entities
list
max_stars_repo_path
stringlengths
6
131
max_stars_repo_name
stringlengths
9
67
max_stars_count
int64
0
17k
content
stringlengths
25
1M
id
stringlengths
1
5
new_content
stringlengths
17
1M
modified
bool
1 class
references
stringlengths
32
1M
[ { "context": "--\n-- Copyright (c) 2015, John Leimon <[email protected]>\n--\n-- Permission to use, cop", "end": 38, "score": 0.9997910857200623, "start": 27, "tag": "NAME", "value": "John Leimon" }, { "context": "--\n-- Copyright (c) 2015, John Leimon <[email protected]>\n--\n-- Permission to use, copy, modify, and/or d", "end": 57, "score": 0.9999232292175293, "start": 40, "tag": "EMAIL", "value": "[email protected]" } ]
pixy/src/host/pantilt_in_ada/specs/x86_64_linux_gnu_sys_sysmacros_h.ads
GambuzX/Pixy-SIW
1
-- -- Copyright (c) 2015, John Leimon <[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. -- pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; package x86_64_linux_gnu_sys_sysmacros_h is -- arg-macro: procedure major (dev) -- gnu_dev_major (dev) -- arg-macro: procedure minor (dev) -- gnu_dev_minor (dev) -- arg-macro: procedure makedev (maj, min) -- gnu_dev_makedev (maj, min) function gnu_dev_major (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:27 pragma Import (C, gnu_dev_major, "gnu_dev_major"); function gnu_dev_minor (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:30 pragma Import (C, gnu_dev_minor, "gnu_dev_minor"); function gnu_dev_makedev (uu_major : unsigned; uu_minor : unsigned) return Extensions.unsigned_long_long; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:33 pragma Import (C, gnu_dev_makedev, "gnu_dev_makedev"); end x86_64_linux_gnu_sys_sysmacros_h;
23353
-- -- Copyright (c) 2015, <NAME> <<EMAIL>> -- -- 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. -- pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; package x86_64_linux_gnu_sys_sysmacros_h is -- arg-macro: procedure major (dev) -- gnu_dev_major (dev) -- arg-macro: procedure minor (dev) -- gnu_dev_minor (dev) -- arg-macro: procedure makedev (maj, min) -- gnu_dev_makedev (maj, min) function gnu_dev_major (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:27 pragma Import (C, gnu_dev_major, "gnu_dev_major"); function gnu_dev_minor (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:30 pragma Import (C, gnu_dev_minor, "gnu_dev_minor"); function gnu_dev_makedev (uu_major : unsigned; uu_minor : unsigned) return Extensions.unsigned_long_long; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:33 pragma Import (C, gnu_dev_makedev, "gnu_dev_makedev"); end x86_64_linux_gnu_sys_sysmacros_h;
true
-- -- Copyright (c) 2015, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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. -- pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; package x86_64_linux_gnu_sys_sysmacros_h is -- arg-macro: procedure major (dev) -- gnu_dev_major (dev) -- arg-macro: procedure minor (dev) -- gnu_dev_minor (dev) -- arg-macro: procedure makedev (maj, min) -- gnu_dev_makedev (maj, min) function gnu_dev_major (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:27 pragma Import (C, gnu_dev_major, "gnu_dev_major"); function gnu_dev_minor (uu_dev : Extensions.unsigned_long_long) return unsigned; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:30 pragma Import (C, gnu_dev_minor, "gnu_dev_minor"); function gnu_dev_makedev (uu_major : unsigned; uu_minor : unsigned) return Extensions.unsigned_long_long; -- /usr/include/x86_64-linux-gnu/sys/sysmacros.h:33 pragma Import (C, gnu_dev_makedev, "gnu_dev_makedev"); end x86_64_linux_gnu_sys_sysmacros_h;
[ { "context": "(11), RM 13.13.2 (37) and\n -- explanations by Tucker Taft\n --\n Last := Item'First - 1;\n -- i", "end": 2608, "score": 0.9997021555900574, "start": 2597, "tag": "NAME", "value": "Tucker Taft" } ]
Sources/Globe_3d/unzip/zip_streams.adb
ForYouEyesOnly/Space-Convoy
1
-- Changes -- -- 11 - Nov - 2009 (GdM) : Unbounded_Stream.Write and .Set_Index are buffered -- 18 - Jan - 2009 (GdM) : Fixed Read (Stream, Item .. .) which read -- only 1st element of Item -- with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; -- with Ada.Text_IO; -- use Ada.Text_IO; with Zip; package body Zip_Streams is procedure Set_Name (S : access Root_Zipstream_Type; Stream_Name : String) is begin S.all.Name := To_Unbounded_String (Stream_Name); end Set_Name; function Get_Name (S : access Root_Zipstream_Type) return String is (To_String (S.all.Name)); procedure Set_Time (S : access Root_Zipstream_Type; Modification_Time : Time) is begin S.all.Modification_Time := Modification_Time; end Set_Time; function Get_Time (S : access Root_Zipstream_Type) return Time is (S.all.Modification_Time); procedure Set_Time (S : Zipstream_Class; Modification_Time : Ada.Calendar.Time) is begin Set_Time (S, Calendar.Convert (Modification_Time)); end Set_Time; function Get_Time (S : Zipstream_Class) return Ada.Calendar.Time is (Calendar.Convert (Get_Time (S))); procedure Set_Unicode_Name_Flag (S : access Root_Zipstream_Type; Value : Boolean) is begin S.all.Is_Unicode_Name := Value; end Set_Unicode_Name_Flag; function Is_Unicode_Name (S : access Root_Zipstream_Type) return Boolean is (S.all.Is_Unicode_Name); --------------------------------------------------------------------- -- Unbounded_Stream : stream based on an in - memory Unbounded_String -- --------------------------------------------------------------------- procedure Get (Str : Memory_Zipstream; Unb : out Unbounded_String) is begin Unb := Str.Unb; end Get; procedure Set (Str : in out Memory_Zipstream; Unb : Unbounded_String) is begin Str.Unb := Null_Unbounded_String; -- clear the content of the stream Str.Unb := Unb; Str.Loc := 1; end Set; overriding procedure Read (Zip_Stream : in out Memory_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin -- Item is read from the stream. If (and only if) the stream is -- exhausted, Last will be < Item'Last. In that case, T'Read will -- raise an End_Error exception. -- -- Cf : RM 13.13.1 (8), RM 13.13.1 (11), RM 13.13.2 (37) and -- explanations by Tucker Taft -- Last := Item'First - 1; -- if Item is empty, the following loop is skipped; if Stream.Loc -- is already indexing out of Stream.Unb, that value is also appropriate for i in Item'Range loop Item (i) := Character'Pos (Element (Zip_Stream.Unb, Zip_Stream.Loc)); Zip_Stream.Loc := Zip_Stream.Loc + 1; Last := i; end loop; exception when Ada.Strings.Index_Error => null; -- what could be read has been read; T'Read will raise End_Error end Read; max_chunk_size : constant := 16 * 1024; overriding procedure Write (Zip_Stream : in out Memory_Zipstream; Item : Stream_Element_Array) is I : Stream_Element_Offset := Item'First; chunk_size : Integer; tmp : String (1 .. max_chunk_size); begin while I <= Item'Last loop chunk_size := Integer'Min (Integer (Item'Last - I + 1), max_chunk_size); if Zip_Stream.Loc > Length (Zip_Stream.Unb) then -- . .. we are off the string's bounds, we need to extend it. for J in 1 .. chunk_size loop tmp (J) := Character'Val (Item (I)); I := I + 1; end loop; Append (Zip_Stream.Unb, tmp (1 .. chunk_size)); else -- . .. we can work (at least for a part) within the string's bounds. chunk_size := Integer'Min (chunk_size, Length (Zip_Stream.Unb) - Zip_Stream.Loc + 1); for J in 0 .. chunk_size - 1 loop Replace_Element (Zip_Stream.Unb, Zip_Stream.Loc + J, Character'Val (Item (I))); -- GNAT 2008's Replace_Slice does something very general -- even in the trivial case where one can make: -- Source.Reference (Low .. High) := By; -- - > still faster with elem by elem replacement -- Anyway, this place is not critical for zipping : only the -- local header before compressed data is rewritten after -- compression. So usually, we are off bounds. I := I + 1; end loop; end if; Zip_Stream.Loc := Zip_Stream.Loc + chunk_size; end loop; end Write; overriding procedure Set_Index (S : access Memory_Zipstream; To : Positive) is I, chunk_size : Integer; begin if To > Length (S.all.Unb) then -- . .. we are off the string's bounds, we need to extend it. I := Length (S.all.Unb) + 1; while I <= To loop chunk_size := Integer'Min (To - I + 1, max_chunk_size); Append (S.all.Unb, (1 .. chunk_size => ASCII.NUL)); I := I + chunk_size; end loop; end if; S.all.Loc := To; end Set_Index; overriding function Size (S : access Memory_Zipstream) return Integer is (Length (S.all.Unb)); overriding function Index (S : access Memory_Zipstream) return Integer is (S.all.Loc); overriding function End_Of_Stream (S : access Memory_Zipstream) return Boolean is begin if Size (S) < Index (S) then return True; else return False; end if; end End_Of_Stream; -------------------------------------------- -- File_Zipstream : stream based on a file -- -------------------------------------------- procedure Open (Str : in out File_Zipstream; Zipfile_Mode : File_Mode) is begin Ada.Streams.Stream_IO.Open (Str.File, Zipfile_Mode, To_String (Str.Name), Form => To_String (Zip.Form_For_IO_Open_N_Create)); end Open; procedure Create (Str : in out File_Zipstream; Zipfile_Mode : File_Mode) is begin Ada.Streams.Stream_IO.Create (Str.File, Zipfile_Mode, To_String (Str.Name), Form => To_String (Zip.Form_For_IO_Open_N_Create)); end Create; procedure Close (Str : in out File_Zipstream) is begin Ada.Streams.Stream_IO.Close (Str.File); end Close; overriding procedure Read (Zip_Stream : in out File_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin Ada.Streams.Stream_IO.Read (Zip_Stream.File, Item, Last); end Read; overriding procedure Write (Zip_Stream : in out File_Zipstream; Item : Stream_Element_Array) is begin Ada.Streams.Stream_IO.Write (Zip_Stream.File, Item); end Write; overriding procedure Set_Index (S : access File_Zipstream; To : Positive) is begin Ada.Streams.Stream_IO.Set_Index (S.all.File, Positive_Count (To)); end Set_Index; overriding function Size (S : access File_Zipstream) return Integer is (Integer (Ada.Streams.Stream_IO.Size (S.all.File))); overriding function Index (S : access File_Zipstream) return Integer is (Integer (Ada.Streams.Stream_IO.Index (S.all.File))); overriding function End_Of_Stream (S : access File_Zipstream) return Boolean is (Ada.Streams.Stream_IO.End_Of_File (S.all.File)); package body Calendar is ----------------------------------------------- -- Time = DOS Time. Valid through Year 2107. -- ----------------------------------------------- procedure Split (Date : Time; Year_Num : out Year_Number; Month_Num : out Month_Number; Day_Num : out Day_Number; No_of_Seconds : out Day_Duration) is d_date : constant Integer := Integer (Date / 65536); d_time : constant Integer := Integer (Date and 65535); use Interfaces; hours : Integer; minutes : Integer; seconds_only : Integer; begin Year_Num := 1980 + d_date / 512; Month_Num := (d_date / 32) mod 16; Day_Num := d_date mod 32; hours := d_time / 2048; minutes := (d_time / 32) mod 64; seconds_only := 2 * (d_time mod 32); No_of_Seconds := Day_Duration (hours * 3600 + minutes * 60 + seconds_only); end Split; -- function Time_Of (Year_Num : Year_Number; Month_Num : Month_Number; Day_Num : Day_Number; No_of_Seconds : Day_Duration := 0.0) return Time is year_2 : Integer := Year_Num; use Interfaces; hours : Unsigned_32; minutes : Unsigned_32; seconds_only : Unsigned_32; seconds_day : Unsigned_32; result : Unsigned_32; begin if year_2 < 1980 then -- avoid invalid DOS date year_2 := 1980; end if; seconds_day := Unsigned_32 (No_of_Seconds); hours := seconds_day / 3600; minutes := (seconds_day / 60) mod 60; seconds_only := seconds_day mod 60; result := -- MSDN formula for encoding: Unsigned_32 ((year_2 - 1980) * 512 + Month_Num * 32 + Day_Num) * 65536 -- Date + hours * 2048 + minutes * 32 + seconds_only / 2; -- Time return Time (result); end Time_Of; function Convert (date : Ada.Calendar.Time) return Time is year_num : Year_Number; month_num : Month_Number; day_num : Day_Number; seconds_day_dur : Day_Duration; begin Split (date, year_num, month_num, day_num, seconds_day_dur); return Time_Of (year_num, month_num, day_num, seconds_day_dur); end Convert; function Convert (date : Time) return Ada.Calendar.Time is year_num : Year_Number; month_num : Month_Number; day_num : Day_Number; seconds_day_dur : Day_Duration; begin Split (date, year_num, month_num, day_num, seconds_day_dur); return Time_Of (year_num, month_num, day_num, seconds_day_dur); end Convert; function Convert (date : DOS_Time) return Time is (Time (date)); -- currently a trivial conversion function Convert (date : Time) return DOS_Time is (DOS_Time (date)); -- currently a trivial conversion end Calendar; end Zip_Streams;
23717
-- Changes -- -- 11 - Nov - 2009 (GdM) : Unbounded_Stream.Write and .Set_Index are buffered -- 18 - Jan - 2009 (GdM) : Fixed Read (Stream, Item .. .) which read -- only 1st element of Item -- with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; -- with Ada.Text_IO; -- use Ada.Text_IO; with Zip; package body Zip_Streams is procedure Set_Name (S : access Root_Zipstream_Type; Stream_Name : String) is begin S.all.Name := To_Unbounded_String (Stream_Name); end Set_Name; function Get_Name (S : access Root_Zipstream_Type) return String is (To_String (S.all.Name)); procedure Set_Time (S : access Root_Zipstream_Type; Modification_Time : Time) is begin S.all.Modification_Time := Modification_Time; end Set_Time; function Get_Time (S : access Root_Zipstream_Type) return Time is (S.all.Modification_Time); procedure Set_Time (S : Zipstream_Class; Modification_Time : Ada.Calendar.Time) is begin Set_Time (S, Calendar.Convert (Modification_Time)); end Set_Time; function Get_Time (S : Zipstream_Class) return Ada.Calendar.Time is (Calendar.Convert (Get_Time (S))); procedure Set_Unicode_Name_Flag (S : access Root_Zipstream_Type; Value : Boolean) is begin S.all.Is_Unicode_Name := Value; end Set_Unicode_Name_Flag; function Is_Unicode_Name (S : access Root_Zipstream_Type) return Boolean is (S.all.Is_Unicode_Name); --------------------------------------------------------------------- -- Unbounded_Stream : stream based on an in - memory Unbounded_String -- --------------------------------------------------------------------- procedure Get (Str : Memory_Zipstream; Unb : out Unbounded_String) is begin Unb := Str.Unb; end Get; procedure Set (Str : in out Memory_Zipstream; Unb : Unbounded_String) is begin Str.Unb := Null_Unbounded_String; -- clear the content of the stream Str.Unb := Unb; Str.Loc := 1; end Set; overriding procedure Read (Zip_Stream : in out Memory_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin -- Item is read from the stream. If (and only if) the stream is -- exhausted, Last will be < Item'Last. In that case, T'Read will -- raise an End_Error exception. -- -- Cf : RM 13.13.1 (8), RM 13.13.1 (11), RM 13.13.2 (37) and -- explanations by <NAME> -- Last := Item'First - 1; -- if Item is empty, the following loop is skipped; if Stream.Loc -- is already indexing out of Stream.Unb, that value is also appropriate for i in Item'Range loop Item (i) := Character'Pos (Element (Zip_Stream.Unb, Zip_Stream.Loc)); Zip_Stream.Loc := Zip_Stream.Loc + 1; Last := i; end loop; exception when Ada.Strings.Index_Error => null; -- what could be read has been read; T'Read will raise End_Error end Read; max_chunk_size : constant := 16 * 1024; overriding procedure Write (Zip_Stream : in out Memory_Zipstream; Item : Stream_Element_Array) is I : Stream_Element_Offset := Item'First; chunk_size : Integer; tmp : String (1 .. max_chunk_size); begin while I <= Item'Last loop chunk_size := Integer'Min (Integer (Item'Last - I + 1), max_chunk_size); if Zip_Stream.Loc > Length (Zip_Stream.Unb) then -- . .. we are off the string's bounds, we need to extend it. for J in 1 .. chunk_size loop tmp (J) := Character'Val (Item (I)); I := I + 1; end loop; Append (Zip_Stream.Unb, tmp (1 .. chunk_size)); else -- . .. we can work (at least for a part) within the string's bounds. chunk_size := Integer'Min (chunk_size, Length (Zip_Stream.Unb) - Zip_Stream.Loc + 1); for J in 0 .. chunk_size - 1 loop Replace_Element (Zip_Stream.Unb, Zip_Stream.Loc + J, Character'Val (Item (I))); -- GNAT 2008's Replace_Slice does something very general -- even in the trivial case where one can make: -- Source.Reference (Low .. High) := By; -- - > still faster with elem by elem replacement -- Anyway, this place is not critical for zipping : only the -- local header before compressed data is rewritten after -- compression. So usually, we are off bounds. I := I + 1; end loop; end if; Zip_Stream.Loc := Zip_Stream.Loc + chunk_size; end loop; end Write; overriding procedure Set_Index (S : access Memory_Zipstream; To : Positive) is I, chunk_size : Integer; begin if To > Length (S.all.Unb) then -- . .. we are off the string's bounds, we need to extend it. I := Length (S.all.Unb) + 1; while I <= To loop chunk_size := Integer'Min (To - I + 1, max_chunk_size); Append (S.all.Unb, (1 .. chunk_size => ASCII.NUL)); I := I + chunk_size; end loop; end if; S.all.Loc := To; end Set_Index; overriding function Size (S : access Memory_Zipstream) return Integer is (Length (S.all.Unb)); overriding function Index (S : access Memory_Zipstream) return Integer is (S.all.Loc); overriding function End_Of_Stream (S : access Memory_Zipstream) return Boolean is begin if Size (S) < Index (S) then return True; else return False; end if; end End_Of_Stream; -------------------------------------------- -- File_Zipstream : stream based on a file -- -------------------------------------------- procedure Open (Str : in out File_Zipstream; Zipfile_Mode : File_Mode) is begin Ada.Streams.Stream_IO.Open (Str.File, Zipfile_Mode, To_String (Str.Name), Form => To_String (Zip.Form_For_IO_Open_N_Create)); end Open; procedure Create (Str : in out File_Zipstream; Zipfile_Mode : File_Mode) is begin Ada.Streams.Stream_IO.Create (Str.File, Zipfile_Mode, To_String (Str.Name), Form => To_String (Zip.Form_For_IO_Open_N_Create)); end Create; procedure Close (Str : in out File_Zipstream) is begin Ada.Streams.Stream_IO.Close (Str.File); end Close; overriding procedure Read (Zip_Stream : in out File_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin Ada.Streams.Stream_IO.Read (Zip_Stream.File, Item, Last); end Read; overriding procedure Write (Zip_Stream : in out File_Zipstream; Item : Stream_Element_Array) is begin Ada.Streams.Stream_IO.Write (Zip_Stream.File, Item); end Write; overriding procedure Set_Index (S : access File_Zipstream; To : Positive) is begin Ada.Streams.Stream_IO.Set_Index (S.all.File, Positive_Count (To)); end Set_Index; overriding function Size (S : access File_Zipstream) return Integer is (Integer (Ada.Streams.Stream_IO.Size (S.all.File))); overriding function Index (S : access File_Zipstream) return Integer is (Integer (Ada.Streams.Stream_IO.Index (S.all.File))); overriding function End_Of_Stream (S : access File_Zipstream) return Boolean is (Ada.Streams.Stream_IO.End_Of_File (S.all.File)); package body Calendar is ----------------------------------------------- -- Time = DOS Time. Valid through Year 2107. -- ----------------------------------------------- procedure Split (Date : Time; Year_Num : out Year_Number; Month_Num : out Month_Number; Day_Num : out Day_Number; No_of_Seconds : out Day_Duration) is d_date : constant Integer := Integer (Date / 65536); d_time : constant Integer := Integer (Date and 65535); use Interfaces; hours : Integer; minutes : Integer; seconds_only : Integer; begin Year_Num := 1980 + d_date / 512; Month_Num := (d_date / 32) mod 16; Day_Num := d_date mod 32; hours := d_time / 2048; minutes := (d_time / 32) mod 64; seconds_only := 2 * (d_time mod 32); No_of_Seconds := Day_Duration (hours * 3600 + minutes * 60 + seconds_only); end Split; -- function Time_Of (Year_Num : Year_Number; Month_Num : Month_Number; Day_Num : Day_Number; No_of_Seconds : Day_Duration := 0.0) return Time is year_2 : Integer := Year_Num; use Interfaces; hours : Unsigned_32; minutes : Unsigned_32; seconds_only : Unsigned_32; seconds_day : Unsigned_32; result : Unsigned_32; begin if year_2 < 1980 then -- avoid invalid DOS date year_2 := 1980; end if; seconds_day := Unsigned_32 (No_of_Seconds); hours := seconds_day / 3600; minutes := (seconds_day / 60) mod 60; seconds_only := seconds_day mod 60; result := -- MSDN formula for encoding: Unsigned_32 ((year_2 - 1980) * 512 + Month_Num * 32 + Day_Num) * 65536 -- Date + hours * 2048 + minutes * 32 + seconds_only / 2; -- Time return Time (result); end Time_Of; function Convert (date : Ada.Calendar.Time) return Time is year_num : Year_Number; month_num : Month_Number; day_num : Day_Number; seconds_day_dur : Day_Duration; begin Split (date, year_num, month_num, day_num, seconds_day_dur); return Time_Of (year_num, month_num, day_num, seconds_day_dur); end Convert; function Convert (date : Time) return Ada.Calendar.Time is year_num : Year_Number; month_num : Month_Number; day_num : Day_Number; seconds_day_dur : Day_Duration; begin Split (date, year_num, month_num, day_num, seconds_day_dur); return Time_Of (year_num, month_num, day_num, seconds_day_dur); end Convert; function Convert (date : DOS_Time) return Time is (Time (date)); -- currently a trivial conversion function Convert (date : Time) return DOS_Time is (DOS_Time (date)); -- currently a trivial conversion end Calendar; end Zip_Streams;
true
-- Changes -- -- 11 - Nov - 2009 (GdM) : Unbounded_Stream.Write and .Set_Index are buffered -- 18 - Jan - 2009 (GdM) : Fixed Read (Stream, Item .. .) which read -- only 1st element of Item -- with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; -- with Ada.Text_IO; -- use Ada.Text_IO; with Zip; package body Zip_Streams is procedure Set_Name (S : access Root_Zipstream_Type; Stream_Name : String) is begin S.all.Name := To_Unbounded_String (Stream_Name); end Set_Name; function Get_Name (S : access Root_Zipstream_Type) return String is (To_String (S.all.Name)); procedure Set_Time (S : access Root_Zipstream_Type; Modification_Time : Time) is begin S.all.Modification_Time := Modification_Time; end Set_Time; function Get_Time (S : access Root_Zipstream_Type) return Time is (S.all.Modification_Time); procedure Set_Time (S : Zipstream_Class; Modification_Time : Ada.Calendar.Time) is begin Set_Time (S, Calendar.Convert (Modification_Time)); end Set_Time; function Get_Time (S : Zipstream_Class) return Ada.Calendar.Time is (Calendar.Convert (Get_Time (S))); procedure Set_Unicode_Name_Flag (S : access Root_Zipstream_Type; Value : Boolean) is begin S.all.Is_Unicode_Name := Value; end Set_Unicode_Name_Flag; function Is_Unicode_Name (S : access Root_Zipstream_Type) return Boolean is (S.all.Is_Unicode_Name); --------------------------------------------------------------------- -- Unbounded_Stream : stream based on an in - memory Unbounded_String -- --------------------------------------------------------------------- procedure Get (Str : Memory_Zipstream; Unb : out Unbounded_String) is begin Unb := Str.Unb; end Get; procedure Set (Str : in out Memory_Zipstream; Unb : Unbounded_String) is begin Str.Unb := Null_Unbounded_String; -- clear the content of the stream Str.Unb := Unb; Str.Loc := 1; end Set; overriding procedure Read (Zip_Stream : in out Memory_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin -- Item is read from the stream. If (and only if) the stream is -- exhausted, Last will be < Item'Last. In that case, T'Read will -- raise an End_Error exception. -- -- Cf : RM 13.13.1 (8), RM 13.13.1 (11), RM 13.13.2 (37) and -- explanations by PI:NAME:<NAME>END_PI -- Last := Item'First - 1; -- if Item is empty, the following loop is skipped; if Stream.Loc -- is already indexing out of Stream.Unb, that value is also appropriate for i in Item'Range loop Item (i) := Character'Pos (Element (Zip_Stream.Unb, Zip_Stream.Loc)); Zip_Stream.Loc := Zip_Stream.Loc + 1; Last := i; end loop; exception when Ada.Strings.Index_Error => null; -- what could be read has been read; T'Read will raise End_Error end Read; max_chunk_size : constant := 16 * 1024; overriding procedure Write (Zip_Stream : in out Memory_Zipstream; Item : Stream_Element_Array) is I : Stream_Element_Offset := Item'First; chunk_size : Integer; tmp : String (1 .. max_chunk_size); begin while I <= Item'Last loop chunk_size := Integer'Min (Integer (Item'Last - I + 1), max_chunk_size); if Zip_Stream.Loc > Length (Zip_Stream.Unb) then -- . .. we are off the string's bounds, we need to extend it. for J in 1 .. chunk_size loop tmp (J) := Character'Val (Item (I)); I := I + 1; end loop; Append (Zip_Stream.Unb, tmp (1 .. chunk_size)); else -- . .. we can work (at least for a part) within the string's bounds. chunk_size := Integer'Min (chunk_size, Length (Zip_Stream.Unb) - Zip_Stream.Loc + 1); for J in 0 .. chunk_size - 1 loop Replace_Element (Zip_Stream.Unb, Zip_Stream.Loc + J, Character'Val (Item (I))); -- GNAT 2008's Replace_Slice does something very general -- even in the trivial case where one can make: -- Source.Reference (Low .. High) := By; -- - > still faster with elem by elem replacement -- Anyway, this place is not critical for zipping : only the -- local header before compressed data is rewritten after -- compression. So usually, we are off bounds. I := I + 1; end loop; end if; Zip_Stream.Loc := Zip_Stream.Loc + chunk_size; end loop; end Write; overriding procedure Set_Index (S : access Memory_Zipstream; To : Positive) is I, chunk_size : Integer; begin if To > Length (S.all.Unb) then -- . .. we are off the string's bounds, we need to extend it. I := Length (S.all.Unb) + 1; while I <= To loop chunk_size := Integer'Min (To - I + 1, max_chunk_size); Append (S.all.Unb, (1 .. chunk_size => ASCII.NUL)); I := I + chunk_size; end loop; end if; S.all.Loc := To; end Set_Index; overriding function Size (S : access Memory_Zipstream) return Integer is (Length (S.all.Unb)); overriding function Index (S : access Memory_Zipstream) return Integer is (S.all.Loc); overriding function End_Of_Stream (S : access Memory_Zipstream) return Boolean is begin if Size (S) < Index (S) then return True; else return False; end if; end End_Of_Stream; -------------------------------------------- -- File_Zipstream : stream based on a file -- -------------------------------------------- procedure Open (Str : in out File_Zipstream; Zipfile_Mode : File_Mode) is begin Ada.Streams.Stream_IO.Open (Str.File, Zipfile_Mode, To_String (Str.Name), Form => To_String (Zip.Form_For_IO_Open_N_Create)); end Open; procedure Create (Str : in out File_Zipstream; Zipfile_Mode : File_Mode) is begin Ada.Streams.Stream_IO.Create (Str.File, Zipfile_Mode, To_String (Str.Name), Form => To_String (Zip.Form_For_IO_Open_N_Create)); end Create; procedure Close (Str : in out File_Zipstream) is begin Ada.Streams.Stream_IO.Close (Str.File); end Close; overriding procedure Read (Zip_Stream : in out File_Zipstream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset) is begin Ada.Streams.Stream_IO.Read (Zip_Stream.File, Item, Last); end Read; overriding procedure Write (Zip_Stream : in out File_Zipstream; Item : Stream_Element_Array) is begin Ada.Streams.Stream_IO.Write (Zip_Stream.File, Item); end Write; overriding procedure Set_Index (S : access File_Zipstream; To : Positive) is begin Ada.Streams.Stream_IO.Set_Index (S.all.File, Positive_Count (To)); end Set_Index; overriding function Size (S : access File_Zipstream) return Integer is (Integer (Ada.Streams.Stream_IO.Size (S.all.File))); overriding function Index (S : access File_Zipstream) return Integer is (Integer (Ada.Streams.Stream_IO.Index (S.all.File))); overriding function End_Of_Stream (S : access File_Zipstream) return Boolean is (Ada.Streams.Stream_IO.End_Of_File (S.all.File)); package body Calendar is ----------------------------------------------- -- Time = DOS Time. Valid through Year 2107. -- ----------------------------------------------- procedure Split (Date : Time; Year_Num : out Year_Number; Month_Num : out Month_Number; Day_Num : out Day_Number; No_of_Seconds : out Day_Duration) is d_date : constant Integer := Integer (Date / 65536); d_time : constant Integer := Integer (Date and 65535); use Interfaces; hours : Integer; minutes : Integer; seconds_only : Integer; begin Year_Num := 1980 + d_date / 512; Month_Num := (d_date / 32) mod 16; Day_Num := d_date mod 32; hours := d_time / 2048; minutes := (d_time / 32) mod 64; seconds_only := 2 * (d_time mod 32); No_of_Seconds := Day_Duration (hours * 3600 + minutes * 60 + seconds_only); end Split; -- function Time_Of (Year_Num : Year_Number; Month_Num : Month_Number; Day_Num : Day_Number; No_of_Seconds : Day_Duration := 0.0) return Time is year_2 : Integer := Year_Num; use Interfaces; hours : Unsigned_32; minutes : Unsigned_32; seconds_only : Unsigned_32; seconds_day : Unsigned_32; result : Unsigned_32; begin if year_2 < 1980 then -- avoid invalid DOS date year_2 := 1980; end if; seconds_day := Unsigned_32 (No_of_Seconds); hours := seconds_day / 3600; minutes := (seconds_day / 60) mod 60; seconds_only := seconds_day mod 60; result := -- MSDN formula for encoding: Unsigned_32 ((year_2 - 1980) * 512 + Month_Num * 32 + Day_Num) * 65536 -- Date + hours * 2048 + minutes * 32 + seconds_only / 2; -- Time return Time (result); end Time_Of; function Convert (date : Ada.Calendar.Time) return Time is year_num : Year_Number; month_num : Month_Number; day_num : Day_Number; seconds_day_dur : Day_Duration; begin Split (date, year_num, month_num, day_num, seconds_day_dur); return Time_Of (year_num, month_num, day_num, seconds_day_dur); end Convert; function Convert (date : Time) return Ada.Calendar.Time is year_num : Year_Number; month_num : Month_Number; day_num : Day_Number; seconds_day_dur : Day_Duration; begin Split (date, year_num, month_num, day_num, seconds_day_dur); return Time_Of (year_num, month_num, day_num, seconds_day_dur); end Convert; function Convert (date : DOS_Time) return Time is (Time (date)); -- currently a trivial conversion function Convert (date : Time) return DOS_Time is (DOS_Time (date)); -- currently a trivial conversion end Calendar; end Zip_Streams;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998571276664734, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999322891235352, "start": 37, "tag": "EMAIL", "value": "[email protected]" } ]
source/nodes/program-nodes-record_representation_clauses.adb
optikos/oasis
0
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Record_Representation_Clauses is function Create (For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Expressions .Expression_Access; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Record_Token : not null Program.Lexical_Elements .Lexical_Element_Access; At_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access; Mod_Semicolon_Token : Program.Lexical_Elements.Lexical_Element_Access; Component_Clauses : not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Record_Representation_Clause is begin return Result : Record_Representation_Clause := (For_Token => For_Token, Name => Name, Use_Token => Use_Token, Record_Token => Record_Token, At_Token => At_Token, Mod_Token => Mod_Token, Mod_Clause_Expression => Mod_Clause_Expression, Mod_Semicolon_Token => Mod_Semicolon_Token, Component_Clauses => Component_Clauses, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Expressions .Expression_Access; Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access; Component_Clauses : not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Record_Representation_Clause is begin return Result : Implicit_Record_Representation_Clause := (Name => Name, Mod_Clause_Expression => Mod_Clause_Expression, Component_Clauses => Component_Clauses, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Name (Self : Base_Record_Representation_Clause) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Name; end Name; overriding function Mod_Clause_Expression (Self : Base_Record_Representation_Clause) return Program.Elements.Expressions.Expression_Access is begin return Self.Mod_Clause_Expression; end Mod_Clause_Expression; overriding function Component_Clauses (Self : Base_Record_Representation_Clause) return not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access is begin return Self.Component_Clauses; end Component_Clauses; overriding function For_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.For_Token; end For_Token; overriding function Use_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Use_Token; end Use_Token; overriding function Record_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Record_Token; end Record_Token; overriding function At_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.At_Token; end At_Token; overriding function Mod_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Mod_Token; end Mod_Token; overriding function Mod_Semicolon_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Mod_Semicolon_Token; end Mod_Semicolon_Token; overriding function Semicolon_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Record_Representation_Clause'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); if Self.Mod_Clause_Expression.Assigned then Set_Enclosing_Element (Self.Mod_Clause_Expression, Self'Unchecked_Access); end if; for Item in Self.Component_Clauses.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Record_Representation_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Record_Representation_Clause_Element; overriding function Is_Representation_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Representation_Clause_Element; overriding function Is_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Clause_Element; overriding procedure Visit (Self : not null access Base_Record_Representation_Clause; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Record_Representation_Clause (Self); end Visit; overriding function To_Record_Representation_Clause_Text (Self : aliased in out Record_Representation_Clause) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Text_Access is begin return Self'Unchecked_Access; end To_Record_Representation_Clause_Text; overriding function To_Record_Representation_Clause_Text (Self : aliased in out Implicit_Record_Representation_Clause) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Text_Access is pragma Unreferenced (Self); begin return null; end To_Record_Representation_Clause_Text; end Program.Nodes.Record_Representation_Clauses;
10968
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Record_Representation_Clauses is function Create (For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Expressions .Expression_Access; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Record_Token : not null Program.Lexical_Elements .Lexical_Element_Access; At_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access; Mod_Semicolon_Token : Program.Lexical_Elements.Lexical_Element_Access; Component_Clauses : not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Record_Representation_Clause is begin return Result : Record_Representation_Clause := (For_Token => For_Token, Name => Name, Use_Token => Use_Token, Record_Token => Record_Token, At_Token => At_Token, Mod_Token => Mod_Token, Mod_Clause_Expression => Mod_Clause_Expression, Mod_Semicolon_Token => Mod_Semicolon_Token, Component_Clauses => Component_Clauses, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Expressions .Expression_Access; Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access; Component_Clauses : not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Record_Representation_Clause is begin return Result : Implicit_Record_Representation_Clause := (Name => Name, Mod_Clause_Expression => Mod_Clause_Expression, Component_Clauses => Component_Clauses, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Name (Self : Base_Record_Representation_Clause) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Name; end Name; overriding function Mod_Clause_Expression (Self : Base_Record_Representation_Clause) return Program.Elements.Expressions.Expression_Access is begin return Self.Mod_Clause_Expression; end Mod_Clause_Expression; overriding function Component_Clauses (Self : Base_Record_Representation_Clause) return not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access is begin return Self.Component_Clauses; end Component_Clauses; overriding function For_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.For_Token; end For_Token; overriding function Use_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Use_Token; end Use_Token; overriding function Record_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Record_Token; end Record_Token; overriding function At_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.At_Token; end At_Token; overriding function Mod_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Mod_Token; end Mod_Token; overriding function Mod_Semicolon_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Mod_Semicolon_Token; end Mod_Semicolon_Token; overriding function Semicolon_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Record_Representation_Clause'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); if Self.Mod_Clause_Expression.Assigned then Set_Enclosing_Element (Self.Mod_Clause_Expression, Self'Unchecked_Access); end if; for Item in Self.Component_Clauses.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Record_Representation_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Record_Representation_Clause_Element; overriding function Is_Representation_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Representation_Clause_Element; overriding function Is_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Clause_Element; overriding procedure Visit (Self : not null access Base_Record_Representation_Clause; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Record_Representation_Clause (Self); end Visit; overriding function To_Record_Representation_Clause_Text (Self : aliased in out Record_Representation_Clause) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Text_Access is begin return Self'Unchecked_Access; end To_Record_Representation_Clause_Text; overriding function To_Record_Representation_Clause_Text (Self : aliased in out Implicit_Record_Representation_Clause) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Text_Access is pragma Unreferenced (Self); begin return null; end To_Record_Representation_Clause_Text; end Program.Nodes.Record_Representation_Clauses;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Record_Representation_Clauses is function Create (For_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Expressions .Expression_Access; Use_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Record_Token : not null Program.Lexical_Elements .Lexical_Element_Access; At_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Token : Program.Lexical_Elements.Lexical_Element_Access; Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access; Mod_Semicolon_Token : Program.Lexical_Elements.Lexical_Element_Access; Component_Clauses : not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Record_Representation_Clause is begin return Result : Record_Representation_Clause := (For_Token => For_Token, Name => Name, Use_Token => Use_Token, Record_Token => Record_Token, At_Token => At_Token, Mod_Token => Mod_Token, Mod_Clause_Expression => Mod_Clause_Expression, Mod_Semicolon_Token => Mod_Semicolon_Token, Component_Clauses => Component_Clauses, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Expressions .Expression_Access; Mod_Clause_Expression : Program.Elements.Expressions.Expression_Access; Component_Clauses : not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Record_Representation_Clause is begin return Result : Implicit_Record_Representation_Clause := (Name => Name, Mod_Clause_Expression => Mod_Clause_Expression, Component_Clauses => Component_Clauses, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Name (Self : Base_Record_Representation_Clause) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Name; end Name; overriding function Mod_Clause_Expression (Self : Base_Record_Representation_Clause) return Program.Elements.Expressions.Expression_Access is begin return Self.Mod_Clause_Expression; end Mod_Clause_Expression; overriding function Component_Clauses (Self : Base_Record_Representation_Clause) return not null Program.Elements.Component_Clauses .Component_Clause_Vector_Access is begin return Self.Component_Clauses; end Component_Clauses; overriding function For_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.For_Token; end For_Token; overriding function Use_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Use_Token; end Use_Token; overriding function Record_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Record_Token; end Record_Token; overriding function At_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.At_Token; end At_Token; overriding function Mod_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Mod_Token; end Mod_Token; overriding function Mod_Semicolon_Token (Self : Record_Representation_Clause) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Mod_Semicolon_Token; end Mod_Semicolon_Token; overriding function Semicolon_Token (Self : Record_Representation_Clause) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Record_Representation_Clause) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Record_Representation_Clause'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); if Self.Mod_Clause_Expression.Assigned then Set_Enclosing_Element (Self.Mod_Clause_Expression, Self'Unchecked_Access); end if; for Item in Self.Component_Clauses.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Record_Representation_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Record_Representation_Clause_Element; overriding function Is_Representation_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Representation_Clause_Element; overriding function Is_Clause_Element (Self : Base_Record_Representation_Clause) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Clause_Element; overriding procedure Visit (Self : not null access Base_Record_Representation_Clause; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Record_Representation_Clause (Self); end Visit; overriding function To_Record_Representation_Clause_Text (Self : aliased in out Record_Representation_Clause) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Text_Access is begin return Self'Unchecked_Access; end To_Record_Representation_Clause_Text; overriding function To_Record_Representation_Clause_Text (Self : aliased in out Implicit_Record_Representation_Clause) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Text_Access is pragma Unreferenced (Self); begin return null; end To_Record_Representation_Clause_Text; end Program.Nodes.Record_Representation_Clauses;
[ { "context": "-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 48, "score": 0.9998584985733032, "start": 38, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 68, "score": 0.9999315142631531, "start": 50, "tag": "EMAIL", "value": "[email protected]" } ]
source/contexts/plain/program-node_symbols.adb
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Character_Literals; with Program.Elements.Defining_Character_Literals; with Program.Elements.Defining_Expanded_Names; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Identifiers; with Program.Elements.Operator_Symbols; with Program.Elements.Package_Declarations; with Program.Elements.Procedure_Body_Declarations; with Program.Lexical_Elements; with Program.Plain_Lexical_Elements; with Program.Safe_Element_Visitors; package body Program.Node_Symbols is package Symbol_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Result : Program.Symbols.Symbol := Program.Symbols.No_Symbol; end record; overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access); overriding procedure Defining_Character_Literal (Self : in out Getter; Element : not null Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access); overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access); overriding procedure Defining_Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access); overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access); overriding procedure Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Operator_Symbols .Operator_Symbol_Access); end Symbol_Getters; package body Symbol_Getters is ----------------------- -- Character_Literal -- ----------------------- overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Character_Literal_Text.Character_Literal_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Character_Literal; -------------------------------- -- Defining_Character_Literal -- -------------------------------- overriding procedure Defining_Character_Literal (Self : in out Getter; Element : not null Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Character_Literal_Text.Character_Literal_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Character_Literal; ------------------------- -- Defining_Identifier -- ------------------------- overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Identifier_Text.Identifier_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Identifier; ------------------------------ -- Defining_Operator_Symbol -- ------------------------------ overriding procedure Defining_Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Operator_Symbol_Text.Operator_Symbol_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Operator_Symbol; ---------------- -- Identifier -- ---------------- overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Identifier_Text.Identifier_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Identifier; overriding procedure Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Operator_Symbols .Operator_Symbol_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Operator_Symbol_Text.Operator_Symbol_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Operator_Symbol; end Symbol_Getters; package Name_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access); overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access); end Name_Getters; package body Name_Getters is ----------------------- -- Character_Literal -- ----------------------- overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access) is Symbol : constant Program.Symbols.Symbol := Get_Symbol (Element); begin Self.Table.Find_Or_Create (Suffix => Symbol, Result => Self.Result); end Character_Literal; ---------------- -- Identifier -- ---------------- overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access) is Symbol : constant Program.Symbols.Symbol := Get_Symbol (Element); begin Self.Table.Find_Or_Create (Suffix => Symbol, Result => Self.Result); end Identifier; end Name_Getters; package Defining_Name_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Defining_Expanded_Name (Self : in out Getter; Element : not null Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access); overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access); end Defining_Name_Getters; package body Defining_Name_Getters is ---------------------------- -- Defining_Expanded_Name -- ---------------------------- overriding procedure Defining_Expanded_Name (Self : in out Getter; Element : not null Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access) is Prefix : Program.Symbol_Lists.Symbol_List; Suffix : constant Program.Symbols.Symbol := Get_Symbol (Element.Selector); begin Name_Symbol (Self.Table.all, Element.Prefix, Prefix); Self.Table.Find_Or_Create (Prefix, Suffix, Self.Result); end Defining_Expanded_Name; ------------------------- -- Defining_Identifier -- ------------------------- overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access) is begin Self.Table.Find_Or_Create (Suffix => Program.Node_Symbols.Get_Symbol (Element), Result => Self.Result); end Defining_Identifier; end Defining_Name_Getters; package Unit_Symbols is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Package_Declaration (Self : in out Getter; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access); overriding procedure Procedure_Body_Declaration (Self : in out Getter; Element : not null Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access); end Unit_Symbols; package body Unit_Symbols is overriding procedure Package_Declaration (Self : in out Getter; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access) is begin Defining_Name_Symbol (Self.Table.all, Element.Name, Self.Result); end Package_Declaration; overriding procedure Procedure_Body_Declaration (Self : in out Getter; Element : not null Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access) is begin Defining_Name_Symbol (Self.Table.all, Element.Name, Self.Result); end Procedure_Body_Declaration; end Unit_Symbols; -------------------------- -- Defining_Name_Symbol -- -------------------------- procedure Defining_Name_Symbol (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Element : not null Program.Elements.Defining_Names.Defining_Name_Access; Result : out Program.Symbol_Lists.Symbol_List) is V : Defining_Name_Getters.Getter := (Table => Self'Unchecked_Access, others => <>); begin V.Visit (Element); Result := V.Result; end Defining_Name_Symbol; ---------------- -- Get_Symbol -- ---------------- function Get_Symbol (Name : access Program.Elements.Element'Class) return Program.Symbols.Symbol is G : Symbol_Getters.Getter; begin G.Visit (Name); return G.Result; end Get_Symbol; ----------------- -- Name_Symbol -- ----------------- procedure Name_Symbol (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Element : not null Program.Elements.Expressions.Expression_Access; Result : out Program.Symbol_Lists.Symbol_List) is Getter : Name_Getters.Getter := (Table => Self'Unchecked_Access, others => <>); begin Getter.Visit (Element); Result := Getter.Result; end Name_Symbol; -------------------- -- Unit_Full_Name -- -------------------- procedure Unit_Full_Name (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Unit : not null Program.Compilation_Units.Compilation_Unit_Access; Name : out Program.Symbol_Lists.Symbol_List) is Getter : Unit_Symbols.Getter := (Table => Self'Unchecked_Access, others => <>); begin Getter.Visit (Unit.Unit_Declaration); Name := Getter.Result; end Unit_Full_Name; end Program.Node_Symbols;
27484
-- SPDX-FileCopyrightText: 2020-2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Character_Literals; with Program.Elements.Defining_Character_Literals; with Program.Elements.Defining_Expanded_Names; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Identifiers; with Program.Elements.Operator_Symbols; with Program.Elements.Package_Declarations; with Program.Elements.Procedure_Body_Declarations; with Program.Lexical_Elements; with Program.Plain_Lexical_Elements; with Program.Safe_Element_Visitors; package body Program.Node_Symbols is package Symbol_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Result : Program.Symbols.Symbol := Program.Symbols.No_Symbol; end record; overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access); overriding procedure Defining_Character_Literal (Self : in out Getter; Element : not null Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access); overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access); overriding procedure Defining_Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access); overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access); overriding procedure Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Operator_Symbols .Operator_Symbol_Access); end Symbol_Getters; package body Symbol_Getters is ----------------------- -- Character_Literal -- ----------------------- overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Character_Literal_Text.Character_Literal_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Character_Literal; -------------------------------- -- Defining_Character_Literal -- -------------------------------- overriding procedure Defining_Character_Literal (Self : in out Getter; Element : not null Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Character_Literal_Text.Character_Literal_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Character_Literal; ------------------------- -- Defining_Identifier -- ------------------------- overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Identifier_Text.Identifier_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Identifier; ------------------------------ -- Defining_Operator_Symbol -- ------------------------------ overriding procedure Defining_Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Operator_Symbol_Text.Operator_Symbol_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Operator_Symbol; ---------------- -- Identifier -- ---------------- overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Identifier_Text.Identifier_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Identifier; overriding procedure Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Operator_Symbols .Operator_Symbol_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Operator_Symbol_Text.Operator_Symbol_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Operator_Symbol; end Symbol_Getters; package Name_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access); overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access); end Name_Getters; package body Name_Getters is ----------------------- -- Character_Literal -- ----------------------- overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access) is Symbol : constant Program.Symbols.Symbol := Get_Symbol (Element); begin Self.Table.Find_Or_Create (Suffix => Symbol, Result => Self.Result); end Character_Literal; ---------------- -- Identifier -- ---------------- overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access) is Symbol : constant Program.Symbols.Symbol := Get_Symbol (Element); begin Self.Table.Find_Or_Create (Suffix => Symbol, Result => Self.Result); end Identifier; end Name_Getters; package Defining_Name_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Defining_Expanded_Name (Self : in out Getter; Element : not null Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access); overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access); end Defining_Name_Getters; package body Defining_Name_Getters is ---------------------------- -- Defining_Expanded_Name -- ---------------------------- overriding procedure Defining_Expanded_Name (Self : in out Getter; Element : not null Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access) is Prefix : Program.Symbol_Lists.Symbol_List; Suffix : constant Program.Symbols.Symbol := Get_Symbol (Element.Selector); begin Name_Symbol (Self.Table.all, Element.Prefix, Prefix); Self.Table.Find_Or_Create (Prefix, Suffix, Self.Result); end Defining_Expanded_Name; ------------------------- -- Defining_Identifier -- ------------------------- overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access) is begin Self.Table.Find_Or_Create (Suffix => Program.Node_Symbols.Get_Symbol (Element), Result => Self.Result); end Defining_Identifier; end Defining_Name_Getters; package Unit_Symbols is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Package_Declaration (Self : in out Getter; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access); overriding procedure Procedure_Body_Declaration (Self : in out Getter; Element : not null Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access); end Unit_Symbols; package body Unit_Symbols is overriding procedure Package_Declaration (Self : in out Getter; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access) is begin Defining_Name_Symbol (Self.Table.all, Element.Name, Self.Result); end Package_Declaration; overriding procedure Procedure_Body_Declaration (Self : in out Getter; Element : not null Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access) is begin Defining_Name_Symbol (Self.Table.all, Element.Name, Self.Result); end Procedure_Body_Declaration; end Unit_Symbols; -------------------------- -- Defining_Name_Symbol -- -------------------------- procedure Defining_Name_Symbol (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Element : not null Program.Elements.Defining_Names.Defining_Name_Access; Result : out Program.Symbol_Lists.Symbol_List) is V : Defining_Name_Getters.Getter := (Table => Self'Unchecked_Access, others => <>); begin V.Visit (Element); Result := V.Result; end Defining_Name_Symbol; ---------------- -- Get_Symbol -- ---------------- function Get_Symbol (Name : access Program.Elements.Element'Class) return Program.Symbols.Symbol is G : Symbol_Getters.Getter; begin G.Visit (Name); return G.Result; end Get_Symbol; ----------------- -- Name_Symbol -- ----------------- procedure Name_Symbol (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Element : not null Program.Elements.Expressions.Expression_Access; Result : out Program.Symbol_Lists.Symbol_List) is Getter : Name_Getters.Getter := (Table => Self'Unchecked_Access, others => <>); begin Getter.Visit (Element); Result := Getter.Result; end Name_Symbol; -------------------- -- Unit_Full_Name -- -------------------- procedure Unit_Full_Name (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Unit : not null Program.Compilation_Units.Compilation_Unit_Access; Name : out Program.Symbol_Lists.Symbol_List) is Getter : Unit_Symbols.Getter := (Table => Self'Unchecked_Access, others => <>); begin Getter.Visit (Unit.Unit_Declaration); Name := Getter.Result; end Unit_Full_Name; end Program.Node_Symbols;
true
-- SPDX-FileCopyrightText: 2020-2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Character_Literals; with Program.Elements.Defining_Character_Literals; with Program.Elements.Defining_Expanded_Names; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Identifiers; with Program.Elements.Operator_Symbols; with Program.Elements.Package_Declarations; with Program.Elements.Procedure_Body_Declarations; with Program.Lexical_Elements; with Program.Plain_Lexical_Elements; with Program.Safe_Element_Visitors; package body Program.Node_Symbols is package Symbol_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Result : Program.Symbols.Symbol := Program.Symbols.No_Symbol; end record; overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access); overriding procedure Defining_Character_Literal (Self : in out Getter; Element : not null Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access); overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access); overriding procedure Defining_Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access); overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access); overriding procedure Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Operator_Symbols .Operator_Symbol_Access); end Symbol_Getters; package body Symbol_Getters is ----------------------- -- Character_Literal -- ----------------------- overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Character_Literal_Text.Character_Literal_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Character_Literal; -------------------------------- -- Defining_Character_Literal -- -------------------------------- overriding procedure Defining_Character_Literal (Self : in out Getter; Element : not null Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Character_Literal_Text.Character_Literal_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Character_Literal; ------------------------- -- Defining_Identifier -- ------------------------- overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Identifier_Text.Identifier_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Identifier; ------------------------------ -- Defining_Operator_Symbol -- ------------------------------ overriding procedure Defining_Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Defining_Operator_Symbol_Text.Operator_Symbol_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Defining_Operator_Symbol; ---------------- -- Identifier -- ---------------- overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Identifier_Text.Identifier_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Identifier; overriding procedure Operator_Symbol (Self : in out Getter; Element : not null Program.Elements.Operator_Symbols .Operator_Symbol_Access) is Token : constant Program.Lexical_Elements.Lexical_Element_Access := Element.To_Operator_Symbol_Text.Operator_Symbol_Token; begin Self.Result := Program.Plain_Lexical_Elements.Lexical_Element (Token.all).Symbol; end Operator_Symbol; end Symbol_Getters; package Name_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access); overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access); end Name_Getters; package body Name_Getters is ----------------------- -- Character_Literal -- ----------------------- overriding procedure Character_Literal (Self : in out Getter; Element : not null Program.Elements.Character_Literals .Character_Literal_Access) is Symbol : constant Program.Symbols.Symbol := Get_Symbol (Element); begin Self.Table.Find_Or_Create (Suffix => Symbol, Result => Self.Result); end Character_Literal; ---------------- -- Identifier -- ---------------- overriding procedure Identifier (Self : in out Getter; Element : not null Program.Elements.Identifiers.Identifier_Access) is Symbol : constant Program.Symbols.Symbol := Get_Symbol (Element); begin Self.Table.Find_Or_Create (Suffix => Symbol, Result => Self.Result); end Identifier; end Name_Getters; package Defining_Name_Getters is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Defining_Expanded_Name (Self : in out Getter; Element : not null Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access); overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access); end Defining_Name_Getters; package body Defining_Name_Getters is ---------------------------- -- Defining_Expanded_Name -- ---------------------------- overriding procedure Defining_Expanded_Name (Self : in out Getter; Element : not null Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access) is Prefix : Program.Symbol_Lists.Symbol_List; Suffix : constant Program.Symbols.Symbol := Get_Symbol (Element.Selector); begin Name_Symbol (Self.Table.all, Element.Prefix, Prefix); Self.Table.Find_Or_Create (Prefix, Suffix, Self.Result); end Defining_Expanded_Name; ------------------------- -- Defining_Identifier -- ------------------------- overriding procedure Defining_Identifier (Self : in out Getter; Element : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access) is begin Self.Table.Find_Or_Create (Suffix => Program.Node_Symbols.Get_Symbol (Element), Result => Self.Result); end Defining_Identifier; end Defining_Name_Getters; package Unit_Symbols is type Getter is new Program.Safe_Element_Visitors.Safe_Element_Visitor with record Table : not null access Program.Symbol_Lists.Symbol_List_Table'Class; Result : Program.Symbol_Lists.Symbol_List := Program.Symbol_Lists.Empty_Symbol_List; end record; overriding procedure Package_Declaration (Self : in out Getter; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access); overriding procedure Procedure_Body_Declaration (Self : in out Getter; Element : not null Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access); end Unit_Symbols; package body Unit_Symbols is overriding procedure Package_Declaration (Self : in out Getter; Element : not null Program.Elements.Package_Declarations .Package_Declaration_Access) is begin Defining_Name_Symbol (Self.Table.all, Element.Name, Self.Result); end Package_Declaration; overriding procedure Procedure_Body_Declaration (Self : in out Getter; Element : not null Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access) is begin Defining_Name_Symbol (Self.Table.all, Element.Name, Self.Result); end Procedure_Body_Declaration; end Unit_Symbols; -------------------------- -- Defining_Name_Symbol -- -------------------------- procedure Defining_Name_Symbol (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Element : not null Program.Elements.Defining_Names.Defining_Name_Access; Result : out Program.Symbol_Lists.Symbol_List) is V : Defining_Name_Getters.Getter := (Table => Self'Unchecked_Access, others => <>); begin V.Visit (Element); Result := V.Result; end Defining_Name_Symbol; ---------------- -- Get_Symbol -- ---------------- function Get_Symbol (Name : access Program.Elements.Element'Class) return Program.Symbols.Symbol is G : Symbol_Getters.Getter; begin G.Visit (Name); return G.Result; end Get_Symbol; ----------------- -- Name_Symbol -- ----------------- procedure Name_Symbol (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Element : not null Program.Elements.Expressions.Expression_Access; Result : out Program.Symbol_Lists.Symbol_List) is Getter : Name_Getters.Getter := (Table => Self'Unchecked_Access, others => <>); begin Getter.Visit (Element); Result := Getter.Result; end Name_Symbol; -------------------- -- Unit_Full_Name -- -------------------- procedure Unit_Full_Name (Self : in out Program.Symbol_Lists.Symbol_List_Table'Class; Unit : not null Program.Compilation_Units.Compilation_Unit_Access; Name : out Program.Symbol_Lists.Symbol_List) is Getter : Unit_Symbols.Getter := (Table => Self'Unchecked_Access, others => <>); begin Getter.Visit (Unit.Unit_Declaration); Name := Getter.Result; end Unit_Full_Name; end Program.Node_Symbols;
[ { "context": "----------------------\n-- Copyright (c) 2015-2017, Natacha Porté --\n-- ", "end": 120, "score": 0.9998463988304138, "start": 107, "tag": "NAME", "value": "Natacha Porté" } ]
src/lithium-line_parsers.adb
faelys/lithium3
1
------------------------------------------------------------------------------ -- Copyright (c) 2015-2017, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ package body Lithium.Line_Parsers is procedure Append_Line (Line : in out Natools.S_Expressions.Atom_Buffers.Atom_Buffer; Source : in out Ada.Streams.Root_Stream_Type'Class; Finished : out Boolean) is Buffer : Ada.Streams.Stream_Element_Array (1 .. 1); Last : Ada.Streams.Stream_Element_Offset; begin Finished := False; loop Source.Read (Buffer, Last); if Last not in Buffer'Range then Finished := True; exit; end if; Line.Append (Buffer (Last)); exit when Buffer (Last) in 10 | 13; end loop; end Append_Line; overriding procedure Read_More (Self : in out Parser; Buffer : out Natools.S_Expressions.Atom_Buffers.Atom_Buffer) is Finished : Boolean; begin Append_Line (Buffer, Self.Source.all, Finished); end Read_More; end Lithium.Line_Parsers;
22286
------------------------------------------------------------------------------ -- Copyright (c) 2015-2017, <NAME> -- -- -- -- 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. -- ------------------------------------------------------------------------------ package body Lithium.Line_Parsers is procedure Append_Line (Line : in out Natools.S_Expressions.Atom_Buffers.Atom_Buffer; Source : in out Ada.Streams.Root_Stream_Type'Class; Finished : out Boolean) is Buffer : Ada.Streams.Stream_Element_Array (1 .. 1); Last : Ada.Streams.Stream_Element_Offset; begin Finished := False; loop Source.Read (Buffer, Last); if Last not in Buffer'Range then Finished := True; exit; end if; Line.Append (Buffer (Last)); exit when Buffer (Last) in 10 | 13; end loop; end Append_Line; overriding procedure Read_More (Self : in out Parser; Buffer : out Natools.S_Expressions.Atom_Buffers.Atom_Buffer) is Finished : Boolean; begin Append_Line (Buffer, Self.Source.all, Finished); end Read_More; end Lithium.Line_Parsers;
true
------------------------------------------------------------------------------ -- Copyright (c) 2015-2017, PI:NAME:<NAME>END_PI -- -- -- -- 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. -- ------------------------------------------------------------------------------ package body Lithium.Line_Parsers is procedure Append_Line (Line : in out Natools.S_Expressions.Atom_Buffers.Atom_Buffer; Source : in out Ada.Streams.Root_Stream_Type'Class; Finished : out Boolean) is Buffer : Ada.Streams.Stream_Element_Array (1 .. 1); Last : Ada.Streams.Stream_Element_Offset; begin Finished := False; loop Source.Read (Buffer, Last); if Last not in Buffer'Range then Finished := True; exit; end if; Line.Append (Buffer (Last)); exit when Buffer (Last) in 10 | 13; end loop; end Append_Line; overriding procedure Read_More (Self : in out Parser; Buffer : out Natools.S_Expressions.Atom_Buffers.Atom_Buffer) is Finished : Boolean; begin Append_Line (Buffer, Self.Source.all, Finished); end Read_More; end Lithium.Line_Parsers;
[ { "context": " Random and Basic_Rand.\n-- Copyright (C) 1995-2018 Jonathan S. Parker\n--\n-- Permission to use, copy, modify, and/or dis", "end": 185, "score": 0.999887228012085, "start": 167, "tag": "NAME", "value": "Jonathan S. Parker" } ]
disorderly/text_utilities.adb
jscparker/math_packages
30
------------------------------------------------------------------------------- -- package body Text_Utilities; for Random and Basic_Rand. -- Copyright (C) 1995-2018 Jonathan S. Parker -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------- package body Text_Utilities with Spark_Mode => On is subtype Integer_Digit is Parent_Random_Int range 0 .. 9; Digit_Image : constant array(Integer_Digit) of Character_Digit := ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); Digit_Value : constant array(Character_Digit) of Integer_Digit := (0, 1, 2, 3, 4, 5, 6, 7, 8, 9); subtype Log_Range is Natural range 0 .. 19; Ten_to_the : constant array(Log_Range) of Parent_Random_Int := (10**00, 10**01, 10**02, 10**03, 10**04, 10**05, 10**06, 10**07, 10**08, 10**09, 10**10, 10**11, 10**12, 10**13, 10**14, 10**15, 10**16, 10**17, 10**18, 10**19); ----------- -- Value -- ----------- -- Random_Int_String contains a 20 digit unsigned integer. -- Every Parent_Random_Int (0 .. 2**64-1) can be represented in 20 decimal digits. -- -- All state values satisfy State.X(i) < 2^64. -- -- The calculation uses the modular arithmetic of modular type Parent_Random_Int. -- If the image string encodes a number > 2^64-1, then of course the calculation -- won't return that value, but all State.X(i) values are in a range that -- is correctly evaluated by this function. -- -- For more general use, one may want to check if the string is out-of-range -- of Parent_Random_Int (i.e. > 2^64-1). To do that, sum the least significant 19 -- digits first. Then check if the most significant digit is '0', '1', or greater. -- If greater the string is out of range, if '1' it might be out of range, and if -- '0' then it's in range. function Value (Random_Int_Image : in Random_Int_String) return Parent_Random_Int is Val : Parent_Random_Int := 0; begin for j in Random_Int_String_Index loop Val := Val + Digit_Value (Random_Int_Image(j))*Ten_to_the(Random_Int_String_Index'Last - j); end loop; return Val; end Value; ----------- -- Image -- ----------- -- Every 64 bit Parent_Random_Int can be represented by a 20 decimal digit -- number. function Image (X : in Parent_Random_Int) return Random_Int_String is Ten : constant Parent_Random_Int := 10; Y : Parent_Random_Int := X; Result : Random_Int_String; begin for j in reverse Random_Int_String_Index loop Result(j) := Digit_Image (Y mod Ten); Y := Y / Ten; end loop; return Result; end Image; end Text_Utilities;
16578
------------------------------------------------------------------------------- -- package body Text_Utilities; for Random and Basic_Rand. -- Copyright (C) 1995-2018 <NAME> -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------- package body Text_Utilities with Spark_Mode => On is subtype Integer_Digit is Parent_Random_Int range 0 .. 9; Digit_Image : constant array(Integer_Digit) of Character_Digit := ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); Digit_Value : constant array(Character_Digit) of Integer_Digit := (0, 1, 2, 3, 4, 5, 6, 7, 8, 9); subtype Log_Range is Natural range 0 .. 19; Ten_to_the : constant array(Log_Range) of Parent_Random_Int := (10**00, 10**01, 10**02, 10**03, 10**04, 10**05, 10**06, 10**07, 10**08, 10**09, 10**10, 10**11, 10**12, 10**13, 10**14, 10**15, 10**16, 10**17, 10**18, 10**19); ----------- -- Value -- ----------- -- Random_Int_String contains a 20 digit unsigned integer. -- Every Parent_Random_Int (0 .. 2**64-1) can be represented in 20 decimal digits. -- -- All state values satisfy State.X(i) < 2^64. -- -- The calculation uses the modular arithmetic of modular type Parent_Random_Int. -- If the image string encodes a number > 2^64-1, then of course the calculation -- won't return that value, but all State.X(i) values are in a range that -- is correctly evaluated by this function. -- -- For more general use, one may want to check if the string is out-of-range -- of Parent_Random_Int (i.e. > 2^64-1). To do that, sum the least significant 19 -- digits first. Then check if the most significant digit is '0', '1', or greater. -- If greater the string is out of range, if '1' it might be out of range, and if -- '0' then it's in range. function Value (Random_Int_Image : in Random_Int_String) return Parent_Random_Int is Val : Parent_Random_Int := 0; begin for j in Random_Int_String_Index loop Val := Val + Digit_Value (Random_Int_Image(j))*Ten_to_the(Random_Int_String_Index'Last - j); end loop; return Val; end Value; ----------- -- Image -- ----------- -- Every 64 bit Parent_Random_Int can be represented by a 20 decimal digit -- number. function Image (X : in Parent_Random_Int) return Random_Int_String is Ten : constant Parent_Random_Int := 10; Y : Parent_Random_Int := X; Result : Random_Int_String; begin for j in reverse Random_Int_String_Index loop Result(j) := Digit_Image (Y mod Ten); Y := Y / Ten; end loop; return Result; end Image; end Text_Utilities;
true
------------------------------------------------------------------------------- -- package body Text_Utilities; for Random and Basic_Rand. -- Copyright (C) 1995-2018 PI:NAME:<NAME>END_PI -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------- package body Text_Utilities with Spark_Mode => On is subtype Integer_Digit is Parent_Random_Int range 0 .. 9; Digit_Image : constant array(Integer_Digit) of Character_Digit := ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); Digit_Value : constant array(Character_Digit) of Integer_Digit := (0, 1, 2, 3, 4, 5, 6, 7, 8, 9); subtype Log_Range is Natural range 0 .. 19; Ten_to_the : constant array(Log_Range) of Parent_Random_Int := (10**00, 10**01, 10**02, 10**03, 10**04, 10**05, 10**06, 10**07, 10**08, 10**09, 10**10, 10**11, 10**12, 10**13, 10**14, 10**15, 10**16, 10**17, 10**18, 10**19); ----------- -- Value -- ----------- -- Random_Int_String contains a 20 digit unsigned integer. -- Every Parent_Random_Int (0 .. 2**64-1) can be represented in 20 decimal digits. -- -- All state values satisfy State.X(i) < 2^64. -- -- The calculation uses the modular arithmetic of modular type Parent_Random_Int. -- If the image string encodes a number > 2^64-1, then of course the calculation -- won't return that value, but all State.X(i) values are in a range that -- is correctly evaluated by this function. -- -- For more general use, one may want to check if the string is out-of-range -- of Parent_Random_Int (i.e. > 2^64-1). To do that, sum the least significant 19 -- digits first. Then check if the most significant digit is '0', '1', or greater. -- If greater the string is out of range, if '1' it might be out of range, and if -- '0' then it's in range. function Value (Random_Int_Image : in Random_Int_String) return Parent_Random_Int is Val : Parent_Random_Int := 0; begin for j in Random_Int_String_Index loop Val := Val + Digit_Value (Random_Int_Image(j))*Ten_to_the(Random_Int_String_Index'Last - j); end loop; return Val; end Value; ----------- -- Image -- ----------- -- Every 64 bit Parent_Random_Int can be represented by a 20 decimal digit -- number. function Image (X : in Parent_Random_Int) return Random_Int_String is Ten : constant Parent_Random_Int := 10; Y : Parent_Random_Int := X; Result : Random_Int_String; begin for j in reverse Random_Int_String_Index loop Result(j) := Digit_Image (Y mod Ten); Y := Y / Ten; end loop; return Result; end Image; end Text_Utilities;
[ { "context": " --\n-- Copyright (C) 2014 David Botton --\n-- ", "end": 741, "score": 0.9998435378074646, "start": 729, "tag": "NAME", "value": "David Botton" } ]
ada_gui-gnoga-gui-location.ads
jrcarter/Ada_GUI
19
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . G U I . L O C A T I O N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2014 David Botton -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, 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. -- -- -- -- 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/>. -- -- -- -- 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. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ package Ada_GUI.Gnoga.Gui.Location is ------------------------------------------------------------------------- -- Location_Type ------------------------------------------------------------------------- -- Location_Type is the class encapsulating the DOM Location node -- To use, access via Window_Type.Location type Location_Type is new Gnoga.Gui.Base_Type with private; type Location_Access is access all Location_Type; type Pointer_To_Location_Class is access all Location_Type'Class; ------------------------------------------------------------------------- -- Location_Type - Properties ------------------------------------------------------------------------- procedure URL (Location : in out Location_Type; Value : in String); function URL (Location : Location_Type) return String; -- Setting URL will navigate the browser from the current location and -- close the current Gnoga Connection. procedure Hash (Location : in out Location_Type; Value : in String); function Hash (Location : Location_Type) return String; procedure Host (Location : in out Location_Type; Value : in String); function Host (Location : Location_Type) return String; procedure Host_Name (Location : in out Location_Type; Value : in String); function Host_Name (Location : Location_Type) return String; function Origin (Location : Location_Type) return String; procedure Path_Name (Location : in out Location_Type; Value : in String); function Path_Name (Location : Location_Type) return String; procedure Port (Location : in out Location_Type; Value : in String); function Port (Location : Location_Type) return String; procedure Protocol (Location : in out Location_Type; Value : in String); function Protocol (Location : Location_Type) return String; procedure Search (Location : in out Location_Type; Value : in String); function Search (Location : Location_Type) return String; function Parse (URL : in String; Encoding : String := "") return Gnoga.Data_Map_Type; -- Parse form GET parameters in URL (typically from Search function) -- to Data_Map_Type -- Supported encodings are ISO-8859-1 (default) -- and UTF-8 (typically from Input_Encoding function) ------------------------------------------------------------------------- -- Location_Type - Methods ------------------------------------------------------------------------- procedure Reload (Location : in out Location_Type); -- Reload the current page procedure Replace (Location : in out Location_Type; URL : in String); -- Replace the current page with URL (the current page will be removed -- from the browser history) procedure Assign (Location : in out Location_Type; URL : in String); -- Assign URL to the current page, the current page will be available -- using the back button. private type Location_Type is new Gnoga.Gui.Base_Type with null record; end Ada_GUI.Gnoga.Gui.Location;
26822
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . G U I . L O C A T I O N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2014 <NAME> -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, 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. -- -- -- -- 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/>. -- -- -- -- 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. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ package Ada_GUI.Gnoga.Gui.Location is ------------------------------------------------------------------------- -- Location_Type ------------------------------------------------------------------------- -- Location_Type is the class encapsulating the DOM Location node -- To use, access via Window_Type.Location type Location_Type is new Gnoga.Gui.Base_Type with private; type Location_Access is access all Location_Type; type Pointer_To_Location_Class is access all Location_Type'Class; ------------------------------------------------------------------------- -- Location_Type - Properties ------------------------------------------------------------------------- procedure URL (Location : in out Location_Type; Value : in String); function URL (Location : Location_Type) return String; -- Setting URL will navigate the browser from the current location and -- close the current Gnoga Connection. procedure Hash (Location : in out Location_Type; Value : in String); function Hash (Location : Location_Type) return String; procedure Host (Location : in out Location_Type; Value : in String); function Host (Location : Location_Type) return String; procedure Host_Name (Location : in out Location_Type; Value : in String); function Host_Name (Location : Location_Type) return String; function Origin (Location : Location_Type) return String; procedure Path_Name (Location : in out Location_Type; Value : in String); function Path_Name (Location : Location_Type) return String; procedure Port (Location : in out Location_Type; Value : in String); function Port (Location : Location_Type) return String; procedure Protocol (Location : in out Location_Type; Value : in String); function Protocol (Location : Location_Type) return String; procedure Search (Location : in out Location_Type; Value : in String); function Search (Location : Location_Type) return String; function Parse (URL : in String; Encoding : String := "") return Gnoga.Data_Map_Type; -- Parse form GET parameters in URL (typically from Search function) -- to Data_Map_Type -- Supported encodings are ISO-8859-1 (default) -- and UTF-8 (typically from Input_Encoding function) ------------------------------------------------------------------------- -- Location_Type - Methods ------------------------------------------------------------------------- procedure Reload (Location : in out Location_Type); -- Reload the current page procedure Replace (Location : in out Location_Type; URL : in String); -- Replace the current page with URL (the current page will be removed -- from the browser history) procedure Assign (Location : in out Location_Type; URL : in String); -- Assign URL to the current page, the current page will be available -- using the back button. private type Location_Type is new Gnoga.Gui.Base_Type with null record; end Ada_GUI.Gnoga.Gui.Location;
true
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . G U I . L O C A T I O N -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2014 PI:NAME:<NAME>END_PI -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, 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. -- -- -- -- 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/>. -- -- -- -- 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. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ package Ada_GUI.Gnoga.Gui.Location is ------------------------------------------------------------------------- -- Location_Type ------------------------------------------------------------------------- -- Location_Type is the class encapsulating the DOM Location node -- To use, access via Window_Type.Location type Location_Type is new Gnoga.Gui.Base_Type with private; type Location_Access is access all Location_Type; type Pointer_To_Location_Class is access all Location_Type'Class; ------------------------------------------------------------------------- -- Location_Type - Properties ------------------------------------------------------------------------- procedure URL (Location : in out Location_Type; Value : in String); function URL (Location : Location_Type) return String; -- Setting URL will navigate the browser from the current location and -- close the current Gnoga Connection. procedure Hash (Location : in out Location_Type; Value : in String); function Hash (Location : Location_Type) return String; procedure Host (Location : in out Location_Type; Value : in String); function Host (Location : Location_Type) return String; procedure Host_Name (Location : in out Location_Type; Value : in String); function Host_Name (Location : Location_Type) return String; function Origin (Location : Location_Type) return String; procedure Path_Name (Location : in out Location_Type; Value : in String); function Path_Name (Location : Location_Type) return String; procedure Port (Location : in out Location_Type; Value : in String); function Port (Location : Location_Type) return String; procedure Protocol (Location : in out Location_Type; Value : in String); function Protocol (Location : Location_Type) return String; procedure Search (Location : in out Location_Type; Value : in String); function Search (Location : Location_Type) return String; function Parse (URL : in String; Encoding : String := "") return Gnoga.Data_Map_Type; -- Parse form GET parameters in URL (typically from Search function) -- to Data_Map_Type -- Supported encodings are ISO-8859-1 (default) -- and UTF-8 (typically from Input_Encoding function) ------------------------------------------------------------------------- -- Location_Type - Methods ------------------------------------------------------------------------- procedure Reload (Location : in out Location_Type); -- Reload the current page procedure Replace (Location : in out Location_Type; URL : in String); -- Replace the current page with URL (the current page will be removed -- from the browser history) procedure Assign (Location : in out Location_Type; URL : in String); -- Assign URL to the current page, the current page will be available -- using the back button. private type Location_Type is new Gnoga.Gui.Base_Type with null record; end Ada_GUI.Gnoga.Gui.Location;
[ { "context": "Druss main tool\n-- Copyright (C) 2017, 2019, 2021 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 157, "score": 0.9998770952224731, "start": 142, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "C) 2017, 2019, 2021 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 188, "score": 0.9998806118965149, "start": 173, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "1 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 215, "score": 0.9999305605888367, "start": 190, "tag": "EMAIL", "value": "[email protected]" } ]
tools/druss-tools.adb
stcarrez/bbox-ada-api
2
----------------------------------------------------------------------- -- druss-tools -- Druss main tool -- Copyright (C) 2017, 2019, 2021 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 GNAT.Command_Line; use GNAT.Command_Line; with Ada.Command_Line; with Ada.Text_IO; with Ada.Exceptions; with Ada.Strings.Unbounded; with Util.Commands; with Util.Http.Clients.AWS; with Util.Log.Loggers; with Util.Properties; with Druss.Config; with Druss.Commands; procedure Druss.Tools is use Ada.Strings.Unbounded; Log_Config : Util.Properties.Manager; Config : Ada.Strings.Unbounded.Unbounded_String; Debug : Boolean := False; Verbose : Boolean := False; Interactive : Boolean := False; First : Natural := 0; All_Args : Util.Commands.Default_Argument_List (0); Console : aliased Druss.Commands.Text_Consoles.Console_Type; Ctx : Druss.Commands.Context_Type; begin Log_Config.Set ("log4j.rootCategory", "DEBUG,console"); Log_Config.Set ("log4j.appender.console", "Console"); Log_Config.Set ("log4j.appender.console.level", "ERROR"); Log_Config.Set ("log4j.appender.console.layout", "level-message"); Log_Config.Set ("log4j.appender.stdout", "Console"); Log_Config.Set ("log4j.appender.stdout.level", "INFO"); Log_Config.Set ("log4j.appender.stdout.layout", "message"); Log_Config.Set ("log4j.logger.Util", "FATAL"); Log_Config.Set ("log4j.logger.Bbox", "FATAL"); Util.Log.Loggers.Initialize (Log_Config); Druss.Commands.Initialize; Ctx.Console := Console'Unchecked_Access; Initialize_Option_Scan (Stop_At_First_Non_Switch => True, Section_Delimiters => "targs"); -- Parse the command line loop case Getopt ("* v d i o: c:") is when ASCII.NUL => exit; when 'c' => Config := Ada.Strings.Unbounded.To_Unbounded_String (Parameter); when 'd' => Debug := True; when 'i' => Interactive := True; when 'v' => Verbose := True; when '*' => exit; when others => null; end case; First := First + 1; end loop; if Verbose or Debug then Log_Config.Set ("log4j.appender.console.level", "INFO"); Log_Config.Set ("log4j.logger.Util", "WARN"); Log_Config.Set ("log4j.logger.Bbox", "ERR"); end if; if Debug then Log_Config.Set ("log4j.appender.console.level", "DEBUG"); end if; Util.Log.Loggers.Initialize (Log_Config); Druss.Config.Initialize (To_String (Config)); Util.Http.Clients.AWS.Register; -- Enter in the interactive mode. if Interactive then Druss.Config.Get_Gateways (Ctx.Gateways); Druss.Commands.Interactive (Ctx); return; end if; if First >= Ada.Command_Line.Argument_Count then Ada.Text_IO.Put_Line ("Missing command name to execute."); Druss.Commands.Driver.Usage (All_Args, Ctx); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; declare Cmd_Name : constant String := Full_Switch; Args : Util.Commands.Default_Argument_List (First + 1); begin Druss.Config.Get_Gateways (Ctx.Gateways); Druss.Commands.Driver.Execute (Cmd_Name, Args, Ctx); end; exception when Util.Commands.Not_Found => Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); when E : Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid option: " & Ada.Exceptions.Exception_Message (E)); Ada.Command_Line.Set_Exit_Status (2); end Druss.Tools;
23924
----------------------------------------------------------------------- -- druss-tools -- Druss main tool -- Copyright (C) 2017, 2019, 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with GNAT.Command_Line; use GNAT.Command_Line; with Ada.Command_Line; with Ada.Text_IO; with Ada.Exceptions; with Ada.Strings.Unbounded; with Util.Commands; with Util.Http.Clients.AWS; with Util.Log.Loggers; with Util.Properties; with Druss.Config; with Druss.Commands; procedure Druss.Tools is use Ada.Strings.Unbounded; Log_Config : Util.Properties.Manager; Config : Ada.Strings.Unbounded.Unbounded_String; Debug : Boolean := False; Verbose : Boolean := False; Interactive : Boolean := False; First : Natural := 0; All_Args : Util.Commands.Default_Argument_List (0); Console : aliased Druss.Commands.Text_Consoles.Console_Type; Ctx : Druss.Commands.Context_Type; begin Log_Config.Set ("log4j.rootCategory", "DEBUG,console"); Log_Config.Set ("log4j.appender.console", "Console"); Log_Config.Set ("log4j.appender.console.level", "ERROR"); Log_Config.Set ("log4j.appender.console.layout", "level-message"); Log_Config.Set ("log4j.appender.stdout", "Console"); Log_Config.Set ("log4j.appender.stdout.level", "INFO"); Log_Config.Set ("log4j.appender.stdout.layout", "message"); Log_Config.Set ("log4j.logger.Util", "FATAL"); Log_Config.Set ("log4j.logger.Bbox", "FATAL"); Util.Log.Loggers.Initialize (Log_Config); Druss.Commands.Initialize; Ctx.Console := Console'Unchecked_Access; Initialize_Option_Scan (Stop_At_First_Non_Switch => True, Section_Delimiters => "targs"); -- Parse the command line loop case Getopt ("* v d i o: c:") is when ASCII.NUL => exit; when 'c' => Config := Ada.Strings.Unbounded.To_Unbounded_String (Parameter); when 'd' => Debug := True; when 'i' => Interactive := True; when 'v' => Verbose := True; when '*' => exit; when others => null; end case; First := First + 1; end loop; if Verbose or Debug then Log_Config.Set ("log4j.appender.console.level", "INFO"); Log_Config.Set ("log4j.logger.Util", "WARN"); Log_Config.Set ("log4j.logger.Bbox", "ERR"); end if; if Debug then Log_Config.Set ("log4j.appender.console.level", "DEBUG"); end if; Util.Log.Loggers.Initialize (Log_Config); Druss.Config.Initialize (To_String (Config)); Util.Http.Clients.AWS.Register; -- Enter in the interactive mode. if Interactive then Druss.Config.Get_Gateways (Ctx.Gateways); Druss.Commands.Interactive (Ctx); return; end if; if First >= Ada.Command_Line.Argument_Count then Ada.Text_IO.Put_Line ("Missing command name to execute."); Druss.Commands.Driver.Usage (All_Args, Ctx); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; declare Cmd_Name : constant String := Full_Switch; Args : Util.Commands.Default_Argument_List (First + 1); begin Druss.Config.Get_Gateways (Ctx.Gateways); Druss.Commands.Driver.Execute (Cmd_Name, Args, Ctx); end; exception when Util.Commands.Not_Found => Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); when E : Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid option: " & Ada.Exceptions.Exception_Message (E)); Ada.Command_Line.Set_Exit_Status (2); end Druss.Tools;
true
----------------------------------------------------------------------- -- druss-tools -- Druss main tool -- Copyright (C) 2017, 2019, 2021 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with GNAT.Command_Line; use GNAT.Command_Line; with Ada.Command_Line; with Ada.Text_IO; with Ada.Exceptions; with Ada.Strings.Unbounded; with Util.Commands; with Util.Http.Clients.AWS; with Util.Log.Loggers; with Util.Properties; with Druss.Config; with Druss.Commands; procedure Druss.Tools is use Ada.Strings.Unbounded; Log_Config : Util.Properties.Manager; Config : Ada.Strings.Unbounded.Unbounded_String; Debug : Boolean := False; Verbose : Boolean := False; Interactive : Boolean := False; First : Natural := 0; All_Args : Util.Commands.Default_Argument_List (0); Console : aliased Druss.Commands.Text_Consoles.Console_Type; Ctx : Druss.Commands.Context_Type; begin Log_Config.Set ("log4j.rootCategory", "DEBUG,console"); Log_Config.Set ("log4j.appender.console", "Console"); Log_Config.Set ("log4j.appender.console.level", "ERROR"); Log_Config.Set ("log4j.appender.console.layout", "level-message"); Log_Config.Set ("log4j.appender.stdout", "Console"); Log_Config.Set ("log4j.appender.stdout.level", "INFO"); Log_Config.Set ("log4j.appender.stdout.layout", "message"); Log_Config.Set ("log4j.logger.Util", "FATAL"); Log_Config.Set ("log4j.logger.Bbox", "FATAL"); Util.Log.Loggers.Initialize (Log_Config); Druss.Commands.Initialize; Ctx.Console := Console'Unchecked_Access; Initialize_Option_Scan (Stop_At_First_Non_Switch => True, Section_Delimiters => "targs"); -- Parse the command line loop case Getopt ("* v d i o: c:") is when ASCII.NUL => exit; when 'c' => Config := Ada.Strings.Unbounded.To_Unbounded_String (Parameter); when 'd' => Debug := True; when 'i' => Interactive := True; when 'v' => Verbose := True; when '*' => exit; when others => null; end case; First := First + 1; end loop; if Verbose or Debug then Log_Config.Set ("log4j.appender.console.level", "INFO"); Log_Config.Set ("log4j.logger.Util", "WARN"); Log_Config.Set ("log4j.logger.Bbox", "ERR"); end if; if Debug then Log_Config.Set ("log4j.appender.console.level", "DEBUG"); end if; Util.Log.Loggers.Initialize (Log_Config); Druss.Config.Initialize (To_String (Config)); Util.Http.Clients.AWS.Register; -- Enter in the interactive mode. if Interactive then Druss.Config.Get_Gateways (Ctx.Gateways); Druss.Commands.Interactive (Ctx); return; end if; if First >= Ada.Command_Line.Argument_Count then Ada.Text_IO.Put_Line ("Missing command name to execute."); Druss.Commands.Driver.Usage (All_Args, Ctx); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); return; end if; declare Cmd_Name : constant String := Full_Switch; Args : Util.Commands.Default_Argument_List (First + 1); begin Druss.Config.Get_Gateways (Ctx.Gateways); Druss.Commands.Driver.Execute (Cmd_Name, Args, Ctx); end; exception when Util.Commands.Not_Found => Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); when E : Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid option: " & Ada.Exceptions.Exception_Message (E)); Ada.Command_Line.Set_Exit_Status (2); end Druss.Tools;
[ { "context": "-- part of AdaYaml, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 42, "score": 0.9998342394828796, "start": 30, "tag": "NAME", "value": "Felix Krause" } ]
test/src/yaml-lexer-buffering_test.adb
robdaemon/AdaYaml
32
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with AUnit.Assertions; use AUnit.Assertions; with Yaml.Source.File; with Utils; package body Yaml.Lexer.Buffering_Test is procedure Register_Tests (T : in out TC) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Test_File_Without_Refill'Access, "Read file of exact buffer size"); Register_Routine (T, Test_File_With_Single_Refill'Access, "Read file exceeding buffer size"); end Register_Tests; function Name (T : TC) return Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Buffering tests for Lexer"); end Name; procedure Set_Up (T : in out TC) is begin T.Pool.Create (8092); end Set_Up; procedure Test_File_Without_Refill (T : in out Test_Cases.Test_Case'Class) is Data_Path : constant String := "test/data/64char.yaml"; Expected : constant String := Utils.File_Content (Data_Path) & End_Of_Input; S : constant Source.Pointer := Source.File.As_Source (Data_Path); L : Instance; begin Init (L, S, TC (T).Pool, 64); Assert (L.Buffer.all'Length = 64, "Buffer length does not match! Val:" & L.Buffer.all'Length'Img); for I in Expected'Range loop Assert (Expected (I) = L.Cur, "Buffer contents at" & I'Img & " does not match. Expected """ & Expected (I) & """, got """ & L.Cur & """."); exit when L.Cur = End_Of_Input; case L.Cur is when Line_Feed => Handle_LF (L); when Carriage_Return => Handle_CR (L); when others => null; end case; L.Cur := Next (L); end loop; end Test_File_Without_Refill; procedure Test_File_With_Single_Refill (T : in out Test_Cases.Test_Case'Class) is Data_Path : constant String := "test/data/98char.yaml"; Expected : constant String := Utils.File_Content (Data_Path); S : constant Source.Pointer := Source.File.As_Source (Data_Path); L : Instance; begin Init (L, S, TC (T).Pool, 64); Assert (L.Buffer.all'Length = 64, "Buffer length does not match! Val: " & L.Buffer.all'Length'Img); for I in Expected'Range loop Assert (Expected (I) = L.Cur, "Buffer contents at" & I'Img & " does not match. Expected """ & Expected (I) & """, got """ & L.Cur & """."); exit when L.Cur = End_Of_Input; case L.Cur is when Line_Feed => Handle_LF (L); when Carriage_Return => Handle_CR (L); when others => null; end case; L.Cur := Next (L); end loop; end Test_File_With_Single_Refill; end Yaml.Lexer.Buffering_Test;
11301
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with AUnit.Assertions; use AUnit.Assertions; with Yaml.Source.File; with Utils; package body Yaml.Lexer.Buffering_Test is procedure Register_Tests (T : in out TC) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Test_File_Without_Refill'Access, "Read file of exact buffer size"); Register_Routine (T, Test_File_With_Single_Refill'Access, "Read file exceeding buffer size"); end Register_Tests; function Name (T : TC) return Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Buffering tests for Lexer"); end Name; procedure Set_Up (T : in out TC) is begin T.Pool.Create (8092); end Set_Up; procedure Test_File_Without_Refill (T : in out Test_Cases.Test_Case'Class) is Data_Path : constant String := "test/data/64char.yaml"; Expected : constant String := Utils.File_Content (Data_Path) & End_Of_Input; S : constant Source.Pointer := Source.File.As_Source (Data_Path); L : Instance; begin Init (L, S, TC (T).Pool, 64); Assert (L.Buffer.all'Length = 64, "Buffer length does not match! Val:" & L.Buffer.all'Length'Img); for I in Expected'Range loop Assert (Expected (I) = L.Cur, "Buffer contents at" & I'Img & " does not match. Expected """ & Expected (I) & """, got """ & L.Cur & """."); exit when L.Cur = End_Of_Input; case L.Cur is when Line_Feed => Handle_LF (L); when Carriage_Return => Handle_CR (L); when others => null; end case; L.Cur := Next (L); end loop; end Test_File_Without_Refill; procedure Test_File_With_Single_Refill (T : in out Test_Cases.Test_Case'Class) is Data_Path : constant String := "test/data/98char.yaml"; Expected : constant String := Utils.File_Content (Data_Path); S : constant Source.Pointer := Source.File.As_Source (Data_Path); L : Instance; begin Init (L, S, TC (T).Pool, 64); Assert (L.Buffer.all'Length = 64, "Buffer length does not match! Val: " & L.Buffer.all'Length'Img); for I in Expected'Range loop Assert (Expected (I) = L.Cur, "Buffer contents at" & I'Img & " does not match. Expected """ & Expected (I) & """, got """ & L.Cur & """."); exit when L.Cur = End_Of_Input; case L.Cur is when Line_Feed => Handle_LF (L); when Carriage_Return => Handle_CR (L); when others => null; end case; L.Cur := Next (L); end loop; end Test_File_With_Single_Refill; end Yaml.Lexer.Buffering_Test;
true
-- part of AdaYaml, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "copying.txt" with AUnit.Assertions; use AUnit.Assertions; with Yaml.Source.File; with Utils; package body Yaml.Lexer.Buffering_Test is procedure Register_Tests (T : in out TC) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Test_File_Without_Refill'Access, "Read file of exact buffer size"); Register_Routine (T, Test_File_With_Single_Refill'Access, "Read file exceeding buffer size"); end Register_Tests; function Name (T : TC) return Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Buffering tests for Lexer"); end Name; procedure Set_Up (T : in out TC) is begin T.Pool.Create (8092); end Set_Up; procedure Test_File_Without_Refill (T : in out Test_Cases.Test_Case'Class) is Data_Path : constant String := "test/data/64char.yaml"; Expected : constant String := Utils.File_Content (Data_Path) & End_Of_Input; S : constant Source.Pointer := Source.File.As_Source (Data_Path); L : Instance; begin Init (L, S, TC (T).Pool, 64); Assert (L.Buffer.all'Length = 64, "Buffer length does not match! Val:" & L.Buffer.all'Length'Img); for I in Expected'Range loop Assert (Expected (I) = L.Cur, "Buffer contents at" & I'Img & " does not match. Expected """ & Expected (I) & """, got """ & L.Cur & """."); exit when L.Cur = End_Of_Input; case L.Cur is when Line_Feed => Handle_LF (L); when Carriage_Return => Handle_CR (L); when others => null; end case; L.Cur := Next (L); end loop; end Test_File_Without_Refill; procedure Test_File_With_Single_Refill (T : in out Test_Cases.Test_Case'Class) is Data_Path : constant String := "test/data/98char.yaml"; Expected : constant String := Utils.File_Content (Data_Path); S : constant Source.Pointer := Source.File.As_Source (Data_Path); L : Instance; begin Init (L, S, TC (T).Pool, 64); Assert (L.Buffer.all'Length = 64, "Buffer length does not match! Val: " & L.Buffer.all'Length'Img); for I in Expected'Range loop Assert (Expected (I) = L.Cur, "Buffer contents at" & I'Img & " does not match. Expected """ & Expected (I) & """, got """ & L.Cur & """."); exit when L.Cur = End_Of_Input; case L.Cur is when Line_Feed => Handle_LF (L); when Carriage_Return => Handle_CR (L); when others => null; end case; L.Cur := Next (L); end loop; end Test_File_With_Single_Refill; end Yaml.Lexer.Buffering_Test;
[ { "context": "----------------------\n-- Copyright (c) 2013-2018 Luke A. Guest\n--\n-- This software is provided 'as-is', without", "end": 158, "score": 0.9996621012687683, "start": 145, "tag": "NAME", "value": "Luke A. Guest" } ]
src/sdl-events-joysticks.ads
alire-project/sdlada
0
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Events.Joysticks -- -- Joystick specific events. -------------------------------------------------------------------------------------------------------------------- package SDL.Events.Joysticks is -- Joystick events. Axis_Motion : constant Event_Types := 16#0000_0600#; Ball_Motion : constant Event_Types := Axis_Motion + 1; Hat_Motion : constant Event_Types := Axis_Motion + 2; Button_Down : constant Event_Types := Axis_Motion + 3; Button_Up : constant Event_Types := Axis_Motion + 4; Device_Added : constant Event_Types := Axis_Motion + 5; Device_Removed : constant Event_Types := Axis_Motion + 6; type IDs is range -2 ** 31 .. 2 ** 31 - 1 with Convention => C, Size => 32; type Axes is range 0 .. 255 with Convention => C, Size => 8; type Axes_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Axis_Events is record Event_Type : Event_Types; -- Will be set to Axis_Motion. Time_Stamp : Time_Stamps; Which : IDs; Axis : Axes; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; Value : Axes_Values; Padding_4 : Padding_16; end record with Convention => C; type Balls is range 0 .. 255 with Convention => C, Size => 8; type Ball_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Ball_Events is record Event_Type : Event_Types; -- Will be set to Ball_Motion. Time_Stamp : Time_Stamps; Which : IDs; Ball : Balls; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; X_Relative : Ball_Values; Y_Relative : Ball_Values; end record with Convention => C; type Hats is range 0 .. 255 with Convention => C, Size => 8; type Hat_Positions is mod 2 ** 8 with Convention => C, Size => 8; Hat_Centred : constant Hat_Positions := 0; Hat_Up : constant Hat_Positions := 1; Hat_Right : constant Hat_Positions := 2; Hat_Down : constant Hat_Positions := 4; Hat_Left : constant Hat_Positions := 8; Hat_Right_Up : constant Hat_Positions := Hat_Right or Hat_Up; Hat_Right_Down : constant Hat_Positions := Hat_Right or Hat_Down; Hat_Left_Up : constant Hat_Positions := Hat_Left or Hat_Up; Hat_Left_Down : constant Hat_Positions := Hat_Left or Hat_Down; type Hat_Events is record Event_Type : Event_Types; -- Will be set to Hat_Motion. Time_Stamp : Time_Stamps; Which : IDs; Hat : Hats; Position : Hat_Positions; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Buttons is range 0 .. 255 with Convention => C, Size => 8; type Button_Events is record Event_Type : Event_Types; -- Will be set to Button_Down or Button_Up. Time_Stamp : Time_Stamps; Which : IDs; Button : Buttons; State : Button_State; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Device_Events is record Event_Type : Event_Types; -- Will be set to Device_Added or Device_Removed. Time_Stamp : Time_Stamps; Which : IDs; end record with Convention => C; -- Update the joystick event data. This is called by the event loop. procedure Update with Import => True, Convention => C, External_Name => "SDL_JoystickUpdate"; function Is_Polling_Enabled return Boolean; procedure Enable_Polling with Inline => True; procedure Disable_Polling with Inline => True; private for Axis_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Axis at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; Value at 4 * SDL.Word range 0 .. 15; Padding_4 at 4 * SDL.Word range 16 .. 31; end record; for Ball_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Ball at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; X_Relative at 4 * SDL.Word range 0 .. 15; Y_Relative at 4 * SDL.Word range 16 .. 31; end record; for Hat_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Hat at 3 * SDL.Word range 0 .. 7; Position at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Button_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Button at 3 * SDL.Word range 0 .. 7; State at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Device_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; end record; end SDL.Events.Joysticks;
10157
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 <NAME> -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Events.Joysticks -- -- Joystick specific events. -------------------------------------------------------------------------------------------------------------------- package SDL.Events.Joysticks is -- Joystick events. Axis_Motion : constant Event_Types := 16#0000_0600#; Ball_Motion : constant Event_Types := Axis_Motion + 1; Hat_Motion : constant Event_Types := Axis_Motion + 2; Button_Down : constant Event_Types := Axis_Motion + 3; Button_Up : constant Event_Types := Axis_Motion + 4; Device_Added : constant Event_Types := Axis_Motion + 5; Device_Removed : constant Event_Types := Axis_Motion + 6; type IDs is range -2 ** 31 .. 2 ** 31 - 1 with Convention => C, Size => 32; type Axes is range 0 .. 255 with Convention => C, Size => 8; type Axes_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Axis_Events is record Event_Type : Event_Types; -- Will be set to Axis_Motion. Time_Stamp : Time_Stamps; Which : IDs; Axis : Axes; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; Value : Axes_Values; Padding_4 : Padding_16; end record with Convention => C; type Balls is range 0 .. 255 with Convention => C, Size => 8; type Ball_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Ball_Events is record Event_Type : Event_Types; -- Will be set to Ball_Motion. Time_Stamp : Time_Stamps; Which : IDs; Ball : Balls; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; X_Relative : Ball_Values; Y_Relative : Ball_Values; end record with Convention => C; type Hats is range 0 .. 255 with Convention => C, Size => 8; type Hat_Positions is mod 2 ** 8 with Convention => C, Size => 8; Hat_Centred : constant Hat_Positions := 0; Hat_Up : constant Hat_Positions := 1; Hat_Right : constant Hat_Positions := 2; Hat_Down : constant Hat_Positions := 4; Hat_Left : constant Hat_Positions := 8; Hat_Right_Up : constant Hat_Positions := Hat_Right or Hat_Up; Hat_Right_Down : constant Hat_Positions := Hat_Right or Hat_Down; Hat_Left_Up : constant Hat_Positions := Hat_Left or Hat_Up; Hat_Left_Down : constant Hat_Positions := Hat_Left or Hat_Down; type Hat_Events is record Event_Type : Event_Types; -- Will be set to Hat_Motion. Time_Stamp : Time_Stamps; Which : IDs; Hat : Hats; Position : Hat_Positions; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Buttons is range 0 .. 255 with Convention => C, Size => 8; type Button_Events is record Event_Type : Event_Types; -- Will be set to Button_Down or Button_Up. Time_Stamp : Time_Stamps; Which : IDs; Button : Buttons; State : Button_State; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Device_Events is record Event_Type : Event_Types; -- Will be set to Device_Added or Device_Removed. Time_Stamp : Time_Stamps; Which : IDs; end record with Convention => C; -- Update the joystick event data. This is called by the event loop. procedure Update with Import => True, Convention => C, External_Name => "SDL_JoystickUpdate"; function Is_Polling_Enabled return Boolean; procedure Enable_Polling with Inline => True; procedure Disable_Polling with Inline => True; private for Axis_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Axis at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; Value at 4 * SDL.Word range 0 .. 15; Padding_4 at 4 * SDL.Word range 16 .. 31; end record; for Ball_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Ball at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; X_Relative at 4 * SDL.Word range 0 .. 15; Y_Relative at 4 * SDL.Word range 16 .. 31; end record; for Hat_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Hat at 3 * SDL.Word range 0 .. 7; Position at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Button_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Button at 3 * SDL.Word range 0 .. 7; State at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Device_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; end record; end SDL.Events.Joysticks;
true
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 PI:NAME:<NAME>END_PI -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Events.Joysticks -- -- Joystick specific events. -------------------------------------------------------------------------------------------------------------------- package SDL.Events.Joysticks is -- Joystick events. Axis_Motion : constant Event_Types := 16#0000_0600#; Ball_Motion : constant Event_Types := Axis_Motion + 1; Hat_Motion : constant Event_Types := Axis_Motion + 2; Button_Down : constant Event_Types := Axis_Motion + 3; Button_Up : constant Event_Types := Axis_Motion + 4; Device_Added : constant Event_Types := Axis_Motion + 5; Device_Removed : constant Event_Types := Axis_Motion + 6; type IDs is range -2 ** 31 .. 2 ** 31 - 1 with Convention => C, Size => 32; type Axes is range 0 .. 255 with Convention => C, Size => 8; type Axes_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Axis_Events is record Event_Type : Event_Types; -- Will be set to Axis_Motion. Time_Stamp : Time_Stamps; Which : IDs; Axis : Axes; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; Value : Axes_Values; Padding_4 : Padding_16; end record with Convention => C; type Balls is range 0 .. 255 with Convention => C, Size => 8; type Ball_Values is range -32768 .. 32767 with Convention => C, Size => 16; type Ball_Events is record Event_Type : Event_Types; -- Will be set to Ball_Motion. Time_Stamp : Time_Stamps; Which : IDs; Ball : Balls; Padding_1 : Padding_8; Padding_2 : Padding_8; Padding_3 : Padding_8; X_Relative : Ball_Values; Y_Relative : Ball_Values; end record with Convention => C; type Hats is range 0 .. 255 with Convention => C, Size => 8; type Hat_Positions is mod 2 ** 8 with Convention => C, Size => 8; Hat_Centred : constant Hat_Positions := 0; Hat_Up : constant Hat_Positions := 1; Hat_Right : constant Hat_Positions := 2; Hat_Down : constant Hat_Positions := 4; Hat_Left : constant Hat_Positions := 8; Hat_Right_Up : constant Hat_Positions := Hat_Right or Hat_Up; Hat_Right_Down : constant Hat_Positions := Hat_Right or Hat_Down; Hat_Left_Up : constant Hat_Positions := Hat_Left or Hat_Up; Hat_Left_Down : constant Hat_Positions := Hat_Left or Hat_Down; type Hat_Events is record Event_Type : Event_Types; -- Will be set to Hat_Motion. Time_Stamp : Time_Stamps; Which : IDs; Hat : Hats; Position : Hat_Positions; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Buttons is range 0 .. 255 with Convention => C, Size => 8; type Button_Events is record Event_Type : Event_Types; -- Will be set to Button_Down or Button_Up. Time_Stamp : Time_Stamps; Which : IDs; Button : Buttons; State : Button_State; Padding_1 : Padding_8; Padding_2 : Padding_8; end record with Convention => C; type Device_Events is record Event_Type : Event_Types; -- Will be set to Device_Added or Device_Removed. Time_Stamp : Time_Stamps; Which : IDs; end record with Convention => C; -- Update the joystick event data. This is called by the event loop. procedure Update with Import => True, Convention => C, External_Name => "SDL_JoystickUpdate"; function Is_Polling_Enabled return Boolean; procedure Enable_Polling with Inline => True; procedure Disable_Polling with Inline => True; private for Axis_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Axis at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; Value at 4 * SDL.Word range 0 .. 15; Padding_4 at 4 * SDL.Word range 16 .. 31; end record; for Ball_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Ball at 3 * SDL.Word range 0 .. 7; Padding_1 at 3 * SDL.Word range 8 .. 15; Padding_2 at 3 * SDL.Word range 16 .. 23; Padding_3 at 3 * SDL.Word range 24 .. 31; X_Relative at 4 * SDL.Word range 0 .. 15; Y_Relative at 4 * SDL.Word range 16 .. 31; end record; for Hat_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Hat at 3 * SDL.Word range 0 .. 7; Position at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Button_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; Button at 3 * SDL.Word range 0 .. 7; State at 3 * SDL.Word range 8 .. 15; Padding_1 at 3 * SDL.Word range 16 .. 23; Padding_2 at 3 * SDL.Word range 24 .. 31; end record; for Device_Events use record Event_Type at 0 * SDL.Word range 0 .. 31; Time_Stamp at 1 * SDL.Word range 0 .. 31; Which at 2 * SDL.Word range 0 .. 31; end record; end SDL.Events.Joysticks;
[ { "context": "terface);\n -- GStreamer\n -- * Copyright (C) 2006 Stefan Kost <[email protected]>\n -- *\n -- * gstpreset.h:", "end": 747, "score": 0.9998831748962402, "start": 736, "tag": "NAME", "value": "Stefan Kost" }, { "context": " GStreamer\n -- * Copyright (C) 2006 Stefan Kost <[email protected]>\n -- *\n -- * gstpreset.h: helper interface head", "end": 769, "score": 0.9999293684959412, "start": 749, "tag": "EMAIL", "value": "[email protected]" } ]
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gstpreset_h.ads
persan/A-gst
1
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpreset_h is -- unsupported macro: GST_TYPE_PRESET (gst_preset_get_type()) -- arg-macro: function GST_PRESET (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PRESET, GstPreset); -- arg-macro: function GST_IS_PRESET (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PRESET); -- arg-macro: function GST_PRESET_GET_INTERFACE (obj) -- return G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PRESET, GstPresetInterface); -- GStreamer -- * Copyright (C) 2006 Stefan Kost <[email protected]> -- * -- * gstpreset.h: helper interface header for element presets -- * -- * 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. -- --* -- * GstPreset: -- * -- * Opaque #GstPreset data structure. -- -- dummy object -- skipped empty struct u_GstPreset -- skipped empty struct GstPreset type GstPresetInterface; type u_GstPresetInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstPresetInterface is u_GstPresetInterface; -- gst/gstpreset.h:41 --* -- * GstPresetInterface: -- * @parent: parent interface type. -- * @get_preset_names: virtual method to get list of presets -- * @get_property_names: virtual methods to get properties that are persistent -- * @load_preset: virtual methods to load a preset into properties -- * @save_preset: virtual methods to save properties into a preset -- * @rename_preset: virtual methods to rename a preset -- * @delete_preset: virtual methods to remove a preset -- * @set_meta: virtual methods to set textual meta data to a preset -- * @get_meta: virtual methods to get textual meta data from a preset -- * -- * #GstPreset interface. -- type GstPresetInterface is record parent : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/gstpreset.h:59 get_preset_names : access function (arg1 : System.Address) return System.Address; -- gst/gstpreset.h:62 get_property_names : access function (arg1 : System.Address) return System.Address; -- gst/gstpreset.h:64 load_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:66 save_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:67 rename_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:69 delete_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:70 set_meta : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar; arg4 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:73 get_meta : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar; arg4 : System.Address) return GLIB.gboolean; -- gst/gstpreset.h:75 u_gst_reserved : u_GstPresetInterface_u_gst_reserved_array; -- gst/gstpreset.h:77 end record; pragma Convention (C_Pass_By_Copy, GstPresetInterface); -- gst/gstpreset.h:57 -- methods --< private > function gst_preset_get_type return GLIB.GType; -- gst/gstpreset.h:80 pragma Import (C, gst_preset_get_type, "gst_preset_get_type"); function gst_preset_get_preset_names (preset : System.Address) return System.Address; -- gst/gstpreset.h:82 pragma Import (C, gst_preset_get_preset_names, "gst_preset_get_preset_names"); function gst_preset_get_property_names (preset : System.Address) return System.Address; -- gst/gstpreset.h:84 pragma Import (C, gst_preset_get_property_names, "gst_preset_get_property_names"); function gst_preset_load_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:86 pragma Import (C, gst_preset_load_preset, "gst_preset_load_preset"); function gst_preset_save_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:87 pragma Import (C, gst_preset_save_preset, "gst_preset_save_preset"); function gst_preset_rename_preset (preset : System.Address; old_name : access GLIB.gchar; new_name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:88 pragma Import (C, gst_preset_rename_preset, "gst_preset_rename_preset"); function gst_preset_delete_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:90 pragma Import (C, gst_preset_delete_preset, "gst_preset_delete_preset"); function gst_preset_set_meta (preset : System.Address; name : access GLIB.gchar; tag : access GLIB.gchar; value : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:92 pragma Import (C, gst_preset_set_meta, "gst_preset_set_meta"); function gst_preset_get_meta (preset : System.Address; name : access GLIB.gchar; tag : access GLIB.gchar; value : System.Address) return GLIB.gboolean; -- gst/gstpreset.h:94 pragma Import (C, gst_preset_get_meta, "gst_preset_get_meta"); function gst_preset_set_app_dir (app_dir : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:97 pragma Import (C, gst_preset_set_app_dir, "gst_preset_set_app_dir"); function gst_preset_get_app_dir return access GLIB.gchar; -- gst/gstpreset.h:98 pragma Import (C, gst_preset_get_app_dir, "gst_preset_get_app_dir"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpreset_h;
4607
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpreset_h is -- unsupported macro: GST_TYPE_PRESET (gst_preset_get_type()) -- arg-macro: function GST_PRESET (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PRESET, GstPreset); -- arg-macro: function GST_IS_PRESET (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PRESET); -- arg-macro: function GST_PRESET_GET_INTERFACE (obj) -- return G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PRESET, GstPresetInterface); -- GStreamer -- * Copyright (C) 2006 <NAME> <<EMAIL>> -- * -- * gstpreset.h: helper interface header for element presets -- * -- * 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. -- --* -- * GstPreset: -- * -- * Opaque #GstPreset data structure. -- -- dummy object -- skipped empty struct u_GstPreset -- skipped empty struct GstPreset type GstPresetInterface; type u_GstPresetInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstPresetInterface is u_GstPresetInterface; -- gst/gstpreset.h:41 --* -- * GstPresetInterface: -- * @parent: parent interface type. -- * @get_preset_names: virtual method to get list of presets -- * @get_property_names: virtual methods to get properties that are persistent -- * @load_preset: virtual methods to load a preset into properties -- * @save_preset: virtual methods to save properties into a preset -- * @rename_preset: virtual methods to rename a preset -- * @delete_preset: virtual methods to remove a preset -- * @set_meta: virtual methods to set textual meta data to a preset -- * @get_meta: virtual methods to get textual meta data from a preset -- * -- * #GstPreset interface. -- type GstPresetInterface is record parent : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/gstpreset.h:59 get_preset_names : access function (arg1 : System.Address) return System.Address; -- gst/gstpreset.h:62 get_property_names : access function (arg1 : System.Address) return System.Address; -- gst/gstpreset.h:64 load_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:66 save_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:67 rename_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:69 delete_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:70 set_meta : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar; arg4 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:73 get_meta : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar; arg4 : System.Address) return GLIB.gboolean; -- gst/gstpreset.h:75 u_gst_reserved : u_GstPresetInterface_u_gst_reserved_array; -- gst/gstpreset.h:77 end record; pragma Convention (C_Pass_By_Copy, GstPresetInterface); -- gst/gstpreset.h:57 -- methods --< private > function gst_preset_get_type return GLIB.GType; -- gst/gstpreset.h:80 pragma Import (C, gst_preset_get_type, "gst_preset_get_type"); function gst_preset_get_preset_names (preset : System.Address) return System.Address; -- gst/gstpreset.h:82 pragma Import (C, gst_preset_get_preset_names, "gst_preset_get_preset_names"); function gst_preset_get_property_names (preset : System.Address) return System.Address; -- gst/gstpreset.h:84 pragma Import (C, gst_preset_get_property_names, "gst_preset_get_property_names"); function gst_preset_load_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:86 pragma Import (C, gst_preset_load_preset, "gst_preset_load_preset"); function gst_preset_save_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:87 pragma Import (C, gst_preset_save_preset, "gst_preset_save_preset"); function gst_preset_rename_preset (preset : System.Address; old_name : access GLIB.gchar; new_name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:88 pragma Import (C, gst_preset_rename_preset, "gst_preset_rename_preset"); function gst_preset_delete_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:90 pragma Import (C, gst_preset_delete_preset, "gst_preset_delete_preset"); function gst_preset_set_meta (preset : System.Address; name : access GLIB.gchar; tag : access GLIB.gchar; value : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:92 pragma Import (C, gst_preset_set_meta, "gst_preset_set_meta"); function gst_preset_get_meta (preset : System.Address; name : access GLIB.gchar; tag : access GLIB.gchar; value : System.Address) return GLIB.gboolean; -- gst/gstpreset.h:94 pragma Import (C, gst_preset_get_meta, "gst_preset_get_meta"); function gst_preset_set_app_dir (app_dir : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:97 pragma Import (C, gst_preset_set_app_dir, "gst_preset_set_app_dir"); function gst_preset_get_app_dir return access GLIB.gchar; -- gst/gstpreset.h:98 pragma Import (C, gst_preset_get_app_dir, "gst_preset_get_app_dir"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpreset_h;
true
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpreset_h is -- unsupported macro: GST_TYPE_PRESET (gst_preset_get_type()) -- arg-macro: function GST_PRESET (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PRESET, GstPreset); -- arg-macro: function GST_IS_PRESET (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PRESET); -- arg-macro: function GST_PRESET_GET_INTERFACE (obj) -- return G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PRESET, GstPresetInterface); -- GStreamer -- * Copyright (C) 2006 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * -- * gstpreset.h: helper interface header for element presets -- * -- * 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. -- --* -- * GstPreset: -- * -- * Opaque #GstPreset data structure. -- -- dummy object -- skipped empty struct u_GstPreset -- skipped empty struct GstPreset type GstPresetInterface; type u_GstPresetInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstPresetInterface is u_GstPresetInterface; -- gst/gstpreset.h:41 --* -- * GstPresetInterface: -- * @parent: parent interface type. -- * @get_preset_names: virtual method to get list of presets -- * @get_property_names: virtual methods to get properties that are persistent -- * @load_preset: virtual methods to load a preset into properties -- * @save_preset: virtual methods to save properties into a preset -- * @rename_preset: virtual methods to rename a preset -- * @delete_preset: virtual methods to remove a preset -- * @set_meta: virtual methods to set textual meta data to a preset -- * @get_meta: virtual methods to get textual meta data from a preset -- * -- * #GstPreset interface. -- type GstPresetInterface is record parent : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/gstpreset.h:59 get_preset_names : access function (arg1 : System.Address) return System.Address; -- gst/gstpreset.h:62 get_property_names : access function (arg1 : System.Address) return System.Address; -- gst/gstpreset.h:64 load_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:66 save_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:67 rename_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:69 delete_preset : access function (arg1 : System.Address; arg2 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:70 set_meta : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar; arg4 : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:73 get_meta : access function (arg1 : System.Address; arg2 : access GLIB.gchar; arg3 : access GLIB.gchar; arg4 : System.Address) return GLIB.gboolean; -- gst/gstpreset.h:75 u_gst_reserved : u_GstPresetInterface_u_gst_reserved_array; -- gst/gstpreset.h:77 end record; pragma Convention (C_Pass_By_Copy, GstPresetInterface); -- gst/gstpreset.h:57 -- methods --< private > function gst_preset_get_type return GLIB.GType; -- gst/gstpreset.h:80 pragma Import (C, gst_preset_get_type, "gst_preset_get_type"); function gst_preset_get_preset_names (preset : System.Address) return System.Address; -- gst/gstpreset.h:82 pragma Import (C, gst_preset_get_preset_names, "gst_preset_get_preset_names"); function gst_preset_get_property_names (preset : System.Address) return System.Address; -- gst/gstpreset.h:84 pragma Import (C, gst_preset_get_property_names, "gst_preset_get_property_names"); function gst_preset_load_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:86 pragma Import (C, gst_preset_load_preset, "gst_preset_load_preset"); function gst_preset_save_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:87 pragma Import (C, gst_preset_save_preset, "gst_preset_save_preset"); function gst_preset_rename_preset (preset : System.Address; old_name : access GLIB.gchar; new_name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:88 pragma Import (C, gst_preset_rename_preset, "gst_preset_rename_preset"); function gst_preset_delete_preset (preset : System.Address; name : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:90 pragma Import (C, gst_preset_delete_preset, "gst_preset_delete_preset"); function gst_preset_set_meta (preset : System.Address; name : access GLIB.gchar; tag : access GLIB.gchar; value : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:92 pragma Import (C, gst_preset_set_meta, "gst_preset_set_meta"); function gst_preset_get_meta (preset : System.Address; name : access GLIB.gchar; tag : access GLIB.gchar; value : System.Address) return GLIB.gboolean; -- gst/gstpreset.h:94 pragma Import (C, gst_preset_get_meta, "gst_preset_get_meta"); function gst_preset_set_app_dir (app_dir : access GLIB.gchar) return GLIB.gboolean; -- gst/gstpreset.h:97 pragma Import (C, gst_preset_set_app_dir, "gst_preset_set_app_dir"); function gst_preset_get_app_dir return access GLIB.gchar; -- gst/gstpreset.h:98 pragma Import (C, gst_preset_get_app_dir, "gst_preset_get_app_dir"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpreset_h;
[ { "context": "/82\n-- VKG 02/15/83\n-- JBG 03/30/83\n-- JLH 09/04/87 ADDED CASE WHICH ATTEMPTS TO CREATE F", "end": 1587, "score": 0.5109005570411682, "start": 1586, "tag": "NAME", "value": "J" } ]
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3601a.ada
best08618/asylo
7
-- CE3601A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT GET (FOR STRINGS AND CHARACTERS), PUT (FOR STRINGS AND -- CHARACTERS), GET_LINE, AND PUT_LINE RAISE STATUS_ERROR WHEN -- CALLED WITH AN UNOPEN FILE PARAMETER. ALSO CHECK NAMES OF FORMAL -- PARAMETERS. -- HISTORY: -- SPS 08/27/82 -- VKG 02/15/83 -- JBG 03/30/83 -- JLH 09/04/87 ADDED CASE WHICH ATTEMPTS TO CREATE FILE AND THEN -- RETESTED OBJECTIVE. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3601A IS BEGIN TEST ("CE3601A", "STATUS_ERROR RAISED BY GET, PUT, GET_LINE, " & "PUT_LINE WHEN FILE IS NOT OPEN"); DECLARE FILE1, FILE2 : FILE_TYPE; CH: CHARACTER := '%'; LST: NATURAL; ST: STRING (1 .. 10); LN : STRING (1 .. 80); BEGIN BEGIN GET (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE1, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE1, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; BEGIN CREATE (FILE2, OUT_FILE); -- THIS IS ONLY AN ATTEMPT TO CLOSE (FILE2); -- CREATE A FILE. OK, WHETHER EXCEPTION -- SUCCESSFUL OR NOT. WHEN USE_ERROR => NULL; END; BEGIN GET (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE2, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE2, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; END; RESULT; END CE3601A;
26541
-- CE3601A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT GET (FOR STRINGS AND CHARACTERS), PUT (FOR STRINGS AND -- CHARACTERS), GET_LINE, AND PUT_LINE RAISE STATUS_ERROR WHEN -- CALLED WITH AN UNOPEN FILE PARAMETER. ALSO CHECK NAMES OF FORMAL -- PARAMETERS. -- HISTORY: -- SPS 08/27/82 -- VKG 02/15/83 -- JBG 03/30/83 -- <NAME>LH 09/04/87 ADDED CASE WHICH ATTEMPTS TO CREATE FILE AND THEN -- RETESTED OBJECTIVE. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3601A IS BEGIN TEST ("CE3601A", "STATUS_ERROR RAISED BY GET, PUT, GET_LINE, " & "PUT_LINE WHEN FILE IS NOT OPEN"); DECLARE FILE1, FILE2 : FILE_TYPE; CH: CHARACTER := '%'; LST: NATURAL; ST: STRING (1 .. 10); LN : STRING (1 .. 80); BEGIN BEGIN GET (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE1, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE1, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; BEGIN CREATE (FILE2, OUT_FILE); -- THIS IS ONLY AN ATTEMPT TO CLOSE (FILE2); -- CREATE A FILE. OK, WHETHER EXCEPTION -- SUCCESSFUL OR NOT. WHEN USE_ERROR => NULL; END; BEGIN GET (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE2, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE2, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; END; RESULT; END CE3601A;
true
-- CE3601A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT GET (FOR STRINGS AND CHARACTERS), PUT (FOR STRINGS AND -- CHARACTERS), GET_LINE, AND PUT_LINE RAISE STATUS_ERROR WHEN -- CALLED WITH AN UNOPEN FILE PARAMETER. ALSO CHECK NAMES OF FORMAL -- PARAMETERS. -- HISTORY: -- SPS 08/27/82 -- VKG 02/15/83 -- JBG 03/30/83 -- PI:NAME:<NAME>END_PILH 09/04/87 ADDED CASE WHICH ATTEMPTS TO CREATE FILE AND THEN -- RETESTED OBJECTIVE. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3601A IS BEGIN TEST ("CE3601A", "STATUS_ERROR RAISED BY GET, PUT, GET_LINE, " & "PUT_LINE WHEN FILE IS NOT OPEN"); DECLARE FILE1, FILE2 : FILE_TYPE; CH: CHARACTER := '%'; LST: NATURAL; ST: STRING (1 .. 10); LN : STRING (1 .. 80); BEGIN BEGIN GET (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE1, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE1, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; BEGIN CREATE (FILE2, OUT_FILE); -- THIS IS ONLY AN ATTEMPT TO CLOSE (FILE2); -- CREATE A FILE. OK, WHETHER EXCEPTION -- SUCCESSFUL OR NOT. WHEN USE_ERROR => NULL; END; BEGIN GET (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE2, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE2, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; END; RESULT; END CE3601A;
[ { "context": "Lumen.GL -- Lumen's own thin OpenGL bindings\n--\n-- Chip Richards, NiEstu, Phoenix AZ, Summer 2010\n\n-- This code is", "end": 67, "score": 0.9997358918190002, "start": 54, "tag": "NAME", "value": "Chip Richards" }, { "context": "en's own thin OpenGL bindings\n--\n-- Chip Richards, NiEstu, Phoenix AZ, Summer 2010\n\n-- This code is covered", "end": 75, "score": 0.9998317956924438, "start": 69, "tag": "NAME", "value": "NiEstu" }, { "context": "overed by the ISC License:\n--\n-- Copyright © 2010, NiEstu\n--\n-- Permission to use, copy, modify, and/or dis", "end": 176, "score": 0.999847412109375, "start": 170, "tag": "NAME", "value": "NiEstu" }, { "context": " : constant Enum := 16#702#;\n GL_LINE_RESET_TOKEN ", "end": 18279, "score": 0.5029715895652771, "start": 18277, "tag": "PASSWORD", "value": "02" }, { "context": " : constant Enum := 16#704#;\n GL_DRAW_PIXEL_TOKEN ", "end": 18504, "score": 0.6129327416419983, "start": 18501, "tag": "PASSWORD", "value": "704" } ]
src/lumen-gl.ads
darkestkhan/lumen
0
-- Lumen.GL -- Lumen's own thin OpenGL bindings -- -- Chip Richards, NiEstu, Phoenix AZ, Summer 2010 -- This code is covered by the ISC License: -- -- Copyright © 2010, NiEstu -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- The software is provided "as is" and the author disclaims all warranties -- with regard to this software including all implied warranties of -- merchantability and fitness. In no event shall the author be liable for any -- special, direct, indirect, or consequential damages or any damages -- whatsoever resulting from loss of use, data or profits, whether in an -- action of contract, negligence or other tortious action, arising out of or -- in connection with the use or performance of this software. -- Environment with System; with Lumen.Binary; package Lumen.GL is --------------------------------------------------------------------------- -- New names for old types subtype Bitfield is Binary.Word; subtype Bool is Binary.Byte; subtype Byte is Binary.S_Byte; subtype ClampD is Long_Float range 0.0 .. 1.0; subtype ClampF is Float range 0.0 .. 1.0; subtype Double is Long_Float; subtype Int is Integer; subtype Short is Short_Integer; subtype SizeI is Integer; subtype UByte is Binary.Byte; subtype UInt is Binary.Word; subtype UShort is Binary.Short; subtype Pointer is System.Address; -- Try to bring a touch of order to the GLenum mess subtype Enum is Binary.Word; -- Types added by Lumen.GL type Bytes_1 is array (1 .. 1) of Byte; type Bytes_2 is array (1 .. 2) of Byte; type Bytes_3 is array (1 .. 3) of Byte; type Bytes_4 is array (1 .. 4) of Byte; type Shorts_1 is array (1 .. 1) of Short; type Shorts_2 is array (1 .. 2) of Short; type Shorts_3 is array (1 .. 3) of Short; type Shorts_4 is array (1 .. 4) of Short; type Ints_1 is array (1 .. 1) of Int; type Ints_2 is array (1 .. 2) of Int; type Ints_3 is array (1 .. 3) of Int; type Ints_4 is array (1 .. 4) of Int; type Floats_1 is array (1 .. 1) of Float; type Floats_2 is array (1 .. 2) of Float; type Floats_3 is array (1 .. 3) of Float; type Floats_4 is array (1 .. 4) of Float; type Doubles_1 is array (1 .. 1) of Double; type Doubles_2 is array (1 .. 2) of Double; type Doubles_3 is array (1 .. 3) of Double; type Doubles_4 is array (1 .. 4) of Double; type UBytes_1 is array (1 .. 1) of UByte; type UBytes_2 is array (1 .. 2) of UByte; type UBytes_3 is array (1 .. 3) of UByte; type UBytes_4 is array (1 .. 4) of UByte; type UShorts_1 is array (1 .. 1) of UShort; type UShorts_2 is array (1 .. 2) of UShort; type UShorts_3 is array (1 .. 3) of UShort; type UShorts_4 is array (1 .. 4) of UShort; type UInts_1 is array (1 .. 1) of UInt; type UInts_2 is array (1 .. 2) of UInt; type UInts_3 is array (1 .. 3) of UInt; type UInts_4 is array (1 .. 4) of UInt; type Float_Matrix is array (1 .. 4, 1 .. 4) of Float; type Double_Matrix is array (1 .. 4, 1 .. 4) of Double; -- Useful value Null_Pointer : Pointer := System.Null_Address; -- "Enumeration" constants GL_FALSE : constant Bool := 16#0#; GL_TRUE : constant Bool := 16#1#; GL_VERSION_1_1 : constant Enum := 1; GL_VERSION_1_2 : constant Enum := 1; GL_VERSION_1_3 : constant Enum := 1; GL_ARB_imaging : constant Enum := 1; GL_BYTE : constant Enum := 16#1400#; GL_UNSIGNED_BYTE : constant Enum := 16#1401#; GL_SHORT : constant Enum := 16#1402#; GL_UNSIGNED_SHORT : constant Enum := 16#1403#; GL_INT : constant Enum := 16#1404#; GL_UNSIGNED_INT : constant Enum := 16#1405#; GL_FLOAT : constant Enum := 16#1406#; GL_2_BYTES : constant Enum := 16#1407#; GL_3_BYTES : constant Enum := 16#1408#; GL_4_BYTES : constant Enum := 16#1409#; GL_DOUBLE : constant Enum := 16#140A#; GL_POINTS : constant Enum := 16#0#; GL_LINES : constant Enum := 16#1#; GL_LINE_LOOP : constant Enum := 16#2#; GL_LINE_STRIP : constant Enum := 16#3#; GL_TRIANGLES : constant Enum := 16#4#; GL_TRIANGLE_STRIP : constant Enum := 16#5#; GL_TRIANGLE_FAN : constant Enum := 16#6#; GL_QUADS : constant Enum := 16#7#; GL_QUAD_STRIP : constant Enum := 16#8#; GL_POLYGON : constant Enum := 16#9#; GL_VERTEX_ARRAY : constant Enum := 16#8074#; GL_NORMAL_ARRAY : constant Enum := 16#8075#; GL_COLOR_ARRAY : constant Enum := 16#8076#; GL_INDEX_ARRAY : constant Enum := 16#8077#; GL_TEXTURE_COORD_ARRAY : constant Enum := 16#8078#; GL_EDGE_FLAG_ARRAY : constant Enum := 16#8079#; GL_VERTEX_ARRAY_SIZE : constant Enum := 16#807A#; GL_VERTEX_ARRAY_TYPE : constant Enum := 16#807B#; GL_VERTEX_ARRAY_STRIDE : constant Enum := 16#807C#; GL_NORMAL_ARRAY_TYPE : constant Enum := 16#807E#; GL_NORMAL_ARRAY_STRIDE : constant Enum := 16#807F#; GL_COLOR_ARRAY_SIZE : constant Enum := 16#8081#; GL_COLOR_ARRAY_TYPE : constant Enum := 16#8082#; GL_COLOR_ARRAY_STRIDE : constant Enum := 16#8083#; GL_INDEX_ARRAY_TYPE : constant Enum := 16#8085#; GL_INDEX_ARRAY_STRIDE : constant Enum := 16#8086#; GL_TEXTURE_COORD_ARRAY_SIZE : constant Enum := 16#8088#; GL_TEXTURE_COORD_ARRAY_TYPE : constant Enum := 16#8089#; GL_TEXTURE_COORD_ARRAY_STRIDE : constant Enum := 16#808A#; GL_EDGE_FLAG_ARRAY_STRIDE : constant Enum := 16#808C#; GL_VERTEX_ARRAY_POINTER : constant Enum := 16#808E#; GL_NORMAL_ARRAY_POINTER : constant Enum := 16#808F#; GL_COLOR_ARRAY_POINTER : constant Enum := 16#8090#; GL_INDEX_ARRAY_POINTER : constant Enum := 16#8091#; GL_TEXTURE_COORD_ARRAY_POINTER : constant Enum := 16#8092#; GL_EDGE_FLAG_ARRAY_POINTER : constant Enum := 16#8093#; GL_V2F : constant Enum := 16#2A20#; GL_V3F : constant Enum := 16#2A21#; GL_C4UB_V2F : constant Enum := 16#2A22#; GL_C4UB_V3F : constant Enum := 16#2A23#; GL_C3F_V3F : constant Enum := 16#2A24#; GL_N3F_V3F : constant Enum := 16#2A25#; GL_C4F_N3F_V3F : constant Enum := 16#2A26#; GL_T2F_V3F : constant Enum := 16#2A27#; GL_T4F_V4F : constant Enum := 16#2A28#; GL_T2F_C4UB_V3F : constant Enum := 16#2A29#; GL_T2F_C3F_V3F : constant Enum := 16#2A2A#; GL_T2F_N3F_V3F : constant Enum := 16#2A2B#; GL_T2F_C4F_N3F_V3F : constant Enum := 16#2A2C#; GL_T4F_C4F_N3F_V4F : constant Enum := 16#2A2D#; GL_MATRIX_MODE : constant Enum := 16#BA0#; GL_MODELVIEW : constant Enum := 16#1700#; GL_PROJECTION : constant Enum := 16#1701#; GL_TEXTURE : constant Enum := 16#1702#; GL_POINT_SMOOTH : constant Enum := 16#B10#; GL_POINT_SIZE : constant Enum := 16#B11#; GL_POINT_SIZE_GRANULARITY : constant Enum := 16#B13#; GL_POINT_SIZE_RANGE : constant Enum := 16#B12#; GL_LINE_SMOOTH : constant Enum := 16#B20#; GL_LINE_STIPPLE : constant Enum := 16#B24#; GL_LINE_STIPPLE_PATTERN : constant Enum := 16#B25#; GL_LINE_STIPPLE_REPEAT : constant Enum := 16#B26#; GL_LINE_WIDTH : constant Enum := 16#B21#; GL_LINE_WIDTH_GRANULARITY : constant Enum := 16#B23#; GL_LINE_WIDTH_RANGE : constant Enum := 16#B22#; GL_POINT : constant Enum := 16#1B00#; GL_LINE : constant Enum := 16#1B01#; GL_FILL : constant Enum := 16#1B02#; GL_CW : constant Enum := 16#900#; GL_CCW : constant Enum := 16#901#; GL_FRONT : constant Enum := 16#404#; GL_BACK : constant Enum := 16#405#; GL_POLYGON_MODE : constant Enum := 16#B40#; GL_POLYGON_SMOOTH : constant Enum := 16#B41#; GL_POLYGON_STIPPLE : constant Enum := 16#B42#; GL_EDGE_FLAG : constant Enum := 16#B43#; GL_CULL_FACE : constant Enum := 16#B44#; GL_CULL_FACE_MODE : constant Enum := 16#B45#; GL_FRONT_FACE : constant Enum := 16#B46#; GL_POLYGON_OFFSET_FACTOR : constant Enum := 16#8038#; GL_POLYGON_OFFSET_UNITS : constant Enum := 16#2A00#; GL_POLYGON_OFFSET_POINT : constant Enum := 16#2A01#; GL_POLYGON_OFFSET_LINE : constant Enum := 16#2A02#; GL_POLYGON_OFFSET_FILL : constant Enum := 16#8037#; GL_COMPILE : constant Enum := 16#1300#; GL_COMPILE_AND_EXECUTE : constant Enum := 16#1301#; GL_LIST_BASE : constant Enum := 16#B32#; GL_LIST_INDEX : constant Enum := 16#B33#; GL_LIST_MODE : constant Enum := 16#B30#; GL_NEVER : constant Enum := 16#200#; GL_LESS : constant Enum := 16#201#; GL_EQUAL : constant Enum := 16#202#; GL_LEQUAL : constant Enum := 16#203#; GL_GREATER : constant Enum := 16#204#; GL_NOTEQUAL : constant Enum := 16#205#; GL_GEQUAL : constant Enum := 16#206#; GL_ALWAYS : constant Enum := 16#207#; GL_DEPTH_TEST : constant Enum := 16#B71#; GL_DEPTH_BITS : constant Enum := 16#D56#; GL_DEPTH_CLEAR_VALUE : constant Enum := 16#B73#; GL_DEPTH_FUNC : constant Enum := 16#B74#; GL_DEPTH_RANGE : constant Enum := 16#B70#; GL_DEPTH_WRITEMASK : constant Enum := 16#B72#; GL_DEPTH_COMPONENT : constant Enum := 16#1902#; GL_LIGHTING : constant Enum := 16#B50#; GL_LIGHT0 : constant Enum := 16#4000#; GL_LIGHT1 : constant Enum := 16#4001#; GL_LIGHT2 : constant Enum := 16#4002#; GL_LIGHT3 : constant Enum := 16#4003#; GL_LIGHT4 : constant Enum := 16#4004#; GL_LIGHT5 : constant Enum := 16#4005#; GL_LIGHT6 : constant Enum := 16#4006#; GL_LIGHT7 : constant Enum := 16#4007#; GL_SPOT_EXPONENT : constant Enum := 16#1205#; GL_SPOT_CUTOFF : constant Enum := 16#1206#; GL_CONSTANT_ATTENUATION : constant Enum := 16#1207#; GL_LINEAR_ATTENUATION : constant Enum := 16#1208#; GL_QUADRATIC_ATTENUATION : constant Enum := 16#1209#; GL_AMBIENT : constant Enum := 16#1200#; GL_DIFFUSE : constant Enum := 16#1201#; GL_SPECULAR : constant Enum := 16#1202#; GL_SHININESS : constant Enum := 16#1601#; GL_EMISSION : constant Enum := 16#1600#; GL_POSITION : constant Enum := 16#1203#; GL_SPOT_DIRECTION : constant Enum := 16#1204#; GL_AMBIENT_AND_DIFFUSE : constant Enum := 16#1602#; GL_COLOR_INDEXES : constant Enum := 16#1603#; GL_LIGHT_MODEL_TWO_SIDE : constant Enum := 16#B52#; GL_LIGHT_MODEL_LOCAL_VIEWER : constant Enum := 16#B51#; GL_LIGHT_MODEL_AMBIENT : constant Enum := 16#B53#; GL_FRONT_AND_BACK : constant Enum := 16#408#; GL_SHADE_MODEL : constant Enum := 16#B54#; GL_FLAT : constant Enum := 16#1D00#; GL_SMOOTH : constant Enum := 16#1D01#; GL_COLOR_MATERIAL : constant Enum := 16#B57#; GL_COLOR_MATERIAL_FACE : constant Enum := 16#B55#; GL_COLOR_MATERIAL_PARAMETER : constant Enum := 16#B56#; GL_NORMALIZE : constant Enum := 16#BA1#; GL_CLIP_PLANE0 : constant Enum := 16#3000#; GL_CLIP_PLANE1 : constant Enum := 16#3001#; GL_CLIP_PLANE2 : constant Enum := 16#3002#; GL_CLIP_PLANE3 : constant Enum := 16#3003#; GL_CLIP_PLANE4 : constant Enum := 16#3004#; GL_CLIP_PLANE5 : constant Enum := 16#3005#; GL_ACCUM_RED_BITS : constant Enum := 16#D58#; GL_ACCUM_GREEN_BITS : constant Enum := 16#D59#; GL_ACCUM_BLUE_BITS : constant Enum := 16#D5A#; GL_ACCUM_ALPHA_BITS : constant Enum := 16#D5B#; GL_ACCUM_CLEAR_VALUE : constant Enum := 16#B80#; GL_ACCUM : constant Enum := 16#100#; GL_ADD : constant Enum := 16#104#; GL_LOAD : constant Enum := 16#101#; GL_MULT : constant Enum := 16#103#; GL_RETURN : constant Enum := 16#102#; GL_ALPHA_TEST : constant Enum := 16#BC0#; GL_ALPHA_TEST_REF : constant Enum := 16#BC2#; GL_ALPHA_TEST_FUNC : constant Enum := 16#BC1#; GL_BLEND : constant Enum := 16#BE2#; GL_BLEND_SRC : constant Enum := 16#BE1#; GL_BLEND_DST : constant Enum := 16#BE0#; GL_ZERO : constant Enum := 16#0#; GL_ONE : constant Enum := 16#1#; GL_SRC_COLOR : constant Enum := 16#300#; GL_ONE_MINUS_SRC_COLOR : constant Enum := 16#301#; GL_SRC_ALPHA : constant Enum := 16#302#; GL_ONE_MINUS_SRC_ALPHA : constant Enum := 16#303#; GL_DST_ALPHA : constant Enum := 16#304#; GL_ONE_MINUS_DST_ALPHA : constant Enum := 16#305#; GL_DST_COLOR : constant Enum := 16#306#; GL_ONE_MINUS_DST_COLOR : constant Enum := 16#307#; GL_SRC_ALPHA_SATURATE : constant Enum := 16#308#; GL_FEEDBACK : constant Enum := 16#1C01#; GL_RENDER : constant Enum := 16#1C00#; GL_SELECT : constant Enum := 16#1C02#; GL_2D : constant Enum := 16#600#; GL_3D : constant Enum := 16#601#; GL_3D_COLOR : constant Enum := 16#602#; GL_3D_COLOR_TEXTURE : constant Enum := 16#603#; GL_4D_COLOR_TEXTURE : constant Enum := 16#604#; GL_POINT_TOKEN : constant Enum := 16#701#; GL_LINE_TOKEN : constant Enum := 16#702#; GL_LINE_RESET_TOKEN : constant Enum := 16#707#; GL_POLYGON_TOKEN : constant Enum := 16#703#; GL_BITMAP_TOKEN : constant Enum := 16#704#; GL_DRAW_PIXEL_TOKEN : constant Enum := 16#705#; GL_COPY_PIXEL_TOKEN : constant Enum := 16#706#; GL_PASS_THROUGH_TOKEN : constant Enum := 16#700#; GL_FEEDBACK_BUFFER_POINTER : constant Enum := 16#DF0#; GL_FEEDBACK_BUFFER_SIZE : constant Enum := 16#DF1#; GL_FEEDBACK_BUFFER_TYPE : constant Enum := 16#DF2#; GL_SELECTION_BUFFER_POINTER : constant Enum := 16#DF3#; GL_SELECTION_BUFFER_SIZE : constant Enum := 16#DF4#; GL_FOG : constant Enum := 16#B60#; GL_FOG_MODE : constant Enum := 16#B65#; GL_FOG_DENSITY : constant Enum := 16#B62#; GL_FOG_COLOR : constant Enum := 16#B66#; GL_FOG_INDEX : constant Enum := 16#B61#; GL_FOG_START : constant Enum := 16#B63#; GL_FOG_END : constant Enum := 16#B64#; GL_LINEAR : constant Enum := 16#2601#; GL_EXP : constant Enum := 16#800#; GL_EXP2 : constant Enum := 16#801#; GL_LOGIC_OP : constant Enum := 16#BF1#; GL_INDEX_LOGIC_OP : constant Enum := 16#BF1#; GL_COLOR_LOGIC_OP : constant Enum := 16#BF2#; GL_LOGIC_OP_MODE : constant Enum := 16#BF0#; GL_CLEAR : constant Enum := 16#1500#; GL_SET : constant Enum := 16#150F#; GL_COPY : constant Enum := 16#1503#; GL_COPY_INVERTED : constant Enum := 16#150C#; GL_NOOP : constant Enum := 16#1505#; GL_INVERT : constant Enum := 16#150A#; GL_AND : constant Enum := 16#1501#; GL_NAND : constant Enum := 16#150E#; GL_OR : constant Enum := 16#1507#; GL_NOR : constant Enum := 16#1508#; GL_XOR : constant Enum := 16#1506#; GL_EQUIV : constant Enum := 16#1509#; GL_AND_REVERSE : constant Enum := 16#1502#; GL_AND_INVERTED : constant Enum := 16#1504#; GL_OR_REVERSE : constant Enum := 16#150B#; GL_OR_INVERTED : constant Enum := 16#150D#; GL_STENCIL_BITS : constant Enum := 16#D57#; GL_STENCIL_TEST : constant Enum := 16#B90#; GL_STENCIL_CLEAR_VALUE : constant Enum := 16#B91#; GL_STENCIL_FUNC : constant Enum := 16#B92#; GL_STENCIL_VALUE_MASK : constant Enum := 16#B93#; GL_STENCIL_FAIL : constant Enum := 16#B94#; GL_STENCIL_PASS_DEPTH_FAIL : constant Enum := 16#B95#; GL_STENCIL_PASS_DEPTH_PASS : constant Enum := 16#B96#; GL_STENCIL_REF : constant Enum := 16#B97#; GL_STENCIL_WRITEMASK : constant Enum := 16#B98#; GL_STENCIL_INDEX : constant Enum := 16#1901#; GL_KEEP : constant Enum := 16#1E00#; GL_REPLACE : constant Enum := 16#1E01#; GL_INCR : constant Enum := 16#1E02#; GL_DECR : constant Enum := 16#1E03#; GL_NONE : constant Enum := 16#0#; GL_LEFT : constant Enum := 16#406#; GL_RIGHT : constant Enum := 16#407#; GL_FRONT_LEFT : constant Enum := 16#400#; GL_FRONT_RIGHT : constant Enum := 16#401#; GL_BACK_LEFT : constant Enum := 16#402#; GL_BACK_RIGHT : constant Enum := 16#403#; GL_AUX0 : constant Enum := 16#409#; GL_AUX1 : constant Enum := 16#40A#; GL_AUX2 : constant Enum := 16#40B#; GL_AUX3 : constant Enum := 16#40C#; GL_COLOR_INDEX : constant Enum := 16#1900#; GL_RED : constant Enum := 16#1903#; GL_GREEN : constant Enum := 16#1904#; GL_BLUE : constant Enum := 16#1905#; GL_ALPHA : constant Enum := 16#1906#; GL_LUMINANCE : constant Enum := 16#1909#; GL_LUMINANCE_ALPHA : constant Enum := 16#190A#; GL_ALPHA_BITS : constant Enum := 16#D55#; GL_RED_BITS : constant Enum := 16#D52#; GL_GREEN_BITS : constant Enum := 16#D53#; GL_BLUE_BITS : constant Enum := 16#D54#; GL_INDEX_BITS : constant Enum := 16#D51#; GL_SUBPIXEL_BITS : constant Enum := 16#D50#; GL_AUX_BUFFERS : constant Enum := 16#C00#; GL_READ_BUFFER : constant Enum := 16#C02#; GL_DRAW_BUFFER : constant Enum := 16#C01#; GL_DOUBLEBUFFER : constant Enum := 16#C32#; GL_STEREO : constant Enum := 16#C33#; GL_BITMAP : constant Enum := 16#1A00#; GL_COLOR : constant Enum := 16#1800#; GL_DEPTH : constant Enum := 16#1801#; GL_STENCIL : constant Enum := 16#1802#; GL_DITHER : constant Enum := 16#BD0#; GL_RGB : constant Enum := 16#1907#; GL_RGBA : constant Enum := 16#1908#; GL_MAX_LIST_NESTING : constant Enum := 16#B31#; GL_MAX_EVAL_ORDER : constant Enum := 16#D30#; GL_MAX_LIGHTS : constant Enum := 16#D31#; GL_MAX_CLIP_PLANES : constant Enum := 16#D32#; GL_MAX_TEXTURE_SIZE : constant Enum := 16#D33#; GL_MAX_PIXEL_MAP_TABLE : constant Enum := 16#D34#; GL_MAX_ATTRIB_STACK_DEPTH : constant Enum := 16#D35#; GL_MAX_MODELVIEW_STACK_DEPTH : constant Enum := 16#D36#; GL_MAX_NAME_STACK_DEPTH : constant Enum := 16#D37#; GL_MAX_PROJECTION_STACK_DEPTH : constant Enum := 16#D38#; GL_MAX_TEXTURE_STACK_DEPTH : constant Enum := 16#D39#; GL_MAX_VIEWPORT_DIMS : constant Enum := 16#D3A#; GL_MAX_CLIENT_ATTRIB_STACK_DEPTH : constant Enum := 16#D3B#; GL_ATTRIB_STACK_DEPTH : constant Enum := 16#BB0#; GL_CLIENT_ATTRIB_STACK_DEPTH : constant Enum := 16#BB1#; GL_COLOR_CLEAR_VALUE : constant Enum := 16#C22#; GL_COLOR_WRITEMASK : constant Enum := 16#C23#; GL_CURRENT_INDEX : constant Enum := 16#B01#; GL_CURRENT_COLOR : constant Enum := 16#B00#; GL_CURRENT_NORMAL : constant Enum := 16#B02#; GL_CURRENT_RASTER_COLOR : constant Enum := 16#B04#; GL_CURRENT_RASTER_DISTANCE : constant Enum := 16#B09#; GL_CURRENT_RASTER_INDEX : constant Enum := 16#B05#; GL_CURRENT_RASTER_POSITION : constant Enum := 16#B07#; GL_CURRENT_RASTER_TEXTURE_COORDS : constant Enum := 16#B06#; GL_CURRENT_RASTER_POSITION_VALID : constant Enum := 16#B08#; GL_CURRENT_TEXTURE_COORDS : constant Enum := 16#B03#; GL_INDEX_CLEAR_VALUE : constant Enum := 16#C20#; GL_INDEX_MODE : constant Enum := 16#C30#; GL_INDEX_WRITEMASK : constant Enum := 16#C21#; GL_MODELVIEW_MATRIX : constant Enum := 16#BA6#; GL_MODELVIEW_STACK_DEPTH : constant Enum := 16#BA3#; GL_NAME_STACK_DEPTH : constant Enum := 16#D70#; GL_PROJECTION_MATRIX : constant Enum := 16#BA7#; GL_PROJECTION_STACK_DEPTH : constant Enum := 16#BA4#; GL_RENDER_MODE : constant Enum := 16#C40#; GL_RGBA_MODE : constant Enum := 16#C31#; GL_TEXTURE_MATRIX : constant Enum := 16#BA8#; GL_TEXTURE_STACK_DEPTH : constant Enum := 16#BA5#; GL_VIEWPORT : constant Enum := 16#BA2#; GL_AUTO_NORMAL : constant Enum := 16#D80#; GL_MAP1_COLOR_4 : constant Enum := 16#D90#; GL_MAP1_INDEX : constant Enum := 16#D91#; GL_MAP1_NORMAL : constant Enum := 16#D92#; GL_MAP1_TEXTURE_COORD_1 : constant Enum := 16#D93#; GL_MAP1_TEXTURE_COORD_2 : constant Enum := 16#D94#; GL_MAP1_TEXTURE_COORD_3 : constant Enum := 16#D95#; GL_MAP1_TEXTURE_COORD_4 : constant Enum := 16#D96#; GL_MAP1_VERTEX_3 : constant Enum := 16#D97#; GL_MAP1_VERTEX_4 : constant Enum := 16#D98#; GL_MAP2_COLOR_4 : constant Enum := 16#DB0#; GL_MAP2_INDEX : constant Enum := 16#DB1#; GL_MAP2_NORMAL : constant Enum := 16#DB2#; GL_MAP2_TEXTURE_COORD_1 : constant Enum := 16#DB3#; GL_MAP2_TEXTURE_COORD_2 : constant Enum := 16#DB4#; GL_MAP2_TEXTURE_COORD_3 : constant Enum := 16#DB5#; GL_MAP2_TEXTURE_COORD_4 : constant Enum := 16#DB6#; GL_MAP2_VERTEX_3 : constant Enum := 16#DB7#; GL_MAP2_VERTEX_4 : constant Enum := 16#DB8#; GL_MAP1_GRID_DOMAIN : constant Enum := 16#DD0#; GL_MAP1_GRID_SEGMENTS : constant Enum := 16#DD1#; GL_MAP2_GRID_DOMAIN : constant Enum := 16#DD2#; GL_MAP2_GRID_SEGMENTS : constant Enum := 16#DD3#; GL_COEFF : constant Enum := 16#A00#; GL_ORDER : constant Enum := 16#A01#; GL_DOMAIN : constant Enum := 16#A02#; GL_PERSPECTIVE_CORRECTION_HINT : constant Enum := 16#C50#; GL_POINT_SMOOTH_HINT : constant Enum := 16#C51#; GL_LINE_SMOOTH_HINT : constant Enum := 16#C52#; GL_POLYGON_SMOOTH_HINT : constant Enum := 16#C53#; GL_FOG_HINT : constant Enum := 16#C54#; GL_DONT_CARE : constant Enum := 16#1100#; GL_FASTEST : constant Enum := 16#1101#; GL_NICEST : constant Enum := 16#1102#; GL_SCISSOR_BOX : constant Enum := 16#C10#; GL_SCISSOR_TEST : constant Enum := 16#C11#; GL_MAP_COLOR : constant Enum := 16#D10#; GL_MAP_STENCIL : constant Enum := 16#D11#; GL_INDEX_SHIFT : constant Enum := 16#D12#; GL_INDEX_OFFSET : constant Enum := 16#D13#; GL_RED_SCALE : constant Enum := 16#D14#; GL_RED_BIAS : constant Enum := 16#D15#; GL_GREEN_SCALE : constant Enum := 16#D18#; GL_GREEN_BIAS : constant Enum := 16#D19#; GL_BLUE_SCALE : constant Enum := 16#D1A#; GL_BLUE_BIAS : constant Enum := 16#D1B#; GL_ALPHA_SCALE : constant Enum := 16#D1C#; GL_ALPHA_BIAS : constant Enum := 16#D1D#; GL_DEPTH_SCALE : constant Enum := 16#D1E#; GL_DEPTH_BIAS : constant Enum := 16#D1F#; GL_PIXEL_MAP_S_TO_S_SIZE : constant Enum := 16#CB1#; GL_PIXEL_MAP_I_TO_I_SIZE : constant Enum := 16#CB0#; GL_PIXEL_MAP_I_TO_R_SIZE : constant Enum := 16#CB2#; GL_PIXEL_MAP_I_TO_G_SIZE : constant Enum := 16#CB3#; GL_PIXEL_MAP_I_TO_B_SIZE : constant Enum := 16#CB4#; GL_PIXEL_MAP_I_TO_A_SIZE : constant Enum := 16#CB5#; GL_PIXEL_MAP_R_TO_R_SIZE : constant Enum := 16#CB6#; GL_PIXEL_MAP_G_TO_G_SIZE : constant Enum := 16#CB7#; GL_PIXEL_MAP_B_TO_B_SIZE : constant Enum := 16#CB8#; GL_PIXEL_MAP_A_TO_A_SIZE : constant Enum := 16#CB9#; GL_PIXEL_MAP_S_TO_S : constant Enum := 16#C71#; GL_PIXEL_MAP_I_TO_I : constant Enum := 16#C70#; GL_PIXEL_MAP_I_TO_R : constant Enum := 16#C72#; GL_PIXEL_MAP_I_TO_G : constant Enum := 16#C73#; GL_PIXEL_MAP_I_TO_B : constant Enum := 16#C74#; GL_PIXEL_MAP_I_TO_A : constant Enum := 16#C75#; GL_PIXEL_MAP_R_TO_R : constant Enum := 16#C76#; GL_PIXEL_MAP_G_TO_G : constant Enum := 16#C77#; GL_PIXEL_MAP_B_TO_B : constant Enum := 16#C78#; GL_PIXEL_MAP_A_TO_A : constant Enum := 16#C79#; GL_PACK_ALIGNMENT : constant Enum := 16#D05#; GL_PACK_LSB_FIRST : constant Enum := 16#D01#; GL_PACK_ROW_LENGTH : constant Enum := 16#D02#; GL_PACK_SKIP_PIXELS : constant Enum := 16#D04#; GL_PACK_SKIP_ROWS : constant Enum := 16#D03#; GL_PACK_SWAP_BYTES : constant Enum := 16#D00#; GL_UNPACK_ALIGNMENT : constant Enum := 16#CF5#; GL_UNPACK_LSB_FIRST : constant Enum := 16#CF1#; GL_UNPACK_ROW_LENGTH : constant Enum := 16#CF2#; GL_UNPACK_SKIP_PIXELS : constant Enum := 16#CF4#; GL_UNPACK_SKIP_ROWS : constant Enum := 16#CF3#; GL_UNPACK_SWAP_BYTES : constant Enum := 16#CF0#; GL_ZOOM_X : constant Enum := 16#D16#; GL_ZOOM_Y : constant Enum := 16#D17#; GL_TEXTURE_ENV : constant Enum := 16#2300#; GL_TEXTURE_ENV_MODE : constant Enum := 16#2200#; GL_TEXTURE_1D : constant Enum := 16#DE0#; GL_TEXTURE_2D : constant Enum := 16#DE1#; GL_TEXTURE_WRAP_S : constant Enum := 16#2802#; GL_TEXTURE_WRAP_T : constant Enum := 16#2803#; GL_TEXTURE_MAG_FILTER : constant Enum := 16#2800#; GL_TEXTURE_MIN_FILTER : constant Enum := 16#2801#; GL_TEXTURE_ENV_COLOR : constant Enum := 16#2201#; GL_TEXTURE_GEN_S : constant Enum := 16#C60#; GL_TEXTURE_GEN_T : constant Enum := 16#C61#; GL_TEXTURE_GEN_MODE : constant Enum := 16#2500#; GL_TEXTURE_BORDER_COLOR : constant Enum := 16#1004#; GL_TEXTURE_WIDTH : constant Enum := 16#1000#; GL_TEXTURE_HEIGHT : constant Enum := 16#1001#; GL_TEXTURE_BORDER : constant Enum := 16#1005#; GL_TEXTURE_COMPONENTS : constant Enum := 16#1003#; GL_TEXTURE_RED_SIZE : constant Enum := 16#805C#; GL_TEXTURE_GREEN_SIZE : constant Enum := 16#805D#; GL_TEXTURE_BLUE_SIZE : constant Enum := 16#805E#; GL_TEXTURE_ALPHA_SIZE : constant Enum := 16#805F#; GL_TEXTURE_LUMINANCE_SIZE : constant Enum := 16#8060#; GL_TEXTURE_INTENSITY_SIZE : constant Enum := 16#8061#; GL_NEAREST_MIPMAP_NEAREST : constant Enum := 16#2700#; GL_NEAREST_MIPMAP_LINEAR : constant Enum := 16#2702#; GL_LINEAR_MIPMAP_NEAREST : constant Enum := 16#2701#; GL_LINEAR_MIPMAP_LINEAR : constant Enum := 16#2703#; GL_OBJECT_LINEAR : constant Enum := 16#2401#; GL_OBJECT_PLANE : constant Enum := 16#2501#; GL_EYE_LINEAR : constant Enum := 16#2400#; GL_EYE_PLANE : constant Enum := 16#2502#; GL_SPHERE_MAP : constant Enum := 16#2402#; GL_DECAL : constant Enum := 16#2101#; GL_MODULATE : constant Enum := 16#2100#; GL_NEAREST : constant Enum := 16#2600#; GL_REPEAT : constant Enum := 16#2901#; GL_CLAMP : constant Enum := 16#2900#; GL_S : constant Enum := 16#2000#; GL_T : constant Enum := 16#2001#; GL_R : constant Enum := 16#2002#; GL_Q : constant Enum := 16#2003#; GL_TEXTURE_GEN_R : constant Enum := 16#C62#; GL_TEXTURE_GEN_Q : constant Enum := 16#C63#; GL_VENDOR : constant Enum := 16#1F00#; GL_RENDERER : constant Enum := 16#1F01#; GL_VERSION : constant Enum := 16#1F02#; GL_SHADING_LANGUAGE_VERSION : constant Enum := 16#8B8C#; GL_EXTENSIONS : constant Enum := 16#1F03#; GL_NO_ERROR : constant Enum := 16#0#; GL_INVALID_ENUM : constant Enum := 16#500#; GL_INVALID_VALUE : constant Enum := 16#501#; GL_INVALID_OPERATION : constant Enum := 16#502#; GL_STACK_OVERFLOW : constant Enum := 16#503#; GL_STACK_UNDERFLOW : constant Enum := 16#504#; GL_OUT_OF_MEMORY : constant Enum := 16#505#; GL_PROXY_TEXTURE_1D : constant Enum := 16#8063#; GL_PROXY_TEXTURE_2D : constant Enum := 16#8064#; GL_TEXTURE_PRIORITY : constant Enum := 16#8066#; GL_TEXTURE_RESIDENT : constant Enum := 16#8067#; GL_TEXTURE_BINDING_1D : constant Enum := 16#8068#; GL_TEXTURE_BINDING_2D : constant Enum := 16#8069#; GL_TEXTURE_INTERNAL_FORMAT : constant Enum := 16#1003#; GL_ALPHA4 : constant Enum := 16#803B#; GL_ALPHA8 : constant Enum := 16#803C#; GL_ALPHA12 : constant Enum := 16#803D#; GL_ALPHA16 : constant Enum := 16#803E#; GL_LUMINANCE4 : constant Enum := 16#803F#; GL_LUMINANCE8 : constant Enum := 16#8040#; GL_LUMINANCE12 : constant Enum := 16#8041#; GL_LUMINANCE16 : constant Enum := 16#8042#; GL_LUMINANCE4_ALPHA4 : constant Enum := 16#8043#; GL_LUMINANCE6_ALPHA2 : constant Enum := 16#8044#; GL_LUMINANCE8_ALPHA8 : constant Enum := 16#8045#; GL_LUMINANCE12_ALPHA4 : constant Enum := 16#8046#; GL_LUMINANCE12_ALPHA12 : constant Enum := 16#8047#; GL_LUMINANCE16_ALPHA16 : constant Enum := 16#8048#; GL_INTENSITY : constant Enum := 16#8049#; GL_INTENSITY4 : constant Enum := 16#804A#; GL_INTENSITY8 : constant Enum := 16#804B#; GL_INTENSITY12 : constant Enum := 16#804C#; GL_INTENSITY16 : constant Enum := 16#804D#; GL_R3_G3_B2 : constant Enum := 16#2A10#; GL_RGB4 : constant Enum := 16#804F#; GL_RGB5 : constant Enum := 16#8050#; GL_RGB8 : constant Enum := 16#8051#; GL_RGB10 : constant Enum := 16#8052#; GL_RGB12 : constant Enum := 16#8053#; GL_RGB16 : constant Enum := 16#8054#; GL_RGBA2 : constant Enum := 16#8055#; GL_RGBA4 : constant Enum := 16#8056#; GL_RGB5_A1 : constant Enum := 16#8057#; GL_RGBA8 : constant Enum := 16#8058#; GL_RGB10_A2 : constant Enum := 16#8059#; GL_RGBA12 : constant Enum := 16#805A#; GL_RGBA16 : constant Enum := 16#805B#; GL_CLIENT_PIXEL_STORE_BIT : constant Enum := 16#1#; GL_CLIENT_VERTEX_ARRAY_BIT : constant Enum := 16#2#; GL_ALL_CLIENT_ATTRIB_BITS : constant Enum := 16#FFFFFFFF#; GL_CLIENT_ALL_ATTRIB_BITS : constant Enum := 16#FFFFFFFF#; GL_RESCALE_NORMAL : constant Enum := 16#803A#; GL_CLAMP_TO_EDGE : constant Enum := 16#812F#; GL_MAX_ELEMENTS_VERTICES : constant Enum := 16#80E8#; GL_MAX_ELEMENTS_INDICES : constant Enum := 16#80E9#; GL_BGR : constant Enum := 16#80E0#; GL_BGRA : constant Enum := 16#80E1#; GL_UNSIGNED_BYTE_3_3_2 : constant Enum := 16#8032#; GL_UNSIGNED_BYTE_2_3_3_REV : constant Enum := 16#8362#; GL_UNSIGNED_SHORT_5_6_5 : constant Enum := 16#8363#; GL_UNSIGNED_SHORT_5_6_5_REV : constant Enum := 16#8364#; GL_UNSIGNED_SHORT_4_4_4_4 : constant Enum := 16#8033#; GL_UNSIGNED_SHORT_4_4_4_4_REV : constant Enum := 16#8365#; GL_UNSIGNED_SHORT_5_5_5_1 : constant Enum := 16#8034#; GL_UNSIGNED_SHORT_1_5_5_5_REV : constant Enum := 16#8366#; GL_UNSIGNED_INT_8_8_8_8 : constant Enum := 16#8035#; GL_UNSIGNED_INT_8_8_8_8_REV : constant Enum := 16#8367#; GL_UNSIGNED_INT_10_10_10_2 : constant Enum := 16#8036#; GL_UNSIGNED_INT_2_10_10_10_REV : constant Enum := 16#8368#; GL_LIGHT_MODEL_COLOR_CONTROL : constant Enum := 16#81F8#; GL_SINGLE_COLOR : constant Enum := 16#81F9#; GL_SEPARATE_SPECULAR_COLOR : constant Enum := 16#81FA#; GL_TEXTURE_MIN_LOD : constant Enum := 16#813A#; GL_TEXTURE_MAX_LOD : constant Enum := 16#813B#; GL_TEXTURE_BASE_LEVEL : constant Enum := 16#813C#; GL_TEXTURE_MAX_LEVEL : constant Enum := 16#813D#; GL_SMOOTH_POINT_SIZE_RANGE : constant Enum := 16#B12#; GL_SMOOTH_POINT_SIZE_GRANULARITY : constant Enum := 16#B13#; GL_SMOOTH_LINE_WIDTH_RANGE : constant Enum := 16#B22#; GL_SMOOTH_LINE_WIDTH_GRANULARITY : constant Enum := 16#B23#; GL_ALIASED_POINT_SIZE_RANGE : constant Enum := 16#846D#; GL_ALIASED_LINE_WIDTH_RANGE : constant Enum := 16#846E#; GL_PACK_SKIP_IMAGES : constant Enum := 16#806B#; GL_PACK_IMAGE_HEIGHT : constant Enum := 16#806C#; GL_UNPACK_SKIP_IMAGES : constant Enum := 16#806D#; GL_UNPACK_IMAGE_HEIGHT : constant Enum := 16#806E#; GL_TEXTURE_3D : constant Enum := 16#806F#; GL_PROXY_TEXTURE_3D : constant Enum := 16#8070#; GL_TEXTURE_DEPTH : constant Enum := 16#8071#; GL_TEXTURE_WRAP_R : constant Enum := 16#8072#; GL_MAX_3D_TEXTURE_SIZE : constant Enum := 16#8073#; GL_TEXTURE_BINDING_3D : constant Enum := 16#806A#; GL_CONSTANT_COLOR : constant Enum := 16#8001#; GL_ONE_MINUS_CONSTANT_COLOR : constant Enum := 16#8002#; GL_CONSTANT_ALPHA : constant Enum := 16#8003#; GL_ONE_MINUS_CONSTANT_ALPHA : constant Enum := 16#8004#; GL_COLOR_TABLE : constant Enum := 16#80D0#; GL_POST_CONVOLUTION_COLOR_TABLE : constant Enum := 16#80D1#; GL_POST_COLOR_MATRIX_COLOR_TABLE : constant Enum := 16#80D2#; GL_PROXY_COLOR_TABLE : constant Enum := 16#80D3#; GL_PROXY_POST_CONVOLUTION_COLOR_TABLE : constant Enum := 16#80D4#; GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE : constant Enum := 16#80D5#; GL_COLOR_TABLE_SCALE : constant Enum := 16#80D6#; GL_COLOR_TABLE_BIAS : constant Enum := 16#80D7#; GL_COLOR_TABLE_FORMAT : constant Enum := 16#80D8#; GL_COLOR_TABLE_WIDTH : constant Enum := 16#80D9#; GL_COLOR_TABLE_RED_SIZE : constant Enum := 16#80DA#; GL_COLOR_TABLE_GREEN_SIZE : constant Enum := 16#80DB#; GL_COLOR_TABLE_BLUE_SIZE : constant Enum := 16#80DC#; GL_COLOR_TABLE_ALPHA_SIZE : constant Enum := 16#80DD#; GL_COLOR_TABLE_LUMINANCE_SIZE : constant Enum := 16#80DE#; GL_COLOR_TABLE_INTENSITY_SIZE : constant Enum := 16#80DF#; GL_CONVOLUTION_1D : constant Enum := 16#8010#; GL_CONVOLUTION_2D : constant Enum := 16#8011#; GL_SEPARABLE_2D : constant Enum := 16#8012#; GL_CONVOLUTION_BORDER_MODE : constant Enum := 16#8013#; GL_CONVOLUTION_FILTER_SCALE : constant Enum := 16#8014#; GL_CONVOLUTION_FILTER_BIAS : constant Enum := 16#8015#; GL_REDUCE : constant Enum := 16#8016#; GL_CONVOLUTION_FORMAT : constant Enum := 16#8017#; GL_CONVOLUTION_WIDTH : constant Enum := 16#8018#; GL_CONVOLUTION_HEIGHT : constant Enum := 16#8019#; GL_MAX_CONVOLUTION_WIDTH : constant Enum := 16#801A#; GL_MAX_CONVOLUTION_HEIGHT : constant Enum := 16#801B#; GL_POST_CONVOLUTION_RED_SCALE : constant Enum := 16#801C#; GL_POST_CONVOLUTION_GREEN_SCALE : constant Enum := 16#801D#; GL_POST_CONVOLUTION_BLUE_SCALE : constant Enum := 16#801E#; GL_POST_CONVOLUTION_ALPHA_SCALE : constant Enum := 16#801F#; GL_POST_CONVOLUTION_RED_BIAS : constant Enum := 16#8020#; GL_POST_CONVOLUTION_GREEN_BIAS : constant Enum := 16#8021#; GL_POST_CONVOLUTION_BLUE_BIAS : constant Enum := 16#8022#; GL_POST_CONVOLUTION_ALPHA_BIAS : constant Enum := 16#8023#; GL_CONSTANT_BORDER : constant Enum := 16#8151#; GL_REPLICATE_BORDER : constant Enum := 16#8153#; GL_CONVOLUTION_BORDER_COLOR : constant Enum := 16#8154#; GL_COLOR_MATRIX : constant Enum := 16#80B1#; GL_COLOR_MATRIX_STACK_DEPTH : constant Enum := 16#80B2#; GL_MAX_COLOR_MATRIX_STACK_DEPTH : constant Enum := 16#80B3#; GL_POST_COLOR_MATRIX_RED_SCALE : constant Enum := 16#80B4#; GL_POST_COLOR_MATRIX_GREEN_SCALE : constant Enum := 16#80B5#; GL_POST_COLOR_MATRIX_BLUE_SCALE : constant Enum := 16#80B6#; GL_POST_COLOR_MATRIX_ALPHA_SCALE : constant Enum := 16#80B7#; GL_POST_COLOR_MATRIX_RED_BIAS : constant Enum := 16#80B8#; GL_POST_COLOR_MATRIX_GREEN_BIAS : constant Enum := 16#80B9#; GL_POST_COLOR_MATRIX_BLUE_BIAS : constant Enum := 16#80BA#; GL_POST_COLOR_MATRIX_ALPHA_BIAS : constant Enum := 16#80BB#; GL_HISTOGRAM : constant Enum := 16#8024#; GL_PROXY_HISTOGRAM : constant Enum := 16#8025#; GL_HISTOGRAM_WIDTH : constant Enum := 16#8026#; GL_HISTOGRAM_FORMAT : constant Enum := 16#8027#; GL_HISTOGRAM_RED_SIZE : constant Enum := 16#8028#; GL_HISTOGRAM_GREEN_SIZE : constant Enum := 16#8029#; GL_HISTOGRAM_BLUE_SIZE : constant Enum := 16#802A#; GL_HISTOGRAM_ALPHA_SIZE : constant Enum := 16#802B#; GL_HISTOGRAM_LUMINANCE_SIZE : constant Enum := 16#802C#; GL_HISTOGRAM_SINK : constant Enum := 16#802D#; GL_MINMAX : constant Enum := 16#802E#; GL_MINMAX_FORMAT : constant Enum := 16#802F#; GL_MINMAX_SINK : constant Enum := 16#8030#; GL_TABLE_TOO_LARGE : constant Enum := 16#8031#; GL_BLEND_EQUATION : constant Enum := 16#8009#; GL_MIN : constant Enum := 16#8007#; GL_MAX : constant Enum := 16#8008#; GL_FUNC_ADD : constant Enum := 16#8006#; GL_FUNC_SUBTRACT : constant Enum := 16#800A#; GL_FUNC_REVERSE_SUBTRACT : constant Enum := 16#800B#; GL_BLEND_COLOR : constant Enum := 16#8005#; GL_TEXTURE0 : constant Enum := 16#84C0#; GL_TEXTURE1 : constant Enum := 16#84C1#; GL_TEXTURE2 : constant Enum := 16#84C2#; GL_TEXTURE3 : constant Enum := 16#84C3#; GL_TEXTURE4 : constant Enum := 16#84C4#; GL_TEXTURE5 : constant Enum := 16#84C5#; GL_TEXTURE6 : constant Enum := 16#84C6#; GL_TEXTURE7 : constant Enum := 16#84C7#; GL_TEXTURE8 : constant Enum := 16#84C8#; GL_TEXTURE9 : constant Enum := 16#84C9#; GL_TEXTURE10 : constant Enum := 16#84CA#; GL_TEXTURE11 : constant Enum := 16#84CB#; GL_TEXTURE12 : constant Enum := 16#84CC#; GL_TEXTURE13 : constant Enum := 16#84CD#; GL_TEXTURE14 : constant Enum := 16#84CE#; GL_TEXTURE15 : constant Enum := 16#84CF#; GL_TEXTURE16 : constant Enum := 16#84D0#; GL_TEXTURE17 : constant Enum := 16#84D1#; GL_TEXTURE18 : constant Enum := 16#84D2#; GL_TEXTURE19 : constant Enum := 16#84D3#; GL_TEXTURE20 : constant Enum := 16#84D4#; GL_TEXTURE21 : constant Enum := 16#84D5#; GL_TEXTURE22 : constant Enum := 16#84D6#; GL_TEXTURE23 : constant Enum := 16#84D7#; GL_TEXTURE24 : constant Enum := 16#84D8#; GL_TEXTURE25 : constant Enum := 16#84D9#; GL_TEXTURE26 : constant Enum := 16#84DA#; GL_TEXTURE27 : constant Enum := 16#84DB#; GL_TEXTURE28 : constant Enum := 16#84DC#; GL_TEXTURE29 : constant Enum := 16#84DD#; GL_TEXTURE30 : constant Enum := 16#84DE#; GL_TEXTURE31 : constant Enum := 16#84DF#; GL_ACTIVE_TEXTURE : constant Enum := 16#84E0#; GL_CLIENT_ACTIVE_TEXTURE : constant Enum := 16#84E1#; GL_MAX_TEXTURE_UNITS : constant Enum := 16#84E2#; GL_NORMAL_MAP : constant Enum := 16#8511#; GL_REFLECTION_MAP : constant Enum := 16#8512#; GL_TEXTURE_CUBE_MAP : constant Enum := 16#8513#; GL_TEXTURE_BINDING_CUBE_MAP : constant Enum := 16#8514#; GL_TEXTURE_CUBE_MAP_POSITIVE_X : constant Enum := 16#8515#; GL_TEXTURE_CUBE_MAP_NEGATIVE_X : constant Enum := 16#8516#; GL_TEXTURE_CUBE_MAP_POSITIVE_Y : constant Enum := 16#8517#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Y : constant Enum := 16#8518#; GL_TEXTURE_CUBE_MAP_POSITIVE_Z : constant Enum := 16#8519#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Z : constant Enum := 16#851A#; GL_PROXY_TEXTURE_CUBE_MAP : constant Enum := 16#851B#; GL_MAX_CUBE_MAP_TEXTURE_SIZE : constant Enum := 16#851C#; GL_COMPRESSED_ALPHA : constant Enum := 16#84E9#; GL_COMPRESSED_LUMINANCE : constant Enum := 16#84EA#; GL_COMPRESSED_LUMINANCE_ALPHA : constant Enum := 16#84EB#; GL_COMPRESSED_INTENSITY : constant Enum := 16#84EC#; GL_COMPRESSED_RGB : constant Enum := 16#84ED#; GL_COMPRESSED_RGBA : constant Enum := 16#84EE#; GL_TEXTURE_COMPRESSION_HINT : constant Enum := 16#84EF#; GL_TEXTURE_COMPRESSED_IMAGE_SIZE : constant Enum := 16#86A0#; GL_TEXTURE_COMPRESSED : constant Enum := 16#86A1#; GL_NUM_COMPRESSED_TEXTURE_FORMATS : constant Enum := 16#86A2#; GL_COMPRESSED_TEXTURE_FORMATS : constant Enum := 16#86A3#; GL_MULTISAMPLE : constant Enum := 16#809D#; GL_SAMPLE_ALPHA_TO_COVERAGE : constant Enum := 16#809E#; GL_SAMPLE_ALPHA_TO_ONE : constant Enum := 16#809F#; GL_SAMPLE_COVERAGE : constant Enum := 16#80A0#; GL_SAMPLE_BUFFERS : constant Enum := 16#80A8#; GL_SAMPLES : constant Enum := 16#80A9#; GL_SAMPLE_COVERAGE_VALUE : constant Enum := 16#80AA#; GL_SAMPLE_COVERAGE_INVERT : constant Enum := 16#80AB#; GL_MULTISAMPLE_BIT : constant Enum := 16#20000000#; GL_TRANSPOSE_MODELVIEW_MATRIX : constant Enum := 16#84E3#; GL_TRANSPOSE_PROJECTION_MATRIX : constant Enum := 16#84E4#; GL_TRANSPOSE_TEXTURE_MATRIX : constant Enum := 16#84E5#; GL_TRANSPOSE_COLOR_MATRIX : constant Enum := 16#84E6#; GL_COMBINE : constant Enum := 16#8570#; GL_COMBINE_RGB : constant Enum := 16#8571#; GL_COMBINE_ALPHA : constant Enum := 16#8572#; GL_SOURCE0_RGB : constant Enum := 16#8580#; GL_SOURCE1_RGB : constant Enum := 16#8581#; GL_SOURCE2_RGB : constant Enum := 16#8582#; GL_SOURCE0_ALPHA : constant Enum := 16#8588#; GL_SOURCE1_ALPHA : constant Enum := 16#8589#; GL_SOURCE2_ALPHA : constant Enum := 16#858A#; GL_OPERAND0_RGB : constant Enum := 16#8590#; GL_OPERAND1_RGB : constant Enum := 16#8591#; GL_OPERAND2_RGB : constant Enum := 16#8592#; GL_OPERAND0_ALPHA : constant Enum := 16#8598#; GL_OPERAND1_ALPHA : constant Enum := 16#8599#; GL_OPERAND2_ALPHA : constant Enum := 16#859A#; GL_RGB_SCALE : constant Enum := 16#8573#; GL_ADD_SIGNED : constant Enum := 16#8574#; GL_INTERPOLATE : constant Enum := 16#8575#; GL_SUBTRACT : constant Enum := 16#84E7#; GL_CONSTANT : constant Enum := 16#8576#; GL_PRIMARY_COLOR : constant Enum := 16#8577#; GL_PREVIOUS : constant Enum := 16#8578#; GL_DOT3_RGB : constant Enum := 16#86AE#; GL_DOT3_RGBA : constant Enum := 16#86AF#; GL_CLAMP_TO_BORDER : constant Enum := 16#812D#; GL_ARB_multitexture : constant Enum := 1; GL_TEXTURE0_ARB : constant Enum := 16#84C0#; GL_TEXTURE1_ARB : constant Enum := 16#84C1#; GL_TEXTURE2_ARB : constant Enum := 16#84C2#; GL_TEXTURE3_ARB : constant Enum := 16#84C3#; GL_TEXTURE4_ARB : constant Enum := 16#84C4#; GL_TEXTURE5_ARB : constant Enum := 16#84C5#; GL_TEXTURE6_ARB : constant Enum := 16#84C6#; GL_TEXTURE7_ARB : constant Enum := 16#84C7#; GL_TEXTURE8_ARB : constant Enum := 16#84C8#; GL_TEXTURE9_ARB : constant Enum := 16#84C9#; GL_TEXTURE10_ARB : constant Enum := 16#84CA#; GL_TEXTURE11_ARB : constant Enum := 16#84CB#; GL_TEXTURE12_ARB : constant Enum := 16#84CC#; GL_TEXTURE13_ARB : constant Enum := 16#84CD#; GL_TEXTURE14_ARB : constant Enum := 16#84CE#; GL_TEXTURE15_ARB : constant Enum := 16#84CF#; GL_TEXTURE16_ARB : constant Enum := 16#84D0#; GL_TEXTURE17_ARB : constant Enum := 16#84D1#; GL_TEXTURE18_ARB : constant Enum := 16#84D2#; GL_TEXTURE19_ARB : constant Enum := 16#84D3#; GL_TEXTURE20_ARB : constant Enum := 16#84D4#; GL_TEXTURE21_ARB : constant Enum := 16#84D5#; GL_TEXTURE22_ARB : constant Enum := 16#84D6#; GL_TEXTURE23_ARB : constant Enum := 16#84D7#; GL_TEXTURE24_ARB : constant Enum := 16#84D8#; GL_TEXTURE25_ARB : constant Enum := 16#84D9#; GL_TEXTURE26_ARB : constant Enum := 16#84DA#; GL_TEXTURE27_ARB : constant Enum := 16#84DB#; GL_TEXTURE28_ARB : constant Enum := 16#84DC#; GL_TEXTURE29_ARB : constant Enum := 16#84DD#; GL_TEXTURE30_ARB : constant Enum := 16#84DE#; GL_TEXTURE31_ARB : constant Enum := 16#84DF#; GL_ACTIVE_TEXTURE_ARB : constant Enum := 16#84E0#; GL_CLIENT_ACTIVE_TEXTURE_ARB : constant Enum := 16#84E1#; GL_MAX_TEXTURE_UNITS_ARB : constant Enum := 16#84E2#; GL_TEXTURE_1D_ARRAY_EXT : constant Enum := 16#8C18#; GL_PROXY_TEXTURE_1D_ARRAY_EXT : constant Enum := 16#8C19#; GL_TEXTURE_2D_ARRAY_EXT : constant Enum := 16#8C1A#; GL_PROXY_TEXTURE_2D_ARRAY_EXT : constant Enum := 16#8C1B#; GL_TEXTURE_BINDING_1D_ARRAY_EXT : constant Enum := 16#8C1C#; GL_TEXTURE_BINDING_2D_ARRAY_EXT : constant Enum := 16#8C1D#; GL_POINT_SPRITE : constant Enum := 16#8861#; GL_COORD_REPLACE : constant Enum := 16#8862#; GL_MAX_ARRAY_TEXTURE_LAYERS_EXT : constant Enum := 16#88FF#; GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT : constant Enum := 16#8CD4#; GL_FRAMEBUFFER : constant Enum := 16#8D40#; GL_READ_FRAMEBUFFER : constant Enum := 16#8CA8#; GL_WRITE_FRAMEBUFFER : constant Enum := 16#8CA9#; GL_RENDERBUFFER : constant Enum := 16#8D41#; GL_ARRAY_BUFFER : constant Enum := 16#8892#; GL_ELEMENT_ARRAY_BUFFER : constant Enum := 16#8893#; GL_STATIC_DRAW : constant Enum := 16#88E4#; GL_DYNAMIC_DRAW : constant Enum := 16#88E8#; GL_VERTEX_SHADER : constant Enum := 16#8B31#; GL_FRAGMENT_SHADER : constant Enum := 16#8B30#; GL_DELETE_STATUS : constant Enum := 16#8B80#; GL_COMPILE_STATUS : constant Enum := 16#8B81#; GL_LINK_STATUS : constant Enum := 16#8B82#; GL_VALIDATE_STATUS : constant Enum := 16#8B83#; GL_INFO_LOG_LENGTH : constant Enum := 16#8B84#; -- Bitfield constants GL_CURRENT_BIT : constant Bitfield := 16#00001#; GL_POINT_BIT : constant Bitfield := 16#00002#; GL_LINE_BIT : constant Bitfield := 16#00004#; GL_POLYGON_BIT : constant Bitfield := 16#00008#; GL_POLYGON_STIPPLE_BIT : constant Bitfield := 16#00010#; GL_PIXEL_MODE_BIT : constant Bitfield := 16#00020#; GL_LIGHTING_BIT : constant Bitfield := 16#00040#; GL_FOG_BIT : constant Bitfield := 16#00080#; GL_DEPTH_BUFFER_BIT : constant Bitfield := 16#00100#; GL_ACCUM_BUFFER_BIT : constant Bitfield := 16#00200#; GL_STENCIL_BUFFER_BIT : constant Bitfield := 16#00400#; GL_VIEWPORT_BIT : constant Bitfield := 16#00800#; GL_TRANSFORM_BIT : constant Bitfield := 16#01000#; GL_ENABLE_BIT : constant Bitfield := 16#02000#; GL_COLOR_BUFFER_BIT : constant Bitfield := 16#04000#; GL_HINT_BIT : constant Bitfield := 16#08000#; GL_EVAL_BIT : constant Bitfield := 16#10000#; GL_LIST_BIT : constant Bitfield := 16#20000#; GL_TEXTURE_BIT : constant Bitfield := 16#40000#; GL_SCISSOR_BIT : constant Bitfield := 16#80000#; GL_ALL_ATTRIB_BITS : constant Bitfield := 16#FFFFF#; --------------------------------------------------------------------------- -- These two have pride of place in that they don't lose their "gl" prefix. -- That's because their "base" names are Ada keywords. procedure Begin_Primitive (Mode : in Enum); procedure End_Primitive; -- Misc function Get_Error return Enum; procedure Push_Attrib (Mask : in Bitfield); procedure Pop_Attrib; function Get_String (Name : Enum) return String; function Get_String (Name : Enum; Index : Int) return String; -- Pipeline control procedure Finish; procedure Flush; -- Server-side capabilities procedure Enable (Cap : in Enum); procedure Disable (Cap : in Enum); function Is_Enabled (Cap : in Enum) return Bool; procedure Hint (Target : Enum; Hint : Enum); -- Projections procedure Ortho (Left : in Double; Right : in Double; Bottom : in Double; Top : in Double; Near_Val : in Double; Far_Val : in Double); procedure Frustum (Left : in Double; Right : in Double; Bottom : in Double; Top : in Double; Near_Val : in Double; Far_Val : in Double); procedure Viewport (X : in Int; Y : in Int; Width : in SizeI; Height : in SizeI); -- Matrix mode procedure Matrix_Mode (Mode : in Enum); -- Matrix stacks procedure Push_Matrix; procedure Pop_Matrix; procedure Load_Identity; procedure Load_Matrix (M : in Float_Matrix); procedure Load_Matrix (M : in Double_Matrix); procedure Mult_Matrix (M : in Float_Matrix); procedure Mult_Matrix (M : in Double_Matrix); pragma Inline (Load_Matrix, Mult_Matrix); -- Clears procedure Clear_Index (C : in Float); procedure Clear_Color (Red : in ClampF; Green : in ClampF; Blue : in ClampF; Alpha : in ClampF); procedure Clear (Mask : in Bitfield); procedure Clear_Depth (Depth : in ClampD); procedure Clear_Accum (Red : in Float; Green : in Float; Blue : in Float; Alpha : in Float); -- Transformations procedure Rotate (Angle : in Double; X : in Double; Y : in Double; Z : in Double); procedure Rotate (Angle : in Float; X : in Float; Y : in Float; Z : in Float); procedure Scale (X : in Double; Y : in Double; Z : in Double); procedure Scale (X : in Float; Y : in Float; Z : in Float); procedure Translate (X : in Double; Y : in Double; Z : in Double); procedure Translate (X : in Float; Y : in Float; Z : in Float); pragma Inline (Scale, Translate); -- Alpha, stencil, and depth tests procedure Alpha_Func (Func : in Enum; Ref : in ClampF); procedure Depth_Func (Func : in Enum); procedure Stencil_Func (Func : in Enum; Ref : in Int; Mask : in UInt); -- Blending procedure Blend_Color (Red : in ClampF; Green : in ClampF; Blue : in ClampF; Alpha : in ClampF); procedure Blend_Equation (Mode : in Enum); procedure Blend_Func (S_Factor : in Enum; D_Factor : in Enum); -- Drawing parameters procedure Point_Size (Size : in Float); procedure Line_Width (Width : in Float); procedure Line_Stipple (Factor : in Int; Pattern : in UShort); procedure Polygon_Offset (Factor : in Float; Units : in Float); procedure Polygon_Stipple (Mask : in Pointer); procedure Polygon_Mode (Face : in Enum; Mode : in Enum); procedure Get_Polygon_Stipple (Mask : in Pointer); procedure Edge_Flag (Flag : in Bool); procedure Edge_Flagv (Flag : in Pointer); procedure Scissor (X : Int; Y : Int; Width : SizeI; Height : SizeI); -- Component color procedure Color (Red : in Byte; Green : in Byte; Blue : in Byte); procedure Color (Red : in Short; Green : in Short; Blue : in Short); procedure Color (Red : in Int; Green : in Int; Blue : in Int); procedure Color (Red : in Float; Green : in Float; Blue : in Float); procedure Color (Red : in Double; Green : in Double; Blue : in Double); procedure Color (Red : in UByte; Green : in UByte; Blue : in UByte); procedure Color (Red : in UShort; Green : in UShort; Blue : in UShort); procedure Color (Red : in UInt; Green : in UInt; Blue : in UInt); procedure Color (Red : in Byte; Green : in Byte; Blue : in Byte; Alpha : in Byte); procedure Color (Red : in Short; Green : in Short; Blue : in Short; Alpha : in Short); procedure Color (Red : in Int; Green : in Int; Blue : in Int; Alpha : in Int); procedure Color (Red : in Float; Green : in Float; Blue : in Float; Alpha : in Float); procedure Color (Red : in Double; Green : in Double; Blue : in Double; Alpha : in Double); procedure Color (Red : in UByte; Green : in UByte; Blue : in UByte; Alpha : in UByte); procedure Color (Red : in UShort; Green : in UShort; Blue : in UShort; Alpha : in UShort); procedure Color (Red : in UInt; Green : in UInt; Blue : in UInt; Alpha : in UInt); procedure Color (V : in Bytes_3); procedure Color (V : in Bytes_4); procedure Color (V : in Shorts_3); procedure Color (V : in Shorts_4); procedure Color (V : in Ints_3); procedure Color (V : in Ints_4); procedure Color (V : in Floats_3); procedure Color (V : in Floats_4); procedure Color (V : in Doubles_3); procedure Color (V : in Doubles_4); procedure Color (V : in UBytes_3); procedure Color (V : in UBytes_4); procedure Color (V : in UShorts_3); procedure Color (V : in UShorts_4); procedure Color (V : in UInts_3); procedure Color (V : in UInts_4); pragma Inline (Color); -- Lighting and materials type Int_Params is array (1 .. 4) of Int; type Float_Params is array (1 .. 4) of Float; procedure Light (Light : in Enum; PName : in Enum; Params : in Int_Params); procedure Light (Light : in Enum; PName : in Enum; Params : in Float_Params); procedure Material (Face : in Enum; PName : in Enum; Params : in Int_Params); procedure Material (Face : in Enum; PName : in Enum; Params : in Float_Params); procedure Front_Face (Mode : in Enum); procedure Cull_Face (Mode : in Enum); procedure Shade_Model (Mode : in Enum); pragma Inline (Light, Material); -- Lighting procedure Light (Light : in Enum; PName : in Enum; Param : in Float); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_1); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_3); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_4); procedure Light (Light : in Enum; PName : in Enum; Param : in Int); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_1); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_3); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_4); pragma Inline (Light); -- Normal Vector procedure Normal (X, Y, Z : Byte); procedure Normal (X, Y, Z : Double); procedure Normal (X, Y, Z : Float); procedure Normal (X, Y, Z : Int); procedure Normal (X, Y, Z : Short); procedure Normal (V : Bytes_3); procedure Normal (V : Doubles_3); procedure Normal (V : Floats_3); procedure Normal (V : Ints_3); procedure Normal (V : Shorts_3); pragma Inline (Normal); -- Texturing procedure Active_Texture (Texture : in Enum); -- v1.3 procedure Bind_Texture (Target : in Enum; Texture : in UInt); procedure Gen_Textures (N : in SizeI; Textures : in Pointer); procedure Delete_Textures (N : in SizeI; Textures : in Pointer); procedure Tex_Env (Coord : in Enum; PName : in Enum; Param : in Enum); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Int); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Float); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Double); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Enum); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Int); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Float); pragma Inline (Tex_Parameter); -- Texture images procedure Tex_Image (Target : in Enum; Level : in Int; Internal_Format : in Enum; Width : in SizeI; Border : in Int; Format : in Enum; Pixel_Type : in Enum; Pixels : in Pointer); procedure Tex_Image (Target : in Enum; Level : in Int; Internal_Format : in Enum; Width : in SizeI; Height : in SizeI; Border : in Int; Format : in Enum; Pixel_Type : in Enum; Pixels : in Pointer); procedure Tex_Sub_Image (Target : in Enum; Level : in Int; X_Offset : in Int; Y_Offset : in Int; Width : in SizeI; Height : in SizeI; Format : in Enum; Pixel_Type : in Enum; Pixels : in GL.Pointer); -- procedure Tex_Image (Target : in Enum; -- Level : in Int; -- Internal_Format : in Int; -- Width : in SizeI; -- Height : in SizeI; -- Depth : in SizeI; -- Border : in Int; -- Format : in Enum; -- Pixel_Type : in Enum; -- Pixels : in Pointer); pragma Inline (Tex_Image); -- Texture coordinates procedure Tex_Coord (S : in Short); procedure Tex_Coord (S : in Int); procedure Tex_Coord (S : in Float); procedure Tex_Coord (S : in Double); procedure Tex_Coord (S : in Short; T : in Short); procedure Tex_Coord (S : in Int; T : in Int); procedure Tex_Coord (S : in Float; T : in Float); procedure Tex_Coord (S : in Double; T : in Double); procedure Tex_Coord (S : in Short; T : in Short; R : in Short); procedure Tex_Coord (S : in Int; T : in Int; R : in Int); procedure Tex_Coord (S : in Float; T : in Float; R : in Float); procedure Tex_Coord (S : in Double; T : in Double; R : in Double); procedure Tex_Coord (S : in Short; T : in Short; R : in Short; Q : in Short); procedure Tex_Coord (S : in Int; T : in Int; R : in Int; Q : in Int); procedure Tex_Coord (S : in Float; T : in Float; R : in Float; Q : in Float); procedure Tex_Coord (S : in Double; T : in Double; R : in Double; Q : in Double); procedure Tex_Coord (V : in Shorts_1); procedure Tex_Coord (V : in Shorts_2); procedure Tex_Coord (V : in Shorts_3); procedure Tex_Coord (V : in Shorts_4); procedure Tex_Coord (V : in Ints_1); procedure Tex_Coord (V : in Ints_2); procedure Tex_Coord (V : in Ints_3); procedure Tex_Coord (V : in Ints_4); procedure Tex_Coord (V : in Floats_1); procedure Tex_Coord (V : in Floats_2); procedure Tex_Coord (V : in Floats_3); procedure Tex_Coord (V : in Floats_4); procedure Tex_Coord (V : in Doubles_1); procedure Tex_Coord (V : in Doubles_2); procedure Tex_Coord (V : in Doubles_3); procedure Tex_Coord (V : in Doubles_4); pragma Inline (Tex_Coord); procedure Tex_Coord_Pointer (Size : in SizeI; Type_Of : in Enum; Stride : in SizeI; Offset : in SizeI); -- Get texture data procedure Get_Tex_Image (Target : in Enum; Level : in Int; Format : in Enum; Type_Of : in Enum; Pixels : in Pointer); -- Evaluators procedure Map (Target : in Enum; U1 : in Float; U2 : in Float; Stride : in Int; Order : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Double; U2 : in Double; Stride : in Int; Order : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Float; U2 : in Float; UStride : in Int; UOrder : in Int; V1 : in Float; V2 : in Float; VStride : in Int; VOrder : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Double; U2 : in Double; UStride : in Int; UOrder : in Int; V1 : in Double; V2 : in Double; VStride : in Int; VOrder : in Int; Points : in System.Address); pragma Inline (Map); procedure Map_Grid (Un : in Int; U1 : in Float; U2 : in Float); procedure Map_Grid (Un : in Int; U1 : in Double; U2 : in Double); procedure Map_Grid (Un : in Int; U1 : in Float; U2 : in Float; Vn : in Int; V1 : in Float; V2 : in Float); procedure Map_Grid (Un : in Int; U1 : in Double; U2 : in Double; Vn : in Int; V1 : in Double; V2 : in Double); pragma Inline (Map_Grid); procedure Eval_Point (I : Int); procedure Eval_Point (I : in Int; J : in Int); pragma Inline (Eval_Point); procedure Eval_Mesh (Mode : in Enum; I1 : in Int; I2 : in Int); procedure Eval_Mesh (Mode : in Enum; I1 : in Int; I2 : in Int; J1 : in Int; J2 : in Int); pragma Inline (Eval_Mesh); -- Specify vertices procedure Vertex (X : in Short; Y : in Short); procedure Vertex (X : in Int; Y : in Int); procedure Vertex (X : in Float; Y : in Float); procedure Vertex (X : in Double; Y : in Double); procedure Vertex (X : in Short; Y : in Short; Z : in Short); procedure Vertex (X : in Int; Y : in Int; Z : in Int); procedure Vertex (X : in Float; Y : in Float; Z : in Float); procedure Vertex (X : in Double; Y : in Double; Z : in Double); procedure Vertex (X : in Short; Y : in Short; Z : in Short; W : in Short); procedure Vertex (X : in Int; Y : in Int; Z : in Int; W : in Int); procedure Vertex (X : in Float; Y : in Float; Z : in Float; W : in Float); procedure Vertex (X : in Double; Y : in Double; Z : in Double; W : in Double); procedure Vertex (V : in Shorts_2); procedure Vertex (V : in Shorts_3); procedure Vertex (V : in Shorts_4); procedure Vertex (V : in Ints_2); procedure Vertex (V : in Ints_3); procedure Vertex (V : in Ints_4); procedure Vertex (V : in Floats_2); procedure Vertex (V : in Floats_3); procedure Vertex (V : in Floats_4); procedure Vertex (V : in Doubles_2); procedure Vertex (V : in Doubles_3); procedure Vertex (V : in Doubles_4); pragma Inline (Vertex); -- Buffer objects v2.1??? procedure Gen_Framebuffers (N : in SizeI; FBOs : in Pointer); procedure Bind_Framebuffer (Target : in Enum; FBO : in UInt); -- Vertex buffer stuff: procedure Gen_Buffers (N : in SizeI; VBO : in Pointer); procedure Delete_Buffers (N : in SizeI; Buffers : in Pointer); procedure Bind_Buffer (Target : in Enum; VBO : in UInt); procedure Buffer_Data (Target : in Enum; Size : in SizeI; Data : in Pointer; Usage : in Enum); procedure Buffer_Sub_Data (Target: in Enum; Offset: in SizeI; Size : in SizeI; Data : in Pointer); procedure Enable_Client_State (Target : in Enum); procedure Disable_Client_State (Target : in Enum); procedure Vertex_Pointer (Size : in SizeI; Element_Type : in Enum; Stride : in SizeI; Data_Pointer : Pointer); procedure Vertex_Pointer (Size : in SizeI; Element_Type : in Enum; Stride : in SizeI; Offset : in SizeI); procedure Draw_Arrays (Mode : in Enum; First : in Int; Count : in SizeI); procedure Draw_Elements (Mode : in Enum; Count : in SizeI; Index_Type : in Enum; Indices : in Pointer); procedure Enable_Vertex_Attrib_Array (Index : in UInt); procedure Disable_Vertex_Attrib_Array (Index : in UInt); procedure Vertex_Attrib_Pointer (Index : in UInt; Size : in Int; Attr_Type : in Enum; Normalized : in Bool; Stride : in SizeI; Data_Pointer : in Pointer); -- Vertex array objects procedure Gen_Vertex_Arrays (N : in SizeI; VAOs : in Pointer); procedure Bind_Vertex_Array (VAO : in UInt); -- Shaders function Create_Shader (Shader_Type : in Enum) return UInt; procedure Delete_Shader (Shader_ID : in UInt); procedure Shader_Source (Shader : in UInt; Count : in SizeI; Source_String : in Pointer; Length : in Pointer); procedure Compile_Shader (Shader : in UInt); procedure Attach_Shader (Program : in UInt; Shader : in UInt); procedure Link_Program (Program : in UInt); procedure Use_Program (Program : in UInt); function Create_Program return UInt; procedure Get_Shader (Shader : in UInt; PName : in Enum; Params : in Pointer); procedure Get_Shader_Info_Log (Shader : in UInt; MaxLength : in SizeI; Length : in Pointer; InfoLog : in Pointer); procedure Get_Program (Program : in UInt; PName : in Enum; Params : in Pointer); procedure Get_Program_Info_Log (Progarm : in UInt; MaxLength : in SizeI; Length : in Pointer; InfoLog : in Pointer); procedure Validate_Program (Program : in GL.UInt); function Get_Uniform_Location (Program : in UInt; Name : in String) return Int; procedure Uniform (Location : in Int; V0 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float; V2 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float; V2 : in Float; V3 : in Float); procedure Uniform (Location : in Int; V0 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int; V2 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int; V2 : in Int; V3 : in Int); procedure Uniform (Location : in Int; V0 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt; V2 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt; V2 : in UInt; V3 : in UInt); procedure Uniform (Location : in Int; Count : in SizeI; Transpose : in Bool; Value : in Float_Matrix); function Get_Attribute_Location (Program : in UInt; Name : in String) return Int; procedure Vertex_Attrib (Index : in UInt; X : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float; Z : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float; Z : in Float; W : in Float); pragma Inline (Vertex_Attrib); procedure Get_Double (Pname : in Enum; Params : out Double_Matrix); pragma Inline (Get_Double); procedure Read_Pixels (X : in Int; Y : in Int; Width : in SizeI; Height : in SizeI; Format : in Enum; C_Type : in Enum; Pixels : in Pointer); --------------------------------------------------------------------------- private -- These can be bound directly pragma Import (StdCall, Active_Texture, "glActiveTexture"); pragma Import (StdCall, Alpha_Func, "glAlphaFunc"); pragma Import (StdCall, Attach_Shader, "glAttachShader"); pragma Import (StdCall, Begin_Primitive, "glBegin"); pragma Import (StdCall, Bind_Buffer, "glBindBuffer"); pragma Import (StdCall, Bind_Framebuffer, "glBindFramebuffer"); pragma Import (StdCall, Bind_Texture, "glBindTexture"); pragma Import (StdCall, Bind_Vertex_Array, "glBindVertexArray"); pragma Import (StdCall, Blend_Color, "glBlendColor"); pragma Import (StdCall, Blend_Equation, "glBlendEquation"); pragma Import (StdCall, Blend_Func, "glBlendFunc"); pragma Import (StdCall, Buffer_Data, "glBufferData"); pragma Import (StdCall, Clear, "glClear"); pragma Import (StdCall, Clear_Accum, "glClearAccum"); pragma Import (StdCall, Clear_Color, "glClearColor"); pragma Import (StdCall, Clear_Depth, "glClearDepth"); pragma Import (StdCall, Clear_Index, "glClearIndex"); pragma Import (StdCall, Compile_Shader, "glCompileShader"); pragma Import (StdCall, Create_Program, "glCreateProgram"); pragma Import (StdCall, Create_Shader, "glCreateShader"); pragma Import (StdCall, Cull_Face, "glCullFace"); pragma Import (StdCall, Delete_Shader, "glDeleteShader"); pragma Import (StdCall, Depth_Func, "glDepthFunc"); pragma Import (StdCall, Disable, "glDisable"); pragma Import (StdCall, Disable_Vertex_Attrib_Array, "glDisableVertexAttribArray"); pragma Import (StdCall, Draw_Arrays, "glDrawArrays"); pragma Import (StdCall, Draw_Elements, "glDrawElements"); pragma Import (StdCall, Edge_Flag, "glEdgeFlag"); pragma Import (StdCall, Edge_Flagv, "glEdgeFlagv"); pragma Import (StdCall, Enable, "glEnable"); pragma Import (StdCall, Enable_Client_State, "glEnableClientState"); pragma Import (StdCall, Enable_Vertex_Attrib_Array, "glEnableVertexAttribArray"); pragma Import (StdCall, End_Primitive, "glEnd"); pragma Import (StdCall, Finish, "glFinish"); pragma Import (StdCall, Flush, "glFlush"); pragma Import (StdCall, Front_Face, "glFrontFace"); pragma Import (StdCall, Frustum, "glFrustum"); pragma Import (StdCall, Gen_Buffers, "glGenBuffers"); pragma Import (StdCall, Gen_Framebuffers, "glGenFramebuffers"); pragma Import (StdCall, Gen_Textures, "glGenTextures"); pragma Import (StdCall, Get_Tex_Image, "glGetTexImage"); pragma Import (StdCall, Delete_Textures, "glDeleteTextures"); pragma Import (StdCall, Gen_Vertex_Arrays, "glGenVertexArrays"); pragma Import (StdCall, Get_Error, "glGetError"); pragma Import (StdCall, Get_Polygon_Stipple, "glGetPolygonStipple"); pragma Import (StdCall, Get_Shader, "glGetShaderiv"); pragma Import (StdCall, Get_Shader_Info_Log, "glGetShaderInfoLog"); pragma Import (StdCall, Hint, "glHint"); pragma Import (StdCall, Is_Enabled, "glIsEnabled"); pragma Import (StdCall, Line_Stipple, "glLineStipple"); pragma Import (StdCall, Line_Width, "glLineWidth"); pragma Import (StdCall, Link_Program, "glLinkProgram"); pragma Import (StdCall, Load_Identity, "glLoadIdentity"); pragma Import (StdCall, Matrix_Mode, "glMatrixMode"); pragma Import (StdCall, Ortho, "glOrtho"); pragma Import (StdCall, Point_Size, "glPointSize"); pragma Import (StdCall, Polygon_Mode, "glPolygonMode"); pragma Import (StdCall, Polygon_Offset, "glPolygonOffset"); pragma Import (StdCall, Polygon_Stipple, "glPolygonStipple"); pragma Import (StdCall, Pop_Attrib, "glPopAttrib"); pragma Import (StdCall, Pop_Matrix, "glPopMatrix"); pragma Import (StdCall, Push_Attrib, "glPushAttrib"); pragma Import (StdCall, Push_Matrix, "glPushMatrix"); pragma Import (StdCall, Scissor, "glScissor"); pragma Import (StdCall, Shade_Model, "glShadeModel"); pragma Import (StdCall, Shader_Source, "glShaderSource"); pragma Import (StdCall, Stencil_Func, "glStencilFunc"); pragma Import (StdCall, Tex_Env, "glTexEnvi"); pragma Import (StdCall, Use_Program, "glUseProgram"); pragma Import (StdCall, Vertex_Attrib_Pointer, "glVertexAttribPointer"); pragma Import (StdCall, Viewport, "glViewport"); pragma Import (StdCall, Delete_Buffers, "glDeleteBuffers"); pragma Import (StdCall, Buffer_Sub_Data, "glBufferSubData"); pragma Import (StdCall, Disable_Client_State, "glDisableClientState"); pragma Import (StdCall, Tex_Coord_Pointer, "glTexCoordPointer"); pragma Import (StdCall, Get_Program, "glGetProgramiv"); pragma Import (StdCall, Get_Program_Info_Log, "glGetProgramInfoLog"); pragma Import (StdCall, Validate_Program, "glValidateProgram"); pragma Import (StdCall, Read_Pixels, "glReadPixels"); end Lumen.GL;
15422
-- Lumen.GL -- Lumen's own thin OpenGL bindings -- -- <NAME>, <NAME>, Phoenix AZ, Summer 2010 -- This code is covered by the ISC License: -- -- Copyright © 2010, <NAME> -- -- 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. -- Environment with System; with Lumen.Binary; package Lumen.GL is --------------------------------------------------------------------------- -- New names for old types subtype Bitfield is Binary.Word; subtype Bool is Binary.Byte; subtype Byte is Binary.S_Byte; subtype ClampD is Long_Float range 0.0 .. 1.0; subtype ClampF is Float range 0.0 .. 1.0; subtype Double is Long_Float; subtype Int is Integer; subtype Short is Short_Integer; subtype SizeI is Integer; subtype UByte is Binary.Byte; subtype UInt is Binary.Word; subtype UShort is Binary.Short; subtype Pointer is System.Address; -- Try to bring a touch of order to the GLenum mess subtype Enum is Binary.Word; -- Types added by Lumen.GL type Bytes_1 is array (1 .. 1) of Byte; type Bytes_2 is array (1 .. 2) of Byte; type Bytes_3 is array (1 .. 3) of Byte; type Bytes_4 is array (1 .. 4) of Byte; type Shorts_1 is array (1 .. 1) of Short; type Shorts_2 is array (1 .. 2) of Short; type Shorts_3 is array (1 .. 3) of Short; type Shorts_4 is array (1 .. 4) of Short; type Ints_1 is array (1 .. 1) of Int; type Ints_2 is array (1 .. 2) of Int; type Ints_3 is array (1 .. 3) of Int; type Ints_4 is array (1 .. 4) of Int; type Floats_1 is array (1 .. 1) of Float; type Floats_2 is array (1 .. 2) of Float; type Floats_3 is array (1 .. 3) of Float; type Floats_4 is array (1 .. 4) of Float; type Doubles_1 is array (1 .. 1) of Double; type Doubles_2 is array (1 .. 2) of Double; type Doubles_3 is array (1 .. 3) of Double; type Doubles_4 is array (1 .. 4) of Double; type UBytes_1 is array (1 .. 1) of UByte; type UBytes_2 is array (1 .. 2) of UByte; type UBytes_3 is array (1 .. 3) of UByte; type UBytes_4 is array (1 .. 4) of UByte; type UShorts_1 is array (1 .. 1) of UShort; type UShorts_2 is array (1 .. 2) of UShort; type UShorts_3 is array (1 .. 3) of UShort; type UShorts_4 is array (1 .. 4) of UShort; type UInts_1 is array (1 .. 1) of UInt; type UInts_2 is array (1 .. 2) of UInt; type UInts_3 is array (1 .. 3) of UInt; type UInts_4 is array (1 .. 4) of UInt; type Float_Matrix is array (1 .. 4, 1 .. 4) of Float; type Double_Matrix is array (1 .. 4, 1 .. 4) of Double; -- Useful value Null_Pointer : Pointer := System.Null_Address; -- "Enumeration" constants GL_FALSE : constant Bool := 16#0#; GL_TRUE : constant Bool := 16#1#; GL_VERSION_1_1 : constant Enum := 1; GL_VERSION_1_2 : constant Enum := 1; GL_VERSION_1_3 : constant Enum := 1; GL_ARB_imaging : constant Enum := 1; GL_BYTE : constant Enum := 16#1400#; GL_UNSIGNED_BYTE : constant Enum := 16#1401#; GL_SHORT : constant Enum := 16#1402#; GL_UNSIGNED_SHORT : constant Enum := 16#1403#; GL_INT : constant Enum := 16#1404#; GL_UNSIGNED_INT : constant Enum := 16#1405#; GL_FLOAT : constant Enum := 16#1406#; GL_2_BYTES : constant Enum := 16#1407#; GL_3_BYTES : constant Enum := 16#1408#; GL_4_BYTES : constant Enum := 16#1409#; GL_DOUBLE : constant Enum := 16#140A#; GL_POINTS : constant Enum := 16#0#; GL_LINES : constant Enum := 16#1#; GL_LINE_LOOP : constant Enum := 16#2#; GL_LINE_STRIP : constant Enum := 16#3#; GL_TRIANGLES : constant Enum := 16#4#; GL_TRIANGLE_STRIP : constant Enum := 16#5#; GL_TRIANGLE_FAN : constant Enum := 16#6#; GL_QUADS : constant Enum := 16#7#; GL_QUAD_STRIP : constant Enum := 16#8#; GL_POLYGON : constant Enum := 16#9#; GL_VERTEX_ARRAY : constant Enum := 16#8074#; GL_NORMAL_ARRAY : constant Enum := 16#8075#; GL_COLOR_ARRAY : constant Enum := 16#8076#; GL_INDEX_ARRAY : constant Enum := 16#8077#; GL_TEXTURE_COORD_ARRAY : constant Enum := 16#8078#; GL_EDGE_FLAG_ARRAY : constant Enum := 16#8079#; GL_VERTEX_ARRAY_SIZE : constant Enum := 16#807A#; GL_VERTEX_ARRAY_TYPE : constant Enum := 16#807B#; GL_VERTEX_ARRAY_STRIDE : constant Enum := 16#807C#; GL_NORMAL_ARRAY_TYPE : constant Enum := 16#807E#; GL_NORMAL_ARRAY_STRIDE : constant Enum := 16#807F#; GL_COLOR_ARRAY_SIZE : constant Enum := 16#8081#; GL_COLOR_ARRAY_TYPE : constant Enum := 16#8082#; GL_COLOR_ARRAY_STRIDE : constant Enum := 16#8083#; GL_INDEX_ARRAY_TYPE : constant Enum := 16#8085#; GL_INDEX_ARRAY_STRIDE : constant Enum := 16#8086#; GL_TEXTURE_COORD_ARRAY_SIZE : constant Enum := 16#8088#; GL_TEXTURE_COORD_ARRAY_TYPE : constant Enum := 16#8089#; GL_TEXTURE_COORD_ARRAY_STRIDE : constant Enum := 16#808A#; GL_EDGE_FLAG_ARRAY_STRIDE : constant Enum := 16#808C#; GL_VERTEX_ARRAY_POINTER : constant Enum := 16#808E#; GL_NORMAL_ARRAY_POINTER : constant Enum := 16#808F#; GL_COLOR_ARRAY_POINTER : constant Enum := 16#8090#; GL_INDEX_ARRAY_POINTER : constant Enum := 16#8091#; GL_TEXTURE_COORD_ARRAY_POINTER : constant Enum := 16#8092#; GL_EDGE_FLAG_ARRAY_POINTER : constant Enum := 16#8093#; GL_V2F : constant Enum := 16#2A20#; GL_V3F : constant Enum := 16#2A21#; GL_C4UB_V2F : constant Enum := 16#2A22#; GL_C4UB_V3F : constant Enum := 16#2A23#; GL_C3F_V3F : constant Enum := 16#2A24#; GL_N3F_V3F : constant Enum := 16#2A25#; GL_C4F_N3F_V3F : constant Enum := 16#2A26#; GL_T2F_V3F : constant Enum := 16#2A27#; GL_T4F_V4F : constant Enum := 16#2A28#; GL_T2F_C4UB_V3F : constant Enum := 16#2A29#; GL_T2F_C3F_V3F : constant Enum := 16#2A2A#; GL_T2F_N3F_V3F : constant Enum := 16#2A2B#; GL_T2F_C4F_N3F_V3F : constant Enum := 16#2A2C#; GL_T4F_C4F_N3F_V4F : constant Enum := 16#2A2D#; GL_MATRIX_MODE : constant Enum := 16#BA0#; GL_MODELVIEW : constant Enum := 16#1700#; GL_PROJECTION : constant Enum := 16#1701#; GL_TEXTURE : constant Enum := 16#1702#; GL_POINT_SMOOTH : constant Enum := 16#B10#; GL_POINT_SIZE : constant Enum := 16#B11#; GL_POINT_SIZE_GRANULARITY : constant Enum := 16#B13#; GL_POINT_SIZE_RANGE : constant Enum := 16#B12#; GL_LINE_SMOOTH : constant Enum := 16#B20#; GL_LINE_STIPPLE : constant Enum := 16#B24#; GL_LINE_STIPPLE_PATTERN : constant Enum := 16#B25#; GL_LINE_STIPPLE_REPEAT : constant Enum := 16#B26#; GL_LINE_WIDTH : constant Enum := 16#B21#; GL_LINE_WIDTH_GRANULARITY : constant Enum := 16#B23#; GL_LINE_WIDTH_RANGE : constant Enum := 16#B22#; GL_POINT : constant Enum := 16#1B00#; GL_LINE : constant Enum := 16#1B01#; GL_FILL : constant Enum := 16#1B02#; GL_CW : constant Enum := 16#900#; GL_CCW : constant Enum := 16#901#; GL_FRONT : constant Enum := 16#404#; GL_BACK : constant Enum := 16#405#; GL_POLYGON_MODE : constant Enum := 16#B40#; GL_POLYGON_SMOOTH : constant Enum := 16#B41#; GL_POLYGON_STIPPLE : constant Enum := 16#B42#; GL_EDGE_FLAG : constant Enum := 16#B43#; GL_CULL_FACE : constant Enum := 16#B44#; GL_CULL_FACE_MODE : constant Enum := 16#B45#; GL_FRONT_FACE : constant Enum := 16#B46#; GL_POLYGON_OFFSET_FACTOR : constant Enum := 16#8038#; GL_POLYGON_OFFSET_UNITS : constant Enum := 16#2A00#; GL_POLYGON_OFFSET_POINT : constant Enum := 16#2A01#; GL_POLYGON_OFFSET_LINE : constant Enum := 16#2A02#; GL_POLYGON_OFFSET_FILL : constant Enum := 16#8037#; GL_COMPILE : constant Enum := 16#1300#; GL_COMPILE_AND_EXECUTE : constant Enum := 16#1301#; GL_LIST_BASE : constant Enum := 16#B32#; GL_LIST_INDEX : constant Enum := 16#B33#; GL_LIST_MODE : constant Enum := 16#B30#; GL_NEVER : constant Enum := 16#200#; GL_LESS : constant Enum := 16#201#; GL_EQUAL : constant Enum := 16#202#; GL_LEQUAL : constant Enum := 16#203#; GL_GREATER : constant Enum := 16#204#; GL_NOTEQUAL : constant Enum := 16#205#; GL_GEQUAL : constant Enum := 16#206#; GL_ALWAYS : constant Enum := 16#207#; GL_DEPTH_TEST : constant Enum := 16#B71#; GL_DEPTH_BITS : constant Enum := 16#D56#; GL_DEPTH_CLEAR_VALUE : constant Enum := 16#B73#; GL_DEPTH_FUNC : constant Enum := 16#B74#; GL_DEPTH_RANGE : constant Enum := 16#B70#; GL_DEPTH_WRITEMASK : constant Enum := 16#B72#; GL_DEPTH_COMPONENT : constant Enum := 16#1902#; GL_LIGHTING : constant Enum := 16#B50#; GL_LIGHT0 : constant Enum := 16#4000#; GL_LIGHT1 : constant Enum := 16#4001#; GL_LIGHT2 : constant Enum := 16#4002#; GL_LIGHT3 : constant Enum := 16#4003#; GL_LIGHT4 : constant Enum := 16#4004#; GL_LIGHT5 : constant Enum := 16#4005#; GL_LIGHT6 : constant Enum := 16#4006#; GL_LIGHT7 : constant Enum := 16#4007#; GL_SPOT_EXPONENT : constant Enum := 16#1205#; GL_SPOT_CUTOFF : constant Enum := 16#1206#; GL_CONSTANT_ATTENUATION : constant Enum := 16#1207#; GL_LINEAR_ATTENUATION : constant Enum := 16#1208#; GL_QUADRATIC_ATTENUATION : constant Enum := 16#1209#; GL_AMBIENT : constant Enum := 16#1200#; GL_DIFFUSE : constant Enum := 16#1201#; GL_SPECULAR : constant Enum := 16#1202#; GL_SHININESS : constant Enum := 16#1601#; GL_EMISSION : constant Enum := 16#1600#; GL_POSITION : constant Enum := 16#1203#; GL_SPOT_DIRECTION : constant Enum := 16#1204#; GL_AMBIENT_AND_DIFFUSE : constant Enum := 16#1602#; GL_COLOR_INDEXES : constant Enum := 16#1603#; GL_LIGHT_MODEL_TWO_SIDE : constant Enum := 16#B52#; GL_LIGHT_MODEL_LOCAL_VIEWER : constant Enum := 16#B51#; GL_LIGHT_MODEL_AMBIENT : constant Enum := 16#B53#; GL_FRONT_AND_BACK : constant Enum := 16#408#; GL_SHADE_MODEL : constant Enum := 16#B54#; GL_FLAT : constant Enum := 16#1D00#; GL_SMOOTH : constant Enum := 16#1D01#; GL_COLOR_MATERIAL : constant Enum := 16#B57#; GL_COLOR_MATERIAL_FACE : constant Enum := 16#B55#; GL_COLOR_MATERIAL_PARAMETER : constant Enum := 16#B56#; GL_NORMALIZE : constant Enum := 16#BA1#; GL_CLIP_PLANE0 : constant Enum := 16#3000#; GL_CLIP_PLANE1 : constant Enum := 16#3001#; GL_CLIP_PLANE2 : constant Enum := 16#3002#; GL_CLIP_PLANE3 : constant Enum := 16#3003#; GL_CLIP_PLANE4 : constant Enum := 16#3004#; GL_CLIP_PLANE5 : constant Enum := 16#3005#; GL_ACCUM_RED_BITS : constant Enum := 16#D58#; GL_ACCUM_GREEN_BITS : constant Enum := 16#D59#; GL_ACCUM_BLUE_BITS : constant Enum := 16#D5A#; GL_ACCUM_ALPHA_BITS : constant Enum := 16#D5B#; GL_ACCUM_CLEAR_VALUE : constant Enum := 16#B80#; GL_ACCUM : constant Enum := 16#100#; GL_ADD : constant Enum := 16#104#; GL_LOAD : constant Enum := 16#101#; GL_MULT : constant Enum := 16#103#; GL_RETURN : constant Enum := 16#102#; GL_ALPHA_TEST : constant Enum := 16#BC0#; GL_ALPHA_TEST_REF : constant Enum := 16#BC2#; GL_ALPHA_TEST_FUNC : constant Enum := 16#BC1#; GL_BLEND : constant Enum := 16#BE2#; GL_BLEND_SRC : constant Enum := 16#BE1#; GL_BLEND_DST : constant Enum := 16#BE0#; GL_ZERO : constant Enum := 16#0#; GL_ONE : constant Enum := 16#1#; GL_SRC_COLOR : constant Enum := 16#300#; GL_ONE_MINUS_SRC_COLOR : constant Enum := 16#301#; GL_SRC_ALPHA : constant Enum := 16#302#; GL_ONE_MINUS_SRC_ALPHA : constant Enum := 16#303#; GL_DST_ALPHA : constant Enum := 16#304#; GL_ONE_MINUS_DST_ALPHA : constant Enum := 16#305#; GL_DST_COLOR : constant Enum := 16#306#; GL_ONE_MINUS_DST_COLOR : constant Enum := 16#307#; GL_SRC_ALPHA_SATURATE : constant Enum := 16#308#; GL_FEEDBACK : constant Enum := 16#1C01#; GL_RENDER : constant Enum := 16#1C00#; GL_SELECT : constant Enum := 16#1C02#; GL_2D : constant Enum := 16#600#; GL_3D : constant Enum := 16#601#; GL_3D_COLOR : constant Enum := 16#602#; GL_3D_COLOR_TEXTURE : constant Enum := 16#603#; GL_4D_COLOR_TEXTURE : constant Enum := 16#604#; GL_POINT_TOKEN : constant Enum := 16#701#; GL_LINE_TOKEN : constant Enum := 16#7<PASSWORD>#; GL_LINE_RESET_TOKEN : constant Enum := 16#707#; GL_POLYGON_TOKEN : constant Enum := 16#703#; GL_BITMAP_TOKEN : constant Enum := 16#<PASSWORD>#; GL_DRAW_PIXEL_TOKEN : constant Enum := 16#705#; GL_COPY_PIXEL_TOKEN : constant Enum := 16#706#; GL_PASS_THROUGH_TOKEN : constant Enum := 16#700#; GL_FEEDBACK_BUFFER_POINTER : constant Enum := 16#DF0#; GL_FEEDBACK_BUFFER_SIZE : constant Enum := 16#DF1#; GL_FEEDBACK_BUFFER_TYPE : constant Enum := 16#DF2#; GL_SELECTION_BUFFER_POINTER : constant Enum := 16#DF3#; GL_SELECTION_BUFFER_SIZE : constant Enum := 16#DF4#; GL_FOG : constant Enum := 16#B60#; GL_FOG_MODE : constant Enum := 16#B65#; GL_FOG_DENSITY : constant Enum := 16#B62#; GL_FOG_COLOR : constant Enum := 16#B66#; GL_FOG_INDEX : constant Enum := 16#B61#; GL_FOG_START : constant Enum := 16#B63#; GL_FOG_END : constant Enum := 16#B64#; GL_LINEAR : constant Enum := 16#2601#; GL_EXP : constant Enum := 16#800#; GL_EXP2 : constant Enum := 16#801#; GL_LOGIC_OP : constant Enum := 16#BF1#; GL_INDEX_LOGIC_OP : constant Enum := 16#BF1#; GL_COLOR_LOGIC_OP : constant Enum := 16#BF2#; GL_LOGIC_OP_MODE : constant Enum := 16#BF0#; GL_CLEAR : constant Enum := 16#1500#; GL_SET : constant Enum := 16#150F#; GL_COPY : constant Enum := 16#1503#; GL_COPY_INVERTED : constant Enum := 16#150C#; GL_NOOP : constant Enum := 16#1505#; GL_INVERT : constant Enum := 16#150A#; GL_AND : constant Enum := 16#1501#; GL_NAND : constant Enum := 16#150E#; GL_OR : constant Enum := 16#1507#; GL_NOR : constant Enum := 16#1508#; GL_XOR : constant Enum := 16#1506#; GL_EQUIV : constant Enum := 16#1509#; GL_AND_REVERSE : constant Enum := 16#1502#; GL_AND_INVERTED : constant Enum := 16#1504#; GL_OR_REVERSE : constant Enum := 16#150B#; GL_OR_INVERTED : constant Enum := 16#150D#; GL_STENCIL_BITS : constant Enum := 16#D57#; GL_STENCIL_TEST : constant Enum := 16#B90#; GL_STENCIL_CLEAR_VALUE : constant Enum := 16#B91#; GL_STENCIL_FUNC : constant Enum := 16#B92#; GL_STENCIL_VALUE_MASK : constant Enum := 16#B93#; GL_STENCIL_FAIL : constant Enum := 16#B94#; GL_STENCIL_PASS_DEPTH_FAIL : constant Enum := 16#B95#; GL_STENCIL_PASS_DEPTH_PASS : constant Enum := 16#B96#; GL_STENCIL_REF : constant Enum := 16#B97#; GL_STENCIL_WRITEMASK : constant Enum := 16#B98#; GL_STENCIL_INDEX : constant Enum := 16#1901#; GL_KEEP : constant Enum := 16#1E00#; GL_REPLACE : constant Enum := 16#1E01#; GL_INCR : constant Enum := 16#1E02#; GL_DECR : constant Enum := 16#1E03#; GL_NONE : constant Enum := 16#0#; GL_LEFT : constant Enum := 16#406#; GL_RIGHT : constant Enum := 16#407#; GL_FRONT_LEFT : constant Enum := 16#400#; GL_FRONT_RIGHT : constant Enum := 16#401#; GL_BACK_LEFT : constant Enum := 16#402#; GL_BACK_RIGHT : constant Enum := 16#403#; GL_AUX0 : constant Enum := 16#409#; GL_AUX1 : constant Enum := 16#40A#; GL_AUX2 : constant Enum := 16#40B#; GL_AUX3 : constant Enum := 16#40C#; GL_COLOR_INDEX : constant Enum := 16#1900#; GL_RED : constant Enum := 16#1903#; GL_GREEN : constant Enum := 16#1904#; GL_BLUE : constant Enum := 16#1905#; GL_ALPHA : constant Enum := 16#1906#; GL_LUMINANCE : constant Enum := 16#1909#; GL_LUMINANCE_ALPHA : constant Enum := 16#190A#; GL_ALPHA_BITS : constant Enum := 16#D55#; GL_RED_BITS : constant Enum := 16#D52#; GL_GREEN_BITS : constant Enum := 16#D53#; GL_BLUE_BITS : constant Enum := 16#D54#; GL_INDEX_BITS : constant Enum := 16#D51#; GL_SUBPIXEL_BITS : constant Enum := 16#D50#; GL_AUX_BUFFERS : constant Enum := 16#C00#; GL_READ_BUFFER : constant Enum := 16#C02#; GL_DRAW_BUFFER : constant Enum := 16#C01#; GL_DOUBLEBUFFER : constant Enum := 16#C32#; GL_STEREO : constant Enum := 16#C33#; GL_BITMAP : constant Enum := 16#1A00#; GL_COLOR : constant Enum := 16#1800#; GL_DEPTH : constant Enum := 16#1801#; GL_STENCIL : constant Enum := 16#1802#; GL_DITHER : constant Enum := 16#BD0#; GL_RGB : constant Enum := 16#1907#; GL_RGBA : constant Enum := 16#1908#; GL_MAX_LIST_NESTING : constant Enum := 16#B31#; GL_MAX_EVAL_ORDER : constant Enum := 16#D30#; GL_MAX_LIGHTS : constant Enum := 16#D31#; GL_MAX_CLIP_PLANES : constant Enum := 16#D32#; GL_MAX_TEXTURE_SIZE : constant Enum := 16#D33#; GL_MAX_PIXEL_MAP_TABLE : constant Enum := 16#D34#; GL_MAX_ATTRIB_STACK_DEPTH : constant Enum := 16#D35#; GL_MAX_MODELVIEW_STACK_DEPTH : constant Enum := 16#D36#; GL_MAX_NAME_STACK_DEPTH : constant Enum := 16#D37#; GL_MAX_PROJECTION_STACK_DEPTH : constant Enum := 16#D38#; GL_MAX_TEXTURE_STACK_DEPTH : constant Enum := 16#D39#; GL_MAX_VIEWPORT_DIMS : constant Enum := 16#D3A#; GL_MAX_CLIENT_ATTRIB_STACK_DEPTH : constant Enum := 16#D3B#; GL_ATTRIB_STACK_DEPTH : constant Enum := 16#BB0#; GL_CLIENT_ATTRIB_STACK_DEPTH : constant Enum := 16#BB1#; GL_COLOR_CLEAR_VALUE : constant Enum := 16#C22#; GL_COLOR_WRITEMASK : constant Enum := 16#C23#; GL_CURRENT_INDEX : constant Enum := 16#B01#; GL_CURRENT_COLOR : constant Enum := 16#B00#; GL_CURRENT_NORMAL : constant Enum := 16#B02#; GL_CURRENT_RASTER_COLOR : constant Enum := 16#B04#; GL_CURRENT_RASTER_DISTANCE : constant Enum := 16#B09#; GL_CURRENT_RASTER_INDEX : constant Enum := 16#B05#; GL_CURRENT_RASTER_POSITION : constant Enum := 16#B07#; GL_CURRENT_RASTER_TEXTURE_COORDS : constant Enum := 16#B06#; GL_CURRENT_RASTER_POSITION_VALID : constant Enum := 16#B08#; GL_CURRENT_TEXTURE_COORDS : constant Enum := 16#B03#; GL_INDEX_CLEAR_VALUE : constant Enum := 16#C20#; GL_INDEX_MODE : constant Enum := 16#C30#; GL_INDEX_WRITEMASK : constant Enum := 16#C21#; GL_MODELVIEW_MATRIX : constant Enum := 16#BA6#; GL_MODELVIEW_STACK_DEPTH : constant Enum := 16#BA3#; GL_NAME_STACK_DEPTH : constant Enum := 16#D70#; GL_PROJECTION_MATRIX : constant Enum := 16#BA7#; GL_PROJECTION_STACK_DEPTH : constant Enum := 16#BA4#; GL_RENDER_MODE : constant Enum := 16#C40#; GL_RGBA_MODE : constant Enum := 16#C31#; GL_TEXTURE_MATRIX : constant Enum := 16#BA8#; GL_TEXTURE_STACK_DEPTH : constant Enum := 16#BA5#; GL_VIEWPORT : constant Enum := 16#BA2#; GL_AUTO_NORMAL : constant Enum := 16#D80#; GL_MAP1_COLOR_4 : constant Enum := 16#D90#; GL_MAP1_INDEX : constant Enum := 16#D91#; GL_MAP1_NORMAL : constant Enum := 16#D92#; GL_MAP1_TEXTURE_COORD_1 : constant Enum := 16#D93#; GL_MAP1_TEXTURE_COORD_2 : constant Enum := 16#D94#; GL_MAP1_TEXTURE_COORD_3 : constant Enum := 16#D95#; GL_MAP1_TEXTURE_COORD_4 : constant Enum := 16#D96#; GL_MAP1_VERTEX_3 : constant Enum := 16#D97#; GL_MAP1_VERTEX_4 : constant Enum := 16#D98#; GL_MAP2_COLOR_4 : constant Enum := 16#DB0#; GL_MAP2_INDEX : constant Enum := 16#DB1#; GL_MAP2_NORMAL : constant Enum := 16#DB2#; GL_MAP2_TEXTURE_COORD_1 : constant Enum := 16#DB3#; GL_MAP2_TEXTURE_COORD_2 : constant Enum := 16#DB4#; GL_MAP2_TEXTURE_COORD_3 : constant Enum := 16#DB5#; GL_MAP2_TEXTURE_COORD_4 : constant Enum := 16#DB6#; GL_MAP2_VERTEX_3 : constant Enum := 16#DB7#; GL_MAP2_VERTEX_4 : constant Enum := 16#DB8#; GL_MAP1_GRID_DOMAIN : constant Enum := 16#DD0#; GL_MAP1_GRID_SEGMENTS : constant Enum := 16#DD1#; GL_MAP2_GRID_DOMAIN : constant Enum := 16#DD2#; GL_MAP2_GRID_SEGMENTS : constant Enum := 16#DD3#; GL_COEFF : constant Enum := 16#A00#; GL_ORDER : constant Enum := 16#A01#; GL_DOMAIN : constant Enum := 16#A02#; GL_PERSPECTIVE_CORRECTION_HINT : constant Enum := 16#C50#; GL_POINT_SMOOTH_HINT : constant Enum := 16#C51#; GL_LINE_SMOOTH_HINT : constant Enum := 16#C52#; GL_POLYGON_SMOOTH_HINT : constant Enum := 16#C53#; GL_FOG_HINT : constant Enum := 16#C54#; GL_DONT_CARE : constant Enum := 16#1100#; GL_FASTEST : constant Enum := 16#1101#; GL_NICEST : constant Enum := 16#1102#; GL_SCISSOR_BOX : constant Enum := 16#C10#; GL_SCISSOR_TEST : constant Enum := 16#C11#; GL_MAP_COLOR : constant Enum := 16#D10#; GL_MAP_STENCIL : constant Enum := 16#D11#; GL_INDEX_SHIFT : constant Enum := 16#D12#; GL_INDEX_OFFSET : constant Enum := 16#D13#; GL_RED_SCALE : constant Enum := 16#D14#; GL_RED_BIAS : constant Enum := 16#D15#; GL_GREEN_SCALE : constant Enum := 16#D18#; GL_GREEN_BIAS : constant Enum := 16#D19#; GL_BLUE_SCALE : constant Enum := 16#D1A#; GL_BLUE_BIAS : constant Enum := 16#D1B#; GL_ALPHA_SCALE : constant Enum := 16#D1C#; GL_ALPHA_BIAS : constant Enum := 16#D1D#; GL_DEPTH_SCALE : constant Enum := 16#D1E#; GL_DEPTH_BIAS : constant Enum := 16#D1F#; GL_PIXEL_MAP_S_TO_S_SIZE : constant Enum := 16#CB1#; GL_PIXEL_MAP_I_TO_I_SIZE : constant Enum := 16#CB0#; GL_PIXEL_MAP_I_TO_R_SIZE : constant Enum := 16#CB2#; GL_PIXEL_MAP_I_TO_G_SIZE : constant Enum := 16#CB3#; GL_PIXEL_MAP_I_TO_B_SIZE : constant Enum := 16#CB4#; GL_PIXEL_MAP_I_TO_A_SIZE : constant Enum := 16#CB5#; GL_PIXEL_MAP_R_TO_R_SIZE : constant Enum := 16#CB6#; GL_PIXEL_MAP_G_TO_G_SIZE : constant Enum := 16#CB7#; GL_PIXEL_MAP_B_TO_B_SIZE : constant Enum := 16#CB8#; GL_PIXEL_MAP_A_TO_A_SIZE : constant Enum := 16#CB9#; GL_PIXEL_MAP_S_TO_S : constant Enum := 16#C71#; GL_PIXEL_MAP_I_TO_I : constant Enum := 16#C70#; GL_PIXEL_MAP_I_TO_R : constant Enum := 16#C72#; GL_PIXEL_MAP_I_TO_G : constant Enum := 16#C73#; GL_PIXEL_MAP_I_TO_B : constant Enum := 16#C74#; GL_PIXEL_MAP_I_TO_A : constant Enum := 16#C75#; GL_PIXEL_MAP_R_TO_R : constant Enum := 16#C76#; GL_PIXEL_MAP_G_TO_G : constant Enum := 16#C77#; GL_PIXEL_MAP_B_TO_B : constant Enum := 16#C78#; GL_PIXEL_MAP_A_TO_A : constant Enum := 16#C79#; GL_PACK_ALIGNMENT : constant Enum := 16#D05#; GL_PACK_LSB_FIRST : constant Enum := 16#D01#; GL_PACK_ROW_LENGTH : constant Enum := 16#D02#; GL_PACK_SKIP_PIXELS : constant Enum := 16#D04#; GL_PACK_SKIP_ROWS : constant Enum := 16#D03#; GL_PACK_SWAP_BYTES : constant Enum := 16#D00#; GL_UNPACK_ALIGNMENT : constant Enum := 16#CF5#; GL_UNPACK_LSB_FIRST : constant Enum := 16#CF1#; GL_UNPACK_ROW_LENGTH : constant Enum := 16#CF2#; GL_UNPACK_SKIP_PIXELS : constant Enum := 16#CF4#; GL_UNPACK_SKIP_ROWS : constant Enum := 16#CF3#; GL_UNPACK_SWAP_BYTES : constant Enum := 16#CF0#; GL_ZOOM_X : constant Enum := 16#D16#; GL_ZOOM_Y : constant Enum := 16#D17#; GL_TEXTURE_ENV : constant Enum := 16#2300#; GL_TEXTURE_ENV_MODE : constant Enum := 16#2200#; GL_TEXTURE_1D : constant Enum := 16#DE0#; GL_TEXTURE_2D : constant Enum := 16#DE1#; GL_TEXTURE_WRAP_S : constant Enum := 16#2802#; GL_TEXTURE_WRAP_T : constant Enum := 16#2803#; GL_TEXTURE_MAG_FILTER : constant Enum := 16#2800#; GL_TEXTURE_MIN_FILTER : constant Enum := 16#2801#; GL_TEXTURE_ENV_COLOR : constant Enum := 16#2201#; GL_TEXTURE_GEN_S : constant Enum := 16#C60#; GL_TEXTURE_GEN_T : constant Enum := 16#C61#; GL_TEXTURE_GEN_MODE : constant Enum := 16#2500#; GL_TEXTURE_BORDER_COLOR : constant Enum := 16#1004#; GL_TEXTURE_WIDTH : constant Enum := 16#1000#; GL_TEXTURE_HEIGHT : constant Enum := 16#1001#; GL_TEXTURE_BORDER : constant Enum := 16#1005#; GL_TEXTURE_COMPONENTS : constant Enum := 16#1003#; GL_TEXTURE_RED_SIZE : constant Enum := 16#805C#; GL_TEXTURE_GREEN_SIZE : constant Enum := 16#805D#; GL_TEXTURE_BLUE_SIZE : constant Enum := 16#805E#; GL_TEXTURE_ALPHA_SIZE : constant Enum := 16#805F#; GL_TEXTURE_LUMINANCE_SIZE : constant Enum := 16#8060#; GL_TEXTURE_INTENSITY_SIZE : constant Enum := 16#8061#; GL_NEAREST_MIPMAP_NEAREST : constant Enum := 16#2700#; GL_NEAREST_MIPMAP_LINEAR : constant Enum := 16#2702#; GL_LINEAR_MIPMAP_NEAREST : constant Enum := 16#2701#; GL_LINEAR_MIPMAP_LINEAR : constant Enum := 16#2703#; GL_OBJECT_LINEAR : constant Enum := 16#2401#; GL_OBJECT_PLANE : constant Enum := 16#2501#; GL_EYE_LINEAR : constant Enum := 16#2400#; GL_EYE_PLANE : constant Enum := 16#2502#; GL_SPHERE_MAP : constant Enum := 16#2402#; GL_DECAL : constant Enum := 16#2101#; GL_MODULATE : constant Enum := 16#2100#; GL_NEAREST : constant Enum := 16#2600#; GL_REPEAT : constant Enum := 16#2901#; GL_CLAMP : constant Enum := 16#2900#; GL_S : constant Enum := 16#2000#; GL_T : constant Enum := 16#2001#; GL_R : constant Enum := 16#2002#; GL_Q : constant Enum := 16#2003#; GL_TEXTURE_GEN_R : constant Enum := 16#C62#; GL_TEXTURE_GEN_Q : constant Enum := 16#C63#; GL_VENDOR : constant Enum := 16#1F00#; GL_RENDERER : constant Enum := 16#1F01#; GL_VERSION : constant Enum := 16#1F02#; GL_SHADING_LANGUAGE_VERSION : constant Enum := 16#8B8C#; GL_EXTENSIONS : constant Enum := 16#1F03#; GL_NO_ERROR : constant Enum := 16#0#; GL_INVALID_ENUM : constant Enum := 16#500#; GL_INVALID_VALUE : constant Enum := 16#501#; GL_INVALID_OPERATION : constant Enum := 16#502#; GL_STACK_OVERFLOW : constant Enum := 16#503#; GL_STACK_UNDERFLOW : constant Enum := 16#504#; GL_OUT_OF_MEMORY : constant Enum := 16#505#; GL_PROXY_TEXTURE_1D : constant Enum := 16#8063#; GL_PROXY_TEXTURE_2D : constant Enum := 16#8064#; GL_TEXTURE_PRIORITY : constant Enum := 16#8066#; GL_TEXTURE_RESIDENT : constant Enum := 16#8067#; GL_TEXTURE_BINDING_1D : constant Enum := 16#8068#; GL_TEXTURE_BINDING_2D : constant Enum := 16#8069#; GL_TEXTURE_INTERNAL_FORMAT : constant Enum := 16#1003#; GL_ALPHA4 : constant Enum := 16#803B#; GL_ALPHA8 : constant Enum := 16#803C#; GL_ALPHA12 : constant Enum := 16#803D#; GL_ALPHA16 : constant Enum := 16#803E#; GL_LUMINANCE4 : constant Enum := 16#803F#; GL_LUMINANCE8 : constant Enum := 16#8040#; GL_LUMINANCE12 : constant Enum := 16#8041#; GL_LUMINANCE16 : constant Enum := 16#8042#; GL_LUMINANCE4_ALPHA4 : constant Enum := 16#8043#; GL_LUMINANCE6_ALPHA2 : constant Enum := 16#8044#; GL_LUMINANCE8_ALPHA8 : constant Enum := 16#8045#; GL_LUMINANCE12_ALPHA4 : constant Enum := 16#8046#; GL_LUMINANCE12_ALPHA12 : constant Enum := 16#8047#; GL_LUMINANCE16_ALPHA16 : constant Enum := 16#8048#; GL_INTENSITY : constant Enum := 16#8049#; GL_INTENSITY4 : constant Enum := 16#804A#; GL_INTENSITY8 : constant Enum := 16#804B#; GL_INTENSITY12 : constant Enum := 16#804C#; GL_INTENSITY16 : constant Enum := 16#804D#; GL_R3_G3_B2 : constant Enum := 16#2A10#; GL_RGB4 : constant Enum := 16#804F#; GL_RGB5 : constant Enum := 16#8050#; GL_RGB8 : constant Enum := 16#8051#; GL_RGB10 : constant Enum := 16#8052#; GL_RGB12 : constant Enum := 16#8053#; GL_RGB16 : constant Enum := 16#8054#; GL_RGBA2 : constant Enum := 16#8055#; GL_RGBA4 : constant Enum := 16#8056#; GL_RGB5_A1 : constant Enum := 16#8057#; GL_RGBA8 : constant Enum := 16#8058#; GL_RGB10_A2 : constant Enum := 16#8059#; GL_RGBA12 : constant Enum := 16#805A#; GL_RGBA16 : constant Enum := 16#805B#; GL_CLIENT_PIXEL_STORE_BIT : constant Enum := 16#1#; GL_CLIENT_VERTEX_ARRAY_BIT : constant Enum := 16#2#; GL_ALL_CLIENT_ATTRIB_BITS : constant Enum := 16#FFFFFFFF#; GL_CLIENT_ALL_ATTRIB_BITS : constant Enum := 16#FFFFFFFF#; GL_RESCALE_NORMAL : constant Enum := 16#803A#; GL_CLAMP_TO_EDGE : constant Enum := 16#812F#; GL_MAX_ELEMENTS_VERTICES : constant Enum := 16#80E8#; GL_MAX_ELEMENTS_INDICES : constant Enum := 16#80E9#; GL_BGR : constant Enum := 16#80E0#; GL_BGRA : constant Enum := 16#80E1#; GL_UNSIGNED_BYTE_3_3_2 : constant Enum := 16#8032#; GL_UNSIGNED_BYTE_2_3_3_REV : constant Enum := 16#8362#; GL_UNSIGNED_SHORT_5_6_5 : constant Enum := 16#8363#; GL_UNSIGNED_SHORT_5_6_5_REV : constant Enum := 16#8364#; GL_UNSIGNED_SHORT_4_4_4_4 : constant Enum := 16#8033#; GL_UNSIGNED_SHORT_4_4_4_4_REV : constant Enum := 16#8365#; GL_UNSIGNED_SHORT_5_5_5_1 : constant Enum := 16#8034#; GL_UNSIGNED_SHORT_1_5_5_5_REV : constant Enum := 16#8366#; GL_UNSIGNED_INT_8_8_8_8 : constant Enum := 16#8035#; GL_UNSIGNED_INT_8_8_8_8_REV : constant Enum := 16#8367#; GL_UNSIGNED_INT_10_10_10_2 : constant Enum := 16#8036#; GL_UNSIGNED_INT_2_10_10_10_REV : constant Enum := 16#8368#; GL_LIGHT_MODEL_COLOR_CONTROL : constant Enum := 16#81F8#; GL_SINGLE_COLOR : constant Enum := 16#81F9#; GL_SEPARATE_SPECULAR_COLOR : constant Enum := 16#81FA#; GL_TEXTURE_MIN_LOD : constant Enum := 16#813A#; GL_TEXTURE_MAX_LOD : constant Enum := 16#813B#; GL_TEXTURE_BASE_LEVEL : constant Enum := 16#813C#; GL_TEXTURE_MAX_LEVEL : constant Enum := 16#813D#; GL_SMOOTH_POINT_SIZE_RANGE : constant Enum := 16#B12#; GL_SMOOTH_POINT_SIZE_GRANULARITY : constant Enum := 16#B13#; GL_SMOOTH_LINE_WIDTH_RANGE : constant Enum := 16#B22#; GL_SMOOTH_LINE_WIDTH_GRANULARITY : constant Enum := 16#B23#; GL_ALIASED_POINT_SIZE_RANGE : constant Enum := 16#846D#; GL_ALIASED_LINE_WIDTH_RANGE : constant Enum := 16#846E#; GL_PACK_SKIP_IMAGES : constant Enum := 16#806B#; GL_PACK_IMAGE_HEIGHT : constant Enum := 16#806C#; GL_UNPACK_SKIP_IMAGES : constant Enum := 16#806D#; GL_UNPACK_IMAGE_HEIGHT : constant Enum := 16#806E#; GL_TEXTURE_3D : constant Enum := 16#806F#; GL_PROXY_TEXTURE_3D : constant Enum := 16#8070#; GL_TEXTURE_DEPTH : constant Enum := 16#8071#; GL_TEXTURE_WRAP_R : constant Enum := 16#8072#; GL_MAX_3D_TEXTURE_SIZE : constant Enum := 16#8073#; GL_TEXTURE_BINDING_3D : constant Enum := 16#806A#; GL_CONSTANT_COLOR : constant Enum := 16#8001#; GL_ONE_MINUS_CONSTANT_COLOR : constant Enum := 16#8002#; GL_CONSTANT_ALPHA : constant Enum := 16#8003#; GL_ONE_MINUS_CONSTANT_ALPHA : constant Enum := 16#8004#; GL_COLOR_TABLE : constant Enum := 16#80D0#; GL_POST_CONVOLUTION_COLOR_TABLE : constant Enum := 16#80D1#; GL_POST_COLOR_MATRIX_COLOR_TABLE : constant Enum := 16#80D2#; GL_PROXY_COLOR_TABLE : constant Enum := 16#80D3#; GL_PROXY_POST_CONVOLUTION_COLOR_TABLE : constant Enum := 16#80D4#; GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE : constant Enum := 16#80D5#; GL_COLOR_TABLE_SCALE : constant Enum := 16#80D6#; GL_COLOR_TABLE_BIAS : constant Enum := 16#80D7#; GL_COLOR_TABLE_FORMAT : constant Enum := 16#80D8#; GL_COLOR_TABLE_WIDTH : constant Enum := 16#80D9#; GL_COLOR_TABLE_RED_SIZE : constant Enum := 16#80DA#; GL_COLOR_TABLE_GREEN_SIZE : constant Enum := 16#80DB#; GL_COLOR_TABLE_BLUE_SIZE : constant Enum := 16#80DC#; GL_COLOR_TABLE_ALPHA_SIZE : constant Enum := 16#80DD#; GL_COLOR_TABLE_LUMINANCE_SIZE : constant Enum := 16#80DE#; GL_COLOR_TABLE_INTENSITY_SIZE : constant Enum := 16#80DF#; GL_CONVOLUTION_1D : constant Enum := 16#8010#; GL_CONVOLUTION_2D : constant Enum := 16#8011#; GL_SEPARABLE_2D : constant Enum := 16#8012#; GL_CONVOLUTION_BORDER_MODE : constant Enum := 16#8013#; GL_CONVOLUTION_FILTER_SCALE : constant Enum := 16#8014#; GL_CONVOLUTION_FILTER_BIAS : constant Enum := 16#8015#; GL_REDUCE : constant Enum := 16#8016#; GL_CONVOLUTION_FORMAT : constant Enum := 16#8017#; GL_CONVOLUTION_WIDTH : constant Enum := 16#8018#; GL_CONVOLUTION_HEIGHT : constant Enum := 16#8019#; GL_MAX_CONVOLUTION_WIDTH : constant Enum := 16#801A#; GL_MAX_CONVOLUTION_HEIGHT : constant Enum := 16#801B#; GL_POST_CONVOLUTION_RED_SCALE : constant Enum := 16#801C#; GL_POST_CONVOLUTION_GREEN_SCALE : constant Enum := 16#801D#; GL_POST_CONVOLUTION_BLUE_SCALE : constant Enum := 16#801E#; GL_POST_CONVOLUTION_ALPHA_SCALE : constant Enum := 16#801F#; GL_POST_CONVOLUTION_RED_BIAS : constant Enum := 16#8020#; GL_POST_CONVOLUTION_GREEN_BIAS : constant Enum := 16#8021#; GL_POST_CONVOLUTION_BLUE_BIAS : constant Enum := 16#8022#; GL_POST_CONVOLUTION_ALPHA_BIAS : constant Enum := 16#8023#; GL_CONSTANT_BORDER : constant Enum := 16#8151#; GL_REPLICATE_BORDER : constant Enum := 16#8153#; GL_CONVOLUTION_BORDER_COLOR : constant Enum := 16#8154#; GL_COLOR_MATRIX : constant Enum := 16#80B1#; GL_COLOR_MATRIX_STACK_DEPTH : constant Enum := 16#80B2#; GL_MAX_COLOR_MATRIX_STACK_DEPTH : constant Enum := 16#80B3#; GL_POST_COLOR_MATRIX_RED_SCALE : constant Enum := 16#80B4#; GL_POST_COLOR_MATRIX_GREEN_SCALE : constant Enum := 16#80B5#; GL_POST_COLOR_MATRIX_BLUE_SCALE : constant Enum := 16#80B6#; GL_POST_COLOR_MATRIX_ALPHA_SCALE : constant Enum := 16#80B7#; GL_POST_COLOR_MATRIX_RED_BIAS : constant Enum := 16#80B8#; GL_POST_COLOR_MATRIX_GREEN_BIAS : constant Enum := 16#80B9#; GL_POST_COLOR_MATRIX_BLUE_BIAS : constant Enum := 16#80BA#; GL_POST_COLOR_MATRIX_ALPHA_BIAS : constant Enum := 16#80BB#; GL_HISTOGRAM : constant Enum := 16#8024#; GL_PROXY_HISTOGRAM : constant Enum := 16#8025#; GL_HISTOGRAM_WIDTH : constant Enum := 16#8026#; GL_HISTOGRAM_FORMAT : constant Enum := 16#8027#; GL_HISTOGRAM_RED_SIZE : constant Enum := 16#8028#; GL_HISTOGRAM_GREEN_SIZE : constant Enum := 16#8029#; GL_HISTOGRAM_BLUE_SIZE : constant Enum := 16#802A#; GL_HISTOGRAM_ALPHA_SIZE : constant Enum := 16#802B#; GL_HISTOGRAM_LUMINANCE_SIZE : constant Enum := 16#802C#; GL_HISTOGRAM_SINK : constant Enum := 16#802D#; GL_MINMAX : constant Enum := 16#802E#; GL_MINMAX_FORMAT : constant Enum := 16#802F#; GL_MINMAX_SINK : constant Enum := 16#8030#; GL_TABLE_TOO_LARGE : constant Enum := 16#8031#; GL_BLEND_EQUATION : constant Enum := 16#8009#; GL_MIN : constant Enum := 16#8007#; GL_MAX : constant Enum := 16#8008#; GL_FUNC_ADD : constant Enum := 16#8006#; GL_FUNC_SUBTRACT : constant Enum := 16#800A#; GL_FUNC_REVERSE_SUBTRACT : constant Enum := 16#800B#; GL_BLEND_COLOR : constant Enum := 16#8005#; GL_TEXTURE0 : constant Enum := 16#84C0#; GL_TEXTURE1 : constant Enum := 16#84C1#; GL_TEXTURE2 : constant Enum := 16#84C2#; GL_TEXTURE3 : constant Enum := 16#84C3#; GL_TEXTURE4 : constant Enum := 16#84C4#; GL_TEXTURE5 : constant Enum := 16#84C5#; GL_TEXTURE6 : constant Enum := 16#84C6#; GL_TEXTURE7 : constant Enum := 16#84C7#; GL_TEXTURE8 : constant Enum := 16#84C8#; GL_TEXTURE9 : constant Enum := 16#84C9#; GL_TEXTURE10 : constant Enum := 16#84CA#; GL_TEXTURE11 : constant Enum := 16#84CB#; GL_TEXTURE12 : constant Enum := 16#84CC#; GL_TEXTURE13 : constant Enum := 16#84CD#; GL_TEXTURE14 : constant Enum := 16#84CE#; GL_TEXTURE15 : constant Enum := 16#84CF#; GL_TEXTURE16 : constant Enum := 16#84D0#; GL_TEXTURE17 : constant Enum := 16#84D1#; GL_TEXTURE18 : constant Enum := 16#84D2#; GL_TEXTURE19 : constant Enum := 16#84D3#; GL_TEXTURE20 : constant Enum := 16#84D4#; GL_TEXTURE21 : constant Enum := 16#84D5#; GL_TEXTURE22 : constant Enum := 16#84D6#; GL_TEXTURE23 : constant Enum := 16#84D7#; GL_TEXTURE24 : constant Enum := 16#84D8#; GL_TEXTURE25 : constant Enum := 16#84D9#; GL_TEXTURE26 : constant Enum := 16#84DA#; GL_TEXTURE27 : constant Enum := 16#84DB#; GL_TEXTURE28 : constant Enum := 16#84DC#; GL_TEXTURE29 : constant Enum := 16#84DD#; GL_TEXTURE30 : constant Enum := 16#84DE#; GL_TEXTURE31 : constant Enum := 16#84DF#; GL_ACTIVE_TEXTURE : constant Enum := 16#84E0#; GL_CLIENT_ACTIVE_TEXTURE : constant Enum := 16#84E1#; GL_MAX_TEXTURE_UNITS : constant Enum := 16#84E2#; GL_NORMAL_MAP : constant Enum := 16#8511#; GL_REFLECTION_MAP : constant Enum := 16#8512#; GL_TEXTURE_CUBE_MAP : constant Enum := 16#8513#; GL_TEXTURE_BINDING_CUBE_MAP : constant Enum := 16#8514#; GL_TEXTURE_CUBE_MAP_POSITIVE_X : constant Enum := 16#8515#; GL_TEXTURE_CUBE_MAP_NEGATIVE_X : constant Enum := 16#8516#; GL_TEXTURE_CUBE_MAP_POSITIVE_Y : constant Enum := 16#8517#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Y : constant Enum := 16#8518#; GL_TEXTURE_CUBE_MAP_POSITIVE_Z : constant Enum := 16#8519#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Z : constant Enum := 16#851A#; GL_PROXY_TEXTURE_CUBE_MAP : constant Enum := 16#851B#; GL_MAX_CUBE_MAP_TEXTURE_SIZE : constant Enum := 16#851C#; GL_COMPRESSED_ALPHA : constant Enum := 16#84E9#; GL_COMPRESSED_LUMINANCE : constant Enum := 16#84EA#; GL_COMPRESSED_LUMINANCE_ALPHA : constant Enum := 16#84EB#; GL_COMPRESSED_INTENSITY : constant Enum := 16#84EC#; GL_COMPRESSED_RGB : constant Enum := 16#84ED#; GL_COMPRESSED_RGBA : constant Enum := 16#84EE#; GL_TEXTURE_COMPRESSION_HINT : constant Enum := 16#84EF#; GL_TEXTURE_COMPRESSED_IMAGE_SIZE : constant Enum := 16#86A0#; GL_TEXTURE_COMPRESSED : constant Enum := 16#86A1#; GL_NUM_COMPRESSED_TEXTURE_FORMATS : constant Enum := 16#86A2#; GL_COMPRESSED_TEXTURE_FORMATS : constant Enum := 16#86A3#; GL_MULTISAMPLE : constant Enum := 16#809D#; GL_SAMPLE_ALPHA_TO_COVERAGE : constant Enum := 16#809E#; GL_SAMPLE_ALPHA_TO_ONE : constant Enum := 16#809F#; GL_SAMPLE_COVERAGE : constant Enum := 16#80A0#; GL_SAMPLE_BUFFERS : constant Enum := 16#80A8#; GL_SAMPLES : constant Enum := 16#80A9#; GL_SAMPLE_COVERAGE_VALUE : constant Enum := 16#80AA#; GL_SAMPLE_COVERAGE_INVERT : constant Enum := 16#80AB#; GL_MULTISAMPLE_BIT : constant Enum := 16#20000000#; GL_TRANSPOSE_MODELVIEW_MATRIX : constant Enum := 16#84E3#; GL_TRANSPOSE_PROJECTION_MATRIX : constant Enum := 16#84E4#; GL_TRANSPOSE_TEXTURE_MATRIX : constant Enum := 16#84E5#; GL_TRANSPOSE_COLOR_MATRIX : constant Enum := 16#84E6#; GL_COMBINE : constant Enum := 16#8570#; GL_COMBINE_RGB : constant Enum := 16#8571#; GL_COMBINE_ALPHA : constant Enum := 16#8572#; GL_SOURCE0_RGB : constant Enum := 16#8580#; GL_SOURCE1_RGB : constant Enum := 16#8581#; GL_SOURCE2_RGB : constant Enum := 16#8582#; GL_SOURCE0_ALPHA : constant Enum := 16#8588#; GL_SOURCE1_ALPHA : constant Enum := 16#8589#; GL_SOURCE2_ALPHA : constant Enum := 16#858A#; GL_OPERAND0_RGB : constant Enum := 16#8590#; GL_OPERAND1_RGB : constant Enum := 16#8591#; GL_OPERAND2_RGB : constant Enum := 16#8592#; GL_OPERAND0_ALPHA : constant Enum := 16#8598#; GL_OPERAND1_ALPHA : constant Enum := 16#8599#; GL_OPERAND2_ALPHA : constant Enum := 16#859A#; GL_RGB_SCALE : constant Enum := 16#8573#; GL_ADD_SIGNED : constant Enum := 16#8574#; GL_INTERPOLATE : constant Enum := 16#8575#; GL_SUBTRACT : constant Enum := 16#84E7#; GL_CONSTANT : constant Enum := 16#8576#; GL_PRIMARY_COLOR : constant Enum := 16#8577#; GL_PREVIOUS : constant Enum := 16#8578#; GL_DOT3_RGB : constant Enum := 16#86AE#; GL_DOT3_RGBA : constant Enum := 16#86AF#; GL_CLAMP_TO_BORDER : constant Enum := 16#812D#; GL_ARB_multitexture : constant Enum := 1; GL_TEXTURE0_ARB : constant Enum := 16#84C0#; GL_TEXTURE1_ARB : constant Enum := 16#84C1#; GL_TEXTURE2_ARB : constant Enum := 16#84C2#; GL_TEXTURE3_ARB : constant Enum := 16#84C3#; GL_TEXTURE4_ARB : constant Enum := 16#84C4#; GL_TEXTURE5_ARB : constant Enum := 16#84C5#; GL_TEXTURE6_ARB : constant Enum := 16#84C6#; GL_TEXTURE7_ARB : constant Enum := 16#84C7#; GL_TEXTURE8_ARB : constant Enum := 16#84C8#; GL_TEXTURE9_ARB : constant Enum := 16#84C9#; GL_TEXTURE10_ARB : constant Enum := 16#84CA#; GL_TEXTURE11_ARB : constant Enum := 16#84CB#; GL_TEXTURE12_ARB : constant Enum := 16#84CC#; GL_TEXTURE13_ARB : constant Enum := 16#84CD#; GL_TEXTURE14_ARB : constant Enum := 16#84CE#; GL_TEXTURE15_ARB : constant Enum := 16#84CF#; GL_TEXTURE16_ARB : constant Enum := 16#84D0#; GL_TEXTURE17_ARB : constant Enum := 16#84D1#; GL_TEXTURE18_ARB : constant Enum := 16#84D2#; GL_TEXTURE19_ARB : constant Enum := 16#84D3#; GL_TEXTURE20_ARB : constant Enum := 16#84D4#; GL_TEXTURE21_ARB : constant Enum := 16#84D5#; GL_TEXTURE22_ARB : constant Enum := 16#84D6#; GL_TEXTURE23_ARB : constant Enum := 16#84D7#; GL_TEXTURE24_ARB : constant Enum := 16#84D8#; GL_TEXTURE25_ARB : constant Enum := 16#84D9#; GL_TEXTURE26_ARB : constant Enum := 16#84DA#; GL_TEXTURE27_ARB : constant Enum := 16#84DB#; GL_TEXTURE28_ARB : constant Enum := 16#84DC#; GL_TEXTURE29_ARB : constant Enum := 16#84DD#; GL_TEXTURE30_ARB : constant Enum := 16#84DE#; GL_TEXTURE31_ARB : constant Enum := 16#84DF#; GL_ACTIVE_TEXTURE_ARB : constant Enum := 16#84E0#; GL_CLIENT_ACTIVE_TEXTURE_ARB : constant Enum := 16#84E1#; GL_MAX_TEXTURE_UNITS_ARB : constant Enum := 16#84E2#; GL_TEXTURE_1D_ARRAY_EXT : constant Enum := 16#8C18#; GL_PROXY_TEXTURE_1D_ARRAY_EXT : constant Enum := 16#8C19#; GL_TEXTURE_2D_ARRAY_EXT : constant Enum := 16#8C1A#; GL_PROXY_TEXTURE_2D_ARRAY_EXT : constant Enum := 16#8C1B#; GL_TEXTURE_BINDING_1D_ARRAY_EXT : constant Enum := 16#8C1C#; GL_TEXTURE_BINDING_2D_ARRAY_EXT : constant Enum := 16#8C1D#; GL_POINT_SPRITE : constant Enum := 16#8861#; GL_COORD_REPLACE : constant Enum := 16#8862#; GL_MAX_ARRAY_TEXTURE_LAYERS_EXT : constant Enum := 16#88FF#; GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT : constant Enum := 16#8CD4#; GL_FRAMEBUFFER : constant Enum := 16#8D40#; GL_READ_FRAMEBUFFER : constant Enum := 16#8CA8#; GL_WRITE_FRAMEBUFFER : constant Enum := 16#8CA9#; GL_RENDERBUFFER : constant Enum := 16#8D41#; GL_ARRAY_BUFFER : constant Enum := 16#8892#; GL_ELEMENT_ARRAY_BUFFER : constant Enum := 16#8893#; GL_STATIC_DRAW : constant Enum := 16#88E4#; GL_DYNAMIC_DRAW : constant Enum := 16#88E8#; GL_VERTEX_SHADER : constant Enum := 16#8B31#; GL_FRAGMENT_SHADER : constant Enum := 16#8B30#; GL_DELETE_STATUS : constant Enum := 16#8B80#; GL_COMPILE_STATUS : constant Enum := 16#8B81#; GL_LINK_STATUS : constant Enum := 16#8B82#; GL_VALIDATE_STATUS : constant Enum := 16#8B83#; GL_INFO_LOG_LENGTH : constant Enum := 16#8B84#; -- Bitfield constants GL_CURRENT_BIT : constant Bitfield := 16#00001#; GL_POINT_BIT : constant Bitfield := 16#00002#; GL_LINE_BIT : constant Bitfield := 16#00004#; GL_POLYGON_BIT : constant Bitfield := 16#00008#; GL_POLYGON_STIPPLE_BIT : constant Bitfield := 16#00010#; GL_PIXEL_MODE_BIT : constant Bitfield := 16#00020#; GL_LIGHTING_BIT : constant Bitfield := 16#00040#; GL_FOG_BIT : constant Bitfield := 16#00080#; GL_DEPTH_BUFFER_BIT : constant Bitfield := 16#00100#; GL_ACCUM_BUFFER_BIT : constant Bitfield := 16#00200#; GL_STENCIL_BUFFER_BIT : constant Bitfield := 16#00400#; GL_VIEWPORT_BIT : constant Bitfield := 16#00800#; GL_TRANSFORM_BIT : constant Bitfield := 16#01000#; GL_ENABLE_BIT : constant Bitfield := 16#02000#; GL_COLOR_BUFFER_BIT : constant Bitfield := 16#04000#; GL_HINT_BIT : constant Bitfield := 16#08000#; GL_EVAL_BIT : constant Bitfield := 16#10000#; GL_LIST_BIT : constant Bitfield := 16#20000#; GL_TEXTURE_BIT : constant Bitfield := 16#40000#; GL_SCISSOR_BIT : constant Bitfield := 16#80000#; GL_ALL_ATTRIB_BITS : constant Bitfield := 16#FFFFF#; --------------------------------------------------------------------------- -- These two have pride of place in that they don't lose their "gl" prefix. -- That's because their "base" names are Ada keywords. procedure Begin_Primitive (Mode : in Enum); procedure End_Primitive; -- Misc function Get_Error return Enum; procedure Push_Attrib (Mask : in Bitfield); procedure Pop_Attrib; function Get_String (Name : Enum) return String; function Get_String (Name : Enum; Index : Int) return String; -- Pipeline control procedure Finish; procedure Flush; -- Server-side capabilities procedure Enable (Cap : in Enum); procedure Disable (Cap : in Enum); function Is_Enabled (Cap : in Enum) return Bool; procedure Hint (Target : Enum; Hint : Enum); -- Projections procedure Ortho (Left : in Double; Right : in Double; Bottom : in Double; Top : in Double; Near_Val : in Double; Far_Val : in Double); procedure Frustum (Left : in Double; Right : in Double; Bottom : in Double; Top : in Double; Near_Val : in Double; Far_Val : in Double); procedure Viewport (X : in Int; Y : in Int; Width : in SizeI; Height : in SizeI); -- Matrix mode procedure Matrix_Mode (Mode : in Enum); -- Matrix stacks procedure Push_Matrix; procedure Pop_Matrix; procedure Load_Identity; procedure Load_Matrix (M : in Float_Matrix); procedure Load_Matrix (M : in Double_Matrix); procedure Mult_Matrix (M : in Float_Matrix); procedure Mult_Matrix (M : in Double_Matrix); pragma Inline (Load_Matrix, Mult_Matrix); -- Clears procedure Clear_Index (C : in Float); procedure Clear_Color (Red : in ClampF; Green : in ClampF; Blue : in ClampF; Alpha : in ClampF); procedure Clear (Mask : in Bitfield); procedure Clear_Depth (Depth : in ClampD); procedure Clear_Accum (Red : in Float; Green : in Float; Blue : in Float; Alpha : in Float); -- Transformations procedure Rotate (Angle : in Double; X : in Double; Y : in Double; Z : in Double); procedure Rotate (Angle : in Float; X : in Float; Y : in Float; Z : in Float); procedure Scale (X : in Double; Y : in Double; Z : in Double); procedure Scale (X : in Float; Y : in Float; Z : in Float); procedure Translate (X : in Double; Y : in Double; Z : in Double); procedure Translate (X : in Float; Y : in Float; Z : in Float); pragma Inline (Scale, Translate); -- Alpha, stencil, and depth tests procedure Alpha_Func (Func : in Enum; Ref : in ClampF); procedure Depth_Func (Func : in Enum); procedure Stencil_Func (Func : in Enum; Ref : in Int; Mask : in UInt); -- Blending procedure Blend_Color (Red : in ClampF; Green : in ClampF; Blue : in ClampF; Alpha : in ClampF); procedure Blend_Equation (Mode : in Enum); procedure Blend_Func (S_Factor : in Enum; D_Factor : in Enum); -- Drawing parameters procedure Point_Size (Size : in Float); procedure Line_Width (Width : in Float); procedure Line_Stipple (Factor : in Int; Pattern : in UShort); procedure Polygon_Offset (Factor : in Float; Units : in Float); procedure Polygon_Stipple (Mask : in Pointer); procedure Polygon_Mode (Face : in Enum; Mode : in Enum); procedure Get_Polygon_Stipple (Mask : in Pointer); procedure Edge_Flag (Flag : in Bool); procedure Edge_Flagv (Flag : in Pointer); procedure Scissor (X : Int; Y : Int; Width : SizeI; Height : SizeI); -- Component color procedure Color (Red : in Byte; Green : in Byte; Blue : in Byte); procedure Color (Red : in Short; Green : in Short; Blue : in Short); procedure Color (Red : in Int; Green : in Int; Blue : in Int); procedure Color (Red : in Float; Green : in Float; Blue : in Float); procedure Color (Red : in Double; Green : in Double; Blue : in Double); procedure Color (Red : in UByte; Green : in UByte; Blue : in UByte); procedure Color (Red : in UShort; Green : in UShort; Blue : in UShort); procedure Color (Red : in UInt; Green : in UInt; Blue : in UInt); procedure Color (Red : in Byte; Green : in Byte; Blue : in Byte; Alpha : in Byte); procedure Color (Red : in Short; Green : in Short; Blue : in Short; Alpha : in Short); procedure Color (Red : in Int; Green : in Int; Blue : in Int; Alpha : in Int); procedure Color (Red : in Float; Green : in Float; Blue : in Float; Alpha : in Float); procedure Color (Red : in Double; Green : in Double; Blue : in Double; Alpha : in Double); procedure Color (Red : in UByte; Green : in UByte; Blue : in UByte; Alpha : in UByte); procedure Color (Red : in UShort; Green : in UShort; Blue : in UShort; Alpha : in UShort); procedure Color (Red : in UInt; Green : in UInt; Blue : in UInt; Alpha : in UInt); procedure Color (V : in Bytes_3); procedure Color (V : in Bytes_4); procedure Color (V : in Shorts_3); procedure Color (V : in Shorts_4); procedure Color (V : in Ints_3); procedure Color (V : in Ints_4); procedure Color (V : in Floats_3); procedure Color (V : in Floats_4); procedure Color (V : in Doubles_3); procedure Color (V : in Doubles_4); procedure Color (V : in UBytes_3); procedure Color (V : in UBytes_4); procedure Color (V : in UShorts_3); procedure Color (V : in UShorts_4); procedure Color (V : in UInts_3); procedure Color (V : in UInts_4); pragma Inline (Color); -- Lighting and materials type Int_Params is array (1 .. 4) of Int; type Float_Params is array (1 .. 4) of Float; procedure Light (Light : in Enum; PName : in Enum; Params : in Int_Params); procedure Light (Light : in Enum; PName : in Enum; Params : in Float_Params); procedure Material (Face : in Enum; PName : in Enum; Params : in Int_Params); procedure Material (Face : in Enum; PName : in Enum; Params : in Float_Params); procedure Front_Face (Mode : in Enum); procedure Cull_Face (Mode : in Enum); procedure Shade_Model (Mode : in Enum); pragma Inline (Light, Material); -- Lighting procedure Light (Light : in Enum; PName : in Enum; Param : in Float); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_1); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_3); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_4); procedure Light (Light : in Enum; PName : in Enum; Param : in Int); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_1); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_3); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_4); pragma Inline (Light); -- Normal Vector procedure Normal (X, Y, Z : Byte); procedure Normal (X, Y, Z : Double); procedure Normal (X, Y, Z : Float); procedure Normal (X, Y, Z : Int); procedure Normal (X, Y, Z : Short); procedure Normal (V : Bytes_3); procedure Normal (V : Doubles_3); procedure Normal (V : Floats_3); procedure Normal (V : Ints_3); procedure Normal (V : Shorts_3); pragma Inline (Normal); -- Texturing procedure Active_Texture (Texture : in Enum); -- v1.3 procedure Bind_Texture (Target : in Enum; Texture : in UInt); procedure Gen_Textures (N : in SizeI; Textures : in Pointer); procedure Delete_Textures (N : in SizeI; Textures : in Pointer); procedure Tex_Env (Coord : in Enum; PName : in Enum; Param : in Enum); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Int); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Float); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Double); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Enum); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Int); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Float); pragma Inline (Tex_Parameter); -- Texture images procedure Tex_Image (Target : in Enum; Level : in Int; Internal_Format : in Enum; Width : in SizeI; Border : in Int; Format : in Enum; Pixel_Type : in Enum; Pixels : in Pointer); procedure Tex_Image (Target : in Enum; Level : in Int; Internal_Format : in Enum; Width : in SizeI; Height : in SizeI; Border : in Int; Format : in Enum; Pixel_Type : in Enum; Pixels : in Pointer); procedure Tex_Sub_Image (Target : in Enum; Level : in Int; X_Offset : in Int; Y_Offset : in Int; Width : in SizeI; Height : in SizeI; Format : in Enum; Pixel_Type : in Enum; Pixels : in GL.Pointer); -- procedure Tex_Image (Target : in Enum; -- Level : in Int; -- Internal_Format : in Int; -- Width : in SizeI; -- Height : in SizeI; -- Depth : in SizeI; -- Border : in Int; -- Format : in Enum; -- Pixel_Type : in Enum; -- Pixels : in Pointer); pragma Inline (Tex_Image); -- Texture coordinates procedure Tex_Coord (S : in Short); procedure Tex_Coord (S : in Int); procedure Tex_Coord (S : in Float); procedure Tex_Coord (S : in Double); procedure Tex_Coord (S : in Short; T : in Short); procedure Tex_Coord (S : in Int; T : in Int); procedure Tex_Coord (S : in Float; T : in Float); procedure Tex_Coord (S : in Double; T : in Double); procedure Tex_Coord (S : in Short; T : in Short; R : in Short); procedure Tex_Coord (S : in Int; T : in Int; R : in Int); procedure Tex_Coord (S : in Float; T : in Float; R : in Float); procedure Tex_Coord (S : in Double; T : in Double; R : in Double); procedure Tex_Coord (S : in Short; T : in Short; R : in Short; Q : in Short); procedure Tex_Coord (S : in Int; T : in Int; R : in Int; Q : in Int); procedure Tex_Coord (S : in Float; T : in Float; R : in Float; Q : in Float); procedure Tex_Coord (S : in Double; T : in Double; R : in Double; Q : in Double); procedure Tex_Coord (V : in Shorts_1); procedure Tex_Coord (V : in Shorts_2); procedure Tex_Coord (V : in Shorts_3); procedure Tex_Coord (V : in Shorts_4); procedure Tex_Coord (V : in Ints_1); procedure Tex_Coord (V : in Ints_2); procedure Tex_Coord (V : in Ints_3); procedure Tex_Coord (V : in Ints_4); procedure Tex_Coord (V : in Floats_1); procedure Tex_Coord (V : in Floats_2); procedure Tex_Coord (V : in Floats_3); procedure Tex_Coord (V : in Floats_4); procedure Tex_Coord (V : in Doubles_1); procedure Tex_Coord (V : in Doubles_2); procedure Tex_Coord (V : in Doubles_3); procedure Tex_Coord (V : in Doubles_4); pragma Inline (Tex_Coord); procedure Tex_Coord_Pointer (Size : in SizeI; Type_Of : in Enum; Stride : in SizeI; Offset : in SizeI); -- Get texture data procedure Get_Tex_Image (Target : in Enum; Level : in Int; Format : in Enum; Type_Of : in Enum; Pixels : in Pointer); -- Evaluators procedure Map (Target : in Enum; U1 : in Float; U2 : in Float; Stride : in Int; Order : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Double; U2 : in Double; Stride : in Int; Order : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Float; U2 : in Float; UStride : in Int; UOrder : in Int; V1 : in Float; V2 : in Float; VStride : in Int; VOrder : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Double; U2 : in Double; UStride : in Int; UOrder : in Int; V1 : in Double; V2 : in Double; VStride : in Int; VOrder : in Int; Points : in System.Address); pragma Inline (Map); procedure Map_Grid (Un : in Int; U1 : in Float; U2 : in Float); procedure Map_Grid (Un : in Int; U1 : in Double; U2 : in Double); procedure Map_Grid (Un : in Int; U1 : in Float; U2 : in Float; Vn : in Int; V1 : in Float; V2 : in Float); procedure Map_Grid (Un : in Int; U1 : in Double; U2 : in Double; Vn : in Int; V1 : in Double; V2 : in Double); pragma Inline (Map_Grid); procedure Eval_Point (I : Int); procedure Eval_Point (I : in Int; J : in Int); pragma Inline (Eval_Point); procedure Eval_Mesh (Mode : in Enum; I1 : in Int; I2 : in Int); procedure Eval_Mesh (Mode : in Enum; I1 : in Int; I2 : in Int; J1 : in Int; J2 : in Int); pragma Inline (Eval_Mesh); -- Specify vertices procedure Vertex (X : in Short; Y : in Short); procedure Vertex (X : in Int; Y : in Int); procedure Vertex (X : in Float; Y : in Float); procedure Vertex (X : in Double; Y : in Double); procedure Vertex (X : in Short; Y : in Short; Z : in Short); procedure Vertex (X : in Int; Y : in Int; Z : in Int); procedure Vertex (X : in Float; Y : in Float; Z : in Float); procedure Vertex (X : in Double; Y : in Double; Z : in Double); procedure Vertex (X : in Short; Y : in Short; Z : in Short; W : in Short); procedure Vertex (X : in Int; Y : in Int; Z : in Int; W : in Int); procedure Vertex (X : in Float; Y : in Float; Z : in Float; W : in Float); procedure Vertex (X : in Double; Y : in Double; Z : in Double; W : in Double); procedure Vertex (V : in Shorts_2); procedure Vertex (V : in Shorts_3); procedure Vertex (V : in Shorts_4); procedure Vertex (V : in Ints_2); procedure Vertex (V : in Ints_3); procedure Vertex (V : in Ints_4); procedure Vertex (V : in Floats_2); procedure Vertex (V : in Floats_3); procedure Vertex (V : in Floats_4); procedure Vertex (V : in Doubles_2); procedure Vertex (V : in Doubles_3); procedure Vertex (V : in Doubles_4); pragma Inline (Vertex); -- Buffer objects v2.1??? procedure Gen_Framebuffers (N : in SizeI; FBOs : in Pointer); procedure Bind_Framebuffer (Target : in Enum; FBO : in UInt); -- Vertex buffer stuff: procedure Gen_Buffers (N : in SizeI; VBO : in Pointer); procedure Delete_Buffers (N : in SizeI; Buffers : in Pointer); procedure Bind_Buffer (Target : in Enum; VBO : in UInt); procedure Buffer_Data (Target : in Enum; Size : in SizeI; Data : in Pointer; Usage : in Enum); procedure Buffer_Sub_Data (Target: in Enum; Offset: in SizeI; Size : in SizeI; Data : in Pointer); procedure Enable_Client_State (Target : in Enum); procedure Disable_Client_State (Target : in Enum); procedure Vertex_Pointer (Size : in SizeI; Element_Type : in Enum; Stride : in SizeI; Data_Pointer : Pointer); procedure Vertex_Pointer (Size : in SizeI; Element_Type : in Enum; Stride : in SizeI; Offset : in SizeI); procedure Draw_Arrays (Mode : in Enum; First : in Int; Count : in SizeI); procedure Draw_Elements (Mode : in Enum; Count : in SizeI; Index_Type : in Enum; Indices : in Pointer); procedure Enable_Vertex_Attrib_Array (Index : in UInt); procedure Disable_Vertex_Attrib_Array (Index : in UInt); procedure Vertex_Attrib_Pointer (Index : in UInt; Size : in Int; Attr_Type : in Enum; Normalized : in Bool; Stride : in SizeI; Data_Pointer : in Pointer); -- Vertex array objects procedure Gen_Vertex_Arrays (N : in SizeI; VAOs : in Pointer); procedure Bind_Vertex_Array (VAO : in UInt); -- Shaders function Create_Shader (Shader_Type : in Enum) return UInt; procedure Delete_Shader (Shader_ID : in UInt); procedure Shader_Source (Shader : in UInt; Count : in SizeI; Source_String : in Pointer; Length : in Pointer); procedure Compile_Shader (Shader : in UInt); procedure Attach_Shader (Program : in UInt; Shader : in UInt); procedure Link_Program (Program : in UInt); procedure Use_Program (Program : in UInt); function Create_Program return UInt; procedure Get_Shader (Shader : in UInt; PName : in Enum; Params : in Pointer); procedure Get_Shader_Info_Log (Shader : in UInt; MaxLength : in SizeI; Length : in Pointer; InfoLog : in Pointer); procedure Get_Program (Program : in UInt; PName : in Enum; Params : in Pointer); procedure Get_Program_Info_Log (Progarm : in UInt; MaxLength : in SizeI; Length : in Pointer; InfoLog : in Pointer); procedure Validate_Program (Program : in GL.UInt); function Get_Uniform_Location (Program : in UInt; Name : in String) return Int; procedure Uniform (Location : in Int; V0 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float; V2 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float; V2 : in Float; V3 : in Float); procedure Uniform (Location : in Int; V0 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int; V2 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int; V2 : in Int; V3 : in Int); procedure Uniform (Location : in Int; V0 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt; V2 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt; V2 : in UInt; V3 : in UInt); procedure Uniform (Location : in Int; Count : in SizeI; Transpose : in Bool; Value : in Float_Matrix); function Get_Attribute_Location (Program : in UInt; Name : in String) return Int; procedure Vertex_Attrib (Index : in UInt; X : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float; Z : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float; Z : in Float; W : in Float); pragma Inline (Vertex_Attrib); procedure Get_Double (Pname : in Enum; Params : out Double_Matrix); pragma Inline (Get_Double); procedure Read_Pixels (X : in Int; Y : in Int; Width : in SizeI; Height : in SizeI; Format : in Enum; C_Type : in Enum; Pixels : in Pointer); --------------------------------------------------------------------------- private -- These can be bound directly pragma Import (StdCall, Active_Texture, "glActiveTexture"); pragma Import (StdCall, Alpha_Func, "glAlphaFunc"); pragma Import (StdCall, Attach_Shader, "glAttachShader"); pragma Import (StdCall, Begin_Primitive, "glBegin"); pragma Import (StdCall, Bind_Buffer, "glBindBuffer"); pragma Import (StdCall, Bind_Framebuffer, "glBindFramebuffer"); pragma Import (StdCall, Bind_Texture, "glBindTexture"); pragma Import (StdCall, Bind_Vertex_Array, "glBindVertexArray"); pragma Import (StdCall, Blend_Color, "glBlendColor"); pragma Import (StdCall, Blend_Equation, "glBlendEquation"); pragma Import (StdCall, Blend_Func, "glBlendFunc"); pragma Import (StdCall, Buffer_Data, "glBufferData"); pragma Import (StdCall, Clear, "glClear"); pragma Import (StdCall, Clear_Accum, "glClearAccum"); pragma Import (StdCall, Clear_Color, "glClearColor"); pragma Import (StdCall, Clear_Depth, "glClearDepth"); pragma Import (StdCall, Clear_Index, "glClearIndex"); pragma Import (StdCall, Compile_Shader, "glCompileShader"); pragma Import (StdCall, Create_Program, "glCreateProgram"); pragma Import (StdCall, Create_Shader, "glCreateShader"); pragma Import (StdCall, Cull_Face, "glCullFace"); pragma Import (StdCall, Delete_Shader, "glDeleteShader"); pragma Import (StdCall, Depth_Func, "glDepthFunc"); pragma Import (StdCall, Disable, "glDisable"); pragma Import (StdCall, Disable_Vertex_Attrib_Array, "glDisableVertexAttribArray"); pragma Import (StdCall, Draw_Arrays, "glDrawArrays"); pragma Import (StdCall, Draw_Elements, "glDrawElements"); pragma Import (StdCall, Edge_Flag, "glEdgeFlag"); pragma Import (StdCall, Edge_Flagv, "glEdgeFlagv"); pragma Import (StdCall, Enable, "glEnable"); pragma Import (StdCall, Enable_Client_State, "glEnableClientState"); pragma Import (StdCall, Enable_Vertex_Attrib_Array, "glEnableVertexAttribArray"); pragma Import (StdCall, End_Primitive, "glEnd"); pragma Import (StdCall, Finish, "glFinish"); pragma Import (StdCall, Flush, "glFlush"); pragma Import (StdCall, Front_Face, "glFrontFace"); pragma Import (StdCall, Frustum, "glFrustum"); pragma Import (StdCall, Gen_Buffers, "glGenBuffers"); pragma Import (StdCall, Gen_Framebuffers, "glGenFramebuffers"); pragma Import (StdCall, Gen_Textures, "glGenTextures"); pragma Import (StdCall, Get_Tex_Image, "glGetTexImage"); pragma Import (StdCall, Delete_Textures, "glDeleteTextures"); pragma Import (StdCall, Gen_Vertex_Arrays, "glGenVertexArrays"); pragma Import (StdCall, Get_Error, "glGetError"); pragma Import (StdCall, Get_Polygon_Stipple, "glGetPolygonStipple"); pragma Import (StdCall, Get_Shader, "glGetShaderiv"); pragma Import (StdCall, Get_Shader_Info_Log, "glGetShaderInfoLog"); pragma Import (StdCall, Hint, "glHint"); pragma Import (StdCall, Is_Enabled, "glIsEnabled"); pragma Import (StdCall, Line_Stipple, "glLineStipple"); pragma Import (StdCall, Line_Width, "glLineWidth"); pragma Import (StdCall, Link_Program, "glLinkProgram"); pragma Import (StdCall, Load_Identity, "glLoadIdentity"); pragma Import (StdCall, Matrix_Mode, "glMatrixMode"); pragma Import (StdCall, Ortho, "glOrtho"); pragma Import (StdCall, Point_Size, "glPointSize"); pragma Import (StdCall, Polygon_Mode, "glPolygonMode"); pragma Import (StdCall, Polygon_Offset, "glPolygonOffset"); pragma Import (StdCall, Polygon_Stipple, "glPolygonStipple"); pragma Import (StdCall, Pop_Attrib, "glPopAttrib"); pragma Import (StdCall, Pop_Matrix, "glPopMatrix"); pragma Import (StdCall, Push_Attrib, "glPushAttrib"); pragma Import (StdCall, Push_Matrix, "glPushMatrix"); pragma Import (StdCall, Scissor, "glScissor"); pragma Import (StdCall, Shade_Model, "glShadeModel"); pragma Import (StdCall, Shader_Source, "glShaderSource"); pragma Import (StdCall, Stencil_Func, "glStencilFunc"); pragma Import (StdCall, Tex_Env, "glTexEnvi"); pragma Import (StdCall, Use_Program, "glUseProgram"); pragma Import (StdCall, Vertex_Attrib_Pointer, "glVertexAttribPointer"); pragma Import (StdCall, Viewport, "glViewport"); pragma Import (StdCall, Delete_Buffers, "glDeleteBuffers"); pragma Import (StdCall, Buffer_Sub_Data, "glBufferSubData"); pragma Import (StdCall, Disable_Client_State, "glDisableClientState"); pragma Import (StdCall, Tex_Coord_Pointer, "glTexCoordPointer"); pragma Import (StdCall, Get_Program, "glGetProgramiv"); pragma Import (StdCall, Get_Program_Info_Log, "glGetProgramInfoLog"); pragma Import (StdCall, Validate_Program, "glValidateProgram"); pragma Import (StdCall, Read_Pixels, "glReadPixels"); end Lumen.GL;
true
-- Lumen.GL -- Lumen's own thin OpenGL bindings -- -- PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI, Phoenix AZ, Summer 2010 -- This code is covered by the ISC License: -- -- Copyright © 2010, PI:NAME:<NAME>END_PI -- -- 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. -- Environment with System; with Lumen.Binary; package Lumen.GL is --------------------------------------------------------------------------- -- New names for old types subtype Bitfield is Binary.Word; subtype Bool is Binary.Byte; subtype Byte is Binary.S_Byte; subtype ClampD is Long_Float range 0.0 .. 1.0; subtype ClampF is Float range 0.0 .. 1.0; subtype Double is Long_Float; subtype Int is Integer; subtype Short is Short_Integer; subtype SizeI is Integer; subtype UByte is Binary.Byte; subtype UInt is Binary.Word; subtype UShort is Binary.Short; subtype Pointer is System.Address; -- Try to bring a touch of order to the GLenum mess subtype Enum is Binary.Word; -- Types added by Lumen.GL type Bytes_1 is array (1 .. 1) of Byte; type Bytes_2 is array (1 .. 2) of Byte; type Bytes_3 is array (1 .. 3) of Byte; type Bytes_4 is array (1 .. 4) of Byte; type Shorts_1 is array (1 .. 1) of Short; type Shorts_2 is array (1 .. 2) of Short; type Shorts_3 is array (1 .. 3) of Short; type Shorts_4 is array (1 .. 4) of Short; type Ints_1 is array (1 .. 1) of Int; type Ints_2 is array (1 .. 2) of Int; type Ints_3 is array (1 .. 3) of Int; type Ints_4 is array (1 .. 4) of Int; type Floats_1 is array (1 .. 1) of Float; type Floats_2 is array (1 .. 2) of Float; type Floats_3 is array (1 .. 3) of Float; type Floats_4 is array (1 .. 4) of Float; type Doubles_1 is array (1 .. 1) of Double; type Doubles_2 is array (1 .. 2) of Double; type Doubles_3 is array (1 .. 3) of Double; type Doubles_4 is array (1 .. 4) of Double; type UBytes_1 is array (1 .. 1) of UByte; type UBytes_2 is array (1 .. 2) of UByte; type UBytes_3 is array (1 .. 3) of UByte; type UBytes_4 is array (1 .. 4) of UByte; type UShorts_1 is array (1 .. 1) of UShort; type UShorts_2 is array (1 .. 2) of UShort; type UShorts_3 is array (1 .. 3) of UShort; type UShorts_4 is array (1 .. 4) of UShort; type UInts_1 is array (1 .. 1) of UInt; type UInts_2 is array (1 .. 2) of UInt; type UInts_3 is array (1 .. 3) of UInt; type UInts_4 is array (1 .. 4) of UInt; type Float_Matrix is array (1 .. 4, 1 .. 4) of Float; type Double_Matrix is array (1 .. 4, 1 .. 4) of Double; -- Useful value Null_Pointer : Pointer := System.Null_Address; -- "Enumeration" constants GL_FALSE : constant Bool := 16#0#; GL_TRUE : constant Bool := 16#1#; GL_VERSION_1_1 : constant Enum := 1; GL_VERSION_1_2 : constant Enum := 1; GL_VERSION_1_3 : constant Enum := 1; GL_ARB_imaging : constant Enum := 1; GL_BYTE : constant Enum := 16#1400#; GL_UNSIGNED_BYTE : constant Enum := 16#1401#; GL_SHORT : constant Enum := 16#1402#; GL_UNSIGNED_SHORT : constant Enum := 16#1403#; GL_INT : constant Enum := 16#1404#; GL_UNSIGNED_INT : constant Enum := 16#1405#; GL_FLOAT : constant Enum := 16#1406#; GL_2_BYTES : constant Enum := 16#1407#; GL_3_BYTES : constant Enum := 16#1408#; GL_4_BYTES : constant Enum := 16#1409#; GL_DOUBLE : constant Enum := 16#140A#; GL_POINTS : constant Enum := 16#0#; GL_LINES : constant Enum := 16#1#; GL_LINE_LOOP : constant Enum := 16#2#; GL_LINE_STRIP : constant Enum := 16#3#; GL_TRIANGLES : constant Enum := 16#4#; GL_TRIANGLE_STRIP : constant Enum := 16#5#; GL_TRIANGLE_FAN : constant Enum := 16#6#; GL_QUADS : constant Enum := 16#7#; GL_QUAD_STRIP : constant Enum := 16#8#; GL_POLYGON : constant Enum := 16#9#; GL_VERTEX_ARRAY : constant Enum := 16#8074#; GL_NORMAL_ARRAY : constant Enum := 16#8075#; GL_COLOR_ARRAY : constant Enum := 16#8076#; GL_INDEX_ARRAY : constant Enum := 16#8077#; GL_TEXTURE_COORD_ARRAY : constant Enum := 16#8078#; GL_EDGE_FLAG_ARRAY : constant Enum := 16#8079#; GL_VERTEX_ARRAY_SIZE : constant Enum := 16#807A#; GL_VERTEX_ARRAY_TYPE : constant Enum := 16#807B#; GL_VERTEX_ARRAY_STRIDE : constant Enum := 16#807C#; GL_NORMAL_ARRAY_TYPE : constant Enum := 16#807E#; GL_NORMAL_ARRAY_STRIDE : constant Enum := 16#807F#; GL_COLOR_ARRAY_SIZE : constant Enum := 16#8081#; GL_COLOR_ARRAY_TYPE : constant Enum := 16#8082#; GL_COLOR_ARRAY_STRIDE : constant Enum := 16#8083#; GL_INDEX_ARRAY_TYPE : constant Enum := 16#8085#; GL_INDEX_ARRAY_STRIDE : constant Enum := 16#8086#; GL_TEXTURE_COORD_ARRAY_SIZE : constant Enum := 16#8088#; GL_TEXTURE_COORD_ARRAY_TYPE : constant Enum := 16#8089#; GL_TEXTURE_COORD_ARRAY_STRIDE : constant Enum := 16#808A#; GL_EDGE_FLAG_ARRAY_STRIDE : constant Enum := 16#808C#; GL_VERTEX_ARRAY_POINTER : constant Enum := 16#808E#; GL_NORMAL_ARRAY_POINTER : constant Enum := 16#808F#; GL_COLOR_ARRAY_POINTER : constant Enum := 16#8090#; GL_INDEX_ARRAY_POINTER : constant Enum := 16#8091#; GL_TEXTURE_COORD_ARRAY_POINTER : constant Enum := 16#8092#; GL_EDGE_FLAG_ARRAY_POINTER : constant Enum := 16#8093#; GL_V2F : constant Enum := 16#2A20#; GL_V3F : constant Enum := 16#2A21#; GL_C4UB_V2F : constant Enum := 16#2A22#; GL_C4UB_V3F : constant Enum := 16#2A23#; GL_C3F_V3F : constant Enum := 16#2A24#; GL_N3F_V3F : constant Enum := 16#2A25#; GL_C4F_N3F_V3F : constant Enum := 16#2A26#; GL_T2F_V3F : constant Enum := 16#2A27#; GL_T4F_V4F : constant Enum := 16#2A28#; GL_T2F_C4UB_V3F : constant Enum := 16#2A29#; GL_T2F_C3F_V3F : constant Enum := 16#2A2A#; GL_T2F_N3F_V3F : constant Enum := 16#2A2B#; GL_T2F_C4F_N3F_V3F : constant Enum := 16#2A2C#; GL_T4F_C4F_N3F_V4F : constant Enum := 16#2A2D#; GL_MATRIX_MODE : constant Enum := 16#BA0#; GL_MODELVIEW : constant Enum := 16#1700#; GL_PROJECTION : constant Enum := 16#1701#; GL_TEXTURE : constant Enum := 16#1702#; GL_POINT_SMOOTH : constant Enum := 16#B10#; GL_POINT_SIZE : constant Enum := 16#B11#; GL_POINT_SIZE_GRANULARITY : constant Enum := 16#B13#; GL_POINT_SIZE_RANGE : constant Enum := 16#B12#; GL_LINE_SMOOTH : constant Enum := 16#B20#; GL_LINE_STIPPLE : constant Enum := 16#B24#; GL_LINE_STIPPLE_PATTERN : constant Enum := 16#B25#; GL_LINE_STIPPLE_REPEAT : constant Enum := 16#B26#; GL_LINE_WIDTH : constant Enum := 16#B21#; GL_LINE_WIDTH_GRANULARITY : constant Enum := 16#B23#; GL_LINE_WIDTH_RANGE : constant Enum := 16#B22#; GL_POINT : constant Enum := 16#1B00#; GL_LINE : constant Enum := 16#1B01#; GL_FILL : constant Enum := 16#1B02#; GL_CW : constant Enum := 16#900#; GL_CCW : constant Enum := 16#901#; GL_FRONT : constant Enum := 16#404#; GL_BACK : constant Enum := 16#405#; GL_POLYGON_MODE : constant Enum := 16#B40#; GL_POLYGON_SMOOTH : constant Enum := 16#B41#; GL_POLYGON_STIPPLE : constant Enum := 16#B42#; GL_EDGE_FLAG : constant Enum := 16#B43#; GL_CULL_FACE : constant Enum := 16#B44#; GL_CULL_FACE_MODE : constant Enum := 16#B45#; GL_FRONT_FACE : constant Enum := 16#B46#; GL_POLYGON_OFFSET_FACTOR : constant Enum := 16#8038#; GL_POLYGON_OFFSET_UNITS : constant Enum := 16#2A00#; GL_POLYGON_OFFSET_POINT : constant Enum := 16#2A01#; GL_POLYGON_OFFSET_LINE : constant Enum := 16#2A02#; GL_POLYGON_OFFSET_FILL : constant Enum := 16#8037#; GL_COMPILE : constant Enum := 16#1300#; GL_COMPILE_AND_EXECUTE : constant Enum := 16#1301#; GL_LIST_BASE : constant Enum := 16#B32#; GL_LIST_INDEX : constant Enum := 16#B33#; GL_LIST_MODE : constant Enum := 16#B30#; GL_NEVER : constant Enum := 16#200#; GL_LESS : constant Enum := 16#201#; GL_EQUAL : constant Enum := 16#202#; GL_LEQUAL : constant Enum := 16#203#; GL_GREATER : constant Enum := 16#204#; GL_NOTEQUAL : constant Enum := 16#205#; GL_GEQUAL : constant Enum := 16#206#; GL_ALWAYS : constant Enum := 16#207#; GL_DEPTH_TEST : constant Enum := 16#B71#; GL_DEPTH_BITS : constant Enum := 16#D56#; GL_DEPTH_CLEAR_VALUE : constant Enum := 16#B73#; GL_DEPTH_FUNC : constant Enum := 16#B74#; GL_DEPTH_RANGE : constant Enum := 16#B70#; GL_DEPTH_WRITEMASK : constant Enum := 16#B72#; GL_DEPTH_COMPONENT : constant Enum := 16#1902#; GL_LIGHTING : constant Enum := 16#B50#; GL_LIGHT0 : constant Enum := 16#4000#; GL_LIGHT1 : constant Enum := 16#4001#; GL_LIGHT2 : constant Enum := 16#4002#; GL_LIGHT3 : constant Enum := 16#4003#; GL_LIGHT4 : constant Enum := 16#4004#; GL_LIGHT5 : constant Enum := 16#4005#; GL_LIGHT6 : constant Enum := 16#4006#; GL_LIGHT7 : constant Enum := 16#4007#; GL_SPOT_EXPONENT : constant Enum := 16#1205#; GL_SPOT_CUTOFF : constant Enum := 16#1206#; GL_CONSTANT_ATTENUATION : constant Enum := 16#1207#; GL_LINEAR_ATTENUATION : constant Enum := 16#1208#; GL_QUADRATIC_ATTENUATION : constant Enum := 16#1209#; GL_AMBIENT : constant Enum := 16#1200#; GL_DIFFUSE : constant Enum := 16#1201#; GL_SPECULAR : constant Enum := 16#1202#; GL_SHININESS : constant Enum := 16#1601#; GL_EMISSION : constant Enum := 16#1600#; GL_POSITION : constant Enum := 16#1203#; GL_SPOT_DIRECTION : constant Enum := 16#1204#; GL_AMBIENT_AND_DIFFUSE : constant Enum := 16#1602#; GL_COLOR_INDEXES : constant Enum := 16#1603#; GL_LIGHT_MODEL_TWO_SIDE : constant Enum := 16#B52#; GL_LIGHT_MODEL_LOCAL_VIEWER : constant Enum := 16#B51#; GL_LIGHT_MODEL_AMBIENT : constant Enum := 16#B53#; GL_FRONT_AND_BACK : constant Enum := 16#408#; GL_SHADE_MODEL : constant Enum := 16#B54#; GL_FLAT : constant Enum := 16#1D00#; GL_SMOOTH : constant Enum := 16#1D01#; GL_COLOR_MATERIAL : constant Enum := 16#B57#; GL_COLOR_MATERIAL_FACE : constant Enum := 16#B55#; GL_COLOR_MATERIAL_PARAMETER : constant Enum := 16#B56#; GL_NORMALIZE : constant Enum := 16#BA1#; GL_CLIP_PLANE0 : constant Enum := 16#3000#; GL_CLIP_PLANE1 : constant Enum := 16#3001#; GL_CLIP_PLANE2 : constant Enum := 16#3002#; GL_CLIP_PLANE3 : constant Enum := 16#3003#; GL_CLIP_PLANE4 : constant Enum := 16#3004#; GL_CLIP_PLANE5 : constant Enum := 16#3005#; GL_ACCUM_RED_BITS : constant Enum := 16#D58#; GL_ACCUM_GREEN_BITS : constant Enum := 16#D59#; GL_ACCUM_BLUE_BITS : constant Enum := 16#D5A#; GL_ACCUM_ALPHA_BITS : constant Enum := 16#D5B#; GL_ACCUM_CLEAR_VALUE : constant Enum := 16#B80#; GL_ACCUM : constant Enum := 16#100#; GL_ADD : constant Enum := 16#104#; GL_LOAD : constant Enum := 16#101#; GL_MULT : constant Enum := 16#103#; GL_RETURN : constant Enum := 16#102#; GL_ALPHA_TEST : constant Enum := 16#BC0#; GL_ALPHA_TEST_REF : constant Enum := 16#BC2#; GL_ALPHA_TEST_FUNC : constant Enum := 16#BC1#; GL_BLEND : constant Enum := 16#BE2#; GL_BLEND_SRC : constant Enum := 16#BE1#; GL_BLEND_DST : constant Enum := 16#BE0#; GL_ZERO : constant Enum := 16#0#; GL_ONE : constant Enum := 16#1#; GL_SRC_COLOR : constant Enum := 16#300#; GL_ONE_MINUS_SRC_COLOR : constant Enum := 16#301#; GL_SRC_ALPHA : constant Enum := 16#302#; GL_ONE_MINUS_SRC_ALPHA : constant Enum := 16#303#; GL_DST_ALPHA : constant Enum := 16#304#; GL_ONE_MINUS_DST_ALPHA : constant Enum := 16#305#; GL_DST_COLOR : constant Enum := 16#306#; GL_ONE_MINUS_DST_COLOR : constant Enum := 16#307#; GL_SRC_ALPHA_SATURATE : constant Enum := 16#308#; GL_FEEDBACK : constant Enum := 16#1C01#; GL_RENDER : constant Enum := 16#1C00#; GL_SELECT : constant Enum := 16#1C02#; GL_2D : constant Enum := 16#600#; GL_3D : constant Enum := 16#601#; GL_3D_COLOR : constant Enum := 16#602#; GL_3D_COLOR_TEXTURE : constant Enum := 16#603#; GL_4D_COLOR_TEXTURE : constant Enum := 16#604#; GL_POINT_TOKEN : constant Enum := 16#701#; GL_LINE_TOKEN : constant Enum := 16#7PI:PASSWORD:<PASSWORD>END_PI#; GL_LINE_RESET_TOKEN : constant Enum := 16#707#; GL_POLYGON_TOKEN : constant Enum := 16#703#; GL_BITMAP_TOKEN : constant Enum := 16#PI:PASSWORD:<PASSWORD>END_PI#; GL_DRAW_PIXEL_TOKEN : constant Enum := 16#705#; GL_COPY_PIXEL_TOKEN : constant Enum := 16#706#; GL_PASS_THROUGH_TOKEN : constant Enum := 16#700#; GL_FEEDBACK_BUFFER_POINTER : constant Enum := 16#DF0#; GL_FEEDBACK_BUFFER_SIZE : constant Enum := 16#DF1#; GL_FEEDBACK_BUFFER_TYPE : constant Enum := 16#DF2#; GL_SELECTION_BUFFER_POINTER : constant Enum := 16#DF3#; GL_SELECTION_BUFFER_SIZE : constant Enum := 16#DF4#; GL_FOG : constant Enum := 16#B60#; GL_FOG_MODE : constant Enum := 16#B65#; GL_FOG_DENSITY : constant Enum := 16#B62#; GL_FOG_COLOR : constant Enum := 16#B66#; GL_FOG_INDEX : constant Enum := 16#B61#; GL_FOG_START : constant Enum := 16#B63#; GL_FOG_END : constant Enum := 16#B64#; GL_LINEAR : constant Enum := 16#2601#; GL_EXP : constant Enum := 16#800#; GL_EXP2 : constant Enum := 16#801#; GL_LOGIC_OP : constant Enum := 16#BF1#; GL_INDEX_LOGIC_OP : constant Enum := 16#BF1#; GL_COLOR_LOGIC_OP : constant Enum := 16#BF2#; GL_LOGIC_OP_MODE : constant Enum := 16#BF0#; GL_CLEAR : constant Enum := 16#1500#; GL_SET : constant Enum := 16#150F#; GL_COPY : constant Enum := 16#1503#; GL_COPY_INVERTED : constant Enum := 16#150C#; GL_NOOP : constant Enum := 16#1505#; GL_INVERT : constant Enum := 16#150A#; GL_AND : constant Enum := 16#1501#; GL_NAND : constant Enum := 16#150E#; GL_OR : constant Enum := 16#1507#; GL_NOR : constant Enum := 16#1508#; GL_XOR : constant Enum := 16#1506#; GL_EQUIV : constant Enum := 16#1509#; GL_AND_REVERSE : constant Enum := 16#1502#; GL_AND_INVERTED : constant Enum := 16#1504#; GL_OR_REVERSE : constant Enum := 16#150B#; GL_OR_INVERTED : constant Enum := 16#150D#; GL_STENCIL_BITS : constant Enum := 16#D57#; GL_STENCIL_TEST : constant Enum := 16#B90#; GL_STENCIL_CLEAR_VALUE : constant Enum := 16#B91#; GL_STENCIL_FUNC : constant Enum := 16#B92#; GL_STENCIL_VALUE_MASK : constant Enum := 16#B93#; GL_STENCIL_FAIL : constant Enum := 16#B94#; GL_STENCIL_PASS_DEPTH_FAIL : constant Enum := 16#B95#; GL_STENCIL_PASS_DEPTH_PASS : constant Enum := 16#B96#; GL_STENCIL_REF : constant Enum := 16#B97#; GL_STENCIL_WRITEMASK : constant Enum := 16#B98#; GL_STENCIL_INDEX : constant Enum := 16#1901#; GL_KEEP : constant Enum := 16#1E00#; GL_REPLACE : constant Enum := 16#1E01#; GL_INCR : constant Enum := 16#1E02#; GL_DECR : constant Enum := 16#1E03#; GL_NONE : constant Enum := 16#0#; GL_LEFT : constant Enum := 16#406#; GL_RIGHT : constant Enum := 16#407#; GL_FRONT_LEFT : constant Enum := 16#400#; GL_FRONT_RIGHT : constant Enum := 16#401#; GL_BACK_LEFT : constant Enum := 16#402#; GL_BACK_RIGHT : constant Enum := 16#403#; GL_AUX0 : constant Enum := 16#409#; GL_AUX1 : constant Enum := 16#40A#; GL_AUX2 : constant Enum := 16#40B#; GL_AUX3 : constant Enum := 16#40C#; GL_COLOR_INDEX : constant Enum := 16#1900#; GL_RED : constant Enum := 16#1903#; GL_GREEN : constant Enum := 16#1904#; GL_BLUE : constant Enum := 16#1905#; GL_ALPHA : constant Enum := 16#1906#; GL_LUMINANCE : constant Enum := 16#1909#; GL_LUMINANCE_ALPHA : constant Enum := 16#190A#; GL_ALPHA_BITS : constant Enum := 16#D55#; GL_RED_BITS : constant Enum := 16#D52#; GL_GREEN_BITS : constant Enum := 16#D53#; GL_BLUE_BITS : constant Enum := 16#D54#; GL_INDEX_BITS : constant Enum := 16#D51#; GL_SUBPIXEL_BITS : constant Enum := 16#D50#; GL_AUX_BUFFERS : constant Enum := 16#C00#; GL_READ_BUFFER : constant Enum := 16#C02#; GL_DRAW_BUFFER : constant Enum := 16#C01#; GL_DOUBLEBUFFER : constant Enum := 16#C32#; GL_STEREO : constant Enum := 16#C33#; GL_BITMAP : constant Enum := 16#1A00#; GL_COLOR : constant Enum := 16#1800#; GL_DEPTH : constant Enum := 16#1801#; GL_STENCIL : constant Enum := 16#1802#; GL_DITHER : constant Enum := 16#BD0#; GL_RGB : constant Enum := 16#1907#; GL_RGBA : constant Enum := 16#1908#; GL_MAX_LIST_NESTING : constant Enum := 16#B31#; GL_MAX_EVAL_ORDER : constant Enum := 16#D30#; GL_MAX_LIGHTS : constant Enum := 16#D31#; GL_MAX_CLIP_PLANES : constant Enum := 16#D32#; GL_MAX_TEXTURE_SIZE : constant Enum := 16#D33#; GL_MAX_PIXEL_MAP_TABLE : constant Enum := 16#D34#; GL_MAX_ATTRIB_STACK_DEPTH : constant Enum := 16#D35#; GL_MAX_MODELVIEW_STACK_DEPTH : constant Enum := 16#D36#; GL_MAX_NAME_STACK_DEPTH : constant Enum := 16#D37#; GL_MAX_PROJECTION_STACK_DEPTH : constant Enum := 16#D38#; GL_MAX_TEXTURE_STACK_DEPTH : constant Enum := 16#D39#; GL_MAX_VIEWPORT_DIMS : constant Enum := 16#D3A#; GL_MAX_CLIENT_ATTRIB_STACK_DEPTH : constant Enum := 16#D3B#; GL_ATTRIB_STACK_DEPTH : constant Enum := 16#BB0#; GL_CLIENT_ATTRIB_STACK_DEPTH : constant Enum := 16#BB1#; GL_COLOR_CLEAR_VALUE : constant Enum := 16#C22#; GL_COLOR_WRITEMASK : constant Enum := 16#C23#; GL_CURRENT_INDEX : constant Enum := 16#B01#; GL_CURRENT_COLOR : constant Enum := 16#B00#; GL_CURRENT_NORMAL : constant Enum := 16#B02#; GL_CURRENT_RASTER_COLOR : constant Enum := 16#B04#; GL_CURRENT_RASTER_DISTANCE : constant Enum := 16#B09#; GL_CURRENT_RASTER_INDEX : constant Enum := 16#B05#; GL_CURRENT_RASTER_POSITION : constant Enum := 16#B07#; GL_CURRENT_RASTER_TEXTURE_COORDS : constant Enum := 16#B06#; GL_CURRENT_RASTER_POSITION_VALID : constant Enum := 16#B08#; GL_CURRENT_TEXTURE_COORDS : constant Enum := 16#B03#; GL_INDEX_CLEAR_VALUE : constant Enum := 16#C20#; GL_INDEX_MODE : constant Enum := 16#C30#; GL_INDEX_WRITEMASK : constant Enum := 16#C21#; GL_MODELVIEW_MATRIX : constant Enum := 16#BA6#; GL_MODELVIEW_STACK_DEPTH : constant Enum := 16#BA3#; GL_NAME_STACK_DEPTH : constant Enum := 16#D70#; GL_PROJECTION_MATRIX : constant Enum := 16#BA7#; GL_PROJECTION_STACK_DEPTH : constant Enum := 16#BA4#; GL_RENDER_MODE : constant Enum := 16#C40#; GL_RGBA_MODE : constant Enum := 16#C31#; GL_TEXTURE_MATRIX : constant Enum := 16#BA8#; GL_TEXTURE_STACK_DEPTH : constant Enum := 16#BA5#; GL_VIEWPORT : constant Enum := 16#BA2#; GL_AUTO_NORMAL : constant Enum := 16#D80#; GL_MAP1_COLOR_4 : constant Enum := 16#D90#; GL_MAP1_INDEX : constant Enum := 16#D91#; GL_MAP1_NORMAL : constant Enum := 16#D92#; GL_MAP1_TEXTURE_COORD_1 : constant Enum := 16#D93#; GL_MAP1_TEXTURE_COORD_2 : constant Enum := 16#D94#; GL_MAP1_TEXTURE_COORD_3 : constant Enum := 16#D95#; GL_MAP1_TEXTURE_COORD_4 : constant Enum := 16#D96#; GL_MAP1_VERTEX_3 : constant Enum := 16#D97#; GL_MAP1_VERTEX_4 : constant Enum := 16#D98#; GL_MAP2_COLOR_4 : constant Enum := 16#DB0#; GL_MAP2_INDEX : constant Enum := 16#DB1#; GL_MAP2_NORMAL : constant Enum := 16#DB2#; GL_MAP2_TEXTURE_COORD_1 : constant Enum := 16#DB3#; GL_MAP2_TEXTURE_COORD_2 : constant Enum := 16#DB4#; GL_MAP2_TEXTURE_COORD_3 : constant Enum := 16#DB5#; GL_MAP2_TEXTURE_COORD_4 : constant Enum := 16#DB6#; GL_MAP2_VERTEX_3 : constant Enum := 16#DB7#; GL_MAP2_VERTEX_4 : constant Enum := 16#DB8#; GL_MAP1_GRID_DOMAIN : constant Enum := 16#DD0#; GL_MAP1_GRID_SEGMENTS : constant Enum := 16#DD1#; GL_MAP2_GRID_DOMAIN : constant Enum := 16#DD2#; GL_MAP2_GRID_SEGMENTS : constant Enum := 16#DD3#; GL_COEFF : constant Enum := 16#A00#; GL_ORDER : constant Enum := 16#A01#; GL_DOMAIN : constant Enum := 16#A02#; GL_PERSPECTIVE_CORRECTION_HINT : constant Enum := 16#C50#; GL_POINT_SMOOTH_HINT : constant Enum := 16#C51#; GL_LINE_SMOOTH_HINT : constant Enum := 16#C52#; GL_POLYGON_SMOOTH_HINT : constant Enum := 16#C53#; GL_FOG_HINT : constant Enum := 16#C54#; GL_DONT_CARE : constant Enum := 16#1100#; GL_FASTEST : constant Enum := 16#1101#; GL_NICEST : constant Enum := 16#1102#; GL_SCISSOR_BOX : constant Enum := 16#C10#; GL_SCISSOR_TEST : constant Enum := 16#C11#; GL_MAP_COLOR : constant Enum := 16#D10#; GL_MAP_STENCIL : constant Enum := 16#D11#; GL_INDEX_SHIFT : constant Enum := 16#D12#; GL_INDEX_OFFSET : constant Enum := 16#D13#; GL_RED_SCALE : constant Enum := 16#D14#; GL_RED_BIAS : constant Enum := 16#D15#; GL_GREEN_SCALE : constant Enum := 16#D18#; GL_GREEN_BIAS : constant Enum := 16#D19#; GL_BLUE_SCALE : constant Enum := 16#D1A#; GL_BLUE_BIAS : constant Enum := 16#D1B#; GL_ALPHA_SCALE : constant Enum := 16#D1C#; GL_ALPHA_BIAS : constant Enum := 16#D1D#; GL_DEPTH_SCALE : constant Enum := 16#D1E#; GL_DEPTH_BIAS : constant Enum := 16#D1F#; GL_PIXEL_MAP_S_TO_S_SIZE : constant Enum := 16#CB1#; GL_PIXEL_MAP_I_TO_I_SIZE : constant Enum := 16#CB0#; GL_PIXEL_MAP_I_TO_R_SIZE : constant Enum := 16#CB2#; GL_PIXEL_MAP_I_TO_G_SIZE : constant Enum := 16#CB3#; GL_PIXEL_MAP_I_TO_B_SIZE : constant Enum := 16#CB4#; GL_PIXEL_MAP_I_TO_A_SIZE : constant Enum := 16#CB5#; GL_PIXEL_MAP_R_TO_R_SIZE : constant Enum := 16#CB6#; GL_PIXEL_MAP_G_TO_G_SIZE : constant Enum := 16#CB7#; GL_PIXEL_MAP_B_TO_B_SIZE : constant Enum := 16#CB8#; GL_PIXEL_MAP_A_TO_A_SIZE : constant Enum := 16#CB9#; GL_PIXEL_MAP_S_TO_S : constant Enum := 16#C71#; GL_PIXEL_MAP_I_TO_I : constant Enum := 16#C70#; GL_PIXEL_MAP_I_TO_R : constant Enum := 16#C72#; GL_PIXEL_MAP_I_TO_G : constant Enum := 16#C73#; GL_PIXEL_MAP_I_TO_B : constant Enum := 16#C74#; GL_PIXEL_MAP_I_TO_A : constant Enum := 16#C75#; GL_PIXEL_MAP_R_TO_R : constant Enum := 16#C76#; GL_PIXEL_MAP_G_TO_G : constant Enum := 16#C77#; GL_PIXEL_MAP_B_TO_B : constant Enum := 16#C78#; GL_PIXEL_MAP_A_TO_A : constant Enum := 16#C79#; GL_PACK_ALIGNMENT : constant Enum := 16#D05#; GL_PACK_LSB_FIRST : constant Enum := 16#D01#; GL_PACK_ROW_LENGTH : constant Enum := 16#D02#; GL_PACK_SKIP_PIXELS : constant Enum := 16#D04#; GL_PACK_SKIP_ROWS : constant Enum := 16#D03#; GL_PACK_SWAP_BYTES : constant Enum := 16#D00#; GL_UNPACK_ALIGNMENT : constant Enum := 16#CF5#; GL_UNPACK_LSB_FIRST : constant Enum := 16#CF1#; GL_UNPACK_ROW_LENGTH : constant Enum := 16#CF2#; GL_UNPACK_SKIP_PIXELS : constant Enum := 16#CF4#; GL_UNPACK_SKIP_ROWS : constant Enum := 16#CF3#; GL_UNPACK_SWAP_BYTES : constant Enum := 16#CF0#; GL_ZOOM_X : constant Enum := 16#D16#; GL_ZOOM_Y : constant Enum := 16#D17#; GL_TEXTURE_ENV : constant Enum := 16#2300#; GL_TEXTURE_ENV_MODE : constant Enum := 16#2200#; GL_TEXTURE_1D : constant Enum := 16#DE0#; GL_TEXTURE_2D : constant Enum := 16#DE1#; GL_TEXTURE_WRAP_S : constant Enum := 16#2802#; GL_TEXTURE_WRAP_T : constant Enum := 16#2803#; GL_TEXTURE_MAG_FILTER : constant Enum := 16#2800#; GL_TEXTURE_MIN_FILTER : constant Enum := 16#2801#; GL_TEXTURE_ENV_COLOR : constant Enum := 16#2201#; GL_TEXTURE_GEN_S : constant Enum := 16#C60#; GL_TEXTURE_GEN_T : constant Enum := 16#C61#; GL_TEXTURE_GEN_MODE : constant Enum := 16#2500#; GL_TEXTURE_BORDER_COLOR : constant Enum := 16#1004#; GL_TEXTURE_WIDTH : constant Enum := 16#1000#; GL_TEXTURE_HEIGHT : constant Enum := 16#1001#; GL_TEXTURE_BORDER : constant Enum := 16#1005#; GL_TEXTURE_COMPONENTS : constant Enum := 16#1003#; GL_TEXTURE_RED_SIZE : constant Enum := 16#805C#; GL_TEXTURE_GREEN_SIZE : constant Enum := 16#805D#; GL_TEXTURE_BLUE_SIZE : constant Enum := 16#805E#; GL_TEXTURE_ALPHA_SIZE : constant Enum := 16#805F#; GL_TEXTURE_LUMINANCE_SIZE : constant Enum := 16#8060#; GL_TEXTURE_INTENSITY_SIZE : constant Enum := 16#8061#; GL_NEAREST_MIPMAP_NEAREST : constant Enum := 16#2700#; GL_NEAREST_MIPMAP_LINEAR : constant Enum := 16#2702#; GL_LINEAR_MIPMAP_NEAREST : constant Enum := 16#2701#; GL_LINEAR_MIPMAP_LINEAR : constant Enum := 16#2703#; GL_OBJECT_LINEAR : constant Enum := 16#2401#; GL_OBJECT_PLANE : constant Enum := 16#2501#; GL_EYE_LINEAR : constant Enum := 16#2400#; GL_EYE_PLANE : constant Enum := 16#2502#; GL_SPHERE_MAP : constant Enum := 16#2402#; GL_DECAL : constant Enum := 16#2101#; GL_MODULATE : constant Enum := 16#2100#; GL_NEAREST : constant Enum := 16#2600#; GL_REPEAT : constant Enum := 16#2901#; GL_CLAMP : constant Enum := 16#2900#; GL_S : constant Enum := 16#2000#; GL_T : constant Enum := 16#2001#; GL_R : constant Enum := 16#2002#; GL_Q : constant Enum := 16#2003#; GL_TEXTURE_GEN_R : constant Enum := 16#C62#; GL_TEXTURE_GEN_Q : constant Enum := 16#C63#; GL_VENDOR : constant Enum := 16#1F00#; GL_RENDERER : constant Enum := 16#1F01#; GL_VERSION : constant Enum := 16#1F02#; GL_SHADING_LANGUAGE_VERSION : constant Enum := 16#8B8C#; GL_EXTENSIONS : constant Enum := 16#1F03#; GL_NO_ERROR : constant Enum := 16#0#; GL_INVALID_ENUM : constant Enum := 16#500#; GL_INVALID_VALUE : constant Enum := 16#501#; GL_INVALID_OPERATION : constant Enum := 16#502#; GL_STACK_OVERFLOW : constant Enum := 16#503#; GL_STACK_UNDERFLOW : constant Enum := 16#504#; GL_OUT_OF_MEMORY : constant Enum := 16#505#; GL_PROXY_TEXTURE_1D : constant Enum := 16#8063#; GL_PROXY_TEXTURE_2D : constant Enum := 16#8064#; GL_TEXTURE_PRIORITY : constant Enum := 16#8066#; GL_TEXTURE_RESIDENT : constant Enum := 16#8067#; GL_TEXTURE_BINDING_1D : constant Enum := 16#8068#; GL_TEXTURE_BINDING_2D : constant Enum := 16#8069#; GL_TEXTURE_INTERNAL_FORMAT : constant Enum := 16#1003#; GL_ALPHA4 : constant Enum := 16#803B#; GL_ALPHA8 : constant Enum := 16#803C#; GL_ALPHA12 : constant Enum := 16#803D#; GL_ALPHA16 : constant Enum := 16#803E#; GL_LUMINANCE4 : constant Enum := 16#803F#; GL_LUMINANCE8 : constant Enum := 16#8040#; GL_LUMINANCE12 : constant Enum := 16#8041#; GL_LUMINANCE16 : constant Enum := 16#8042#; GL_LUMINANCE4_ALPHA4 : constant Enum := 16#8043#; GL_LUMINANCE6_ALPHA2 : constant Enum := 16#8044#; GL_LUMINANCE8_ALPHA8 : constant Enum := 16#8045#; GL_LUMINANCE12_ALPHA4 : constant Enum := 16#8046#; GL_LUMINANCE12_ALPHA12 : constant Enum := 16#8047#; GL_LUMINANCE16_ALPHA16 : constant Enum := 16#8048#; GL_INTENSITY : constant Enum := 16#8049#; GL_INTENSITY4 : constant Enum := 16#804A#; GL_INTENSITY8 : constant Enum := 16#804B#; GL_INTENSITY12 : constant Enum := 16#804C#; GL_INTENSITY16 : constant Enum := 16#804D#; GL_R3_G3_B2 : constant Enum := 16#2A10#; GL_RGB4 : constant Enum := 16#804F#; GL_RGB5 : constant Enum := 16#8050#; GL_RGB8 : constant Enum := 16#8051#; GL_RGB10 : constant Enum := 16#8052#; GL_RGB12 : constant Enum := 16#8053#; GL_RGB16 : constant Enum := 16#8054#; GL_RGBA2 : constant Enum := 16#8055#; GL_RGBA4 : constant Enum := 16#8056#; GL_RGB5_A1 : constant Enum := 16#8057#; GL_RGBA8 : constant Enum := 16#8058#; GL_RGB10_A2 : constant Enum := 16#8059#; GL_RGBA12 : constant Enum := 16#805A#; GL_RGBA16 : constant Enum := 16#805B#; GL_CLIENT_PIXEL_STORE_BIT : constant Enum := 16#1#; GL_CLIENT_VERTEX_ARRAY_BIT : constant Enum := 16#2#; GL_ALL_CLIENT_ATTRIB_BITS : constant Enum := 16#FFFFFFFF#; GL_CLIENT_ALL_ATTRIB_BITS : constant Enum := 16#FFFFFFFF#; GL_RESCALE_NORMAL : constant Enum := 16#803A#; GL_CLAMP_TO_EDGE : constant Enum := 16#812F#; GL_MAX_ELEMENTS_VERTICES : constant Enum := 16#80E8#; GL_MAX_ELEMENTS_INDICES : constant Enum := 16#80E9#; GL_BGR : constant Enum := 16#80E0#; GL_BGRA : constant Enum := 16#80E1#; GL_UNSIGNED_BYTE_3_3_2 : constant Enum := 16#8032#; GL_UNSIGNED_BYTE_2_3_3_REV : constant Enum := 16#8362#; GL_UNSIGNED_SHORT_5_6_5 : constant Enum := 16#8363#; GL_UNSIGNED_SHORT_5_6_5_REV : constant Enum := 16#8364#; GL_UNSIGNED_SHORT_4_4_4_4 : constant Enum := 16#8033#; GL_UNSIGNED_SHORT_4_4_4_4_REV : constant Enum := 16#8365#; GL_UNSIGNED_SHORT_5_5_5_1 : constant Enum := 16#8034#; GL_UNSIGNED_SHORT_1_5_5_5_REV : constant Enum := 16#8366#; GL_UNSIGNED_INT_8_8_8_8 : constant Enum := 16#8035#; GL_UNSIGNED_INT_8_8_8_8_REV : constant Enum := 16#8367#; GL_UNSIGNED_INT_10_10_10_2 : constant Enum := 16#8036#; GL_UNSIGNED_INT_2_10_10_10_REV : constant Enum := 16#8368#; GL_LIGHT_MODEL_COLOR_CONTROL : constant Enum := 16#81F8#; GL_SINGLE_COLOR : constant Enum := 16#81F9#; GL_SEPARATE_SPECULAR_COLOR : constant Enum := 16#81FA#; GL_TEXTURE_MIN_LOD : constant Enum := 16#813A#; GL_TEXTURE_MAX_LOD : constant Enum := 16#813B#; GL_TEXTURE_BASE_LEVEL : constant Enum := 16#813C#; GL_TEXTURE_MAX_LEVEL : constant Enum := 16#813D#; GL_SMOOTH_POINT_SIZE_RANGE : constant Enum := 16#B12#; GL_SMOOTH_POINT_SIZE_GRANULARITY : constant Enum := 16#B13#; GL_SMOOTH_LINE_WIDTH_RANGE : constant Enum := 16#B22#; GL_SMOOTH_LINE_WIDTH_GRANULARITY : constant Enum := 16#B23#; GL_ALIASED_POINT_SIZE_RANGE : constant Enum := 16#846D#; GL_ALIASED_LINE_WIDTH_RANGE : constant Enum := 16#846E#; GL_PACK_SKIP_IMAGES : constant Enum := 16#806B#; GL_PACK_IMAGE_HEIGHT : constant Enum := 16#806C#; GL_UNPACK_SKIP_IMAGES : constant Enum := 16#806D#; GL_UNPACK_IMAGE_HEIGHT : constant Enum := 16#806E#; GL_TEXTURE_3D : constant Enum := 16#806F#; GL_PROXY_TEXTURE_3D : constant Enum := 16#8070#; GL_TEXTURE_DEPTH : constant Enum := 16#8071#; GL_TEXTURE_WRAP_R : constant Enum := 16#8072#; GL_MAX_3D_TEXTURE_SIZE : constant Enum := 16#8073#; GL_TEXTURE_BINDING_3D : constant Enum := 16#806A#; GL_CONSTANT_COLOR : constant Enum := 16#8001#; GL_ONE_MINUS_CONSTANT_COLOR : constant Enum := 16#8002#; GL_CONSTANT_ALPHA : constant Enum := 16#8003#; GL_ONE_MINUS_CONSTANT_ALPHA : constant Enum := 16#8004#; GL_COLOR_TABLE : constant Enum := 16#80D0#; GL_POST_CONVOLUTION_COLOR_TABLE : constant Enum := 16#80D1#; GL_POST_COLOR_MATRIX_COLOR_TABLE : constant Enum := 16#80D2#; GL_PROXY_COLOR_TABLE : constant Enum := 16#80D3#; GL_PROXY_POST_CONVOLUTION_COLOR_TABLE : constant Enum := 16#80D4#; GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE : constant Enum := 16#80D5#; GL_COLOR_TABLE_SCALE : constant Enum := 16#80D6#; GL_COLOR_TABLE_BIAS : constant Enum := 16#80D7#; GL_COLOR_TABLE_FORMAT : constant Enum := 16#80D8#; GL_COLOR_TABLE_WIDTH : constant Enum := 16#80D9#; GL_COLOR_TABLE_RED_SIZE : constant Enum := 16#80DA#; GL_COLOR_TABLE_GREEN_SIZE : constant Enum := 16#80DB#; GL_COLOR_TABLE_BLUE_SIZE : constant Enum := 16#80DC#; GL_COLOR_TABLE_ALPHA_SIZE : constant Enum := 16#80DD#; GL_COLOR_TABLE_LUMINANCE_SIZE : constant Enum := 16#80DE#; GL_COLOR_TABLE_INTENSITY_SIZE : constant Enum := 16#80DF#; GL_CONVOLUTION_1D : constant Enum := 16#8010#; GL_CONVOLUTION_2D : constant Enum := 16#8011#; GL_SEPARABLE_2D : constant Enum := 16#8012#; GL_CONVOLUTION_BORDER_MODE : constant Enum := 16#8013#; GL_CONVOLUTION_FILTER_SCALE : constant Enum := 16#8014#; GL_CONVOLUTION_FILTER_BIAS : constant Enum := 16#8015#; GL_REDUCE : constant Enum := 16#8016#; GL_CONVOLUTION_FORMAT : constant Enum := 16#8017#; GL_CONVOLUTION_WIDTH : constant Enum := 16#8018#; GL_CONVOLUTION_HEIGHT : constant Enum := 16#8019#; GL_MAX_CONVOLUTION_WIDTH : constant Enum := 16#801A#; GL_MAX_CONVOLUTION_HEIGHT : constant Enum := 16#801B#; GL_POST_CONVOLUTION_RED_SCALE : constant Enum := 16#801C#; GL_POST_CONVOLUTION_GREEN_SCALE : constant Enum := 16#801D#; GL_POST_CONVOLUTION_BLUE_SCALE : constant Enum := 16#801E#; GL_POST_CONVOLUTION_ALPHA_SCALE : constant Enum := 16#801F#; GL_POST_CONVOLUTION_RED_BIAS : constant Enum := 16#8020#; GL_POST_CONVOLUTION_GREEN_BIAS : constant Enum := 16#8021#; GL_POST_CONVOLUTION_BLUE_BIAS : constant Enum := 16#8022#; GL_POST_CONVOLUTION_ALPHA_BIAS : constant Enum := 16#8023#; GL_CONSTANT_BORDER : constant Enum := 16#8151#; GL_REPLICATE_BORDER : constant Enum := 16#8153#; GL_CONVOLUTION_BORDER_COLOR : constant Enum := 16#8154#; GL_COLOR_MATRIX : constant Enum := 16#80B1#; GL_COLOR_MATRIX_STACK_DEPTH : constant Enum := 16#80B2#; GL_MAX_COLOR_MATRIX_STACK_DEPTH : constant Enum := 16#80B3#; GL_POST_COLOR_MATRIX_RED_SCALE : constant Enum := 16#80B4#; GL_POST_COLOR_MATRIX_GREEN_SCALE : constant Enum := 16#80B5#; GL_POST_COLOR_MATRIX_BLUE_SCALE : constant Enum := 16#80B6#; GL_POST_COLOR_MATRIX_ALPHA_SCALE : constant Enum := 16#80B7#; GL_POST_COLOR_MATRIX_RED_BIAS : constant Enum := 16#80B8#; GL_POST_COLOR_MATRIX_GREEN_BIAS : constant Enum := 16#80B9#; GL_POST_COLOR_MATRIX_BLUE_BIAS : constant Enum := 16#80BA#; GL_POST_COLOR_MATRIX_ALPHA_BIAS : constant Enum := 16#80BB#; GL_HISTOGRAM : constant Enum := 16#8024#; GL_PROXY_HISTOGRAM : constant Enum := 16#8025#; GL_HISTOGRAM_WIDTH : constant Enum := 16#8026#; GL_HISTOGRAM_FORMAT : constant Enum := 16#8027#; GL_HISTOGRAM_RED_SIZE : constant Enum := 16#8028#; GL_HISTOGRAM_GREEN_SIZE : constant Enum := 16#8029#; GL_HISTOGRAM_BLUE_SIZE : constant Enum := 16#802A#; GL_HISTOGRAM_ALPHA_SIZE : constant Enum := 16#802B#; GL_HISTOGRAM_LUMINANCE_SIZE : constant Enum := 16#802C#; GL_HISTOGRAM_SINK : constant Enum := 16#802D#; GL_MINMAX : constant Enum := 16#802E#; GL_MINMAX_FORMAT : constant Enum := 16#802F#; GL_MINMAX_SINK : constant Enum := 16#8030#; GL_TABLE_TOO_LARGE : constant Enum := 16#8031#; GL_BLEND_EQUATION : constant Enum := 16#8009#; GL_MIN : constant Enum := 16#8007#; GL_MAX : constant Enum := 16#8008#; GL_FUNC_ADD : constant Enum := 16#8006#; GL_FUNC_SUBTRACT : constant Enum := 16#800A#; GL_FUNC_REVERSE_SUBTRACT : constant Enum := 16#800B#; GL_BLEND_COLOR : constant Enum := 16#8005#; GL_TEXTURE0 : constant Enum := 16#84C0#; GL_TEXTURE1 : constant Enum := 16#84C1#; GL_TEXTURE2 : constant Enum := 16#84C2#; GL_TEXTURE3 : constant Enum := 16#84C3#; GL_TEXTURE4 : constant Enum := 16#84C4#; GL_TEXTURE5 : constant Enum := 16#84C5#; GL_TEXTURE6 : constant Enum := 16#84C6#; GL_TEXTURE7 : constant Enum := 16#84C7#; GL_TEXTURE8 : constant Enum := 16#84C8#; GL_TEXTURE9 : constant Enum := 16#84C9#; GL_TEXTURE10 : constant Enum := 16#84CA#; GL_TEXTURE11 : constant Enum := 16#84CB#; GL_TEXTURE12 : constant Enum := 16#84CC#; GL_TEXTURE13 : constant Enum := 16#84CD#; GL_TEXTURE14 : constant Enum := 16#84CE#; GL_TEXTURE15 : constant Enum := 16#84CF#; GL_TEXTURE16 : constant Enum := 16#84D0#; GL_TEXTURE17 : constant Enum := 16#84D1#; GL_TEXTURE18 : constant Enum := 16#84D2#; GL_TEXTURE19 : constant Enum := 16#84D3#; GL_TEXTURE20 : constant Enum := 16#84D4#; GL_TEXTURE21 : constant Enum := 16#84D5#; GL_TEXTURE22 : constant Enum := 16#84D6#; GL_TEXTURE23 : constant Enum := 16#84D7#; GL_TEXTURE24 : constant Enum := 16#84D8#; GL_TEXTURE25 : constant Enum := 16#84D9#; GL_TEXTURE26 : constant Enum := 16#84DA#; GL_TEXTURE27 : constant Enum := 16#84DB#; GL_TEXTURE28 : constant Enum := 16#84DC#; GL_TEXTURE29 : constant Enum := 16#84DD#; GL_TEXTURE30 : constant Enum := 16#84DE#; GL_TEXTURE31 : constant Enum := 16#84DF#; GL_ACTIVE_TEXTURE : constant Enum := 16#84E0#; GL_CLIENT_ACTIVE_TEXTURE : constant Enum := 16#84E1#; GL_MAX_TEXTURE_UNITS : constant Enum := 16#84E2#; GL_NORMAL_MAP : constant Enum := 16#8511#; GL_REFLECTION_MAP : constant Enum := 16#8512#; GL_TEXTURE_CUBE_MAP : constant Enum := 16#8513#; GL_TEXTURE_BINDING_CUBE_MAP : constant Enum := 16#8514#; GL_TEXTURE_CUBE_MAP_POSITIVE_X : constant Enum := 16#8515#; GL_TEXTURE_CUBE_MAP_NEGATIVE_X : constant Enum := 16#8516#; GL_TEXTURE_CUBE_MAP_POSITIVE_Y : constant Enum := 16#8517#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Y : constant Enum := 16#8518#; GL_TEXTURE_CUBE_MAP_POSITIVE_Z : constant Enum := 16#8519#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Z : constant Enum := 16#851A#; GL_PROXY_TEXTURE_CUBE_MAP : constant Enum := 16#851B#; GL_MAX_CUBE_MAP_TEXTURE_SIZE : constant Enum := 16#851C#; GL_COMPRESSED_ALPHA : constant Enum := 16#84E9#; GL_COMPRESSED_LUMINANCE : constant Enum := 16#84EA#; GL_COMPRESSED_LUMINANCE_ALPHA : constant Enum := 16#84EB#; GL_COMPRESSED_INTENSITY : constant Enum := 16#84EC#; GL_COMPRESSED_RGB : constant Enum := 16#84ED#; GL_COMPRESSED_RGBA : constant Enum := 16#84EE#; GL_TEXTURE_COMPRESSION_HINT : constant Enum := 16#84EF#; GL_TEXTURE_COMPRESSED_IMAGE_SIZE : constant Enum := 16#86A0#; GL_TEXTURE_COMPRESSED : constant Enum := 16#86A1#; GL_NUM_COMPRESSED_TEXTURE_FORMATS : constant Enum := 16#86A2#; GL_COMPRESSED_TEXTURE_FORMATS : constant Enum := 16#86A3#; GL_MULTISAMPLE : constant Enum := 16#809D#; GL_SAMPLE_ALPHA_TO_COVERAGE : constant Enum := 16#809E#; GL_SAMPLE_ALPHA_TO_ONE : constant Enum := 16#809F#; GL_SAMPLE_COVERAGE : constant Enum := 16#80A0#; GL_SAMPLE_BUFFERS : constant Enum := 16#80A8#; GL_SAMPLES : constant Enum := 16#80A9#; GL_SAMPLE_COVERAGE_VALUE : constant Enum := 16#80AA#; GL_SAMPLE_COVERAGE_INVERT : constant Enum := 16#80AB#; GL_MULTISAMPLE_BIT : constant Enum := 16#20000000#; GL_TRANSPOSE_MODELVIEW_MATRIX : constant Enum := 16#84E3#; GL_TRANSPOSE_PROJECTION_MATRIX : constant Enum := 16#84E4#; GL_TRANSPOSE_TEXTURE_MATRIX : constant Enum := 16#84E5#; GL_TRANSPOSE_COLOR_MATRIX : constant Enum := 16#84E6#; GL_COMBINE : constant Enum := 16#8570#; GL_COMBINE_RGB : constant Enum := 16#8571#; GL_COMBINE_ALPHA : constant Enum := 16#8572#; GL_SOURCE0_RGB : constant Enum := 16#8580#; GL_SOURCE1_RGB : constant Enum := 16#8581#; GL_SOURCE2_RGB : constant Enum := 16#8582#; GL_SOURCE0_ALPHA : constant Enum := 16#8588#; GL_SOURCE1_ALPHA : constant Enum := 16#8589#; GL_SOURCE2_ALPHA : constant Enum := 16#858A#; GL_OPERAND0_RGB : constant Enum := 16#8590#; GL_OPERAND1_RGB : constant Enum := 16#8591#; GL_OPERAND2_RGB : constant Enum := 16#8592#; GL_OPERAND0_ALPHA : constant Enum := 16#8598#; GL_OPERAND1_ALPHA : constant Enum := 16#8599#; GL_OPERAND2_ALPHA : constant Enum := 16#859A#; GL_RGB_SCALE : constant Enum := 16#8573#; GL_ADD_SIGNED : constant Enum := 16#8574#; GL_INTERPOLATE : constant Enum := 16#8575#; GL_SUBTRACT : constant Enum := 16#84E7#; GL_CONSTANT : constant Enum := 16#8576#; GL_PRIMARY_COLOR : constant Enum := 16#8577#; GL_PREVIOUS : constant Enum := 16#8578#; GL_DOT3_RGB : constant Enum := 16#86AE#; GL_DOT3_RGBA : constant Enum := 16#86AF#; GL_CLAMP_TO_BORDER : constant Enum := 16#812D#; GL_ARB_multitexture : constant Enum := 1; GL_TEXTURE0_ARB : constant Enum := 16#84C0#; GL_TEXTURE1_ARB : constant Enum := 16#84C1#; GL_TEXTURE2_ARB : constant Enum := 16#84C2#; GL_TEXTURE3_ARB : constant Enum := 16#84C3#; GL_TEXTURE4_ARB : constant Enum := 16#84C4#; GL_TEXTURE5_ARB : constant Enum := 16#84C5#; GL_TEXTURE6_ARB : constant Enum := 16#84C6#; GL_TEXTURE7_ARB : constant Enum := 16#84C7#; GL_TEXTURE8_ARB : constant Enum := 16#84C8#; GL_TEXTURE9_ARB : constant Enum := 16#84C9#; GL_TEXTURE10_ARB : constant Enum := 16#84CA#; GL_TEXTURE11_ARB : constant Enum := 16#84CB#; GL_TEXTURE12_ARB : constant Enum := 16#84CC#; GL_TEXTURE13_ARB : constant Enum := 16#84CD#; GL_TEXTURE14_ARB : constant Enum := 16#84CE#; GL_TEXTURE15_ARB : constant Enum := 16#84CF#; GL_TEXTURE16_ARB : constant Enum := 16#84D0#; GL_TEXTURE17_ARB : constant Enum := 16#84D1#; GL_TEXTURE18_ARB : constant Enum := 16#84D2#; GL_TEXTURE19_ARB : constant Enum := 16#84D3#; GL_TEXTURE20_ARB : constant Enum := 16#84D4#; GL_TEXTURE21_ARB : constant Enum := 16#84D5#; GL_TEXTURE22_ARB : constant Enum := 16#84D6#; GL_TEXTURE23_ARB : constant Enum := 16#84D7#; GL_TEXTURE24_ARB : constant Enum := 16#84D8#; GL_TEXTURE25_ARB : constant Enum := 16#84D9#; GL_TEXTURE26_ARB : constant Enum := 16#84DA#; GL_TEXTURE27_ARB : constant Enum := 16#84DB#; GL_TEXTURE28_ARB : constant Enum := 16#84DC#; GL_TEXTURE29_ARB : constant Enum := 16#84DD#; GL_TEXTURE30_ARB : constant Enum := 16#84DE#; GL_TEXTURE31_ARB : constant Enum := 16#84DF#; GL_ACTIVE_TEXTURE_ARB : constant Enum := 16#84E0#; GL_CLIENT_ACTIVE_TEXTURE_ARB : constant Enum := 16#84E1#; GL_MAX_TEXTURE_UNITS_ARB : constant Enum := 16#84E2#; GL_TEXTURE_1D_ARRAY_EXT : constant Enum := 16#8C18#; GL_PROXY_TEXTURE_1D_ARRAY_EXT : constant Enum := 16#8C19#; GL_TEXTURE_2D_ARRAY_EXT : constant Enum := 16#8C1A#; GL_PROXY_TEXTURE_2D_ARRAY_EXT : constant Enum := 16#8C1B#; GL_TEXTURE_BINDING_1D_ARRAY_EXT : constant Enum := 16#8C1C#; GL_TEXTURE_BINDING_2D_ARRAY_EXT : constant Enum := 16#8C1D#; GL_POINT_SPRITE : constant Enum := 16#8861#; GL_COORD_REPLACE : constant Enum := 16#8862#; GL_MAX_ARRAY_TEXTURE_LAYERS_EXT : constant Enum := 16#88FF#; GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT : constant Enum := 16#8CD4#; GL_FRAMEBUFFER : constant Enum := 16#8D40#; GL_READ_FRAMEBUFFER : constant Enum := 16#8CA8#; GL_WRITE_FRAMEBUFFER : constant Enum := 16#8CA9#; GL_RENDERBUFFER : constant Enum := 16#8D41#; GL_ARRAY_BUFFER : constant Enum := 16#8892#; GL_ELEMENT_ARRAY_BUFFER : constant Enum := 16#8893#; GL_STATIC_DRAW : constant Enum := 16#88E4#; GL_DYNAMIC_DRAW : constant Enum := 16#88E8#; GL_VERTEX_SHADER : constant Enum := 16#8B31#; GL_FRAGMENT_SHADER : constant Enum := 16#8B30#; GL_DELETE_STATUS : constant Enum := 16#8B80#; GL_COMPILE_STATUS : constant Enum := 16#8B81#; GL_LINK_STATUS : constant Enum := 16#8B82#; GL_VALIDATE_STATUS : constant Enum := 16#8B83#; GL_INFO_LOG_LENGTH : constant Enum := 16#8B84#; -- Bitfield constants GL_CURRENT_BIT : constant Bitfield := 16#00001#; GL_POINT_BIT : constant Bitfield := 16#00002#; GL_LINE_BIT : constant Bitfield := 16#00004#; GL_POLYGON_BIT : constant Bitfield := 16#00008#; GL_POLYGON_STIPPLE_BIT : constant Bitfield := 16#00010#; GL_PIXEL_MODE_BIT : constant Bitfield := 16#00020#; GL_LIGHTING_BIT : constant Bitfield := 16#00040#; GL_FOG_BIT : constant Bitfield := 16#00080#; GL_DEPTH_BUFFER_BIT : constant Bitfield := 16#00100#; GL_ACCUM_BUFFER_BIT : constant Bitfield := 16#00200#; GL_STENCIL_BUFFER_BIT : constant Bitfield := 16#00400#; GL_VIEWPORT_BIT : constant Bitfield := 16#00800#; GL_TRANSFORM_BIT : constant Bitfield := 16#01000#; GL_ENABLE_BIT : constant Bitfield := 16#02000#; GL_COLOR_BUFFER_BIT : constant Bitfield := 16#04000#; GL_HINT_BIT : constant Bitfield := 16#08000#; GL_EVAL_BIT : constant Bitfield := 16#10000#; GL_LIST_BIT : constant Bitfield := 16#20000#; GL_TEXTURE_BIT : constant Bitfield := 16#40000#; GL_SCISSOR_BIT : constant Bitfield := 16#80000#; GL_ALL_ATTRIB_BITS : constant Bitfield := 16#FFFFF#; --------------------------------------------------------------------------- -- These two have pride of place in that they don't lose their "gl" prefix. -- That's because their "base" names are Ada keywords. procedure Begin_Primitive (Mode : in Enum); procedure End_Primitive; -- Misc function Get_Error return Enum; procedure Push_Attrib (Mask : in Bitfield); procedure Pop_Attrib; function Get_String (Name : Enum) return String; function Get_String (Name : Enum; Index : Int) return String; -- Pipeline control procedure Finish; procedure Flush; -- Server-side capabilities procedure Enable (Cap : in Enum); procedure Disable (Cap : in Enum); function Is_Enabled (Cap : in Enum) return Bool; procedure Hint (Target : Enum; Hint : Enum); -- Projections procedure Ortho (Left : in Double; Right : in Double; Bottom : in Double; Top : in Double; Near_Val : in Double; Far_Val : in Double); procedure Frustum (Left : in Double; Right : in Double; Bottom : in Double; Top : in Double; Near_Val : in Double; Far_Val : in Double); procedure Viewport (X : in Int; Y : in Int; Width : in SizeI; Height : in SizeI); -- Matrix mode procedure Matrix_Mode (Mode : in Enum); -- Matrix stacks procedure Push_Matrix; procedure Pop_Matrix; procedure Load_Identity; procedure Load_Matrix (M : in Float_Matrix); procedure Load_Matrix (M : in Double_Matrix); procedure Mult_Matrix (M : in Float_Matrix); procedure Mult_Matrix (M : in Double_Matrix); pragma Inline (Load_Matrix, Mult_Matrix); -- Clears procedure Clear_Index (C : in Float); procedure Clear_Color (Red : in ClampF; Green : in ClampF; Blue : in ClampF; Alpha : in ClampF); procedure Clear (Mask : in Bitfield); procedure Clear_Depth (Depth : in ClampD); procedure Clear_Accum (Red : in Float; Green : in Float; Blue : in Float; Alpha : in Float); -- Transformations procedure Rotate (Angle : in Double; X : in Double; Y : in Double; Z : in Double); procedure Rotate (Angle : in Float; X : in Float; Y : in Float; Z : in Float); procedure Scale (X : in Double; Y : in Double; Z : in Double); procedure Scale (X : in Float; Y : in Float; Z : in Float); procedure Translate (X : in Double; Y : in Double; Z : in Double); procedure Translate (X : in Float; Y : in Float; Z : in Float); pragma Inline (Scale, Translate); -- Alpha, stencil, and depth tests procedure Alpha_Func (Func : in Enum; Ref : in ClampF); procedure Depth_Func (Func : in Enum); procedure Stencil_Func (Func : in Enum; Ref : in Int; Mask : in UInt); -- Blending procedure Blend_Color (Red : in ClampF; Green : in ClampF; Blue : in ClampF; Alpha : in ClampF); procedure Blend_Equation (Mode : in Enum); procedure Blend_Func (S_Factor : in Enum; D_Factor : in Enum); -- Drawing parameters procedure Point_Size (Size : in Float); procedure Line_Width (Width : in Float); procedure Line_Stipple (Factor : in Int; Pattern : in UShort); procedure Polygon_Offset (Factor : in Float; Units : in Float); procedure Polygon_Stipple (Mask : in Pointer); procedure Polygon_Mode (Face : in Enum; Mode : in Enum); procedure Get_Polygon_Stipple (Mask : in Pointer); procedure Edge_Flag (Flag : in Bool); procedure Edge_Flagv (Flag : in Pointer); procedure Scissor (X : Int; Y : Int; Width : SizeI; Height : SizeI); -- Component color procedure Color (Red : in Byte; Green : in Byte; Blue : in Byte); procedure Color (Red : in Short; Green : in Short; Blue : in Short); procedure Color (Red : in Int; Green : in Int; Blue : in Int); procedure Color (Red : in Float; Green : in Float; Blue : in Float); procedure Color (Red : in Double; Green : in Double; Blue : in Double); procedure Color (Red : in UByte; Green : in UByte; Blue : in UByte); procedure Color (Red : in UShort; Green : in UShort; Blue : in UShort); procedure Color (Red : in UInt; Green : in UInt; Blue : in UInt); procedure Color (Red : in Byte; Green : in Byte; Blue : in Byte; Alpha : in Byte); procedure Color (Red : in Short; Green : in Short; Blue : in Short; Alpha : in Short); procedure Color (Red : in Int; Green : in Int; Blue : in Int; Alpha : in Int); procedure Color (Red : in Float; Green : in Float; Blue : in Float; Alpha : in Float); procedure Color (Red : in Double; Green : in Double; Blue : in Double; Alpha : in Double); procedure Color (Red : in UByte; Green : in UByte; Blue : in UByte; Alpha : in UByte); procedure Color (Red : in UShort; Green : in UShort; Blue : in UShort; Alpha : in UShort); procedure Color (Red : in UInt; Green : in UInt; Blue : in UInt; Alpha : in UInt); procedure Color (V : in Bytes_3); procedure Color (V : in Bytes_4); procedure Color (V : in Shorts_3); procedure Color (V : in Shorts_4); procedure Color (V : in Ints_3); procedure Color (V : in Ints_4); procedure Color (V : in Floats_3); procedure Color (V : in Floats_4); procedure Color (V : in Doubles_3); procedure Color (V : in Doubles_4); procedure Color (V : in UBytes_3); procedure Color (V : in UBytes_4); procedure Color (V : in UShorts_3); procedure Color (V : in UShorts_4); procedure Color (V : in UInts_3); procedure Color (V : in UInts_4); pragma Inline (Color); -- Lighting and materials type Int_Params is array (1 .. 4) of Int; type Float_Params is array (1 .. 4) of Float; procedure Light (Light : in Enum; PName : in Enum; Params : in Int_Params); procedure Light (Light : in Enum; PName : in Enum; Params : in Float_Params); procedure Material (Face : in Enum; PName : in Enum; Params : in Int_Params); procedure Material (Face : in Enum; PName : in Enum; Params : in Float_Params); procedure Front_Face (Mode : in Enum); procedure Cull_Face (Mode : in Enum); procedure Shade_Model (Mode : in Enum); pragma Inline (Light, Material); -- Lighting procedure Light (Light : in Enum; PName : in Enum; Param : in Float); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_1); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_3); procedure Light (Light : in Enum; PName : in Enum; Params : in Floats_4); procedure Light (Light : in Enum; PName : in Enum; Param : in Int); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_1); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_3); procedure Light (Light : in Enum; PName : in Enum; Params : in Ints_4); pragma Inline (Light); -- Normal Vector procedure Normal (X, Y, Z : Byte); procedure Normal (X, Y, Z : Double); procedure Normal (X, Y, Z : Float); procedure Normal (X, Y, Z : Int); procedure Normal (X, Y, Z : Short); procedure Normal (V : Bytes_3); procedure Normal (V : Doubles_3); procedure Normal (V : Floats_3); procedure Normal (V : Ints_3); procedure Normal (V : Shorts_3); pragma Inline (Normal); -- Texturing procedure Active_Texture (Texture : in Enum); -- v1.3 procedure Bind_Texture (Target : in Enum; Texture : in UInt); procedure Gen_Textures (N : in SizeI; Textures : in Pointer); procedure Delete_Textures (N : in SizeI; Textures : in Pointer); procedure Tex_Env (Coord : in Enum; PName : in Enum; Param : in Enum); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Int); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Float); procedure Tex_Gen (Coord : in Enum; PName : in Enum; Param : in Double); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Enum); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Int); procedure Tex_Parameter (Target : in Enum; PName : in Enum; Param : in Float); pragma Inline (Tex_Parameter); -- Texture images procedure Tex_Image (Target : in Enum; Level : in Int; Internal_Format : in Enum; Width : in SizeI; Border : in Int; Format : in Enum; Pixel_Type : in Enum; Pixels : in Pointer); procedure Tex_Image (Target : in Enum; Level : in Int; Internal_Format : in Enum; Width : in SizeI; Height : in SizeI; Border : in Int; Format : in Enum; Pixel_Type : in Enum; Pixels : in Pointer); procedure Tex_Sub_Image (Target : in Enum; Level : in Int; X_Offset : in Int; Y_Offset : in Int; Width : in SizeI; Height : in SizeI; Format : in Enum; Pixel_Type : in Enum; Pixels : in GL.Pointer); -- procedure Tex_Image (Target : in Enum; -- Level : in Int; -- Internal_Format : in Int; -- Width : in SizeI; -- Height : in SizeI; -- Depth : in SizeI; -- Border : in Int; -- Format : in Enum; -- Pixel_Type : in Enum; -- Pixels : in Pointer); pragma Inline (Tex_Image); -- Texture coordinates procedure Tex_Coord (S : in Short); procedure Tex_Coord (S : in Int); procedure Tex_Coord (S : in Float); procedure Tex_Coord (S : in Double); procedure Tex_Coord (S : in Short; T : in Short); procedure Tex_Coord (S : in Int; T : in Int); procedure Tex_Coord (S : in Float; T : in Float); procedure Tex_Coord (S : in Double; T : in Double); procedure Tex_Coord (S : in Short; T : in Short; R : in Short); procedure Tex_Coord (S : in Int; T : in Int; R : in Int); procedure Tex_Coord (S : in Float; T : in Float; R : in Float); procedure Tex_Coord (S : in Double; T : in Double; R : in Double); procedure Tex_Coord (S : in Short; T : in Short; R : in Short; Q : in Short); procedure Tex_Coord (S : in Int; T : in Int; R : in Int; Q : in Int); procedure Tex_Coord (S : in Float; T : in Float; R : in Float; Q : in Float); procedure Tex_Coord (S : in Double; T : in Double; R : in Double; Q : in Double); procedure Tex_Coord (V : in Shorts_1); procedure Tex_Coord (V : in Shorts_2); procedure Tex_Coord (V : in Shorts_3); procedure Tex_Coord (V : in Shorts_4); procedure Tex_Coord (V : in Ints_1); procedure Tex_Coord (V : in Ints_2); procedure Tex_Coord (V : in Ints_3); procedure Tex_Coord (V : in Ints_4); procedure Tex_Coord (V : in Floats_1); procedure Tex_Coord (V : in Floats_2); procedure Tex_Coord (V : in Floats_3); procedure Tex_Coord (V : in Floats_4); procedure Tex_Coord (V : in Doubles_1); procedure Tex_Coord (V : in Doubles_2); procedure Tex_Coord (V : in Doubles_3); procedure Tex_Coord (V : in Doubles_4); pragma Inline (Tex_Coord); procedure Tex_Coord_Pointer (Size : in SizeI; Type_Of : in Enum; Stride : in SizeI; Offset : in SizeI); -- Get texture data procedure Get_Tex_Image (Target : in Enum; Level : in Int; Format : in Enum; Type_Of : in Enum; Pixels : in Pointer); -- Evaluators procedure Map (Target : in Enum; U1 : in Float; U2 : in Float; Stride : in Int; Order : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Double; U2 : in Double; Stride : in Int; Order : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Float; U2 : in Float; UStride : in Int; UOrder : in Int; V1 : in Float; V2 : in Float; VStride : in Int; VOrder : in Int; Points : in System.Address); procedure Map (Target : in Enum; U1 : in Double; U2 : in Double; UStride : in Int; UOrder : in Int; V1 : in Double; V2 : in Double; VStride : in Int; VOrder : in Int; Points : in System.Address); pragma Inline (Map); procedure Map_Grid (Un : in Int; U1 : in Float; U2 : in Float); procedure Map_Grid (Un : in Int; U1 : in Double; U2 : in Double); procedure Map_Grid (Un : in Int; U1 : in Float; U2 : in Float; Vn : in Int; V1 : in Float; V2 : in Float); procedure Map_Grid (Un : in Int; U1 : in Double; U2 : in Double; Vn : in Int; V1 : in Double; V2 : in Double); pragma Inline (Map_Grid); procedure Eval_Point (I : Int); procedure Eval_Point (I : in Int; J : in Int); pragma Inline (Eval_Point); procedure Eval_Mesh (Mode : in Enum; I1 : in Int; I2 : in Int); procedure Eval_Mesh (Mode : in Enum; I1 : in Int; I2 : in Int; J1 : in Int; J2 : in Int); pragma Inline (Eval_Mesh); -- Specify vertices procedure Vertex (X : in Short; Y : in Short); procedure Vertex (X : in Int; Y : in Int); procedure Vertex (X : in Float; Y : in Float); procedure Vertex (X : in Double; Y : in Double); procedure Vertex (X : in Short; Y : in Short; Z : in Short); procedure Vertex (X : in Int; Y : in Int; Z : in Int); procedure Vertex (X : in Float; Y : in Float; Z : in Float); procedure Vertex (X : in Double; Y : in Double; Z : in Double); procedure Vertex (X : in Short; Y : in Short; Z : in Short; W : in Short); procedure Vertex (X : in Int; Y : in Int; Z : in Int; W : in Int); procedure Vertex (X : in Float; Y : in Float; Z : in Float; W : in Float); procedure Vertex (X : in Double; Y : in Double; Z : in Double; W : in Double); procedure Vertex (V : in Shorts_2); procedure Vertex (V : in Shorts_3); procedure Vertex (V : in Shorts_4); procedure Vertex (V : in Ints_2); procedure Vertex (V : in Ints_3); procedure Vertex (V : in Ints_4); procedure Vertex (V : in Floats_2); procedure Vertex (V : in Floats_3); procedure Vertex (V : in Floats_4); procedure Vertex (V : in Doubles_2); procedure Vertex (V : in Doubles_3); procedure Vertex (V : in Doubles_4); pragma Inline (Vertex); -- Buffer objects v2.1??? procedure Gen_Framebuffers (N : in SizeI; FBOs : in Pointer); procedure Bind_Framebuffer (Target : in Enum; FBO : in UInt); -- Vertex buffer stuff: procedure Gen_Buffers (N : in SizeI; VBO : in Pointer); procedure Delete_Buffers (N : in SizeI; Buffers : in Pointer); procedure Bind_Buffer (Target : in Enum; VBO : in UInt); procedure Buffer_Data (Target : in Enum; Size : in SizeI; Data : in Pointer; Usage : in Enum); procedure Buffer_Sub_Data (Target: in Enum; Offset: in SizeI; Size : in SizeI; Data : in Pointer); procedure Enable_Client_State (Target : in Enum); procedure Disable_Client_State (Target : in Enum); procedure Vertex_Pointer (Size : in SizeI; Element_Type : in Enum; Stride : in SizeI; Data_Pointer : Pointer); procedure Vertex_Pointer (Size : in SizeI; Element_Type : in Enum; Stride : in SizeI; Offset : in SizeI); procedure Draw_Arrays (Mode : in Enum; First : in Int; Count : in SizeI); procedure Draw_Elements (Mode : in Enum; Count : in SizeI; Index_Type : in Enum; Indices : in Pointer); procedure Enable_Vertex_Attrib_Array (Index : in UInt); procedure Disable_Vertex_Attrib_Array (Index : in UInt); procedure Vertex_Attrib_Pointer (Index : in UInt; Size : in Int; Attr_Type : in Enum; Normalized : in Bool; Stride : in SizeI; Data_Pointer : in Pointer); -- Vertex array objects procedure Gen_Vertex_Arrays (N : in SizeI; VAOs : in Pointer); procedure Bind_Vertex_Array (VAO : in UInt); -- Shaders function Create_Shader (Shader_Type : in Enum) return UInt; procedure Delete_Shader (Shader_ID : in UInt); procedure Shader_Source (Shader : in UInt; Count : in SizeI; Source_String : in Pointer; Length : in Pointer); procedure Compile_Shader (Shader : in UInt); procedure Attach_Shader (Program : in UInt; Shader : in UInt); procedure Link_Program (Program : in UInt); procedure Use_Program (Program : in UInt); function Create_Program return UInt; procedure Get_Shader (Shader : in UInt; PName : in Enum; Params : in Pointer); procedure Get_Shader_Info_Log (Shader : in UInt; MaxLength : in SizeI; Length : in Pointer; InfoLog : in Pointer); procedure Get_Program (Program : in UInt; PName : in Enum; Params : in Pointer); procedure Get_Program_Info_Log (Progarm : in UInt; MaxLength : in SizeI; Length : in Pointer; InfoLog : in Pointer); procedure Validate_Program (Program : in GL.UInt); function Get_Uniform_Location (Program : in UInt; Name : in String) return Int; procedure Uniform (Location : in Int; V0 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float; V2 : in Float); procedure Uniform (Location : in Int; V0 : in Float; V1 : in Float; V2 : in Float; V3 : in Float); procedure Uniform (Location : in Int; V0 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int; V2 : in Int); procedure Uniform (Location : in Int; V0 : in Int; V1 : in Int; V2 : in Int; V3 : in Int); procedure Uniform (Location : in Int; V0 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt; V2 : in UInt); procedure Uniform (Location : in Int; V0 : in UInt; V1 : in UInt; V2 : in UInt; V3 : in UInt); procedure Uniform (Location : in Int; Count : in SizeI; Transpose : in Bool; Value : in Float_Matrix); function Get_Attribute_Location (Program : in UInt; Name : in String) return Int; procedure Vertex_Attrib (Index : in UInt; X : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float; Z : in Float); procedure Vertex_Attrib (Index : in UInt; X : in Float; Y : in Float; Z : in Float; W : in Float); pragma Inline (Vertex_Attrib); procedure Get_Double (Pname : in Enum; Params : out Double_Matrix); pragma Inline (Get_Double); procedure Read_Pixels (X : in Int; Y : in Int; Width : in SizeI; Height : in SizeI; Format : in Enum; C_Type : in Enum; Pixels : in Pointer); --------------------------------------------------------------------------- private -- These can be bound directly pragma Import (StdCall, Active_Texture, "glActiveTexture"); pragma Import (StdCall, Alpha_Func, "glAlphaFunc"); pragma Import (StdCall, Attach_Shader, "glAttachShader"); pragma Import (StdCall, Begin_Primitive, "glBegin"); pragma Import (StdCall, Bind_Buffer, "glBindBuffer"); pragma Import (StdCall, Bind_Framebuffer, "glBindFramebuffer"); pragma Import (StdCall, Bind_Texture, "glBindTexture"); pragma Import (StdCall, Bind_Vertex_Array, "glBindVertexArray"); pragma Import (StdCall, Blend_Color, "glBlendColor"); pragma Import (StdCall, Blend_Equation, "glBlendEquation"); pragma Import (StdCall, Blend_Func, "glBlendFunc"); pragma Import (StdCall, Buffer_Data, "glBufferData"); pragma Import (StdCall, Clear, "glClear"); pragma Import (StdCall, Clear_Accum, "glClearAccum"); pragma Import (StdCall, Clear_Color, "glClearColor"); pragma Import (StdCall, Clear_Depth, "glClearDepth"); pragma Import (StdCall, Clear_Index, "glClearIndex"); pragma Import (StdCall, Compile_Shader, "glCompileShader"); pragma Import (StdCall, Create_Program, "glCreateProgram"); pragma Import (StdCall, Create_Shader, "glCreateShader"); pragma Import (StdCall, Cull_Face, "glCullFace"); pragma Import (StdCall, Delete_Shader, "glDeleteShader"); pragma Import (StdCall, Depth_Func, "glDepthFunc"); pragma Import (StdCall, Disable, "glDisable"); pragma Import (StdCall, Disable_Vertex_Attrib_Array, "glDisableVertexAttribArray"); pragma Import (StdCall, Draw_Arrays, "glDrawArrays"); pragma Import (StdCall, Draw_Elements, "glDrawElements"); pragma Import (StdCall, Edge_Flag, "glEdgeFlag"); pragma Import (StdCall, Edge_Flagv, "glEdgeFlagv"); pragma Import (StdCall, Enable, "glEnable"); pragma Import (StdCall, Enable_Client_State, "glEnableClientState"); pragma Import (StdCall, Enable_Vertex_Attrib_Array, "glEnableVertexAttribArray"); pragma Import (StdCall, End_Primitive, "glEnd"); pragma Import (StdCall, Finish, "glFinish"); pragma Import (StdCall, Flush, "glFlush"); pragma Import (StdCall, Front_Face, "glFrontFace"); pragma Import (StdCall, Frustum, "glFrustum"); pragma Import (StdCall, Gen_Buffers, "glGenBuffers"); pragma Import (StdCall, Gen_Framebuffers, "glGenFramebuffers"); pragma Import (StdCall, Gen_Textures, "glGenTextures"); pragma Import (StdCall, Get_Tex_Image, "glGetTexImage"); pragma Import (StdCall, Delete_Textures, "glDeleteTextures"); pragma Import (StdCall, Gen_Vertex_Arrays, "glGenVertexArrays"); pragma Import (StdCall, Get_Error, "glGetError"); pragma Import (StdCall, Get_Polygon_Stipple, "glGetPolygonStipple"); pragma Import (StdCall, Get_Shader, "glGetShaderiv"); pragma Import (StdCall, Get_Shader_Info_Log, "glGetShaderInfoLog"); pragma Import (StdCall, Hint, "glHint"); pragma Import (StdCall, Is_Enabled, "glIsEnabled"); pragma Import (StdCall, Line_Stipple, "glLineStipple"); pragma Import (StdCall, Line_Width, "glLineWidth"); pragma Import (StdCall, Link_Program, "glLinkProgram"); pragma Import (StdCall, Load_Identity, "glLoadIdentity"); pragma Import (StdCall, Matrix_Mode, "glMatrixMode"); pragma Import (StdCall, Ortho, "glOrtho"); pragma Import (StdCall, Point_Size, "glPointSize"); pragma Import (StdCall, Polygon_Mode, "glPolygonMode"); pragma Import (StdCall, Polygon_Offset, "glPolygonOffset"); pragma Import (StdCall, Polygon_Stipple, "glPolygonStipple"); pragma Import (StdCall, Pop_Attrib, "glPopAttrib"); pragma Import (StdCall, Pop_Matrix, "glPopMatrix"); pragma Import (StdCall, Push_Attrib, "glPushAttrib"); pragma Import (StdCall, Push_Matrix, "glPushMatrix"); pragma Import (StdCall, Scissor, "glScissor"); pragma Import (StdCall, Shade_Model, "glShadeModel"); pragma Import (StdCall, Shader_Source, "glShaderSource"); pragma Import (StdCall, Stencil_Func, "glStencilFunc"); pragma Import (StdCall, Tex_Env, "glTexEnvi"); pragma Import (StdCall, Use_Program, "glUseProgram"); pragma Import (StdCall, Vertex_Attrib_Pointer, "glVertexAttribPointer"); pragma Import (StdCall, Viewport, "glViewport"); pragma Import (StdCall, Delete_Buffers, "glDeleteBuffers"); pragma Import (StdCall, Buffer_Sub_Data, "glBufferSubData"); pragma Import (StdCall, Disable_Client_State, "glDisableClientState"); pragma Import (StdCall, Tex_Coord_Pointer, "glTexCoordPointer"); pragma Import (StdCall, Get_Program, "glGetProgramiv"); pragma Import (StdCall, Get_Program_Info_Log, "glGetProgramInfoLog"); pragma Import (StdCall, Validate_Program, "glValidateProgram"); pragma Import (StdCall, Read_Pixels, "glReadPixels"); end Lumen.GL;
[ { "context": "formations on Builder types\n-- Copyright (C) 2015 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 191, "score": 0.999871551990509, "start": 176, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2015 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 222, "score": 0.999879002571106, "start": 207, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "5 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 249, "score": 0.999926745891571, "start": 224, "tag": "EMAIL", "value": "[email protected]" } ]
src/core/strings/util-strings-builders-transforms.ads
RREE/ada-util
60
----------------------------------------------------------------------- -- util-strings-builders-transforms -- String transformations on Builder types -- Copyright (C) 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 Ada.Characters.Handling; with Util.Texts.Transforms; -- The <b>Util.Strings.Builders.Transforms</b> package provides an instantiation -- of the text transformation operations for the Builder type. package Util.Strings.Builders.Transforms is new Util.Texts.Transforms (Stream => Builder, Char => Character, Input => String, Put => Append, To_Upper => Ada.Characters.Handling.To_Upper, To_Lower => Ada.Characters.Handling.To_Lower);
21618
----------------------------------------------------------------------- -- util-strings-builders-transforms -- String transformations on Builder types -- Copyright (C) 2015 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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.Characters.Handling; with Util.Texts.Transforms; -- The <b>Util.Strings.Builders.Transforms</b> package provides an instantiation -- of the text transformation operations for the Builder type. package Util.Strings.Builders.Transforms is new Util.Texts.Transforms (Stream => Builder, Char => Character, Input => String, Put => Append, To_Upper => Ada.Characters.Handling.To_Upper, To_Lower => Ada.Characters.Handling.To_Lower);
true
----------------------------------------------------------------------- -- util-strings-builders-transforms -- String transformations on Builder types -- Copyright (C) 2015 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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.Characters.Handling; with Util.Texts.Transforms; -- The <b>Util.Strings.Builders.Transforms</b> package provides an instantiation -- of the text transformation operations for the Builder type. package Util.Strings.Builders.Transforms is new Util.Texts.Transforms (Stream => Builder, Char => Character, Input => String, Put => Append, To_Upper => Ada.Characters.Handling.To_Upper, To_Lower => Ada.Characters.Handling.To_Lower);
[ { "context": "- GStreamer StreamVolume\n -- * Copyright (C) 2009 Sebastian Dröge <[email protected]>\n -- *\n -- * ", "end": 1162, "score": 0.9998893737792969, "start": 1147, "tag": "NAME", "value": "Sebastian Dröge" }, { "context": "Volume\n -- * Copyright (C) 2009 Sebastian Dröge <[email protected]>\n -- *\n -- * This library is free software; you", "end": 1196, "score": 0.9999334812164307, "start": 1164, "tag": "EMAIL", "value": "[email protected]" } ]
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_interfaces_streamvolume_h.ads
persan/A-gst
1
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_streamvolume_h is -- unsupported macro: GST_TYPE_STREAM_VOLUME (gst_stream_volume_get_type ()) -- arg-macro: function GST_STREAM_VOLUME (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_VOLUME, GstStreamVolume); -- arg-macro: function GST_STREAM_VOLUME_INTERFACE (iface) -- return G_TYPE_CHECK_INTERFACE_CAST ((iface), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface); -- arg-macro: function GST_IS_STREAM_VOLUME (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_VOLUME); -- arg-macro: function GST_IS_STREAM_VOLUME_INTERFACE (iface) -- return G_TYPE_CHECK_INTERFACE_TYPE ((iface), GST_TYPE_STREAM_VOLUME); -- arg-macro: function GST_STREAM_VOLUME_GET_INTERFACE (inst) -- return G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface); -- GStreamer StreamVolume -- * Copyright (C) 2009 Sebastian Dröge <[email protected]> -- * -- * 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. -- -- skipped empty struct u_GstStreamVolume -- skipped empty struct GstStreamVolume type GstStreamVolumeInterface; type u_GstStreamVolumeInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstStreamVolumeInterface is u_GstStreamVolumeInterface; -- gst/interfaces/streamvolume.h:41 type GstStreamVolumeInterface is record parent : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/streamvolume.h:44 u_gst_reserved : u_GstStreamVolumeInterface_u_gst_reserved_array; -- gst/interfaces/streamvolume.h:47 end record; pragma Convention (C_Pass_By_Copy, GstStreamVolumeInterface); -- gst/interfaces/streamvolume.h:43 --< private > --* -- * GstStreamVolumeFormat: -- * @GST_STREAM_VOLUME_FORMAT_LINEAR: Linear scale factor, 1.0 = 100% -- * @GST_STREAM_VOLUME_FORMAT_CUBIC: Cubic volume scale -- * @GST_STREAM_VOLUME_FORMAT_DB: Logarithmic volume scale (dB, amplitude not power) -- * -- * Different representations of a stream volume. gst_stream_volume_convert_volume() -- * allows to convert between the different representations. -- * -- * Formulas to convert from a linear to a cubic or dB volume are -- * cbrt(val) and 20 * log10 (val). -- * -- * Since: 0.10.25 -- type GstStreamVolumeFormat is (GST_STREAM_VOLUME_FORMAT_LINEAR, GST_STREAM_VOLUME_FORMAT_CUBIC, GST_STREAM_VOLUME_FORMAT_DB); pragma Convention (C, GstStreamVolumeFormat); -- gst/interfaces/streamvolume.h:68 function gst_stream_volume_get_type return GLIB.GType; -- gst/interfaces/streamvolume.h:70 pragma Import (C, gst_stream_volume_get_type, "gst_stream_volume_get_type"); procedure gst_stream_volume_set_volume (volume : System.Address; format : GstStreamVolumeFormat; val : GLIB.gdouble); -- gst/interfaces/streamvolume.h:71 pragma Import (C, gst_stream_volume_set_volume, "gst_stream_volume_set_volume"); function gst_stream_volume_get_volume (volume : System.Address; format : GstStreamVolumeFormat) return GLIB.gdouble; -- gst/interfaces/streamvolume.h:74 pragma Import (C, gst_stream_volume_get_volume, "gst_stream_volume_get_volume"); procedure gst_stream_volume_set_mute (volume : System.Address; mute : GLIB.gboolean); -- gst/interfaces/streamvolume.h:77 pragma Import (C, gst_stream_volume_set_mute, "gst_stream_volume_set_mute"); function gst_stream_volume_get_mute (volume : System.Address) return GLIB.gboolean; -- gst/interfaces/streamvolume.h:79 pragma Import (C, gst_stream_volume_get_mute, "gst_stream_volume_get_mute"); function gst_stream_volume_convert_volume (from : GstStreamVolumeFormat; to : GstStreamVolumeFormat; val : GLIB.gdouble) return GLIB.gdouble; -- gst/interfaces/streamvolume.h:81 pragma Import (C, gst_stream_volume_convert_volume, "gst_stream_volume_convert_volume"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_streamvolume_h;
5558
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_streamvolume_h is -- unsupported macro: GST_TYPE_STREAM_VOLUME (gst_stream_volume_get_type ()) -- arg-macro: function GST_STREAM_VOLUME (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_VOLUME, GstStreamVolume); -- arg-macro: function GST_STREAM_VOLUME_INTERFACE (iface) -- return G_TYPE_CHECK_INTERFACE_CAST ((iface), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface); -- arg-macro: function GST_IS_STREAM_VOLUME (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_VOLUME); -- arg-macro: function GST_IS_STREAM_VOLUME_INTERFACE (iface) -- return G_TYPE_CHECK_INTERFACE_TYPE ((iface), GST_TYPE_STREAM_VOLUME); -- arg-macro: function GST_STREAM_VOLUME_GET_INTERFACE (inst) -- return G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface); -- GStreamer StreamVolume -- * Copyright (C) 2009 <NAME> <<EMAIL>> -- * -- * 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. -- -- skipped empty struct u_GstStreamVolume -- skipped empty struct GstStreamVolume type GstStreamVolumeInterface; type u_GstStreamVolumeInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstStreamVolumeInterface is u_GstStreamVolumeInterface; -- gst/interfaces/streamvolume.h:41 type GstStreamVolumeInterface is record parent : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/streamvolume.h:44 u_gst_reserved : u_GstStreamVolumeInterface_u_gst_reserved_array; -- gst/interfaces/streamvolume.h:47 end record; pragma Convention (C_Pass_By_Copy, GstStreamVolumeInterface); -- gst/interfaces/streamvolume.h:43 --< private > --* -- * GstStreamVolumeFormat: -- * @GST_STREAM_VOLUME_FORMAT_LINEAR: Linear scale factor, 1.0 = 100% -- * @GST_STREAM_VOLUME_FORMAT_CUBIC: Cubic volume scale -- * @GST_STREAM_VOLUME_FORMAT_DB: Logarithmic volume scale (dB, amplitude not power) -- * -- * Different representations of a stream volume. gst_stream_volume_convert_volume() -- * allows to convert between the different representations. -- * -- * Formulas to convert from a linear to a cubic or dB volume are -- * cbrt(val) and 20 * log10 (val). -- * -- * Since: 0.10.25 -- type GstStreamVolumeFormat is (GST_STREAM_VOLUME_FORMAT_LINEAR, GST_STREAM_VOLUME_FORMAT_CUBIC, GST_STREAM_VOLUME_FORMAT_DB); pragma Convention (C, GstStreamVolumeFormat); -- gst/interfaces/streamvolume.h:68 function gst_stream_volume_get_type return GLIB.GType; -- gst/interfaces/streamvolume.h:70 pragma Import (C, gst_stream_volume_get_type, "gst_stream_volume_get_type"); procedure gst_stream_volume_set_volume (volume : System.Address; format : GstStreamVolumeFormat; val : GLIB.gdouble); -- gst/interfaces/streamvolume.h:71 pragma Import (C, gst_stream_volume_set_volume, "gst_stream_volume_set_volume"); function gst_stream_volume_get_volume (volume : System.Address; format : GstStreamVolumeFormat) return GLIB.gdouble; -- gst/interfaces/streamvolume.h:74 pragma Import (C, gst_stream_volume_get_volume, "gst_stream_volume_get_volume"); procedure gst_stream_volume_set_mute (volume : System.Address; mute : GLIB.gboolean); -- gst/interfaces/streamvolume.h:77 pragma Import (C, gst_stream_volume_set_mute, "gst_stream_volume_set_mute"); function gst_stream_volume_get_mute (volume : System.Address) return GLIB.gboolean; -- gst/interfaces/streamvolume.h:79 pragma Import (C, gst_stream_volume_get_mute, "gst_stream_volume_get_mute"); function gst_stream_volume_convert_volume (from : GstStreamVolumeFormat; to : GstStreamVolumeFormat; val : GLIB.gdouble) return GLIB.gdouble; -- gst/interfaces/streamvolume.h:81 pragma Import (C, gst_stream_volume_convert_volume, "gst_stream_volume_convert_volume"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_streamvolume_h;
true
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with glib; with System; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_streamvolume_h is -- unsupported macro: GST_TYPE_STREAM_VOLUME (gst_stream_volume_get_type ()) -- arg-macro: function GST_STREAM_VOLUME (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_VOLUME, GstStreamVolume); -- arg-macro: function GST_STREAM_VOLUME_INTERFACE (iface) -- return G_TYPE_CHECK_INTERFACE_CAST ((iface), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface); -- arg-macro: function GST_IS_STREAM_VOLUME (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_VOLUME); -- arg-macro: function GST_IS_STREAM_VOLUME_INTERFACE (iface) -- return G_TYPE_CHECK_INTERFACE_TYPE ((iface), GST_TYPE_STREAM_VOLUME); -- arg-macro: function GST_STREAM_VOLUME_GET_INTERFACE (inst) -- return G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface); -- GStreamer StreamVolume -- * Copyright (C) 2009 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * -- * 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. -- -- skipped empty struct u_GstStreamVolume -- skipped empty struct GstStreamVolume type GstStreamVolumeInterface; type u_GstStreamVolumeInterface_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstStreamVolumeInterface is u_GstStreamVolumeInterface; -- gst/interfaces/streamvolume.h:41 type GstStreamVolumeInterface is record parent : aliased GStreamer.GST_Low_Level.glib_2_0_gobject_gtype_h.GTypeInterface; -- gst/interfaces/streamvolume.h:44 u_gst_reserved : u_GstStreamVolumeInterface_u_gst_reserved_array; -- gst/interfaces/streamvolume.h:47 end record; pragma Convention (C_Pass_By_Copy, GstStreamVolumeInterface); -- gst/interfaces/streamvolume.h:43 --< private > --* -- * GstStreamVolumeFormat: -- * @GST_STREAM_VOLUME_FORMAT_LINEAR: Linear scale factor, 1.0 = 100% -- * @GST_STREAM_VOLUME_FORMAT_CUBIC: Cubic volume scale -- * @GST_STREAM_VOLUME_FORMAT_DB: Logarithmic volume scale (dB, amplitude not power) -- * -- * Different representations of a stream volume. gst_stream_volume_convert_volume() -- * allows to convert between the different representations. -- * -- * Formulas to convert from a linear to a cubic or dB volume are -- * cbrt(val) and 20 * log10 (val). -- * -- * Since: 0.10.25 -- type GstStreamVolumeFormat is (GST_STREAM_VOLUME_FORMAT_LINEAR, GST_STREAM_VOLUME_FORMAT_CUBIC, GST_STREAM_VOLUME_FORMAT_DB); pragma Convention (C, GstStreamVolumeFormat); -- gst/interfaces/streamvolume.h:68 function gst_stream_volume_get_type return GLIB.GType; -- gst/interfaces/streamvolume.h:70 pragma Import (C, gst_stream_volume_get_type, "gst_stream_volume_get_type"); procedure gst_stream_volume_set_volume (volume : System.Address; format : GstStreamVolumeFormat; val : GLIB.gdouble); -- gst/interfaces/streamvolume.h:71 pragma Import (C, gst_stream_volume_set_volume, "gst_stream_volume_set_volume"); function gst_stream_volume_get_volume (volume : System.Address; format : GstStreamVolumeFormat) return GLIB.gdouble; -- gst/interfaces/streamvolume.h:74 pragma Import (C, gst_stream_volume_get_volume, "gst_stream_volume_get_volume"); procedure gst_stream_volume_set_mute (volume : System.Address; mute : GLIB.gboolean); -- gst/interfaces/streamvolume.h:77 pragma Import (C, gst_stream_volume_set_mute, "gst_stream_volume_set_mute"); function gst_stream_volume_get_mute (volume : System.Address) return GLIB.gboolean; -- gst/interfaces/streamvolume.h:79 pragma Import (C, gst_stream_volume_get_mute, "gst_stream_volume_get_mute"); function gst_stream_volume_convert_volume (from : GstStreamVolumeFormat; to : GstStreamVolumeFormat; val : GLIB.gdouble) return GLIB.gdouble; -- gst/interfaces/streamvolume.h:81 pragma Import (C, gst_stream_volume_convert_volume, "gst_stream_volume_convert_volume"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_interfaces_streamvolume_h;
[ { "context": "\r\n\r\n-- Space vehicle #001 3D model. Copyright (c) Gautier de Montmollin 1999 - 2000\r\n -- CH - 2000 Neuchatel\r\n -- SWITZ", "end": 122, "score": 0.9998775124549866, "start": 101, "tag": "NAME", "value": "Gautier de Montmollin" } ]
Sources/Globe_3d/models/vehic001.adb
ForYouEyesOnly/Space-Convoy
1
pragma Warnings (Off); pragma Style_Checks (Off); -- Space vehicle #001 3D model. Copyright (c) Gautier de Montmollin 1999 - 2000 -- CH - 2000 Neuchatel -- SWITZERLAND -- Permission granted to use the herein contained 3D model for any purpose, -- provided this copyright note remains attached and unmodified. with GL; package body Vehic001 is procedure Create ( object : in out GLOBE_3D.p_Object_3D; scale : GLOBE_3D.Real; centre : GLOBE_3D.Point_3D ) is use GL, GLOBE_3D; -- matos : Material_type; polys : constant array (1 .. 101, 1 .. 4) of Natural := -- Here, clockwise ! (1 => (2, 1, 3, 4), 2 => (4, 3, 6, 7), 3 => (7, 6, 9, 10), 4 => (10, 9, 11, 12), 5 => (12, 11, 14, 16), 6 => (16, 14, 19, 15), -- zebr. hg -- 7 => (14, 13, 23, 21) passait devant 17 7 => (14, 17, 23, 21), 94 => (14, 13, 17, 0), 8 => (14, 21, 22, 19), 9 => (56, 49, 54, 57), -- 10 => (21, 25, 79, 74) passait devant 22 10 => (21, 25, 22, 0), 90 => (25, 79, 22, 0), 91 => (79, 74, 22, 0), 11 => (21, 23, 27, 25), 12 => (27, 23, 33, 34), 13 => (25, 27, 34, 35), -- fusel hg 14 => (24, 25, 35, 29), -- aile hg -- 15 => (1, 36, 41, 6) passait devant 3, 5, 85, 40, 38 15 => (1, 36, 85, 0), 98 => (1, 85, 5, 3), 99 => (85, 36, 38, 40), 100 => (6, 3, 5, 0), 101 => (40, 38, 41, 0), 16 => (6, 5, 8, 9), 17 => (40, 41, 44, 43), -- appui vitre 18 => (36, 37, 39, 38), 19 => (38, 39, 42, 41), 20 => (41, 42, 45, 44), 21 => (44, 45, 47, 46), 22 => (46, 47, 51, 49), 23 => (49, 51, 50, 54), -- zebr hd -- 24 => (48, 49, 56, 58) passait devant 52 24 => (52, 49, 56, 58), 95 => (48, 49, 52, 0), 25 => (61, 18, 78, 26), -- sous 27 26 => (20, 76, 78, 18), -- sous 24 27 => (56, 60, 62, 58), 28 => (62, 66, 65, 58), 29 => (60, 67, 66, 62), -- fusel hd 30 => (35, 32, 87, 82), -- react. g. 31 => (17, 52, 58, 23), -- centre h 32 => (32, 67, 89, 87), -- react d. 33 => (23, 58, 65, 33), 34 => (13, 48, 52, 17), -- 35 => (33, 30, 31, 34), 36 => (30, 65, 66, 31), -- face 31 passait devant 30 35 => (33, 0, 31, 34), 36 => (0, 65, 66, 31), 96 => (33, 65, 31, 0), 37 => (34, 31, 32, 35), 38 => (31, 66, 67, 32), -- arr. react h 39 => (60, 59, 64, 67), -- aile hd -- 40 => (60, 56, 18, 61) passait devant 57 40 => (60, 56, 57, 0), 92 => (61, 60, 57, 0), 93 => (61, 57, 18, 0), 41 => (14, 8, 96, 13), 42 => (13, 96, 97, 48), 43 => (97, 43, 49, 48), -- cockpit 44 => (68, 2, 4, 69), 45 => (69, 4, 7, 70), 46 => (70, 7, 10, 71), 47 => (71, 10, 12, 72), 48 => (72, 12, 16, 73), 49 => (73, 16, 15, 19), -- zebr bg 50 => (19, 22, 74, 73), 51 => (73, 74, 77, 75), 52 => (76, 75, 77, 78), 53 => (64, 59, 92, 90), 54 => (77, 74, 79, 80), 55 => (77, 80, 83, 84), 56 => (80, 79, 82, 83), -- aile bg 57 => (79, 25, 24, 28), 58 => (24, 29, 81, 28), 59 => (29, 35, 82, 81), 60 => (87, 86, 83, 82), 61 => (87, 89, 88, 86), -- 62 => (86, 85, 84, 83), 63 => (86, 88, 91, 85) face 78 passait devant 85 62 => (86, 0, 84, 83), 63 => (86, 88, 91, 0), 97 => (84, 86, 91, 0), 64 => (67, 64, 90, 89), 65 => (60, 61, 92, 59), 66 => (92, 61, 89, 90), -- aile bd 67 => (61, 26, 88, 89), 68 => (18, 57, 54, 20), 69 => (54, 50, 51, 20), 70 => (20, 51, 47, 53), 71 => (53, 47, 45, 55), 72 => (45, 42, 93, 55), 73 => (42, 39, 94, 93), 74 => (39, 37, 95, 94), -- zebr bd 75 => (5, 85, 96, 8), 76 => (85, 40, 43, 97), -- lucarnes cockpit 77 => (82, 79, 28, 81), -- sous aile g 78 => (84, 91, 78, 77), -- sous 33:rc 79 => (91, 88, 26, 78), -- sous 28 80 => (75, 76, 20, 73), -- "entree air" 81 => (73, 20, 93, 70), -- sous cockpit 82 => (70, 93, 95, 68), -- sous l'avant 83 => (1, 2, 68, 30), 84 => (30, 68, 95, 63), -- nez 85 => (63, 95, 37, 36), 86 => (63, 36, 1, 30), -- nez 87 => (9, 8, 14, 0), 88 => (43, 44, 49, 0), -- triangles plateau cockpit cf 16, 17 89 => (96, 85, 97, 0) -- triangle pointe cockpit devant 42 ); coords : constant array (1 .. 97, 0 .. 2) of Integer := (1 => ( - 10, 360, 10), 2 => ( - 20, 360, 0), 3 => ( - 20, 330, 12), 4 => ( - 30, 330, 0), 5 => ( - 10, 300, 14), 6 => ( - 30, 300, 14), 7 => ( - 40, 300, 0), 8 => ( - 20, 270, 16), 9 => ( - 30, 270, 16), 10 => ( - 50, 270, 0), 11 => ( - 30, 240, 18), 12 => ( - 60, 240, 0), 13 => ( - 20, 220, 30), 14 => ( - 30, 210, 20), 15 => ( - 40, 200, 0), 16 => ( - 70, 210, 0), 17 => ( - 20, 200, 30), 18 => (30, 120, - 20), 19 => ( - 31, 200, 0), 20 => (30, 210, - 20), 21 => ( - 30, 120, 20), 22 => ( - 31, 120, 0), 23 => ( - 20, 110, 30), 24 => ( - 110, 110, 1), 25 => ( - 50, 100, 1), 26 => (40, 90, - 10), 27 => ( - 40, 90, 10), 28 => ( - 110, 110, - 1), 29 => ( - 120, 50, 1), -- 30 => (0, 7, 40), 31 => (0, 0, 20), 32 => (0, 0, 10), 33 => ( - 20, 7, 40), 34 => ( - 40, 0, 10), 35 => ( - 60, 0, 2), -- fin hg 36 => (10, 360, 10), 37 => (20, 360, 0), 38 => (20, 330, 12), 39 => (30, 330, 0), 40 => (10, 300, 14), 41 => (30, 300, 14), 42 => (40, 300, 0), 43 => (20, 270, 16), 44 => (30, 270, 16), 45 => (50, 270, 0), 46 => (30, 240, 18), 47 => (60, 240, 0), 48 => (20, 220, 30), 49 => (30, 210, 20), 50 => (40, 200, 0), 51 => (70, 210, 0), 52 => (20, 200, 30), 53 => (30, 240, - 18), 54 => (31, 200, 0), 55 => (30, 270, - 16), 56 => (30, 120, 20), 57 => (31, 120, 0), 58 => (20, 110, 30), 59 => (110, 110, 1), 60 => (50, 100, 1), 61 => (50, 100, - 1), 62 => (40, 90, 10), 63 => (4, 366, 0), 64 => (120, 50, 1), 65 => (20, 7, 40), 66 => (40, 0, 10), 67 => (60, 0, 2), -- fin hd 68 => ( - 10, 360, - 10), -- debut bas g 69 => ( - 20, 330, - 12), 70 => ( - 30, 300, - 14), 71 => ( - 30, 270, - 16), 72 => ( - 30, 240, - 18), 73 => ( - 30, 210, - 20), 74 => ( - 30, 120, - 20), 75 => ( - 20, 210, - 30), 76 => (20, 210, - 30), 77 => ( - 20, 110, - 30), 78 => (20, 110, - 30), 79 => ( - 50, 100, - 1), 80 => ( - 40, 80, - 10), 81 => ( - 120, 50, - 1), 82 => ( - 60, 0, - 2), 83 => ( - 40, 0, - 10), 84 => ( - 20, 7, - 40), -- 85 => (0, 7, - 40), 86 => (0, 0, - 20), 87 => (0, 0, - 10), 88 => (40, 0, - 10), 89 => (60, 0, - 2), 90 => (120, 50, - 1), 91 => (20, 7, - 40), 92 => (110, 110, - 1), 93 => (30, 300, - 14), 94 => (20, 330, - 12), 95 => (10, 360, - 10), 96 => ( - 10, 270, 17), 97 => (10, 270, 17), 30 => ( - 4, 366, 0), 85 => (0, 300, 14) ); colour : GL.RGB_Color; corr : constant Vector_3D := (0.0, 160.0, 0.0); face_0 : Face_type; -- takes defaults values begin face_0.skin := colour_only; object := new Object_3D (Max_points => 97, Max_faces => polys'Length (1)); for i in coords'Range loop for d in Point_3D'Range loop object.point (i) (d) := scale * 0.1 * (Real (coords (i, d)) - corr (d)); end loop; end loop; for i in polys'Range (1) loop case i is when 2|4|6|19|21|23|44|46|48|70|72|74 => colour := (1.0, 1.0, 0.1); -- jaune --matos := very_bright; when 1|3|5|18|20|22|45|47|49|69|71|73 => colour := (0.1, 0.1, 0.5); -- bleu f. --matos := very_bright; when 34 => colour := (0.3, 0.11, 0.11); -- rouge --matos := neutral; when 41 .. 43|75|76|89 => colour := (0.13, 0.2, 0.2); -- vitre cockpit --matos := very_bright; when 30|32 => colour := (1.0, 0.8, 0.1); -- orange --matos := neutral; when 83 .. 86 => colour := (0.1, 0.2, 0.4); -- museau --matos := neutral; when others => colour := (0.8, 0.8, 1.0); -- caisse --matos := bright; end case; face_0.colour := colour; face_0.P := (polys (i, 1), polys (i, 4), polys (i, 3), polys (i, 2)); object.face (i) := face_0; end loop; object.centre := centre; Set_name (object.all, "vehicle_001"); end Create; end Vehic001;
2576
pragma Warnings (Off); pragma Style_Checks (Off); -- Space vehicle #001 3D model. Copyright (c) <NAME> 1999 - 2000 -- CH - 2000 Neuchatel -- SWITZERLAND -- Permission granted to use the herein contained 3D model for any purpose, -- provided this copyright note remains attached and unmodified. with GL; package body Vehic001 is procedure Create ( object : in out GLOBE_3D.p_Object_3D; scale : GLOBE_3D.Real; centre : GLOBE_3D.Point_3D ) is use GL, GLOBE_3D; -- matos : Material_type; polys : constant array (1 .. 101, 1 .. 4) of Natural := -- Here, clockwise ! (1 => (2, 1, 3, 4), 2 => (4, 3, 6, 7), 3 => (7, 6, 9, 10), 4 => (10, 9, 11, 12), 5 => (12, 11, 14, 16), 6 => (16, 14, 19, 15), -- zebr. hg -- 7 => (14, 13, 23, 21) passait devant 17 7 => (14, 17, 23, 21), 94 => (14, 13, 17, 0), 8 => (14, 21, 22, 19), 9 => (56, 49, 54, 57), -- 10 => (21, 25, 79, 74) passait devant 22 10 => (21, 25, 22, 0), 90 => (25, 79, 22, 0), 91 => (79, 74, 22, 0), 11 => (21, 23, 27, 25), 12 => (27, 23, 33, 34), 13 => (25, 27, 34, 35), -- fusel hg 14 => (24, 25, 35, 29), -- aile hg -- 15 => (1, 36, 41, 6) passait devant 3, 5, 85, 40, 38 15 => (1, 36, 85, 0), 98 => (1, 85, 5, 3), 99 => (85, 36, 38, 40), 100 => (6, 3, 5, 0), 101 => (40, 38, 41, 0), 16 => (6, 5, 8, 9), 17 => (40, 41, 44, 43), -- appui vitre 18 => (36, 37, 39, 38), 19 => (38, 39, 42, 41), 20 => (41, 42, 45, 44), 21 => (44, 45, 47, 46), 22 => (46, 47, 51, 49), 23 => (49, 51, 50, 54), -- zebr hd -- 24 => (48, 49, 56, 58) passait devant 52 24 => (52, 49, 56, 58), 95 => (48, 49, 52, 0), 25 => (61, 18, 78, 26), -- sous 27 26 => (20, 76, 78, 18), -- sous 24 27 => (56, 60, 62, 58), 28 => (62, 66, 65, 58), 29 => (60, 67, 66, 62), -- fusel hd 30 => (35, 32, 87, 82), -- react. g. 31 => (17, 52, 58, 23), -- centre h 32 => (32, 67, 89, 87), -- react d. 33 => (23, 58, 65, 33), 34 => (13, 48, 52, 17), -- 35 => (33, 30, 31, 34), 36 => (30, 65, 66, 31), -- face 31 passait devant 30 35 => (33, 0, 31, 34), 36 => (0, 65, 66, 31), 96 => (33, 65, 31, 0), 37 => (34, 31, 32, 35), 38 => (31, 66, 67, 32), -- arr. react h 39 => (60, 59, 64, 67), -- aile hd -- 40 => (60, 56, 18, 61) passait devant 57 40 => (60, 56, 57, 0), 92 => (61, 60, 57, 0), 93 => (61, 57, 18, 0), 41 => (14, 8, 96, 13), 42 => (13, 96, 97, 48), 43 => (97, 43, 49, 48), -- cockpit 44 => (68, 2, 4, 69), 45 => (69, 4, 7, 70), 46 => (70, 7, 10, 71), 47 => (71, 10, 12, 72), 48 => (72, 12, 16, 73), 49 => (73, 16, 15, 19), -- zebr bg 50 => (19, 22, 74, 73), 51 => (73, 74, 77, 75), 52 => (76, 75, 77, 78), 53 => (64, 59, 92, 90), 54 => (77, 74, 79, 80), 55 => (77, 80, 83, 84), 56 => (80, 79, 82, 83), -- aile bg 57 => (79, 25, 24, 28), 58 => (24, 29, 81, 28), 59 => (29, 35, 82, 81), 60 => (87, 86, 83, 82), 61 => (87, 89, 88, 86), -- 62 => (86, 85, 84, 83), 63 => (86, 88, 91, 85) face 78 passait devant 85 62 => (86, 0, 84, 83), 63 => (86, 88, 91, 0), 97 => (84, 86, 91, 0), 64 => (67, 64, 90, 89), 65 => (60, 61, 92, 59), 66 => (92, 61, 89, 90), -- aile bd 67 => (61, 26, 88, 89), 68 => (18, 57, 54, 20), 69 => (54, 50, 51, 20), 70 => (20, 51, 47, 53), 71 => (53, 47, 45, 55), 72 => (45, 42, 93, 55), 73 => (42, 39, 94, 93), 74 => (39, 37, 95, 94), -- zebr bd 75 => (5, 85, 96, 8), 76 => (85, 40, 43, 97), -- lucarnes cockpit 77 => (82, 79, 28, 81), -- sous aile g 78 => (84, 91, 78, 77), -- sous 33:rc 79 => (91, 88, 26, 78), -- sous 28 80 => (75, 76, 20, 73), -- "entree air" 81 => (73, 20, 93, 70), -- sous cockpit 82 => (70, 93, 95, 68), -- sous l'avant 83 => (1, 2, 68, 30), 84 => (30, 68, 95, 63), -- nez 85 => (63, 95, 37, 36), 86 => (63, 36, 1, 30), -- nez 87 => (9, 8, 14, 0), 88 => (43, 44, 49, 0), -- triangles plateau cockpit cf 16, 17 89 => (96, 85, 97, 0) -- triangle pointe cockpit devant 42 ); coords : constant array (1 .. 97, 0 .. 2) of Integer := (1 => ( - 10, 360, 10), 2 => ( - 20, 360, 0), 3 => ( - 20, 330, 12), 4 => ( - 30, 330, 0), 5 => ( - 10, 300, 14), 6 => ( - 30, 300, 14), 7 => ( - 40, 300, 0), 8 => ( - 20, 270, 16), 9 => ( - 30, 270, 16), 10 => ( - 50, 270, 0), 11 => ( - 30, 240, 18), 12 => ( - 60, 240, 0), 13 => ( - 20, 220, 30), 14 => ( - 30, 210, 20), 15 => ( - 40, 200, 0), 16 => ( - 70, 210, 0), 17 => ( - 20, 200, 30), 18 => (30, 120, - 20), 19 => ( - 31, 200, 0), 20 => (30, 210, - 20), 21 => ( - 30, 120, 20), 22 => ( - 31, 120, 0), 23 => ( - 20, 110, 30), 24 => ( - 110, 110, 1), 25 => ( - 50, 100, 1), 26 => (40, 90, - 10), 27 => ( - 40, 90, 10), 28 => ( - 110, 110, - 1), 29 => ( - 120, 50, 1), -- 30 => (0, 7, 40), 31 => (0, 0, 20), 32 => (0, 0, 10), 33 => ( - 20, 7, 40), 34 => ( - 40, 0, 10), 35 => ( - 60, 0, 2), -- fin hg 36 => (10, 360, 10), 37 => (20, 360, 0), 38 => (20, 330, 12), 39 => (30, 330, 0), 40 => (10, 300, 14), 41 => (30, 300, 14), 42 => (40, 300, 0), 43 => (20, 270, 16), 44 => (30, 270, 16), 45 => (50, 270, 0), 46 => (30, 240, 18), 47 => (60, 240, 0), 48 => (20, 220, 30), 49 => (30, 210, 20), 50 => (40, 200, 0), 51 => (70, 210, 0), 52 => (20, 200, 30), 53 => (30, 240, - 18), 54 => (31, 200, 0), 55 => (30, 270, - 16), 56 => (30, 120, 20), 57 => (31, 120, 0), 58 => (20, 110, 30), 59 => (110, 110, 1), 60 => (50, 100, 1), 61 => (50, 100, - 1), 62 => (40, 90, 10), 63 => (4, 366, 0), 64 => (120, 50, 1), 65 => (20, 7, 40), 66 => (40, 0, 10), 67 => (60, 0, 2), -- fin hd 68 => ( - 10, 360, - 10), -- debut bas g 69 => ( - 20, 330, - 12), 70 => ( - 30, 300, - 14), 71 => ( - 30, 270, - 16), 72 => ( - 30, 240, - 18), 73 => ( - 30, 210, - 20), 74 => ( - 30, 120, - 20), 75 => ( - 20, 210, - 30), 76 => (20, 210, - 30), 77 => ( - 20, 110, - 30), 78 => (20, 110, - 30), 79 => ( - 50, 100, - 1), 80 => ( - 40, 80, - 10), 81 => ( - 120, 50, - 1), 82 => ( - 60, 0, - 2), 83 => ( - 40, 0, - 10), 84 => ( - 20, 7, - 40), -- 85 => (0, 7, - 40), 86 => (0, 0, - 20), 87 => (0, 0, - 10), 88 => (40, 0, - 10), 89 => (60, 0, - 2), 90 => (120, 50, - 1), 91 => (20, 7, - 40), 92 => (110, 110, - 1), 93 => (30, 300, - 14), 94 => (20, 330, - 12), 95 => (10, 360, - 10), 96 => ( - 10, 270, 17), 97 => (10, 270, 17), 30 => ( - 4, 366, 0), 85 => (0, 300, 14) ); colour : GL.RGB_Color; corr : constant Vector_3D := (0.0, 160.0, 0.0); face_0 : Face_type; -- takes defaults values begin face_0.skin := colour_only; object := new Object_3D (Max_points => 97, Max_faces => polys'Length (1)); for i in coords'Range loop for d in Point_3D'Range loop object.point (i) (d) := scale * 0.1 * (Real (coords (i, d)) - corr (d)); end loop; end loop; for i in polys'Range (1) loop case i is when 2|4|6|19|21|23|44|46|48|70|72|74 => colour := (1.0, 1.0, 0.1); -- jaune --matos := very_bright; when 1|3|5|18|20|22|45|47|49|69|71|73 => colour := (0.1, 0.1, 0.5); -- bleu f. --matos := very_bright; when 34 => colour := (0.3, 0.11, 0.11); -- rouge --matos := neutral; when 41 .. 43|75|76|89 => colour := (0.13, 0.2, 0.2); -- vitre cockpit --matos := very_bright; when 30|32 => colour := (1.0, 0.8, 0.1); -- orange --matos := neutral; when 83 .. 86 => colour := (0.1, 0.2, 0.4); -- museau --matos := neutral; when others => colour := (0.8, 0.8, 1.0); -- caisse --matos := bright; end case; face_0.colour := colour; face_0.P := (polys (i, 1), polys (i, 4), polys (i, 3), polys (i, 2)); object.face (i) := face_0; end loop; object.centre := centre; Set_name (object.all, "vehicle_001"); end Create; end Vehic001;
true
pragma Warnings (Off); pragma Style_Checks (Off); -- Space vehicle #001 3D model. Copyright (c) PI:NAME:<NAME>END_PI 1999 - 2000 -- CH - 2000 Neuchatel -- SWITZERLAND -- Permission granted to use the herein contained 3D model for any purpose, -- provided this copyright note remains attached and unmodified. with GL; package body Vehic001 is procedure Create ( object : in out GLOBE_3D.p_Object_3D; scale : GLOBE_3D.Real; centre : GLOBE_3D.Point_3D ) is use GL, GLOBE_3D; -- matos : Material_type; polys : constant array (1 .. 101, 1 .. 4) of Natural := -- Here, clockwise ! (1 => (2, 1, 3, 4), 2 => (4, 3, 6, 7), 3 => (7, 6, 9, 10), 4 => (10, 9, 11, 12), 5 => (12, 11, 14, 16), 6 => (16, 14, 19, 15), -- zebr. hg -- 7 => (14, 13, 23, 21) passait devant 17 7 => (14, 17, 23, 21), 94 => (14, 13, 17, 0), 8 => (14, 21, 22, 19), 9 => (56, 49, 54, 57), -- 10 => (21, 25, 79, 74) passait devant 22 10 => (21, 25, 22, 0), 90 => (25, 79, 22, 0), 91 => (79, 74, 22, 0), 11 => (21, 23, 27, 25), 12 => (27, 23, 33, 34), 13 => (25, 27, 34, 35), -- fusel hg 14 => (24, 25, 35, 29), -- aile hg -- 15 => (1, 36, 41, 6) passait devant 3, 5, 85, 40, 38 15 => (1, 36, 85, 0), 98 => (1, 85, 5, 3), 99 => (85, 36, 38, 40), 100 => (6, 3, 5, 0), 101 => (40, 38, 41, 0), 16 => (6, 5, 8, 9), 17 => (40, 41, 44, 43), -- appui vitre 18 => (36, 37, 39, 38), 19 => (38, 39, 42, 41), 20 => (41, 42, 45, 44), 21 => (44, 45, 47, 46), 22 => (46, 47, 51, 49), 23 => (49, 51, 50, 54), -- zebr hd -- 24 => (48, 49, 56, 58) passait devant 52 24 => (52, 49, 56, 58), 95 => (48, 49, 52, 0), 25 => (61, 18, 78, 26), -- sous 27 26 => (20, 76, 78, 18), -- sous 24 27 => (56, 60, 62, 58), 28 => (62, 66, 65, 58), 29 => (60, 67, 66, 62), -- fusel hd 30 => (35, 32, 87, 82), -- react. g. 31 => (17, 52, 58, 23), -- centre h 32 => (32, 67, 89, 87), -- react d. 33 => (23, 58, 65, 33), 34 => (13, 48, 52, 17), -- 35 => (33, 30, 31, 34), 36 => (30, 65, 66, 31), -- face 31 passait devant 30 35 => (33, 0, 31, 34), 36 => (0, 65, 66, 31), 96 => (33, 65, 31, 0), 37 => (34, 31, 32, 35), 38 => (31, 66, 67, 32), -- arr. react h 39 => (60, 59, 64, 67), -- aile hd -- 40 => (60, 56, 18, 61) passait devant 57 40 => (60, 56, 57, 0), 92 => (61, 60, 57, 0), 93 => (61, 57, 18, 0), 41 => (14, 8, 96, 13), 42 => (13, 96, 97, 48), 43 => (97, 43, 49, 48), -- cockpit 44 => (68, 2, 4, 69), 45 => (69, 4, 7, 70), 46 => (70, 7, 10, 71), 47 => (71, 10, 12, 72), 48 => (72, 12, 16, 73), 49 => (73, 16, 15, 19), -- zebr bg 50 => (19, 22, 74, 73), 51 => (73, 74, 77, 75), 52 => (76, 75, 77, 78), 53 => (64, 59, 92, 90), 54 => (77, 74, 79, 80), 55 => (77, 80, 83, 84), 56 => (80, 79, 82, 83), -- aile bg 57 => (79, 25, 24, 28), 58 => (24, 29, 81, 28), 59 => (29, 35, 82, 81), 60 => (87, 86, 83, 82), 61 => (87, 89, 88, 86), -- 62 => (86, 85, 84, 83), 63 => (86, 88, 91, 85) face 78 passait devant 85 62 => (86, 0, 84, 83), 63 => (86, 88, 91, 0), 97 => (84, 86, 91, 0), 64 => (67, 64, 90, 89), 65 => (60, 61, 92, 59), 66 => (92, 61, 89, 90), -- aile bd 67 => (61, 26, 88, 89), 68 => (18, 57, 54, 20), 69 => (54, 50, 51, 20), 70 => (20, 51, 47, 53), 71 => (53, 47, 45, 55), 72 => (45, 42, 93, 55), 73 => (42, 39, 94, 93), 74 => (39, 37, 95, 94), -- zebr bd 75 => (5, 85, 96, 8), 76 => (85, 40, 43, 97), -- lucarnes cockpit 77 => (82, 79, 28, 81), -- sous aile g 78 => (84, 91, 78, 77), -- sous 33:rc 79 => (91, 88, 26, 78), -- sous 28 80 => (75, 76, 20, 73), -- "entree air" 81 => (73, 20, 93, 70), -- sous cockpit 82 => (70, 93, 95, 68), -- sous l'avant 83 => (1, 2, 68, 30), 84 => (30, 68, 95, 63), -- nez 85 => (63, 95, 37, 36), 86 => (63, 36, 1, 30), -- nez 87 => (9, 8, 14, 0), 88 => (43, 44, 49, 0), -- triangles plateau cockpit cf 16, 17 89 => (96, 85, 97, 0) -- triangle pointe cockpit devant 42 ); coords : constant array (1 .. 97, 0 .. 2) of Integer := (1 => ( - 10, 360, 10), 2 => ( - 20, 360, 0), 3 => ( - 20, 330, 12), 4 => ( - 30, 330, 0), 5 => ( - 10, 300, 14), 6 => ( - 30, 300, 14), 7 => ( - 40, 300, 0), 8 => ( - 20, 270, 16), 9 => ( - 30, 270, 16), 10 => ( - 50, 270, 0), 11 => ( - 30, 240, 18), 12 => ( - 60, 240, 0), 13 => ( - 20, 220, 30), 14 => ( - 30, 210, 20), 15 => ( - 40, 200, 0), 16 => ( - 70, 210, 0), 17 => ( - 20, 200, 30), 18 => (30, 120, - 20), 19 => ( - 31, 200, 0), 20 => (30, 210, - 20), 21 => ( - 30, 120, 20), 22 => ( - 31, 120, 0), 23 => ( - 20, 110, 30), 24 => ( - 110, 110, 1), 25 => ( - 50, 100, 1), 26 => (40, 90, - 10), 27 => ( - 40, 90, 10), 28 => ( - 110, 110, - 1), 29 => ( - 120, 50, 1), -- 30 => (0, 7, 40), 31 => (0, 0, 20), 32 => (0, 0, 10), 33 => ( - 20, 7, 40), 34 => ( - 40, 0, 10), 35 => ( - 60, 0, 2), -- fin hg 36 => (10, 360, 10), 37 => (20, 360, 0), 38 => (20, 330, 12), 39 => (30, 330, 0), 40 => (10, 300, 14), 41 => (30, 300, 14), 42 => (40, 300, 0), 43 => (20, 270, 16), 44 => (30, 270, 16), 45 => (50, 270, 0), 46 => (30, 240, 18), 47 => (60, 240, 0), 48 => (20, 220, 30), 49 => (30, 210, 20), 50 => (40, 200, 0), 51 => (70, 210, 0), 52 => (20, 200, 30), 53 => (30, 240, - 18), 54 => (31, 200, 0), 55 => (30, 270, - 16), 56 => (30, 120, 20), 57 => (31, 120, 0), 58 => (20, 110, 30), 59 => (110, 110, 1), 60 => (50, 100, 1), 61 => (50, 100, - 1), 62 => (40, 90, 10), 63 => (4, 366, 0), 64 => (120, 50, 1), 65 => (20, 7, 40), 66 => (40, 0, 10), 67 => (60, 0, 2), -- fin hd 68 => ( - 10, 360, - 10), -- debut bas g 69 => ( - 20, 330, - 12), 70 => ( - 30, 300, - 14), 71 => ( - 30, 270, - 16), 72 => ( - 30, 240, - 18), 73 => ( - 30, 210, - 20), 74 => ( - 30, 120, - 20), 75 => ( - 20, 210, - 30), 76 => (20, 210, - 30), 77 => ( - 20, 110, - 30), 78 => (20, 110, - 30), 79 => ( - 50, 100, - 1), 80 => ( - 40, 80, - 10), 81 => ( - 120, 50, - 1), 82 => ( - 60, 0, - 2), 83 => ( - 40, 0, - 10), 84 => ( - 20, 7, - 40), -- 85 => (0, 7, - 40), 86 => (0, 0, - 20), 87 => (0, 0, - 10), 88 => (40, 0, - 10), 89 => (60, 0, - 2), 90 => (120, 50, - 1), 91 => (20, 7, - 40), 92 => (110, 110, - 1), 93 => (30, 300, - 14), 94 => (20, 330, - 12), 95 => (10, 360, - 10), 96 => ( - 10, 270, 17), 97 => (10, 270, 17), 30 => ( - 4, 366, 0), 85 => (0, 300, 14) ); colour : GL.RGB_Color; corr : constant Vector_3D := (0.0, 160.0, 0.0); face_0 : Face_type; -- takes defaults values begin face_0.skin := colour_only; object := new Object_3D (Max_points => 97, Max_faces => polys'Length (1)); for i in coords'Range loop for d in Point_3D'Range loop object.point (i) (d) := scale * 0.1 * (Real (coords (i, d)) - corr (d)); end loop; end loop; for i in polys'Range (1) loop case i is when 2|4|6|19|21|23|44|46|48|70|72|74 => colour := (1.0, 1.0, 0.1); -- jaune --matos := very_bright; when 1|3|5|18|20|22|45|47|49|69|71|73 => colour := (0.1, 0.1, 0.5); -- bleu f. --matos := very_bright; when 34 => colour := (0.3, 0.11, 0.11); -- rouge --matos := neutral; when 41 .. 43|75|76|89 => colour := (0.13, 0.2, 0.2); -- vitre cockpit --matos := very_bright; when 30|32 => colour := (1.0, 0.8, 0.1); -- orange --matos := neutral; when 83 .. 86 => colour := (0.1, 0.2, 0.4); -- museau --matos := neutral; when others => colour := (0.8, 0.8, 1.0); -- caisse --matos := bright; end case; face_0.colour := colour; face_0.P := (polys (i, 1), polys (i, 4), polys (i, 3), polys (i, 2)); object.face (i) := face_0; end loop; object.centre := centre; Set_name (object.all, "vehicle_001"); end Create; end Vehic001;
[ { "context": "generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n--\n-- OpenAPI spec version: 2", "end": 121, "score": 0.9995419979095459, "start": 109, "tag": "USERNAME", "value": "openapitools" }, { "context": " Username : Swagger.UString;\n Password : Swagger.UString;\n end record;\n\n package AuthenticationReque", "end": 10909, "score": 0.8151741027832031, "start": 10894, "tag": "PASSWORD", "value": "Swagger.UString" }, { "context": "meProfile_Type_Vectors.Vector);\n\n\n\nend com.github.asyncmc.mojang.authentication.ada.model.Models;\n", "end": 14270, "score": 0.7340672016143799, "start": 14263, "tag": "USERNAME", "value": "asyncmc" } ]
generated-sources/ada/mojang-authentication/src/model/com-github-asyncmc-mojang-authentication-ada-model-models.ads
AsyncMC/Mojang-API-Libs
0
-- Mojang Authentication API -- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) -- -- OpenAPI spec version: 2020_06_05 -- -- -- NOTE: This package is auto generated by the swagger code generator 3.3.4. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package com.github.asyncmc.mojang.authentication.ada.model.Models is type Error_Type is record Error : Swagger.Nullable_UString; Error_Message : Swagger.Nullable_UString; end record; package Error_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Error_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type_Vectors.Vector); type GameProfileProperty_Type is record Name : Swagger.Nullable_UString; Value : Swagger.Nullable_UString; end record; package GameProfileProperty_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => GameProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfileProperty_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfileProperty_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfileProperty_Type_Vectors.Vector); type PrivateUserData_Type is record Id : Swagger.Nullable_UString; Properties : com.github.asyncmc.mojang.authentication.ada.model.Models.GameProfileProperty_Type_Vectors.Vector; end record; package PrivateUserData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PrivateUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PrivateUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PrivateUserData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PrivateUserData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PrivateUserData_Type_Vectors.Vector); type ReducedUserData_Type is record Id : Swagger.Nullable_UString; Properties : com.github.asyncmc.mojang.authentication.ada.model.Models.GameProfileProperty_Type_Vectors.Vector; end record; package ReducedUserData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ReducedUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ReducedUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ReducedUserData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ReducedUserData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ReducedUserData_Type_Vectors.Vector); type Agent_Type is record Name : Swagger.Nullable_UString; Version : Swagger.Nullable_Integer; end record; package Agent_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Agent_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type_Vectors.Vector); type ProfileId_Type is record Id : Swagger.UString; Name : Swagger.UString; end record; package ProfileId_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ProfileId_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ProfileId_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ProfileId_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ProfileId_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ProfileId_Type_Vectors.Vector); type RefreshRequest_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package RefreshRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RefreshRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshRequest_Type_Vectors.Vector); type AccessKeys_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package AccessKeys_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => AccessKeys_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AccessKeys_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AccessKeys_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AccessKeys_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AccessKeys_Type_Vectors.Vector); type UsernamePassword_Type is record Username : Swagger.UString; Password : Swagger.UString; end record; package UsernamePassword_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => UsernamePassword_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UsernamePassword_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UsernamePassword_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UsernamePassword_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UsernamePassword_Type_Vectors.Vector); type RefreshResponse_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package RefreshResponse_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RefreshResponse_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshResponse_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshResponse_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshResponse_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshResponse_Type_Vectors.Vector); type AuthenticationRequest_Type is record Username : Swagger.UString; Password : Swagger.UString; end record; package AuthenticationRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => AuthenticationRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AuthenticationRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AuthenticationRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AuthenticationRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AuthenticationRequest_Type_Vectors.Vector); type Authentication_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package Authentication_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Authentication_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Authentication_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Authentication_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Authentication_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Authentication_Type_Vectors.Vector); type GameProfile_Type is record Agent : Swagger.Nullable_UString; Id : Swagger.Nullable_UString; Name : Swagger.Nullable_UString; User_Id : Swagger.Nullable_UString; Created_At : Swagger.Nullable_Long; Legacy_Profile : Swagger.Nullable_Boolean; Suspended : Swagger.Nullable_Boolean; Paid : Swagger.Nullable_Boolean; Migrated : Swagger.Nullable_Boolean; Legacy : Swagger.Nullable_Boolean; end record; package GameProfile_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => GameProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfile_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfile_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfile_Type_Vectors.Vector); end com.github.asyncmc.mojang.authentication.ada.model.Models;
885
-- Mojang Authentication API -- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) -- -- OpenAPI spec version: 2020_06_05 -- -- -- NOTE: This package is auto generated by the swagger code generator 3.3.4. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package com.github.asyncmc.mojang.authentication.ada.model.Models is type Error_Type is record Error : Swagger.Nullable_UString; Error_Message : Swagger.Nullable_UString; end record; package Error_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Error_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type_Vectors.Vector); type GameProfileProperty_Type is record Name : Swagger.Nullable_UString; Value : Swagger.Nullable_UString; end record; package GameProfileProperty_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => GameProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfileProperty_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfileProperty_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfileProperty_Type_Vectors.Vector); type PrivateUserData_Type is record Id : Swagger.Nullable_UString; Properties : com.github.asyncmc.mojang.authentication.ada.model.Models.GameProfileProperty_Type_Vectors.Vector; end record; package PrivateUserData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PrivateUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PrivateUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PrivateUserData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PrivateUserData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PrivateUserData_Type_Vectors.Vector); type ReducedUserData_Type is record Id : Swagger.Nullable_UString; Properties : com.github.asyncmc.mojang.authentication.ada.model.Models.GameProfileProperty_Type_Vectors.Vector; end record; package ReducedUserData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ReducedUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ReducedUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ReducedUserData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ReducedUserData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ReducedUserData_Type_Vectors.Vector); type Agent_Type is record Name : Swagger.Nullable_UString; Version : Swagger.Nullable_Integer; end record; package Agent_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Agent_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type_Vectors.Vector); type ProfileId_Type is record Id : Swagger.UString; Name : Swagger.UString; end record; package ProfileId_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ProfileId_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ProfileId_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ProfileId_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ProfileId_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ProfileId_Type_Vectors.Vector); type RefreshRequest_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package RefreshRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RefreshRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshRequest_Type_Vectors.Vector); type AccessKeys_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package AccessKeys_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => AccessKeys_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AccessKeys_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AccessKeys_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AccessKeys_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AccessKeys_Type_Vectors.Vector); type UsernamePassword_Type is record Username : Swagger.UString; Password : Swagger.UString; end record; package UsernamePassword_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => UsernamePassword_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UsernamePassword_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UsernamePassword_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UsernamePassword_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UsernamePassword_Type_Vectors.Vector); type RefreshResponse_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package RefreshResponse_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RefreshResponse_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshResponse_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshResponse_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshResponse_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshResponse_Type_Vectors.Vector); type AuthenticationRequest_Type is record Username : Swagger.UString; Password : <PASSWORD>; end record; package AuthenticationRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => AuthenticationRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AuthenticationRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AuthenticationRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AuthenticationRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AuthenticationRequest_Type_Vectors.Vector); type Authentication_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package Authentication_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Authentication_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Authentication_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Authentication_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Authentication_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Authentication_Type_Vectors.Vector); type GameProfile_Type is record Agent : Swagger.Nullable_UString; Id : Swagger.Nullable_UString; Name : Swagger.Nullable_UString; User_Id : Swagger.Nullable_UString; Created_At : Swagger.Nullable_Long; Legacy_Profile : Swagger.Nullable_Boolean; Suspended : Swagger.Nullable_Boolean; Paid : Swagger.Nullable_Boolean; Migrated : Swagger.Nullable_Boolean; Legacy : Swagger.Nullable_Boolean; end record; package GameProfile_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => GameProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfile_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfile_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfile_Type_Vectors.Vector); end com.github.asyncmc.mojang.authentication.ada.model.Models;
true
-- Mojang Authentication API -- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) -- -- OpenAPI spec version: 2020_06_05 -- -- -- NOTE: This package is auto generated by the swagger code generator 3.3.4. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package com.github.asyncmc.mojang.authentication.ada.model.Models is type Error_Type is record Error : Swagger.Nullable_UString; Error_Message : Swagger.Nullable_UString; end record; package Error_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Error_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Error_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Error_Type_Vectors.Vector); type GameProfileProperty_Type is record Name : Swagger.Nullable_UString; Value : Swagger.Nullable_UString; end record; package GameProfileProperty_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => GameProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfileProperty_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfileProperty_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfileProperty_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfileProperty_Type_Vectors.Vector); type PrivateUserData_Type is record Id : Swagger.Nullable_UString; Properties : com.github.asyncmc.mojang.authentication.ada.model.Models.GameProfileProperty_Type_Vectors.Vector; end record; package PrivateUserData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => PrivateUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PrivateUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PrivateUserData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PrivateUserData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PrivateUserData_Type_Vectors.Vector); type ReducedUserData_Type is record Id : Swagger.Nullable_UString; Properties : com.github.asyncmc.mojang.authentication.ada.model.Models.GameProfileProperty_Type_Vectors.Vector; end record; package ReducedUserData_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ReducedUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ReducedUserData_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ReducedUserData_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ReducedUserData_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ReducedUserData_Type_Vectors.Vector); type Agent_Type is record Name : Swagger.Nullable_UString; Version : Swagger.Nullable_Integer; end record; package Agent_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Agent_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Agent_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Agent_Type_Vectors.Vector); type ProfileId_Type is record Id : Swagger.UString; Name : Swagger.UString; end record; package ProfileId_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => ProfileId_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ProfileId_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ProfileId_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ProfileId_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ProfileId_Type_Vectors.Vector); type RefreshRequest_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package RefreshRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RefreshRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshRequest_Type_Vectors.Vector); type AccessKeys_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package AccessKeys_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => AccessKeys_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AccessKeys_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AccessKeys_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AccessKeys_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AccessKeys_Type_Vectors.Vector); type UsernamePassword_Type is record Username : Swagger.UString; Password : Swagger.UString; end record; package UsernamePassword_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => UsernamePassword_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UsernamePassword_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in UsernamePassword_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UsernamePassword_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out UsernamePassword_Type_Vectors.Vector); type RefreshResponse_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package RefreshResponse_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => RefreshResponse_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshResponse_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in RefreshResponse_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshResponse_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out RefreshResponse_Type_Vectors.Vector); type AuthenticationRequest_Type is record Username : Swagger.UString; Password : PI:PASSWORD:<PASSWORD>END_PI; end record; package AuthenticationRequest_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => AuthenticationRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AuthenticationRequest_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in AuthenticationRequest_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AuthenticationRequest_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out AuthenticationRequest_Type_Vectors.Vector); type Authentication_Type is record Access_Token : Swagger.UString; Client_Token : Swagger.Nullable_UString; end record; package Authentication_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Authentication_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Authentication_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Authentication_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Authentication_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Authentication_Type_Vectors.Vector); type GameProfile_Type is record Agent : Swagger.Nullable_UString; Id : Swagger.Nullable_UString; Name : Swagger.Nullable_UString; User_Id : Swagger.Nullable_UString; Created_At : Swagger.Nullable_Long; Legacy_Profile : Swagger.Nullable_Boolean; Suspended : Swagger.Nullable_Boolean; Paid : Swagger.Nullable_Boolean; Migrated : Swagger.Nullable_Boolean; Legacy : Swagger.Nullable_Boolean; end record; package GameProfile_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => GameProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfile_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in GameProfile_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfile_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out GameProfile_Type_Vectors.Vector); end com.github.asyncmc.mojang.authentication.ada.model.Models;
[ { "context": "hts reserved.\n--\n-- This software was developed by John Self of the Arcadia project\n-- at the University of Ca", "end": 133, "score": 0.9998612403869629, "start": 124, "tag": "NAME", "value": "John Self" }, { "context": "SE.\n\n-- TITLE DFA construction routines\n-- AUTHOR: John Self (UCI)\n-- DESCRIPTION converts non-deterministic f", "end": 982, "score": 0.9998730421066284, "start": 973, "tag": "NAME", "value": "John Self" } ]
lib/aflexnat/dfa.adb
alvaromb/Compilemon
1
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by John Self of the Arcadia project -- at the University of California, Irvine. -- -- 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. -- TITLE DFA construction routines -- AUTHOR: John Self (UCI) -- DESCRIPTION converts non-deterministic finite automatons to finite ones. -- $Header: /dc/uc/self/tmp/gnat_aflex/RCS/dfa.adb,v 1.1 1995/07/04 20:18:39 self Exp self $ with dfa, int_io, misc_defs, text_io, misc, tblcmp, ccl, external_file_manager; with ecs, nfa, tstring, gen, skeleton_manager; use misc_defs, external_file_manager; package body dfa is use TSTRING; -- check_for_backtracking - check a DFA state for backtracking -- -- ds is the number of the state to check and state[) is its out-transitions, -- indexed by equivalence class, and state_rules[) is the set of rules -- associated with this state DID_STK_INIT : BOOLEAN := FALSE; STK : INT_PTR; procedure CHECK_FOR_BACKTRACKING(DS : in INTEGER; STATE : in UNBOUNDED_INT_ARRAY) is use MISC_DEFS; begin if (DFAACC(DS).DFAACC_STATE = 0) then -- state is non-accepting NUM_BACKTRACKING := NUM_BACKTRACKING + 1; if (BACKTRACK_REPORT) then TEXT_IO.PUT(BACKTRACK_FILE, "State #"); INT_IO.PUT(BACKTRACK_FILE, DS, 1); TEXT_IO.PUT(BACKTRACK_FILE, "is non-accepting -"); TEXT_IO.NEW_LINE(BACKTRACK_FILE); -- identify the state DUMP_ASSOCIATED_RULES(BACKTRACK_FILE, DS); -- now identify it further using the out- and jam-transitions DUMP_TRANSITIONS(BACKTRACK_FILE, STATE); TEXT_IO.NEW_LINE(BACKTRACK_FILE); end if; end if; end CHECK_FOR_BACKTRACKING; -- check_trailing_context - check to see if NFA state set constitutes -- "dangerous" trailing context -- -- NOTES -- Trailing context is "dangerous" if both the head and the trailing -- part are of variable size \and/ there's a DFA state which contains -- both an accepting state for the head part of the rule and NFA states -- which occur after the beginning of the trailing context. -- When such a rule is matched, it's impossible to tell if having been -- in the DFA state indicates the beginning of the trailing context -- or further-along scanning of the pattern. In these cases, a warning -- message is issued. -- -- nfa_states[1 .. num_states) is the list of NFA states in the DFA. -- accset[1 .. nacc) is the list of accepting numbers for the DFA state. procedure CHECK_TRAILING_CONTEXT(NFA_STATES : in INT_PTR; NUM_STATES : in INTEGER; ACCSET : in INT_PTR; NACC : in INTEGER) is NS, AR : INTEGER; STATE_VAR, TYPE_VAR : STATE_ENUM; use MISC_DEFS, MISC, TEXT_IO; begin for I in 1 .. NUM_STATES loop NS := NFA_STATES(I); TYPE_VAR := STATE_TYPE(NS); AR := ASSOC_RULE(NS); if ((TYPE_VAR = STATE_NORMAL) or (RULE_TYPE(AR) /= RULE_VARIABLE)) then null; -- do nothing else if (TYPE_VAR = STATE_TRAILING_CONTEXT) then -- potential trouble. Scan set of accepting numbers for -- the one marking the end of the "head". We assume that -- this looping will be fairly cheap since it's rare that -- an accepting number set is large. for J in 1 .. NACC loop if (CHECK_YY_TRAILING_HEAD_MASK(ACCSET(J)) /= 0) then TEXT_IO.PUT(STANDARD_ERROR, "aflex: Dangerous trailing context in rule at line "); INT_IO.PUT(STANDARD_ERROR, RULE_LINENUM(AR), 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); return; end if; end loop; end if; end if; end loop; end CHECK_TRAILING_CONTEXT; -- dump_associated_rules - list the rules associated with a DFA state -- -- goes through the set of NFA states associated with the DFA and -- extracts the first MAX_ASSOC_RULES unique rules, sorts them, -- and writes a report to the given file procedure DUMP_ASSOCIATED_RULES(F : in FILE_TYPE; DS : in INTEGER) is J : INTEGER; NUM_ASSOCIATED_RULES : INTEGER := 0; RULE_SET : INT_PTR; SIZE, RULE_NUM : INTEGER; begin RULE_SET := new UNBOUNDED_INT_ARRAY(0 .. MAX_ASSOC_RULES + 1); SIZE := DFASIZ(DS); for I in 1 .. SIZE loop RULE_NUM := RULE_LINENUM(ASSOC_RULE(DSS(DS)(I))); J := 1; while (J <= NUM_ASSOCIATED_RULES) loop if (RULE_NUM = RULE_SET(J)) then exit; end if; J := J + 1; end loop; if (J > NUM_ASSOCIATED_RULES) then --new rule if (NUM_ASSOCIATED_RULES < MAX_ASSOC_RULES) then NUM_ASSOCIATED_RULES := NUM_ASSOCIATED_RULES + 1; RULE_SET(NUM_ASSOCIATED_RULES) := RULE_NUM; end if; end if; end loop; MISC.BUBBLE(RULE_SET, NUM_ASSOCIATED_RULES); TEXT_IO.PUT(F, " associated rules:"); for I in 1 .. NUM_ASSOCIATED_RULES loop if (I mod 8 = 1) then TEXT_IO.NEW_LINE(F); end if; TEXT_IO.PUT(F, ASCII.HT); INT_IO.PUT(F, RULE_SET(I), 1); end loop; TEXT_IO.NEW_LINE(F); exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in dump_associated_rules()"); end DUMP_ASSOCIATED_RULES; -- dump_transitions - list the transitions associated with a DFA state -- -- goes through the set of out-transitions and lists them in human-readable -- form (i.e., not as equivalence classes); also lists jam transitions -- (i.e., all those which are not out-transitions, plus EOF). The dump -- is done to the given file. procedure DUMP_TRANSITIONS(F : in FILE_TYPE; STATE : in UNBOUNDED_INT_ARRAY) is EC : INTEGER; OUT_CHAR_SET : C_SIZE_BOOL_ARRAY; begin for I in 1 .. CSIZE loop EC := ECGROUP(I); if (EC < 0) then EC := -EC; end if; OUT_CHAR_SET(I) := (STATE(EC) /= 0); end loop; TEXT_IO.PUT(F, " out-transitions: "); CCL.LIST_CHARACTER_SET(F, OUT_CHAR_SET); -- now invert the members of the set to get the jam transitions for I in 1 .. CSIZE loop OUT_CHAR_SET(I) := not OUT_CHAR_SET(I); end loop; TEXT_IO.NEW_LINE(F); TEXT_IO.PUT(F, "jam-transitions: EOF "); CCL.LIST_CHARACTER_SET(F, OUT_CHAR_SET); TEXT_IO.NEW_LINE(F); end DUMP_TRANSITIONS; -- epsclosure - construct the epsilon closure of a set of ndfa states -- -- NOTES -- the epsilon closure is the set of all states reachable by an arbitrary -- number of epsilon transitions which themselves do not have epsilon -- transitions going out, unioned with the set of states which have non-null -- accepting numbers. t is an array of size numstates of nfa state numbers. -- Upon return, t holds the epsilon closure and numstates is updated. accset -- holds a list of the accepting numbers, and the size of accset is given -- by nacc. t may be subjected to reallocation if it is not large enough -- to hold the epsilon closure. -- -- hashval is the hash value for the dfa corresponding to the state set procedure EPSCLOSURE(T : in out INT_PTR; NS_ADDR : in out INTEGER; ACCSET : in out INT_PTR; NACC_ADDR, HV_ADDR : out INTEGER; RESULT : out INT_PTR) is NS, TSP : INTEGER; NUMSTATES, NACC, HASHVAL, TRANSSYM, NFACCNUM : INTEGER; STKEND : INTEGER; STKPOS : INTEGER; procedure MARK_STATE(STATE : in INTEGER) is begin TRANS1(STATE) := TRANS1(STATE) - MARKER_DIFFERENCE; end MARK_STATE; pragma INLINE(MARK_STATE); function IS_MARKED(STATE : in INTEGER) return BOOLEAN is begin return TRANS1(STATE) < 0; end IS_MARKED; pragma INLINE(IS_MARKED); procedure UNMARK_STATE(STATE : in INTEGER) is begin TRANS1(STATE) := TRANS1(STATE) + MARKER_DIFFERENCE; end UNMARK_STATE; pragma INLINE(UNMARK_STATE); procedure CHECK_ACCEPT(STATE : in INTEGER) is begin NFACCNUM := ACCPTNUM(STATE); if (NFACCNUM /= NIL) then NACC := NACC + 1; ACCSET(NACC) := NFACCNUM; end if; end CHECK_ACCEPT; pragma INLINE(CHECK_ACCEPT); procedure DO_REALLOCATION is begin CURRENT_MAX_DFA_SIZE := CURRENT_MAX_DFA_SIZE + MAX_DFA_SIZE_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(T, CURRENT_MAX_DFA_SIZE); REALLOCATE_INTEGER_ARRAY(STK, CURRENT_MAX_DFA_SIZE); end DO_REALLOCATION; pragma INLINE(DO_REALLOCATION); procedure PUT_ON_STACK(STATE : in INTEGER) is begin STKEND := STKEND + 1; if (STKEND >= CURRENT_MAX_DFA_SIZE) then DO_REALLOCATION; end if; STK(STKEND) := STATE; MARK_STATE(STATE); end PUT_ON_STACK; pragma INLINE(PUT_ON_STACK); procedure ADD_STATE(STATE : in INTEGER) is begin NUMSTATES := NUMSTATES + 1; if (NUMSTATES >= CURRENT_MAX_DFA_SIZE) then DO_REALLOCATION; end if; T(NUMSTATES) := STATE; HASHVAL := HASHVAL + STATE; end ADD_STATE; pragma INLINE(ADD_STATE); procedure STACK_STATE(STATE : in INTEGER) is begin PUT_ON_STACK(STATE); CHECK_ACCEPT(STATE); if ((NFACCNUM /= NIL) or (TRANSCHAR(STATE) /= SYM_EPSILON)) then ADD_STATE(STATE); end if; end STACK_STATE; pragma INLINE(STACK_STATE); begin NUMSTATES := NS_ADDR; if (not DID_STK_INIT) then STK := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFA_SIZE); DID_STK_INIT := TRUE; end if; NACC := 0; STKEND := 0; HASHVAL := 0; for NSTATE in 1 .. NUMSTATES loop NS := T(NSTATE); -- the state could be marked if we've already pushed it onto -- the stack if (not IS_MARKED(NS)) then PUT_ON_STACK(NS); null; end if; CHECK_ACCEPT(NS); HASHVAL := HASHVAL + NS; end loop; STKPOS := 1; while (STKPOS <= STKEND) loop NS := STK(STKPOS); TRANSSYM := TRANSCHAR(NS); if (TRANSSYM = SYM_EPSILON) then TSP := TRANS1(NS) + MARKER_DIFFERENCE; if (TSP /= NO_TRANSITION) then if (not IS_MARKED(TSP)) then STACK_STATE(TSP); end if; TSP := TRANS2(NS); if (TSP /= NO_TRANSITION) then if (not IS_MARKED(TSP)) then STACK_STATE(TSP); end if; end if; end if; end if; STKPOS := STKPOS + 1; end loop; -- clear out "visit" markers for CHK_STKPOS in 1 .. STKEND loop if (IS_MARKED(STK(CHK_STKPOS))) then UNMARK_STATE(STK(CHK_STKPOS)); else MISC.AFLEXFATAL("consistency check failed in epsclosure()"); end if; end loop; NS_ADDR := NUMSTATES; HV_ADDR := HASHVAL; NACC_ADDR := NACC; RESULT := T; end EPSCLOSURE; -- increase_max_dfas - increase the maximum number of DFAs procedure INCREASE_MAX_DFAS is begin CURRENT_MAX_DFAS := CURRENT_MAX_DFAS + MAX_DFAS_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(BASE, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DEF, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DFASIZ, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(ACCSIZ, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DHASH, CURRENT_MAX_DFAS); REALLOCATE_INT_PTR_ARRAY(DSS, CURRENT_MAX_DFAS); REALLOCATE_DFAACC_UNION(DFAACC, CURRENT_MAX_DFAS); end INCREASE_MAX_DFAS; -- ntod - convert an ndfa to a dfa -- -- creates the dfa corresponding to the ndfa we've constructed. the -- dfa starts out in state #1. procedure NTOD is ACCSET : INT_PTR; DS, NACC, NEWDS : INTEGER; DUPLIST, TARGFREQ, TARGSTATE, STATE : C_SIZE_ARRAY; SYMLIST : C_SIZE_BOOL_ARRAY; HASHVAL, NUMSTATES, DSIZE : INTEGER; NSET, DSET : INT_PTR; TARGPTR, TOTALTRANS, I, J, COMSTATE, COMFREQ, TARG : INTEGER; NUM_START_STATES, TODO_HEAD, TODO_NEXT : INTEGER; SNSRESULT : BOOLEAN; FULL_TABLE_TEMP_FILE : FILE_TYPE; BUF : VSTRING; NUM_NXT_STATES : INTEGER; use TEXT_IO; -- this is so find_table_space(...) will know where to start looking in -- chk/nxt for unused records for space to put in the state begin ACCSET := ALLOCATE_INTEGER_ARRAY(NUM_RULES + 1); NSET := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFA_SIZE); -- the "todo" queue is represented by the head, which is the DFA -- state currently being processed, and the "next", which is the -- next DFA state number available (not in use). We depend on the -- fact that snstods() returns DFA's \in increasing order/, and thus -- need only know the bounds of the dfas to be processed. TODO_HEAD := 0; TODO_NEXT := 0; for CNT in 0 .. CSIZE loop DUPLIST(CNT) := NIL; SYMLIST(CNT) := FALSE; end loop; for CNT in 0 .. NUM_RULES loop ACCSET(CNT) := NIL; end loop; if (TRACE) then NFA.DUMPNFA(SCSET(1)); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.PUT(STANDARD_ERROR, "DFA Dump:"); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; TBLCMP.INITTBL; if (FULLTBL) then GEN.DO_SECT3_OUT; -- output user code up to ## SKELETON_MANAGER.SKELOUT; -- declare it "short" because it's a real long-shot that that -- won't be large enough begin -- make a temporary file to write yy_nxt array into CREATE(FULL_TABLE_TEMP_FILE, OUT_FILE); exception when USE_ERROR | NAME_ERROR => MISC.AFLEXFATAL("can't create temporary file"); end; NUM_NXT_STATES := 1; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, "( "); -- generate 0 entries for state #0 for CNT in 0 .. NUMECS loop MISC.MK2DATA(FULL_TABLE_TEMP_FILE, 0); end loop; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, " )"); -- force extra blank line next dataflush() DATALINE := NUMDATALINES; end if; -- create the first states NUM_START_STATES := LASTSC*2; for CNT in 1 .. NUM_START_STATES loop NUMSTATES := 1; -- for each start condition, make one state for the case when -- we're at the beginning of the line (the '%' operator) and -- one for the case when we're not if (CNT mod 2 = 1) then NSET(NUMSTATES) := SCSET((CNT/2) + 1); else NSET(NUMSTATES) := NFA.MKBRANCH(SCBOL(CNT/2), SCSET(CNT/2)); end if; DFA.EPSCLOSURE(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NSET); SNSTODS(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, DS, SNSRESULT); if (SNSRESULT) then NUMAS := NUMAS + NACC; TOTNST := TOTNST + NUMSTATES; TODO_NEXT := TODO_NEXT + 1; if (VARIABLE_TRAILING_CONTEXT_RULES and (NACC > 0)) then CHECK_TRAILING_CONTEXT(NSET, NUMSTATES, ACCSET, NACC); end if; end if; end loop; SNSTODS(NSET, 0, ACCSET, 0, 0, END_OF_BUFFER_STATE, SNSRESULT); if (not SNSRESULT) then MISC.AFLEXFATAL("could not create unique end-of-buffer state"); end if; NUMAS := NUMAS + 1; NUM_START_STATES := NUM_START_STATES + 1; TODO_NEXT := TODO_NEXT + 1; while (TODO_HEAD < TODO_NEXT) loop NUM_NXT_STATES := NUM_NXT_STATES + 1; TARGPTR := 0; TOTALTRANS := 0; for STATE_CNT in 1 .. NUMECS loop STATE(STATE_CNT) := 0; end loop; TODO_HEAD := TODO_HEAD + 1; DS := TODO_HEAD; DSET := DSS(DS); DSIZE := DFASIZ(DS); if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, "state # "); INT_IO.PUT(STANDARD_ERROR, DS, 1); TEXT_IO.PUT_LINE(STANDARD_ERROR, ":"); end if; SYMPARTITION(DSET, DSIZE, SYMLIST, DUPLIST); for SYM in 1 .. NUMECS loop if (SYMLIST(SYM)) then SYMLIST(SYM) := FALSE; if (DUPLIST(SYM) = NIL) then -- symbol has unique out-transitions NUMSTATES := SYMFOLLOWSET(DSET, DSIZE, SYM, NSET); DFA.EPSCLOSURE(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NSET); SNSTODS(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NEWDS, SNSRESULT); if (SNSRESULT) then TOTNST := TOTNST + NUMSTATES; TODO_NEXT := TODO_NEXT + 1; NUMAS := NUMAS + NACC; if (VARIABLE_TRAILING_CONTEXT_RULES and (NACC > 0)) then CHECK_TRAILING_CONTEXT(NSET, NUMSTATES, ACCSET, NACC); end if; end if; STATE(SYM) := NEWDS; if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, SYM, 1); TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, NEWDS, 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; TARGPTR := TARGPTR + 1; TARGFREQ(TARGPTR) := 1; TARGSTATE(TARGPTR) := NEWDS; NUMUNIQ := NUMUNIQ + 1; else -- sym's equivalence class has the same transitions -- as duplist(sym)'s equivalence class TARG := STATE(DUPLIST(SYM)); STATE(SYM) := TARG; if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, SYM, 1); TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, TARG, 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; -- update frequency count for destination state I := 1; while (TARGSTATE(I) /= TARG) loop I := I + 1; end loop; TARGFREQ(I) := TARGFREQ(I) + 1; NUMDUP := NUMDUP + 1; end if; TOTALTRANS := TOTALTRANS + 1; DUPLIST(SYM) := NIL; end if; end loop; NUMSNPAIRS := NUMSNPAIRS + TOTALTRANS; if (CASEINS and not USEECS) then I := CHARACTER'POS('A'); J := CHARACTER'POS('a'); while (I < CHARACTER'POS('Z')) loop STATE(I) := STATE(J); I := I + 1; J := J + 1; end loop; end if; if (DS > NUM_START_STATES) then CHECK_FOR_BACKTRACKING(DS, STATE); end if; if (FULLTBL) then -- supply array's 0-element TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, ","); MISC.DATAFLUSH(FULL_TABLE_TEMP_FILE); TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, "( "); if (DS = END_OF_BUFFER_STATE) then MISC.MK2DATA(FULL_TABLE_TEMP_FILE, -END_OF_BUFFER_STATE); else MISC.MK2DATA(FULL_TABLE_TEMP_FILE, END_OF_BUFFER_STATE); end if; for CNT in 1 .. NUMECS loop -- jams are marked by negative of state number if ((STATE(CNT) /= 0)) then MISC.MK2DATA(FULL_TABLE_TEMP_FILE, STATE(CNT)); else MISC.MK2DATA(FULL_TABLE_TEMP_FILE, -DS); end if; end loop; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, " )"); -- force extra blank line next dataflush() DATALINE := NUMDATALINES; else if (DS = END_OF_BUFFER_STATE) then -- special case this state to make sure it does what it's -- supposed to, i.e., jam on end-of-buffer TBLCMP.STACK1(DS, 0, 0, JAMSTATE_CONST); else -- normal, compressed state -- determine which destination state is the most common, and -- how many transitions to it there are COMFREQ := 0; COMSTATE := 0; for CNT in 1 .. TARGPTR loop if (TARGFREQ(CNT) > COMFREQ) then COMFREQ := TARGFREQ(CNT); COMSTATE := TARGSTATE(CNT); end if; end loop; TBLCMP.BLDTBL(STATE, DS, TOTALTRANS, COMSTATE, COMFREQ); end if; end if; end loop; if (FULLTBL) then TEXT_IO.PUT("yy_nxt : constant array(0.."); INT_IO.PUT(NUM_NXT_STATES - 1, 1); TEXT_IO.PUT_LINE(" , ASCII.NUL..ASCII.DEL) of short :="); TEXT_IO.PUT_LINE(" ("); RESET(FULL_TABLE_TEMP_FILE, IN_FILE); while (not END_OF_FILE(FULL_TABLE_TEMP_FILE)) loop TSTRING.GET_LINE(FULL_TABLE_TEMP_FILE, BUF); TSTRING.PUT_LINE(BUF); end loop; DELETE(FULL_TABLE_TEMP_FILE); MISC.DATAEND; else TBLCMP.CMPTMPS; -- create compressed template entries -- create tables for all the states with only one out-transition while (ONESP > 0) loop TBLCMP.MK1TBL(ONESTATE(ONESP), ONESYM(ONESP), ONENEXT(ONESP), ONEDEF( ONESP)); ONESP := ONESP - 1; end loop; TBLCMP.MKDEFTBL; end if; end NTOD; -- snstods - converts a set of ndfa states into a dfa state -- -- on return, the dfa state number is in newds. procedure SNSTODS(SNS : in INT_PTR; NUMSTATES : in INTEGER; ACCSET : in INT_PTR; NACC, HASHVAL : in INTEGER; NEWDS_ADDR : out INTEGER; RESULT : out BOOLEAN) is DIDSORT : BOOLEAN := FALSE; J : INTEGER; NEWDS : INTEGER; OLDSNS : INT_PTR; begin for I in 1 .. LASTDFA loop if (HASHVAL = DHASH(I)) then if (NUMSTATES = DFASIZ(I)) then OLDSNS := DSS(I); if (not DIDSORT) then -- we sort the states in sns so we can compare it to -- oldsns quickly. we use bubble because there probably -- aren't very many states MISC.BUBBLE(SNS, NUMSTATES); DIDSORT := TRUE; end if; J := 1; while (J <= NUMSTATES) loop if (SNS(J) /= OLDSNS(J)) then exit; end if; J := J + 1; end loop; if (J > NUMSTATES) then DFAEQL := DFAEQL + 1; NEWDS_ADDR := I; RESULT := FALSE; return; end if; HSHCOL := HSHCOL + 1; else HSHSAVE := HSHSAVE + 1; end if; end if; end loop; -- make a new dfa LASTDFA := LASTDFA + 1; if (LASTDFA >= CURRENT_MAX_DFAS) then INCREASE_MAX_DFAS; end if; NEWDS := LASTDFA; DSS(NEWDS) := new UNBOUNDED_INT_ARRAY(0 .. NUMSTATES + 1); -- if we haven't already sorted the states in sns, we do so now, so that -- future comparisons with it can be made quickly if (not DIDSORT) then MISC.BUBBLE(SNS, NUMSTATES); end if; for I in 1 .. NUMSTATES loop DSS(NEWDS)(I) := SNS(I); end loop; DFASIZ(NEWDS) := NUMSTATES; DHASH(NEWDS) := HASHVAL; if (NACC = 0) then DFAACC(NEWDS).DFAACC_STATE := 0; ACCSIZ(NEWDS) := 0; else -- find lowest numbered rule so the disambiguating rule will work J := NUM_RULES + 1; for I in 1 .. NACC loop if (ACCSET(I) < J) then J := ACCSET(I); end if; end loop; DFAACC(NEWDS).DFAACC_STATE := J; end if; NEWDS_ADDR := NEWDS; RESULT := TRUE; return; exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in snstods()"); end SNSTODS; -- symfollowset - follow the symbol transitions one step function SYMFOLLOWSET(DS : in INT_PTR; DSIZE, TRANSSYM : in INTEGER; NSET : in INT_PTR) return INTEGER is NS, TSP, SYM, LENCCL, CH, NUMSTATES, CCLLIST : INTEGER; begin NUMSTATES := 0; for I in 1 .. DSIZE loop -- for each nfa state ns in the state set of ds NS := DS(I); SYM := TRANSCHAR(NS); TSP := TRANS1(NS); if (SYM < 0) then -- it's a character class SYM := -SYM; CCLLIST := CCLMAP(SYM); LENCCL := CCLLEN(SYM); if (CCLNG(SYM) /= 0) then for J in 0 .. LENCCL - 1 loop -- loop through negated character class CH := CHARACTER'POS(CCLTBL(CCLLIST + J)); if (CH > TRANSSYM) then exit; -- transsym isn't in negated ccl else if (CH = TRANSSYM) then goto BOTTOM; -- next 2 end if; end if; end loop; -- didn't find transsym in ccl NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; else for J in 0 .. LENCCL - 1 loop CH := CHARACTER'POS(CCLTBL(CCLLIST + J)); if (CH > TRANSSYM) then exit; else if (CH = TRANSSYM) then NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; exit; end if; end if; end loop; end if; else if ((SYM >= CHARACTER'POS('A')) and (SYM <= CHARACTER'POS('Z')) and CASEINS) then MISC.AFLEXFATAL("consistency check failed in symfollowset"); else if (SYM = SYM_EPSILON) then null; -- do nothing else if (ECGROUP(SYM) = TRANSSYM) then NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; end if; end if; end if; end if; <<BOTTOM>> null; end loop; return NUMSTATES; end SYMFOLLOWSET; -- sympartition - partition characters with same out-transitions procedure SYMPARTITION(DS : in INT_PTR; NUMSTATES : in INTEGER; SYMLIST : in out C_SIZE_BOOL_ARRAY; DUPLIST : in out C_SIZE_ARRAY) is TCH, J, NS, LENCCL, CCLP, ICH : INTEGER; DUPFWD : C_SIZE_ARRAY; -- partitioning is done by creating equivalence classes for those -- characters which have out-transitions from the given state. Thus -- we are really creating equivalence classes of equivalence classes. begin for I in 1 .. NUMECS loop -- initialize equivalence class list DUPLIST(I) := I - 1; DUPFWD(I) := I + 1; end loop; DUPLIST(1) := NIL; DUPFWD(NUMECS) := NIL; DUPFWD(0) := 0; for I in 1 .. NUMSTATES loop NS := DS(I); TCH := TRANSCHAR(NS); if (TCH /= SYM_EPSILON) then if ((TCH < -LASTCCL) or (TCH > CSIZE)) then MISC.AFLEXFATAL("bad transition character detected in sympartition()") ; end if; if (TCH > 0) then -- character transition ECS.MKECHAR(ECGROUP(TCH), DUPFWD, DUPLIST); SYMLIST(ECGROUP(TCH)) := TRUE; else -- character class TCH := -TCH; LENCCL := CCLLEN(TCH); CCLP := CCLMAP(TCH); ECS.MKECCL(CCLTBL(CCLP .. CCLP + LENCCL), LENCCL, DUPFWD, DUPLIST, NUMECS); if (CCLNG(TCH) /= 0) then J := 0; for K in 0 .. LENCCL - 1 loop ICH := CHARACTER'POS(CCLTBL(CCLP + K)); J := J + 1; while (J < ICH) loop SYMLIST(J) := TRUE; J := J + 1; end loop; end loop; J := J + 1; while (J <= NUMECS) loop SYMLIST(J) := TRUE; J := J + 1; end loop; else for K in 0 .. LENCCL - 1 loop ICH := CHARACTER'POS(CCLTBL(CCLP + K)); SYMLIST(ICH) := TRUE; end loop; end if; end if; end if; end loop; end SYMPARTITION; end dfa;
3478
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by <NAME> of the Arcadia project -- at the University of California, Irvine. -- -- 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. -- TITLE DFA construction routines -- AUTHOR: <NAME> (UCI) -- DESCRIPTION converts non-deterministic finite automatons to finite ones. -- $Header: /dc/uc/self/tmp/gnat_aflex/RCS/dfa.adb,v 1.1 1995/07/04 20:18:39 self Exp self $ with dfa, int_io, misc_defs, text_io, misc, tblcmp, ccl, external_file_manager; with ecs, nfa, tstring, gen, skeleton_manager; use misc_defs, external_file_manager; package body dfa is use TSTRING; -- check_for_backtracking - check a DFA state for backtracking -- -- ds is the number of the state to check and state[) is its out-transitions, -- indexed by equivalence class, and state_rules[) is the set of rules -- associated with this state DID_STK_INIT : BOOLEAN := FALSE; STK : INT_PTR; procedure CHECK_FOR_BACKTRACKING(DS : in INTEGER; STATE : in UNBOUNDED_INT_ARRAY) is use MISC_DEFS; begin if (DFAACC(DS).DFAACC_STATE = 0) then -- state is non-accepting NUM_BACKTRACKING := NUM_BACKTRACKING + 1; if (BACKTRACK_REPORT) then TEXT_IO.PUT(BACKTRACK_FILE, "State #"); INT_IO.PUT(BACKTRACK_FILE, DS, 1); TEXT_IO.PUT(BACKTRACK_FILE, "is non-accepting -"); TEXT_IO.NEW_LINE(BACKTRACK_FILE); -- identify the state DUMP_ASSOCIATED_RULES(BACKTRACK_FILE, DS); -- now identify it further using the out- and jam-transitions DUMP_TRANSITIONS(BACKTRACK_FILE, STATE); TEXT_IO.NEW_LINE(BACKTRACK_FILE); end if; end if; end CHECK_FOR_BACKTRACKING; -- check_trailing_context - check to see if NFA state set constitutes -- "dangerous" trailing context -- -- NOTES -- Trailing context is "dangerous" if both the head and the trailing -- part are of variable size \and/ there's a DFA state which contains -- both an accepting state for the head part of the rule and NFA states -- which occur after the beginning of the trailing context. -- When such a rule is matched, it's impossible to tell if having been -- in the DFA state indicates the beginning of the trailing context -- or further-along scanning of the pattern. In these cases, a warning -- message is issued. -- -- nfa_states[1 .. num_states) is the list of NFA states in the DFA. -- accset[1 .. nacc) is the list of accepting numbers for the DFA state. procedure CHECK_TRAILING_CONTEXT(NFA_STATES : in INT_PTR; NUM_STATES : in INTEGER; ACCSET : in INT_PTR; NACC : in INTEGER) is NS, AR : INTEGER; STATE_VAR, TYPE_VAR : STATE_ENUM; use MISC_DEFS, MISC, TEXT_IO; begin for I in 1 .. NUM_STATES loop NS := NFA_STATES(I); TYPE_VAR := STATE_TYPE(NS); AR := ASSOC_RULE(NS); if ((TYPE_VAR = STATE_NORMAL) or (RULE_TYPE(AR) /= RULE_VARIABLE)) then null; -- do nothing else if (TYPE_VAR = STATE_TRAILING_CONTEXT) then -- potential trouble. Scan set of accepting numbers for -- the one marking the end of the "head". We assume that -- this looping will be fairly cheap since it's rare that -- an accepting number set is large. for J in 1 .. NACC loop if (CHECK_YY_TRAILING_HEAD_MASK(ACCSET(J)) /= 0) then TEXT_IO.PUT(STANDARD_ERROR, "aflex: Dangerous trailing context in rule at line "); INT_IO.PUT(STANDARD_ERROR, RULE_LINENUM(AR), 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); return; end if; end loop; end if; end if; end loop; end CHECK_TRAILING_CONTEXT; -- dump_associated_rules - list the rules associated with a DFA state -- -- goes through the set of NFA states associated with the DFA and -- extracts the first MAX_ASSOC_RULES unique rules, sorts them, -- and writes a report to the given file procedure DUMP_ASSOCIATED_RULES(F : in FILE_TYPE; DS : in INTEGER) is J : INTEGER; NUM_ASSOCIATED_RULES : INTEGER := 0; RULE_SET : INT_PTR; SIZE, RULE_NUM : INTEGER; begin RULE_SET := new UNBOUNDED_INT_ARRAY(0 .. MAX_ASSOC_RULES + 1); SIZE := DFASIZ(DS); for I in 1 .. SIZE loop RULE_NUM := RULE_LINENUM(ASSOC_RULE(DSS(DS)(I))); J := 1; while (J <= NUM_ASSOCIATED_RULES) loop if (RULE_NUM = RULE_SET(J)) then exit; end if; J := J + 1; end loop; if (J > NUM_ASSOCIATED_RULES) then --new rule if (NUM_ASSOCIATED_RULES < MAX_ASSOC_RULES) then NUM_ASSOCIATED_RULES := NUM_ASSOCIATED_RULES + 1; RULE_SET(NUM_ASSOCIATED_RULES) := RULE_NUM; end if; end if; end loop; MISC.BUBBLE(RULE_SET, NUM_ASSOCIATED_RULES); TEXT_IO.PUT(F, " associated rules:"); for I in 1 .. NUM_ASSOCIATED_RULES loop if (I mod 8 = 1) then TEXT_IO.NEW_LINE(F); end if; TEXT_IO.PUT(F, ASCII.HT); INT_IO.PUT(F, RULE_SET(I), 1); end loop; TEXT_IO.NEW_LINE(F); exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in dump_associated_rules()"); end DUMP_ASSOCIATED_RULES; -- dump_transitions - list the transitions associated with a DFA state -- -- goes through the set of out-transitions and lists them in human-readable -- form (i.e., not as equivalence classes); also lists jam transitions -- (i.e., all those which are not out-transitions, plus EOF). The dump -- is done to the given file. procedure DUMP_TRANSITIONS(F : in FILE_TYPE; STATE : in UNBOUNDED_INT_ARRAY) is EC : INTEGER; OUT_CHAR_SET : C_SIZE_BOOL_ARRAY; begin for I in 1 .. CSIZE loop EC := ECGROUP(I); if (EC < 0) then EC := -EC; end if; OUT_CHAR_SET(I) := (STATE(EC) /= 0); end loop; TEXT_IO.PUT(F, " out-transitions: "); CCL.LIST_CHARACTER_SET(F, OUT_CHAR_SET); -- now invert the members of the set to get the jam transitions for I in 1 .. CSIZE loop OUT_CHAR_SET(I) := not OUT_CHAR_SET(I); end loop; TEXT_IO.NEW_LINE(F); TEXT_IO.PUT(F, "jam-transitions: EOF "); CCL.LIST_CHARACTER_SET(F, OUT_CHAR_SET); TEXT_IO.NEW_LINE(F); end DUMP_TRANSITIONS; -- epsclosure - construct the epsilon closure of a set of ndfa states -- -- NOTES -- the epsilon closure is the set of all states reachable by an arbitrary -- number of epsilon transitions which themselves do not have epsilon -- transitions going out, unioned with the set of states which have non-null -- accepting numbers. t is an array of size numstates of nfa state numbers. -- Upon return, t holds the epsilon closure and numstates is updated. accset -- holds a list of the accepting numbers, and the size of accset is given -- by nacc. t may be subjected to reallocation if it is not large enough -- to hold the epsilon closure. -- -- hashval is the hash value for the dfa corresponding to the state set procedure EPSCLOSURE(T : in out INT_PTR; NS_ADDR : in out INTEGER; ACCSET : in out INT_PTR; NACC_ADDR, HV_ADDR : out INTEGER; RESULT : out INT_PTR) is NS, TSP : INTEGER; NUMSTATES, NACC, HASHVAL, TRANSSYM, NFACCNUM : INTEGER; STKEND : INTEGER; STKPOS : INTEGER; procedure MARK_STATE(STATE : in INTEGER) is begin TRANS1(STATE) := TRANS1(STATE) - MARKER_DIFFERENCE; end MARK_STATE; pragma INLINE(MARK_STATE); function IS_MARKED(STATE : in INTEGER) return BOOLEAN is begin return TRANS1(STATE) < 0; end IS_MARKED; pragma INLINE(IS_MARKED); procedure UNMARK_STATE(STATE : in INTEGER) is begin TRANS1(STATE) := TRANS1(STATE) + MARKER_DIFFERENCE; end UNMARK_STATE; pragma INLINE(UNMARK_STATE); procedure CHECK_ACCEPT(STATE : in INTEGER) is begin NFACCNUM := ACCPTNUM(STATE); if (NFACCNUM /= NIL) then NACC := NACC + 1; ACCSET(NACC) := NFACCNUM; end if; end CHECK_ACCEPT; pragma INLINE(CHECK_ACCEPT); procedure DO_REALLOCATION is begin CURRENT_MAX_DFA_SIZE := CURRENT_MAX_DFA_SIZE + MAX_DFA_SIZE_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(T, CURRENT_MAX_DFA_SIZE); REALLOCATE_INTEGER_ARRAY(STK, CURRENT_MAX_DFA_SIZE); end DO_REALLOCATION; pragma INLINE(DO_REALLOCATION); procedure PUT_ON_STACK(STATE : in INTEGER) is begin STKEND := STKEND + 1; if (STKEND >= CURRENT_MAX_DFA_SIZE) then DO_REALLOCATION; end if; STK(STKEND) := STATE; MARK_STATE(STATE); end PUT_ON_STACK; pragma INLINE(PUT_ON_STACK); procedure ADD_STATE(STATE : in INTEGER) is begin NUMSTATES := NUMSTATES + 1; if (NUMSTATES >= CURRENT_MAX_DFA_SIZE) then DO_REALLOCATION; end if; T(NUMSTATES) := STATE; HASHVAL := HASHVAL + STATE; end ADD_STATE; pragma INLINE(ADD_STATE); procedure STACK_STATE(STATE : in INTEGER) is begin PUT_ON_STACK(STATE); CHECK_ACCEPT(STATE); if ((NFACCNUM /= NIL) or (TRANSCHAR(STATE) /= SYM_EPSILON)) then ADD_STATE(STATE); end if; end STACK_STATE; pragma INLINE(STACK_STATE); begin NUMSTATES := NS_ADDR; if (not DID_STK_INIT) then STK := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFA_SIZE); DID_STK_INIT := TRUE; end if; NACC := 0; STKEND := 0; HASHVAL := 0; for NSTATE in 1 .. NUMSTATES loop NS := T(NSTATE); -- the state could be marked if we've already pushed it onto -- the stack if (not IS_MARKED(NS)) then PUT_ON_STACK(NS); null; end if; CHECK_ACCEPT(NS); HASHVAL := HASHVAL + NS; end loop; STKPOS := 1; while (STKPOS <= STKEND) loop NS := STK(STKPOS); TRANSSYM := TRANSCHAR(NS); if (TRANSSYM = SYM_EPSILON) then TSP := TRANS1(NS) + MARKER_DIFFERENCE; if (TSP /= NO_TRANSITION) then if (not IS_MARKED(TSP)) then STACK_STATE(TSP); end if; TSP := TRANS2(NS); if (TSP /= NO_TRANSITION) then if (not IS_MARKED(TSP)) then STACK_STATE(TSP); end if; end if; end if; end if; STKPOS := STKPOS + 1; end loop; -- clear out "visit" markers for CHK_STKPOS in 1 .. STKEND loop if (IS_MARKED(STK(CHK_STKPOS))) then UNMARK_STATE(STK(CHK_STKPOS)); else MISC.AFLEXFATAL("consistency check failed in epsclosure()"); end if; end loop; NS_ADDR := NUMSTATES; HV_ADDR := HASHVAL; NACC_ADDR := NACC; RESULT := T; end EPSCLOSURE; -- increase_max_dfas - increase the maximum number of DFAs procedure INCREASE_MAX_DFAS is begin CURRENT_MAX_DFAS := CURRENT_MAX_DFAS + MAX_DFAS_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(BASE, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DEF, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DFASIZ, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(ACCSIZ, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DHASH, CURRENT_MAX_DFAS); REALLOCATE_INT_PTR_ARRAY(DSS, CURRENT_MAX_DFAS); REALLOCATE_DFAACC_UNION(DFAACC, CURRENT_MAX_DFAS); end INCREASE_MAX_DFAS; -- ntod - convert an ndfa to a dfa -- -- creates the dfa corresponding to the ndfa we've constructed. the -- dfa starts out in state #1. procedure NTOD is ACCSET : INT_PTR; DS, NACC, NEWDS : INTEGER; DUPLIST, TARGFREQ, TARGSTATE, STATE : C_SIZE_ARRAY; SYMLIST : C_SIZE_BOOL_ARRAY; HASHVAL, NUMSTATES, DSIZE : INTEGER; NSET, DSET : INT_PTR; TARGPTR, TOTALTRANS, I, J, COMSTATE, COMFREQ, TARG : INTEGER; NUM_START_STATES, TODO_HEAD, TODO_NEXT : INTEGER; SNSRESULT : BOOLEAN; FULL_TABLE_TEMP_FILE : FILE_TYPE; BUF : VSTRING; NUM_NXT_STATES : INTEGER; use TEXT_IO; -- this is so find_table_space(...) will know where to start looking in -- chk/nxt for unused records for space to put in the state begin ACCSET := ALLOCATE_INTEGER_ARRAY(NUM_RULES + 1); NSET := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFA_SIZE); -- the "todo" queue is represented by the head, which is the DFA -- state currently being processed, and the "next", which is the -- next DFA state number available (not in use). We depend on the -- fact that snstods() returns DFA's \in increasing order/, and thus -- need only know the bounds of the dfas to be processed. TODO_HEAD := 0; TODO_NEXT := 0; for CNT in 0 .. CSIZE loop DUPLIST(CNT) := NIL; SYMLIST(CNT) := FALSE; end loop; for CNT in 0 .. NUM_RULES loop ACCSET(CNT) := NIL; end loop; if (TRACE) then NFA.DUMPNFA(SCSET(1)); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.PUT(STANDARD_ERROR, "DFA Dump:"); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; TBLCMP.INITTBL; if (FULLTBL) then GEN.DO_SECT3_OUT; -- output user code up to ## SKELETON_MANAGER.SKELOUT; -- declare it "short" because it's a real long-shot that that -- won't be large enough begin -- make a temporary file to write yy_nxt array into CREATE(FULL_TABLE_TEMP_FILE, OUT_FILE); exception when USE_ERROR | NAME_ERROR => MISC.AFLEXFATAL("can't create temporary file"); end; NUM_NXT_STATES := 1; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, "( "); -- generate 0 entries for state #0 for CNT in 0 .. NUMECS loop MISC.MK2DATA(FULL_TABLE_TEMP_FILE, 0); end loop; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, " )"); -- force extra blank line next dataflush() DATALINE := NUMDATALINES; end if; -- create the first states NUM_START_STATES := LASTSC*2; for CNT in 1 .. NUM_START_STATES loop NUMSTATES := 1; -- for each start condition, make one state for the case when -- we're at the beginning of the line (the '%' operator) and -- one for the case when we're not if (CNT mod 2 = 1) then NSET(NUMSTATES) := SCSET((CNT/2) + 1); else NSET(NUMSTATES) := NFA.MKBRANCH(SCBOL(CNT/2), SCSET(CNT/2)); end if; DFA.EPSCLOSURE(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NSET); SNSTODS(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, DS, SNSRESULT); if (SNSRESULT) then NUMAS := NUMAS + NACC; TOTNST := TOTNST + NUMSTATES; TODO_NEXT := TODO_NEXT + 1; if (VARIABLE_TRAILING_CONTEXT_RULES and (NACC > 0)) then CHECK_TRAILING_CONTEXT(NSET, NUMSTATES, ACCSET, NACC); end if; end if; end loop; SNSTODS(NSET, 0, ACCSET, 0, 0, END_OF_BUFFER_STATE, SNSRESULT); if (not SNSRESULT) then MISC.AFLEXFATAL("could not create unique end-of-buffer state"); end if; NUMAS := NUMAS + 1; NUM_START_STATES := NUM_START_STATES + 1; TODO_NEXT := TODO_NEXT + 1; while (TODO_HEAD < TODO_NEXT) loop NUM_NXT_STATES := NUM_NXT_STATES + 1; TARGPTR := 0; TOTALTRANS := 0; for STATE_CNT in 1 .. NUMECS loop STATE(STATE_CNT) := 0; end loop; TODO_HEAD := TODO_HEAD + 1; DS := TODO_HEAD; DSET := DSS(DS); DSIZE := DFASIZ(DS); if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, "state # "); INT_IO.PUT(STANDARD_ERROR, DS, 1); TEXT_IO.PUT_LINE(STANDARD_ERROR, ":"); end if; SYMPARTITION(DSET, DSIZE, SYMLIST, DUPLIST); for SYM in 1 .. NUMECS loop if (SYMLIST(SYM)) then SYMLIST(SYM) := FALSE; if (DUPLIST(SYM) = NIL) then -- symbol has unique out-transitions NUMSTATES := SYMFOLLOWSET(DSET, DSIZE, SYM, NSET); DFA.EPSCLOSURE(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NSET); SNSTODS(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NEWDS, SNSRESULT); if (SNSRESULT) then TOTNST := TOTNST + NUMSTATES; TODO_NEXT := TODO_NEXT + 1; NUMAS := NUMAS + NACC; if (VARIABLE_TRAILING_CONTEXT_RULES and (NACC > 0)) then CHECK_TRAILING_CONTEXT(NSET, NUMSTATES, ACCSET, NACC); end if; end if; STATE(SYM) := NEWDS; if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, SYM, 1); TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, NEWDS, 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; TARGPTR := TARGPTR + 1; TARGFREQ(TARGPTR) := 1; TARGSTATE(TARGPTR) := NEWDS; NUMUNIQ := NUMUNIQ + 1; else -- sym's equivalence class has the same transitions -- as duplist(sym)'s equivalence class TARG := STATE(DUPLIST(SYM)); STATE(SYM) := TARG; if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, SYM, 1); TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, TARG, 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; -- update frequency count for destination state I := 1; while (TARGSTATE(I) /= TARG) loop I := I + 1; end loop; TARGFREQ(I) := TARGFREQ(I) + 1; NUMDUP := NUMDUP + 1; end if; TOTALTRANS := TOTALTRANS + 1; DUPLIST(SYM) := NIL; end if; end loop; NUMSNPAIRS := NUMSNPAIRS + TOTALTRANS; if (CASEINS and not USEECS) then I := CHARACTER'POS('A'); J := CHARACTER'POS('a'); while (I < CHARACTER'POS('Z')) loop STATE(I) := STATE(J); I := I + 1; J := J + 1; end loop; end if; if (DS > NUM_START_STATES) then CHECK_FOR_BACKTRACKING(DS, STATE); end if; if (FULLTBL) then -- supply array's 0-element TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, ","); MISC.DATAFLUSH(FULL_TABLE_TEMP_FILE); TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, "( "); if (DS = END_OF_BUFFER_STATE) then MISC.MK2DATA(FULL_TABLE_TEMP_FILE, -END_OF_BUFFER_STATE); else MISC.MK2DATA(FULL_TABLE_TEMP_FILE, END_OF_BUFFER_STATE); end if; for CNT in 1 .. NUMECS loop -- jams are marked by negative of state number if ((STATE(CNT) /= 0)) then MISC.MK2DATA(FULL_TABLE_TEMP_FILE, STATE(CNT)); else MISC.MK2DATA(FULL_TABLE_TEMP_FILE, -DS); end if; end loop; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, " )"); -- force extra blank line next dataflush() DATALINE := NUMDATALINES; else if (DS = END_OF_BUFFER_STATE) then -- special case this state to make sure it does what it's -- supposed to, i.e., jam on end-of-buffer TBLCMP.STACK1(DS, 0, 0, JAMSTATE_CONST); else -- normal, compressed state -- determine which destination state is the most common, and -- how many transitions to it there are COMFREQ := 0; COMSTATE := 0; for CNT in 1 .. TARGPTR loop if (TARGFREQ(CNT) > COMFREQ) then COMFREQ := TARGFREQ(CNT); COMSTATE := TARGSTATE(CNT); end if; end loop; TBLCMP.BLDTBL(STATE, DS, TOTALTRANS, COMSTATE, COMFREQ); end if; end if; end loop; if (FULLTBL) then TEXT_IO.PUT("yy_nxt : constant array(0.."); INT_IO.PUT(NUM_NXT_STATES - 1, 1); TEXT_IO.PUT_LINE(" , ASCII.NUL..ASCII.DEL) of short :="); TEXT_IO.PUT_LINE(" ("); RESET(FULL_TABLE_TEMP_FILE, IN_FILE); while (not END_OF_FILE(FULL_TABLE_TEMP_FILE)) loop TSTRING.GET_LINE(FULL_TABLE_TEMP_FILE, BUF); TSTRING.PUT_LINE(BUF); end loop; DELETE(FULL_TABLE_TEMP_FILE); MISC.DATAEND; else TBLCMP.CMPTMPS; -- create compressed template entries -- create tables for all the states with only one out-transition while (ONESP > 0) loop TBLCMP.MK1TBL(ONESTATE(ONESP), ONESYM(ONESP), ONENEXT(ONESP), ONEDEF( ONESP)); ONESP := ONESP - 1; end loop; TBLCMP.MKDEFTBL; end if; end NTOD; -- snstods - converts a set of ndfa states into a dfa state -- -- on return, the dfa state number is in newds. procedure SNSTODS(SNS : in INT_PTR; NUMSTATES : in INTEGER; ACCSET : in INT_PTR; NACC, HASHVAL : in INTEGER; NEWDS_ADDR : out INTEGER; RESULT : out BOOLEAN) is DIDSORT : BOOLEAN := FALSE; J : INTEGER; NEWDS : INTEGER; OLDSNS : INT_PTR; begin for I in 1 .. LASTDFA loop if (HASHVAL = DHASH(I)) then if (NUMSTATES = DFASIZ(I)) then OLDSNS := DSS(I); if (not DIDSORT) then -- we sort the states in sns so we can compare it to -- oldsns quickly. we use bubble because there probably -- aren't very many states MISC.BUBBLE(SNS, NUMSTATES); DIDSORT := TRUE; end if; J := 1; while (J <= NUMSTATES) loop if (SNS(J) /= OLDSNS(J)) then exit; end if; J := J + 1; end loop; if (J > NUMSTATES) then DFAEQL := DFAEQL + 1; NEWDS_ADDR := I; RESULT := FALSE; return; end if; HSHCOL := HSHCOL + 1; else HSHSAVE := HSHSAVE + 1; end if; end if; end loop; -- make a new dfa LASTDFA := LASTDFA + 1; if (LASTDFA >= CURRENT_MAX_DFAS) then INCREASE_MAX_DFAS; end if; NEWDS := LASTDFA; DSS(NEWDS) := new UNBOUNDED_INT_ARRAY(0 .. NUMSTATES + 1); -- if we haven't already sorted the states in sns, we do so now, so that -- future comparisons with it can be made quickly if (not DIDSORT) then MISC.BUBBLE(SNS, NUMSTATES); end if; for I in 1 .. NUMSTATES loop DSS(NEWDS)(I) := SNS(I); end loop; DFASIZ(NEWDS) := NUMSTATES; DHASH(NEWDS) := HASHVAL; if (NACC = 0) then DFAACC(NEWDS).DFAACC_STATE := 0; ACCSIZ(NEWDS) := 0; else -- find lowest numbered rule so the disambiguating rule will work J := NUM_RULES + 1; for I in 1 .. NACC loop if (ACCSET(I) < J) then J := ACCSET(I); end if; end loop; DFAACC(NEWDS).DFAACC_STATE := J; end if; NEWDS_ADDR := NEWDS; RESULT := TRUE; return; exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in snstods()"); end SNSTODS; -- symfollowset - follow the symbol transitions one step function SYMFOLLOWSET(DS : in INT_PTR; DSIZE, TRANSSYM : in INTEGER; NSET : in INT_PTR) return INTEGER is NS, TSP, SYM, LENCCL, CH, NUMSTATES, CCLLIST : INTEGER; begin NUMSTATES := 0; for I in 1 .. DSIZE loop -- for each nfa state ns in the state set of ds NS := DS(I); SYM := TRANSCHAR(NS); TSP := TRANS1(NS); if (SYM < 0) then -- it's a character class SYM := -SYM; CCLLIST := CCLMAP(SYM); LENCCL := CCLLEN(SYM); if (CCLNG(SYM) /= 0) then for J in 0 .. LENCCL - 1 loop -- loop through negated character class CH := CHARACTER'POS(CCLTBL(CCLLIST + J)); if (CH > TRANSSYM) then exit; -- transsym isn't in negated ccl else if (CH = TRANSSYM) then goto BOTTOM; -- next 2 end if; end if; end loop; -- didn't find transsym in ccl NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; else for J in 0 .. LENCCL - 1 loop CH := CHARACTER'POS(CCLTBL(CCLLIST + J)); if (CH > TRANSSYM) then exit; else if (CH = TRANSSYM) then NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; exit; end if; end if; end loop; end if; else if ((SYM >= CHARACTER'POS('A')) and (SYM <= CHARACTER'POS('Z')) and CASEINS) then MISC.AFLEXFATAL("consistency check failed in symfollowset"); else if (SYM = SYM_EPSILON) then null; -- do nothing else if (ECGROUP(SYM) = TRANSSYM) then NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; end if; end if; end if; end if; <<BOTTOM>> null; end loop; return NUMSTATES; end SYMFOLLOWSET; -- sympartition - partition characters with same out-transitions procedure SYMPARTITION(DS : in INT_PTR; NUMSTATES : in INTEGER; SYMLIST : in out C_SIZE_BOOL_ARRAY; DUPLIST : in out C_SIZE_ARRAY) is TCH, J, NS, LENCCL, CCLP, ICH : INTEGER; DUPFWD : C_SIZE_ARRAY; -- partitioning is done by creating equivalence classes for those -- characters which have out-transitions from the given state. Thus -- we are really creating equivalence classes of equivalence classes. begin for I in 1 .. NUMECS loop -- initialize equivalence class list DUPLIST(I) := I - 1; DUPFWD(I) := I + 1; end loop; DUPLIST(1) := NIL; DUPFWD(NUMECS) := NIL; DUPFWD(0) := 0; for I in 1 .. NUMSTATES loop NS := DS(I); TCH := TRANSCHAR(NS); if (TCH /= SYM_EPSILON) then if ((TCH < -LASTCCL) or (TCH > CSIZE)) then MISC.AFLEXFATAL("bad transition character detected in sympartition()") ; end if; if (TCH > 0) then -- character transition ECS.MKECHAR(ECGROUP(TCH), DUPFWD, DUPLIST); SYMLIST(ECGROUP(TCH)) := TRUE; else -- character class TCH := -TCH; LENCCL := CCLLEN(TCH); CCLP := CCLMAP(TCH); ECS.MKECCL(CCLTBL(CCLP .. CCLP + LENCCL), LENCCL, DUPFWD, DUPLIST, NUMECS); if (CCLNG(TCH) /= 0) then J := 0; for K in 0 .. LENCCL - 1 loop ICH := CHARACTER'POS(CCLTBL(CCLP + K)); J := J + 1; while (J < ICH) loop SYMLIST(J) := TRUE; J := J + 1; end loop; end loop; J := J + 1; while (J <= NUMECS) loop SYMLIST(J) := TRUE; J := J + 1; end loop; else for K in 0 .. LENCCL - 1 loop ICH := CHARACTER'POS(CCLTBL(CCLP + K)); SYMLIST(ICH) := TRUE; end loop; end if; end if; end if; end loop; end SYMPARTITION; end dfa;
true
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by PI:NAME:<NAME>END_PI of the Arcadia project -- at the University of California, Irvine. -- -- 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. -- TITLE DFA construction routines -- AUTHOR: PI:NAME:<NAME>END_PI (UCI) -- DESCRIPTION converts non-deterministic finite automatons to finite ones. -- $Header: /dc/uc/self/tmp/gnat_aflex/RCS/dfa.adb,v 1.1 1995/07/04 20:18:39 self Exp self $ with dfa, int_io, misc_defs, text_io, misc, tblcmp, ccl, external_file_manager; with ecs, nfa, tstring, gen, skeleton_manager; use misc_defs, external_file_manager; package body dfa is use TSTRING; -- check_for_backtracking - check a DFA state for backtracking -- -- ds is the number of the state to check and state[) is its out-transitions, -- indexed by equivalence class, and state_rules[) is the set of rules -- associated with this state DID_STK_INIT : BOOLEAN := FALSE; STK : INT_PTR; procedure CHECK_FOR_BACKTRACKING(DS : in INTEGER; STATE : in UNBOUNDED_INT_ARRAY) is use MISC_DEFS; begin if (DFAACC(DS).DFAACC_STATE = 0) then -- state is non-accepting NUM_BACKTRACKING := NUM_BACKTRACKING + 1; if (BACKTRACK_REPORT) then TEXT_IO.PUT(BACKTRACK_FILE, "State #"); INT_IO.PUT(BACKTRACK_FILE, DS, 1); TEXT_IO.PUT(BACKTRACK_FILE, "is non-accepting -"); TEXT_IO.NEW_LINE(BACKTRACK_FILE); -- identify the state DUMP_ASSOCIATED_RULES(BACKTRACK_FILE, DS); -- now identify it further using the out- and jam-transitions DUMP_TRANSITIONS(BACKTRACK_FILE, STATE); TEXT_IO.NEW_LINE(BACKTRACK_FILE); end if; end if; end CHECK_FOR_BACKTRACKING; -- check_trailing_context - check to see if NFA state set constitutes -- "dangerous" trailing context -- -- NOTES -- Trailing context is "dangerous" if both the head and the trailing -- part are of variable size \and/ there's a DFA state which contains -- both an accepting state for the head part of the rule and NFA states -- which occur after the beginning of the trailing context. -- When such a rule is matched, it's impossible to tell if having been -- in the DFA state indicates the beginning of the trailing context -- or further-along scanning of the pattern. In these cases, a warning -- message is issued. -- -- nfa_states[1 .. num_states) is the list of NFA states in the DFA. -- accset[1 .. nacc) is the list of accepting numbers for the DFA state. procedure CHECK_TRAILING_CONTEXT(NFA_STATES : in INT_PTR; NUM_STATES : in INTEGER; ACCSET : in INT_PTR; NACC : in INTEGER) is NS, AR : INTEGER; STATE_VAR, TYPE_VAR : STATE_ENUM; use MISC_DEFS, MISC, TEXT_IO; begin for I in 1 .. NUM_STATES loop NS := NFA_STATES(I); TYPE_VAR := STATE_TYPE(NS); AR := ASSOC_RULE(NS); if ((TYPE_VAR = STATE_NORMAL) or (RULE_TYPE(AR) /= RULE_VARIABLE)) then null; -- do nothing else if (TYPE_VAR = STATE_TRAILING_CONTEXT) then -- potential trouble. Scan set of accepting numbers for -- the one marking the end of the "head". We assume that -- this looping will be fairly cheap since it's rare that -- an accepting number set is large. for J in 1 .. NACC loop if (CHECK_YY_TRAILING_HEAD_MASK(ACCSET(J)) /= 0) then TEXT_IO.PUT(STANDARD_ERROR, "aflex: Dangerous trailing context in rule at line "); INT_IO.PUT(STANDARD_ERROR, RULE_LINENUM(AR), 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); return; end if; end loop; end if; end if; end loop; end CHECK_TRAILING_CONTEXT; -- dump_associated_rules - list the rules associated with a DFA state -- -- goes through the set of NFA states associated with the DFA and -- extracts the first MAX_ASSOC_RULES unique rules, sorts them, -- and writes a report to the given file procedure DUMP_ASSOCIATED_RULES(F : in FILE_TYPE; DS : in INTEGER) is J : INTEGER; NUM_ASSOCIATED_RULES : INTEGER := 0; RULE_SET : INT_PTR; SIZE, RULE_NUM : INTEGER; begin RULE_SET := new UNBOUNDED_INT_ARRAY(0 .. MAX_ASSOC_RULES + 1); SIZE := DFASIZ(DS); for I in 1 .. SIZE loop RULE_NUM := RULE_LINENUM(ASSOC_RULE(DSS(DS)(I))); J := 1; while (J <= NUM_ASSOCIATED_RULES) loop if (RULE_NUM = RULE_SET(J)) then exit; end if; J := J + 1; end loop; if (J > NUM_ASSOCIATED_RULES) then --new rule if (NUM_ASSOCIATED_RULES < MAX_ASSOC_RULES) then NUM_ASSOCIATED_RULES := NUM_ASSOCIATED_RULES + 1; RULE_SET(NUM_ASSOCIATED_RULES) := RULE_NUM; end if; end if; end loop; MISC.BUBBLE(RULE_SET, NUM_ASSOCIATED_RULES); TEXT_IO.PUT(F, " associated rules:"); for I in 1 .. NUM_ASSOCIATED_RULES loop if (I mod 8 = 1) then TEXT_IO.NEW_LINE(F); end if; TEXT_IO.PUT(F, ASCII.HT); INT_IO.PUT(F, RULE_SET(I), 1); end loop; TEXT_IO.NEW_LINE(F); exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in dump_associated_rules()"); end DUMP_ASSOCIATED_RULES; -- dump_transitions - list the transitions associated with a DFA state -- -- goes through the set of out-transitions and lists them in human-readable -- form (i.e., not as equivalence classes); also lists jam transitions -- (i.e., all those which are not out-transitions, plus EOF). The dump -- is done to the given file. procedure DUMP_TRANSITIONS(F : in FILE_TYPE; STATE : in UNBOUNDED_INT_ARRAY) is EC : INTEGER; OUT_CHAR_SET : C_SIZE_BOOL_ARRAY; begin for I in 1 .. CSIZE loop EC := ECGROUP(I); if (EC < 0) then EC := -EC; end if; OUT_CHAR_SET(I) := (STATE(EC) /= 0); end loop; TEXT_IO.PUT(F, " out-transitions: "); CCL.LIST_CHARACTER_SET(F, OUT_CHAR_SET); -- now invert the members of the set to get the jam transitions for I in 1 .. CSIZE loop OUT_CHAR_SET(I) := not OUT_CHAR_SET(I); end loop; TEXT_IO.NEW_LINE(F); TEXT_IO.PUT(F, "jam-transitions: EOF "); CCL.LIST_CHARACTER_SET(F, OUT_CHAR_SET); TEXT_IO.NEW_LINE(F); end DUMP_TRANSITIONS; -- epsclosure - construct the epsilon closure of a set of ndfa states -- -- NOTES -- the epsilon closure is the set of all states reachable by an arbitrary -- number of epsilon transitions which themselves do not have epsilon -- transitions going out, unioned with the set of states which have non-null -- accepting numbers. t is an array of size numstates of nfa state numbers. -- Upon return, t holds the epsilon closure and numstates is updated. accset -- holds a list of the accepting numbers, and the size of accset is given -- by nacc. t may be subjected to reallocation if it is not large enough -- to hold the epsilon closure. -- -- hashval is the hash value for the dfa corresponding to the state set procedure EPSCLOSURE(T : in out INT_PTR; NS_ADDR : in out INTEGER; ACCSET : in out INT_PTR; NACC_ADDR, HV_ADDR : out INTEGER; RESULT : out INT_PTR) is NS, TSP : INTEGER; NUMSTATES, NACC, HASHVAL, TRANSSYM, NFACCNUM : INTEGER; STKEND : INTEGER; STKPOS : INTEGER; procedure MARK_STATE(STATE : in INTEGER) is begin TRANS1(STATE) := TRANS1(STATE) - MARKER_DIFFERENCE; end MARK_STATE; pragma INLINE(MARK_STATE); function IS_MARKED(STATE : in INTEGER) return BOOLEAN is begin return TRANS1(STATE) < 0; end IS_MARKED; pragma INLINE(IS_MARKED); procedure UNMARK_STATE(STATE : in INTEGER) is begin TRANS1(STATE) := TRANS1(STATE) + MARKER_DIFFERENCE; end UNMARK_STATE; pragma INLINE(UNMARK_STATE); procedure CHECK_ACCEPT(STATE : in INTEGER) is begin NFACCNUM := ACCPTNUM(STATE); if (NFACCNUM /= NIL) then NACC := NACC + 1; ACCSET(NACC) := NFACCNUM; end if; end CHECK_ACCEPT; pragma INLINE(CHECK_ACCEPT); procedure DO_REALLOCATION is begin CURRENT_MAX_DFA_SIZE := CURRENT_MAX_DFA_SIZE + MAX_DFA_SIZE_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(T, CURRENT_MAX_DFA_SIZE); REALLOCATE_INTEGER_ARRAY(STK, CURRENT_MAX_DFA_SIZE); end DO_REALLOCATION; pragma INLINE(DO_REALLOCATION); procedure PUT_ON_STACK(STATE : in INTEGER) is begin STKEND := STKEND + 1; if (STKEND >= CURRENT_MAX_DFA_SIZE) then DO_REALLOCATION; end if; STK(STKEND) := STATE; MARK_STATE(STATE); end PUT_ON_STACK; pragma INLINE(PUT_ON_STACK); procedure ADD_STATE(STATE : in INTEGER) is begin NUMSTATES := NUMSTATES + 1; if (NUMSTATES >= CURRENT_MAX_DFA_SIZE) then DO_REALLOCATION; end if; T(NUMSTATES) := STATE; HASHVAL := HASHVAL + STATE; end ADD_STATE; pragma INLINE(ADD_STATE); procedure STACK_STATE(STATE : in INTEGER) is begin PUT_ON_STACK(STATE); CHECK_ACCEPT(STATE); if ((NFACCNUM /= NIL) or (TRANSCHAR(STATE) /= SYM_EPSILON)) then ADD_STATE(STATE); end if; end STACK_STATE; pragma INLINE(STACK_STATE); begin NUMSTATES := NS_ADDR; if (not DID_STK_INIT) then STK := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFA_SIZE); DID_STK_INIT := TRUE; end if; NACC := 0; STKEND := 0; HASHVAL := 0; for NSTATE in 1 .. NUMSTATES loop NS := T(NSTATE); -- the state could be marked if we've already pushed it onto -- the stack if (not IS_MARKED(NS)) then PUT_ON_STACK(NS); null; end if; CHECK_ACCEPT(NS); HASHVAL := HASHVAL + NS; end loop; STKPOS := 1; while (STKPOS <= STKEND) loop NS := STK(STKPOS); TRANSSYM := TRANSCHAR(NS); if (TRANSSYM = SYM_EPSILON) then TSP := TRANS1(NS) + MARKER_DIFFERENCE; if (TSP /= NO_TRANSITION) then if (not IS_MARKED(TSP)) then STACK_STATE(TSP); end if; TSP := TRANS2(NS); if (TSP /= NO_TRANSITION) then if (not IS_MARKED(TSP)) then STACK_STATE(TSP); end if; end if; end if; end if; STKPOS := STKPOS + 1; end loop; -- clear out "visit" markers for CHK_STKPOS in 1 .. STKEND loop if (IS_MARKED(STK(CHK_STKPOS))) then UNMARK_STATE(STK(CHK_STKPOS)); else MISC.AFLEXFATAL("consistency check failed in epsclosure()"); end if; end loop; NS_ADDR := NUMSTATES; HV_ADDR := HASHVAL; NACC_ADDR := NACC; RESULT := T; end EPSCLOSURE; -- increase_max_dfas - increase the maximum number of DFAs procedure INCREASE_MAX_DFAS is begin CURRENT_MAX_DFAS := CURRENT_MAX_DFAS + MAX_DFAS_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(BASE, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DEF, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DFASIZ, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(ACCSIZ, CURRENT_MAX_DFAS); REALLOCATE_INTEGER_ARRAY(DHASH, CURRENT_MAX_DFAS); REALLOCATE_INT_PTR_ARRAY(DSS, CURRENT_MAX_DFAS); REALLOCATE_DFAACC_UNION(DFAACC, CURRENT_MAX_DFAS); end INCREASE_MAX_DFAS; -- ntod - convert an ndfa to a dfa -- -- creates the dfa corresponding to the ndfa we've constructed. the -- dfa starts out in state #1. procedure NTOD is ACCSET : INT_PTR; DS, NACC, NEWDS : INTEGER; DUPLIST, TARGFREQ, TARGSTATE, STATE : C_SIZE_ARRAY; SYMLIST : C_SIZE_BOOL_ARRAY; HASHVAL, NUMSTATES, DSIZE : INTEGER; NSET, DSET : INT_PTR; TARGPTR, TOTALTRANS, I, J, COMSTATE, COMFREQ, TARG : INTEGER; NUM_START_STATES, TODO_HEAD, TODO_NEXT : INTEGER; SNSRESULT : BOOLEAN; FULL_TABLE_TEMP_FILE : FILE_TYPE; BUF : VSTRING; NUM_NXT_STATES : INTEGER; use TEXT_IO; -- this is so find_table_space(...) will know where to start looking in -- chk/nxt for unused records for space to put in the state begin ACCSET := ALLOCATE_INTEGER_ARRAY(NUM_RULES + 1); NSET := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFA_SIZE); -- the "todo" queue is represented by the head, which is the DFA -- state currently being processed, and the "next", which is the -- next DFA state number available (not in use). We depend on the -- fact that snstods() returns DFA's \in increasing order/, and thus -- need only know the bounds of the dfas to be processed. TODO_HEAD := 0; TODO_NEXT := 0; for CNT in 0 .. CSIZE loop DUPLIST(CNT) := NIL; SYMLIST(CNT) := FALSE; end loop; for CNT in 0 .. NUM_RULES loop ACCSET(CNT) := NIL; end loop; if (TRACE) then NFA.DUMPNFA(SCSET(1)); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.PUT(STANDARD_ERROR, "DFA Dump:"); TEXT_IO.NEW_LINE(STANDARD_ERROR); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; TBLCMP.INITTBL; if (FULLTBL) then GEN.DO_SECT3_OUT; -- output user code up to ## SKELETON_MANAGER.SKELOUT; -- declare it "short" because it's a real long-shot that that -- won't be large enough begin -- make a temporary file to write yy_nxt array into CREATE(FULL_TABLE_TEMP_FILE, OUT_FILE); exception when USE_ERROR | NAME_ERROR => MISC.AFLEXFATAL("can't create temporary file"); end; NUM_NXT_STATES := 1; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, "( "); -- generate 0 entries for state #0 for CNT in 0 .. NUMECS loop MISC.MK2DATA(FULL_TABLE_TEMP_FILE, 0); end loop; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, " )"); -- force extra blank line next dataflush() DATALINE := NUMDATALINES; end if; -- create the first states NUM_START_STATES := LASTSC*2; for CNT in 1 .. NUM_START_STATES loop NUMSTATES := 1; -- for each start condition, make one state for the case when -- we're at the beginning of the line (the '%' operator) and -- one for the case when we're not if (CNT mod 2 = 1) then NSET(NUMSTATES) := SCSET((CNT/2) + 1); else NSET(NUMSTATES) := NFA.MKBRANCH(SCBOL(CNT/2), SCSET(CNT/2)); end if; DFA.EPSCLOSURE(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NSET); SNSTODS(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, DS, SNSRESULT); if (SNSRESULT) then NUMAS := NUMAS + NACC; TOTNST := TOTNST + NUMSTATES; TODO_NEXT := TODO_NEXT + 1; if (VARIABLE_TRAILING_CONTEXT_RULES and (NACC > 0)) then CHECK_TRAILING_CONTEXT(NSET, NUMSTATES, ACCSET, NACC); end if; end if; end loop; SNSTODS(NSET, 0, ACCSET, 0, 0, END_OF_BUFFER_STATE, SNSRESULT); if (not SNSRESULT) then MISC.AFLEXFATAL("could not create unique end-of-buffer state"); end if; NUMAS := NUMAS + 1; NUM_START_STATES := NUM_START_STATES + 1; TODO_NEXT := TODO_NEXT + 1; while (TODO_HEAD < TODO_NEXT) loop NUM_NXT_STATES := NUM_NXT_STATES + 1; TARGPTR := 0; TOTALTRANS := 0; for STATE_CNT in 1 .. NUMECS loop STATE(STATE_CNT) := 0; end loop; TODO_HEAD := TODO_HEAD + 1; DS := TODO_HEAD; DSET := DSS(DS); DSIZE := DFASIZ(DS); if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, "state # "); INT_IO.PUT(STANDARD_ERROR, DS, 1); TEXT_IO.PUT_LINE(STANDARD_ERROR, ":"); end if; SYMPARTITION(DSET, DSIZE, SYMLIST, DUPLIST); for SYM in 1 .. NUMECS loop if (SYMLIST(SYM)) then SYMLIST(SYM) := FALSE; if (DUPLIST(SYM) = NIL) then -- symbol has unique out-transitions NUMSTATES := SYMFOLLOWSET(DSET, DSIZE, SYM, NSET); DFA.EPSCLOSURE(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NSET); SNSTODS(NSET, NUMSTATES, ACCSET, NACC, HASHVAL, NEWDS, SNSRESULT); if (SNSRESULT) then TOTNST := TOTNST + NUMSTATES; TODO_NEXT := TODO_NEXT + 1; NUMAS := NUMAS + NACC; if (VARIABLE_TRAILING_CONTEXT_RULES and (NACC > 0)) then CHECK_TRAILING_CONTEXT(NSET, NUMSTATES, ACCSET, NACC); end if; end if; STATE(SYM) := NEWDS; if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, SYM, 1); TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, NEWDS, 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; TARGPTR := TARGPTR + 1; TARGFREQ(TARGPTR) := 1; TARGSTATE(TARGPTR) := NEWDS; NUMUNIQ := NUMUNIQ + 1; else -- sym's equivalence class has the same transitions -- as duplist(sym)'s equivalence class TARG := STATE(DUPLIST(SYM)); STATE(SYM) := TARG; if (TRACE) then TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, SYM, 1); TEXT_IO.PUT(STANDARD_ERROR, ASCII.HT); INT_IO.PUT(STANDARD_ERROR, TARG, 1); TEXT_IO.NEW_LINE(STANDARD_ERROR); end if; -- update frequency count for destination state I := 1; while (TARGSTATE(I) /= TARG) loop I := I + 1; end loop; TARGFREQ(I) := TARGFREQ(I) + 1; NUMDUP := NUMDUP + 1; end if; TOTALTRANS := TOTALTRANS + 1; DUPLIST(SYM) := NIL; end if; end loop; NUMSNPAIRS := NUMSNPAIRS + TOTALTRANS; if (CASEINS and not USEECS) then I := CHARACTER'POS('A'); J := CHARACTER'POS('a'); while (I < CHARACTER'POS('Z')) loop STATE(I) := STATE(J); I := I + 1; J := J + 1; end loop; end if; if (DS > NUM_START_STATES) then CHECK_FOR_BACKTRACKING(DS, STATE); end if; if (FULLTBL) then -- supply array's 0-element TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, ","); MISC.DATAFLUSH(FULL_TABLE_TEMP_FILE); TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, "( "); if (DS = END_OF_BUFFER_STATE) then MISC.MK2DATA(FULL_TABLE_TEMP_FILE, -END_OF_BUFFER_STATE); else MISC.MK2DATA(FULL_TABLE_TEMP_FILE, END_OF_BUFFER_STATE); end if; for CNT in 1 .. NUMECS loop -- jams are marked by negative of state number if ((STATE(CNT) /= 0)) then MISC.MK2DATA(FULL_TABLE_TEMP_FILE, STATE(CNT)); else MISC.MK2DATA(FULL_TABLE_TEMP_FILE, -DS); end if; end loop; TEXT_IO.PUT(FULL_TABLE_TEMP_FILE, " )"); -- force extra blank line next dataflush() DATALINE := NUMDATALINES; else if (DS = END_OF_BUFFER_STATE) then -- special case this state to make sure it does what it's -- supposed to, i.e., jam on end-of-buffer TBLCMP.STACK1(DS, 0, 0, JAMSTATE_CONST); else -- normal, compressed state -- determine which destination state is the most common, and -- how many transitions to it there are COMFREQ := 0; COMSTATE := 0; for CNT in 1 .. TARGPTR loop if (TARGFREQ(CNT) > COMFREQ) then COMFREQ := TARGFREQ(CNT); COMSTATE := TARGSTATE(CNT); end if; end loop; TBLCMP.BLDTBL(STATE, DS, TOTALTRANS, COMSTATE, COMFREQ); end if; end if; end loop; if (FULLTBL) then TEXT_IO.PUT("yy_nxt : constant array(0.."); INT_IO.PUT(NUM_NXT_STATES - 1, 1); TEXT_IO.PUT_LINE(" , ASCII.NUL..ASCII.DEL) of short :="); TEXT_IO.PUT_LINE(" ("); RESET(FULL_TABLE_TEMP_FILE, IN_FILE); while (not END_OF_FILE(FULL_TABLE_TEMP_FILE)) loop TSTRING.GET_LINE(FULL_TABLE_TEMP_FILE, BUF); TSTRING.PUT_LINE(BUF); end loop; DELETE(FULL_TABLE_TEMP_FILE); MISC.DATAEND; else TBLCMP.CMPTMPS; -- create compressed template entries -- create tables for all the states with only one out-transition while (ONESP > 0) loop TBLCMP.MK1TBL(ONESTATE(ONESP), ONESYM(ONESP), ONENEXT(ONESP), ONEDEF( ONESP)); ONESP := ONESP - 1; end loop; TBLCMP.MKDEFTBL; end if; end NTOD; -- snstods - converts a set of ndfa states into a dfa state -- -- on return, the dfa state number is in newds. procedure SNSTODS(SNS : in INT_PTR; NUMSTATES : in INTEGER; ACCSET : in INT_PTR; NACC, HASHVAL : in INTEGER; NEWDS_ADDR : out INTEGER; RESULT : out BOOLEAN) is DIDSORT : BOOLEAN := FALSE; J : INTEGER; NEWDS : INTEGER; OLDSNS : INT_PTR; begin for I in 1 .. LASTDFA loop if (HASHVAL = DHASH(I)) then if (NUMSTATES = DFASIZ(I)) then OLDSNS := DSS(I); if (not DIDSORT) then -- we sort the states in sns so we can compare it to -- oldsns quickly. we use bubble because there probably -- aren't very many states MISC.BUBBLE(SNS, NUMSTATES); DIDSORT := TRUE; end if; J := 1; while (J <= NUMSTATES) loop if (SNS(J) /= OLDSNS(J)) then exit; end if; J := J + 1; end loop; if (J > NUMSTATES) then DFAEQL := DFAEQL + 1; NEWDS_ADDR := I; RESULT := FALSE; return; end if; HSHCOL := HSHCOL + 1; else HSHSAVE := HSHSAVE + 1; end if; end if; end loop; -- make a new dfa LASTDFA := LASTDFA + 1; if (LASTDFA >= CURRENT_MAX_DFAS) then INCREASE_MAX_DFAS; end if; NEWDS := LASTDFA; DSS(NEWDS) := new UNBOUNDED_INT_ARRAY(0 .. NUMSTATES + 1); -- if we haven't already sorted the states in sns, we do so now, so that -- future comparisons with it can be made quickly if (not DIDSORT) then MISC.BUBBLE(SNS, NUMSTATES); end if; for I in 1 .. NUMSTATES loop DSS(NEWDS)(I) := SNS(I); end loop; DFASIZ(NEWDS) := NUMSTATES; DHASH(NEWDS) := HASHVAL; if (NACC = 0) then DFAACC(NEWDS).DFAACC_STATE := 0; ACCSIZ(NEWDS) := 0; else -- find lowest numbered rule so the disambiguating rule will work J := NUM_RULES + 1; for I in 1 .. NACC loop if (ACCSET(I) < J) then J := ACCSET(I); end if; end loop; DFAACC(NEWDS).DFAACC_STATE := J; end if; NEWDS_ADDR := NEWDS; RESULT := TRUE; return; exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in snstods()"); end SNSTODS; -- symfollowset - follow the symbol transitions one step function SYMFOLLOWSET(DS : in INT_PTR; DSIZE, TRANSSYM : in INTEGER; NSET : in INT_PTR) return INTEGER is NS, TSP, SYM, LENCCL, CH, NUMSTATES, CCLLIST : INTEGER; begin NUMSTATES := 0; for I in 1 .. DSIZE loop -- for each nfa state ns in the state set of ds NS := DS(I); SYM := TRANSCHAR(NS); TSP := TRANS1(NS); if (SYM < 0) then -- it's a character class SYM := -SYM; CCLLIST := CCLMAP(SYM); LENCCL := CCLLEN(SYM); if (CCLNG(SYM) /= 0) then for J in 0 .. LENCCL - 1 loop -- loop through negated character class CH := CHARACTER'POS(CCLTBL(CCLLIST + J)); if (CH > TRANSSYM) then exit; -- transsym isn't in negated ccl else if (CH = TRANSSYM) then goto BOTTOM; -- next 2 end if; end if; end loop; -- didn't find transsym in ccl NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; else for J in 0 .. LENCCL - 1 loop CH := CHARACTER'POS(CCLTBL(CCLLIST + J)); if (CH > TRANSSYM) then exit; else if (CH = TRANSSYM) then NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; exit; end if; end if; end loop; end if; else if ((SYM >= CHARACTER'POS('A')) and (SYM <= CHARACTER'POS('Z')) and CASEINS) then MISC.AFLEXFATAL("consistency check failed in symfollowset"); else if (SYM = SYM_EPSILON) then null; -- do nothing else if (ECGROUP(SYM) = TRANSSYM) then NUMSTATES := NUMSTATES + 1; NSET(NUMSTATES) := TSP; end if; end if; end if; end if; <<BOTTOM>> null; end loop; return NUMSTATES; end SYMFOLLOWSET; -- sympartition - partition characters with same out-transitions procedure SYMPARTITION(DS : in INT_PTR; NUMSTATES : in INTEGER; SYMLIST : in out C_SIZE_BOOL_ARRAY; DUPLIST : in out C_SIZE_ARRAY) is TCH, J, NS, LENCCL, CCLP, ICH : INTEGER; DUPFWD : C_SIZE_ARRAY; -- partitioning is done by creating equivalence classes for those -- characters which have out-transitions from the given state. Thus -- we are really creating equivalence classes of equivalence classes. begin for I in 1 .. NUMECS loop -- initialize equivalence class list DUPLIST(I) := I - 1; DUPFWD(I) := I + 1; end loop; DUPLIST(1) := NIL; DUPFWD(NUMECS) := NIL; DUPFWD(0) := 0; for I in 1 .. NUMSTATES loop NS := DS(I); TCH := TRANSCHAR(NS); if (TCH /= SYM_EPSILON) then if ((TCH < -LASTCCL) or (TCH > CSIZE)) then MISC.AFLEXFATAL("bad transition character detected in sympartition()") ; end if; if (TCH > 0) then -- character transition ECS.MKECHAR(ECGROUP(TCH), DUPFWD, DUPLIST); SYMLIST(ECGROUP(TCH)) := TRUE; else -- character class TCH := -TCH; LENCCL := CCLLEN(TCH); CCLP := CCLMAP(TCH); ECS.MKECCL(CCLTBL(CCLP .. CCLP + LENCCL), LENCCL, DUPFWD, DUPLIST, NUMECS); if (CCLNG(TCH) /= 0) then J := 0; for K in 0 .. LENCCL - 1 loop ICH := CHARACTER'POS(CCLTBL(CCLP + K)); J := J + 1; while (J < ICH) loop SYMLIST(J) := TRUE; J := J + 1; end loop; end loop; J := J + 1; while (J <= NUMECS) loop SYMLIST(J) := TRUE; J := J + 1; end loop; else for K in 0 .. LENCCL - 1 loop ICH := CHARACTER'POS(CCLTBL(CCLP + K)); SYMLIST(ICH) := TRUE; end loop; end if; end if; end if; end loop; end SYMPARTITION; end dfa;
[ { "context": "incipal through an Ada bean\n-- Copyright (C) 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 179, "score": 0.9998747110366821, "start": 164, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2012 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 210, "score": 0.9998809695243835, "start": 195, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "2 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 237, "score": 0.9999235272407532, "start": 212, "tag": "EMAIL", "value": "[email protected]" } ]
samples/beans/users.ads
jquorning/ada-asf
12
----------------------------------------------------------------------- -- users - Gives access to the OpenID principal through an Ada bean -- 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.Strings.Unbounded; with Util.Beans.Objects; with Util.Beans.Basic; with Util.Beans.Methods; package Users is -- Given an Email address, return the Gravatar link to the user image. -- (See http://en.gravatar.com/site/implement/hash/ and -- http://en.gravatar.com/site/implement/images/) function Get_Gravatar_Link (Email : in String) return String; -- A bean that expose information about the user type User_Info is new Util.Beans.Basic.Readonly_Bean and Util.Beans.Methods.Method_Bean with null record; -- Get the user information identified by the given name. overriding function Get_Value (From : in User_Info; Name : in String) return Util.Beans.Objects.Object; -- Logout by dropping the user session. procedure Logout (From : in out User_Info; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- This bean provides some methods that can be used in a Method_Expression overriding function Get_Method_Bindings (From : in User_Info) return Util.Beans.Methods.Method_Binding_Array_Access; -- An application bean. This instance is shared by all requests. User : aliased Users.User_Info; end Users;
6902
----------------------------------------------------------------------- -- users - Gives access to the OpenID principal through an Ada bean -- Copyright (C) 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Beans.Objects; with Util.Beans.Basic; with Util.Beans.Methods; package Users is -- Given an Email address, return the Gravatar link to the user image. -- (See http://en.gravatar.com/site/implement/hash/ and -- http://en.gravatar.com/site/implement/images/) function Get_Gravatar_Link (Email : in String) return String; -- A bean that expose information about the user type User_Info is new Util.Beans.Basic.Readonly_Bean and Util.Beans.Methods.Method_Bean with null record; -- Get the user information identified by the given name. overriding function Get_Value (From : in User_Info; Name : in String) return Util.Beans.Objects.Object; -- Logout by dropping the user session. procedure Logout (From : in out User_Info; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- This bean provides some methods that can be used in a Method_Expression overriding function Get_Method_Bindings (From : in User_Info) return Util.Beans.Methods.Method_Binding_Array_Access; -- An application bean. This instance is shared by all requests. User : aliased Users.User_Info; end Users;
true
----------------------------------------------------------------------- -- users - Gives access to the OpenID principal through an Ada bean -- Copyright (C) 2012 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Beans.Objects; with Util.Beans.Basic; with Util.Beans.Methods; package Users is -- Given an Email address, return the Gravatar link to the user image. -- (See http://en.gravatar.com/site/implement/hash/ and -- http://en.gravatar.com/site/implement/images/) function Get_Gravatar_Link (Email : in String) return String; -- A bean that expose information about the user type User_Info is new Util.Beans.Basic.Readonly_Bean and Util.Beans.Methods.Method_Bean with null record; -- Get the user information identified by the given name. overriding function Get_Value (From : in User_Info; Name : in String) return Util.Beans.Objects.Object; -- Logout by dropping the user session. procedure Logout (From : in out User_Info; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- This bean provides some methods that can be used in a Method_Expression overriding function Get_Method_Bindings (From : in User_Info) return Util.Beans.Methods.Method_Binding_Array_Access; -- An application bean. This instance is shared by all requests. User : aliased Users.User_Info; end Users;
[ { "context": "---------------------\n-- G E L A A S I S --\n-- ", "end": 115, "score": 0.6976557970046997, "start": 108, "tag": "NAME", "value": "G E L A" }, { "context": "---------------------\n-- Copyright (c) 2006-2013, Maxim Reznik\n-- All rights reserved.\n--\n-- Redistribution an", "end": 8782, "score": 0.9998596906661987, "start": 8770, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "the distribution.\n-- * Neither the name of the Maxim Reznik, IE nor the names of its\n-- contributors ma", "end": 9383, "score": 0.9998241662979126, "start": 9371, "tag": "NAME", "value": "Maxim Reznik" } ]
tools/uaflex/automatons.adb
faelys/gela-asis
4
------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Unchecked_Deallocation; package body Automatons is type Edge_Access_Access is access all Edge_Access; function Get_State (Automaton : in DFA; From : in State) return Edge_Access_Access; Error : exception; -------------- -- Add_Edge -- -------------- procedure Add_Edge (Automaton : in out DFA; From : in State; To : in State; Set : in Symbols.Symbol_Set) is use type Symbols.Symbol_Set; function Find_Prev (Ptr : in Edge_Access_Access; To : in State) return Edge_Access_Access; function Find_Prev (Ptr : in Edge_Access_Access; To : in State) return Edge_Access_Access is begin if Ptr.all = null then return Ptr; elsif Ptr.all.Jump <= To then return Ptr; else return Find_Prev (Ptr.all.Next'Access, To); end if; end Find_Prev; Ptr : Edge_Access_Access := Get_State (Automaton, From); Next : Edge_Access; begin Ptr := Find_Prev (Ptr, To); if Ptr.all /= null and then Ptr.all.Jump = To then Ptr.all.Symbol := Ptr.all.Symbol or Set; else Next := new Edge; Next.Next := Ptr.all; Next.Jump := To; Next.Symbol := Set; Ptr.all := Next; end if; end Add_Edge; --------------------- -- Clear_All_Sets -- --------------------- procedure Clear_All_Sets (Automaton : in out DFA) is begin if Automaton /= null then for I in 1 .. Automaton.Last - Automaton.First + 1 loop Positions.Clear (Automaton.States (I).Set); end loop; Clear_All_Sets (Automaton.Next); end if; end Clear_All_Sets; ------------------ -- Create_State -- ------------------ procedure Create_State (Automaton : in out DFA; S : out State; Set : in Positions.Set := Positions.Empty_Set; Start : in Natural := 0) is Temp : DFA; begin if Automaton = null or else Automaton.Last = Automaton.First + Length - 1 then Temp := new Node; if Automaton = null then Temp.First := 1; else Temp.First := Automaton.Last + 1; end if; Temp.Last := Temp.First - 1; Temp.Marked := Temp.Last; Temp.Next := Automaton; Automaton := Temp; end if; Automaton.Last := Automaton.Last + 1; S := Automaton.Last; Automaton.States (S - Automaton.First + 1).Set := Set; Automaton.States (S - Automaton.First + 1).Start := Start; end Create_State; ------------ -- Delete -- ------------ procedure Delete (Automaton : in out DFA) is procedure Free is new Ada.Unchecked_Deallocation (Node, DFA); begin if Automaton /= null then for I in 1 .. Automaton.Last - Automaton.First + 1 loop Positions.Clear (Automaton.States (I).Set); end loop; Delete (Automaton.Next); Free (Automaton); Automaton := null; end if; end Delete; ------------------ -- Edge_Symbols -- ------------------ function Edge_Symbols (Automaton : DFA; S : State; Edge : Positive) return Symbols.Symbol_Set is Ptr : Edge_Access := Get_State (Automaton, S).all; begin for I in 2 .. Edge loop Ptr := Ptr.Next; end loop; return Ptr.Symbol; end Edge_Symbols; --------------- -- Edge_Jump -- --------------- function Edge_Jump (Automaton : DFA; S : State; Edge : Positive) return State is Ptr : Edge_Access := Get_State (Automaton, S).all; begin for I in 2 .. Edge loop Ptr := Ptr.Next; end loop; return Ptr.Jump; end Edge_Jump; ----------- -- Edges -- ----------- function Edges (Automaton : DFA; S : State) return Natural is Ptr : Edge_Access := Get_State (Automaton, S).all; Count : Natural := 0; begin while Ptr /= null loop Ptr := Ptr.Next; Count := Count + 1; end loop; return Count; end Edges; -------------- -- Get_Next -- -------------- procedure Get_Next (Automaton : in out DFA; S : out State; Set : out Positions.Set) is begin if Automaton.Next /= null and then Has_More (Automaton.Next) then Get_Next (Automaton.Next, S, Set); elsif Has_More (Automaton) then Automaton.Marked := Automaton.Marked + 1; S := Automaton.Marked; Set := Automaton.States (S - Automaton.First + 1).Set; else raise Error; end if; end Get_Next; --------------- -- Get_State -- --------------- function Get_State (Automaton : in DFA; From : in State) return Edge_Access_Access is begin if Automaton = null or else From > Automaton.Last then raise Error; elsif From < Automaton.First then return Get_State (Automaton.Next, From); else return Automaton.States (From - Automaton.First + 1).Edge'Access; end if; end Get_State; --------------- -- Get_Token -- --------------- function Get_Token (Automaton : DFA; S : State) return Token is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then return Get_Token (Automaton.Next, S); else return Automaton.States (S - Automaton.First + 1).Target; end if; end Get_Token; --------------- -- Get_Start -- --------------- function Get_Start (Automaton : DFA; S : State) return Natural is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then return Get_Start (Automaton.Next, S); else return Automaton.States (S - Automaton.First + 1).Start; end if; end Get_Start; -------------- -- Has_More -- -------------- function Has_More (Automaton : in DFA) return Boolean is begin return Automaton.Marked < Automaton.Last; end Has_More; ---------------- -- Last_State -- ---------------- function Last_State (Automaton : DFA) return State is begin if Automaton = null then return 0; else return Automaton.Last; end if; end Last_State; ---------------- -- Need_State -- ---------------- procedure Need_State (Automaton : in out DFA; S : out State; Set : in out Positions.Set; Start : in Natural := 0) is function Exist (Automaton : in DFA) return Boolean is use Positions; begin if Automaton = null then return False; end if; for I in 1 .. Automaton.Last - Automaton.First + 1 loop if Equal (Automaton.States (I).Set, Set) then S := Automaton.First + I - 1; Positions.Clear (Set); return True; end if; end loop; return Exist (Automaton.Next); end Exist; begin if not Exist (Automaton) then Create_State (Automaton, S, Set, Start); end if; end Need_State; --------------- -- Set_Token -- --------------- procedure Set_Token (Automaton : in out DFA; S : in State; Target : in Token) is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then Set_Token (Automaton.Next, S, Target); else Automaton.States (S - Automaton.First + 1).Target := Target; end if; end Set_Token; end Automatons; ------------------------------------------------------------------------------ -- 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. ------------------------------------------------------------------------------
26653
------------------------------------------------------------------------------ -- <NAME> A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Unchecked_Deallocation; package body Automatons is type Edge_Access_Access is access all Edge_Access; function Get_State (Automaton : in DFA; From : in State) return Edge_Access_Access; Error : exception; -------------- -- Add_Edge -- -------------- procedure Add_Edge (Automaton : in out DFA; From : in State; To : in State; Set : in Symbols.Symbol_Set) is use type Symbols.Symbol_Set; function Find_Prev (Ptr : in Edge_Access_Access; To : in State) return Edge_Access_Access; function Find_Prev (Ptr : in Edge_Access_Access; To : in State) return Edge_Access_Access is begin if Ptr.all = null then return Ptr; elsif Ptr.all.Jump <= To then return Ptr; else return Find_Prev (Ptr.all.Next'Access, To); end if; end Find_Prev; Ptr : Edge_Access_Access := Get_State (Automaton, From); Next : Edge_Access; begin Ptr := Find_Prev (Ptr, To); if Ptr.all /= null and then Ptr.all.Jump = To then Ptr.all.Symbol := Ptr.all.Symbol or Set; else Next := new Edge; Next.Next := Ptr.all; Next.Jump := To; Next.Symbol := Set; Ptr.all := Next; end if; end Add_Edge; --------------------- -- Clear_All_Sets -- --------------------- procedure Clear_All_Sets (Automaton : in out DFA) is begin if Automaton /= null then for I in 1 .. Automaton.Last - Automaton.First + 1 loop Positions.Clear (Automaton.States (I).Set); end loop; Clear_All_Sets (Automaton.Next); end if; end Clear_All_Sets; ------------------ -- Create_State -- ------------------ procedure Create_State (Automaton : in out DFA; S : out State; Set : in Positions.Set := Positions.Empty_Set; Start : in Natural := 0) is Temp : DFA; begin if Automaton = null or else Automaton.Last = Automaton.First + Length - 1 then Temp := new Node; if Automaton = null then Temp.First := 1; else Temp.First := Automaton.Last + 1; end if; Temp.Last := Temp.First - 1; Temp.Marked := Temp.Last; Temp.Next := Automaton; Automaton := Temp; end if; Automaton.Last := Automaton.Last + 1; S := Automaton.Last; Automaton.States (S - Automaton.First + 1).Set := Set; Automaton.States (S - Automaton.First + 1).Start := Start; end Create_State; ------------ -- Delete -- ------------ procedure Delete (Automaton : in out DFA) is procedure Free is new Ada.Unchecked_Deallocation (Node, DFA); begin if Automaton /= null then for I in 1 .. Automaton.Last - Automaton.First + 1 loop Positions.Clear (Automaton.States (I).Set); end loop; Delete (Automaton.Next); Free (Automaton); Automaton := null; end if; end Delete; ------------------ -- Edge_Symbols -- ------------------ function Edge_Symbols (Automaton : DFA; S : State; Edge : Positive) return Symbols.Symbol_Set is Ptr : Edge_Access := Get_State (Automaton, S).all; begin for I in 2 .. Edge loop Ptr := Ptr.Next; end loop; return Ptr.Symbol; end Edge_Symbols; --------------- -- Edge_Jump -- --------------- function Edge_Jump (Automaton : DFA; S : State; Edge : Positive) return State is Ptr : Edge_Access := Get_State (Automaton, S).all; begin for I in 2 .. Edge loop Ptr := Ptr.Next; end loop; return Ptr.Jump; end Edge_Jump; ----------- -- Edges -- ----------- function Edges (Automaton : DFA; S : State) return Natural is Ptr : Edge_Access := Get_State (Automaton, S).all; Count : Natural := 0; begin while Ptr /= null loop Ptr := Ptr.Next; Count := Count + 1; end loop; return Count; end Edges; -------------- -- Get_Next -- -------------- procedure Get_Next (Automaton : in out DFA; S : out State; Set : out Positions.Set) is begin if Automaton.Next /= null and then Has_More (Automaton.Next) then Get_Next (Automaton.Next, S, Set); elsif Has_More (Automaton) then Automaton.Marked := Automaton.Marked + 1; S := Automaton.Marked; Set := Automaton.States (S - Automaton.First + 1).Set; else raise Error; end if; end Get_Next; --------------- -- Get_State -- --------------- function Get_State (Automaton : in DFA; From : in State) return Edge_Access_Access is begin if Automaton = null or else From > Automaton.Last then raise Error; elsif From < Automaton.First then return Get_State (Automaton.Next, From); else return Automaton.States (From - Automaton.First + 1).Edge'Access; end if; end Get_State; --------------- -- Get_Token -- --------------- function Get_Token (Automaton : DFA; S : State) return Token is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then return Get_Token (Automaton.Next, S); else return Automaton.States (S - Automaton.First + 1).Target; end if; end Get_Token; --------------- -- Get_Start -- --------------- function Get_Start (Automaton : DFA; S : State) return Natural is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then return Get_Start (Automaton.Next, S); else return Automaton.States (S - Automaton.First + 1).Start; end if; end Get_Start; -------------- -- Has_More -- -------------- function Has_More (Automaton : in DFA) return Boolean is begin return Automaton.Marked < Automaton.Last; end Has_More; ---------------- -- Last_State -- ---------------- function Last_State (Automaton : DFA) return State is begin if Automaton = null then return 0; else return Automaton.Last; end if; end Last_State; ---------------- -- Need_State -- ---------------- procedure Need_State (Automaton : in out DFA; S : out State; Set : in out Positions.Set; Start : in Natural := 0) is function Exist (Automaton : in DFA) return Boolean is use Positions; begin if Automaton = null then return False; end if; for I in 1 .. Automaton.Last - Automaton.First + 1 loop if Equal (Automaton.States (I).Set, Set) then S := Automaton.First + I - 1; Positions.Clear (Set); return True; end if; end loop; return Exist (Automaton.Next); end Exist; begin if not Exist (Automaton) then Create_State (Automaton, S, Set, Start); end if; end Need_State; --------------- -- Set_Token -- --------------- procedure Set_Token (Automaton : in out DFA; S : in State; Target : in Token) is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then Set_Token (Automaton.Next, S, Target); else Automaton.States (S - Automaton.First + 1).Target := Target; end if; end Set_Token; end Automatons; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- 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 <NAME>, 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. ------------------------------------------------------------------------------
true
------------------------------------------------------------------------------ -- PI:NAME:<NAME>END_PI A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Unchecked_Deallocation; package body Automatons is type Edge_Access_Access is access all Edge_Access; function Get_State (Automaton : in DFA; From : in State) return Edge_Access_Access; Error : exception; -------------- -- Add_Edge -- -------------- procedure Add_Edge (Automaton : in out DFA; From : in State; To : in State; Set : in Symbols.Symbol_Set) is use type Symbols.Symbol_Set; function Find_Prev (Ptr : in Edge_Access_Access; To : in State) return Edge_Access_Access; function Find_Prev (Ptr : in Edge_Access_Access; To : in State) return Edge_Access_Access is begin if Ptr.all = null then return Ptr; elsif Ptr.all.Jump <= To then return Ptr; else return Find_Prev (Ptr.all.Next'Access, To); end if; end Find_Prev; Ptr : Edge_Access_Access := Get_State (Automaton, From); Next : Edge_Access; begin Ptr := Find_Prev (Ptr, To); if Ptr.all /= null and then Ptr.all.Jump = To then Ptr.all.Symbol := Ptr.all.Symbol or Set; else Next := new Edge; Next.Next := Ptr.all; Next.Jump := To; Next.Symbol := Set; Ptr.all := Next; end if; end Add_Edge; --------------------- -- Clear_All_Sets -- --------------------- procedure Clear_All_Sets (Automaton : in out DFA) is begin if Automaton /= null then for I in 1 .. Automaton.Last - Automaton.First + 1 loop Positions.Clear (Automaton.States (I).Set); end loop; Clear_All_Sets (Automaton.Next); end if; end Clear_All_Sets; ------------------ -- Create_State -- ------------------ procedure Create_State (Automaton : in out DFA; S : out State; Set : in Positions.Set := Positions.Empty_Set; Start : in Natural := 0) is Temp : DFA; begin if Automaton = null or else Automaton.Last = Automaton.First + Length - 1 then Temp := new Node; if Automaton = null then Temp.First := 1; else Temp.First := Automaton.Last + 1; end if; Temp.Last := Temp.First - 1; Temp.Marked := Temp.Last; Temp.Next := Automaton; Automaton := Temp; end if; Automaton.Last := Automaton.Last + 1; S := Automaton.Last; Automaton.States (S - Automaton.First + 1).Set := Set; Automaton.States (S - Automaton.First + 1).Start := Start; end Create_State; ------------ -- Delete -- ------------ procedure Delete (Automaton : in out DFA) is procedure Free is new Ada.Unchecked_Deallocation (Node, DFA); begin if Automaton /= null then for I in 1 .. Automaton.Last - Automaton.First + 1 loop Positions.Clear (Automaton.States (I).Set); end loop; Delete (Automaton.Next); Free (Automaton); Automaton := null; end if; end Delete; ------------------ -- Edge_Symbols -- ------------------ function Edge_Symbols (Automaton : DFA; S : State; Edge : Positive) return Symbols.Symbol_Set is Ptr : Edge_Access := Get_State (Automaton, S).all; begin for I in 2 .. Edge loop Ptr := Ptr.Next; end loop; return Ptr.Symbol; end Edge_Symbols; --------------- -- Edge_Jump -- --------------- function Edge_Jump (Automaton : DFA; S : State; Edge : Positive) return State is Ptr : Edge_Access := Get_State (Automaton, S).all; begin for I in 2 .. Edge loop Ptr := Ptr.Next; end loop; return Ptr.Jump; end Edge_Jump; ----------- -- Edges -- ----------- function Edges (Automaton : DFA; S : State) return Natural is Ptr : Edge_Access := Get_State (Automaton, S).all; Count : Natural := 0; begin while Ptr /= null loop Ptr := Ptr.Next; Count := Count + 1; end loop; return Count; end Edges; -------------- -- Get_Next -- -------------- procedure Get_Next (Automaton : in out DFA; S : out State; Set : out Positions.Set) is begin if Automaton.Next /= null and then Has_More (Automaton.Next) then Get_Next (Automaton.Next, S, Set); elsif Has_More (Automaton) then Automaton.Marked := Automaton.Marked + 1; S := Automaton.Marked; Set := Automaton.States (S - Automaton.First + 1).Set; else raise Error; end if; end Get_Next; --------------- -- Get_State -- --------------- function Get_State (Automaton : in DFA; From : in State) return Edge_Access_Access is begin if Automaton = null or else From > Automaton.Last then raise Error; elsif From < Automaton.First then return Get_State (Automaton.Next, From); else return Automaton.States (From - Automaton.First + 1).Edge'Access; end if; end Get_State; --------------- -- Get_Token -- --------------- function Get_Token (Automaton : DFA; S : State) return Token is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then return Get_Token (Automaton.Next, S); else return Automaton.States (S - Automaton.First + 1).Target; end if; end Get_Token; --------------- -- Get_Start -- --------------- function Get_Start (Automaton : DFA; S : State) return Natural is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then return Get_Start (Automaton.Next, S); else return Automaton.States (S - Automaton.First + 1).Start; end if; end Get_Start; -------------- -- Has_More -- -------------- function Has_More (Automaton : in DFA) return Boolean is begin return Automaton.Marked < Automaton.Last; end Has_More; ---------------- -- Last_State -- ---------------- function Last_State (Automaton : DFA) return State is begin if Automaton = null then return 0; else return Automaton.Last; end if; end Last_State; ---------------- -- Need_State -- ---------------- procedure Need_State (Automaton : in out DFA; S : out State; Set : in out Positions.Set; Start : in Natural := 0) is function Exist (Automaton : in DFA) return Boolean is use Positions; begin if Automaton = null then return False; end if; for I in 1 .. Automaton.Last - Automaton.First + 1 loop if Equal (Automaton.States (I).Set, Set) then S := Automaton.First + I - 1; Positions.Clear (Set); return True; end if; end loop; return Exist (Automaton.Next); end Exist; begin if not Exist (Automaton) then Create_State (Automaton, S, Set, Start); end if; end Need_State; --------------- -- Set_Token -- --------------- procedure Set_Token (Automaton : in out DFA; S : in State; Target : in Token) is begin if Automaton = null or else S > Automaton.Last then raise Error; elsif S < Automaton.First then Set_Token (Automaton.Next, S, Target); else Automaton.States (S - Automaton.First + 1).Target := Target; end if; end Set_Token; end Automatons; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, PI:NAME:<NAME>END_PI -- 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 PI:NAME:<NAME>END_PI, 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. ------------------------------------------------------------------------------
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998558163642883, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999313354492188, "start": 37, "tag": "EMAIL", "value": "[email protected]" } ]
source/oasis/program-elements-expressions.ads
optikos/oasis
0
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Vectors; package Program.Elements.Expressions is pragma Pure (Program.Elements.Expressions); type Expression is limited interface and Program.Elements.Element; type Expression_Access is access all Expression'Class with Storage_Size => 0; type Expression_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Expression_Vector_Access is access all Expression_Vector'Class with Storage_Size => 0; overriding function Element (Self : Expression_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Expression; function To_Expression (Self : Expression_Vector'Class; Index : Positive) return not null Expression_Access is (Self.Element (Index).To_Expression); end Program.Elements.Expressions;
24710
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Vectors; package Program.Elements.Expressions is pragma Pure (Program.Elements.Expressions); type Expression is limited interface and Program.Elements.Element; type Expression_Access is access all Expression'Class with Storage_Size => 0; type Expression_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Expression_Vector_Access is access all Expression_Vector'Class with Storage_Size => 0; overriding function Element (Self : Expression_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Expression; function To_Expression (Self : Expression_Vector'Class; Index : Positive) return not null Expression_Access is (Self.Element (Index).To_Expression); end Program.Elements.Expressions;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Vectors; package Program.Elements.Expressions is pragma Pure (Program.Elements.Expressions); type Expression is limited interface and Program.Elements.Element; type Expression_Access is access all Expression'Class with Storage_Size => 0; type Expression_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Expression_Vector_Access is access all Expression_Vector'Class with Storage_Size => 0; overriding function Element (Self : Expression_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Expression; function To_Expression (Self : Expression_Vector'Class; Index : Positive) return not null Expression_Access is (Self.Element (Index).To_Expression); end Program.Elements.Expressions;
[ { "context": " --\n-- Copyright (C) 2001 A.M.F.Vargas --\n-- Antonio M", "end": 266, "score": 0.9998714923858643, "start": 254, "tag": "NAME", "value": "A.M.F.Vargas" }, { "context": "M.F.Vargas --\n-- Antonio M. F. Vargas --\n-- ", "end": 327, "score": 0.9998727440834045, "start": 307, "tag": "NAME", "value": "Antonio M. F. Vargas" }, { "context": " --\n-- Ponta Delgada - Azores - Portugal --\n-- ", "end": 389, "score": 0.5144278407096863, "start": 388, "tag": "NAME", "value": "g" }, { "context": " --\n-- http://www.adapower.net/~avargas --\n-- E-mail: av", "end": 483, "score": 0.6127126216888428, "start": 476, "tag": "USERNAME", "value": "avargas" }, { "context": "gas --\n-- E-mail: [email protected] --\n-- ---------------------", "end": 551, "score": 0.9999325275421143, "start": 531, "tag": "EMAIL", "value": "[email protected]" } ]
thirdparty/adasdl/thin/adasdl/AdaSDL/binding/sdl-events.ads
Lucretia/old_nehe_ada95
0
-- ----------------------------------------------------------------- -- -- AdaSDL -- -- Binding to Simple Direct Media Layer -- -- Copyright (C) 2001 A.M.F.Vargas -- -- Antonio M. F. Vargas -- -- Ponta Delgada - Azores - Portugal -- -- http://www.adapower.net/~avargas -- -- E-mail: [email protected] -- -- ----------------------------------------------------------------- -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This 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 -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- 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 is an Ada binding to SDL ( Simple DirectMedia Layer from -- -- Sam Lantinga - www.libsld.org ) -- -- **************************************************************** -- -- In order to help the Ada programmer, the comments in this file -- -- are, in great extent, a direct copy of the original text in the -- -- SDL header files. -- -- **************************************************************** -- with System; with Interfaces.C; with SDL.Types; use SDL.Types; with SDL.Keyboard; with SDL.Active; with SDL.Mouse; with SDL.Joystick; package SDL.Events is type Event_Type is new Interfaces.Unsigned_8; for Event_Type'Size use 8; -- pragma Convention (C, Event_Type); package I renames Interfaces; package M renames SDL.Mouse; package Jy renames SDL.Joystick; -- ------------------ -- Orginal C Event enumerations -- ------------------ -- Unused (do not remove) NOEVENT : constant Event_Type := 0; -- Application loses/gains visibility ISACTIVEEVENT : constant Event_Type := 1; -- Keys pressed KEYDOWN : constant Event_Type := 2; -- Keys released KEYUP : constant Event_Type := 3; -- Mouse moved MOUSEMOTION : constant Event_Type := 4; -- Mouse button pressed MOUSEBUTTONDOWN : constant Event_Type := 5; -- Mouse button released MOUSEBUTTONUP : constant Event_Type := 6; -- Joystick axis motion JOYAXISMOTION : constant Event_Type := 7; -- Joystick trackball motion JOYBALLMOTION : constant Event_Type := 8; -- Joystick hat position change JOYHATMOTION : constant Event_Type := 9; -- Joystick button pressed JOYBUTTONDOWN : constant Event_Type := 10; -- Joystick button released JOYBUTTONUP : constant Event_Type := 11; -- User-requested quit QUIT : constant Event_Type := 12; -- System specific event ISSYSWMEVENT : constant Event_Type := 13; -- Reserved for future use.. EVENT_RESERVEDA : constant Event_Type := 14; -- Reserved for future use.. EVENT_RESERVEDB : constant Event_Type := 15; -- User resized video mode VIDEORESIZE : constant Event_Type := 16; -- Reserved for future use.. EVENT_RESERVED1 : constant Event_Type := 17; -- Reserved for future use.. EVENT_RESERVED2 : constant Event_Type := 18; -- Reserved for future use.. EVENT_RESERVED3 : constant Event_Type := 19; -- Reserved for future use.. EVENT_RESERVED4 : constant Event_Type := 20; -- Reserved for future use.. EVENT_RESERVED5 : constant Event_Type := 21; -- Reserved for future use.. EVENT_RESERVED6 : constant Event_Type := 22; -- Reserved for future use.. EVENT_RESERVED7 : constant Event_Type := 23; -- Events USEREVENT through MAXEVENTS-1 are for your use ISUSEREVENT : constant Event_Type := 24; -- This last event is only for bounding internal arrays -- It is the number of bits in the event mask datatype -- Uint32 NUMEVENTS : constant Event_Type := 32; -- Predefined event masks type Event_Mask is mod 2**Integer (NUMEVENTS); ACTIVEEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISACTIVEEVENT))); KEYDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYDOWN))); KEYUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYUP))); MOUSEMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION))); MOUSEBUTTONDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN))); MOUSEBUTTONUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP))); MOUSEEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP))); JOYAXISMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION))); JOYBALLMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION))); JOYHATMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION))); JOYBUTTONDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN))); JOYBUTTONUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP))); JOYEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP))); VIDEORESIZEMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (VIDEORESIZE))); QUITMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (QUIT))); SYSWMEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISSYSWMEVENT))); ALLEVENTS : constant Event_Mask := 16#FFFFFFFF#; -- Application visibility event structure type ActiveEvent is record -- the_type, -- ISACTIVEEVENT the_type : Event_Type; -- ISACTIVEEVENT; gain, -- Whether given states were gained or lost (1/0) state : SDL.Active.Active_State; -- A mask of the focus states end record; pragma Convention (C, ActiveEvent); -- Keyboard event structure type KeyboardEvent is record the_type : Event_Type; -- KEYDOWN or KEYUP which : Uint8; -- The keyboard device index state : Uint8; -- PRESSED or RELEASED keysym : aliased SDL.Keyboard.keysym; end record; pragma Convention (C, KeyboardEvent); -- Mouse motion event structure type MouseMotionEvent is record the_type : Event_Type; -- MOUSEMOTION which : Uint8; -- The mouse device index state : Uint8; -- The current state x, y : Uint16; -- The X/Y coordinates of the mouse xrel : Sint16; -- The relative motion in the X direction yrel : Sint16; -- The relative motion in the Y direction end record; pragma Convention (C, MouseMotionEvent); -- Mouse button event structure type MouseButtonEvent is record the_type : Event_Type; -- MOUSEBUTTONDOWN or MOUSEBUTTONUP which : Uint8; -- The mouse device index button : Uint8; -- The mouse button index state : M.Mouse_Button_State; -- PRESSED or RELEASED x, y : Uint16; -- The X/Y coordinates of the mouse at -- press time end record; pragma Convention (C, MouseButtonEvent); -- Joystick axis motion event structure type JoyAxisEvent is record the_type : Event_Type; -- JOYAXISMOTION which : Uint8; -- The joystick device index axis : Uint8; -- The joystick axis index value : Sint16; -- The axis value (range: -32768 to 32767) end record; pragma Convention (C, JoyAxisEvent); -- Joystick trackball motion event structure type JoyBallEvent is record the_type : Event_Type; -- JOYBALLMOTION which : Uint8; -- The joystick device index ball : Uint8; -- The joystick trackball index xrel : Sint16; -- The relative motion in the X direction yrel : Sint16; -- The relative motion in the Y direction end record; pragma Convention (C, JoyBallEvent); -- Joystick hat position change event structure type JoyHatEvent is record the_type : Event_Type; -- JOYHATMOTION which : Uint8; -- The joystick device index hat : Uint8; -- The joystick hat index value : Jy.HAT_State; -- The hat position value -- 8 1 2 -- 7 0 3 -- 6 5 4 -- Note that zero means the POV is centered. end record; pragma Convention (C, JoyHatEvent); -- Joystick button event structure */ type JoyButtonEvent is record the_type : Event_Type; -- JOYBUTTONDOWN or JOYBUTTONUP which : Uint8; -- The joystick device index button : Uint8; -- The joystick button index state : Uint8; -- PRESSED or RELEASED end record; pragma Convention (C, JoyButtonEvent); -- The "window resized" event -- When you get this event, you are responsible for setting a new video -- mode with the new width and height. type ResizeEvent is record the_type : Event_Type; -- VIDEORESIZE w, h : C.int; -- New width and height end record; pragma Convention (C, ResizeEvent); -- The "quit requested" event type QuitEvent is record the_type : Event_Type; -- QUIT end record; pragma Convention (C, QuitEvent); -- A user-defined event type type UserEvent is record the_type : Event_Type; -- USEREVENT through NUMEVENTS-1 code : C.int; -- User defined event code data1 : void_ptr; -- User defined data pointer data2 : void_ptr; -- User defined data pointer end record; pragma Convention (C, UserEvent); type SysWMmsg_ptr is new System.Address; -- If you want to use this event, you should use SDL.Syswm type SysWMEvent is record the_type : Event_Type; msg : SysWMmsg_ptr; end record; pragma Convention (C, SysWMEvent); type Event_Selection is ( Is_Event_Type, Is_ActiveEvent, Is_KeyboardEvent, Is_MouseMotionEvent, Is_MouseButtonEvent, Is_JoyAxisEvent, Is_JoyBallEvent, Is_JoyHatEvent, Is_JoyButtonEvent, Is_ResizeEvent, Is_QuitEvent, Is_UserEvent, Is_SysWMEvent); -- General event structure type Event (Event_Selec : Event_Selection := Is_Event_Type) is record case Event_Selec is when Is_Event_Type => the_type : Event_Type; when Is_ActiveEvent => active : ActiveEvent; when Is_KeyboardEvent => key : KeyboardEvent; when Is_MouseMotionEvent => motion : MouseMotionEvent; when Is_MouseButtonEvent => button : MouseButtonEvent; when Is_JoyAxisEvent => jaxis : JoyAxisEvent; when Is_JoyBallEvent => jball : JoyBallEvent; when Is_JoyHatEvent => jhat : JoyHatEvent; when Is_JoyButtonEvent => jbutton : JoyButtonEvent; when Is_ResizeEvent => resize : ResizeEvent; when Is_QuitEvent => quit : QuitEvent; when Is_UserEvent => user : UserEvent; when Is_SysWMEvent => syswm : SysWMEvent; end case; end record; pragma Convention (C, Event); pragma Unchecked_Union (Event); type Event_ptr is access all Event; pragma Convention (C, Event_ptr); -- ------------------- -- Function prototypes -- ------------------- -- Pumps the event loop, gathering events from the input devices. -- This function updates the event queue and internal input device state. -- This should only be run in the thread that sets the video mode. procedure PumpEvents; pragma Import (C, PumpEvents, "SDL_PumpEvents"); -- Checks the event queue for messages and optionally returns them. -- If 'action' is ADDEVENT, up to 'numevents' events will be added to -- the back of the event queue. -- If 'action' is PEEKEVENT, up to 'numevents' events at the front -- of the event queue, matching 'mask', will be returned and will not -- be removed from the queue. -- If 'action' is GETEVENT, up to 'numevents' events at the front -- of the event queue, matching 'mask', will be returned and will be -- removed from the queue. -- This function returns the number of events actually stored, or -1 -- if there was an error. This function is thread-safe. type eventaction is new C.int; ADDEVENT : constant := 0; PEEKEVENT : constant := 1; GETEVENT : constant := 2; type Events_Array is array (Natural range <>) of Event; procedure PeepEventsVP ( result : out C.int; events : in out Events_Array; numevents : C.int; action : eventaction; mask : Event_Mask); pragma Import (C, PeepEventsVP, "SDL_PeepEvents"); pragma Import_Valued_Procedure (PeepEventsVP); -- From Ada this function is to be called only as -- ... := PeepEvents (null, 0, the_action, the_mask); -- in other cases use PeepEventsVP. function PeepEvents ( events : Event_ptr; numevents : C.int; action : eventaction; mask : Event_Mask) return C.int; pragma Import (C, PeepEvents, "SDL_PeepEvents"); -- pending events, or 0 if there are none available. If 'event' is not -- NULL, the next event is removed from the queue and stored in that area. function PollEvent (the_event : access Event) return C.int; pragma Import (C, PollEvent, "SDL_PollEvent"); -- Check the pending events. Doesn't remove them. function Poll_Event return C.int; pragma Inline (Poll_Event); -- A corresponding Valued Procedure procedure PollEventVP (result : out C.int; the_event : in out Event); pragma Import (C, PollEventVP, "SDL_PollEvent"); pragma Import_Valued_Procedure (PollEventVP); -- Waits indefinitely for the next available event, returning 1, or 0 -- if there was an error while waiting for events. If 'event' is not -- NULL, the next event is removed from the queue and stored in that area. function WaitEvent (event : Event_ptr) return C.int; procedure WaitEvent (event : Event_ptr); procedure WaitEvent (the_event : in out Event); pragma Import (C, WaitEvent, "SDL_WaitEvent"); procedure Wait_Event ( Result : out C.int; the_event : in out Event); pragma Import (C, Wait_Event, "SDL_WaitEvent"); pragma Import_Valued_Procedure (Wait_Event); function Wait_Any_Event return C.int; pragma Inline (Wait_Any_Event); -- Add an event to the event queue. -- This function returns 0, or -1 if the event couldn't be added to -- the event queue. If the event queue is full, this function fails. function PushEvent (event : Event_ptr) return C.int; procedure PushEvent (event : Event_ptr); function PushEvent (the_event : Event) return C.int; procedure PushEvent (the_event : Event); pragma Import (C, PushEvent, "SDL_PushEvent"); -- This function sets up a filter to process all events before they -- change internal state and are posted to the internal event queue. -- The filter is protypted as: type EventFilter_ptr is access function (event : Event_ptr) return C.int; pragma Convention (C, EventFilter_ptr); -- If the filter returns 1, then the event will be added to the internal -- queue. If it returns 0, then the event will be dropped from the queue, -- but the internal state will still be updated. This allows selective -- filtering of dynamically arriving events. -- WARNING: Be very careful of what you do in the event filter function, -- as it may run in a different thread! -- There is one caveat when dealing with the QUITEVENT event type. The -- event filter is only called when the window manager desires to close the -- application window. If the event filter returns 1, then the window will -- be closed, otherwise the window will remain open if possible. -- If the quit event is generated by an interrupt signal, it will bypass -- the internal queue and be delivered to the application at the next event -- poll. procedure SetEventFilter (filter : EventFilter_ptr); pragma Import (C, SetEventFilter, "SDL_SetEventFilter"); -- Return the current event filter - can be used to "chain" filters. -- If there is no event filter set, this function returns NULL. function GetEventFilter return EventFilter_ptr; pragma Import (C, GetEventFilter, "SDL_GetEventFilter"); -- This function allows you to set the state of processing certain events. -- If 'state' is set to IGNORE, that event will be automatically dropped -- from the event queue and will not event be filtered. -- If 'state' is set to ENABLE, that event will be processed normally. -- If 'state' is set to QUERY, EventState will return the -- current processing state of the specified event. QUERY : constant := -1; IGNORE : constant := 0; DISABLE : constant := 0; ENABLE : constant := 1; function EventState ( the_type : Event_Type; state : C.int) return Uint8; procedure EventState ( the_type : Event_Type; state : C.int); pragma Import (C, EventState, "SDL_EventState"); end SDL.Events;
10878
-- ----------------------------------------------------------------- -- -- AdaSDL -- -- Binding to Simple Direct Media Layer -- -- Copyright (C) 2001 <NAME> -- -- <NAME> -- -- Ponta Del<NAME>ada - Azores - Portugal -- -- http://www.adapower.net/~avargas -- -- E-mail: <EMAIL> -- -- ----------------------------------------------------------------- -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This 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 -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- 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 is an Ada binding to SDL ( Simple DirectMedia Layer from -- -- Sam Lantinga - www.libsld.org ) -- -- **************************************************************** -- -- In order to help the Ada programmer, the comments in this file -- -- are, in great extent, a direct copy of the original text in the -- -- SDL header files. -- -- **************************************************************** -- with System; with Interfaces.C; with SDL.Types; use SDL.Types; with SDL.Keyboard; with SDL.Active; with SDL.Mouse; with SDL.Joystick; package SDL.Events is type Event_Type is new Interfaces.Unsigned_8; for Event_Type'Size use 8; -- pragma Convention (C, Event_Type); package I renames Interfaces; package M renames SDL.Mouse; package Jy renames SDL.Joystick; -- ------------------ -- Orginal C Event enumerations -- ------------------ -- Unused (do not remove) NOEVENT : constant Event_Type := 0; -- Application loses/gains visibility ISACTIVEEVENT : constant Event_Type := 1; -- Keys pressed KEYDOWN : constant Event_Type := 2; -- Keys released KEYUP : constant Event_Type := 3; -- Mouse moved MOUSEMOTION : constant Event_Type := 4; -- Mouse button pressed MOUSEBUTTONDOWN : constant Event_Type := 5; -- Mouse button released MOUSEBUTTONUP : constant Event_Type := 6; -- Joystick axis motion JOYAXISMOTION : constant Event_Type := 7; -- Joystick trackball motion JOYBALLMOTION : constant Event_Type := 8; -- Joystick hat position change JOYHATMOTION : constant Event_Type := 9; -- Joystick button pressed JOYBUTTONDOWN : constant Event_Type := 10; -- Joystick button released JOYBUTTONUP : constant Event_Type := 11; -- User-requested quit QUIT : constant Event_Type := 12; -- System specific event ISSYSWMEVENT : constant Event_Type := 13; -- Reserved for future use.. EVENT_RESERVEDA : constant Event_Type := 14; -- Reserved for future use.. EVENT_RESERVEDB : constant Event_Type := 15; -- User resized video mode VIDEORESIZE : constant Event_Type := 16; -- Reserved for future use.. EVENT_RESERVED1 : constant Event_Type := 17; -- Reserved for future use.. EVENT_RESERVED2 : constant Event_Type := 18; -- Reserved for future use.. EVENT_RESERVED3 : constant Event_Type := 19; -- Reserved for future use.. EVENT_RESERVED4 : constant Event_Type := 20; -- Reserved for future use.. EVENT_RESERVED5 : constant Event_Type := 21; -- Reserved for future use.. EVENT_RESERVED6 : constant Event_Type := 22; -- Reserved for future use.. EVENT_RESERVED7 : constant Event_Type := 23; -- Events USEREVENT through MAXEVENTS-1 are for your use ISUSEREVENT : constant Event_Type := 24; -- This last event is only for bounding internal arrays -- It is the number of bits in the event mask datatype -- Uint32 NUMEVENTS : constant Event_Type := 32; -- Predefined event masks type Event_Mask is mod 2**Integer (NUMEVENTS); ACTIVEEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISACTIVEEVENT))); KEYDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYDOWN))); KEYUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYUP))); MOUSEMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION))); MOUSEBUTTONDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN))); MOUSEBUTTONUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP))); MOUSEEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP))); JOYAXISMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION))); JOYBALLMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION))); JOYHATMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION))); JOYBUTTONDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN))); JOYBUTTONUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP))); JOYEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP))); VIDEORESIZEMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (VIDEORESIZE))); QUITMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (QUIT))); SYSWMEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISSYSWMEVENT))); ALLEVENTS : constant Event_Mask := 16#FFFFFFFF#; -- Application visibility event structure type ActiveEvent is record -- the_type, -- ISACTIVEEVENT the_type : Event_Type; -- ISACTIVEEVENT; gain, -- Whether given states were gained or lost (1/0) state : SDL.Active.Active_State; -- A mask of the focus states end record; pragma Convention (C, ActiveEvent); -- Keyboard event structure type KeyboardEvent is record the_type : Event_Type; -- KEYDOWN or KEYUP which : Uint8; -- The keyboard device index state : Uint8; -- PRESSED or RELEASED keysym : aliased SDL.Keyboard.keysym; end record; pragma Convention (C, KeyboardEvent); -- Mouse motion event structure type MouseMotionEvent is record the_type : Event_Type; -- MOUSEMOTION which : Uint8; -- The mouse device index state : Uint8; -- The current state x, y : Uint16; -- The X/Y coordinates of the mouse xrel : Sint16; -- The relative motion in the X direction yrel : Sint16; -- The relative motion in the Y direction end record; pragma Convention (C, MouseMotionEvent); -- Mouse button event structure type MouseButtonEvent is record the_type : Event_Type; -- MOUSEBUTTONDOWN or MOUSEBUTTONUP which : Uint8; -- The mouse device index button : Uint8; -- The mouse button index state : M.Mouse_Button_State; -- PRESSED or RELEASED x, y : Uint16; -- The X/Y coordinates of the mouse at -- press time end record; pragma Convention (C, MouseButtonEvent); -- Joystick axis motion event structure type JoyAxisEvent is record the_type : Event_Type; -- JOYAXISMOTION which : Uint8; -- The joystick device index axis : Uint8; -- The joystick axis index value : Sint16; -- The axis value (range: -32768 to 32767) end record; pragma Convention (C, JoyAxisEvent); -- Joystick trackball motion event structure type JoyBallEvent is record the_type : Event_Type; -- JOYBALLMOTION which : Uint8; -- The joystick device index ball : Uint8; -- The joystick trackball index xrel : Sint16; -- The relative motion in the X direction yrel : Sint16; -- The relative motion in the Y direction end record; pragma Convention (C, JoyBallEvent); -- Joystick hat position change event structure type JoyHatEvent is record the_type : Event_Type; -- JOYHATMOTION which : Uint8; -- The joystick device index hat : Uint8; -- The joystick hat index value : Jy.HAT_State; -- The hat position value -- 8 1 2 -- 7 0 3 -- 6 5 4 -- Note that zero means the POV is centered. end record; pragma Convention (C, JoyHatEvent); -- Joystick button event structure */ type JoyButtonEvent is record the_type : Event_Type; -- JOYBUTTONDOWN or JOYBUTTONUP which : Uint8; -- The joystick device index button : Uint8; -- The joystick button index state : Uint8; -- PRESSED or RELEASED end record; pragma Convention (C, JoyButtonEvent); -- The "window resized" event -- When you get this event, you are responsible for setting a new video -- mode with the new width and height. type ResizeEvent is record the_type : Event_Type; -- VIDEORESIZE w, h : C.int; -- New width and height end record; pragma Convention (C, ResizeEvent); -- The "quit requested" event type QuitEvent is record the_type : Event_Type; -- QUIT end record; pragma Convention (C, QuitEvent); -- A user-defined event type type UserEvent is record the_type : Event_Type; -- USEREVENT through NUMEVENTS-1 code : C.int; -- User defined event code data1 : void_ptr; -- User defined data pointer data2 : void_ptr; -- User defined data pointer end record; pragma Convention (C, UserEvent); type SysWMmsg_ptr is new System.Address; -- If you want to use this event, you should use SDL.Syswm type SysWMEvent is record the_type : Event_Type; msg : SysWMmsg_ptr; end record; pragma Convention (C, SysWMEvent); type Event_Selection is ( Is_Event_Type, Is_ActiveEvent, Is_KeyboardEvent, Is_MouseMotionEvent, Is_MouseButtonEvent, Is_JoyAxisEvent, Is_JoyBallEvent, Is_JoyHatEvent, Is_JoyButtonEvent, Is_ResizeEvent, Is_QuitEvent, Is_UserEvent, Is_SysWMEvent); -- General event structure type Event (Event_Selec : Event_Selection := Is_Event_Type) is record case Event_Selec is when Is_Event_Type => the_type : Event_Type; when Is_ActiveEvent => active : ActiveEvent; when Is_KeyboardEvent => key : KeyboardEvent; when Is_MouseMotionEvent => motion : MouseMotionEvent; when Is_MouseButtonEvent => button : MouseButtonEvent; when Is_JoyAxisEvent => jaxis : JoyAxisEvent; when Is_JoyBallEvent => jball : JoyBallEvent; when Is_JoyHatEvent => jhat : JoyHatEvent; when Is_JoyButtonEvent => jbutton : JoyButtonEvent; when Is_ResizeEvent => resize : ResizeEvent; when Is_QuitEvent => quit : QuitEvent; when Is_UserEvent => user : UserEvent; when Is_SysWMEvent => syswm : SysWMEvent; end case; end record; pragma Convention (C, Event); pragma Unchecked_Union (Event); type Event_ptr is access all Event; pragma Convention (C, Event_ptr); -- ------------------- -- Function prototypes -- ------------------- -- Pumps the event loop, gathering events from the input devices. -- This function updates the event queue and internal input device state. -- This should only be run in the thread that sets the video mode. procedure PumpEvents; pragma Import (C, PumpEvents, "SDL_PumpEvents"); -- Checks the event queue for messages and optionally returns them. -- If 'action' is ADDEVENT, up to 'numevents' events will be added to -- the back of the event queue. -- If 'action' is PEEKEVENT, up to 'numevents' events at the front -- of the event queue, matching 'mask', will be returned and will not -- be removed from the queue. -- If 'action' is GETEVENT, up to 'numevents' events at the front -- of the event queue, matching 'mask', will be returned and will be -- removed from the queue. -- This function returns the number of events actually stored, or -1 -- if there was an error. This function is thread-safe. type eventaction is new C.int; ADDEVENT : constant := 0; PEEKEVENT : constant := 1; GETEVENT : constant := 2; type Events_Array is array (Natural range <>) of Event; procedure PeepEventsVP ( result : out C.int; events : in out Events_Array; numevents : C.int; action : eventaction; mask : Event_Mask); pragma Import (C, PeepEventsVP, "SDL_PeepEvents"); pragma Import_Valued_Procedure (PeepEventsVP); -- From Ada this function is to be called only as -- ... := PeepEvents (null, 0, the_action, the_mask); -- in other cases use PeepEventsVP. function PeepEvents ( events : Event_ptr; numevents : C.int; action : eventaction; mask : Event_Mask) return C.int; pragma Import (C, PeepEvents, "SDL_PeepEvents"); -- pending events, or 0 if there are none available. If 'event' is not -- NULL, the next event is removed from the queue and stored in that area. function PollEvent (the_event : access Event) return C.int; pragma Import (C, PollEvent, "SDL_PollEvent"); -- Check the pending events. Doesn't remove them. function Poll_Event return C.int; pragma Inline (Poll_Event); -- A corresponding Valued Procedure procedure PollEventVP (result : out C.int; the_event : in out Event); pragma Import (C, PollEventVP, "SDL_PollEvent"); pragma Import_Valued_Procedure (PollEventVP); -- Waits indefinitely for the next available event, returning 1, or 0 -- if there was an error while waiting for events. If 'event' is not -- NULL, the next event is removed from the queue and stored in that area. function WaitEvent (event : Event_ptr) return C.int; procedure WaitEvent (event : Event_ptr); procedure WaitEvent (the_event : in out Event); pragma Import (C, WaitEvent, "SDL_WaitEvent"); procedure Wait_Event ( Result : out C.int; the_event : in out Event); pragma Import (C, Wait_Event, "SDL_WaitEvent"); pragma Import_Valued_Procedure (Wait_Event); function Wait_Any_Event return C.int; pragma Inline (Wait_Any_Event); -- Add an event to the event queue. -- This function returns 0, or -1 if the event couldn't be added to -- the event queue. If the event queue is full, this function fails. function PushEvent (event : Event_ptr) return C.int; procedure PushEvent (event : Event_ptr); function PushEvent (the_event : Event) return C.int; procedure PushEvent (the_event : Event); pragma Import (C, PushEvent, "SDL_PushEvent"); -- This function sets up a filter to process all events before they -- change internal state and are posted to the internal event queue. -- The filter is protypted as: type EventFilter_ptr is access function (event : Event_ptr) return C.int; pragma Convention (C, EventFilter_ptr); -- If the filter returns 1, then the event will be added to the internal -- queue. If it returns 0, then the event will be dropped from the queue, -- but the internal state will still be updated. This allows selective -- filtering of dynamically arriving events. -- WARNING: Be very careful of what you do in the event filter function, -- as it may run in a different thread! -- There is one caveat when dealing with the QUITEVENT event type. The -- event filter is only called when the window manager desires to close the -- application window. If the event filter returns 1, then the window will -- be closed, otherwise the window will remain open if possible. -- If the quit event is generated by an interrupt signal, it will bypass -- the internal queue and be delivered to the application at the next event -- poll. procedure SetEventFilter (filter : EventFilter_ptr); pragma Import (C, SetEventFilter, "SDL_SetEventFilter"); -- Return the current event filter - can be used to "chain" filters. -- If there is no event filter set, this function returns NULL. function GetEventFilter return EventFilter_ptr; pragma Import (C, GetEventFilter, "SDL_GetEventFilter"); -- This function allows you to set the state of processing certain events. -- If 'state' is set to IGNORE, that event will be automatically dropped -- from the event queue and will not event be filtered. -- If 'state' is set to ENABLE, that event will be processed normally. -- If 'state' is set to QUERY, EventState will return the -- current processing state of the specified event. QUERY : constant := -1; IGNORE : constant := 0; DISABLE : constant := 0; ENABLE : constant := 1; function EventState ( the_type : Event_Type; state : C.int) return Uint8; procedure EventState ( the_type : Event_Type; state : C.int); pragma Import (C, EventState, "SDL_EventState"); end SDL.Events;
true
-- ----------------------------------------------------------------- -- -- AdaSDL -- -- Binding to Simple Direct Media Layer -- -- Copyright (C) 2001 PI:NAME:<NAME>END_PI -- -- PI:NAME:<NAME>END_PI -- -- Ponta DelPI:NAME:<NAME>END_PIada - Azores - Portugal -- -- http://www.adapower.net/~avargas -- -- E-mail: PI:EMAIL:<EMAIL>END_PI -- -- ----------------------------------------------------------------- -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This 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 -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- 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 is an Ada binding to SDL ( Simple DirectMedia Layer from -- -- Sam Lantinga - www.libsld.org ) -- -- **************************************************************** -- -- In order to help the Ada programmer, the comments in this file -- -- are, in great extent, a direct copy of the original text in the -- -- SDL header files. -- -- **************************************************************** -- with System; with Interfaces.C; with SDL.Types; use SDL.Types; with SDL.Keyboard; with SDL.Active; with SDL.Mouse; with SDL.Joystick; package SDL.Events is type Event_Type is new Interfaces.Unsigned_8; for Event_Type'Size use 8; -- pragma Convention (C, Event_Type); package I renames Interfaces; package M renames SDL.Mouse; package Jy renames SDL.Joystick; -- ------------------ -- Orginal C Event enumerations -- ------------------ -- Unused (do not remove) NOEVENT : constant Event_Type := 0; -- Application loses/gains visibility ISACTIVEEVENT : constant Event_Type := 1; -- Keys pressed KEYDOWN : constant Event_Type := 2; -- Keys released KEYUP : constant Event_Type := 3; -- Mouse moved MOUSEMOTION : constant Event_Type := 4; -- Mouse button pressed MOUSEBUTTONDOWN : constant Event_Type := 5; -- Mouse button released MOUSEBUTTONUP : constant Event_Type := 6; -- Joystick axis motion JOYAXISMOTION : constant Event_Type := 7; -- Joystick trackball motion JOYBALLMOTION : constant Event_Type := 8; -- Joystick hat position change JOYHATMOTION : constant Event_Type := 9; -- Joystick button pressed JOYBUTTONDOWN : constant Event_Type := 10; -- Joystick button released JOYBUTTONUP : constant Event_Type := 11; -- User-requested quit QUIT : constant Event_Type := 12; -- System specific event ISSYSWMEVENT : constant Event_Type := 13; -- Reserved for future use.. EVENT_RESERVEDA : constant Event_Type := 14; -- Reserved for future use.. EVENT_RESERVEDB : constant Event_Type := 15; -- User resized video mode VIDEORESIZE : constant Event_Type := 16; -- Reserved for future use.. EVENT_RESERVED1 : constant Event_Type := 17; -- Reserved for future use.. EVENT_RESERVED2 : constant Event_Type := 18; -- Reserved for future use.. EVENT_RESERVED3 : constant Event_Type := 19; -- Reserved for future use.. EVENT_RESERVED4 : constant Event_Type := 20; -- Reserved for future use.. EVENT_RESERVED5 : constant Event_Type := 21; -- Reserved for future use.. EVENT_RESERVED6 : constant Event_Type := 22; -- Reserved for future use.. EVENT_RESERVED7 : constant Event_Type := 23; -- Events USEREVENT through MAXEVENTS-1 are for your use ISUSEREVENT : constant Event_Type := 24; -- This last event is only for bounding internal arrays -- It is the number of bits in the event mask datatype -- Uint32 NUMEVENTS : constant Event_Type := 32; -- Predefined event masks type Event_Mask is mod 2**Integer (NUMEVENTS); ACTIVEEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISACTIVEEVENT))); KEYDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYDOWN))); KEYUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (KEYUP))); MOUSEMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION))); MOUSEBUTTONDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN))); MOUSEBUTTONUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP))); MOUSEEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONDOWN))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (MOUSEBUTTONUP))); JOYAXISMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION))); JOYBALLMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION))); JOYHATMOTIONMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION))); JOYBUTTONDOWNMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN))); JOYBUTTONUPMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP))); JOYEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYAXISMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBALLMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYHATMOTION))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONDOWN))) or Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (JOYBUTTONUP))); VIDEORESIZEMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (VIDEORESIZE))); QUITMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (QUIT))); SYSWMEVENTMASK : constant Event_Mask := Event_Mask (I.Shift_Left (I.Unsigned_32 (1), Integer (ISSYSWMEVENT))); ALLEVENTS : constant Event_Mask := 16#FFFFFFFF#; -- Application visibility event structure type ActiveEvent is record -- the_type, -- ISACTIVEEVENT the_type : Event_Type; -- ISACTIVEEVENT; gain, -- Whether given states were gained or lost (1/0) state : SDL.Active.Active_State; -- A mask of the focus states end record; pragma Convention (C, ActiveEvent); -- Keyboard event structure type KeyboardEvent is record the_type : Event_Type; -- KEYDOWN or KEYUP which : Uint8; -- The keyboard device index state : Uint8; -- PRESSED or RELEASED keysym : aliased SDL.Keyboard.keysym; end record; pragma Convention (C, KeyboardEvent); -- Mouse motion event structure type MouseMotionEvent is record the_type : Event_Type; -- MOUSEMOTION which : Uint8; -- The mouse device index state : Uint8; -- The current state x, y : Uint16; -- The X/Y coordinates of the mouse xrel : Sint16; -- The relative motion in the X direction yrel : Sint16; -- The relative motion in the Y direction end record; pragma Convention (C, MouseMotionEvent); -- Mouse button event structure type MouseButtonEvent is record the_type : Event_Type; -- MOUSEBUTTONDOWN or MOUSEBUTTONUP which : Uint8; -- The mouse device index button : Uint8; -- The mouse button index state : M.Mouse_Button_State; -- PRESSED or RELEASED x, y : Uint16; -- The X/Y coordinates of the mouse at -- press time end record; pragma Convention (C, MouseButtonEvent); -- Joystick axis motion event structure type JoyAxisEvent is record the_type : Event_Type; -- JOYAXISMOTION which : Uint8; -- The joystick device index axis : Uint8; -- The joystick axis index value : Sint16; -- The axis value (range: -32768 to 32767) end record; pragma Convention (C, JoyAxisEvent); -- Joystick trackball motion event structure type JoyBallEvent is record the_type : Event_Type; -- JOYBALLMOTION which : Uint8; -- The joystick device index ball : Uint8; -- The joystick trackball index xrel : Sint16; -- The relative motion in the X direction yrel : Sint16; -- The relative motion in the Y direction end record; pragma Convention (C, JoyBallEvent); -- Joystick hat position change event structure type JoyHatEvent is record the_type : Event_Type; -- JOYHATMOTION which : Uint8; -- The joystick device index hat : Uint8; -- The joystick hat index value : Jy.HAT_State; -- The hat position value -- 8 1 2 -- 7 0 3 -- 6 5 4 -- Note that zero means the POV is centered. end record; pragma Convention (C, JoyHatEvent); -- Joystick button event structure */ type JoyButtonEvent is record the_type : Event_Type; -- JOYBUTTONDOWN or JOYBUTTONUP which : Uint8; -- The joystick device index button : Uint8; -- The joystick button index state : Uint8; -- PRESSED or RELEASED end record; pragma Convention (C, JoyButtonEvent); -- The "window resized" event -- When you get this event, you are responsible for setting a new video -- mode with the new width and height. type ResizeEvent is record the_type : Event_Type; -- VIDEORESIZE w, h : C.int; -- New width and height end record; pragma Convention (C, ResizeEvent); -- The "quit requested" event type QuitEvent is record the_type : Event_Type; -- QUIT end record; pragma Convention (C, QuitEvent); -- A user-defined event type type UserEvent is record the_type : Event_Type; -- USEREVENT through NUMEVENTS-1 code : C.int; -- User defined event code data1 : void_ptr; -- User defined data pointer data2 : void_ptr; -- User defined data pointer end record; pragma Convention (C, UserEvent); type SysWMmsg_ptr is new System.Address; -- If you want to use this event, you should use SDL.Syswm type SysWMEvent is record the_type : Event_Type; msg : SysWMmsg_ptr; end record; pragma Convention (C, SysWMEvent); type Event_Selection is ( Is_Event_Type, Is_ActiveEvent, Is_KeyboardEvent, Is_MouseMotionEvent, Is_MouseButtonEvent, Is_JoyAxisEvent, Is_JoyBallEvent, Is_JoyHatEvent, Is_JoyButtonEvent, Is_ResizeEvent, Is_QuitEvent, Is_UserEvent, Is_SysWMEvent); -- General event structure type Event (Event_Selec : Event_Selection := Is_Event_Type) is record case Event_Selec is when Is_Event_Type => the_type : Event_Type; when Is_ActiveEvent => active : ActiveEvent; when Is_KeyboardEvent => key : KeyboardEvent; when Is_MouseMotionEvent => motion : MouseMotionEvent; when Is_MouseButtonEvent => button : MouseButtonEvent; when Is_JoyAxisEvent => jaxis : JoyAxisEvent; when Is_JoyBallEvent => jball : JoyBallEvent; when Is_JoyHatEvent => jhat : JoyHatEvent; when Is_JoyButtonEvent => jbutton : JoyButtonEvent; when Is_ResizeEvent => resize : ResizeEvent; when Is_QuitEvent => quit : QuitEvent; when Is_UserEvent => user : UserEvent; when Is_SysWMEvent => syswm : SysWMEvent; end case; end record; pragma Convention (C, Event); pragma Unchecked_Union (Event); type Event_ptr is access all Event; pragma Convention (C, Event_ptr); -- ------------------- -- Function prototypes -- ------------------- -- Pumps the event loop, gathering events from the input devices. -- This function updates the event queue and internal input device state. -- This should only be run in the thread that sets the video mode. procedure PumpEvents; pragma Import (C, PumpEvents, "SDL_PumpEvents"); -- Checks the event queue for messages and optionally returns them. -- If 'action' is ADDEVENT, up to 'numevents' events will be added to -- the back of the event queue. -- If 'action' is PEEKEVENT, up to 'numevents' events at the front -- of the event queue, matching 'mask', will be returned and will not -- be removed from the queue. -- If 'action' is GETEVENT, up to 'numevents' events at the front -- of the event queue, matching 'mask', will be returned and will be -- removed from the queue. -- This function returns the number of events actually stored, or -1 -- if there was an error. This function is thread-safe. type eventaction is new C.int; ADDEVENT : constant := 0; PEEKEVENT : constant := 1; GETEVENT : constant := 2; type Events_Array is array (Natural range <>) of Event; procedure PeepEventsVP ( result : out C.int; events : in out Events_Array; numevents : C.int; action : eventaction; mask : Event_Mask); pragma Import (C, PeepEventsVP, "SDL_PeepEvents"); pragma Import_Valued_Procedure (PeepEventsVP); -- From Ada this function is to be called only as -- ... := PeepEvents (null, 0, the_action, the_mask); -- in other cases use PeepEventsVP. function PeepEvents ( events : Event_ptr; numevents : C.int; action : eventaction; mask : Event_Mask) return C.int; pragma Import (C, PeepEvents, "SDL_PeepEvents"); -- pending events, or 0 if there are none available. If 'event' is not -- NULL, the next event is removed from the queue and stored in that area. function PollEvent (the_event : access Event) return C.int; pragma Import (C, PollEvent, "SDL_PollEvent"); -- Check the pending events. Doesn't remove them. function Poll_Event return C.int; pragma Inline (Poll_Event); -- A corresponding Valued Procedure procedure PollEventVP (result : out C.int; the_event : in out Event); pragma Import (C, PollEventVP, "SDL_PollEvent"); pragma Import_Valued_Procedure (PollEventVP); -- Waits indefinitely for the next available event, returning 1, or 0 -- if there was an error while waiting for events. If 'event' is not -- NULL, the next event is removed from the queue and stored in that area. function WaitEvent (event : Event_ptr) return C.int; procedure WaitEvent (event : Event_ptr); procedure WaitEvent (the_event : in out Event); pragma Import (C, WaitEvent, "SDL_WaitEvent"); procedure Wait_Event ( Result : out C.int; the_event : in out Event); pragma Import (C, Wait_Event, "SDL_WaitEvent"); pragma Import_Valued_Procedure (Wait_Event); function Wait_Any_Event return C.int; pragma Inline (Wait_Any_Event); -- Add an event to the event queue. -- This function returns 0, or -1 if the event couldn't be added to -- the event queue. If the event queue is full, this function fails. function PushEvent (event : Event_ptr) return C.int; procedure PushEvent (event : Event_ptr); function PushEvent (the_event : Event) return C.int; procedure PushEvent (the_event : Event); pragma Import (C, PushEvent, "SDL_PushEvent"); -- This function sets up a filter to process all events before they -- change internal state and are posted to the internal event queue. -- The filter is protypted as: type EventFilter_ptr is access function (event : Event_ptr) return C.int; pragma Convention (C, EventFilter_ptr); -- If the filter returns 1, then the event will be added to the internal -- queue. If it returns 0, then the event will be dropped from the queue, -- but the internal state will still be updated. This allows selective -- filtering of dynamically arriving events. -- WARNING: Be very careful of what you do in the event filter function, -- as it may run in a different thread! -- There is one caveat when dealing with the QUITEVENT event type. The -- event filter is only called when the window manager desires to close the -- application window. If the event filter returns 1, then the window will -- be closed, otherwise the window will remain open if possible. -- If the quit event is generated by an interrupt signal, it will bypass -- the internal queue and be delivered to the application at the next event -- poll. procedure SetEventFilter (filter : EventFilter_ptr); pragma Import (C, SetEventFilter, "SDL_SetEventFilter"); -- Return the current event filter - can be used to "chain" filters. -- If there is no event filter set, this function returns NULL. function GetEventFilter return EventFilter_ptr; pragma Import (C, GetEventFilter, "SDL_GetEventFilter"); -- This function allows you to set the state of processing certain events. -- If 'state' is set to IGNORE, that event will be automatically dropped -- from the event queue and will not event be filtered. -- If 'state' is set to ENABLE, that event will be processed normally. -- If 'state' is set to QUERY, EventState will return the -- current processing state of the specified event. QUERY : constant := -1; IGNORE : constant := 0; DISABLE : constant := 0; ENABLE : constant := 1; function EventState ( the_type : Event_Type; state : C.int) return Uint8; procedure EventState ( the_type : Event_Type; state : C.int); pragma Import (C, EventState, "SDL_EventState"); end SDL.Events;
[ { "context": "ests for blogs module\n-- Copyright (C) 2017, 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 167, "score": 0.9998844265937805, "start": 152, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "ight (C) 2017, 2018 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 198, "score": 0.9998893737792969, "start": 183, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "8 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 225, "score": 0.9999286532402039, "start": 200, "tag": "EMAIL", "value": "[email protected]" } ]
awa/plugins/awa-blogs/regtests/awa-blogs-tests.ads
twdroeger/ada-awa
81
----------------------------------------------------------------------- -- awa-blogs-tests -- Unit tests for blogs module -- Copyright (C) 2017, 2018 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.Tests; with AWA.Tests; with Ada.Strings.Unbounded; package AWA.Blogs.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Blog_Ident : Ada.Strings.Unbounded.Unbounded_String; Post_Ident : Ada.Strings.Unbounded.Unbounded_String; Post_Uri : Ada.Strings.Unbounded.Unbounded_String; end record; -- Get some access on the blog as anonymous users. procedure Verify_Anonymous (T : in out Test; Post : in String); -- Test access to the blog as anonymous user. procedure Test_Anonymous_Access (T : in out Test); -- Test creation of blog by simulating web requests. procedure Test_Create_Blog (T : in out Test); -- Test updating a post by simulating web requests. procedure Test_Update_Post (T : in out Test); -- Test updating the publication date by simulating web requests. procedure Test_Update_Publish_Date (T : in out Test); -- Test listing the blog posts. procedure Test_Admin_List_Posts (T : in out Test); -- Test listing the blog comments. procedure Test_Admin_List_Comments (T : in out Test); -- Test getting the JSON blog stats (for graphs). procedure Test_Admin_Blog_Stats (T : in out Test); end AWA.Blogs.Tests;
21085
----------------------------------------------------------------------- -- awa-blogs-tests -- Unit tests for blogs module -- Copyright (C) 2017, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with AWA.Tests; with Ada.Strings.Unbounded; package AWA.Blogs.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Blog_Ident : Ada.Strings.Unbounded.Unbounded_String; Post_Ident : Ada.Strings.Unbounded.Unbounded_String; Post_Uri : Ada.Strings.Unbounded.Unbounded_String; end record; -- Get some access on the blog as anonymous users. procedure Verify_Anonymous (T : in out Test; Post : in String); -- Test access to the blog as anonymous user. procedure Test_Anonymous_Access (T : in out Test); -- Test creation of blog by simulating web requests. procedure Test_Create_Blog (T : in out Test); -- Test updating a post by simulating web requests. procedure Test_Update_Post (T : in out Test); -- Test updating the publication date by simulating web requests. procedure Test_Update_Publish_Date (T : in out Test); -- Test listing the blog posts. procedure Test_Admin_List_Posts (T : in out Test); -- Test listing the blog comments. procedure Test_Admin_List_Comments (T : in out Test); -- Test getting the JSON blog stats (for graphs). procedure Test_Admin_Blog_Stats (T : in out Test); end AWA.Blogs.Tests;
true
----------------------------------------------------------------------- -- awa-blogs-tests -- Unit tests for blogs module -- Copyright (C) 2017, 2018 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with AWA.Tests; with Ada.Strings.Unbounded; package AWA.Blogs.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Blog_Ident : Ada.Strings.Unbounded.Unbounded_String; Post_Ident : Ada.Strings.Unbounded.Unbounded_String; Post_Uri : Ada.Strings.Unbounded.Unbounded_String; end record; -- Get some access on the blog as anonymous users. procedure Verify_Anonymous (T : in out Test; Post : in String); -- Test access to the blog as anonymous user. procedure Test_Anonymous_Access (T : in out Test); -- Test creation of blog by simulating web requests. procedure Test_Create_Blog (T : in out Test); -- Test updating a post by simulating web requests. procedure Test_Update_Post (T : in out Test); -- Test updating the publication date by simulating web requests. procedure Test_Update_Publish_Date (T : in out Test); -- Test listing the blog posts. procedure Test_Admin_List_Posts (T : in out Test); -- Test listing the blog comments. procedure Test_Admin_List_Comments (T : in out Test); -- Test getting the JSON blog stats (for graphs). procedure Test_Admin_Blog_Stats (T : in out Test); end AWA.Blogs.Tests;
[ { "context": "-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 48, "score": 0.9998705387115479, "start": 38, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 68, "score": 0.9999305009841919, "start": 50, "tag": "EMAIL", "value": "[email protected]" } ]
source/nodes/program-nodes-identifiers-set_defining_name.ads
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- procedure Program.Nodes.Identifiers.Set_Defining_Name (Self : not null Program.Elements.Identifiers.Identifier_Access; Value : Program.Elements.Defining_Identifiers.Defining_Identifier_Access); pragma Preelaborate (Program.Nodes.Identifiers.Set_Defining_Name);
22079
-- SPDX-FileCopyrightText: 2020-2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- procedure Program.Nodes.Identifiers.Set_Defining_Name (Self : not null Program.Elements.Identifiers.Identifier_Access; Value : Program.Elements.Defining_Identifiers.Defining_Identifier_Access); pragma Preelaborate (Program.Nodes.Identifiers.Set_Defining_Name);
true
-- SPDX-FileCopyrightText: 2020-2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- procedure Program.Nodes.Identifiers.Set_Defining_Name (Self : not null Program.Elements.Identifiers.Identifier_Access; Value : Program.Elements.Defining_Identifiers.Defining_Identifier_Access); pragma Preelaborate (Program.Nodes.Identifiers.Set_Defining_Name);
[ { "context": "-------\n-- Copyright (C) 2020 by Heisenbug Ltd. ([email protected])\n--\n-- This work is free. You can redistribute i", "end": 142, "score": 0.999923586845398, "start": 123, "tag": "EMAIL", "value": "[email protected]" } ]
src/open_weather_map-api-query.adb
Jellix/open_weather_map_api
1
-------------------------------------------------------------------------------- -- 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); package body Open_Weather_Map.API.Query is My_Debug : constant not null GNATCOLL.Traces.Trace_Handle := GNATCOLL.Traces.Create (Unit_Name => "OWM.API.QUERY"); ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T) is begin My_Debug.all.Trace (Message => "Initialize"); Self.Last_Query := Ada.Real_Time.Time_First; end Initialize; ----------------------------------------------------------------------------- -- Set_Last_Query ----------------------------------------------------------------------------- procedure Set_Last_Query (Self : in out T; Value : in Ada.Real_Time.Time) is begin My_Debug.all.Trace (Message => "Set_Last_Query"); Self.Last_Query := Value; end Set_Last_Query; end Open_Weather_Map.API.Query;
15012
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- 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); package body Open_Weather_Map.API.Query is My_Debug : constant not null GNATCOLL.Traces.Trace_Handle := GNATCOLL.Traces.Create (Unit_Name => "OWM.API.QUERY"); ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T) is begin My_Debug.all.Trace (Message => "Initialize"); Self.Last_Query := Ada.Real_Time.Time_First; end Initialize; ----------------------------------------------------------------------------- -- Set_Last_Query ----------------------------------------------------------------------------- procedure Set_Last_Query (Self : in out T; Value : in Ada.Real_Time.Time) is begin My_Debug.all.Trace (Message => "Set_Last_Query"); Self.Last_Query := Value; end Set_Last_Query; end Open_Weather_Map.API.Query;
true
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (PI:EMAIL:<EMAIL>END_PI) -- -- 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); package body Open_Weather_Map.API.Query is My_Debug : constant not null GNATCOLL.Traces.Trace_Handle := GNATCOLL.Traces.Create (Unit_Name => "OWM.API.QUERY"); ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T) is begin My_Debug.all.Trace (Message => "Initialize"); Self.Last_Query := Ada.Real_Time.Time_First; end Initialize; ----------------------------------------------------------------------------- -- Set_Last_Query ----------------------------------------------------------------------------- procedure Set_Last_Query (Self : in out T; Value : in Ada.Real_Time.Time) is begin My_Debug.all.Trace (Message => "Set_Last_Query"); Self.Last_Query := Value; end Set_Last_Query; end Open_Weather_Map.API.Query;
[ { "context": " --\n-- Copyright (C) 2018 Fabien Chouteau --\n-- ", "end": 372, "score": 0.9998192191123962, "start": 357, "tag": "NAME", "value": "Fabien Chouteau" } ]
src/geste-grid.ads
Fabien-Chouteau/GESTE
13
------------------------------------------------------------------------------ -- -- -- GESTE -- -- -- -- Copyright (C) 2018 Fabien Chouteau -- -- -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with GESTE.Tile_Bank; package GESTE.Grid is type Grid_Data is array (Natural range <>, Natural range <>) of Tile_Index; type Grid_Data_Ref is access constant Grid_Data; subtype Parent is Layer.Instance; type Instance (Data : not null Grid_Data_Ref; Bank : not null Tile_Bank.Const_Ref) is new Parent with private; subtype Class is Instance'Class; type Ref is access all Class; type Const_Ref is access constant Class; private type Grid_Map is array (Natural range <>, Natural range <>) of Tile_Index; type Grid_Orientation is array (Natural range <>, Natural range <>) of Integer; type Instance (Data : not null Grid_Data_Ref; Bank : not null Tile_Bank.Const_Ref) is new Parent with null record; overriding procedure Update_Size (This : in out Instance); overriding function Pix (This : Instance; X, Y : Integer) return Output_Color with Pre => X in 0 .. This.Width - 1 and then Y in 0 .. This.Height - 1; overriding function Collides (This : Instance; X, Y : Integer) return Boolean; end GESTE.Grid;
13242
------------------------------------------------------------------------------ -- -- -- GESTE -- -- -- -- Copyright (C) 2018 <NAME> -- -- -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with GESTE.Tile_Bank; package GESTE.Grid is type Grid_Data is array (Natural range <>, Natural range <>) of Tile_Index; type Grid_Data_Ref is access constant Grid_Data; subtype Parent is Layer.Instance; type Instance (Data : not null Grid_Data_Ref; Bank : not null Tile_Bank.Const_Ref) is new Parent with private; subtype Class is Instance'Class; type Ref is access all Class; type Const_Ref is access constant Class; private type Grid_Map is array (Natural range <>, Natural range <>) of Tile_Index; type Grid_Orientation is array (Natural range <>, Natural range <>) of Integer; type Instance (Data : not null Grid_Data_Ref; Bank : not null Tile_Bank.Const_Ref) is new Parent with null record; overriding procedure Update_Size (This : in out Instance); overriding function Pix (This : Instance; X, Y : Integer) return Output_Color with Pre => X in 0 .. This.Width - 1 and then Y in 0 .. This.Height - 1; overriding function Collides (This : Instance; X, Y : Integer) return Boolean; end GESTE.Grid;
true
------------------------------------------------------------------------------ -- -- -- GESTE -- -- -- -- Copyright (C) 2018 PI:NAME:<NAME>END_PI -- -- -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with GESTE.Tile_Bank; package GESTE.Grid is type Grid_Data is array (Natural range <>, Natural range <>) of Tile_Index; type Grid_Data_Ref is access constant Grid_Data; subtype Parent is Layer.Instance; type Instance (Data : not null Grid_Data_Ref; Bank : not null Tile_Bank.Const_Ref) is new Parent with private; subtype Class is Instance'Class; type Ref is access all Class; type Const_Ref is access constant Class; private type Grid_Map is array (Natural range <>, Natural range <>) of Tile_Index; type Grid_Orientation is array (Natural range <>, Natural range <>) of Integer; type Instance (Data : not null Grid_Data_Ref; Bank : not null Tile_Bank.Const_Ref) is new Parent with null record; overriding procedure Update_Size (This : in out Instance); overriding function Pix (This : Instance; X, Y : Integer) return Output_Color with Pre => X in 0 .. This.Width - 1 and then Y in 0 .. This.Height - 1; overriding function Collides (This : Instance; X, Y : Integer) return Boolean; end GESTE.Grid;
[ { "context": "-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998663663864136, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999317526817322, "start": 45, "tag": "EMAIL", "value": "[email protected]" } ]
source/resolver/program-complete_contexts-case_statements.ads
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Cross_Reference_Updaters; with Program.Elements.Case_Statements; with Program.Interpretations; package Program.Complete_Contexts.Case_Statements is pragma Preelaborate; procedure Case_Statement (Sets : not null Program.Interpretations.Context_Access; Setter : not null Program.Cross_Reference_Updaters .Cross_Reference_Updater_Access; Element : Program.Elements.Case_Statements.Case_Statement_Access); end Program.Complete_Contexts.Case_Statements;
13986
-- SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Cross_Reference_Updaters; with Program.Elements.Case_Statements; with Program.Interpretations; package Program.Complete_Contexts.Case_Statements is pragma Preelaborate; procedure Case_Statement (Sets : not null Program.Interpretations.Context_Access; Setter : not null Program.Cross_Reference_Updaters .Cross_Reference_Updater_Access; Element : Program.Elements.Case_Statements.Case_Statement_Access); end Program.Complete_Contexts.Case_Statements;
true
-- SPDX-FileCopyrightText: 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Cross_Reference_Updaters; with Program.Elements.Case_Statements; with Program.Interpretations; package Program.Complete_Contexts.Case_Statements is pragma Preelaborate; procedure Case_Statement (Sets : not null Program.Interpretations.Context_Access; Setter : not null Program.Cross_Reference_Updaters .Cross_Reference_Updater_Access; Element : Program.Elements.Case_Statements.Case_Statement_Access); end Program.Complete_Contexts.Case_Statements;
[ { "context": "-- Copyright 2019 Simon Symeonidis (psyomn)\n--\n-- Licensed under the Apache License", "end": 35, "score": 0.9998489022254944, "start": 19, "tag": "NAME", "value": "Simon Symeonidis" }, { "context": "-- Copyright 2019 Simon Symeonidis (psyomn)\n--\n-- Licensed under the Apache License, Versio", "end": 43, "score": 0.9681594967842102, "start": 37, "tag": "USERNAME", "value": "psyomn" } ]
test/common_utils_suite.adb
psyomn/ash
11
-- Copyright 2019 Simon Symeonidis (psyomn) -- -- 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 AUnit.Test_Caller; with Common_Utils_Test; use Common_Utils_Test; package body Common_Utils_Suite is package Caller is new AUnit.Test_Caller (Common_Utils_Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin Ret.Add_Test (Caller.Create ("test integer to trimmed string", Test_Integer_To_Trimmed_String'Access)); Ret.Add_Test (Caller.Create ("Test header string", Test_Header_String'Access)); Ret.Add_Test (Caller.Create ("Test header string integer", Test_Header_String_Integer'Access)); Ret.Add_Test (Caller.Create ("Test empty string", Test_Empty_String'Access)); Ret.Add_Test (Caller.Create ("test empty string range", Test_Empty_String_Range'Access)); Ret.Add_Test (Caller.Create ("test concat null string", Test_Concat_Null_String'Access)); return Ret; end Suite; end Common_Utils_Suite;
7923
-- Copyright 2019 <NAME> (psyomn) -- -- 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 AUnit.Test_Caller; with Common_Utils_Test; use Common_Utils_Test; package body Common_Utils_Suite is package Caller is new AUnit.Test_Caller (Common_Utils_Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin Ret.Add_Test (Caller.Create ("test integer to trimmed string", Test_Integer_To_Trimmed_String'Access)); Ret.Add_Test (Caller.Create ("Test header string", Test_Header_String'Access)); Ret.Add_Test (Caller.Create ("Test header string integer", Test_Header_String_Integer'Access)); Ret.Add_Test (Caller.Create ("Test empty string", Test_Empty_String'Access)); Ret.Add_Test (Caller.Create ("test empty string range", Test_Empty_String_Range'Access)); Ret.Add_Test (Caller.Create ("test concat null string", Test_Concat_Null_String'Access)); return Ret; end Suite; end Common_Utils_Suite;
true
-- Copyright 2019 PI:NAME:<NAME>END_PI (psyomn) -- -- 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 AUnit.Test_Caller; with Common_Utils_Test; use Common_Utils_Test; package body Common_Utils_Suite is package Caller is new AUnit.Test_Caller (Common_Utils_Test.Test); function Suite return Access_Test_Suite is Ret : constant Access_Test_Suite := AUnit.Test_Suites.New_Suite; begin Ret.Add_Test (Caller.Create ("test integer to trimmed string", Test_Integer_To_Trimmed_String'Access)); Ret.Add_Test (Caller.Create ("Test header string", Test_Header_String'Access)); Ret.Add_Test (Caller.Create ("Test header string integer", Test_Header_String_Integer'Access)); Ret.Add_Test (Caller.Create ("Test empty string", Test_Empty_String'Access)); Ret.Add_Test (Caller.Create ("test empty string range", Test_Empty_String_Range'Access)); Ret.Add_Test (Caller.Create ("test concat null string", Test_Concat_Null_String'Access)); return Ret; end Suite; end Common_Utils_Suite;
[ { "context": "n\n -- the XRenderPictFormat.\n -- h/t datenwolf\n -- https://stackoverflow.com/questions/40", "end": 8030, "score": 0.9511352777481079, "start": 8021, "tag": "NAME", "value": "datenwolf" } ]
src/render.adb
docandrew/troodon
5
with Ada.Text_IO; with Ada.Unchecked_Deallocation; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with System; use System; with fontconfig; with fttypes; with freetype; with GL; with GLX; with Xlib; with Xutil; with xcb; with xcb_render; with xproto; with Setup; with Util; package body Render is -- Framebuffer configurations. Need to keep this around so we can free it -- after we're finished. The actual config used is a pointer into the -- structure at this address. -- @TODO consider making a copy of this so we don't need all of it. fbConfigsAddr : System.Address; --------------------------------------------------------------------------- -- initSoftwareRenderer -- We prefer a hardware-accelerated, eye-candy heavy rendering backend like -- OpenGL. However, in the event that this is unavailable, we can fall back -- to using a software renderer. -- @TODO probably just get rid of software rendering entirely. Let Mesa -- do that part. --------------------------------------------------------------------------- function initSoftwareRenderer (connection : access xcb.xcb_connection_t) return Render.Renderer is -- @TODO load these from a config DEFAULT_FONT : constant String := "7x13"; fontName : constant chars_ptr := New_String(DEFAULT_FONT); TITLE_FG : constant := 16#00BB_9911#; TITLE_BG : constant := 16#0077_7777#; font : xproto.xcb_font_t; cookie : xcb.xcb_void_cookie_t; gcConfig : xproto.xcb_create_gc_value_list_t; begin Ada.Text_IO.Put_Line ("Troodon: Fallback to software rendering"); -- Set up an X11 rendering context instead. Each window will use it's own -- graphics context, but we can load the font and common parameters used here. -- Load font for this GC font := xcb.xcb_generate_id(connection); cookie := xproto.xcb_open_font_checked(c => connection, fid => font, name_len => DEFAULT_FONT'Length, name => fontName); util.checkFatal(connection, cookie, "Unable to open selected font" & DEFAULT_FONT); -- Set up a graphics context configuration here w/ font -- We'll generate a new graphics context each time we create a window. gcConfig.foreground := TITLE_FG; gcConfig.background := TITLE_BG; gcConfig.font := font; --checkFatal(connection, gcCookie, "drawTitleBar: Unable to create graphics context"); return R : Renderer := (SOFTWARE, visualID => setup.getScreen(connection).root_visual, gcConfig => gcConfig); end initSoftwareRenderer; --------------------------------------------------------------------------- -- printFBConfig -- dump information about a particular GLX Framebuffer configuration --------------------------------------------------------------------------- procedure printFBConfig (display : not null access Xlib.Display; fb : GLX.GLXFBConfig) is -- GLX framebuffer attributes glxRet : int; vtype : aliased int; depth : aliased int; size : aliased int; dbuf : aliased int; bitsR : aliased int; bitsG : aliased int; bitsB : aliased int; bitsA : aliased int; vid : aliased int; trans : aliased int; begin glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_VISUAL_ID, vid'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_X_VISUAL_TYPE, vtype'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_DEPTH_SIZE, depth'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_BUFFER_SIZE, size'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_DOUBLEBUFFER, dbuf'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_RED_SIZE, bitsR'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_GREEN_SIZE, bitsG'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_BLUE_SIZE, bitsB'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_ALPHA_SIZE, bitsA'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_TRANSPARENT_TYPE, trans'Access); Ada.Text_IO.Put_Line ("Troodon: (Render) GLX Framebuffer Configuration:"); Ada.Text_IO.Put_Line (" Visual ID.......:" & vid'Image); Ada.Text_IO.Put_Line (" Visual Type.....: " & (if vtype = GLX.GLX_TRUE_COLOR then "True Color" else "Not True Color")); Ada.Text_IO.Put_Line (" Depth Size......:" & depth'Image); Ada.Text_IO.Put_Line (" Buffer Size.....:" & size'Image); Ada.Text_IO.Put_Line (" Double Buffer...: " & (if dbuf = 1 then "Yes" else "No")); Ada.Text_IO.Put_Line (" Red Bits........:" & bitsR'Image); Ada.Text_IO.Put_Line (" Green Bits......:" & bitsG'Image); Ada.Text_IO.Put_Line (" Blue Bits.......:" & bitsB'Image); Ada.Text_IO.Put_Line (" Alpha Bits......:" & bitsA'Image); Ada.Text_IO.Put_Line (" Transparency....: " & (if trans = GLX.GLX_NONE then "None" elsif trans = GLX.GLX_TRANSPARENT_INDEX then "Index" elsif trans = GLX.GLX_TRANSPARENT_RGB then "RGB" else "Unknown")); end printFBConfig; --------------------------------------------------------------------------- -- getFBConfig -- Query the X Server for an acceptable framebuffer configuration. --------------------------------------------------------------------------- procedure getFBConfig (connection : not null access xcb.xcb_connection_t; display : not null access Xlib.Display; fbConfig : out GLX.GLXFBConfig; visualID : out xproto.xcb_visualid_t) is use GLX; -- fbConfigsAddr : System.Address; fbConfigCount : aliased int; visualAttribs : GLX.IntArray(1..23) := ( GLX_X_RENDERABLE, 1, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, 1, 0 ); begin -- Find a list of suitable framebuffer configurations -- Must be freed w/ XFree Render.fbConfigsAddr := GLX.glXChooseFBConfig (dpy => display, screen => Xlib.XDefaultScreen(display), attribList => visualAttribs, nitems => fbConfigCount'Access); if Render.fbConfigsAddr = System.Null_Address or fbConfigCount = 0 then raise OpenGLException with "Troodon: (Render) Unable to get GLX framebuffer config"; end if; Ada.Text_IO.Put_Line("Troodon: (Render) Found" & fbConfigCount'Image & " potential GLX framebuffer configurations"); -- Apparently the trick here to supporting transparency is to ask for an -- alpha channel as well as make sure that there is an alpha mask in -- the XRenderPictFormat. -- h/t datenwolf -- https://stackoverflow.com/questions/4052940/how-to-make-an-opengl-rendering-context-with-transparent-background -- -- This code here is analogous to XRenderFindVisualFormat findVisualFormat: declare use xcb_render; fbConfigs : GLX.GLXFBConfigArray (1..Integer(fbConfigCount)) with Import, Address => Render.fbConfigsAddr; type PictFormatReply is access all xcb_render_query_pict_formats_reply_t; visual : access XUtil.XVisualInfo; ignore : Interfaces.C.int; cookie : xcb_render_query_pict_formats_cookie_t; formats : PictFormatReply; screens : aliased xcb_render_pictscreen_iterator_t; depths : aliased xcb_render_pictdepth_iterator_t; visuals : aliased xcb_render_pictvisual_iterator_t; doofers : aliased xcb_render_pictforminfo_iterator_t; procedure free is new Ada.Unchecked_Deallocation (Object => xcb_render_query_pict_formats_reply_t, Name => PictFormatReply); begin -- Get formats cookie := xcb_render_query_pict_formats (connection); -- allocates on heap! formats := xcb_render_query_pict_formats_reply (connection, cookie, System.Null_Address); for fb of fbConfigs loop -- allocates on heap! visual := GLX.glXGetVisualFromFBConfig (display, fb); -- If we use a different visual, glXSwapBuffers fails -- EXPERIMENT -- visualID := xproto.xcb_visualid_t(visual.the_visualid); -- fbConfig := fb; -- return; -- END EXPERIMENT if visual /= null then screens := xcb_render_query_pict_formats_screens_iterator (formats); while screens.c_rem >= 0 loop depths := xcb_render_pictscreen_depths_iterator (screens.data); while depths.c_rem >= 0 loop visuals := xcb_render_pictdepth_visuals_iterator (depths.data); while visuals.c_rem >= 0 loop if visuals.data.visual = xproto.xcb_visualid_t(visual.the_visualid) then doofers := xcb_render_query_pict_formats_formats_iterator (formats); while doofers.c_rem >= 0 loop if doofers.data.id = visuals.data.format and doofers.data.direct.alpha_mask > 0 then -- we found it! Ada.Text_IO.Put_Line ("Troodon: (Render) Found picture format" & doofers.data.id'Image & " matching visual ID" & visuals.data.visual'Image); visualID := xproto.xcb_visualid_t(visual.the_visualid); fbConfig := fb; ignore := XLib.XFree (visual.all'Address); free (formats); return; end if; xcb_render_pictforminfo_next (doofers'Access); end loop; end if; xcb_render_pictvisual_next (visuals'Access); end loop; xcb_render_pictdepth_next (depths'Access); end loop; xcb_render_pictscreen_next (screens'Access); end loop; ignore := XLib.XFree (visual.all'Address); end if; end loop; free (formats); end findVisualFormat; raise OpenGLException with "Troodon: (Render) Unable to find a suitable framebuffer configuration and/or visual."; end getFBConfig; --------------------------------------------------------------------------- -- start -- Try to set up OpenGL rendering --------------------------------------------------------------------------- function start(connection : not null access xcb.xcb_connection_t; display : not null access Xlib.Display) return Renderer is use GLX; glxContext : GLX.GLXContext; colormap : xproto.xcb_colormap_t; cookie : xcb.xcb_void_cookie_t; fb : GLX.GLXFBConfig; visualID : xproto.xcb_visualid_t; begin getFBConfig (connection, display, fb, visualID); printFBConfig (display, fb); Ada.Text_IO.Put_Line ("Troodon: (Render) Using Visual ID" & visualID'Image); Ada.Text_IO.Put_Line ("Troodon: (Render) Creating GLX Context"); glxContext := GLX.glXCreateNewContext (dpy => display, config => fb, renderType => GLX.GLX_RGBA_TYPE, shareList => null, direct => 1); if glxContext = null then raise OpenGLException with "Troodon: Failed to create new GLX Context"; end if; Ada.Text_IO.Put_Line ("Troodon: (Render) Created new GLX context"); -- Create XIDs for colormap colormap := xcb.xcb_generate_id (connection); cookie := xproto.xcb_create_colormap_checked (c => connection, alloc => xproto.xcb_colormap_alloc_t'Pos(xproto.XCB_COLORMAP_ALLOC_NONE), mid => colormap, window => setup.getRootWindow (connection), visual => visualID); if xcb.xcb_request_check (connection, cookie) /= null then Ada.Text_IO.Put_Line( "Troodon: Unable to create colormap"); raise OpenGLException; end if; Ada.Text_IO.Put_Line ("Troodon: Using OpenGL Renderer!"); return R : Renderer := (OPENGL, display => display, visualID => visualID, context => glxContext, colormap => colormap, fbConfig => fb); exception when OpenGLException => return initSoftwareRenderer(connection); end start; -- @TODO procedure teardownSoftwareRenderer (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is -- cookie : xcb.xcb_void_cookie_t; begin null; end teardownSoftwareRenderer; --------------------------------------------------------------------------- -- teardownGLRenderer --------------------------------------------------------------------------- procedure teardownGLRenderer (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is ignore : Interfaces.C.int; begin GLX.glXDestroyContext (rend.Display, rend.context); ignore := XLib.XFree (fbConfigsAddr); end teardownGLRenderer; --------------------------------------------------------------------------- -- stop --------------------------------------------------------------------------- procedure stop (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is begin Ada.Text_IO.Put_Line ("Troodon: (Render) Shutting down."); case rend.kind is when Render.SOFTWARE => teardownSoftwareRenderer (connection, rend); when Render.OpenGL => teardownGLRenderer (connection, rend); when others => null; end case; Ada.Text_IO.Put_Line ("Troodon: (Render) Stopped."); end stop; end Render;
4484
with Ada.Text_IO; with Ada.Unchecked_Deallocation; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with System; use System; with fontconfig; with fttypes; with freetype; with GL; with GLX; with Xlib; with Xutil; with xcb; with xcb_render; with xproto; with Setup; with Util; package body Render is -- Framebuffer configurations. Need to keep this around so we can free it -- after we're finished. The actual config used is a pointer into the -- structure at this address. -- @TODO consider making a copy of this so we don't need all of it. fbConfigsAddr : System.Address; --------------------------------------------------------------------------- -- initSoftwareRenderer -- We prefer a hardware-accelerated, eye-candy heavy rendering backend like -- OpenGL. However, in the event that this is unavailable, we can fall back -- to using a software renderer. -- @TODO probably just get rid of software rendering entirely. Let Mesa -- do that part. --------------------------------------------------------------------------- function initSoftwareRenderer (connection : access xcb.xcb_connection_t) return Render.Renderer is -- @TODO load these from a config DEFAULT_FONT : constant String := "7x13"; fontName : constant chars_ptr := New_String(DEFAULT_FONT); TITLE_FG : constant := 16#00BB_9911#; TITLE_BG : constant := 16#0077_7777#; font : xproto.xcb_font_t; cookie : xcb.xcb_void_cookie_t; gcConfig : xproto.xcb_create_gc_value_list_t; begin Ada.Text_IO.Put_Line ("Troodon: Fallback to software rendering"); -- Set up an X11 rendering context instead. Each window will use it's own -- graphics context, but we can load the font and common parameters used here. -- Load font for this GC font := xcb.xcb_generate_id(connection); cookie := xproto.xcb_open_font_checked(c => connection, fid => font, name_len => DEFAULT_FONT'Length, name => fontName); util.checkFatal(connection, cookie, "Unable to open selected font" & DEFAULT_FONT); -- Set up a graphics context configuration here w/ font -- We'll generate a new graphics context each time we create a window. gcConfig.foreground := TITLE_FG; gcConfig.background := TITLE_BG; gcConfig.font := font; --checkFatal(connection, gcCookie, "drawTitleBar: Unable to create graphics context"); return R : Renderer := (SOFTWARE, visualID => setup.getScreen(connection).root_visual, gcConfig => gcConfig); end initSoftwareRenderer; --------------------------------------------------------------------------- -- printFBConfig -- dump information about a particular GLX Framebuffer configuration --------------------------------------------------------------------------- procedure printFBConfig (display : not null access Xlib.Display; fb : GLX.GLXFBConfig) is -- GLX framebuffer attributes glxRet : int; vtype : aliased int; depth : aliased int; size : aliased int; dbuf : aliased int; bitsR : aliased int; bitsG : aliased int; bitsB : aliased int; bitsA : aliased int; vid : aliased int; trans : aliased int; begin glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_VISUAL_ID, vid'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_X_VISUAL_TYPE, vtype'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_DEPTH_SIZE, depth'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_BUFFER_SIZE, size'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_DOUBLEBUFFER, dbuf'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_RED_SIZE, bitsR'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_GREEN_SIZE, bitsG'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_BLUE_SIZE, bitsB'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_ALPHA_SIZE, bitsA'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_TRANSPARENT_TYPE, trans'Access); Ada.Text_IO.Put_Line ("Troodon: (Render) GLX Framebuffer Configuration:"); Ada.Text_IO.Put_Line (" Visual ID.......:" & vid'Image); Ada.Text_IO.Put_Line (" Visual Type.....: " & (if vtype = GLX.GLX_TRUE_COLOR then "True Color" else "Not True Color")); Ada.Text_IO.Put_Line (" Depth Size......:" & depth'Image); Ada.Text_IO.Put_Line (" Buffer Size.....:" & size'Image); Ada.Text_IO.Put_Line (" Double Buffer...: " & (if dbuf = 1 then "Yes" else "No")); Ada.Text_IO.Put_Line (" Red Bits........:" & bitsR'Image); Ada.Text_IO.Put_Line (" Green Bits......:" & bitsG'Image); Ada.Text_IO.Put_Line (" Blue Bits.......:" & bitsB'Image); Ada.Text_IO.Put_Line (" Alpha Bits......:" & bitsA'Image); Ada.Text_IO.Put_Line (" Transparency....: " & (if trans = GLX.GLX_NONE then "None" elsif trans = GLX.GLX_TRANSPARENT_INDEX then "Index" elsif trans = GLX.GLX_TRANSPARENT_RGB then "RGB" else "Unknown")); end printFBConfig; --------------------------------------------------------------------------- -- getFBConfig -- Query the X Server for an acceptable framebuffer configuration. --------------------------------------------------------------------------- procedure getFBConfig (connection : not null access xcb.xcb_connection_t; display : not null access Xlib.Display; fbConfig : out GLX.GLXFBConfig; visualID : out xproto.xcb_visualid_t) is use GLX; -- fbConfigsAddr : System.Address; fbConfigCount : aliased int; visualAttribs : GLX.IntArray(1..23) := ( GLX_X_RENDERABLE, 1, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, 1, 0 ); begin -- Find a list of suitable framebuffer configurations -- Must be freed w/ XFree Render.fbConfigsAddr := GLX.glXChooseFBConfig (dpy => display, screen => Xlib.XDefaultScreen(display), attribList => visualAttribs, nitems => fbConfigCount'Access); if Render.fbConfigsAddr = System.Null_Address or fbConfigCount = 0 then raise OpenGLException with "Troodon: (Render) Unable to get GLX framebuffer config"; end if; Ada.Text_IO.Put_Line("Troodon: (Render) Found" & fbConfigCount'Image & " potential GLX framebuffer configurations"); -- Apparently the trick here to supporting transparency is to ask for an -- alpha channel as well as make sure that there is an alpha mask in -- the XRenderPictFormat. -- h/t <NAME> -- https://stackoverflow.com/questions/4052940/how-to-make-an-opengl-rendering-context-with-transparent-background -- -- This code here is analogous to XRenderFindVisualFormat findVisualFormat: declare use xcb_render; fbConfigs : GLX.GLXFBConfigArray (1..Integer(fbConfigCount)) with Import, Address => Render.fbConfigsAddr; type PictFormatReply is access all xcb_render_query_pict_formats_reply_t; visual : access XUtil.XVisualInfo; ignore : Interfaces.C.int; cookie : xcb_render_query_pict_formats_cookie_t; formats : PictFormatReply; screens : aliased xcb_render_pictscreen_iterator_t; depths : aliased xcb_render_pictdepth_iterator_t; visuals : aliased xcb_render_pictvisual_iterator_t; doofers : aliased xcb_render_pictforminfo_iterator_t; procedure free is new Ada.Unchecked_Deallocation (Object => xcb_render_query_pict_formats_reply_t, Name => PictFormatReply); begin -- Get formats cookie := xcb_render_query_pict_formats (connection); -- allocates on heap! formats := xcb_render_query_pict_formats_reply (connection, cookie, System.Null_Address); for fb of fbConfigs loop -- allocates on heap! visual := GLX.glXGetVisualFromFBConfig (display, fb); -- If we use a different visual, glXSwapBuffers fails -- EXPERIMENT -- visualID := xproto.xcb_visualid_t(visual.the_visualid); -- fbConfig := fb; -- return; -- END EXPERIMENT if visual /= null then screens := xcb_render_query_pict_formats_screens_iterator (formats); while screens.c_rem >= 0 loop depths := xcb_render_pictscreen_depths_iterator (screens.data); while depths.c_rem >= 0 loop visuals := xcb_render_pictdepth_visuals_iterator (depths.data); while visuals.c_rem >= 0 loop if visuals.data.visual = xproto.xcb_visualid_t(visual.the_visualid) then doofers := xcb_render_query_pict_formats_formats_iterator (formats); while doofers.c_rem >= 0 loop if doofers.data.id = visuals.data.format and doofers.data.direct.alpha_mask > 0 then -- we found it! Ada.Text_IO.Put_Line ("Troodon: (Render) Found picture format" & doofers.data.id'Image & " matching visual ID" & visuals.data.visual'Image); visualID := xproto.xcb_visualid_t(visual.the_visualid); fbConfig := fb; ignore := XLib.XFree (visual.all'Address); free (formats); return; end if; xcb_render_pictforminfo_next (doofers'Access); end loop; end if; xcb_render_pictvisual_next (visuals'Access); end loop; xcb_render_pictdepth_next (depths'Access); end loop; xcb_render_pictscreen_next (screens'Access); end loop; ignore := XLib.XFree (visual.all'Address); end if; end loop; free (formats); end findVisualFormat; raise OpenGLException with "Troodon: (Render) Unable to find a suitable framebuffer configuration and/or visual."; end getFBConfig; --------------------------------------------------------------------------- -- start -- Try to set up OpenGL rendering --------------------------------------------------------------------------- function start(connection : not null access xcb.xcb_connection_t; display : not null access Xlib.Display) return Renderer is use GLX; glxContext : GLX.GLXContext; colormap : xproto.xcb_colormap_t; cookie : xcb.xcb_void_cookie_t; fb : GLX.GLXFBConfig; visualID : xproto.xcb_visualid_t; begin getFBConfig (connection, display, fb, visualID); printFBConfig (display, fb); Ada.Text_IO.Put_Line ("Troodon: (Render) Using Visual ID" & visualID'Image); Ada.Text_IO.Put_Line ("Troodon: (Render) Creating GLX Context"); glxContext := GLX.glXCreateNewContext (dpy => display, config => fb, renderType => GLX.GLX_RGBA_TYPE, shareList => null, direct => 1); if glxContext = null then raise OpenGLException with "Troodon: Failed to create new GLX Context"; end if; Ada.Text_IO.Put_Line ("Troodon: (Render) Created new GLX context"); -- Create XIDs for colormap colormap := xcb.xcb_generate_id (connection); cookie := xproto.xcb_create_colormap_checked (c => connection, alloc => xproto.xcb_colormap_alloc_t'Pos(xproto.XCB_COLORMAP_ALLOC_NONE), mid => colormap, window => setup.getRootWindow (connection), visual => visualID); if xcb.xcb_request_check (connection, cookie) /= null then Ada.Text_IO.Put_Line( "Troodon: Unable to create colormap"); raise OpenGLException; end if; Ada.Text_IO.Put_Line ("Troodon: Using OpenGL Renderer!"); return R : Renderer := (OPENGL, display => display, visualID => visualID, context => glxContext, colormap => colormap, fbConfig => fb); exception when OpenGLException => return initSoftwareRenderer(connection); end start; -- @TODO procedure teardownSoftwareRenderer (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is -- cookie : xcb.xcb_void_cookie_t; begin null; end teardownSoftwareRenderer; --------------------------------------------------------------------------- -- teardownGLRenderer --------------------------------------------------------------------------- procedure teardownGLRenderer (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is ignore : Interfaces.C.int; begin GLX.glXDestroyContext (rend.Display, rend.context); ignore := XLib.XFree (fbConfigsAddr); end teardownGLRenderer; --------------------------------------------------------------------------- -- stop --------------------------------------------------------------------------- procedure stop (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is begin Ada.Text_IO.Put_Line ("Troodon: (Render) Shutting down."); case rend.kind is when Render.SOFTWARE => teardownSoftwareRenderer (connection, rend); when Render.OpenGL => teardownGLRenderer (connection, rend); when others => null; end case; Ada.Text_IO.Put_Line ("Troodon: (Render) Stopped."); end stop; end Render;
true
with Ada.Text_IO; with Ada.Unchecked_Deallocation; with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with System; use System; with fontconfig; with fttypes; with freetype; with GL; with GLX; with Xlib; with Xutil; with xcb; with xcb_render; with xproto; with Setup; with Util; package body Render is -- Framebuffer configurations. Need to keep this around so we can free it -- after we're finished. The actual config used is a pointer into the -- structure at this address. -- @TODO consider making a copy of this so we don't need all of it. fbConfigsAddr : System.Address; --------------------------------------------------------------------------- -- initSoftwareRenderer -- We prefer a hardware-accelerated, eye-candy heavy rendering backend like -- OpenGL. However, in the event that this is unavailable, we can fall back -- to using a software renderer. -- @TODO probably just get rid of software rendering entirely. Let Mesa -- do that part. --------------------------------------------------------------------------- function initSoftwareRenderer (connection : access xcb.xcb_connection_t) return Render.Renderer is -- @TODO load these from a config DEFAULT_FONT : constant String := "7x13"; fontName : constant chars_ptr := New_String(DEFAULT_FONT); TITLE_FG : constant := 16#00BB_9911#; TITLE_BG : constant := 16#0077_7777#; font : xproto.xcb_font_t; cookie : xcb.xcb_void_cookie_t; gcConfig : xproto.xcb_create_gc_value_list_t; begin Ada.Text_IO.Put_Line ("Troodon: Fallback to software rendering"); -- Set up an X11 rendering context instead. Each window will use it's own -- graphics context, but we can load the font and common parameters used here. -- Load font for this GC font := xcb.xcb_generate_id(connection); cookie := xproto.xcb_open_font_checked(c => connection, fid => font, name_len => DEFAULT_FONT'Length, name => fontName); util.checkFatal(connection, cookie, "Unable to open selected font" & DEFAULT_FONT); -- Set up a graphics context configuration here w/ font -- We'll generate a new graphics context each time we create a window. gcConfig.foreground := TITLE_FG; gcConfig.background := TITLE_BG; gcConfig.font := font; --checkFatal(connection, gcCookie, "drawTitleBar: Unable to create graphics context"); return R : Renderer := (SOFTWARE, visualID => setup.getScreen(connection).root_visual, gcConfig => gcConfig); end initSoftwareRenderer; --------------------------------------------------------------------------- -- printFBConfig -- dump information about a particular GLX Framebuffer configuration --------------------------------------------------------------------------- procedure printFBConfig (display : not null access Xlib.Display; fb : GLX.GLXFBConfig) is -- GLX framebuffer attributes glxRet : int; vtype : aliased int; depth : aliased int; size : aliased int; dbuf : aliased int; bitsR : aliased int; bitsG : aliased int; bitsB : aliased int; bitsA : aliased int; vid : aliased int; trans : aliased int; begin glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_VISUAL_ID, vid'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_X_VISUAL_TYPE, vtype'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_DEPTH_SIZE, depth'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_BUFFER_SIZE, size'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_DOUBLEBUFFER, dbuf'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_RED_SIZE, bitsR'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_GREEN_SIZE, bitsG'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_BLUE_SIZE, bitsB'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_ALPHA_SIZE, bitsA'Access); glxRet := GLX.glXGetFBConfigAttrib (display, fb, GLX.GLX_TRANSPARENT_TYPE, trans'Access); Ada.Text_IO.Put_Line ("Troodon: (Render) GLX Framebuffer Configuration:"); Ada.Text_IO.Put_Line (" Visual ID.......:" & vid'Image); Ada.Text_IO.Put_Line (" Visual Type.....: " & (if vtype = GLX.GLX_TRUE_COLOR then "True Color" else "Not True Color")); Ada.Text_IO.Put_Line (" Depth Size......:" & depth'Image); Ada.Text_IO.Put_Line (" Buffer Size.....:" & size'Image); Ada.Text_IO.Put_Line (" Double Buffer...: " & (if dbuf = 1 then "Yes" else "No")); Ada.Text_IO.Put_Line (" Red Bits........:" & bitsR'Image); Ada.Text_IO.Put_Line (" Green Bits......:" & bitsG'Image); Ada.Text_IO.Put_Line (" Blue Bits.......:" & bitsB'Image); Ada.Text_IO.Put_Line (" Alpha Bits......:" & bitsA'Image); Ada.Text_IO.Put_Line (" Transparency....: " & (if trans = GLX.GLX_NONE then "None" elsif trans = GLX.GLX_TRANSPARENT_INDEX then "Index" elsif trans = GLX.GLX_TRANSPARENT_RGB then "RGB" else "Unknown")); end printFBConfig; --------------------------------------------------------------------------- -- getFBConfig -- Query the X Server for an acceptable framebuffer configuration. --------------------------------------------------------------------------- procedure getFBConfig (connection : not null access xcb.xcb_connection_t; display : not null access Xlib.Display; fbConfig : out GLX.GLXFBConfig; visualID : out xproto.xcb_visualid_t) is use GLX; -- fbConfigsAddr : System.Address; fbConfigCount : aliased int; visualAttribs : GLX.IntArray(1..23) := ( GLX_X_RENDERABLE, 1, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, 1, 0 ); begin -- Find a list of suitable framebuffer configurations -- Must be freed w/ XFree Render.fbConfigsAddr := GLX.glXChooseFBConfig (dpy => display, screen => Xlib.XDefaultScreen(display), attribList => visualAttribs, nitems => fbConfigCount'Access); if Render.fbConfigsAddr = System.Null_Address or fbConfigCount = 0 then raise OpenGLException with "Troodon: (Render) Unable to get GLX framebuffer config"; end if; Ada.Text_IO.Put_Line("Troodon: (Render) Found" & fbConfigCount'Image & " potential GLX framebuffer configurations"); -- Apparently the trick here to supporting transparency is to ask for an -- alpha channel as well as make sure that there is an alpha mask in -- the XRenderPictFormat. -- h/t PI:NAME:<NAME>END_PI -- https://stackoverflow.com/questions/4052940/how-to-make-an-opengl-rendering-context-with-transparent-background -- -- This code here is analogous to XRenderFindVisualFormat findVisualFormat: declare use xcb_render; fbConfigs : GLX.GLXFBConfigArray (1..Integer(fbConfigCount)) with Import, Address => Render.fbConfigsAddr; type PictFormatReply is access all xcb_render_query_pict_formats_reply_t; visual : access XUtil.XVisualInfo; ignore : Interfaces.C.int; cookie : xcb_render_query_pict_formats_cookie_t; formats : PictFormatReply; screens : aliased xcb_render_pictscreen_iterator_t; depths : aliased xcb_render_pictdepth_iterator_t; visuals : aliased xcb_render_pictvisual_iterator_t; doofers : aliased xcb_render_pictforminfo_iterator_t; procedure free is new Ada.Unchecked_Deallocation (Object => xcb_render_query_pict_formats_reply_t, Name => PictFormatReply); begin -- Get formats cookie := xcb_render_query_pict_formats (connection); -- allocates on heap! formats := xcb_render_query_pict_formats_reply (connection, cookie, System.Null_Address); for fb of fbConfigs loop -- allocates on heap! visual := GLX.glXGetVisualFromFBConfig (display, fb); -- If we use a different visual, glXSwapBuffers fails -- EXPERIMENT -- visualID := xproto.xcb_visualid_t(visual.the_visualid); -- fbConfig := fb; -- return; -- END EXPERIMENT if visual /= null then screens := xcb_render_query_pict_formats_screens_iterator (formats); while screens.c_rem >= 0 loop depths := xcb_render_pictscreen_depths_iterator (screens.data); while depths.c_rem >= 0 loop visuals := xcb_render_pictdepth_visuals_iterator (depths.data); while visuals.c_rem >= 0 loop if visuals.data.visual = xproto.xcb_visualid_t(visual.the_visualid) then doofers := xcb_render_query_pict_formats_formats_iterator (formats); while doofers.c_rem >= 0 loop if doofers.data.id = visuals.data.format and doofers.data.direct.alpha_mask > 0 then -- we found it! Ada.Text_IO.Put_Line ("Troodon: (Render) Found picture format" & doofers.data.id'Image & " matching visual ID" & visuals.data.visual'Image); visualID := xproto.xcb_visualid_t(visual.the_visualid); fbConfig := fb; ignore := XLib.XFree (visual.all'Address); free (formats); return; end if; xcb_render_pictforminfo_next (doofers'Access); end loop; end if; xcb_render_pictvisual_next (visuals'Access); end loop; xcb_render_pictdepth_next (depths'Access); end loop; xcb_render_pictscreen_next (screens'Access); end loop; ignore := XLib.XFree (visual.all'Address); end if; end loop; free (formats); end findVisualFormat; raise OpenGLException with "Troodon: (Render) Unable to find a suitable framebuffer configuration and/or visual."; end getFBConfig; --------------------------------------------------------------------------- -- start -- Try to set up OpenGL rendering --------------------------------------------------------------------------- function start(connection : not null access xcb.xcb_connection_t; display : not null access Xlib.Display) return Renderer is use GLX; glxContext : GLX.GLXContext; colormap : xproto.xcb_colormap_t; cookie : xcb.xcb_void_cookie_t; fb : GLX.GLXFBConfig; visualID : xproto.xcb_visualid_t; begin getFBConfig (connection, display, fb, visualID); printFBConfig (display, fb); Ada.Text_IO.Put_Line ("Troodon: (Render) Using Visual ID" & visualID'Image); Ada.Text_IO.Put_Line ("Troodon: (Render) Creating GLX Context"); glxContext := GLX.glXCreateNewContext (dpy => display, config => fb, renderType => GLX.GLX_RGBA_TYPE, shareList => null, direct => 1); if glxContext = null then raise OpenGLException with "Troodon: Failed to create new GLX Context"; end if; Ada.Text_IO.Put_Line ("Troodon: (Render) Created new GLX context"); -- Create XIDs for colormap colormap := xcb.xcb_generate_id (connection); cookie := xproto.xcb_create_colormap_checked (c => connection, alloc => xproto.xcb_colormap_alloc_t'Pos(xproto.XCB_COLORMAP_ALLOC_NONE), mid => colormap, window => setup.getRootWindow (connection), visual => visualID); if xcb.xcb_request_check (connection, cookie) /= null then Ada.Text_IO.Put_Line( "Troodon: Unable to create colormap"); raise OpenGLException; end if; Ada.Text_IO.Put_Line ("Troodon: Using OpenGL Renderer!"); return R : Renderer := (OPENGL, display => display, visualID => visualID, context => glxContext, colormap => colormap, fbConfig => fb); exception when OpenGLException => return initSoftwareRenderer(connection); end start; -- @TODO procedure teardownSoftwareRenderer (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is -- cookie : xcb.xcb_void_cookie_t; begin null; end teardownSoftwareRenderer; --------------------------------------------------------------------------- -- teardownGLRenderer --------------------------------------------------------------------------- procedure teardownGLRenderer (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is ignore : Interfaces.C.int; begin GLX.glXDestroyContext (rend.Display, rend.context); ignore := XLib.XFree (fbConfigsAddr); end teardownGLRenderer; --------------------------------------------------------------------------- -- stop --------------------------------------------------------------------------- procedure stop (connection : access xcb.xcb_connection_t; rend : Render.Renderer) is begin Ada.Text_IO.Put_Line ("Troodon: (Render) Shutting down."); case rend.kind is when Render.SOFTWARE => teardownSoftwareRenderer (connection, rend); when Render.OpenGL => teardownGLRenderer (connection, rend); when others => null; end case; Ada.Text_IO.Put_Line ("Troodon: (Render) Stopped."); end stop; end Render;
[ { "context": "-- Shoot'n'loot\n-- Copyright (c) 2020 Fabien Chouteau\n\npackage Menus is\n\n procedure Run with No_Retur", "end": 55, "score": 0.999819278717041, "start": 40, "tag": "NAME", "value": "Fabien Chouteau" } ]
src/menus.ads
thomas070605/shoot-n-loot
0
-- Shoot'n'loot -- Copyright (c) 2020 Fabien Chouteau package Menus is procedure Run with No_Return; end Menus;
24231
-- Shoot'n'loot -- Copyright (c) 2020 <NAME> package Menus is procedure Run with No_Return; end Menus;
true
-- Shoot'n'loot -- Copyright (c) 2020 PI:NAME:<NAME>END_PI package Menus is procedure Run with No_Return; end Menus;
[ { "context": "ity-oauth - OAuth2 servlets\n-- Copyright (C) 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 155, "score": 0.9998735189437866, "start": 140, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2018 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 186, "score": 0.9998782873153687, "start": 171, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "8 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 213, "score": 0.9999265670776367, "start": 188, "tag": "EMAIL", "value": "[email protected]" } ]
src/servlet-security-oauth.adb
My-Colaborations/ada-servlet
6
----------------------------------------------------------------------- -- servlet-security-oauth - OAuth2 servlets -- Copyright (C) 2018 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.Strings.Unbounded; with Util.Encoders; with Util.Strings; with Servlet.Streams.JSON; with Security.Auth; use Security; package body Servlet.Security.OAuth is use Ada.Strings.Unbounded; use type Servers.Grant_Status; function Get_Authorization (Req : in Servlet.Requests.Request'Class) return String; -- ------------------------------ -- Called by the servlet container to indicate to a servlet that the servlet -- is being placed into service. -- ------------------------------ overriding procedure Initialize (Server : in out Token_Servlet; Context : in Servlet.Core.Servlet_Registry'Class) is begin null; end Initialize; -- ------------------------------ -- Set the authorization manager. -- ------------------------------ procedure Set_Auth_Manager (Server : in out Token_Servlet; Manager : in Servers.Auth_Manager_Access) is begin Server.Manager := Manager; end Set_Auth_Manager; function Get_Authorization (Req : in Servlet.Requests.Request'Class) return String is Decoder : constant Util.Encoders.Decoder := Util.Encoders.Create (Util.Encoders.BASE_64_URL); Auth : constant String := Req.Get_Header ("Authorization"); begin if Auth'Length < 6 then return ""; end if; if Auth (Auth'First .. Auth'First + 5) /= "Basic " then return ""; end if; return Decoder.Decode (Auth (Auth'First + 6 .. Auth'Last)); exception when others => return ""; end Get_Authorization; -- ------------------------------ -- Perform the OAuth token request. This is the last step in OAuth flow that allows -- to retrieve an access token and an optional refresh token. This token request is -- used by the following OAuth methods: -- RFC 6749: 4.1.3. Access Token Request -- RFC 6749: 4.3. Resource Owner Password Credentials Grant -- RFC 6749: 4.4. Client Credentials Grant -- RFC 6749: 4.5. Extension Grants -- ------------------------------ overriding procedure Do_Post (Server : in Token_Servlet; Request : in out Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class) is type Auth_Params is new Auth.Parameters with record Client_Id : Ada.Strings.Unbounded.Unbounded_String; Client_Secret : Ada.Strings.Unbounded.Unbounded_String; Has_Authorization : Boolean := False; end record; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String is begin if Name = "client_id" and Params.Has_Authorization then return To_String (Params.Client_Id); end if; if Name = "client_secret" and Params.Has_Authorization then return To_String (Params.Client_Secret); end if; return Request.Get_Parameter (Name); end Get_Parameter; Params : Auth_Params; Grant : Servers.Grant_Type; Auth : constant String := Get_Authorization (Request); Pos : constant Natural := Util.Strings.Index (Auth, ':'); Output : constant Streams.Print_Stream := Response.Get_Output_Stream; Stream : Streams.JSON.Print_Stream; begin if Pos > 0 then Params.Client_Id := To_Unbounded_String (Auth (Auth'First .. Pos - 1)); Params.Client_Id := To_Unbounded_String (Auth (Pos + 1 .. Auth'Last)); Params.Has_Authorization := True; end if; Streams.JSON.Initialize (Stream, Output); Response.Set_Content_Type ("application/json; charset=utf-8"); Server.Manager.Token (Params, Grant); if Grant.Status = Servers.Valid_Grant then Response.Set_Status (Servlet.Responses.SC_OK); Stream.Start_Document; Stream.Start_Entity (""); Stream.Write_Entity ("access_token", To_String (Grant.Token)); Stream.Write_Entity ("token_type", "Bearer"); Stream.Write_Long_Entity ("expires_in", Long_Long_Integer (Grant.Expires_In)); Stream.End_Entity (""); Stream.End_Document; else Response.Set_Status (Servlet.Responses.SC_BAD_REQUEST); Stream.Start_Document; Stream.Start_Entity (""); Stream.Write_Entity ("error", Grant.Error.all); Stream.End_Entity (""); Stream.End_Document; end if; end Do_Post; end Servlet.Security.OAuth;
14321
----------------------------------------------------------------------- -- servlet-security-oauth - OAuth2 servlets -- Copyright (C) 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Encoders; with Util.Strings; with Servlet.Streams.JSON; with Security.Auth; use Security; package body Servlet.Security.OAuth is use Ada.Strings.Unbounded; use type Servers.Grant_Status; function Get_Authorization (Req : in Servlet.Requests.Request'Class) return String; -- ------------------------------ -- Called by the servlet container to indicate to a servlet that the servlet -- is being placed into service. -- ------------------------------ overriding procedure Initialize (Server : in out Token_Servlet; Context : in Servlet.Core.Servlet_Registry'Class) is begin null; end Initialize; -- ------------------------------ -- Set the authorization manager. -- ------------------------------ procedure Set_Auth_Manager (Server : in out Token_Servlet; Manager : in Servers.Auth_Manager_Access) is begin Server.Manager := Manager; end Set_Auth_Manager; function Get_Authorization (Req : in Servlet.Requests.Request'Class) return String is Decoder : constant Util.Encoders.Decoder := Util.Encoders.Create (Util.Encoders.BASE_64_URL); Auth : constant String := Req.Get_Header ("Authorization"); begin if Auth'Length < 6 then return ""; end if; if Auth (Auth'First .. Auth'First + 5) /= "Basic " then return ""; end if; return Decoder.Decode (Auth (Auth'First + 6 .. Auth'Last)); exception when others => return ""; end Get_Authorization; -- ------------------------------ -- Perform the OAuth token request. This is the last step in OAuth flow that allows -- to retrieve an access token and an optional refresh token. This token request is -- used by the following OAuth methods: -- RFC 6749: 4.1.3. Access Token Request -- RFC 6749: 4.3. Resource Owner Password Credentials Grant -- RFC 6749: 4.4. Client Credentials Grant -- RFC 6749: 4.5. Extension Grants -- ------------------------------ overriding procedure Do_Post (Server : in Token_Servlet; Request : in out Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class) is type Auth_Params is new Auth.Parameters with record Client_Id : Ada.Strings.Unbounded.Unbounded_String; Client_Secret : Ada.Strings.Unbounded.Unbounded_String; Has_Authorization : Boolean := False; end record; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String is begin if Name = "client_id" and Params.Has_Authorization then return To_String (Params.Client_Id); end if; if Name = "client_secret" and Params.Has_Authorization then return To_String (Params.Client_Secret); end if; return Request.Get_Parameter (Name); end Get_Parameter; Params : Auth_Params; Grant : Servers.Grant_Type; Auth : constant String := Get_Authorization (Request); Pos : constant Natural := Util.Strings.Index (Auth, ':'); Output : constant Streams.Print_Stream := Response.Get_Output_Stream; Stream : Streams.JSON.Print_Stream; begin if Pos > 0 then Params.Client_Id := To_Unbounded_String (Auth (Auth'First .. Pos - 1)); Params.Client_Id := To_Unbounded_String (Auth (Pos + 1 .. Auth'Last)); Params.Has_Authorization := True; end if; Streams.JSON.Initialize (Stream, Output); Response.Set_Content_Type ("application/json; charset=utf-8"); Server.Manager.Token (Params, Grant); if Grant.Status = Servers.Valid_Grant then Response.Set_Status (Servlet.Responses.SC_OK); Stream.Start_Document; Stream.Start_Entity (""); Stream.Write_Entity ("access_token", To_String (Grant.Token)); Stream.Write_Entity ("token_type", "Bearer"); Stream.Write_Long_Entity ("expires_in", Long_Long_Integer (Grant.Expires_In)); Stream.End_Entity (""); Stream.End_Document; else Response.Set_Status (Servlet.Responses.SC_BAD_REQUEST); Stream.Start_Document; Stream.Start_Entity (""); Stream.Write_Entity ("error", Grant.Error.all); Stream.End_Entity (""); Stream.End_Document; end if; end Do_Post; end Servlet.Security.OAuth;
true
----------------------------------------------------------------------- -- servlet-security-oauth - OAuth2 servlets -- Copyright (C) 2018 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Encoders; with Util.Strings; with Servlet.Streams.JSON; with Security.Auth; use Security; package body Servlet.Security.OAuth is use Ada.Strings.Unbounded; use type Servers.Grant_Status; function Get_Authorization (Req : in Servlet.Requests.Request'Class) return String; -- ------------------------------ -- Called by the servlet container to indicate to a servlet that the servlet -- is being placed into service. -- ------------------------------ overriding procedure Initialize (Server : in out Token_Servlet; Context : in Servlet.Core.Servlet_Registry'Class) is begin null; end Initialize; -- ------------------------------ -- Set the authorization manager. -- ------------------------------ procedure Set_Auth_Manager (Server : in out Token_Servlet; Manager : in Servers.Auth_Manager_Access) is begin Server.Manager := Manager; end Set_Auth_Manager; function Get_Authorization (Req : in Servlet.Requests.Request'Class) return String is Decoder : constant Util.Encoders.Decoder := Util.Encoders.Create (Util.Encoders.BASE_64_URL); Auth : constant String := Req.Get_Header ("Authorization"); begin if Auth'Length < 6 then return ""; end if; if Auth (Auth'First .. Auth'First + 5) /= "Basic " then return ""; end if; return Decoder.Decode (Auth (Auth'First + 6 .. Auth'Last)); exception when others => return ""; end Get_Authorization; -- ------------------------------ -- Perform the OAuth token request. This is the last step in OAuth flow that allows -- to retrieve an access token and an optional refresh token. This token request is -- used by the following OAuth methods: -- RFC 6749: 4.1.3. Access Token Request -- RFC 6749: 4.3. Resource Owner Password Credentials Grant -- RFC 6749: 4.4. Client Credentials Grant -- RFC 6749: 4.5. Extension Grants -- ------------------------------ overriding procedure Do_Post (Server : in Token_Servlet; Request : in out Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class) is type Auth_Params is new Auth.Parameters with record Client_Id : Ada.Strings.Unbounded.Unbounded_String; Client_Secret : Ada.Strings.Unbounded.Unbounded_String; Has_Authorization : Boolean := False; end record; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String; overriding function Get_Parameter (Params : in Auth_Params; Name : in String) return String is begin if Name = "client_id" and Params.Has_Authorization then return To_String (Params.Client_Id); end if; if Name = "client_secret" and Params.Has_Authorization then return To_String (Params.Client_Secret); end if; return Request.Get_Parameter (Name); end Get_Parameter; Params : Auth_Params; Grant : Servers.Grant_Type; Auth : constant String := Get_Authorization (Request); Pos : constant Natural := Util.Strings.Index (Auth, ':'); Output : constant Streams.Print_Stream := Response.Get_Output_Stream; Stream : Streams.JSON.Print_Stream; begin if Pos > 0 then Params.Client_Id := To_Unbounded_String (Auth (Auth'First .. Pos - 1)); Params.Client_Id := To_Unbounded_String (Auth (Pos + 1 .. Auth'Last)); Params.Has_Authorization := True; end if; Streams.JSON.Initialize (Stream, Output); Response.Set_Content_Type ("application/json; charset=utf-8"); Server.Manager.Token (Params, Grant); if Grant.Status = Servers.Valid_Grant then Response.Set_Status (Servlet.Responses.SC_OK); Stream.Start_Document; Stream.Start_Entity (""); Stream.Write_Entity ("access_token", To_String (Grant.Token)); Stream.Write_Entity ("token_type", "Bearer"); Stream.Write_Long_Entity ("expires_in", Long_Long_Integer (Grant.Expires_In)); Stream.End_Entity (""); Stream.End_Document; else Response.Set_Status (Servlet.Responses.SC_BAD_REQUEST); Stream.Start_Document; Stream.Start_Entity (""); Stream.Write_Entity ("error", Grant.Error.all); Stream.End_Entity (""); Stream.End_Document; end if; end Do_Post; end Servlet.Security.OAuth;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998534321784973, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999300241470337, "start": 37, "tag": "EMAIL", "value": "[email protected]" } ]
source/oasis/program-elements-formal_discrete_type_definitions.ads
optikos/oasis
0
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Formal_Type_Definitions; with Program.Lexical_Elements; package Program.Elements.Formal_Discrete_Type_Definitions is pragma Pure (Program.Elements.Formal_Discrete_Type_Definitions); type Formal_Discrete_Type_Definition is limited interface and Program.Elements.Formal_Type_Definitions.Formal_Type_Definition; type Formal_Discrete_Type_Definition_Access is access all Formal_Discrete_Type_Definition'Class with Storage_Size => 0; type Formal_Discrete_Type_Definition_Text is limited interface; type Formal_Discrete_Type_Definition_Text_Access is access all Formal_Discrete_Type_Definition_Text'Class with Storage_Size => 0; not overriding function To_Formal_Discrete_Type_Definition_Text (Self : aliased in out Formal_Discrete_Type_Definition) return Formal_Discrete_Type_Definition_Text_Access is abstract; not overriding function Left_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Box_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Formal_Discrete_Type_Definitions;
27841
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Formal_Type_Definitions; with Program.Lexical_Elements; package Program.Elements.Formal_Discrete_Type_Definitions is pragma Pure (Program.Elements.Formal_Discrete_Type_Definitions); type Formal_Discrete_Type_Definition is limited interface and Program.Elements.Formal_Type_Definitions.Formal_Type_Definition; type Formal_Discrete_Type_Definition_Access is access all Formal_Discrete_Type_Definition'Class with Storage_Size => 0; type Formal_Discrete_Type_Definition_Text is limited interface; type Formal_Discrete_Type_Definition_Text_Access is access all Formal_Discrete_Type_Definition_Text'Class with Storage_Size => 0; not overriding function To_Formal_Discrete_Type_Definition_Text (Self : aliased in out Formal_Discrete_Type_Definition) return Formal_Discrete_Type_Definition_Text_Access is abstract; not overriding function Left_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Box_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Formal_Discrete_Type_Definitions;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Formal_Type_Definitions; with Program.Lexical_Elements; package Program.Elements.Formal_Discrete_Type_Definitions is pragma Pure (Program.Elements.Formal_Discrete_Type_Definitions); type Formal_Discrete_Type_Definition is limited interface and Program.Elements.Formal_Type_Definitions.Formal_Type_Definition; type Formal_Discrete_Type_Definition_Access is access all Formal_Discrete_Type_Definition'Class with Storage_Size => 0; type Formal_Discrete_Type_Definition_Text is limited interface; type Formal_Discrete_Type_Definition_Text_Access is access all Formal_Discrete_Type_Definition_Text'Class with Storage_Size => 0; not overriding function To_Formal_Discrete_Type_Definition_Text (Self : aliased in out Formal_Discrete_Type_Definition) return Formal_Discrete_Type_Definition_Text_Access is abstract; not overriding function Left_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Box_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Formal_Discrete_Type_Definition_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Formal_Discrete_Type_Definitions;
[ { "context": " -- Core CSS API definition\n-- Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 150, "score": 0.9998693466186523, "start": 135, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 181, "score": 0.9998809099197388, "start": 166, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "7 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 208, "score": 0.9999229311943054, "start": 183, "tag": "EMAIL", "value": "[email protected]" } ]
src/css-core.ads
stcarrez/ada-css
3
----------------------------------------------------------------------- -- css-core -- Core CSS API definition -- Copyright (C) 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 Util.Strings; with Util.Refs; with Util.Log.Locations; private with CSS.Comments; private with Ada.Finalization; private with Ada.Strings.Unbounded; private with Ada.Containers.Hashed_Maps; -- The API implemented by the <tt>CSS.Core</tt> package and child packages try to -- follow the IDL specification defined in the W3C CSS Object Model (CSSOM) -- (See https://drafts.csswg.org/cssom/ or https://www.w3.org/TR/2016/WD-cssom-1-20160317/) package CSS.Core is type CSSProperty_Name is access all String; subtype CSSProperty_Value is CSSProperty_Name; subtype Location is Util.Log.Locations.Line_Info; use type Util.Log.Locations.Line_Info; -- Get the line number. function Get_Line (Loc : in Location) return Natural renames Util.Log.Locations.Line; -- Get a printable representation of the source file name and line number. function To_String (Loc : in Location) return String; -- The StyleSheet interface represents an abstract, base style sheet. -- See CSSOM: 5.1.1. The StyleSheet Interface type Stylesheet is tagged limited private; type Stylesheet_Access is access all Stylesheet'Class; -- Returns the CSS type ("text/css"). function Get_Type (Sheet : in Stylesheet) return String; -- Get the parent CSS stylesheet if there is one or return null. function Get_Parent (Sheet : in Stylesheet) return Stylesheet_Access; -- Get the source file information. function Get_File_Info (Sheet : in Stylesheet) return Util.Log.Locations.File_Info_Access; -- Get the href attribute (stylesheet location). function Get_Href (Sheet : in Stylesheet) return String; -- Set the href attribute representing the stylesheet location. procedure Set_Href (Sheet : in out Stylesheet; Href : in String); function Create_Property_Name (Sheet : in Stylesheet; Name : in String) return CSSProperty_Name; -- Create a location record to represent a CSS source position. function Create_Location (Sheet : in Stylesheet_Access; Line : in Natural; Column : in Natural) return Location; type CSSRule_Type is (STYLE_RULE, CHARSET_RULE, IMPORT_RULE, MEDIA_RULE, FONT_FACE_RULE, PAGE_RULE, MARGIN_RULE, NAMESPACE_RULE); -- The CSSRule interface represents an abstract, base CSS style rule. -- Each distinct CSS style rule type is represented by a distinct interface that inherits -- from this interface. -- See CSSOM: Section 5.4.2. The CSSRule Interface type CSSRule is abstract new Util.Refs.Ref_Entity with private; type CSSRule_Access is access all CSSRule'Class; -- Get the type that identifies the rule. function Get_Type (Rule : in CSSRule) return CSSRule_Type is abstract; -- Get the parent rule. Returns null when there is no parent. function Get_Parent (Rule : in CSSRule) return CSSRule_Access; -- Get the stylesheet. function Get_Stylesheet (Rule : in CSSRule) return Stylesheet_Access; -- Get the location of the rule. function Get_Location (Rule : in CSSRule) return Location; private type String_Access is access all String; package String_Map is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => CSSProperty_Name, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys); type String_Map_Access is access all String_Map.Map; type Stylesheet is new Ada.Finalization.Limited_Controlled with record Loc : Location; Parent : Stylesheet_Access; File : Util.Log.Locations.File_Info_Access; Href : Ada.Strings.Unbounded.Unbounded_String; Strings : String_Map_Access := new String_Map.Map; Comments : CSS.Comments.CSSComment_List; end record; overriding procedure Finalize (Sheet : in out Stylesheet); type CSSRule is abstract new Util.Refs.Ref_Entity with record Loc : Location; Sheet : Stylesheet_Access; Parent : CSSRule_Access; Comments : CSS.Comments.CSSComment_List; end record; -- Set the source code location. procedure Set_Location (Rule : in out CSSRule'Class; Line : in Natural; Column : in Natural; Sheet : in Stylesheet_Access); end CSS.Core;
30167
----------------------------------------------------------------------- -- css-core -- Core CSS API definition -- Copyright (C) 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; with Util.Refs; with Util.Log.Locations; private with CSS.Comments; private with Ada.Finalization; private with Ada.Strings.Unbounded; private with Ada.Containers.Hashed_Maps; -- The API implemented by the <tt>CSS.Core</tt> package and child packages try to -- follow the IDL specification defined in the W3C CSS Object Model (CSSOM) -- (See https://drafts.csswg.org/cssom/ or https://www.w3.org/TR/2016/WD-cssom-1-20160317/) package CSS.Core is type CSSProperty_Name is access all String; subtype CSSProperty_Value is CSSProperty_Name; subtype Location is Util.Log.Locations.Line_Info; use type Util.Log.Locations.Line_Info; -- Get the line number. function Get_Line (Loc : in Location) return Natural renames Util.Log.Locations.Line; -- Get a printable representation of the source file name and line number. function To_String (Loc : in Location) return String; -- The StyleSheet interface represents an abstract, base style sheet. -- See CSSOM: 5.1.1. The StyleSheet Interface type Stylesheet is tagged limited private; type Stylesheet_Access is access all Stylesheet'Class; -- Returns the CSS type ("text/css"). function Get_Type (Sheet : in Stylesheet) return String; -- Get the parent CSS stylesheet if there is one or return null. function Get_Parent (Sheet : in Stylesheet) return Stylesheet_Access; -- Get the source file information. function Get_File_Info (Sheet : in Stylesheet) return Util.Log.Locations.File_Info_Access; -- Get the href attribute (stylesheet location). function Get_Href (Sheet : in Stylesheet) return String; -- Set the href attribute representing the stylesheet location. procedure Set_Href (Sheet : in out Stylesheet; Href : in String); function Create_Property_Name (Sheet : in Stylesheet; Name : in String) return CSSProperty_Name; -- Create a location record to represent a CSS source position. function Create_Location (Sheet : in Stylesheet_Access; Line : in Natural; Column : in Natural) return Location; type CSSRule_Type is (STYLE_RULE, CHARSET_RULE, IMPORT_RULE, MEDIA_RULE, FONT_FACE_RULE, PAGE_RULE, MARGIN_RULE, NAMESPACE_RULE); -- The CSSRule interface represents an abstract, base CSS style rule. -- Each distinct CSS style rule type is represented by a distinct interface that inherits -- from this interface. -- See CSSOM: Section 5.4.2. The CSSRule Interface type CSSRule is abstract new Util.Refs.Ref_Entity with private; type CSSRule_Access is access all CSSRule'Class; -- Get the type that identifies the rule. function Get_Type (Rule : in CSSRule) return CSSRule_Type is abstract; -- Get the parent rule. Returns null when there is no parent. function Get_Parent (Rule : in CSSRule) return CSSRule_Access; -- Get the stylesheet. function Get_Stylesheet (Rule : in CSSRule) return Stylesheet_Access; -- Get the location of the rule. function Get_Location (Rule : in CSSRule) return Location; private type String_Access is access all String; package String_Map is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => CSSProperty_Name, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys); type String_Map_Access is access all String_Map.Map; type Stylesheet is new Ada.Finalization.Limited_Controlled with record Loc : Location; Parent : Stylesheet_Access; File : Util.Log.Locations.File_Info_Access; Href : Ada.Strings.Unbounded.Unbounded_String; Strings : String_Map_Access := new String_Map.Map; Comments : CSS.Comments.CSSComment_List; end record; overriding procedure Finalize (Sheet : in out Stylesheet); type CSSRule is abstract new Util.Refs.Ref_Entity with record Loc : Location; Sheet : Stylesheet_Access; Parent : CSSRule_Access; Comments : CSS.Comments.CSSComment_List; end record; -- Set the source code location. procedure Set_Location (Rule : in out CSSRule'Class; Line : in Natural; Column : in Natural; Sheet : in Stylesheet_Access); end CSS.Core;
true
----------------------------------------------------------------------- -- css-core -- Core CSS API definition -- Copyright (C) 2017 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; with Util.Refs; with Util.Log.Locations; private with CSS.Comments; private with Ada.Finalization; private with Ada.Strings.Unbounded; private with Ada.Containers.Hashed_Maps; -- The API implemented by the <tt>CSS.Core</tt> package and child packages try to -- follow the IDL specification defined in the W3C CSS Object Model (CSSOM) -- (See https://drafts.csswg.org/cssom/ or https://www.w3.org/TR/2016/WD-cssom-1-20160317/) package CSS.Core is type CSSProperty_Name is access all String; subtype CSSProperty_Value is CSSProperty_Name; subtype Location is Util.Log.Locations.Line_Info; use type Util.Log.Locations.Line_Info; -- Get the line number. function Get_Line (Loc : in Location) return Natural renames Util.Log.Locations.Line; -- Get a printable representation of the source file name and line number. function To_String (Loc : in Location) return String; -- The StyleSheet interface represents an abstract, base style sheet. -- See CSSOM: 5.1.1. The StyleSheet Interface type Stylesheet is tagged limited private; type Stylesheet_Access is access all Stylesheet'Class; -- Returns the CSS type ("text/css"). function Get_Type (Sheet : in Stylesheet) return String; -- Get the parent CSS stylesheet if there is one or return null. function Get_Parent (Sheet : in Stylesheet) return Stylesheet_Access; -- Get the source file information. function Get_File_Info (Sheet : in Stylesheet) return Util.Log.Locations.File_Info_Access; -- Get the href attribute (stylesheet location). function Get_Href (Sheet : in Stylesheet) return String; -- Set the href attribute representing the stylesheet location. procedure Set_Href (Sheet : in out Stylesheet; Href : in String); function Create_Property_Name (Sheet : in Stylesheet; Name : in String) return CSSProperty_Name; -- Create a location record to represent a CSS source position. function Create_Location (Sheet : in Stylesheet_Access; Line : in Natural; Column : in Natural) return Location; type CSSRule_Type is (STYLE_RULE, CHARSET_RULE, IMPORT_RULE, MEDIA_RULE, FONT_FACE_RULE, PAGE_RULE, MARGIN_RULE, NAMESPACE_RULE); -- The CSSRule interface represents an abstract, base CSS style rule. -- Each distinct CSS style rule type is represented by a distinct interface that inherits -- from this interface. -- See CSSOM: Section 5.4.2. The CSSRule Interface type CSSRule is abstract new Util.Refs.Ref_Entity with private; type CSSRule_Access is access all CSSRule'Class; -- Get the type that identifies the rule. function Get_Type (Rule : in CSSRule) return CSSRule_Type is abstract; -- Get the parent rule. Returns null when there is no parent. function Get_Parent (Rule : in CSSRule) return CSSRule_Access; -- Get the stylesheet. function Get_Stylesheet (Rule : in CSSRule) return Stylesheet_Access; -- Get the location of the rule. function Get_Location (Rule : in CSSRule) return Location; private type String_Access is access all String; package String_Map is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => CSSProperty_Name, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys); type String_Map_Access is access all String_Map.Map; type Stylesheet is new Ada.Finalization.Limited_Controlled with record Loc : Location; Parent : Stylesheet_Access; File : Util.Log.Locations.File_Info_Access; Href : Ada.Strings.Unbounded.Unbounded_String; Strings : String_Map_Access := new String_Map.Map; Comments : CSS.Comments.CSSComment_List; end record; overriding procedure Finalize (Sheet : in out Stylesheet); type CSSRule is abstract new Util.Refs.Ref_Entity with record Loc : Location; Sheet : Stylesheet_Access; Parent : CSSRule_Access; Comments : CSS.Comments.CSSComment_List; end record; -- Set the source code location. procedure Set_Location (Rule : in out CSSRule'Class; Line : in Natural; Column : in Natural; Sheet : in Stylesheet_Access); end CSS.Core;
[ { "context": " --\n-- Copyright © 2013, Vadim Godunko <[email protected]> --\n-- Al", "end": 824, "score": 0.9998900294303894, "start": 811, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2013, Vadim Godunko <[email protected]> --\n-- All rights reserved. ", "end": 844, "score": 0.9999323487281799, "start": 826, "tag": "EMAIL", "value": "[email protected]" }, { "context": " --\n-- * Neither the name of the Vadim Godunko, IE nor the names of its --\n-- contribu", "end": 1939, "score": 0.9050071835517883, "start": 1926, "tag": "NAME", "value": "Vadim Godunko" } ]
source/web/fastcgi/fastcgi-handlers-responder.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, 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$ ------------------------------------------------------------------------------ package body FastCGI.Handlers.Responder is ----------------- -- End_Headers -- ----------------- procedure End_Headers (Self : in out Abstract_Responder'Class) is begin Self.Internal_End_Headers; end End_Headers; ------------ -- Header -- ------------ procedure Header (Self : in out Abstract_Responder'Class; Name : FastCGI.Field_Names.Field_Name; Value : FastCGI.Field_Values.Field_Value) is begin Self.Internal_Header (Name, Value); end Header; ---------------------------- -- Internal_Begin_Request -- ---------------------------- overriding procedure Internal_Begin_Request (Self : in out Abstract_Responder; Socket : GNAT.Sockets.Socket_Type; Request_Id : Matreshka.FastCGI.FCGI_Request_Identifier) is begin Matreshka.FastCGI.Descriptors.Abstract_Descriptor (Self).Internal_Begin_Request (Socket, Request_Id); Abstract_Responder'Class (Self).Start_Request; end Internal_Begin_Request; ------------------------- -- Internal_End_Params -- ------------------------- overriding procedure Internal_End_Params (Self : in out Abstract_Responder) is begin Abstract_Responder'Class (Self).End_Meta_Variables; end Internal_End_Params; -------------------- -- Internal_Param -- -------------------- overriding procedure Internal_Param (Self : in out Abstract_Responder; Name : FastCGI.Field_Names.Field_Name; Value : FastCGI.Field_Values.Field_Value) is begin Abstract_Responder'Class (Self).Meta_Variable (Name, Value); end Internal_Param; -------------------- -- Internal_Stdin -- -------------------- overriding procedure Internal_Stdin (Self : in out Abstract_Responder; Buffer : Ada.Streams.Stream_Element_Array) is begin Abstract_Responder'Class (Self).Stdin (Buffer); end Internal_Stdin; ------------ -- Stderr -- ------------ procedure Stderr (Self : in out Abstract_Responder'Class; Data : Ada.Streams.Stream_Element_Array) is begin Self.Internal_Stderr (Data); end Stderr; ------------ -- Stdout -- ------------ procedure Stdout (Self : in out Abstract_Responder'Class; Data : Ada.Streams.Stream_Element_Array) is begin Self.Internal_Stdout (Data); end Stdout; ------------------- -- To_Descriptor -- ------------------- function To_Descriptor (Item : Responder_Access) return Matreshka.FastCGI.Descriptors.Descriptor_Access is begin return Matreshka.FastCGI.Descriptors.Descriptor_Access (Item); end To_Descriptor; end FastCGI.Handlers.Responder;
22313
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, <NAME> <<EMAIL>> -- -- 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 <NAME>, 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$ ------------------------------------------------------------------------------ package body FastCGI.Handlers.Responder is ----------------- -- End_Headers -- ----------------- procedure End_Headers (Self : in out Abstract_Responder'Class) is begin Self.Internal_End_Headers; end End_Headers; ------------ -- Header -- ------------ procedure Header (Self : in out Abstract_Responder'Class; Name : FastCGI.Field_Names.Field_Name; Value : FastCGI.Field_Values.Field_Value) is begin Self.Internal_Header (Name, Value); end Header; ---------------------------- -- Internal_Begin_Request -- ---------------------------- overriding procedure Internal_Begin_Request (Self : in out Abstract_Responder; Socket : GNAT.Sockets.Socket_Type; Request_Id : Matreshka.FastCGI.FCGI_Request_Identifier) is begin Matreshka.FastCGI.Descriptors.Abstract_Descriptor (Self).Internal_Begin_Request (Socket, Request_Id); Abstract_Responder'Class (Self).Start_Request; end Internal_Begin_Request; ------------------------- -- Internal_End_Params -- ------------------------- overriding procedure Internal_End_Params (Self : in out Abstract_Responder) is begin Abstract_Responder'Class (Self).End_Meta_Variables; end Internal_End_Params; -------------------- -- Internal_Param -- -------------------- overriding procedure Internal_Param (Self : in out Abstract_Responder; Name : FastCGI.Field_Names.Field_Name; Value : FastCGI.Field_Values.Field_Value) is begin Abstract_Responder'Class (Self).Meta_Variable (Name, Value); end Internal_Param; -------------------- -- Internal_Stdin -- -------------------- overriding procedure Internal_Stdin (Self : in out Abstract_Responder; Buffer : Ada.Streams.Stream_Element_Array) is begin Abstract_Responder'Class (Self).Stdin (Buffer); end Internal_Stdin; ------------ -- Stderr -- ------------ procedure Stderr (Self : in out Abstract_Responder'Class; Data : Ada.Streams.Stream_Element_Array) is begin Self.Internal_Stderr (Data); end Stderr; ------------ -- Stdout -- ------------ procedure Stdout (Self : in out Abstract_Responder'Class; Data : Ada.Streams.Stream_Element_Array) is begin Self.Internal_Stdout (Data); end Stdout; ------------------- -- To_Descriptor -- ------------------- function To_Descriptor (Item : Responder_Access) return Matreshka.FastCGI.Descriptors.Descriptor_Access is begin return Matreshka.FastCGI.Descriptors.Descriptor_Access (Item); end To_Descriptor; end FastCGI.Handlers.Responder;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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 PI:NAME:<NAME>END_PI, 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$ ------------------------------------------------------------------------------ package body FastCGI.Handlers.Responder is ----------------- -- End_Headers -- ----------------- procedure End_Headers (Self : in out Abstract_Responder'Class) is begin Self.Internal_End_Headers; end End_Headers; ------------ -- Header -- ------------ procedure Header (Self : in out Abstract_Responder'Class; Name : FastCGI.Field_Names.Field_Name; Value : FastCGI.Field_Values.Field_Value) is begin Self.Internal_Header (Name, Value); end Header; ---------------------------- -- Internal_Begin_Request -- ---------------------------- overriding procedure Internal_Begin_Request (Self : in out Abstract_Responder; Socket : GNAT.Sockets.Socket_Type; Request_Id : Matreshka.FastCGI.FCGI_Request_Identifier) is begin Matreshka.FastCGI.Descriptors.Abstract_Descriptor (Self).Internal_Begin_Request (Socket, Request_Id); Abstract_Responder'Class (Self).Start_Request; end Internal_Begin_Request; ------------------------- -- Internal_End_Params -- ------------------------- overriding procedure Internal_End_Params (Self : in out Abstract_Responder) is begin Abstract_Responder'Class (Self).End_Meta_Variables; end Internal_End_Params; -------------------- -- Internal_Param -- -------------------- overriding procedure Internal_Param (Self : in out Abstract_Responder; Name : FastCGI.Field_Names.Field_Name; Value : FastCGI.Field_Values.Field_Value) is begin Abstract_Responder'Class (Self).Meta_Variable (Name, Value); end Internal_Param; -------------------- -- Internal_Stdin -- -------------------- overriding procedure Internal_Stdin (Self : in out Abstract_Responder; Buffer : Ada.Streams.Stream_Element_Array) is begin Abstract_Responder'Class (Self).Stdin (Buffer); end Internal_Stdin; ------------ -- Stderr -- ------------ procedure Stderr (Self : in out Abstract_Responder'Class; Data : Ada.Streams.Stream_Element_Array) is begin Self.Internal_Stderr (Data); end Stderr; ------------ -- Stdout -- ------------ procedure Stdout (Self : in out Abstract_Responder'Class; Data : Ada.Streams.Stream_Element_Array) is begin Self.Internal_Stdout (Data); end Stdout; ------------------- -- To_Descriptor -- ------------------- function To_Descriptor (Item : Responder_Access) return Matreshka.FastCGI.Descriptors.Descriptor_Access is begin return Matreshka.FastCGI.Descriptors.Descriptor_Access (Item); end To_Descriptor; end FastCGI.Handlers.Responder;
[ { "context": "1 grosch Exp $\n\n-- $Log: ErrorsDrv.mi,v $\n\n-- Ich, Doktor Josef Grosch, Informatiker, Sept. 1994\n\nwith Text_Io, Sets, St", "end": 115, "score": 0.9996691346168518, "start": 96, "tag": "NAME", "value": "Doktor Josef Grosch" } ]
reuse/ada/errorsdr.adb
cocolab8/cocktail
0
-- $Id: ErrorsDrv.mi,v 1.0 1993/01/16 11:25:41 grosch Exp $ -- $Log: ErrorsDrv.mi,v $ -- Ich, Doktor Josef Grosch, Informatiker, Sept. 1994 with Text_Io, Sets, Strings, Idents, Position, Errors; use Text_Io, Sets, Strings, Idents, Position, Errors; procedure ErrorsDr is Int : Integer; Short : Integer range 0 .. 2 ** 16 - 1; Long : Integer; Real : Float; Bool : Boolean; Char : Character; Str : tString; Set : tSet; Ident : tIdent; procedure do_errors is begin MessageI ("Integer ", Errors.Error, NoPosition, Errors.cInteger , Int 'Address); MessageI ("Short ", Errors.Error, NoPosition, Errors.cShort , Short 'Address); MessageI ("Long ", Errors.Error, NoPosition, Errors.cLong , Long 'Address); MessageI ("Real ", Errors.Error, NoPosition, Errors.cFloat , Real 'Address); MessageI ("Boolean ", Errors.Error, NoPosition, Errors.cBoolean , Bool 'Address); MessageI ("Character ", Errors.Error, NoPosition, Errors.cCharacter , Char 'Address); MessageI ("String ", Errors.Error, NoPosition, Errors.cString , Str 'Address); MessageI ("Set ", Errors.Error, NoPosition, Errors.cSet , Set 'Address); MessageI ("Ident ", Errors.Error, NoPosition, Errors.cIdent , Ident 'Address); end do_errors; begin Int := 1; Short := 2; Long := 3; Real := 4.0; Bool := False; Char := 'a'; MakeSet (Set, 10); Include (Set, 5); Include (Set, 6); To_tString ("def", Str); Ident := MakeIdent (Str); do_errors; New_Line (Standard_Error); StoreMessages (True); do_errors; WriteMessages (Standard_Error); New_Line (Standard_Error); WriteMessages (Standard_Output); New_Line (Standard_Error); StoreMessages (True); WriteMessages (Standard_Output); end ErrorsDr;
26326
-- $Id: ErrorsDrv.mi,v 1.0 1993/01/16 11:25:41 grosch Exp $ -- $Log: ErrorsDrv.mi,v $ -- Ich, <NAME>, Informatiker, Sept. 1994 with Text_Io, Sets, Strings, Idents, Position, Errors; use Text_Io, Sets, Strings, Idents, Position, Errors; procedure ErrorsDr is Int : Integer; Short : Integer range 0 .. 2 ** 16 - 1; Long : Integer; Real : Float; Bool : Boolean; Char : Character; Str : tString; Set : tSet; Ident : tIdent; procedure do_errors is begin MessageI ("Integer ", Errors.Error, NoPosition, Errors.cInteger , Int 'Address); MessageI ("Short ", Errors.Error, NoPosition, Errors.cShort , Short 'Address); MessageI ("Long ", Errors.Error, NoPosition, Errors.cLong , Long 'Address); MessageI ("Real ", Errors.Error, NoPosition, Errors.cFloat , Real 'Address); MessageI ("Boolean ", Errors.Error, NoPosition, Errors.cBoolean , Bool 'Address); MessageI ("Character ", Errors.Error, NoPosition, Errors.cCharacter , Char 'Address); MessageI ("String ", Errors.Error, NoPosition, Errors.cString , Str 'Address); MessageI ("Set ", Errors.Error, NoPosition, Errors.cSet , Set 'Address); MessageI ("Ident ", Errors.Error, NoPosition, Errors.cIdent , Ident 'Address); end do_errors; begin Int := 1; Short := 2; Long := 3; Real := 4.0; Bool := False; Char := 'a'; MakeSet (Set, 10); Include (Set, 5); Include (Set, 6); To_tString ("def", Str); Ident := MakeIdent (Str); do_errors; New_Line (Standard_Error); StoreMessages (True); do_errors; WriteMessages (Standard_Error); New_Line (Standard_Error); WriteMessages (Standard_Output); New_Line (Standard_Error); StoreMessages (True); WriteMessages (Standard_Output); end ErrorsDr;
true
-- $Id: ErrorsDrv.mi,v 1.0 1993/01/16 11:25:41 grosch Exp $ -- $Log: ErrorsDrv.mi,v $ -- Ich, PI:NAME:<NAME>END_PI, Informatiker, Sept. 1994 with Text_Io, Sets, Strings, Idents, Position, Errors; use Text_Io, Sets, Strings, Idents, Position, Errors; procedure ErrorsDr is Int : Integer; Short : Integer range 0 .. 2 ** 16 - 1; Long : Integer; Real : Float; Bool : Boolean; Char : Character; Str : tString; Set : tSet; Ident : tIdent; procedure do_errors is begin MessageI ("Integer ", Errors.Error, NoPosition, Errors.cInteger , Int 'Address); MessageI ("Short ", Errors.Error, NoPosition, Errors.cShort , Short 'Address); MessageI ("Long ", Errors.Error, NoPosition, Errors.cLong , Long 'Address); MessageI ("Real ", Errors.Error, NoPosition, Errors.cFloat , Real 'Address); MessageI ("Boolean ", Errors.Error, NoPosition, Errors.cBoolean , Bool 'Address); MessageI ("Character ", Errors.Error, NoPosition, Errors.cCharacter , Char 'Address); MessageI ("String ", Errors.Error, NoPosition, Errors.cString , Str 'Address); MessageI ("Set ", Errors.Error, NoPosition, Errors.cSet , Set 'Address); MessageI ("Ident ", Errors.Error, NoPosition, Errors.cIdent , Ident 'Address); end do_errors; begin Int := 1; Short := 2; Long := 3; Real := 4.0; Bool := False; Char := 'a'; MakeSet (Set, 10); Include (Set, 5); Include (Set, 6); To_tString ("def", Str); Ident := MakeIdent (Str); do_errors; New_Line (Standard_Error); StoreMessages (True); do_errors; WriteMessages (Standard_Error); New_Line (Standard_Error); WriteMessages (Standard_Output); New_Line (Standard_Error); StoreMessages (True); WriteMessages (Standard_Output); end ErrorsDr;
[ { "context": " --\n-- Copyright (C) 2016-2017 Fabien Chouteau --\n-- ", "end": 379, "score": 0.9998605847358704, "start": 364, "tag": "NAME", "value": "Fabien Chouteau" } ]
src/GUI/clock_widget.ads
Fabien-Chouteau/coffee-clock
7
------------------------------------------------------------------------------- -- -- -- Coffee Clock -- -- -- -- Copyright (C) 2016-2017 Fabien Chouteau -- -- -- -- Coffee Clock 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. -- -- -- -- Coffee Clock 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------- with Giza.Widget; with Giza.Context; with Giza.Types; use Giza.Types; with HAL.Real_Time_Clock; package Clock_Widget is subtype Parent is Giza.Widget.Instance; type Instance is new Parent with private; subtype Class is Instance'Class; type Ref is access all Class; overriding procedure Draw (This : in out Instance; Ctx : in out Giza.Context.Class; Force : Boolean := True); procedure Set_Time (This : in out Instance; Time : HAL.Real_Time_Clock.RTC_Time); function Get_Time (This : Instance) return HAL.Real_Time_Clock.RTC_Time; function Required_Size (This : Instance) return Size_T; private type Instance is new Parent with record Time : HAL.Real_Time_Clock.RTC_Time; end record; end Clock_Widget;
6292
------------------------------------------------------------------------------- -- -- -- Coffee Clock -- -- -- -- Copyright (C) 2016-2017 <NAME> -- -- -- -- Coffee Clock 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. -- -- -- -- Coffee Clock 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------- with Giza.Widget; with Giza.Context; with Giza.Types; use Giza.Types; with HAL.Real_Time_Clock; package Clock_Widget is subtype Parent is Giza.Widget.Instance; type Instance is new Parent with private; subtype Class is Instance'Class; type Ref is access all Class; overriding procedure Draw (This : in out Instance; Ctx : in out Giza.Context.Class; Force : Boolean := True); procedure Set_Time (This : in out Instance; Time : HAL.Real_Time_Clock.RTC_Time); function Get_Time (This : Instance) return HAL.Real_Time_Clock.RTC_Time; function Required_Size (This : Instance) return Size_T; private type Instance is new Parent with record Time : HAL.Real_Time_Clock.RTC_Time; end record; end Clock_Widget;
true
------------------------------------------------------------------------------- -- -- -- Coffee Clock -- -- -- -- Copyright (C) 2016-2017 PI:NAME:<NAME>END_PI -- -- -- -- Coffee Clock 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. -- -- -- -- Coffee Clock 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 We Noise Maker. If not, see <http://www.gnu.org/licenses/>. -- -- -- ------------------------------------------------------------------------------- with Giza.Widget; with Giza.Context; with Giza.Types; use Giza.Types; with HAL.Real_Time_Clock; package Clock_Widget is subtype Parent is Giza.Widget.Instance; type Instance is new Parent with private; subtype Class is Instance'Class; type Ref is access all Class; overriding procedure Draw (This : in out Instance; Ctx : in out Giza.Context.Class; Force : Boolean := True); procedure Set_Time (This : in out Instance; Time : HAL.Real_Time_Clock.RTC_Time); function Get_Time (This : Instance) return HAL.Real_Time_Clock.RTC_Time; function Required_Size (This : Instance) return Size_T; private type Instance is new Parent with record Time : HAL.Real_Time_Clock.RTC_Time; end record; end Clock_Widget;
[ { "context": "---------------------\n-- Copyright (c) 2006-2013, Maxim Reznik\n-- All rights reserved.\n--\n-- Redistribution an", "end": 121, "score": 0.9998098611831665, "start": 109, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "the distribution.\n-- * Neither the name of the Maxim Reznik, IE nor the names of its\n-- contribu", "end": 715, "score": 0.9559805393218994, "start": 710, "tag": "NAME", "value": "Maxim" }, { "context": "ibution.\n-- * Neither the name of the Maxim Reznik, IE nor the names of its\n-- contributors ma", "end": 722, "score": 0.7530426383018494, "start": 718, "tag": "NAME", "value": "znik" } ]
.build/ada/asis-gela-elements-pathes.ads
faelys/gela-asis
4
------------------------------------------------------------------------------ -- 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. ------------------------------------------------------------------------------ package Asis.Gela.Elements.Pathes is ------------------ -- If_Path_Node -- ------------------ type If_Path_Node is new Path_Node with private; type If_Path_Ptr is access all If_Path_Node; for If_Path_Ptr'Storage_Pool use Lists.Pool; function New_If_Path_Node (The_Context : ASIS.Context) return If_Path_Ptr; function Condition_Expression (Element : If_Path_Node) return Asis.Expression; procedure Set_Condition_Expression (Element : in out If_Path_Node; Value : in Asis.Expression); function Path_Kind (Element : If_Path_Node) return Asis.Path_Kinds; function Children (Element : access If_Path_Node) return Traverse_List; function Clone (Element : If_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access If_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); --------------------- -- Elsif_Path_Node -- --------------------- type Elsif_Path_Node is new If_Path_Node with private; type Elsif_Path_Ptr is access all Elsif_Path_Node; for Elsif_Path_Ptr'Storage_Pool use Lists.Pool; function New_Elsif_Path_Node (The_Context : ASIS.Context) return Elsif_Path_Ptr; function Path_Kind (Element : Elsif_Path_Node) return Asis.Path_Kinds; function Clone (Element : Elsif_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Elsif_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------- -- Else_Path_Node -- -------------------- type Else_Path_Node is new Path_Node with private; type Else_Path_Ptr is access all Else_Path_Node; for Else_Path_Ptr'Storage_Pool use Lists.Pool; function New_Else_Path_Node (The_Context : ASIS.Context) return Else_Path_Ptr; function Path_Kind (Element : Else_Path_Node) return Asis.Path_Kinds; function Clone (Element : Else_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Else_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------- -- Case_Path_Node -- -------------------- type Case_Path_Node is new Path_Node with private; type Case_Path_Ptr is access all Case_Path_Node; for Case_Path_Ptr'Storage_Pool use Lists.Pool; function New_Case_Path_Node (The_Context : ASIS.Context) return Case_Path_Ptr; function Case_Statement_Alternative_Choices (Element : Case_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Case_Statement_Alternative_Choices (Element : in out Case_Path_Node; Value : in Asis.Element); function Case_Statement_Alternative_Choices_List (Element : Case_Path_Node) return Asis.Element; function Pragmas (Element : Case_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Pragmas (Element : in out Case_Path_Node; Value : in Asis.Element); function Pragmas_List (Element : Case_Path_Node) return Asis.Element; function Path_Kind (Element : Case_Path_Node) return Asis.Path_Kinds; function Children (Element : access Case_Path_Node) return Traverse_List; function Clone (Element : Case_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Case_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); ---------------------- -- Select_Path_Node -- ---------------------- type Select_Path_Node is new Path_Node with private; type Select_Path_Ptr is access all Select_Path_Node; for Select_Path_Ptr'Storage_Pool use Lists.Pool; function New_Select_Path_Node (The_Context : ASIS.Context) return Select_Path_Ptr; function Guard (Element : Select_Path_Node) return Asis.Expression; procedure Set_Guard (Element : in out Select_Path_Node; Value : in Asis.Expression); function Pragmas (Element : Select_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Pragmas (Element : in out Select_Path_Node; Value : in Asis.Element); function Pragmas_List (Element : Select_Path_Node) return Asis.Element; function Path_Kind (Element : Select_Path_Node) return Asis.Path_Kinds; function Children (Element : access Select_Path_Node) return Traverse_List; function Clone (Element : Select_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Select_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); ------------------ -- Or_Path_Node -- ------------------ type Or_Path_Node is new Select_Path_Node with private; type Or_Path_Ptr is access all Or_Path_Node; for Or_Path_Ptr'Storage_Pool use Lists.Pool; function New_Or_Path_Node (The_Context : ASIS.Context) return Or_Path_Ptr; function Path_Kind (Element : Or_Path_Node) return Asis.Path_Kinds; function Clone (Element : Or_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Or_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------------- -- Then_Abort_Path_Node -- -------------------------- type Then_Abort_Path_Node is new Path_Node with private; type Then_Abort_Path_Ptr is access all Then_Abort_Path_Node; for Then_Abort_Path_Ptr'Storage_Pool use Lists.Pool; function New_Then_Abort_Path_Node (The_Context : ASIS.Context) return Then_Abort_Path_Ptr; function Path_Kind (Element : Then_Abort_Path_Node) return Asis.Path_Kinds; function Clone (Element : Then_Abort_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Then_Abort_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); private type If_Path_Node is new Path_Node with record Condition_Expression : aliased Asis.Expression; end record; type Elsif_Path_Node is new If_Path_Node with record null; end record; type Else_Path_Node is new Path_Node with record null; end record; type Case_Path_Node is new Path_Node with record Case_Statement_Alternative_Choices : aliased Primary_Choise_Lists.List; Pragmas : aliased Primary_Pragma_Lists.List; end record; type Select_Path_Node is new Path_Node with record Guard : aliased Asis.Expression; Pragmas : aliased Primary_Pragma_Lists.List; end record; type Or_Path_Node is new Select_Path_Node with record null; end record; type Then_Abort_Path_Node is new Path_Node with record null; end record; end Asis.Gela.Elements.Pathes;
14458
------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- 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 <NAME> Re<NAME>, 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. ------------------------------------------------------------------------------ package Asis.Gela.Elements.Pathes is ------------------ -- If_Path_Node -- ------------------ type If_Path_Node is new Path_Node with private; type If_Path_Ptr is access all If_Path_Node; for If_Path_Ptr'Storage_Pool use Lists.Pool; function New_If_Path_Node (The_Context : ASIS.Context) return If_Path_Ptr; function Condition_Expression (Element : If_Path_Node) return Asis.Expression; procedure Set_Condition_Expression (Element : in out If_Path_Node; Value : in Asis.Expression); function Path_Kind (Element : If_Path_Node) return Asis.Path_Kinds; function Children (Element : access If_Path_Node) return Traverse_List; function Clone (Element : If_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access If_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); --------------------- -- Elsif_Path_Node -- --------------------- type Elsif_Path_Node is new If_Path_Node with private; type Elsif_Path_Ptr is access all Elsif_Path_Node; for Elsif_Path_Ptr'Storage_Pool use Lists.Pool; function New_Elsif_Path_Node (The_Context : ASIS.Context) return Elsif_Path_Ptr; function Path_Kind (Element : Elsif_Path_Node) return Asis.Path_Kinds; function Clone (Element : Elsif_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Elsif_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------- -- Else_Path_Node -- -------------------- type Else_Path_Node is new Path_Node with private; type Else_Path_Ptr is access all Else_Path_Node; for Else_Path_Ptr'Storage_Pool use Lists.Pool; function New_Else_Path_Node (The_Context : ASIS.Context) return Else_Path_Ptr; function Path_Kind (Element : Else_Path_Node) return Asis.Path_Kinds; function Clone (Element : Else_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Else_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------- -- Case_Path_Node -- -------------------- type Case_Path_Node is new Path_Node with private; type Case_Path_Ptr is access all Case_Path_Node; for Case_Path_Ptr'Storage_Pool use Lists.Pool; function New_Case_Path_Node (The_Context : ASIS.Context) return Case_Path_Ptr; function Case_Statement_Alternative_Choices (Element : Case_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Case_Statement_Alternative_Choices (Element : in out Case_Path_Node; Value : in Asis.Element); function Case_Statement_Alternative_Choices_List (Element : Case_Path_Node) return Asis.Element; function Pragmas (Element : Case_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Pragmas (Element : in out Case_Path_Node; Value : in Asis.Element); function Pragmas_List (Element : Case_Path_Node) return Asis.Element; function Path_Kind (Element : Case_Path_Node) return Asis.Path_Kinds; function Children (Element : access Case_Path_Node) return Traverse_List; function Clone (Element : Case_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Case_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); ---------------------- -- Select_Path_Node -- ---------------------- type Select_Path_Node is new Path_Node with private; type Select_Path_Ptr is access all Select_Path_Node; for Select_Path_Ptr'Storage_Pool use Lists.Pool; function New_Select_Path_Node (The_Context : ASIS.Context) return Select_Path_Ptr; function Guard (Element : Select_Path_Node) return Asis.Expression; procedure Set_Guard (Element : in out Select_Path_Node; Value : in Asis.Expression); function Pragmas (Element : Select_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Pragmas (Element : in out Select_Path_Node; Value : in Asis.Element); function Pragmas_List (Element : Select_Path_Node) return Asis.Element; function Path_Kind (Element : Select_Path_Node) return Asis.Path_Kinds; function Children (Element : access Select_Path_Node) return Traverse_List; function Clone (Element : Select_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Select_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); ------------------ -- Or_Path_Node -- ------------------ type Or_Path_Node is new Select_Path_Node with private; type Or_Path_Ptr is access all Or_Path_Node; for Or_Path_Ptr'Storage_Pool use Lists.Pool; function New_Or_Path_Node (The_Context : ASIS.Context) return Or_Path_Ptr; function Path_Kind (Element : Or_Path_Node) return Asis.Path_Kinds; function Clone (Element : Or_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Or_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------------- -- Then_Abort_Path_Node -- -------------------------- type Then_Abort_Path_Node is new Path_Node with private; type Then_Abort_Path_Ptr is access all Then_Abort_Path_Node; for Then_Abort_Path_Ptr'Storage_Pool use Lists.Pool; function New_Then_Abort_Path_Node (The_Context : ASIS.Context) return Then_Abort_Path_Ptr; function Path_Kind (Element : Then_Abort_Path_Node) return Asis.Path_Kinds; function Clone (Element : Then_Abort_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Then_Abort_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); private type If_Path_Node is new Path_Node with record Condition_Expression : aliased Asis.Expression; end record; type Elsif_Path_Node is new If_Path_Node with record null; end record; type Else_Path_Node is new Path_Node with record null; end record; type Case_Path_Node is new Path_Node with record Case_Statement_Alternative_Choices : aliased Primary_Choise_Lists.List; Pragmas : aliased Primary_Pragma_Lists.List; end record; type Select_Path_Node is new Path_Node with record Guard : aliased Asis.Expression; Pragmas : aliased Primary_Pragma_Lists.List; end record; type Or_Path_Node is new Select_Path_Node with record null; end record; type Then_Abort_Path_Node is new Path_Node with record null; end record; end Asis.Gela.Elements.Pathes;
true
------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, PI:NAME:<NAME>END_PI -- 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 PI:NAME:<NAME>END_PI RePI:NAME:<NAME>END_PI, 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. ------------------------------------------------------------------------------ package Asis.Gela.Elements.Pathes is ------------------ -- If_Path_Node -- ------------------ type If_Path_Node is new Path_Node with private; type If_Path_Ptr is access all If_Path_Node; for If_Path_Ptr'Storage_Pool use Lists.Pool; function New_If_Path_Node (The_Context : ASIS.Context) return If_Path_Ptr; function Condition_Expression (Element : If_Path_Node) return Asis.Expression; procedure Set_Condition_Expression (Element : in out If_Path_Node; Value : in Asis.Expression); function Path_Kind (Element : If_Path_Node) return Asis.Path_Kinds; function Children (Element : access If_Path_Node) return Traverse_List; function Clone (Element : If_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access If_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); --------------------- -- Elsif_Path_Node -- --------------------- type Elsif_Path_Node is new If_Path_Node with private; type Elsif_Path_Ptr is access all Elsif_Path_Node; for Elsif_Path_Ptr'Storage_Pool use Lists.Pool; function New_Elsif_Path_Node (The_Context : ASIS.Context) return Elsif_Path_Ptr; function Path_Kind (Element : Elsif_Path_Node) return Asis.Path_Kinds; function Clone (Element : Elsif_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Elsif_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------- -- Else_Path_Node -- -------------------- type Else_Path_Node is new Path_Node with private; type Else_Path_Ptr is access all Else_Path_Node; for Else_Path_Ptr'Storage_Pool use Lists.Pool; function New_Else_Path_Node (The_Context : ASIS.Context) return Else_Path_Ptr; function Path_Kind (Element : Else_Path_Node) return Asis.Path_Kinds; function Clone (Element : Else_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Else_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------- -- Case_Path_Node -- -------------------- type Case_Path_Node is new Path_Node with private; type Case_Path_Ptr is access all Case_Path_Node; for Case_Path_Ptr'Storage_Pool use Lists.Pool; function New_Case_Path_Node (The_Context : ASIS.Context) return Case_Path_Ptr; function Case_Statement_Alternative_Choices (Element : Case_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Case_Statement_Alternative_Choices (Element : in out Case_Path_Node; Value : in Asis.Element); function Case_Statement_Alternative_Choices_List (Element : Case_Path_Node) return Asis.Element; function Pragmas (Element : Case_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Pragmas (Element : in out Case_Path_Node; Value : in Asis.Element); function Pragmas_List (Element : Case_Path_Node) return Asis.Element; function Path_Kind (Element : Case_Path_Node) return Asis.Path_Kinds; function Children (Element : access Case_Path_Node) return Traverse_List; function Clone (Element : Case_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Case_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); ---------------------- -- Select_Path_Node -- ---------------------- type Select_Path_Node is new Path_Node with private; type Select_Path_Ptr is access all Select_Path_Node; for Select_Path_Ptr'Storage_Pool use Lists.Pool; function New_Select_Path_Node (The_Context : ASIS.Context) return Select_Path_Ptr; function Guard (Element : Select_Path_Node) return Asis.Expression; procedure Set_Guard (Element : in out Select_Path_Node; Value : in Asis.Expression); function Pragmas (Element : Select_Path_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; procedure Set_Pragmas (Element : in out Select_Path_Node; Value : in Asis.Element); function Pragmas_List (Element : Select_Path_Node) return Asis.Element; function Path_Kind (Element : Select_Path_Node) return Asis.Path_Kinds; function Children (Element : access Select_Path_Node) return Traverse_List; function Clone (Element : Select_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Select_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); ------------------ -- Or_Path_Node -- ------------------ type Or_Path_Node is new Select_Path_Node with private; type Or_Path_Ptr is access all Or_Path_Node; for Or_Path_Ptr'Storage_Pool use Lists.Pool; function New_Or_Path_Node (The_Context : ASIS.Context) return Or_Path_Ptr; function Path_Kind (Element : Or_Path_Node) return Asis.Path_Kinds; function Clone (Element : Or_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Or_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); -------------------------- -- Then_Abort_Path_Node -- -------------------------- type Then_Abort_Path_Node is new Path_Node with private; type Then_Abort_Path_Ptr is access all Then_Abort_Path_Node; for Then_Abort_Path_Ptr'Storage_Pool use Lists.Pool; function New_Then_Abort_Path_Node (The_Context : ASIS.Context) return Then_Abort_Path_Ptr; function Path_Kind (Element : Then_Abort_Path_Node) return Asis.Path_Kinds; function Clone (Element : Then_Abort_Path_Node; Parent : Asis.Element) return Asis.Element; procedure Copy (Source : in Asis.Element; Target : access Then_Abort_Path_Node; Cloner : in Cloner_Class; Parent : in Asis.Element); private type If_Path_Node is new Path_Node with record Condition_Expression : aliased Asis.Expression; end record; type Elsif_Path_Node is new If_Path_Node with record null; end record; type Else_Path_Node is new Path_Node with record null; end record; type Case_Path_Node is new Path_Node with record Case_Statement_Alternative_Choices : aliased Primary_Choise_Lists.List; Pragmas : aliased Primary_Pragma_Lists.List; end record; type Select_Path_Node is new Path_Node with record Guard : aliased Asis.Expression; Pragmas : aliased Primary_Pragma_Lists.List; end record; type Or_Path_Node is new Select_Path_Node with record null; end record; type Then_Abort_Path_Node is new Path_Node with record null; end record; end Asis.Gela.Elements.Pathes;
[ { "context": "--\n-- Copyright 2018 The wookey project team <[email protected]>\n-- - Ryad Benadjila\n-- - Arnauld Michel", "end": 64, "score": 0.9999319314956665, "start": 46, "tag": "EMAIL", "value": "[email protected]" }, { "context": "he wookey project team <[email protected]>\n-- - Ryad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard", "end": 91, "score": 0.9989519715309143, "start": 73, "tag": "NAME", "value": "Ryad Benadjila" }, { "context": "[email protected]>\n-- - Ryad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n--", "end": 118, "score": 0.9914314150810242, "start": 99, "tag": "NAME", "value": "Arnauld Michelizza" }, { "context": "ad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet", "end": 141, "score": 0.9352777600288391, "start": 126, "tag": "NAME", "value": "Mathieu Renard" }, { "context": " Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet\n--\n-- Licensed under th", "end": 165, "score": 0.999828040599823, "start": 149, "tag": "NAME", "value": "Philippe Thierry" }, { "context": " - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet\n--\n-- Licensed under the Apache License, Version ", "end": 191, "score": 0.9998628497123718, "start": 173, "tag": "NAME", "value": "Philippe Trebuchet" } ]
src/Ada/ewok-softirq.adb
wookey-project/ewok-legacy
0
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the 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 ewok.syscalls; use ewok.syscalls; with ewok.tasks; use ewok.tasks; with ewok.debug; with ewok.devices; with ewok.exported.interrupts; use type ewok.exported.interrupts.t_interrupt_config_access; with ewok.interrupts; with ewok.layout; with ewok.sched; with ewok.syscalls.init; with ewok.syscalls.cfg; with ewok.syscalls.gettick; with ewok.syscalls.ipc; with ewok.syscalls.lock; with ewok.syscalls.log; with ewok.syscalls.reset; with ewok.syscalls.sleep; with ewok.syscalls.yield; with ewok.syscalls.rng; with soc.interrupts; use type soc.interrupts.t_interrupt; with soc.nvic; with m4.cpu; with m4.cpu.instructions; #if CONFIG_DBGLEVEL >= 7 with types.c; use types.c; #end if; package body ewok.softirq with spark_mode => off is package TSK renames ewok.tasks; procedure init is begin p_isr_requests.init (isr_queue); p_syscall_requests.init (syscall_queue); pragma DEBUG (debug.log (debug.INFO, "SOFTIRQ initialized")); end init; procedure push_isr (task_id : in ewok.tasks_shared.t_task_id; params : in t_isr_parameters) is req : constant t_isr_request := (task_id, WAITING, params); ok : boolean; begin p_isr_requests.write (isr_queue, req, ok); if not ok then debug.panic ("push_isr() failed."); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); end push_isr; procedure push_syscall (task_id : in ewok.tasks_shared.t_task_id) is req : constant t_syscall_request := (task_id, WAITING); ok : boolean; begin p_syscall_requests.write (syscall_queue, req, ok); if not ok then debug.panic ("push_syscall() failed."); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); end push_syscall; procedure syscall_handler (req : in t_syscall_request) is type t_syscall_parameters_access is access all t_syscall_parameters; function to_syscall_parameters_access is new ada.unchecked_conversion (system_address, t_syscall_parameters_access); svc : t_svc_type; params_a : t_syscall_parameters_access; begin -- -- Getting the svc number from the SVC instruction -- declare PC : constant system_address := TSK.tasks_list(req.caller_id).ctx.frame_a.all.PC; inst : m4.cpu.instructions.t_svc_instruction with import, address => to_address (PC - 2); begin if not inst.opcode'valid then raise program_error; end if; declare svc_type : t_svc_type with address => inst.svc_num'address; val : unsigned_8 with address => inst.svc_num'address; begin if not svc_type'valid then pragma DEBUG (debug.log (debug.ERROR, "Invalid SVC: " & unsigned_8'image (val))); ewok.tasks.set_state (req.caller_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT); set_return_value (req.caller_id, TSK.tasks_list(req.caller_id).mode, SYS_E_DENIED); return; end if; svc := svc_type; end; end; -- -- Getting syscall parameters -- params_a := to_syscall_parameters_access (TSK.tasks_list(req.caller_id).ctx.frame_a.all.R0); if params_a = NULL then pragma DEBUG (debug.log (debug.ERROR, ewok.tasks.tasks_list(req.caller_id).name & ": syscall with no parameters")); return; end if; if not params_a.all.syscall_type'valid then pragma DEBUG (debug.log (debug.ERROR, ewok.tasks.tasks_list(req.caller_id).name & ": unknown syscall " & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type))); return; end if; -- -- Logging -- #if CONFIG_DBGLEVEL >= 7 declare len : constant natural := types.c.len (TSK.tasks_list(req.caller_id).name.all); name : string (1 .. len); begin to_ada (name, TSK.tasks_list(req.caller_id).name.all); debug.log (debug.INFO, name & ": svc" & ewok.syscalls.t_svc_type'image (svc) & ", syscall" & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type)); end; #end if; -- -- Calling the handler -- if svc /= SVC_SYSCALL then debug.panic ("syscall_handler(): wrong SVC" & ewok.syscalls.t_svc_type'image (svc)); end if; case params_a.all.syscall_type is when SYS_LOG => ewok.syscalls.log.sys_log (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_YIELD => ewok.syscalls.yield.sys_yield (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_INIT => ewok.syscalls.init.sys_init (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_IPC => ewok.syscalls.ipc.sys_ipc (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_CFG => ewok.syscalls.cfg.sys_cfg (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_GETTICK => ewok.syscalls.gettick.sys_gettick (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_RESET => ewok.syscalls.reset.sys_reset (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_SLEEP => ewok.syscalls.sleep.sys_sleep (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_LOCK => ewok.syscalls.lock.sys_lock (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_GET_RANDOM => ewok.syscalls.rng.sys_get_random (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); end case; end syscall_handler; procedure isr_handler (req : in t_isr_request) is params : t_parameters; config_a : ewok.exported.interrupts.t_interrupt_config_access; begin -- For further MPU mapping of the device, we need to know which device -- triggered that interrupt. -- Note -- - EXTIs are not associated to any device because they can be -- associated to several GPIO pins -- - DMAs are not considered as devices because a single controller -- can be used by several drivers. DMA streams are registered in a -- specific table TSK.tasks_list(req.caller_id).isr_ctx.device_id := ewok.interrupts.get_device_from_interrupt (req.params.interrupt); -- Keep track of some hint about scheduling policy to apply after the end -- of the ISR execution -- Note - see above config_a := ewok.devices.get_interrupt_config_from_interrupt (req.params.interrupt); if config_a /= NULL then TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := config_a.all.mode; else TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := ISR_STANDARD; end if; -- Zeroing the ISR stack if the ISR previously executed belongs to -- another task if previous_isr_owner /= req.caller_id then declare stack : byte_array(1 .. ewok.layout.STACK_SIZE_TASK_ISR) with address => to_address (ewok.layout.STACK_BOTTOM_TASK_ISR); begin stack := (others => 0); end; previous_isr_owner := req.caller_id; end if; -- -- Note - isr_ctx.entry_point is a wrapper. The real ISR entry -- point is defined in params(0) -- -- User defined ISR handler params(0) := req.params.handler; -- IRQ params(1) := unsigned_32'val (soc.nvic.to_irq_number (req.params.interrupt)); -- Status and data returned by the 'posthook' treatement -- (cf. ewok.posthook.exec) params(2) := req.params.posthook_status; params(3) := req.params.posthook_data; create_stack (ewok.layout.STACK_TOP_TASK_ISR, TSK.tasks_list(req.caller_id).isr_ctx.entry_point, -- Wrapper params, TSK.tasks_list(req.caller_id).isr_ctx.frame_a); ewok.tasks.set_mode (req.caller_id, TASK_MODE_ISRTHREAD); ewok.tasks.set_state (req.caller_id, TASK_MODE_ISRTHREAD, TASK_STATE_RUNNABLE); end isr_handler; procedure main_task is isr_req : t_isr_request; sys_req : t_syscall_request; ok : boolean; begin loop -- -- User ISRs -- loop m4.cpu.disable_irq; p_isr_requests.read (isr_queue, isr_req, ok); m4.cpu.enable_irq; exit when not ok; if isr_req.state = WAITING then if TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_LOCKED and TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_SLEEPING_DEEP then m4.cpu.disable_irq; isr_handler (isr_req); isr_req.state := DONE; ewok.sched.request_schedule; m4.cpu.enable_irq; m4.cpu.instructions.full_memory_barrier; else m4.cpu.disable_irq; p_isr_requests.write (isr_queue, isr_req, ok); if not ok then debug.panic ("SOFTIRQ failed to add ISR request"); end if; ewok.sched.request_schedule; m4.cpu.enable_irq; m4.cpu.instructions.full_memory_barrier; end if; else raise program_error; end if; end loop; -- -- Syscalls -- loop m4.cpu.disable_irq; p_syscall_requests.read (syscall_queue, sys_req, ok); m4.cpu.enable_irq; exit when not ok; if sys_req.state = WAITING then syscall_handler (sys_req); sys_req.state := DONE; else raise program_error; end if; end loop; -- -- Set softirq task as IDLE if there is no more request to handle -- m4.cpu.disable_irq; if p_isr_requests.state (isr_queue) = p_isr_requests.EMPTY and p_syscall_requests.state (syscall_queue) = p_syscall_requests.EMPTY then ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_IDLE); m4.cpu.instructions.full_memory_barrier; ewok.sched.request_schedule; end if; m4.cpu.enable_irq; end loop; end main_task; end ewok.softirq;
27659
-- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- 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 ewok.syscalls; use ewok.syscalls; with ewok.tasks; use ewok.tasks; with ewok.debug; with ewok.devices; with ewok.exported.interrupts; use type ewok.exported.interrupts.t_interrupt_config_access; with ewok.interrupts; with ewok.layout; with ewok.sched; with ewok.syscalls.init; with ewok.syscalls.cfg; with ewok.syscalls.gettick; with ewok.syscalls.ipc; with ewok.syscalls.lock; with ewok.syscalls.log; with ewok.syscalls.reset; with ewok.syscalls.sleep; with ewok.syscalls.yield; with ewok.syscalls.rng; with soc.interrupts; use type soc.interrupts.t_interrupt; with soc.nvic; with m4.cpu; with m4.cpu.instructions; #if CONFIG_DBGLEVEL >= 7 with types.c; use types.c; #end if; package body ewok.softirq with spark_mode => off is package TSK renames ewok.tasks; procedure init is begin p_isr_requests.init (isr_queue); p_syscall_requests.init (syscall_queue); pragma DEBUG (debug.log (debug.INFO, "SOFTIRQ initialized")); end init; procedure push_isr (task_id : in ewok.tasks_shared.t_task_id; params : in t_isr_parameters) is req : constant t_isr_request := (task_id, WAITING, params); ok : boolean; begin p_isr_requests.write (isr_queue, req, ok); if not ok then debug.panic ("push_isr() failed."); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); end push_isr; procedure push_syscall (task_id : in ewok.tasks_shared.t_task_id) is req : constant t_syscall_request := (task_id, WAITING); ok : boolean; begin p_syscall_requests.write (syscall_queue, req, ok); if not ok then debug.panic ("push_syscall() failed."); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); end push_syscall; procedure syscall_handler (req : in t_syscall_request) is type t_syscall_parameters_access is access all t_syscall_parameters; function to_syscall_parameters_access is new ada.unchecked_conversion (system_address, t_syscall_parameters_access); svc : t_svc_type; params_a : t_syscall_parameters_access; begin -- -- Getting the svc number from the SVC instruction -- declare PC : constant system_address := TSK.tasks_list(req.caller_id).ctx.frame_a.all.PC; inst : m4.cpu.instructions.t_svc_instruction with import, address => to_address (PC - 2); begin if not inst.opcode'valid then raise program_error; end if; declare svc_type : t_svc_type with address => inst.svc_num'address; val : unsigned_8 with address => inst.svc_num'address; begin if not svc_type'valid then pragma DEBUG (debug.log (debug.ERROR, "Invalid SVC: " & unsigned_8'image (val))); ewok.tasks.set_state (req.caller_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT); set_return_value (req.caller_id, TSK.tasks_list(req.caller_id).mode, SYS_E_DENIED); return; end if; svc := svc_type; end; end; -- -- Getting syscall parameters -- params_a := to_syscall_parameters_access (TSK.tasks_list(req.caller_id).ctx.frame_a.all.R0); if params_a = NULL then pragma DEBUG (debug.log (debug.ERROR, ewok.tasks.tasks_list(req.caller_id).name & ": syscall with no parameters")); return; end if; if not params_a.all.syscall_type'valid then pragma DEBUG (debug.log (debug.ERROR, ewok.tasks.tasks_list(req.caller_id).name & ": unknown syscall " & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type))); return; end if; -- -- Logging -- #if CONFIG_DBGLEVEL >= 7 declare len : constant natural := types.c.len (TSK.tasks_list(req.caller_id).name.all); name : string (1 .. len); begin to_ada (name, TSK.tasks_list(req.caller_id).name.all); debug.log (debug.INFO, name & ": svc" & ewok.syscalls.t_svc_type'image (svc) & ", syscall" & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type)); end; #end if; -- -- Calling the handler -- if svc /= SVC_SYSCALL then debug.panic ("syscall_handler(): wrong SVC" & ewok.syscalls.t_svc_type'image (svc)); end if; case params_a.all.syscall_type is when SYS_LOG => ewok.syscalls.log.sys_log (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_YIELD => ewok.syscalls.yield.sys_yield (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_INIT => ewok.syscalls.init.sys_init (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_IPC => ewok.syscalls.ipc.sys_ipc (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_CFG => ewok.syscalls.cfg.sys_cfg (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_GETTICK => ewok.syscalls.gettick.sys_gettick (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_RESET => ewok.syscalls.reset.sys_reset (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_SLEEP => ewok.syscalls.sleep.sys_sleep (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_LOCK => ewok.syscalls.lock.sys_lock (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_GET_RANDOM => ewok.syscalls.rng.sys_get_random (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); end case; end syscall_handler; procedure isr_handler (req : in t_isr_request) is params : t_parameters; config_a : ewok.exported.interrupts.t_interrupt_config_access; begin -- For further MPU mapping of the device, we need to know which device -- triggered that interrupt. -- Note -- - EXTIs are not associated to any device because they can be -- associated to several GPIO pins -- - DMAs are not considered as devices because a single controller -- can be used by several drivers. DMA streams are registered in a -- specific table TSK.tasks_list(req.caller_id).isr_ctx.device_id := ewok.interrupts.get_device_from_interrupt (req.params.interrupt); -- Keep track of some hint about scheduling policy to apply after the end -- of the ISR execution -- Note - see above config_a := ewok.devices.get_interrupt_config_from_interrupt (req.params.interrupt); if config_a /= NULL then TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := config_a.all.mode; else TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := ISR_STANDARD; end if; -- Zeroing the ISR stack if the ISR previously executed belongs to -- another task if previous_isr_owner /= req.caller_id then declare stack : byte_array(1 .. ewok.layout.STACK_SIZE_TASK_ISR) with address => to_address (ewok.layout.STACK_BOTTOM_TASK_ISR); begin stack := (others => 0); end; previous_isr_owner := req.caller_id; end if; -- -- Note - isr_ctx.entry_point is a wrapper. The real ISR entry -- point is defined in params(0) -- -- User defined ISR handler params(0) := req.params.handler; -- IRQ params(1) := unsigned_32'val (soc.nvic.to_irq_number (req.params.interrupt)); -- Status and data returned by the 'posthook' treatement -- (cf. ewok.posthook.exec) params(2) := req.params.posthook_status; params(3) := req.params.posthook_data; create_stack (ewok.layout.STACK_TOP_TASK_ISR, TSK.tasks_list(req.caller_id).isr_ctx.entry_point, -- Wrapper params, TSK.tasks_list(req.caller_id).isr_ctx.frame_a); ewok.tasks.set_mode (req.caller_id, TASK_MODE_ISRTHREAD); ewok.tasks.set_state (req.caller_id, TASK_MODE_ISRTHREAD, TASK_STATE_RUNNABLE); end isr_handler; procedure main_task is isr_req : t_isr_request; sys_req : t_syscall_request; ok : boolean; begin loop -- -- User ISRs -- loop m4.cpu.disable_irq; p_isr_requests.read (isr_queue, isr_req, ok); m4.cpu.enable_irq; exit when not ok; if isr_req.state = WAITING then if TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_LOCKED and TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_SLEEPING_DEEP then m4.cpu.disable_irq; isr_handler (isr_req); isr_req.state := DONE; ewok.sched.request_schedule; m4.cpu.enable_irq; m4.cpu.instructions.full_memory_barrier; else m4.cpu.disable_irq; p_isr_requests.write (isr_queue, isr_req, ok); if not ok then debug.panic ("SOFTIRQ failed to add ISR request"); end if; ewok.sched.request_schedule; m4.cpu.enable_irq; m4.cpu.instructions.full_memory_barrier; end if; else raise program_error; end if; end loop; -- -- Syscalls -- loop m4.cpu.disable_irq; p_syscall_requests.read (syscall_queue, sys_req, ok); m4.cpu.enable_irq; exit when not ok; if sys_req.state = WAITING then syscall_handler (sys_req); sys_req.state := DONE; else raise program_error; end if; end loop; -- -- Set softirq task as IDLE if there is no more request to handle -- m4.cpu.disable_irq; if p_isr_requests.state (isr_queue) = p_isr_requests.EMPTY and p_syscall_requests.state (syscall_queue) = p_syscall_requests.EMPTY then ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_IDLE); m4.cpu.instructions.full_memory_barrier; ewok.sched.request_schedule; end if; m4.cpu.enable_irq; end loop; end main_task; end ewok.softirq;
true
-- -- Copyright 2018 The wookey project team <PI:EMAIL:<EMAIL>END_PI> -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- -- 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 ewok.syscalls; use ewok.syscalls; with ewok.tasks; use ewok.tasks; with ewok.debug; with ewok.devices; with ewok.exported.interrupts; use type ewok.exported.interrupts.t_interrupt_config_access; with ewok.interrupts; with ewok.layout; with ewok.sched; with ewok.syscalls.init; with ewok.syscalls.cfg; with ewok.syscalls.gettick; with ewok.syscalls.ipc; with ewok.syscalls.lock; with ewok.syscalls.log; with ewok.syscalls.reset; with ewok.syscalls.sleep; with ewok.syscalls.yield; with ewok.syscalls.rng; with soc.interrupts; use type soc.interrupts.t_interrupt; with soc.nvic; with m4.cpu; with m4.cpu.instructions; #if CONFIG_DBGLEVEL >= 7 with types.c; use types.c; #end if; package body ewok.softirq with spark_mode => off is package TSK renames ewok.tasks; procedure init is begin p_isr_requests.init (isr_queue); p_syscall_requests.init (syscall_queue); pragma DEBUG (debug.log (debug.INFO, "SOFTIRQ initialized")); end init; procedure push_isr (task_id : in ewok.tasks_shared.t_task_id; params : in t_isr_parameters) is req : constant t_isr_request := (task_id, WAITING, params); ok : boolean; begin p_isr_requests.write (isr_queue, req, ok); if not ok then debug.panic ("push_isr() failed."); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); end push_isr; procedure push_syscall (task_id : in ewok.tasks_shared.t_task_id) is req : constant t_syscall_request := (task_id, WAITING); ok : boolean; begin p_syscall_requests.write (syscall_queue, req, ok); if not ok then debug.panic ("push_syscall() failed."); end if; ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_RUNNABLE); end push_syscall; procedure syscall_handler (req : in t_syscall_request) is type t_syscall_parameters_access is access all t_syscall_parameters; function to_syscall_parameters_access is new ada.unchecked_conversion (system_address, t_syscall_parameters_access); svc : t_svc_type; params_a : t_syscall_parameters_access; begin -- -- Getting the svc number from the SVC instruction -- declare PC : constant system_address := TSK.tasks_list(req.caller_id).ctx.frame_a.all.PC; inst : m4.cpu.instructions.t_svc_instruction with import, address => to_address (PC - 2); begin if not inst.opcode'valid then raise program_error; end if; declare svc_type : t_svc_type with address => inst.svc_num'address; val : unsigned_8 with address => inst.svc_num'address; begin if not svc_type'valid then pragma DEBUG (debug.log (debug.ERROR, "Invalid SVC: " & unsigned_8'image (val))); ewok.tasks.set_state (req.caller_id, TASK_MODE_MAINTHREAD, TASK_STATE_FAULT); set_return_value (req.caller_id, TSK.tasks_list(req.caller_id).mode, SYS_E_DENIED); return; end if; svc := svc_type; end; end; -- -- Getting syscall parameters -- params_a := to_syscall_parameters_access (TSK.tasks_list(req.caller_id).ctx.frame_a.all.R0); if params_a = NULL then pragma DEBUG (debug.log (debug.ERROR, ewok.tasks.tasks_list(req.caller_id).name & ": syscall with no parameters")); return; end if; if not params_a.all.syscall_type'valid then pragma DEBUG (debug.log (debug.ERROR, ewok.tasks.tasks_list(req.caller_id).name & ": unknown syscall " & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type))); return; end if; -- -- Logging -- #if CONFIG_DBGLEVEL >= 7 declare len : constant natural := types.c.len (TSK.tasks_list(req.caller_id).name.all); name : string (1 .. len); begin to_ada (name, TSK.tasks_list(req.caller_id).name.all); debug.log (debug.INFO, name & ": svc" & ewok.syscalls.t_svc_type'image (svc) & ", syscall" & ewok.syscalls.t_syscall_type'image (params_a.all.syscall_type)); end; #end if; -- -- Calling the handler -- if svc /= SVC_SYSCALL then debug.panic ("syscall_handler(): wrong SVC" & ewok.syscalls.t_svc_type'image (svc)); end if; case params_a.all.syscall_type is when SYS_LOG => ewok.syscalls.log.sys_log (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_YIELD => ewok.syscalls.yield.sys_yield (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_INIT => ewok.syscalls.init.sys_init (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_IPC => ewok.syscalls.ipc.sys_ipc (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_CFG => ewok.syscalls.cfg.sys_cfg (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_GETTICK => ewok.syscalls.gettick.sys_gettick (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_RESET => ewok.syscalls.reset.sys_reset (req.caller_id, TASK_MODE_MAINTHREAD); when SYS_SLEEP => ewok.syscalls.sleep.sys_sleep (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_LOCK => ewok.syscalls.lock.sys_lock (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); when SYS_GET_RANDOM => ewok.syscalls.rng.sys_get_random (req.caller_id, params_a.all.args, TASK_MODE_MAINTHREAD); end case; end syscall_handler; procedure isr_handler (req : in t_isr_request) is params : t_parameters; config_a : ewok.exported.interrupts.t_interrupt_config_access; begin -- For further MPU mapping of the device, we need to know which device -- triggered that interrupt. -- Note -- - EXTIs are not associated to any device because they can be -- associated to several GPIO pins -- - DMAs are not considered as devices because a single controller -- can be used by several drivers. DMA streams are registered in a -- specific table TSK.tasks_list(req.caller_id).isr_ctx.device_id := ewok.interrupts.get_device_from_interrupt (req.params.interrupt); -- Keep track of some hint about scheduling policy to apply after the end -- of the ISR execution -- Note - see above config_a := ewok.devices.get_interrupt_config_from_interrupt (req.params.interrupt); if config_a /= NULL then TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := config_a.all.mode; else TSK.tasks_list(req.caller_id).isr_ctx.sched_policy := ISR_STANDARD; end if; -- Zeroing the ISR stack if the ISR previously executed belongs to -- another task if previous_isr_owner /= req.caller_id then declare stack : byte_array(1 .. ewok.layout.STACK_SIZE_TASK_ISR) with address => to_address (ewok.layout.STACK_BOTTOM_TASK_ISR); begin stack := (others => 0); end; previous_isr_owner := req.caller_id; end if; -- -- Note - isr_ctx.entry_point is a wrapper. The real ISR entry -- point is defined in params(0) -- -- User defined ISR handler params(0) := req.params.handler; -- IRQ params(1) := unsigned_32'val (soc.nvic.to_irq_number (req.params.interrupt)); -- Status and data returned by the 'posthook' treatement -- (cf. ewok.posthook.exec) params(2) := req.params.posthook_status; params(3) := req.params.posthook_data; create_stack (ewok.layout.STACK_TOP_TASK_ISR, TSK.tasks_list(req.caller_id).isr_ctx.entry_point, -- Wrapper params, TSK.tasks_list(req.caller_id).isr_ctx.frame_a); ewok.tasks.set_mode (req.caller_id, TASK_MODE_ISRTHREAD); ewok.tasks.set_state (req.caller_id, TASK_MODE_ISRTHREAD, TASK_STATE_RUNNABLE); end isr_handler; procedure main_task is isr_req : t_isr_request; sys_req : t_syscall_request; ok : boolean; begin loop -- -- User ISRs -- loop m4.cpu.disable_irq; p_isr_requests.read (isr_queue, isr_req, ok); m4.cpu.enable_irq; exit when not ok; if isr_req.state = WAITING then if TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_LOCKED and TSK.tasks_list(isr_req.caller_id).state /= TASK_STATE_SLEEPING_DEEP then m4.cpu.disable_irq; isr_handler (isr_req); isr_req.state := DONE; ewok.sched.request_schedule; m4.cpu.enable_irq; m4.cpu.instructions.full_memory_barrier; else m4.cpu.disable_irq; p_isr_requests.write (isr_queue, isr_req, ok); if not ok then debug.panic ("SOFTIRQ failed to add ISR request"); end if; ewok.sched.request_schedule; m4.cpu.enable_irq; m4.cpu.instructions.full_memory_barrier; end if; else raise program_error; end if; end loop; -- -- Syscalls -- loop m4.cpu.disable_irq; p_syscall_requests.read (syscall_queue, sys_req, ok); m4.cpu.enable_irq; exit when not ok; if sys_req.state = WAITING then syscall_handler (sys_req); sys_req.state := DONE; else raise program_error; end if; end loop; -- -- Set softirq task as IDLE if there is no more request to handle -- m4.cpu.disable_irq; if p_isr_requests.state (isr_queue) = p_isr_requests.EMPTY and p_syscall_requests.state (syscall_queue) = p_syscall_requests.EMPTY then ewok.tasks.set_state (ID_SOFTIRQ, TASK_MODE_MAINTHREAD, TASK_STATE_IDLE); m4.cpu.instructions.full_memory_barrier; ewok.sched.request_schedule; end if; m4.cpu.enable_irq; end loop; end main_task; end ewok.softirq;
[ { "context": "----------------------\n-- Copyright (c) 2013-2014, Natacha Porté --\n-- ", "end": 120, "score": 0.9998475909233093, "start": 107, "tag": "NAME", "value": "Natacha Porté" } ]
tests/natools-reference_tests.ads
faelys/natools
0
------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Reference_Tests is a test suite for Natools.References -- -- reference-counted object holder. -- -- Note that the task-safety test is quite long and often reports success -- -- on task-unsafe code when run on a single core. For these reasons, it is -- -- not used by All_Tests. -- ------------------------------------------------------------------------------ with Natools.Tests; private with Ada.Finalization; private with GNAT.Debug_Pools; private with Natools.References; private with System.Storage_Pools; package Natools.Reference_Tests is package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); -- All tests except Test_Task_Safety (see the Note above) procedure Test_Data_Access (Report : in out NT.Reporter'Class); procedure Test_Double_Finalize (Report : in out NT.Reporter'Class); procedure Test_Implicit_Dereference (Report : in out NT.Reporter'Class); procedure Test_Instance_Counts (Report : in out NT.Reporter'Class); procedure Test_Reference_Counts (Report : in out NT.Reporter'Class); procedure Test_Reference_Tests (Report : in out NT.Reporter'Class); procedure Test_Task_Safety (Report : in out NT.Reporter'Class); private Instance_Count : Integer := 0; type Counter is new Ada.Finalization.Limited_Controlled with record Instance_Number : Natural := 0; end record; function Factory return Counter; overriding procedure Initialize (Object : in out Counter); overriding procedure Finalize (Object : in out Counter); Pool : GNAT.Debug_Pools.Debug_Pool; package Refs is new Natools.References (Counter, System.Storage_Pools.Root_Storage_Pool'Class (Pool), System.Storage_Pools.Root_Storage_Pool'Class (Pool)); end Natools.Reference_Tests;
7554
------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, <NAME> -- -- -- -- 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. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Reference_Tests is a test suite for Natools.References -- -- reference-counted object holder. -- -- Note that the task-safety test is quite long and often reports success -- -- on task-unsafe code when run on a single core. For these reasons, it is -- -- not used by All_Tests. -- ------------------------------------------------------------------------------ with Natools.Tests; private with Ada.Finalization; private with GNAT.Debug_Pools; private with Natools.References; private with System.Storage_Pools; package Natools.Reference_Tests is package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); -- All tests except Test_Task_Safety (see the Note above) procedure Test_Data_Access (Report : in out NT.Reporter'Class); procedure Test_Double_Finalize (Report : in out NT.Reporter'Class); procedure Test_Implicit_Dereference (Report : in out NT.Reporter'Class); procedure Test_Instance_Counts (Report : in out NT.Reporter'Class); procedure Test_Reference_Counts (Report : in out NT.Reporter'Class); procedure Test_Reference_Tests (Report : in out NT.Reporter'Class); procedure Test_Task_Safety (Report : in out NT.Reporter'Class); private Instance_Count : Integer := 0; type Counter is new Ada.Finalization.Limited_Controlled with record Instance_Number : Natural := 0; end record; function Factory return Counter; overriding procedure Initialize (Object : in out Counter); overriding procedure Finalize (Object : in out Counter); Pool : GNAT.Debug_Pools.Debug_Pool; package Refs is new Natools.References (Counter, System.Storage_Pools.Root_Storage_Pool'Class (Pool), System.Storage_Pools.Root_Storage_Pool'Class (Pool)); end Natools.Reference_Tests;
true
------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, PI:NAME:<NAME>END_PI -- -- -- -- 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. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Reference_Tests is a test suite for Natools.References -- -- reference-counted object holder. -- -- Note that the task-safety test is quite long and often reports success -- -- on task-unsafe code when run on a single core. For these reasons, it is -- -- not used by All_Tests. -- ------------------------------------------------------------------------------ with Natools.Tests; private with Ada.Finalization; private with GNAT.Debug_Pools; private with Natools.References; private with System.Storage_Pools; package Natools.Reference_Tests is package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); -- All tests except Test_Task_Safety (see the Note above) procedure Test_Data_Access (Report : in out NT.Reporter'Class); procedure Test_Double_Finalize (Report : in out NT.Reporter'Class); procedure Test_Implicit_Dereference (Report : in out NT.Reporter'Class); procedure Test_Instance_Counts (Report : in out NT.Reporter'Class); procedure Test_Reference_Counts (Report : in out NT.Reporter'Class); procedure Test_Reference_Tests (Report : in out NT.Reporter'Class); procedure Test_Task_Safety (Report : in out NT.Reporter'Class); private Instance_Count : Integer := 0; type Counter is new Ada.Finalization.Limited_Controlled with record Instance_Number : Natural := 0; end record; function Factory return Counter; overriding procedure Initialize (Object : in out Counter); overriding procedure Finalize (Object : in out Counter); Pool : GNAT.Debug_Pools.Debug_Pool; package Refs is new Natools.References (Counter, System.Storage_Pools.Root_Storage_Pool'Class (Pool), System.Storage_Pools.Root_Storage_Pool'Class (Pool)); end Natools.Reference_Tests;
[ { "context": "bounded_String(\"Vivant\"),'F',To_Unbounded_String(\"[email protected]\"),0678953421);\n\n Inserer_R(Registre, 3, Do", "end": 829, "score": 0.9997818470001221, "start": 811, "tag": "EMAIL", "value": "[email protected]" }, { "context": " (To_Unbounded_String(\"Max\"),To_Unbounded_String(\"Lili\"),Date_N1,To_Unbounded_String(\"Paris\"),Date_D1,To", "end": 1511, "score": 0.9801936149597168, "start": 1507, "tag": "NAME", "value": "Lili" }, { "context": "d_String(\"Paris\"),Date_D1,To_Unbounded_String(\"Vivant\"),'F',To_Unbounded_String(\"[email protected]\"),0", "end": 1586, "score": 0.6206757426261902, "start": 1583, "tag": "NAME", "value": "ant" }, { "context": "bounded_String(\"Vivant\"),'F',To_Unbounded_String(\"[email protected]\"),0678953421);\n\n -- Insertion de l'Id 3, a", "end": 1632, "score": 0.9999186992645264, "start": 1614, "tag": "EMAIL", "value": "[email protected]" }, { "context": "nnee2 := Initialiser_Donnee (To_Unbounded_String(\"Dupont\"),To_Unbounded_String(\"Baptiste\"),Date_N2,To_Unbo", "end": 1951, "score": 0.9993209838867188, "start": 1945, "tag": "NAME", "value": "Dupont" }, { "context": "o_Unbounded_String(\"Dupont\"),To_Unbounded_String(\"Baptiste\"),Date_N2,To_Unbounded_String(\"Toulouse\"),Date_D2", "end": 1983, "score": 0.9905886650085449, "start": 1975, "tag": "NAME", "value": "Baptiste" }, { "context": "unded_String(\"Toulouse\"),'H',To_Unbounded_String(\"[email protected]\"),0656673421);\n -- Insertion de l'Id 8, av", "end": 2116, "score": 0.9999209642410278, "start": 2091, "tag": "EMAIL", "value": "[email protected]" }, { "context": "nnee3 := Initialiser_Donnee (To_Unbounded_String(\"Halwani\"),To_Unbounded_String(\"Jad\"),Date_N3,To_Unbounded", "end": 2435, "score": 0.9994732737541199, "start": 2428, "tag": "NAME", "value": "Halwani" }, { "context": "_Unbounded_String(\"Halwani\"),To_Unbounded_String(\"Jad\"),Date_N3,To_Unbounded_String(\"Lille\"), Date_D3,T", "end": 2462, "score": 0.9958417415618896, "start": 2459, "tag": "NAME", "value": "Jad" }, { "context": "unded_String(\"Jad\"),Date_N3,To_Unbounded_String(\"Lille\"), Date_D3,To_Unbounded_String(\"Toulouse\"),'H',To", "end": 2499, "score": 0.613605260848999, "start": 2495, "tag": "NAME", "value": "ille" }, { "context": "unded_String(\"Toulouse\"),'H',To_Unbounded_String(\"[email protected]\"),0656693421);\n -- Insertion de l'Id 20, a", "end": 2589, "score": 0.9999188184738159, "start": 2568, "tag": "EMAIL", "value": "[email protected]" }, { "context": "onnee := Initialiser_Donnee (To_Unbounded_String(\"Dupont\"),To_Unbounded_String(\"Baptiste\"),Date_N,To_Unbou", "end": 4759, "score": 0.9983959794044495, "start": 4753, "tag": "NAME", "value": "Dupont" }, { "context": "o_Unbounded_String(\"Dupont\"),To_Unbounded_String(\"Baptiste\"),Date_N,To_Unbounded_String(\"Toulouse\"),Date_D,T", "end": 4791, "score": 0.944066047668457, "start": 4783, "tag": "NAME", "value": "Baptiste" }, { "context": "unded_String(\"Toulouse\"),'H',To_Unbounded_String(\"[email protected]\"),0656673421);\n\n -- Insertion de l'Id 8 av", "end": 4922, "score": 0.9999173283576965, "start": 4897, "tag": "EMAIL", "value": "[email protected]" }, { "context": "onnee := Initialiser_Donnee (To_Unbounded_String(\"Dupont\"),To_Unbounded_String(\"Baptiste\"),Date_N,To_Unbou", "end": 5878, "score": 0.9952945113182068, "start": 5872, "tag": "NAME", "value": "Dupont" }, { "context": "unded_String(\"Toulouse\"),'H',To_Unbounded_String(\"[email protected]\"),0656673421);\n -- Modification des donnée", "end": 6041, "score": 0.9999081492424011, "start": 6016, "tag": "EMAIL", "value": "[email protected]" }, { "context": "nnee1 := Initialiser_Donnee (To_Unbounded_String(\"Max\"),To_Unbounded_String(\"Lili\"),Date_N1,To_Unbounde", "end": 8104, "score": 0.9993083477020264, "start": 8101, "tag": "NAME", "value": "Max" }, { "context": " (To_Unbounded_String(\"Max\"),To_Unbounded_String(\"Lili\"),Date_N1,To_Unbounded_String(\"Paris\"),Date_D1,To", "end": 8132, "score": 0.9939340353012085, "start": 8128, "tag": "NAME", "value": "Lili" }, { "context": "bounded_String(\"Vivant\"),'F',To_Unbounded_String(\"[email protected]\"),0678953421);\n Donnee2 := Initialiser_Don", "end": 8253, "score": 0.9998518228530884, "start": 8235, "tag": "EMAIL", "value": "[email protected]" }, { "context": "nnee2 := Initialiser_Donnee (To_Unbounded_String(\"Dupont\"),To_Unbounded_String(\"Baptiste\"),Date_N2,To_Unbo", "end": 8335, "score": 0.9994606971740723, "start": 8329, "tag": "NAME", "value": "Dupont" }, { "context": "o_Unbounded_String(\"Dupont\"),To_Unbounded_String(\"Baptiste\"),Date_N2,To_Unbounded_String(\"Toulouse\"),Date_D2", "end": 8367, "score": 0.9987139105796814, "start": 8359, "tag": "NAME", "value": "Baptiste" }, { "context": "unded_String(\"Toulouse\"),'H',To_Unbounded_String(\"[email protected]\"),0656673421);\n Donnee3 := Initialiser_Don", "end": 8500, "score": 0.999921977519989, "start": 8475, "tag": "EMAIL", "value": "[email protected]" }, { "context": "nnee3 := Initialiser_Donnee (To_Unbounded_String(\"Halwani\"),To_Unbounded_String(\"Jad\"),Date_N3,To_Unbounded", "end": 8583, "score": 0.9992570281028748, "start": 8576, "tag": "NAME", "value": "Halwani" }, { "context": "_Unbounded_String(\"Halwani\"),To_Unbounded_String(\"Jad\"),Date_N3,To_Unbounded_String(\"Lille\"), Date_D3,T", "end": 8610, "score": 0.9967999458312988, "start": 8607, "tag": "NAME", "value": "Jad" }, { "context": "unded_String(\"Toulouse\"),'H',To_Unbounded_String(\"[email protected]\"),0656693421);\n pragma Assert(La_Donnee_R(", "end": 8737, "score": 0.9999222755432129, "start": 8716, "tag": "EMAIL", "value": "[email protected]" } ]
1A/S5/PIM/projet/src/test_registre.adb
MOUDDENEHamza/ENSEEIHT
4
with Ada.Text_IO; use Ada.Text_IO; with registre; use registre; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure test_registre is -- Création d'un registre avec un Id et ses données. procedure Initialiser_Le_Test (Registre : out T_Registre) is Donnee : T_Donnee; Date_N : T_Date; Date_D : T_Date; begin -- Initialisation du registre. Initialiser_R(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(18,09,1999); Date_D := Initialiser_Date(0,0,0); Donnee := Initialiser_Donnee (To_Unbounded_String("Max"),To_Unbounded_String("Lili"),Date_N,To_Unbounded_String("Paris"),Date_D,To_Unbounded_String("Vivant"),'F',To_Unbounded_String("[email protected]"),0678953421); Inserer_R(Registre, 3, Donnee); end Initialiser_Le_Test; -- Création d'un registre avec un Id et ses données. procedure Initialiser_Le_Test_Avec_3_Elts (Registre : in out T_Registre) is Donnee1 : T_Donnee; Donnee2 : T_Donnee; Donnee3 : T_Donnee; Date_N1, Date_D1, Date_N2, Date_D2, Date_N3, Date_D3 : T_Date; begin -- Initialisation du registre. Initialiser_R(Registre); -- Inscription de Donnee1. Date_N1 := Initialiser_Date(18,09,1999); Date_D1 := Initialiser_Date(0,0,0); Donnee1 := Initialiser_Donnee (To_Unbounded_String("Max"),To_Unbounded_String("Lili"),Date_N1,To_Unbounded_String("Paris"),Date_D1,To_Unbounded_String("Vivant"),'F',To_Unbounded_String("[email protected]"),0678953421); -- Insertion de l'Id 3, avec Donnee1, dans Registre. Inserer_R(Registre, 3, Donnee1); -- Inscription de Donnee2. Date_N2 := Initialiser_Date(21,12,1925); Date_D2 := Initialiser_Date(01,09,2001); Donnee2 := Initialiser_Donnee (To_Unbounded_String("Dupont"),To_Unbounded_String("Baptiste"),Date_N2,To_Unbounded_String("Toulouse"),Date_D2,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("[email protected]"),0656673421); -- Insertion de l'Id 8, avec Donnee2, dans Registre. Inserer_R(Registre, 8, Donnee2); -- Inscription de Donnee3. Date_D3 := Initialiser_Date(02,05,2019); Date_N3 := Initialiser_Date(11,02,1998); Donnee3 := Initialiser_Donnee (To_Unbounded_String("Halwani"),To_Unbounded_String("Jad"),Date_N3,To_Unbounded_String("Lille"), Date_D3,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("[email protected]"),0656693421); -- Insertion de l'Id 20, avec Donnee3, dans Registre. Inserer_R(Registre, 20, Donnee3); end Initialiser_Le_Test_Avec_3_Elts; -- Tester les procédures Initialiser_R et Est_Vide_R procedure Tester_Initialiser_R_Et_Est_Vide_R is Registre : T_Registre; begin -- Initialisation du registre. Initialiser_R(Registre); pragma Assert (Est_Vide_R(Registre)); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Initialiser_R_Et_Est_Vide_R est "); Put_Line (" testée avec succès."); New_Line; end Tester_Initialiser_R_Et_Est_Vide_R; -- Tester la procédure Taille_R procedure Tester_Taille_R is Registre : T_Registre; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); pragma Assert(Taille_R(Registre)=3); pragma Assert(not(Taille_R(Registre)=5)); -- Suppression de l'Id 3 et de ses données du registre. Supprimer_R(Registre,3); pragma Assert(Taille_R(Registre)=2); pragma Assert(not(Taille_R(Registre)=8)); -- Suppression de l'Id 8 et de ses données du registre. Supprimer_R(Registre,8); pragma Assert(Taille_R(Registre)=1); pragma Assert(not(Taille_R(Registre)=2)); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Taille_R est testée avec succès."); New_Line; end Tester_Taille_R; -- Tester la procédure Inserer_R procedure Tester_Inserer_R is Registre : T_Registre; Donnee : T_Donnee; Date_D, Date_N : T_Date; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(21,12,1925); Date_D := Initialiser_Date(01,09,2001); Donnee := Initialiser_Donnee (To_Unbounded_String("Dupont"),To_Unbounded_String("Baptiste"),Date_N,To_Unbounded_String("Toulouse"),Date_D,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("[email protected]"),0656673421); -- Insertion de l'Id 8 avec ses données dans le registre. Inserer_R(Registre, 8, Donnee); pragma Assert(La_Donnee_R(Registre,8)=Donnee); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Inserer_R est testée avec succès."); New_Line; end Tester_Inserer_R; -- Tester la procédure Modifier_R procedure Tester_Modifier_R is Registre : T_Registre; Donnee : T_Donnee; -- la donnée avec laquelle on en modifie une autre. Date_D, Date_N : T_Date; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(21,12,1925); Date_D := Initialiser_Date(01,09,2001); Donnee := Initialiser_Donnee (To_Unbounded_String("Dupont"),To_Unbounded_String("Baptiste"),Date_N,To_Unbounded_String("Toulouse"),Date_D,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("[email protected]"),0656673421); -- Modification des données de l'Id présent avec Donnee. Modifier_R(Registre, 3, Donnee); pragma Assert(La_Donnee_R(Registre, 3) = Donnee); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Modifier_R est testée avec succès."); New_Line; end Tester_Modifier_R; -- Tester la procédure Supprimer_R procedure Tester_Supprimer_R is Registre : T_Registre; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); pragma Assert (Taille_R (Registre) = 3); -- Suppression de l'Id 3 et de ses données du registre. Supprimer_R(Registre, 3); pragma Assert (Taille_R (Registre) = 2); -- Suppression de l'Id 8 et de ses données du registre. Supprimer_R(Registre, 8); pragma Assert (Taille_R (Registre) = 1); -- Suppression de l'Id 20 et de ses données du registre. Supprimer_R(Registre, 20); pragma Assert (Taille_R (Registre) = 0); pragma Assert (Est_Vide_R (Registre)); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Supprimer_R est testée avec succès."); New_Line; end Tester_Supprimer_R; -- Tester la procédure La_Donnee_R procedure Tester_La_Donnee_R is Registre : T_Registre; Donnee1 : T_Donnee; Donnee2 : T_Donnee; Donnee3 : T_Donnee; Date_N1, Date_D1, Date_N2, Date_D2, Date_N3, Date_D3 : T_Date; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); Date_N1 := Initialiser_Date(18,09,1999); Date_D1 := Initialiser_Date(0,0,0); Date_N2 := Initialiser_Date(21,12,1925); Date_D2 := Initialiser_Date(01,09,2001); Date_D3 := Initialiser_Date(02,05,2019); Date_N3 := Initialiser_Date(11,02,1998); Donnee1 := Initialiser_Donnee (To_Unbounded_String("Max"),To_Unbounded_String("Lili"),Date_N1,To_Unbounded_String("Paris"),Date_D1,To_Unbounded_String("Vivant"),'F',To_Unbounded_String("[email protected]"),0678953421); Donnee2 := Initialiser_Donnee (To_Unbounded_String("Dupont"),To_Unbounded_String("Baptiste"),Date_N2,To_Unbounded_String("Toulouse"),Date_D2,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("[email protected]"),0656673421); Donnee3 := Initialiser_Donnee (To_Unbounded_String("Halwani"),To_Unbounded_String("Jad"),Date_N3,To_Unbounded_String("Lille"), Date_D3,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("[email protected]"),0656693421); pragma Assert(La_Donnee_R(Registre,3) = Donnee1); pragma Assert(La_Donnee_R(Registre,8) = Donnee2); pragma Assert(La_Donnee_R(Registre,20) = Donnee3); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_La_Donnee_R est testée avec succès."); New_Line; end Tester_La_Donnee_R; -- Tester la fonction Vider_R procedure Tester_Vider_R is Registre : T_Registre; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); Vider_R(Registre); pragma Assert(Taille_R(Registre)=0); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Vider_R est testée avec succès."); New_Line; end Tester_Vider_R; -- Tester la fonction Ecart_Age_Parent_Enfant_R procedure Tester_Ecart_Age_Parent_Enfant_R is Registre : T_Registre; Id : constant Integer := 3; -- Identifiant de l'enfant Parent_1 : T_Tab; -- l'enfant a un parent begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test_Avec_3_Elts(Registre); -- L'individu d'identifiant 3 a un parent d'identifiant 8. Parent_1.Taille := 1; Parent_1.Elt(1) := 8; pragma Assert(Ecart_Age_Parent_Enfant_R(Registre,Id, Parent_1)); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Ecart_Age_Parent_EnfantSupprimer_R "); Put_Line(" est testée avec succès."); New_Line; end Tester_Ecart_Age_Parent_Enfant_R; -- Tester la fonction Age procedure Tester_Age is Registre : T_Registre; Age_Individu1, Age_Individu2, Age_Individu3 : Integer; begin Initialiser_Le_Test_Avec_3_Elts(Registre); Age_Individu1 := Age(Registre,3); Age_Individu2 := Age(Registre,8); Age_Individu3 := Age(Registre,20); pragma Assert(Age_Individu1 = 20); pragma Assert(Age_Individu2 = 75); pragma Assert(Age_Individu3 = 21); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Age est testée avec succès."); New_Line; end Tester_Age; begin New_Line; Put_Line("*************************** Début ****************************"); New_Line; Tester_Initialiser_R_Et_Est_Vide_R; Tester_Taille_R; Tester_Inserer_R; Tester_Modifier_R; Tester_Supprimer_R; Tester_La_Donnee_R; Tester_Vider_R; Tester_Age; Tester_Ecart_Age_Parent_Enfant_R; New_Line; Put_Line("***************************** Fin ****************************"); New_Line; end test_registre;
13162
with Ada.Text_IO; use Ada.Text_IO; with registre; use registre; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure test_registre is -- Création d'un registre avec un Id et ses données. procedure Initialiser_Le_Test (Registre : out T_Registre) is Donnee : T_Donnee; Date_N : T_Date; Date_D : T_Date; begin -- Initialisation du registre. Initialiser_R(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(18,09,1999); Date_D := Initialiser_Date(0,0,0); Donnee := Initialiser_Donnee (To_Unbounded_String("Max"),To_Unbounded_String("Lili"),Date_N,To_Unbounded_String("Paris"),Date_D,To_Unbounded_String("Vivant"),'F',To_Unbounded_String("<EMAIL>"),0678953421); Inserer_R(Registre, 3, Donnee); end Initialiser_Le_Test; -- Création d'un registre avec un Id et ses données. procedure Initialiser_Le_Test_Avec_3_Elts (Registre : in out T_Registre) is Donnee1 : T_Donnee; Donnee2 : T_Donnee; Donnee3 : T_Donnee; Date_N1, Date_D1, Date_N2, Date_D2, Date_N3, Date_D3 : T_Date; begin -- Initialisation du registre. Initialiser_R(Registre); -- Inscription de Donnee1. Date_N1 := Initialiser_Date(18,09,1999); Date_D1 := Initialiser_Date(0,0,0); Donnee1 := Initialiser_Donnee (To_Unbounded_String("Max"),To_Unbounded_String("<NAME>"),Date_N1,To_Unbounded_String("Paris"),Date_D1,To_Unbounded_String("Viv<NAME>"),'F',To_Unbounded_String("<EMAIL>"),0678953421); -- Insertion de l'Id 3, avec Donnee1, dans Registre. Inserer_R(Registre, 3, Donnee1); -- Inscription de Donnee2. Date_N2 := Initialiser_Date(21,12,1925); Date_D2 := Initialiser_Date(01,09,2001); Donnee2 := Initialiser_Donnee (To_Unbounded_String("<NAME>"),To_Unbounded_String("<NAME>"),Date_N2,To_Unbounded_String("Toulouse"),Date_D2,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("<EMAIL>"),0656673421); -- Insertion de l'Id 8, avec Donnee2, dans Registre. Inserer_R(Registre, 8, Donnee2); -- Inscription de Donnee3. Date_D3 := Initialiser_Date(02,05,2019); Date_N3 := Initialiser_Date(11,02,1998); Donnee3 := Initialiser_Donnee (To_Unbounded_String("<NAME>"),To_Unbounded_String("<NAME>"),Date_N3,To_Unbounded_String("L<NAME>"), Date_D3,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("<EMAIL>"),0656693421); -- Insertion de l'Id 20, avec Donnee3, dans Registre. Inserer_R(Registre, 20, Donnee3); end Initialiser_Le_Test_Avec_3_Elts; -- Tester les procédures Initialiser_R et Est_Vide_R procedure Tester_Initialiser_R_Et_Est_Vide_R is Registre : T_Registre; begin -- Initialisation du registre. Initialiser_R(Registre); pragma Assert (Est_Vide_R(Registre)); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Initialiser_R_Et_Est_Vide_R est "); Put_Line (" testée avec succès."); New_Line; end Tester_Initialiser_R_Et_Est_Vide_R; -- Tester la procédure Taille_R procedure Tester_Taille_R is Registre : T_Registre; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); pragma Assert(Taille_R(Registre)=3); pragma Assert(not(Taille_R(Registre)=5)); -- Suppression de l'Id 3 et de ses données du registre. Supprimer_R(Registre,3); pragma Assert(Taille_R(Registre)=2); pragma Assert(not(Taille_R(Registre)=8)); -- Suppression de l'Id 8 et de ses données du registre. Supprimer_R(Registre,8); pragma Assert(Taille_R(Registre)=1); pragma Assert(not(Taille_R(Registre)=2)); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Taille_R est testée avec succès."); New_Line; end Tester_Taille_R; -- Tester la procédure Inserer_R procedure Tester_Inserer_R is Registre : T_Registre; Donnee : T_Donnee; Date_D, Date_N : T_Date; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(21,12,1925); Date_D := Initialiser_Date(01,09,2001); Donnee := Initialiser_Donnee (To_Unbounded_String("<NAME>"),To_Unbounded_String("<NAME>"),Date_N,To_Unbounded_String("Toulouse"),Date_D,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("<EMAIL>"),0656673421); -- Insertion de l'Id 8 avec ses données dans le registre. Inserer_R(Registre, 8, Donnee); pragma Assert(La_Donnee_R(Registre,8)=Donnee); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Inserer_R est testée avec succès."); New_Line; end Tester_Inserer_R; -- Tester la procédure Modifier_R procedure Tester_Modifier_R is Registre : T_Registre; Donnee : T_Donnee; -- la donnée avec laquelle on en modifie une autre. Date_D, Date_N : T_Date; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(21,12,1925); Date_D := Initialiser_Date(01,09,2001); Donnee := Initialiser_Donnee (To_Unbounded_String("<NAME>"),To_Unbounded_String("Baptiste"),Date_N,To_Unbounded_String("Toulouse"),Date_D,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("<EMAIL>"),0656673421); -- Modification des données de l'Id présent avec Donnee. Modifier_R(Registre, 3, Donnee); pragma Assert(La_Donnee_R(Registre, 3) = Donnee); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Modifier_R est testée avec succès."); New_Line; end Tester_Modifier_R; -- Tester la procédure Supprimer_R procedure Tester_Supprimer_R is Registre : T_Registre; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); pragma Assert (Taille_R (Registre) = 3); -- Suppression de l'Id 3 et de ses données du registre. Supprimer_R(Registre, 3); pragma Assert (Taille_R (Registre) = 2); -- Suppression de l'Id 8 et de ses données du registre. Supprimer_R(Registre, 8); pragma Assert (Taille_R (Registre) = 1); -- Suppression de l'Id 20 et de ses données du registre. Supprimer_R(Registre, 20); pragma Assert (Taille_R (Registre) = 0); pragma Assert (Est_Vide_R (Registre)); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Supprimer_R est testée avec succès."); New_Line; end Tester_Supprimer_R; -- Tester la procédure La_Donnee_R procedure Tester_La_Donnee_R is Registre : T_Registre; Donnee1 : T_Donnee; Donnee2 : T_Donnee; Donnee3 : T_Donnee; Date_N1, Date_D1, Date_N2, Date_D2, Date_N3, Date_D3 : T_Date; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); Date_N1 := Initialiser_Date(18,09,1999); Date_D1 := Initialiser_Date(0,0,0); Date_N2 := Initialiser_Date(21,12,1925); Date_D2 := Initialiser_Date(01,09,2001); Date_D3 := Initialiser_Date(02,05,2019); Date_N3 := Initialiser_Date(11,02,1998); Donnee1 := Initialiser_Donnee (To_Unbounded_String("<NAME>"),To_Unbounded_String("<NAME>"),Date_N1,To_Unbounded_String("Paris"),Date_D1,To_Unbounded_String("Vivant"),'F',To_Unbounded_String("<EMAIL>"),0678953421); Donnee2 := Initialiser_Donnee (To_Unbounded_String("<NAME>"),To_Unbounded_String("<NAME>"),Date_N2,To_Unbounded_String("Toulouse"),Date_D2,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("<EMAIL>"),0656673421); Donnee3 := Initialiser_Donnee (To_Unbounded_String("<NAME>"),To_Unbounded_String("<NAME>"),Date_N3,To_Unbounded_String("Lille"), Date_D3,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("<EMAIL>"),0656693421); pragma Assert(La_Donnee_R(Registre,3) = Donnee1); pragma Assert(La_Donnee_R(Registre,8) = Donnee2); pragma Assert(La_Donnee_R(Registre,20) = Donnee3); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_La_Donnee_R est testée avec succès."); New_Line; end Tester_La_Donnee_R; -- Tester la fonction Vider_R procedure Tester_Vider_R is Registre : T_Registre; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); Vider_R(Registre); pragma Assert(Taille_R(Registre)=0); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Vider_R est testée avec succès."); New_Line; end Tester_Vider_R; -- Tester la fonction Ecart_Age_Parent_Enfant_R procedure Tester_Ecart_Age_Parent_Enfant_R is Registre : T_Registre; Id : constant Integer := 3; -- Identifiant de l'enfant Parent_1 : T_Tab; -- l'enfant a un parent begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test_Avec_3_Elts(Registre); -- L'individu d'identifiant 3 a un parent d'identifiant 8. Parent_1.Taille := 1; Parent_1.Elt(1) := 8; pragma Assert(Ecart_Age_Parent_Enfant_R(Registre,Id, Parent_1)); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Ecart_Age_Parent_EnfantSupprimer_R "); Put_Line(" est testée avec succès."); New_Line; end Tester_Ecart_Age_Parent_Enfant_R; -- Tester la fonction Age procedure Tester_Age is Registre : T_Registre; Age_Individu1, Age_Individu2, Age_Individu3 : Integer; begin Initialiser_Le_Test_Avec_3_Elts(Registre); Age_Individu1 := Age(Registre,3); Age_Individu2 := Age(Registre,8); Age_Individu3 := Age(Registre,20); pragma Assert(Age_Individu1 = 20); pragma Assert(Age_Individu2 = 75); pragma Assert(Age_Individu3 = 21); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Age est testée avec succès."); New_Line; end Tester_Age; begin New_Line; Put_Line("*************************** Début ****************************"); New_Line; Tester_Initialiser_R_Et_Est_Vide_R; Tester_Taille_R; Tester_Inserer_R; Tester_Modifier_R; Tester_Supprimer_R; Tester_La_Donnee_R; Tester_Vider_R; Tester_Age; Tester_Ecart_Age_Parent_Enfant_R; New_Line; Put_Line("***************************** Fin ****************************"); New_Line; end test_registre;
true
with Ada.Text_IO; use Ada.Text_IO; with registre; use registre; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure test_registre is -- Création d'un registre avec un Id et ses données. procedure Initialiser_Le_Test (Registre : out T_Registre) is Donnee : T_Donnee; Date_N : T_Date; Date_D : T_Date; begin -- Initialisation du registre. Initialiser_R(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(18,09,1999); Date_D := Initialiser_Date(0,0,0); Donnee := Initialiser_Donnee (To_Unbounded_String("Max"),To_Unbounded_String("Lili"),Date_N,To_Unbounded_String("Paris"),Date_D,To_Unbounded_String("Vivant"),'F',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0678953421); Inserer_R(Registre, 3, Donnee); end Initialiser_Le_Test; -- Création d'un registre avec un Id et ses données. procedure Initialiser_Le_Test_Avec_3_Elts (Registre : in out T_Registre) is Donnee1 : T_Donnee; Donnee2 : T_Donnee; Donnee3 : T_Donnee; Date_N1, Date_D1, Date_N2, Date_D2, Date_N3, Date_D3 : T_Date; begin -- Initialisation du registre. Initialiser_R(Registre); -- Inscription de Donnee1. Date_N1 := Initialiser_Date(18,09,1999); Date_D1 := Initialiser_Date(0,0,0); Donnee1 := Initialiser_Donnee (To_Unbounded_String("Max"),To_Unbounded_String("PI:NAME:<NAME>END_PI"),Date_N1,To_Unbounded_String("Paris"),Date_D1,To_Unbounded_String("VivPI:NAME:<NAME>END_PI"),'F',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0678953421); -- Insertion de l'Id 3, avec Donnee1, dans Registre. Inserer_R(Registre, 3, Donnee1); -- Inscription de Donnee2. Date_N2 := Initialiser_Date(21,12,1925); Date_D2 := Initialiser_Date(01,09,2001); Donnee2 := Initialiser_Donnee (To_Unbounded_String("PI:NAME:<NAME>END_PI"),To_Unbounded_String("PI:NAME:<NAME>END_PI"),Date_N2,To_Unbounded_String("Toulouse"),Date_D2,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0656673421); -- Insertion de l'Id 8, avec Donnee2, dans Registre. Inserer_R(Registre, 8, Donnee2); -- Inscription de Donnee3. Date_D3 := Initialiser_Date(02,05,2019); Date_N3 := Initialiser_Date(11,02,1998); Donnee3 := Initialiser_Donnee (To_Unbounded_String("PI:NAME:<NAME>END_PI"),To_Unbounded_String("PI:NAME:<NAME>END_PI"),Date_N3,To_Unbounded_String("LPI:NAME:<NAME>END_PI"), Date_D3,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0656693421); -- Insertion de l'Id 20, avec Donnee3, dans Registre. Inserer_R(Registre, 20, Donnee3); end Initialiser_Le_Test_Avec_3_Elts; -- Tester les procédures Initialiser_R et Est_Vide_R procedure Tester_Initialiser_R_Et_Est_Vide_R is Registre : T_Registre; begin -- Initialisation du registre. Initialiser_R(Registre); pragma Assert (Est_Vide_R(Registre)); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Initialiser_R_Et_Est_Vide_R est "); Put_Line (" testée avec succès."); New_Line; end Tester_Initialiser_R_Et_Est_Vide_R; -- Tester la procédure Taille_R procedure Tester_Taille_R is Registre : T_Registre; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); pragma Assert(Taille_R(Registre)=3); pragma Assert(not(Taille_R(Registre)=5)); -- Suppression de l'Id 3 et de ses données du registre. Supprimer_R(Registre,3); pragma Assert(Taille_R(Registre)=2); pragma Assert(not(Taille_R(Registre)=8)); -- Suppression de l'Id 8 et de ses données du registre. Supprimer_R(Registre,8); pragma Assert(Taille_R(Registre)=1); pragma Assert(not(Taille_R(Registre)=2)); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Taille_R est testée avec succès."); New_Line; end Tester_Taille_R; -- Tester la procédure Inserer_R procedure Tester_Inserer_R is Registre : T_Registre; Donnee : T_Donnee; Date_D, Date_N : T_Date; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(21,12,1925); Date_D := Initialiser_Date(01,09,2001); Donnee := Initialiser_Donnee (To_Unbounded_String("PI:NAME:<NAME>END_PI"),To_Unbounded_String("PI:NAME:<NAME>END_PI"),Date_N,To_Unbounded_String("Toulouse"),Date_D,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0656673421); -- Insertion de l'Id 8 avec ses données dans le registre. Inserer_R(Registre, 8, Donnee); pragma Assert(La_Donnee_R(Registre,8)=Donnee); -- Libération de la mémoire. Vider_R(Registre); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Inserer_R est testée avec succès."); New_Line; end Tester_Inserer_R; -- Tester la procédure Modifier_R procedure Tester_Modifier_R is Registre : T_Registre; Donnee : T_Donnee; -- la donnée avec laquelle on en modifie une autre. Date_D, Date_N : T_Date; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); -- Inscription d'une donnée. Date_N := Initialiser_Date(21,12,1925); Date_D := Initialiser_Date(01,09,2001); Donnee := Initialiser_Donnee (To_Unbounded_String("PI:NAME:<NAME>END_PI"),To_Unbounded_String("Baptiste"),Date_N,To_Unbounded_String("Toulouse"),Date_D,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0656673421); -- Modification des données de l'Id présent avec Donnee. Modifier_R(Registre, 3, Donnee); pragma Assert(La_Donnee_R(Registre, 3) = Donnee); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Modifier_R est testée avec succès."); New_Line; end Tester_Modifier_R; -- Tester la procédure Supprimer_R procedure Tester_Supprimer_R is Registre : T_Registre; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); pragma Assert (Taille_R (Registre) = 3); -- Suppression de l'Id 3 et de ses données du registre. Supprimer_R(Registre, 3); pragma Assert (Taille_R (Registre) = 2); -- Suppression de l'Id 8 et de ses données du registre. Supprimer_R(Registre, 8); pragma Assert (Taille_R (Registre) = 1); -- Suppression de l'Id 20 et de ses données du registre. Supprimer_R(Registre, 20); pragma Assert (Taille_R (Registre) = 0); pragma Assert (Est_Vide_R (Registre)); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Supprimer_R est testée avec succès."); New_Line; end Tester_Supprimer_R; -- Tester la procédure La_Donnee_R procedure Tester_La_Donnee_R is Registre : T_Registre; Donnee1 : T_Donnee; Donnee2 : T_Donnee; Donnee3 : T_Donnee; Date_N1, Date_D1, Date_N2, Date_D2, Date_N3, Date_D3 : T_Date; begin -- Création d'un registre avec un 3 Id et leurs données. Initialiser_Le_Test_Avec_3_Elts(Registre); Date_N1 := Initialiser_Date(18,09,1999); Date_D1 := Initialiser_Date(0,0,0); Date_N2 := Initialiser_Date(21,12,1925); Date_D2 := Initialiser_Date(01,09,2001); Date_D3 := Initialiser_Date(02,05,2019); Date_N3 := Initialiser_Date(11,02,1998); Donnee1 := Initialiser_Donnee (To_Unbounded_String("PI:NAME:<NAME>END_PI"),To_Unbounded_String("PI:NAME:<NAME>END_PI"),Date_N1,To_Unbounded_String("Paris"),Date_D1,To_Unbounded_String("Vivant"),'F',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0678953421); Donnee2 := Initialiser_Donnee (To_Unbounded_String("PI:NAME:<NAME>END_PI"),To_Unbounded_String("PI:NAME:<NAME>END_PI"),Date_N2,To_Unbounded_String("Toulouse"),Date_D2,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0656673421); Donnee3 := Initialiser_Donnee (To_Unbounded_String("PI:NAME:<NAME>END_PI"),To_Unbounded_String("PI:NAME:<NAME>END_PI"),Date_N3,To_Unbounded_String("Lille"), Date_D3,To_Unbounded_String("Toulouse"),'H',To_Unbounded_String("PI:EMAIL:<EMAIL>END_PI"),0656693421); pragma Assert(La_Donnee_R(Registre,3) = Donnee1); pragma Assert(La_Donnee_R(Registre,8) = Donnee2); pragma Assert(La_Donnee_R(Registre,20) = Donnee3); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_La_Donnee_R est testée avec succès."); New_Line; end Tester_La_Donnee_R; -- Tester la fonction Vider_R procedure Tester_Vider_R is Registre : T_Registre; begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test(Registre); Vider_R(Registre); pragma Assert(Taille_R(Registre)=0); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Vider_R est testée avec succès."); New_Line; end Tester_Vider_R; -- Tester la fonction Ecart_Age_Parent_Enfant_R procedure Tester_Ecart_Age_Parent_Enfant_R is Registre : T_Registre; Id : constant Integer := 3; -- Identifiant de l'enfant Parent_1 : T_Tab; -- l'enfant a un parent begin -- Création d'un registre avec un Id et ses données. Initialiser_Le_Test_Avec_3_Elts(Registre); -- L'individu d'identifiant 3 a un parent d'identifiant 8. Parent_1.Taille := 1; Parent_1.Elt(1) := 8; pragma Assert(Ecart_Age_Parent_Enfant_R(Registre,Id, Parent_1)); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Ecart_Age_Parent_EnfantSupprimer_R "); Put_Line(" est testée avec succès."); New_Line; end Tester_Ecart_Age_Parent_Enfant_R; -- Tester la fonction Age procedure Tester_Age is Registre : T_Registre; Age_Individu1, Age_Individu2, Age_Individu3 : Integer; begin Initialiser_Le_Test_Avec_3_Elts(Registre); Age_Individu1 := Age(Registre,3); Age_Individu2 := Age(Registre,8); Age_Individu3 := Age(Registre,20); pragma Assert(Age_Individu1 = 20); pragma Assert(Age_Individu2 = 75); pragma Assert(Age_Individu3 = 21); New_Line; Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Procedure Tester_Age est testée avec succès."); New_Line; end Tester_Age; begin New_Line; Put_Line("*************************** Début ****************************"); New_Line; Tester_Initialiser_R_Et_Est_Vide_R; Tester_Taille_R; Tester_Inserer_R; Tester_Modifier_R; Tester_Supprimer_R; Tester_La_Donnee_R; Tester_Vider_R; Tester_Age; Tester_Ecart_Age_Parent_Enfant_R; New_Line; Put_Line("***************************** Fin ****************************"); New_Line; end test_registre;
[ { "context": "--\n-- Copyright (C) 2022 Jeremy Grosser <[email protected]>\n--\n-- SPDX-License-Identifier", "end": 40, "score": 0.9998458623886108, "start": 26, "tag": "NAME", "value": "Jeremy Grosser" }, { "context": "--\n-- Copyright (C) 2022 Jeremy Grosser <[email protected]>\n--\n-- SPDX-License-Identifier: BSD-3-Clause\n--\n", "end": 58, "score": 0.9999328851699829, "start": 42, "tag": "EMAIL", "value": "[email protected]" } ]
src/epoll.ads
JeremyGrosser/epoll-ada
0
-- -- Copyright (C) 2022 Jeremy Grosser <[email protected]> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Interfaces.C; use Interfaces.C; with Interfaces; use Interfaces; with GNAT.Sockets; use GNAT.Sockets; package Epoll is Epoll_Error : exception; type Epoll_Descriptor is private; type Epoll_Flags is record Readable : Boolean; -- EPOLLIN Writable : Boolean; -- EPOLLOUT Peer_Shutdown : Boolean; -- EPOLLRDHUP Out_Of_Band : Boolean; -- EPOLLPRI Error : Boolean; -- EPOLLERR Hang_Up : Boolean; -- EPOLLHUP Edge_Triggered : Boolean; -- EPOLLET One_Shot : Boolean; -- EPOLLONESHOT Wake_Up : Boolean; -- EPOLLWAKEUP Exclusive : Boolean; -- EPOLLEXCLUSIVE end record with Size => 32; for Epoll_Flags use record Readable at 0 range 0 .. 0; Out_Of_Band at 0 range 1 .. 1; Writable at 0 range 2 .. 2; Error at 0 range 3 .. 3; Hang_Up at 0 range 4 .. 4; Peer_Shutdown at 0 range 13 .. 13; Exclusive at 0 range 28 .. 28; Wake_Up at 0 range 29 .. 29; One_Shot at 0 range 30 .. 30; Edge_Triggered at 0 range 31 .. 31; end record; type Epoll_Event is record Flags : Epoll_Flags := (others => False); Data : Unsigned_64 := -1; end record with Pack, Convention => C_Pass_By_Copy; type Epoll_Events is array (Integer range <>) of Epoll_Event with Convention => C; type Epoll_Operation is (Add, Delete, Modify) with Size => 32; for Epoll_Operation use (1, 2, 3); function Create return Epoll_Descriptor; procedure Control (This : Epoll_Descriptor; Socket : Socket_Type; Op : Epoll_Operation; Event : access Epoll_Event); function Wait (This : Epoll_Descriptor; Max_Events : Positive := 1; Timeout : Integer := -1) return Epoll_Events; private type Epoll_Descriptor is new int; end Epoll;
18854
-- -- Copyright (C) 2022 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Interfaces.C; use Interfaces.C; with Interfaces; use Interfaces; with GNAT.Sockets; use GNAT.Sockets; package Epoll is Epoll_Error : exception; type Epoll_Descriptor is private; type Epoll_Flags is record Readable : Boolean; -- EPOLLIN Writable : Boolean; -- EPOLLOUT Peer_Shutdown : Boolean; -- EPOLLRDHUP Out_Of_Band : Boolean; -- EPOLLPRI Error : Boolean; -- EPOLLERR Hang_Up : Boolean; -- EPOLLHUP Edge_Triggered : Boolean; -- EPOLLET One_Shot : Boolean; -- EPOLLONESHOT Wake_Up : Boolean; -- EPOLLWAKEUP Exclusive : Boolean; -- EPOLLEXCLUSIVE end record with Size => 32; for Epoll_Flags use record Readable at 0 range 0 .. 0; Out_Of_Band at 0 range 1 .. 1; Writable at 0 range 2 .. 2; Error at 0 range 3 .. 3; Hang_Up at 0 range 4 .. 4; Peer_Shutdown at 0 range 13 .. 13; Exclusive at 0 range 28 .. 28; Wake_Up at 0 range 29 .. 29; One_Shot at 0 range 30 .. 30; Edge_Triggered at 0 range 31 .. 31; end record; type Epoll_Event is record Flags : Epoll_Flags := (others => False); Data : Unsigned_64 := -1; end record with Pack, Convention => C_Pass_By_Copy; type Epoll_Events is array (Integer range <>) of Epoll_Event with Convention => C; type Epoll_Operation is (Add, Delete, Modify) with Size => 32; for Epoll_Operation use (1, 2, 3); function Create return Epoll_Descriptor; procedure Control (This : Epoll_Descriptor; Socket : Socket_Type; Op : Epoll_Operation; Event : access Epoll_Event); function Wait (This : Epoll_Descriptor; Max_Events : Positive := 1; Timeout : Integer := -1) return Epoll_Events; private type Epoll_Descriptor is new int; end Epoll;
true
-- -- Copyright (C) 2022 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Interfaces.C; use Interfaces.C; with Interfaces; use Interfaces; with GNAT.Sockets; use GNAT.Sockets; package Epoll is Epoll_Error : exception; type Epoll_Descriptor is private; type Epoll_Flags is record Readable : Boolean; -- EPOLLIN Writable : Boolean; -- EPOLLOUT Peer_Shutdown : Boolean; -- EPOLLRDHUP Out_Of_Band : Boolean; -- EPOLLPRI Error : Boolean; -- EPOLLERR Hang_Up : Boolean; -- EPOLLHUP Edge_Triggered : Boolean; -- EPOLLET One_Shot : Boolean; -- EPOLLONESHOT Wake_Up : Boolean; -- EPOLLWAKEUP Exclusive : Boolean; -- EPOLLEXCLUSIVE end record with Size => 32; for Epoll_Flags use record Readable at 0 range 0 .. 0; Out_Of_Band at 0 range 1 .. 1; Writable at 0 range 2 .. 2; Error at 0 range 3 .. 3; Hang_Up at 0 range 4 .. 4; Peer_Shutdown at 0 range 13 .. 13; Exclusive at 0 range 28 .. 28; Wake_Up at 0 range 29 .. 29; One_Shot at 0 range 30 .. 30; Edge_Triggered at 0 range 31 .. 31; end record; type Epoll_Event is record Flags : Epoll_Flags := (others => False); Data : Unsigned_64 := -1; end record with Pack, Convention => C_Pass_By_Copy; type Epoll_Events is array (Integer range <>) of Epoll_Event with Convention => C; type Epoll_Operation is (Add, Delete, Modify) with Size => 32; for Epoll_Operation use (1, 2, 3); function Create return Epoll_Descriptor; procedure Control (This : Epoll_Descriptor; Socket : Socket_Type; Op : Epoll_Operation; Event : access Epoll_Event); function Wait (This : Epoll_Descriptor; Max_Events : Positive := 1; Timeout : Integer := -1) return Epoll_Events; private type Epoll_Descriptor is new int; end Epoll;
[ { "context": " --\n-- Copyright © 2016-2020, Vadim Godunko <[email protected]> --\n-- All rig", "end": 671, "score": 0.999885618686676, "start": 658, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2016-2020, Vadim Godunko <[email protected]> --\n-- All rights reserved. ", "end": 691, "score": 0.9999329447746277, "start": 673, "tag": "EMAIL", "value": "[email protected]" }, { "context": " --\n-- * Neither the name of the Vadim Godunko, IE nor the names of its --\n-- ", "end": 1773, "score": 0.7140375375747681, "start": 1769, "tag": "NAME", "value": "adim" } ]
examples/servlets/web_sockets/source/servlets-hello.adb
reznikmm/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Examples Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, 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.Wide_Wide_Text_IO; with League.Stream_Element_Vectors; with Web_Socket.Connections; package body Servlets.Hello is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; Max_Count : constant := 5; type WS_Handler_Access is access all WS_Handler'Class; ------------ -- Do_Get -- ------------ overriding procedure Do_Get (Self : in out Hello_Servlet; Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class; Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class) is H : WS_Handler_Access := new WS_Handler; begin H.WS.Set_Web_Socket_Listener (H.all'Access); Request.Upgrade (H.WS'Access); Response.Set_Status (Servlet.HTTP_Responses.Switching_Protocols); end Do_Get; ---------------------- -- Get_Servlet_Info -- ---------------------- overriding function Get_Servlet_Info (Self : Hello_Servlet) return League.Strings.Universal_String is pragma Unreferenced (Self); Text : constant Wide_Wide_String := "Hello servlet provides WebSocket upgrade responses"; begin return +Text; end Get_Servlet_Info; ----------------- -- Instantiate -- ----------------- overriding function Instantiate (Parameters : not null access Servlet.Generic_Servlets.Instantiation_Parameters'Class) return Hello_Servlet is pragma Unreferenced (Parameters); begin return (Servlet.HTTP_Servlets.HTTP_Servlet with null record); end Instantiate; --------------- -- On_Binary -- --------------- overriding procedure On_Binary (Self : in out WS_Handler; Data : Ada.Streams.Stream_Element_Array) is Vector : League.Stream_Element_Vectors.Stream_Element_Vector; begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Binary:" & Natural'Wide_Wide_Image (Data'Length)); if Self.Count < Max_Count then Self.Count := Self.Count + 1; Vector.Append (Data); Web_Socket.Connections.Connection'Class (Self.WS). Send_Binary (Vector); -- Web_Socket.Handlers.AWS_Handlers.Send_Binary (Self.WS, Vector); -- Self.WS.Send_Binary (Vector); end if; end On_Binary; -------------- -- On_Close -- -------------- overriding procedure On_Close (Self : in out WS_Handler; Status : Web_Socket.Listeners.Status_Code; Reason : League.Strings.Universal_String) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Close: " & Web_Socket.Listeners.Status_Code'Wide_Wide_Image (Status) & Reason.To_Wide_Wide_String); end On_Close; ---------------- -- On_Connect -- ---------------- overriding procedure On_Connect (Self : in out WS_Handler) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Connect"); end On_Connect; -------------- -- On_Error -- -------------- overriding procedure On_Error (Self : in out WS_Handler) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Error"); end On_Error; ------------- -- On_Text -- ------------- overriding procedure On_Text (Self : in out WS_Handler; Text : League.Strings.Universal_String) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Text: " & Text.To_Wide_Wide_String); if Self.Count < Max_Count then Self.Count := Self.Count + 1; Web_Socket.Connections.Connection'Class (Self.WS). Send_Text (Text); end if; end On_Text; end Servlets.Hello;
15506
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Examples Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, <NAME> <<EMAIL>> -- -- 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 V<NAME> 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.Wide_Wide_Text_IO; with League.Stream_Element_Vectors; with Web_Socket.Connections; package body Servlets.Hello is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; Max_Count : constant := 5; type WS_Handler_Access is access all WS_Handler'Class; ------------ -- Do_Get -- ------------ overriding procedure Do_Get (Self : in out Hello_Servlet; Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class; Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class) is H : WS_Handler_Access := new WS_Handler; begin H.WS.Set_Web_Socket_Listener (H.all'Access); Request.Upgrade (H.WS'Access); Response.Set_Status (Servlet.HTTP_Responses.Switching_Protocols); end Do_Get; ---------------------- -- Get_Servlet_Info -- ---------------------- overriding function Get_Servlet_Info (Self : Hello_Servlet) return League.Strings.Universal_String is pragma Unreferenced (Self); Text : constant Wide_Wide_String := "Hello servlet provides WebSocket upgrade responses"; begin return +Text; end Get_Servlet_Info; ----------------- -- Instantiate -- ----------------- overriding function Instantiate (Parameters : not null access Servlet.Generic_Servlets.Instantiation_Parameters'Class) return Hello_Servlet is pragma Unreferenced (Parameters); begin return (Servlet.HTTP_Servlets.HTTP_Servlet with null record); end Instantiate; --------------- -- On_Binary -- --------------- overriding procedure On_Binary (Self : in out WS_Handler; Data : Ada.Streams.Stream_Element_Array) is Vector : League.Stream_Element_Vectors.Stream_Element_Vector; begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Binary:" & Natural'Wide_Wide_Image (Data'Length)); if Self.Count < Max_Count then Self.Count := Self.Count + 1; Vector.Append (Data); Web_Socket.Connections.Connection'Class (Self.WS). Send_Binary (Vector); -- Web_Socket.Handlers.AWS_Handlers.Send_Binary (Self.WS, Vector); -- Self.WS.Send_Binary (Vector); end if; end On_Binary; -------------- -- On_Close -- -------------- overriding procedure On_Close (Self : in out WS_Handler; Status : Web_Socket.Listeners.Status_Code; Reason : League.Strings.Universal_String) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Close: " & Web_Socket.Listeners.Status_Code'Wide_Wide_Image (Status) & Reason.To_Wide_Wide_String); end On_Close; ---------------- -- On_Connect -- ---------------- overriding procedure On_Connect (Self : in out WS_Handler) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Connect"); end On_Connect; -------------- -- On_Error -- -------------- overriding procedure On_Error (Self : in out WS_Handler) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Error"); end On_Error; ------------- -- On_Text -- ------------- overriding procedure On_Text (Self : in out WS_Handler; Text : League.Strings.Universal_String) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Text: " & Text.To_Wide_Wide_String); if Self.Count < Max_Count then Self.Count := Self.Count + 1; Web_Socket.Connections.Connection'Class (Self.WS). Send_Text (Text); end if; end On_Text; end Servlets.Hello;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Examples Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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 VPI:NAME:<NAME>END_PI 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.Wide_Wide_Text_IO; with League.Stream_Element_Vectors; with Web_Socket.Connections; package body Servlets.Hello is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; Max_Count : constant := 5; type WS_Handler_Access is access all WS_Handler'Class; ------------ -- Do_Get -- ------------ overriding procedure Do_Get (Self : in out Hello_Servlet; Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class; Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class) is H : WS_Handler_Access := new WS_Handler; begin H.WS.Set_Web_Socket_Listener (H.all'Access); Request.Upgrade (H.WS'Access); Response.Set_Status (Servlet.HTTP_Responses.Switching_Protocols); end Do_Get; ---------------------- -- Get_Servlet_Info -- ---------------------- overriding function Get_Servlet_Info (Self : Hello_Servlet) return League.Strings.Universal_String is pragma Unreferenced (Self); Text : constant Wide_Wide_String := "Hello servlet provides WebSocket upgrade responses"; begin return +Text; end Get_Servlet_Info; ----------------- -- Instantiate -- ----------------- overriding function Instantiate (Parameters : not null access Servlet.Generic_Servlets.Instantiation_Parameters'Class) return Hello_Servlet is pragma Unreferenced (Parameters); begin return (Servlet.HTTP_Servlets.HTTP_Servlet with null record); end Instantiate; --------------- -- On_Binary -- --------------- overriding procedure On_Binary (Self : in out WS_Handler; Data : Ada.Streams.Stream_Element_Array) is Vector : League.Stream_Element_Vectors.Stream_Element_Vector; begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Binary:" & Natural'Wide_Wide_Image (Data'Length)); if Self.Count < Max_Count then Self.Count := Self.Count + 1; Vector.Append (Data); Web_Socket.Connections.Connection'Class (Self.WS). Send_Binary (Vector); -- Web_Socket.Handlers.AWS_Handlers.Send_Binary (Self.WS, Vector); -- Self.WS.Send_Binary (Vector); end if; end On_Binary; -------------- -- On_Close -- -------------- overriding procedure On_Close (Self : in out WS_Handler; Status : Web_Socket.Listeners.Status_Code; Reason : League.Strings.Universal_String) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Close: " & Web_Socket.Listeners.Status_Code'Wide_Wide_Image (Status) & Reason.To_Wide_Wide_String); end On_Close; ---------------- -- On_Connect -- ---------------- overriding procedure On_Connect (Self : in out WS_Handler) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Connect"); end On_Connect; -------------- -- On_Error -- -------------- overriding procedure On_Error (Self : in out WS_Handler) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Error"); end On_Error; ------------- -- On_Text -- ------------- overriding procedure On_Text (Self : in out WS_Handler; Text : League.Strings.Universal_String) is begin Ada.Wide_Wide_Text_IO.Put_Line ("On_Text: " & Text.To_Wide_Wide_String); if Self.Count < Max_Count then Self.Count := Self.Count + 1; Web_Socket.Connections.Connection'Class (Self.WS). Send_Text (Text); end if; end On_Text; end Servlets.Hello;
[ { "context": "ation and off in the body.\n\n-- Copyright (c) 2015, James Humphry - see LICENSE file for details\n\nwith System.Stora", "end": 180, "score": 0.9998406171798706, "start": 167, "tag": "NAME", "value": "James Humphry" } ]
src/general-provable/integer_storage_io.ads
jhumphry/SPARK_SipHash
5
-- Integer_Storage_IO -- A re-implementation of Storage_IO for Integers with SPARK_Mode turned on in -- the specification and off in the body. -- Copyright (c) 2015, James Humphry - see LICENSE file for details with System.Storage_Elements; pragma Warnings (Off, "no procedure exists that can initialize abstract state"); -- The references to the Heap as an Abstract_State of the package are necessary -- for SPARK GPL 2016 but cause a (non-fatal) warning in SPARK Discovery GPL -- 2017. package Integer_Storage_IO with SPARK_Mode => On, Abstract_State => Heap -- This is necessary for SPARK GPL 2016 is pragma Warnings (On, "no procedure exists that can initialize abstract state"); use type System.Storage_Elements.Storage_Offset; Buffer_Size : constant System.Storage_Elements.Storage_Count := (Integer'Size + 7) / 8; subtype Buffer_Type is System.Storage_Elements.Storage_Array(1..Buffer_Size); procedure Read (Buffer : in Buffer_Type; Item : out Integer); procedure Write(Buffer : out Buffer_Type; Item : in Integer) with Global => (Input => Heap); end Integer_Storage_IO;
27936
-- Integer_Storage_IO -- A re-implementation of Storage_IO for Integers with SPARK_Mode turned on in -- the specification and off in the body. -- Copyright (c) 2015, <NAME> - see LICENSE file for details with System.Storage_Elements; pragma Warnings (Off, "no procedure exists that can initialize abstract state"); -- The references to the Heap as an Abstract_State of the package are necessary -- for SPARK GPL 2016 but cause a (non-fatal) warning in SPARK Discovery GPL -- 2017. package Integer_Storage_IO with SPARK_Mode => On, Abstract_State => Heap -- This is necessary for SPARK GPL 2016 is pragma Warnings (On, "no procedure exists that can initialize abstract state"); use type System.Storage_Elements.Storage_Offset; Buffer_Size : constant System.Storage_Elements.Storage_Count := (Integer'Size + 7) / 8; subtype Buffer_Type is System.Storage_Elements.Storage_Array(1..Buffer_Size); procedure Read (Buffer : in Buffer_Type; Item : out Integer); procedure Write(Buffer : out Buffer_Type; Item : in Integer) with Global => (Input => Heap); end Integer_Storage_IO;
true
-- Integer_Storage_IO -- A re-implementation of Storage_IO for Integers with SPARK_Mode turned on in -- the specification and off in the body. -- Copyright (c) 2015, PI:NAME:<NAME>END_PI - see LICENSE file for details with System.Storage_Elements; pragma Warnings (Off, "no procedure exists that can initialize abstract state"); -- The references to the Heap as an Abstract_State of the package are necessary -- for SPARK GPL 2016 but cause a (non-fatal) warning in SPARK Discovery GPL -- 2017. package Integer_Storage_IO with SPARK_Mode => On, Abstract_State => Heap -- This is necessary for SPARK GPL 2016 is pragma Warnings (On, "no procedure exists that can initialize abstract state"); use type System.Storage_Elements.Storage_Offset; Buffer_Size : constant System.Storage_Elements.Storage_Count := (Integer'Size + 7) / 8; subtype Buffer_Type is System.Storage_Elements.Storage_Array(1..Buffer_Size); procedure Read (Buffer : in Buffer_Type; Item : out Integer); procedure Write(Buffer : out Buffer_Type; Item : in Integer) with Global => (Input => Heap); end Integer_Storage_IO;
[ { "context": "ols -- HTTP Utility Library\n-- Copyright (C) 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 154, "score": 0.9998728036880493, "start": 139, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2012 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 185, "score": 0.9998791813850403, "start": 170, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "2 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 212, "score": 0.9999273419380188, "start": 187, "tag": "EMAIL", "value": "[email protected]" } ]
src/http/util-http-tools.adb
Letractively/ada-util
60
----------------------------------------------------------------------- -- util-http-tools -- HTTP Utility Library -- 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.Strings.Unbounded; with Util.Files; package body Util.Http.Tools is -- ------------------------------ -- Save the content stored in the HTTP response into a file. -- The response headers are saved only when <b>Save_Headers</b> is true. -- ------------------------------ procedure Save_Response (Path : in String; Response : in Abstract_Response'Class; Save_Headers : in Boolean := False) is procedure Write_Header (Name : in String; Value : in String); Data : Ada.Strings.Unbounded.Unbounded_String; procedure Write_Header (Name : in String; Value : in String) is begin Ada.Strings.Unbounded.Append (Data, Name); Ada.Strings.Unbounded.Append (Data, ": "); Ada.Strings.Unbounded.Append (Data, Value); Ada.Strings.Unbounded.Append (Data, ASCII.CR & ASCII.LF); end Write_Header; begin if Save_Headers then Response.Iterate_Headers (Write_Header'Access); end if; Ada.Strings.Unbounded.Append (Data, Response.Get_Body); Util.Files.Write_File (Path => Path, Content => Ada.Strings.Unbounded.To_String (Data)); end Save_Response; end Util.Http.Tools;
15564
----------------------------------------------------------------------- -- util-http-tools -- HTTP Utility Library -- Copyright (C) 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Files; package body Util.Http.Tools is -- ------------------------------ -- Save the content stored in the HTTP response into a file. -- The response headers are saved only when <b>Save_Headers</b> is true. -- ------------------------------ procedure Save_Response (Path : in String; Response : in Abstract_Response'Class; Save_Headers : in Boolean := False) is procedure Write_Header (Name : in String; Value : in String); Data : Ada.Strings.Unbounded.Unbounded_String; procedure Write_Header (Name : in String; Value : in String) is begin Ada.Strings.Unbounded.Append (Data, Name); Ada.Strings.Unbounded.Append (Data, ": "); Ada.Strings.Unbounded.Append (Data, Value); Ada.Strings.Unbounded.Append (Data, ASCII.CR & ASCII.LF); end Write_Header; begin if Save_Headers then Response.Iterate_Headers (Write_Header'Access); end if; Ada.Strings.Unbounded.Append (Data, Response.Get_Body); Util.Files.Write_File (Path => Path, Content => Ada.Strings.Unbounded.To_String (Data)); end Save_Response; end Util.Http.Tools;
true
----------------------------------------------------------------------- -- util-http-tools -- HTTP Utility Library -- Copyright (C) 2012 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Files; package body Util.Http.Tools is -- ------------------------------ -- Save the content stored in the HTTP response into a file. -- The response headers are saved only when <b>Save_Headers</b> is true. -- ------------------------------ procedure Save_Response (Path : in String; Response : in Abstract_Response'Class; Save_Headers : in Boolean := False) is procedure Write_Header (Name : in String; Value : in String); Data : Ada.Strings.Unbounded.Unbounded_String; procedure Write_Header (Name : in String; Value : in String) is begin Ada.Strings.Unbounded.Append (Data, Name); Ada.Strings.Unbounded.Append (Data, ": "); Ada.Strings.Unbounded.Append (Data, Value); Ada.Strings.Unbounded.Append (Data, ASCII.CR & ASCII.LF); end Write_Header; begin if Save_Headers then Response.Iterate_Headers (Write_Header'Access); end if; Ada.Strings.Unbounded.Append (Data, Response.Get_Body); Util.Files.Write_File (Path => Path, Content => Ada.Strings.Unbounded.To_String (Data)); end Save_Response; end Util.Http.Tools;
[ { "context": "perations\n-- Copyright (C) 2014, 2015, 2016, 2021 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 195, "score": 0.9998794794082642, "start": 180, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "4, 2015, 2016, 2021 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 226, "score": 0.9998857378959656, "start": 211, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "1 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 253, "score": 0.9999291300773621, "start": 228, "tag": "EMAIL", "value": "[email protected]" } ]
regtests/systems/util-systems-os-tests.adb
RREE/ada-util
60
----------------------------------------------------------------------- -- util-systems-os-tests -- Unit tests for OS specific operations -- Copyright (C) 2014, 2015, 2016, 2021 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.Directories; with Util.Test_Caller; with Util.Systems.Types; with Interfaces.C.Strings; package body Util.Systems.Os.Tests is package Caller is new Util.Test_Caller (Test, "Systems.OS"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Systems.Os.Sys_Stat (File)", Test_Stat'Access); Caller.Add_Test (Suite, "Test Util.Systems.Os.Sys_Stat (Directory)", Test_Stat_Directory'Access); end Add_Tests; -- ------------------------------ -- Test the Sys_Stat operation. -- ------------------------------ procedure Test_Stat (T : in out Test) is use Interfaces.C; use Util.Systems.Types; Info : array (1 .. 2) of aliased Util.Systems.Types.Stat_Type; Path : constant String := Util.Tests.Get_Path ("regtests/files/test-1.json"); Name : Util.Systems.Os.Ptr := Interfaces.C.Strings.New_String (Path); Res : Integer; begin Info (2).st_dev := 16#12345678#; Res := Sys_Stat (Name, Info (1)'Unchecked_Access); T.Assert (Res = 0, "Sys_Stat must return 0"); T.Assert (Info (1).st_size > 0, "Sys_Stat must return the correct size"); T.Assert (Info (2).st_dev = 16#12345678#, "Suspecting invalid size for Stat_Type"); T.Assert (Info (1).st_size = off_t (Ada.Directories.Size (Path)), "Invalid size returned by Sys_Stat"); T.Assert ((Info (1).st_mode and S_IFMT) = S_IFREG, "st_mode must indicate a regular file"); Interfaces.C.Strings.Free (Name); end Test_Stat; -- ------------------------------ -- Test the Sys_Stat operation. -- ------------------------------ procedure Test_Stat_Directory (T : in out Test) is use Interfaces.C; use Util.Systems.Types; Stat : aliased Util.Systems.Types.Stat_Type; Path : constant String := Util.Tests.Get_Path ("regtests/files"); Name : Util.Systems.Os.Ptr := Interfaces.C.Strings.New_String (Path); Res : Integer; begin Res := Sys_Stat (Name, Stat'Unchecked_Access); T.Assert (Res = 0, "Sys_Stat must return 0"); T.Assert ((Stat.st_mode and S_IFMT) = S_IFDIR, "st_mode must indicate a directory"); Interfaces.C.Strings.Free (Name); end Test_Stat_Directory; end Util.Systems.Os.Tests;
15147
----------------------------------------------------------------------- -- util-systems-os-tests -- Unit tests for OS specific operations -- Copyright (C) 2014, 2015, 2016, 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Util.Test_Caller; with Util.Systems.Types; with Interfaces.C.Strings; package body Util.Systems.Os.Tests is package Caller is new Util.Test_Caller (Test, "Systems.OS"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Systems.Os.Sys_Stat (File)", Test_Stat'Access); Caller.Add_Test (Suite, "Test Util.Systems.Os.Sys_Stat (Directory)", Test_Stat_Directory'Access); end Add_Tests; -- ------------------------------ -- Test the Sys_Stat operation. -- ------------------------------ procedure Test_Stat (T : in out Test) is use Interfaces.C; use Util.Systems.Types; Info : array (1 .. 2) of aliased Util.Systems.Types.Stat_Type; Path : constant String := Util.Tests.Get_Path ("regtests/files/test-1.json"); Name : Util.Systems.Os.Ptr := Interfaces.C.Strings.New_String (Path); Res : Integer; begin Info (2).st_dev := 16#12345678#; Res := Sys_Stat (Name, Info (1)'Unchecked_Access); T.Assert (Res = 0, "Sys_Stat must return 0"); T.Assert (Info (1).st_size > 0, "Sys_Stat must return the correct size"); T.Assert (Info (2).st_dev = 16#12345678#, "Suspecting invalid size for Stat_Type"); T.Assert (Info (1).st_size = off_t (Ada.Directories.Size (Path)), "Invalid size returned by Sys_Stat"); T.Assert ((Info (1).st_mode and S_IFMT) = S_IFREG, "st_mode must indicate a regular file"); Interfaces.C.Strings.Free (Name); end Test_Stat; -- ------------------------------ -- Test the Sys_Stat operation. -- ------------------------------ procedure Test_Stat_Directory (T : in out Test) is use Interfaces.C; use Util.Systems.Types; Stat : aliased Util.Systems.Types.Stat_Type; Path : constant String := Util.Tests.Get_Path ("regtests/files"); Name : Util.Systems.Os.Ptr := Interfaces.C.Strings.New_String (Path); Res : Integer; begin Res := Sys_Stat (Name, Stat'Unchecked_Access); T.Assert (Res = 0, "Sys_Stat must return 0"); T.Assert ((Stat.st_mode and S_IFMT) = S_IFDIR, "st_mode must indicate a directory"); Interfaces.C.Strings.Free (Name); end Test_Stat_Directory; end Util.Systems.Os.Tests;
true
----------------------------------------------------------------------- -- util-systems-os-tests -- Unit tests for OS specific operations -- Copyright (C) 2014, 2015, 2016, 2021 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Util.Test_Caller; with Util.Systems.Types; with Interfaces.C.Strings; package body Util.Systems.Os.Tests is package Caller is new Util.Test_Caller (Test, "Systems.OS"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Systems.Os.Sys_Stat (File)", Test_Stat'Access); Caller.Add_Test (Suite, "Test Util.Systems.Os.Sys_Stat (Directory)", Test_Stat_Directory'Access); end Add_Tests; -- ------------------------------ -- Test the Sys_Stat operation. -- ------------------------------ procedure Test_Stat (T : in out Test) is use Interfaces.C; use Util.Systems.Types; Info : array (1 .. 2) of aliased Util.Systems.Types.Stat_Type; Path : constant String := Util.Tests.Get_Path ("regtests/files/test-1.json"); Name : Util.Systems.Os.Ptr := Interfaces.C.Strings.New_String (Path); Res : Integer; begin Info (2).st_dev := 16#12345678#; Res := Sys_Stat (Name, Info (1)'Unchecked_Access); T.Assert (Res = 0, "Sys_Stat must return 0"); T.Assert (Info (1).st_size > 0, "Sys_Stat must return the correct size"); T.Assert (Info (2).st_dev = 16#12345678#, "Suspecting invalid size for Stat_Type"); T.Assert (Info (1).st_size = off_t (Ada.Directories.Size (Path)), "Invalid size returned by Sys_Stat"); T.Assert ((Info (1).st_mode and S_IFMT) = S_IFREG, "st_mode must indicate a regular file"); Interfaces.C.Strings.Free (Name); end Test_Stat; -- ------------------------------ -- Test the Sys_Stat operation. -- ------------------------------ procedure Test_Stat_Directory (T : in out Test) is use Interfaces.C; use Util.Systems.Types; Stat : aliased Util.Systems.Types.Stat_Type; Path : constant String := Util.Tests.Get_Path ("regtests/files"); Name : Util.Systems.Os.Ptr := Interfaces.C.Strings.New_String (Path); Res : Integer; begin Res := Sys_Stat (Name, Stat'Unchecked_Access); T.Assert (Res = 0, "Sys_Stat must return 0"); T.Assert ((Stat.st_mode and S_IFMT) = S_IFDIR, "st_mode must indicate a directory"); Interfaces.C.Strings.Free (Name); end Test_Stat_Directory; end Util.Systems.Os.Tests;
[ { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rig", "end": 829, "score": 0.9998888969421387, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ", "end": 849, "score": 0.9999304413795471, "start": 831, "tag": "EMAIL", "value": "[email protected]" } ]
source/uaflex/matreshka-internals-finite_automatons.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- 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 Ada.Containers.Ordered_Maps; with Ada.Containers.Vectors; with League.Character_Sets; with League.String_Vectors; with League.Strings; with Matreshka.Internals.Graphs; with Matreshka.Internals.Regexps; package Matreshka.Internals.Finite_Automatons is subtype State is Matreshka.Internals.Graphs.Node_Index; use type State; package Vectors is new Ada.Containers.Vectors (Index_Type => Matreshka.Internals.Graphs.Edge_Identifier, Element_Type => League.Character_Sets.Universal_Character_Set, "=" => League.Character_Sets."="); subtype Rule_Index is Positive; package State_Maps is new Ada.Containers.Ordered_Maps (Key_Type => State, Element_Type => Rule_Index); package Start_Maps is new Ada.Containers.Ordered_Maps (Key_Type => League.Strings.Universal_String, Element_Type => State, "<" => League.Strings."<"); type DFA is limited record Start : Start_Maps.Map; Graph : Matreshka.Internals.Graphs.Graph; Edge_Char_Set : Vectors.Vector; Final : State_Maps.Map; end record; type Rule_Index_Array is array (Positive range <>) of Rule_Index; type DFA_Constructor is tagged limited private; type Shared_Pattern_Array is array (Positive range <>) of Matreshka.Internals.Regexps.Shared_Pattern_Access; -- List of regexp procedure Compile (Self : in out DFA_Constructor; Start : League.Strings.Universal_String; List : Shared_Pattern_Array; Actions : Rule_Index_Array); procedure Compile (Self : in out DFA_Constructor; Start : League.Strings.Universal_String; List : League.String_Vectors.Universal_String_Vector; Actions : Rule_Index_Array); procedure Complete (Input : in out DFA_Constructor; Output : out DFA); procedure Minimize (Self : in out DFA); private type DFA_Constructor is tagged limited record Start : Start_Maps.Map; Graph : Matreshka.Internals.Graphs.Constructor.Graph; Edge_Char_Set : Vectors.Vector; Final : State_Maps.Map; end record; end Matreshka.Internals.Finite_Automatons;
5627
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- 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.Ordered_Maps; with Ada.Containers.Vectors; with League.Character_Sets; with League.String_Vectors; with League.Strings; with Matreshka.Internals.Graphs; with Matreshka.Internals.Regexps; package Matreshka.Internals.Finite_Automatons is subtype State is Matreshka.Internals.Graphs.Node_Index; use type State; package Vectors is new Ada.Containers.Vectors (Index_Type => Matreshka.Internals.Graphs.Edge_Identifier, Element_Type => League.Character_Sets.Universal_Character_Set, "=" => League.Character_Sets."="); subtype Rule_Index is Positive; package State_Maps is new Ada.Containers.Ordered_Maps (Key_Type => State, Element_Type => Rule_Index); package Start_Maps is new Ada.Containers.Ordered_Maps (Key_Type => League.Strings.Universal_String, Element_Type => State, "<" => League.Strings."<"); type DFA is limited record Start : Start_Maps.Map; Graph : Matreshka.Internals.Graphs.Graph; Edge_Char_Set : Vectors.Vector; Final : State_Maps.Map; end record; type Rule_Index_Array is array (Positive range <>) of Rule_Index; type DFA_Constructor is tagged limited private; type Shared_Pattern_Array is array (Positive range <>) of Matreshka.Internals.Regexps.Shared_Pattern_Access; -- List of regexp procedure Compile (Self : in out DFA_Constructor; Start : League.Strings.Universal_String; List : Shared_Pattern_Array; Actions : Rule_Index_Array); procedure Compile (Self : in out DFA_Constructor; Start : League.Strings.Universal_String; List : League.String_Vectors.Universal_String_Vector; Actions : Rule_Index_Array); procedure Complete (Input : in out DFA_Constructor; Output : out DFA); procedure Minimize (Self : in out DFA); private type DFA_Constructor is tagged limited record Start : Start_Maps.Map; Graph : Matreshka.Internals.Graphs.Constructor.Graph; Edge_Char_Set : Vectors.Vector; Final : State_Maps.Map; end record; end Matreshka.Internals.Finite_Automatons;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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.Ordered_Maps; with Ada.Containers.Vectors; with League.Character_Sets; with League.String_Vectors; with League.Strings; with Matreshka.Internals.Graphs; with Matreshka.Internals.Regexps; package Matreshka.Internals.Finite_Automatons is subtype State is Matreshka.Internals.Graphs.Node_Index; use type State; package Vectors is new Ada.Containers.Vectors (Index_Type => Matreshka.Internals.Graphs.Edge_Identifier, Element_Type => League.Character_Sets.Universal_Character_Set, "=" => League.Character_Sets."="); subtype Rule_Index is Positive; package State_Maps is new Ada.Containers.Ordered_Maps (Key_Type => State, Element_Type => Rule_Index); package Start_Maps is new Ada.Containers.Ordered_Maps (Key_Type => League.Strings.Universal_String, Element_Type => State, "<" => League.Strings."<"); type DFA is limited record Start : Start_Maps.Map; Graph : Matreshka.Internals.Graphs.Graph; Edge_Char_Set : Vectors.Vector; Final : State_Maps.Map; end record; type Rule_Index_Array is array (Positive range <>) of Rule_Index; type DFA_Constructor is tagged limited private; type Shared_Pattern_Array is array (Positive range <>) of Matreshka.Internals.Regexps.Shared_Pattern_Access; -- List of regexp procedure Compile (Self : in out DFA_Constructor; Start : League.Strings.Universal_String; List : Shared_Pattern_Array; Actions : Rule_Index_Array); procedure Compile (Self : in out DFA_Constructor; Start : League.Strings.Universal_String; List : League.String_Vectors.Universal_String_Vector; Actions : Rule_Index_Array); procedure Complete (Input : in out DFA_Constructor; Output : out DFA); procedure Minimize (Self : in out DFA); private type DFA_Constructor is tagged limited record Start : Start_Maps.Map; Graph : Matreshka.Internals.Graphs.Constructor.Graph; Edge_Char_Set : Vectors.Vector; Final : State_Maps.Map; end record; end Matreshka.Internals.Finite_Automatons;
[ { "context": "----------\n-- Fichier : foret.ads\n-- Auteur : MOUDDENE Hamza & CAZES Noa\n-- Objectif : Spécification du modul", "end": 135, "score": 0.9998688697814941, "start": 121, "tag": "NAME", "value": "MOUDDENE Hamza" }, { "context": "chier : foret.ads\n-- Auteur : MOUDDENE Hamza & CAZES Noa\n-- Objectif : Spécification du module Ensemble\n-", "end": 147, "score": 0.9998773336410522, "start": 138, "tag": "NAME", "value": "CAZES Noa" }, { "context": " : Spécification du module Ensemble\n-- Crée : Dimanche Nov 10 2019\n-------------------------------------", "end": 219, "score": 0.9091398119926453, "start": 211, "tag": "NAME", "value": "Dimanche" } ]
1A/S5/PIM/projet/src/ensemble.ads
MOUDDENEHamza/ENSEEIHT
4
-------------------------------------------------------------------------------- -- Fichier : foret.ads -- Auteur : MOUDDENE Hamza & CAZES Noa -- Objectif : Spécification du module Ensemble -- Crée : Dimanche Nov 10 2019 -------------------------------------------------------------------------------- generic type T_Element is private; -- Type des éléments de l'ensemble. package Ensemble is type T_Ensemble is private; ----------------------------------Constuctor---------------------------------- -- Initilaiser un ensemble. L'ensemble est vide. -- -- Param Ensemble : Ensembe qu'on va initialiser. procedure Initialiser (Ensemble : out T_Ensemble) with Post => Est_Vide (Ensemble); -- Copier un ensemble dans un autre. -- -- Param E1 : E1 dont on va lui copier un deuxième ensemble. -- Param E2 : E2 l'ensemble copié dans E1. procedure Copy (E1 : in out T_Ensemble; E2 : in T_Ensemble); -- Ajouter l'élément à l'ensemble. procedure Ajouter (Ensemble : in out T_Ensemble; Element : in T_Element) with Pre => not(Est_Present (Ensemble, Element)), Post => Est_Present (Ensemble, Element); -----------------------------------Getters---------------------------------- -- Nom : Get_Element -- Sémantique : Obtenir le noeud du pointeur. -- Type_De_Retour : T_Element est la valeur du pointeur. -- Paramètres -- E : E que l'on va parcourir. function Get_Element (E : in T_Ensemble) return T_Element; -- Nom : Get_Next -- Sémantique : Obtenir le pointeur suivant. -- Type_De_Retour : T_Ensemble : Est le pointeur sur la case suivante. -- Paramètre : -- E -- L'ensemble qu'on va parcourir. function Get_Next (E : in T_Ensemble) return T_Ensemble; -----------------------------------Setters---------------------------------- -- Nom : Set_Element -- Sémantique : Changer le noeud du pointeur. -- Paramètres -- E : E que l'on va parcourir. -- Element : L'element qu'on va mettre dans Element. procedure Set_Element (E : in T_Ensemble; Element : in T_Element); -- Nom : Set_Next -- Sémantique : Changer le pointeur suivant. -- Paramètre : -- E -- L'ensemble qu'on va parcourir. -- Next -- Le pointeur suivant procedure Set_Next (E : in T_Ensemble; Next : in T_Ensemble); ---------------------------------------------------------------------------- -- Détruire un ensemble (libérer les ressources qu’il utilise). procedure Detruire (Ensemble : in out T_Ensemble) with Post => Est_Vide (Ensemble); -- Est-ce que l'ensemble est vide ? function Est_Vide (Ensemble : in T_Ensemble) return Boolean; -- Obtenir la taille d'un ensemble ? function Taille (Ensemble : in T_Ensemble) return Integer; -- L'élément est-il présent dans l'ensemble. function Est_Present (Ensemble : in T_Ensemble; Element : in T_Element) return Boolean; -- Nom : Edit_Set -- Sémantique : Modifier un element de l'ensemble. -- Paramètre : -- Ensemble : L'ensemble qu'on va parcourir. -- Old_Element : L'element qu'on va changer. -- New_Element : L'element qu'on va mettre en place. procedure Edit_Set (Ensemble : in T_Ensemble; Old_Element, New_Element : in T_Element); -- Nom : Supprimer -- Sémantique : Supprimer un element de l'ensemble. -- Paramètre : -- Ensemble : L'ensemble qu'on va parcourir. -- Ab : L'arbre avant la modification. procedure Supprimer (Ensemble : in out T_Ensemble; Element : in T_Element) with Pre => not Est_Vide (Ensemble) and Est_Present (Ensemble, Element), Post => not(Est_Present (Ensemble, Element)); -- Appliquer une opération sur les éléments de l'ensemble. generic with procedure Afficher_Elt (Un_Element: in T_Element); procedure Afficher_Ensemble (Ensemble : in T_Ensemble); private type T_Cellule; -- T_Ensemble est un pointeur sur T_Cellule. type T_Ensemble is access T_Cellule; type T_Cellule is record Element: T_Element; -- la valeur de la cellule. Suivant: T_Ensemble; -- un pointeur sur la cellule suivante. end record; end Ensemble;
25674
-------------------------------------------------------------------------------- -- Fichier : foret.ads -- Auteur : <NAME> & <NAME> -- Objectif : Spécification du module Ensemble -- Crée : <NAME> Nov 10 2019 -------------------------------------------------------------------------------- generic type T_Element is private; -- Type des éléments de l'ensemble. package Ensemble is type T_Ensemble is private; ----------------------------------Constuctor---------------------------------- -- Initilaiser un ensemble. L'ensemble est vide. -- -- Param Ensemble : Ensembe qu'on va initialiser. procedure Initialiser (Ensemble : out T_Ensemble) with Post => Est_Vide (Ensemble); -- Copier un ensemble dans un autre. -- -- Param E1 : E1 dont on va lui copier un deuxième ensemble. -- Param E2 : E2 l'ensemble copié dans E1. procedure Copy (E1 : in out T_Ensemble; E2 : in T_Ensemble); -- Ajouter l'élément à l'ensemble. procedure Ajouter (Ensemble : in out T_Ensemble; Element : in T_Element) with Pre => not(Est_Present (Ensemble, Element)), Post => Est_Present (Ensemble, Element); -----------------------------------Getters---------------------------------- -- Nom : Get_Element -- Sémantique : Obtenir le noeud du pointeur. -- Type_De_Retour : T_Element est la valeur du pointeur. -- Paramètres -- E : E que l'on va parcourir. function Get_Element (E : in T_Ensemble) return T_Element; -- Nom : Get_Next -- Sémantique : Obtenir le pointeur suivant. -- Type_De_Retour : T_Ensemble : Est le pointeur sur la case suivante. -- Paramètre : -- E -- L'ensemble qu'on va parcourir. function Get_Next (E : in T_Ensemble) return T_Ensemble; -----------------------------------Setters---------------------------------- -- Nom : Set_Element -- Sémantique : Changer le noeud du pointeur. -- Paramètres -- E : E que l'on va parcourir. -- Element : L'element qu'on va mettre dans Element. procedure Set_Element (E : in T_Ensemble; Element : in T_Element); -- Nom : Set_Next -- Sémantique : Changer le pointeur suivant. -- Paramètre : -- E -- L'ensemble qu'on va parcourir. -- Next -- Le pointeur suivant procedure Set_Next (E : in T_Ensemble; Next : in T_Ensemble); ---------------------------------------------------------------------------- -- Détruire un ensemble (libérer les ressources qu’il utilise). procedure Detruire (Ensemble : in out T_Ensemble) with Post => Est_Vide (Ensemble); -- Est-ce que l'ensemble est vide ? function Est_Vide (Ensemble : in T_Ensemble) return Boolean; -- Obtenir la taille d'un ensemble ? function Taille (Ensemble : in T_Ensemble) return Integer; -- L'élément est-il présent dans l'ensemble. function Est_Present (Ensemble : in T_Ensemble; Element : in T_Element) return Boolean; -- Nom : Edit_Set -- Sémantique : Modifier un element de l'ensemble. -- Paramètre : -- Ensemble : L'ensemble qu'on va parcourir. -- Old_Element : L'element qu'on va changer. -- New_Element : L'element qu'on va mettre en place. procedure Edit_Set (Ensemble : in T_Ensemble; Old_Element, New_Element : in T_Element); -- Nom : Supprimer -- Sémantique : Supprimer un element de l'ensemble. -- Paramètre : -- Ensemble : L'ensemble qu'on va parcourir. -- Ab : L'arbre avant la modification. procedure Supprimer (Ensemble : in out T_Ensemble; Element : in T_Element) with Pre => not Est_Vide (Ensemble) and Est_Present (Ensemble, Element), Post => not(Est_Present (Ensemble, Element)); -- Appliquer une opération sur les éléments de l'ensemble. generic with procedure Afficher_Elt (Un_Element: in T_Element); procedure Afficher_Ensemble (Ensemble : in T_Ensemble); private type T_Cellule; -- T_Ensemble est un pointeur sur T_Cellule. type T_Ensemble is access T_Cellule; type T_Cellule is record Element: T_Element; -- la valeur de la cellule. Suivant: T_Ensemble; -- un pointeur sur la cellule suivante. end record; end Ensemble;
true
-------------------------------------------------------------------------------- -- Fichier : foret.ads -- Auteur : PI:NAME:<NAME>END_PI & PI:NAME:<NAME>END_PI -- Objectif : Spécification du module Ensemble -- Crée : PI:NAME:<NAME>END_PI Nov 10 2019 -------------------------------------------------------------------------------- generic type T_Element is private; -- Type des éléments de l'ensemble. package Ensemble is type T_Ensemble is private; ----------------------------------Constuctor---------------------------------- -- Initilaiser un ensemble. L'ensemble est vide. -- -- Param Ensemble : Ensembe qu'on va initialiser. procedure Initialiser (Ensemble : out T_Ensemble) with Post => Est_Vide (Ensemble); -- Copier un ensemble dans un autre. -- -- Param E1 : E1 dont on va lui copier un deuxième ensemble. -- Param E2 : E2 l'ensemble copié dans E1. procedure Copy (E1 : in out T_Ensemble; E2 : in T_Ensemble); -- Ajouter l'élément à l'ensemble. procedure Ajouter (Ensemble : in out T_Ensemble; Element : in T_Element) with Pre => not(Est_Present (Ensemble, Element)), Post => Est_Present (Ensemble, Element); -----------------------------------Getters---------------------------------- -- Nom : Get_Element -- Sémantique : Obtenir le noeud du pointeur. -- Type_De_Retour : T_Element est la valeur du pointeur. -- Paramètres -- E : E que l'on va parcourir. function Get_Element (E : in T_Ensemble) return T_Element; -- Nom : Get_Next -- Sémantique : Obtenir le pointeur suivant. -- Type_De_Retour : T_Ensemble : Est le pointeur sur la case suivante. -- Paramètre : -- E -- L'ensemble qu'on va parcourir. function Get_Next (E : in T_Ensemble) return T_Ensemble; -----------------------------------Setters---------------------------------- -- Nom : Set_Element -- Sémantique : Changer le noeud du pointeur. -- Paramètres -- E : E que l'on va parcourir. -- Element : L'element qu'on va mettre dans Element. procedure Set_Element (E : in T_Ensemble; Element : in T_Element); -- Nom : Set_Next -- Sémantique : Changer le pointeur suivant. -- Paramètre : -- E -- L'ensemble qu'on va parcourir. -- Next -- Le pointeur suivant procedure Set_Next (E : in T_Ensemble; Next : in T_Ensemble); ---------------------------------------------------------------------------- -- Détruire un ensemble (libérer les ressources qu’il utilise). procedure Detruire (Ensemble : in out T_Ensemble) with Post => Est_Vide (Ensemble); -- Est-ce que l'ensemble est vide ? function Est_Vide (Ensemble : in T_Ensemble) return Boolean; -- Obtenir la taille d'un ensemble ? function Taille (Ensemble : in T_Ensemble) return Integer; -- L'élément est-il présent dans l'ensemble. function Est_Present (Ensemble : in T_Ensemble; Element : in T_Element) return Boolean; -- Nom : Edit_Set -- Sémantique : Modifier un element de l'ensemble. -- Paramètre : -- Ensemble : L'ensemble qu'on va parcourir. -- Old_Element : L'element qu'on va changer. -- New_Element : L'element qu'on va mettre en place. procedure Edit_Set (Ensemble : in T_Ensemble; Old_Element, New_Element : in T_Element); -- Nom : Supprimer -- Sémantique : Supprimer un element de l'ensemble. -- Paramètre : -- Ensemble : L'ensemble qu'on va parcourir. -- Ab : L'arbre avant la modification. procedure Supprimer (Ensemble : in out T_Ensemble; Element : in T_Element) with Pre => not Est_Vide (Ensemble) and Est_Present (Ensemble, Element), Post => not(Est_Present (Ensemble, Element)); -- Appliquer une opération sur les éléments de l'ensemble. generic with procedure Afficher_Elt (Un_Element: in T_Element); procedure Afficher_Ensemble (Ensemble : in T_Ensemble); private type T_Cellule; -- T_Ensemble est un pointeur sur T_Cellule. type T_Ensemble is access T_Cellule; type T_Cellule is record Element: T_Element; -- la valeur de la cellule. Suivant: T_Ensemble; -- un pointeur sur la cellule suivante. end record; end Ensemble;
[ { "context": "----------------------\n-- Copyright (c) 2013-2018 Luke A. Guest\n--\n-- This software is provided 'as-is', without", "end": 158, "score": 0.9997104406356812, "start": 145, "tag": "NAME", "value": "Luke A. Guest" } ]
src/sdl-inputs-mice.ads
alire-project/sdlada
0
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Inputs.Mice -------------------------------------------------------------------------------------------------------------------- with SDL.Events.Mice; with SDL.Video.Windows; package SDL.Inputs.Mice is Mice_Error : exception; type Cursor_Toggles is (Off, On); for Cursor_Toggles use (Off => 0, On => 1); type Supported is (Yes, No); -- TODO: Re-enable this when the library links against 2.0.4! -- function Capture (Enabled : in Boolean) return Supported; -- SDL_CreateColorCursor -- SDL_CreateCursor -- SDL_CreateSystemCursor -- SDL_FreeCursor -- SDL_GetCursor -- SDL_GetDefaultCursor -- TODO: Re-enable this when the library links against 2.0.4! -- function Get_Global_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return -- SDL.Events.Mice.Button_Masks; -- SDL_GetMouseFocus function Get_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return SDL.Events.Mice.Button_Masks; function In_Relative_Mode return Boolean; function Get_Relative_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return SDL.Events.Mice.Button_Masks; -- SDL_SetCursor procedure Set_Relative_Mode (Enable : in Boolean); -- SDL_ShowCursor -- TODO: Re-enable this when the library links against 2.0.4! -- Move the mouse to (x, y) on the screen. -- procedure Warp (X, Y : in SDL.Events.Mice.Screen_Coordinates); -- -- Move the mouse to (x, y) in the specified window. -- procedure Warp (Window : in SDL.Video.Windows.Window; X, Y : in SDL.Events.Mice.Window_Coordinates); end SDL.Inputs.Mice;
30712
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 <NAME> -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Inputs.Mice -------------------------------------------------------------------------------------------------------------------- with SDL.Events.Mice; with SDL.Video.Windows; package SDL.Inputs.Mice is Mice_Error : exception; type Cursor_Toggles is (Off, On); for Cursor_Toggles use (Off => 0, On => 1); type Supported is (Yes, No); -- TODO: Re-enable this when the library links against 2.0.4! -- function Capture (Enabled : in Boolean) return Supported; -- SDL_CreateColorCursor -- SDL_CreateCursor -- SDL_CreateSystemCursor -- SDL_FreeCursor -- SDL_GetCursor -- SDL_GetDefaultCursor -- TODO: Re-enable this when the library links against 2.0.4! -- function Get_Global_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return -- SDL.Events.Mice.Button_Masks; -- SDL_GetMouseFocus function Get_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return SDL.Events.Mice.Button_Masks; function In_Relative_Mode return Boolean; function Get_Relative_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return SDL.Events.Mice.Button_Masks; -- SDL_SetCursor procedure Set_Relative_Mode (Enable : in Boolean); -- SDL_ShowCursor -- TODO: Re-enable this when the library links against 2.0.4! -- Move the mouse to (x, y) on the screen. -- procedure Warp (X, Y : in SDL.Events.Mice.Screen_Coordinates); -- -- Move the mouse to (x, y) in the specified window. -- procedure Warp (Window : in SDL.Video.Windows.Window; X, Y : in SDL.Events.Mice.Window_Coordinates); end SDL.Inputs.Mice;
true
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 PI:NAME:<NAME>END_PI -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Inputs.Mice -------------------------------------------------------------------------------------------------------------------- with SDL.Events.Mice; with SDL.Video.Windows; package SDL.Inputs.Mice is Mice_Error : exception; type Cursor_Toggles is (Off, On); for Cursor_Toggles use (Off => 0, On => 1); type Supported is (Yes, No); -- TODO: Re-enable this when the library links against 2.0.4! -- function Capture (Enabled : in Boolean) return Supported; -- SDL_CreateColorCursor -- SDL_CreateCursor -- SDL_CreateSystemCursor -- SDL_FreeCursor -- SDL_GetCursor -- SDL_GetDefaultCursor -- TODO: Re-enable this when the library links against 2.0.4! -- function Get_Global_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return -- SDL.Events.Mice.Button_Masks; -- SDL_GetMouseFocus function Get_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return SDL.Events.Mice.Button_Masks; function In_Relative_Mode return Boolean; function Get_Relative_State (X_Relative, Y_Relative : out SDL.Events.Mice.Movement_Values) return SDL.Events.Mice.Button_Masks; -- SDL_SetCursor procedure Set_Relative_Mode (Enable : in Boolean); -- SDL_ShowCursor -- TODO: Re-enable this when the library links against 2.0.4! -- Move the mouse to (x, y) on the screen. -- procedure Warp (X, Y : in SDL.Events.Mice.Screen_Coordinates); -- -- Move the mouse to (x, y) in the specified window. -- procedure Warp (Window : in SDL.Video.Windows.Window; X, Y : in SDL.Events.Mice.Window_Coordinates); end SDL.Inputs.Mice;
[ { "context": "-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>\n--\n-- Licensed under the Apac", "end": 44, "score": 0.9998728036880493, "start": 22, "tag": "NAME", "value": "Bartek thindil Jasicki" }, { "context": "-- Copyright (c) 2021 Bartek thindil Jasicki <[email protected]>\n--\n-- Licensed under the Apache License, Version", "end": 63, "score": 0.9999332427978516, "start": 46, "tag": "EMAIL", "value": "[email protected]" } ]
src/tk/tk-labelframe.ads
thindil/tashy2
2
-- Copyright (c) 2021 Bartek thindil Jasicki <[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 Tk.Frame; use Tk.Frame; with Tk.Widget; use Tk.Widget; with Tcl.Strings; use Tcl.Strings; -- ****h* Tk/Labelframe -- FUNCTION -- Provides code for manipulate Tk widget labelframe -- SOURCE package Tk.Labelframe is pragma Elaborate_Body; -- **** --## rule off REDUCEABLE_SCOPE -- ****t* Labelframe/Labelframe.Tk_Label_Frame -- FUNCTION -- The Tk identifier of the labelframe -- HISTORY -- 8.6.0 - Added -- SOURCE subtype Tk_Label_Frame is Tk_Widget; -- **** --## rule off TYPE_INITIAL_VALUES -- ****s* Labelframe/Labelframe.Label_Frame_Options -- FUNCTION -- Data structure for all available options for the Tk labelframe which can -- be changed after creation of a widget -- OPTIONS -- Background - Normal Background color of the labelframe -- Border_Width - The width of the labelframe's border -- Height - Height of the labelframe. -- Highlight_Background - Highlight traversal region background color for -- the labelframe -- Highlight_Color - Highlight traversal rectangle color for the -- labelframe -- Highlight_Thickness - The width of highlight traversal rectangle for the -- labelframe -- Label_Anchor - The direction where to place the label of Tk -- labelframe. Works only when Text option isn't empty -- Label_Widget - Tk_Widget used as a label for Tk labelframe. -- Menu - Menu widget which will be used as menubar in the -- labelframe -- Pad_X - Extra space requested for the labelframe in -- X-direction -- Pad_Y - Extra space requested for the labelframe in -- Y-direction -- Relief - 3-D effect desired for the labelframe -- Text - The text which will be displayed in label of Tk -- labelframe -- Width - Width of the labelframe -- HISTORY -- 8.6.0 - Added -- SOURCE type Label_Frame_Options is new Frame_Options with record Label_Anchor: Anchor_Directions := NONE; Label_Widget: Tk_Widget := Null_Widget; Text: Tcl_String := Null_Tcl_String; end record; -- **** --## rule on TYPE_INITIAL_VALUES -- ****f* Labelframe/Labelframe.Configure -- FUNCTION -- Set the selected options for the selected labelframe -- PARAMETERS -- Frame_Widget - Tk_Label_Frame which options will be set -- Options - The record with new values for the labelframe options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set background to black for labelframe My_Frame -- Configure(My_Frame, (Background => To_Tcl_String("black"), others => <>)); -- SEE ALSO -- Labelframe.Get_Options -- COMMANDS -- Widget configure Options -- SOURCE overriding procedure Configure (Frame_Widget: Tk_Label_Frame; Options: Label_Frame_Options) with Pre'Class => Frame_Widget /= Null_Widget, Test_Case => (Name => "Test_Configure_Label_Frame", Mode => Nominal); -- **** --## rule off TYPE_INITIAL_VALUES -- ****s* Labelframe/Labelframe.Frame_Create_Options -- FUNCTION -- Data structure for additional frame widget options which can be set -- only during creating a widget -- OPTIONS -- Class - The name of the class for the widget -- Color_Map - The name of the color map used by the widget. Can be -- `new` or name of the color map from another widget -- Visual - Type of visual information for the widget -- HISTORY -- 8.6.0 - Added -- SOURCE type Label_Frame_Create_Options is new Label_Frame_Options with record Class: Tcl_String; Color_Map: Tcl_String; Container: Extended_Boolean; Visual: Tcl_String; end record; -- **** --## rule on TYPE_INITIAL_VALUES -- ****f* Labelframe/Labelframe.Create_(function) -- FUNCTION -- Create a new Tk labelframe widget with the selected pathname and options -- PARAMETERS -- Path_Name - Tk pathname for the newly created labelframe -- Options - Options for the newly created labelframe -- Interpreter - Tcl interpreter on which the labelframe will be created. Can -- be empty. Default value is the default Tcl interpreter -- RESULT -- The Tk identifier of the newly created labelframe widget or Null_Widget -- if the frame cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the labelframe with pathname .myframe and black background -- My_Frame: constant Tk_Label_Frame := Create(".myframe", (Background => To_Tcl_String("black"), -- others => <>)); -- SEE ALSO -- Labelframe.Create_(procedure) -- COMMANDS -- labelframe Path_Name Options -- SOURCE function Create (Path_Name: Tk_Path_String; Options: Label_Frame_Create_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tk_Label_Frame with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Label_Frame1", Mode => Nominal); -- **** -- ****f* Labelframe/Labelframe.Create_(procedure) -- FUNCTION -- Create a new Tk labelframe widget with the selected pathname and options -- PARAMETERS -- Frame_Widget - Tk_Label_Frame identifier which will be returned -- Path_Name - Tk pathname for the newly created labelframe -- Options - Options for the newly created labelframe -- Interpreter - Tcl interpreter on which the labelframe will be created. Can -- be empty. Default value is the default Tcl interpreter -- OUTPUT -- The Widget parameter as Tk identifier of the newly created labelframe -- widget or Null_Widget if the frame cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the labelframe with pathname .myframe -- declare -- My_Frame: Tk_Label_Frame; -- begin -- Create(My_Frame, ".myframe", Default_Frame_Create_Options); -- end; -- SEE ALSO -- Labelframe.Create_(function) -- COMMANDS -- labelframe Path_Name Options -- SOURCE procedure Create (Frame_Widget: out Tk_Label_Frame; Path_Name: Tk_Path_String; Options: Label_Frame_Create_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Label_Frame2", Mode => Nominal); -- **** -- ****f* Labelframe/Labelframe.Get_Options -- FUNCTION -- Get all values of Tk options of the selected labelframe -- PARAMETERS -- Frame_Widget - Tk_Label_Frame which options' values will be taken -- RESULT -- Frame_Create_Options record with values of the selected labelframe -- options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get all values of option of labelframe with pathname .myframe -- My_Labe_Frame_Options: constant Label_Frame_Create_Options := Get_Options(Get_Widget(".myframe")); -- COMMANDS -- Widget configure -- SOURCE function Get_Options (Frame_Widget: Tk_Label_Frame) return Label_Frame_Create_Options with Pre'Class => Frame_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Options_Label_Frame", Mode => Nominal); -- **** --## rule on REDUCEABLE_SCOPE end Tk.Labelframe;
19546
-- Copyright (c) 2021 <NAME> <<EMAIL>> -- -- 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 Tk.Frame; use Tk.Frame; with Tk.Widget; use Tk.Widget; with Tcl.Strings; use Tcl.Strings; -- ****h* Tk/Labelframe -- FUNCTION -- Provides code for manipulate Tk widget labelframe -- SOURCE package Tk.Labelframe is pragma Elaborate_Body; -- **** --## rule off REDUCEABLE_SCOPE -- ****t* Labelframe/Labelframe.Tk_Label_Frame -- FUNCTION -- The Tk identifier of the labelframe -- HISTORY -- 8.6.0 - Added -- SOURCE subtype Tk_Label_Frame is Tk_Widget; -- **** --## rule off TYPE_INITIAL_VALUES -- ****s* Labelframe/Labelframe.Label_Frame_Options -- FUNCTION -- Data structure for all available options for the Tk labelframe which can -- be changed after creation of a widget -- OPTIONS -- Background - Normal Background color of the labelframe -- Border_Width - The width of the labelframe's border -- Height - Height of the labelframe. -- Highlight_Background - Highlight traversal region background color for -- the labelframe -- Highlight_Color - Highlight traversal rectangle color for the -- labelframe -- Highlight_Thickness - The width of highlight traversal rectangle for the -- labelframe -- Label_Anchor - The direction where to place the label of Tk -- labelframe. Works only when Text option isn't empty -- Label_Widget - Tk_Widget used as a label for Tk labelframe. -- Menu - Menu widget which will be used as menubar in the -- labelframe -- Pad_X - Extra space requested for the labelframe in -- X-direction -- Pad_Y - Extra space requested for the labelframe in -- Y-direction -- Relief - 3-D effect desired for the labelframe -- Text - The text which will be displayed in label of Tk -- labelframe -- Width - Width of the labelframe -- HISTORY -- 8.6.0 - Added -- SOURCE type Label_Frame_Options is new Frame_Options with record Label_Anchor: Anchor_Directions := NONE; Label_Widget: Tk_Widget := Null_Widget; Text: Tcl_String := Null_Tcl_String; end record; -- **** --## rule on TYPE_INITIAL_VALUES -- ****f* Labelframe/Labelframe.Configure -- FUNCTION -- Set the selected options for the selected labelframe -- PARAMETERS -- Frame_Widget - Tk_Label_Frame which options will be set -- Options - The record with new values for the labelframe options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set background to black for labelframe My_Frame -- Configure(My_Frame, (Background => To_Tcl_String("black"), others => <>)); -- SEE ALSO -- Labelframe.Get_Options -- COMMANDS -- Widget configure Options -- SOURCE overriding procedure Configure (Frame_Widget: Tk_Label_Frame; Options: Label_Frame_Options) with Pre'Class => Frame_Widget /= Null_Widget, Test_Case => (Name => "Test_Configure_Label_Frame", Mode => Nominal); -- **** --## rule off TYPE_INITIAL_VALUES -- ****s* Labelframe/Labelframe.Frame_Create_Options -- FUNCTION -- Data structure for additional frame widget options which can be set -- only during creating a widget -- OPTIONS -- Class - The name of the class for the widget -- Color_Map - The name of the color map used by the widget. Can be -- `new` or name of the color map from another widget -- Visual - Type of visual information for the widget -- HISTORY -- 8.6.0 - Added -- SOURCE type Label_Frame_Create_Options is new Label_Frame_Options with record Class: Tcl_String; Color_Map: Tcl_String; Container: Extended_Boolean; Visual: Tcl_String; end record; -- **** --## rule on TYPE_INITIAL_VALUES -- ****f* Labelframe/Labelframe.Create_(function) -- FUNCTION -- Create a new Tk labelframe widget with the selected pathname and options -- PARAMETERS -- Path_Name - Tk pathname for the newly created labelframe -- Options - Options for the newly created labelframe -- Interpreter - Tcl interpreter on which the labelframe will be created. Can -- be empty. Default value is the default Tcl interpreter -- RESULT -- The Tk identifier of the newly created labelframe widget or Null_Widget -- if the frame cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the labelframe with pathname .myframe and black background -- My_Frame: constant Tk_Label_Frame := Create(".myframe", (Background => To_Tcl_String("black"), -- others => <>)); -- SEE ALSO -- Labelframe.Create_(procedure) -- COMMANDS -- labelframe Path_Name Options -- SOURCE function Create (Path_Name: Tk_Path_String; Options: Label_Frame_Create_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tk_Label_Frame with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Label_Frame1", Mode => Nominal); -- **** -- ****f* Labelframe/Labelframe.Create_(procedure) -- FUNCTION -- Create a new Tk labelframe widget with the selected pathname and options -- PARAMETERS -- Frame_Widget - Tk_Label_Frame identifier which will be returned -- Path_Name - Tk pathname for the newly created labelframe -- Options - Options for the newly created labelframe -- Interpreter - Tcl interpreter on which the labelframe will be created. Can -- be empty. Default value is the default Tcl interpreter -- OUTPUT -- The Widget parameter as Tk identifier of the newly created labelframe -- widget or Null_Widget if the frame cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the labelframe with pathname .myframe -- declare -- My_Frame: Tk_Label_Frame; -- begin -- Create(My_Frame, ".myframe", Default_Frame_Create_Options); -- end; -- SEE ALSO -- Labelframe.Create_(function) -- COMMANDS -- labelframe Path_Name Options -- SOURCE procedure Create (Frame_Widget: out Tk_Label_Frame; Path_Name: Tk_Path_String; Options: Label_Frame_Create_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Label_Frame2", Mode => Nominal); -- **** -- ****f* Labelframe/Labelframe.Get_Options -- FUNCTION -- Get all values of Tk options of the selected labelframe -- PARAMETERS -- Frame_Widget - Tk_Label_Frame which options' values will be taken -- RESULT -- Frame_Create_Options record with values of the selected labelframe -- options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get all values of option of labelframe with pathname .myframe -- My_Labe_Frame_Options: constant Label_Frame_Create_Options := Get_Options(Get_Widget(".myframe")); -- COMMANDS -- Widget configure -- SOURCE function Get_Options (Frame_Widget: Tk_Label_Frame) return Label_Frame_Create_Options with Pre'Class => Frame_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Options_Label_Frame", Mode => Nominal); -- **** --## rule on REDUCEABLE_SCOPE end Tk.Labelframe;
true
-- Copyright (c) 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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 Tk.Frame; use Tk.Frame; with Tk.Widget; use Tk.Widget; with Tcl.Strings; use Tcl.Strings; -- ****h* Tk/Labelframe -- FUNCTION -- Provides code for manipulate Tk widget labelframe -- SOURCE package Tk.Labelframe is pragma Elaborate_Body; -- **** --## rule off REDUCEABLE_SCOPE -- ****t* Labelframe/Labelframe.Tk_Label_Frame -- FUNCTION -- The Tk identifier of the labelframe -- HISTORY -- 8.6.0 - Added -- SOURCE subtype Tk_Label_Frame is Tk_Widget; -- **** --## rule off TYPE_INITIAL_VALUES -- ****s* Labelframe/Labelframe.Label_Frame_Options -- FUNCTION -- Data structure for all available options for the Tk labelframe which can -- be changed after creation of a widget -- OPTIONS -- Background - Normal Background color of the labelframe -- Border_Width - The width of the labelframe's border -- Height - Height of the labelframe. -- Highlight_Background - Highlight traversal region background color for -- the labelframe -- Highlight_Color - Highlight traversal rectangle color for the -- labelframe -- Highlight_Thickness - The width of highlight traversal rectangle for the -- labelframe -- Label_Anchor - The direction where to place the label of Tk -- labelframe. Works only when Text option isn't empty -- Label_Widget - Tk_Widget used as a label for Tk labelframe. -- Menu - Menu widget which will be used as menubar in the -- labelframe -- Pad_X - Extra space requested for the labelframe in -- X-direction -- Pad_Y - Extra space requested for the labelframe in -- Y-direction -- Relief - 3-D effect desired for the labelframe -- Text - The text which will be displayed in label of Tk -- labelframe -- Width - Width of the labelframe -- HISTORY -- 8.6.0 - Added -- SOURCE type Label_Frame_Options is new Frame_Options with record Label_Anchor: Anchor_Directions := NONE; Label_Widget: Tk_Widget := Null_Widget; Text: Tcl_String := Null_Tcl_String; end record; -- **** --## rule on TYPE_INITIAL_VALUES -- ****f* Labelframe/Labelframe.Configure -- FUNCTION -- Set the selected options for the selected labelframe -- PARAMETERS -- Frame_Widget - Tk_Label_Frame which options will be set -- Options - The record with new values for the labelframe options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Set background to black for labelframe My_Frame -- Configure(My_Frame, (Background => To_Tcl_String("black"), others => <>)); -- SEE ALSO -- Labelframe.Get_Options -- COMMANDS -- Widget configure Options -- SOURCE overriding procedure Configure (Frame_Widget: Tk_Label_Frame; Options: Label_Frame_Options) with Pre'Class => Frame_Widget /= Null_Widget, Test_Case => (Name => "Test_Configure_Label_Frame", Mode => Nominal); -- **** --## rule off TYPE_INITIAL_VALUES -- ****s* Labelframe/Labelframe.Frame_Create_Options -- FUNCTION -- Data structure for additional frame widget options which can be set -- only during creating a widget -- OPTIONS -- Class - The name of the class for the widget -- Color_Map - The name of the color map used by the widget. Can be -- `new` or name of the color map from another widget -- Visual - Type of visual information for the widget -- HISTORY -- 8.6.0 - Added -- SOURCE type Label_Frame_Create_Options is new Label_Frame_Options with record Class: Tcl_String; Color_Map: Tcl_String; Container: Extended_Boolean; Visual: Tcl_String; end record; -- **** --## rule on TYPE_INITIAL_VALUES -- ****f* Labelframe/Labelframe.Create_(function) -- FUNCTION -- Create a new Tk labelframe widget with the selected pathname and options -- PARAMETERS -- Path_Name - Tk pathname for the newly created labelframe -- Options - Options for the newly created labelframe -- Interpreter - Tcl interpreter on which the labelframe will be created. Can -- be empty. Default value is the default Tcl interpreter -- RESULT -- The Tk identifier of the newly created labelframe widget or Null_Widget -- if the frame cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the labelframe with pathname .myframe and black background -- My_Frame: constant Tk_Label_Frame := Create(".myframe", (Background => To_Tcl_String("black"), -- others => <>)); -- SEE ALSO -- Labelframe.Create_(procedure) -- COMMANDS -- labelframe Path_Name Options -- SOURCE function Create (Path_Name: Tk_Path_String; Options: Label_Frame_Create_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) return Tk_Label_Frame with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Label_Frame1", Mode => Nominal); -- **** -- ****f* Labelframe/Labelframe.Create_(procedure) -- FUNCTION -- Create a new Tk labelframe widget with the selected pathname and options -- PARAMETERS -- Frame_Widget - Tk_Label_Frame identifier which will be returned -- Path_Name - Tk pathname for the newly created labelframe -- Options - Options for the newly created labelframe -- Interpreter - Tcl interpreter on which the labelframe will be created. Can -- be empty. Default value is the default Tcl interpreter -- OUTPUT -- The Widget parameter as Tk identifier of the newly created labelframe -- widget or Null_Widget if the frame cannot be created -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Create the labelframe with pathname .myframe -- declare -- My_Frame: Tk_Label_Frame; -- begin -- Create(My_Frame, ".myframe", Default_Frame_Create_Options); -- end; -- SEE ALSO -- Labelframe.Create_(function) -- COMMANDS -- labelframe Path_Name Options -- SOURCE procedure Create (Frame_Widget: out Tk_Label_Frame; Path_Name: Tk_Path_String; Options: Label_Frame_Create_Options; Interpreter: Tcl_Interpreter := Get_Interpreter) with Pre'Class => Path_Name'Length > 0 and Interpreter /= Null_Interpreter, Test_Case => (Name => "Test_Create_Label_Frame2", Mode => Nominal); -- **** -- ****f* Labelframe/Labelframe.Get_Options -- FUNCTION -- Get all values of Tk options of the selected labelframe -- PARAMETERS -- Frame_Widget - Tk_Label_Frame which options' values will be taken -- RESULT -- Frame_Create_Options record with values of the selected labelframe -- options -- HISTORY -- 8.6.0 - Added -- EXAMPLE -- -- Get all values of option of labelframe with pathname .myframe -- My_Labe_Frame_Options: constant Label_Frame_Create_Options := Get_Options(Get_Widget(".myframe")); -- COMMANDS -- Widget configure -- SOURCE function Get_Options (Frame_Widget: Tk_Label_Frame) return Label_Frame_Create_Options with Pre'Class => Frame_Widget /= Null_Widget, Test_Case => (Name => "Test_Get_Options_Label_Frame", Mode => Nominal); -- **** --## rule on REDUCEABLE_SCOPE end Tk.Labelframe;
[ { "context": "----------\n-- Fichier : input.ads\n-- Auteur : MOUDDENE Hamza & CAZES Noa\n-- Objectif : Spécification du modul", "end": 135, "score": 0.9998744130134583, "start": 121, "tag": "NAME", "value": "MOUDDENE Hamza" }, { "context": "chier : input.ads\n-- Auteur : MOUDDENE Hamza & CAZES Noa\n-- Objectif : Spécification du module Input\n-- ", "end": 147, "score": 0.9998857378959656, "start": 138, "tag": "NAME", "value": "CAZES Noa" }, { "context": "tif : Spécification du module Input\n-- Crée : Dimanche Déc 01 2019\n------------------------------------------", "end": 220, "score": 0.9124441146850586, "start": 208, "tag": "NAME", "value": "Dimanche Déc" } ]
1A/S5/PIM/projet/src/input.ads
MOUDDENEHamza/ENSEEIHT
4
-------------------------------------------------------------------------------- -- Fichier : input.ads -- Auteur : MOUDDENE Hamza & CAZES Noa -- Objectif : Spécification du module Input -- Crée : Dimanche Déc 01 2019 -------------------------------------------------------------------------------- with Registre; use Registre; package Input is -- lire au clavier un entier quelconque. -- -- Param Value : Value est l'entier lu au clavier. -- -- Exception : DATA_ERROR_EXCEPTION. procedure Input_Integer (Value : out Integer); -- Entrer le choix du menu. -- -- Param Choice : Choice est le choix d'une option dans le menu. procedure Input_Choice (Choice : out Integer); -- Entrer le sexe d'un individu. function Input_Sex return Character; -- Entrer les données personnelles d'une personne. -- -- Return T_Donnee : T_Donnee est le type qui contient les données personnelles d'une personne. function Demander_Donnee return T_Donnee; -- Entrer l'ID d'un individu. -- -- Param ID : ID lu au clavier. -- Param Message : Message associé à chaque opération de saisie. procedure Input_ID (ID : out Integer; Message : in String); -- Entrer si le parent que vous souhaiterez ajouter est le père ou la mère. -- Entrer 0 s'il s'agit d'un père, 1 si c'est la mère. -- -- Param Flag : Flag 0 si c'est le père, 1 si c'est la mère. procedure Input_Flag (Flag : out Integer); -- Entrez la géneration des ancetres. -- -- Param Generation : La génération des ancestres. procedure Input_Generation (Generation : out Integer); end Input;
16279
-------------------------------------------------------------------------------- -- Fichier : input.ads -- Auteur : <NAME> & <NAME> -- Objectif : Spécification du module Input -- Crée : <NAME> 01 2019 -------------------------------------------------------------------------------- with Registre; use Registre; package Input is -- lire au clavier un entier quelconque. -- -- Param Value : Value est l'entier lu au clavier. -- -- Exception : DATA_ERROR_EXCEPTION. procedure Input_Integer (Value : out Integer); -- Entrer le choix du menu. -- -- Param Choice : Choice est le choix d'une option dans le menu. procedure Input_Choice (Choice : out Integer); -- Entrer le sexe d'un individu. function Input_Sex return Character; -- Entrer les données personnelles d'une personne. -- -- Return T_Donnee : T_Donnee est le type qui contient les données personnelles d'une personne. function Demander_Donnee return T_Donnee; -- Entrer l'ID d'un individu. -- -- Param ID : ID lu au clavier. -- Param Message : Message associé à chaque opération de saisie. procedure Input_ID (ID : out Integer; Message : in String); -- Entrer si le parent que vous souhaiterez ajouter est le père ou la mère. -- Entrer 0 s'il s'agit d'un père, 1 si c'est la mère. -- -- Param Flag : Flag 0 si c'est le père, 1 si c'est la mère. procedure Input_Flag (Flag : out Integer); -- Entrez la géneration des ancetres. -- -- Param Generation : La génération des ancestres. procedure Input_Generation (Generation : out Integer); end Input;
true
-------------------------------------------------------------------------------- -- Fichier : input.ads -- Auteur : PI:NAME:<NAME>END_PI & PI:NAME:<NAME>END_PI -- Objectif : Spécification du module Input -- Crée : PI:NAME:<NAME>END_PI 01 2019 -------------------------------------------------------------------------------- with Registre; use Registre; package Input is -- lire au clavier un entier quelconque. -- -- Param Value : Value est l'entier lu au clavier. -- -- Exception : DATA_ERROR_EXCEPTION. procedure Input_Integer (Value : out Integer); -- Entrer le choix du menu. -- -- Param Choice : Choice est le choix d'une option dans le menu. procedure Input_Choice (Choice : out Integer); -- Entrer le sexe d'un individu. function Input_Sex return Character; -- Entrer les données personnelles d'une personne. -- -- Return T_Donnee : T_Donnee est le type qui contient les données personnelles d'une personne. function Demander_Donnee return T_Donnee; -- Entrer l'ID d'un individu. -- -- Param ID : ID lu au clavier. -- Param Message : Message associé à chaque opération de saisie. procedure Input_ID (ID : out Integer; Message : in String); -- Entrer si le parent que vous souhaiterez ajouter est le père ou la mère. -- Entrer 0 s'il s'agit d'un père, 1 si c'est la mère. -- -- Param Flag : Flag 0 si c'est le père, 1 si c'est la mère. procedure Input_Flag (Flag : out Integer); -- Entrez la géneration des ancetres. -- -- Param Generation : La génération des ancestres. procedure Input_Generation (Generation : out Integer); end Input;
[ { "context": "-- part of AdaYaml, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 42, "score": 0.9998455047607422, "start": 30, "tag": "NAME", "value": "Felix Krause" } ]
src/implementation/yaml-dom-node_memory.adb
persan/AdaYaml
32
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" package body Yaml.Dom.Node_Memory is procedure Visit (Object : in out Instance; Value : not null access Node.Instance; Previously_Visited : out Boolean) is begin if Object.Data.Contains (Node_Pointer (Value)) then Previously_Visited := True; else Object.Data.Include (Node_Pointer (Value)); Previously_Visited := False; end if; end Visit; procedure Forget (Object : in out Instance; Value : not null access Node.Instance) is begin Object.Data.Exclude (Node_Pointer (Value)); end Forget; function Pop_First (Object : in out Instance) return not null access Node.Instance is First : Pointer_Sets.Cursor := Object.Data.First; begin return Ptr : constant not null access Node.Instance := Pointer_Sets.Element (First) do Object.Data.Delete (First); end return; end Pop_First; function Is_Empty (Object : Instance) return Boolean is (Object.Data.Is_Empty); procedure Visit (Object : in out Pair_Instance; Left, Right : not null access Node.Instance; Previously_Visited : out Boolean) is Pair : constant Pointer_Pair := (Left => Left, Right => Right); begin if Object.Data.Contains (Pair) then Previously_Visited := True; else Object.Data.Include (Pair); Previously_Visited := False; end if; end Visit; end Yaml.Dom.Node_Memory;
8509
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" package body Yaml.Dom.Node_Memory is procedure Visit (Object : in out Instance; Value : not null access Node.Instance; Previously_Visited : out Boolean) is begin if Object.Data.Contains (Node_Pointer (Value)) then Previously_Visited := True; else Object.Data.Include (Node_Pointer (Value)); Previously_Visited := False; end if; end Visit; procedure Forget (Object : in out Instance; Value : not null access Node.Instance) is begin Object.Data.Exclude (Node_Pointer (Value)); end Forget; function Pop_First (Object : in out Instance) return not null access Node.Instance is First : Pointer_Sets.Cursor := Object.Data.First; begin return Ptr : constant not null access Node.Instance := Pointer_Sets.Element (First) do Object.Data.Delete (First); end return; end Pop_First; function Is_Empty (Object : Instance) return Boolean is (Object.Data.Is_Empty); procedure Visit (Object : in out Pair_Instance; Left, Right : not null access Node.Instance; Previously_Visited : out Boolean) is Pair : constant Pointer_Pair := (Left => Left, Right => Right); begin if Object.Data.Contains (Pair) then Previously_Visited := True; else Object.Data.Include (Pair); Previously_Visited := False; end if; end Visit; end Yaml.Dom.Node_Memory;
true
-- part of AdaYaml, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "copying.txt" package body Yaml.Dom.Node_Memory is procedure Visit (Object : in out Instance; Value : not null access Node.Instance; Previously_Visited : out Boolean) is begin if Object.Data.Contains (Node_Pointer (Value)) then Previously_Visited := True; else Object.Data.Include (Node_Pointer (Value)); Previously_Visited := False; end if; end Visit; procedure Forget (Object : in out Instance; Value : not null access Node.Instance) is begin Object.Data.Exclude (Node_Pointer (Value)); end Forget; function Pop_First (Object : in out Instance) return not null access Node.Instance is First : Pointer_Sets.Cursor := Object.Data.First; begin return Ptr : constant not null access Node.Instance := Pointer_Sets.Element (First) do Object.Data.Delete (First); end return; end Pop_First; function Is_Empty (Object : Instance) return Boolean is (Object.Data.Is_Empty); procedure Visit (Object : in out Pair_Instance; Left, Right : not null access Node.Instance; Previously_Visited : out Boolean) is Pair : constant Pointer_Pair := (Left => Left, Right => Right); begin if Object.Data.Contains (Pair) then Previously_Visited := True; else Object.Data.Include (Pair); Previously_Visited := False; end if; end Visit; end Yaml.Dom.Node_Memory;
[ { "context": "-- part of AdaYaml, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 42, "score": 0.9998391270637512, "start": 30, "tag": "NAME", "value": "Felix Krause" } ]
src/implementation/yaml-lexer-evaluation.adb
robdaemon/AdaYaml
32
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Strings.UTF_Encoding.Strings; with Ada.Strings.UTF_Encoding.Wide_Strings; with Ada.Strings.UTF_Encoding.Wide_Wide_Strings; with Text.Builder; package body Yaml.Lexer.Evaluation is ----------------------------------------------------------------------------- -- constant UTF-8 strings that may be generated from escape sequences ----------------------------------------------------------------------------- function Next_Line return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#85#))); function Non_Breaking_Space return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#A0#))); function Line_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Wide_Strings.Encode ("" & Wide_Character'Val (16#2028#))); function Paragraph_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Wide_Strings.Encode ("" & Wide_Character'Val (16#2029#))); ----------------------------------------------------------------------------- -- implementation ----------------------------------------------------------------------------- procedure Read_Plain_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); After_Newline_State : constant State_Type := (if L.Flow_Depth + L.Annotation_Depth = 0 then Line_Indentation'Access else Flow_Line_Indentation'Access); Line_Start_Pos : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>, Kind => Plain_Scalar); Multiline_Loop : loop Line_Start_Pos := L.Pos - 1; Inline_Loop : loop L.Cur := Next (L); case L.Cur is when ' ' => T.End_Pos := Cur_Mark (L); declare Space_Start : constant Positive := L.Pos - 1; begin Space_Loop : loop L.Cur := Next (L); case L.Cur is when Line_Feed | Carriage_Return => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); exit Inline_Loop; when End_Of_Input => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Stream_End'Access; exit Multiline_Loop; when '#' => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Expect_Line_End'Access; exit Multiline_Loop; when ':' => if not Next_Is_Plain_Safe (L) then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when Flow_Indicator => if L.Flow_Depth + L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when ')' => if L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when ' ' => null; when others => exit Space_Loop; end case; end loop Space_Loop; end; when ':' => if not Next_Is_Plain_Safe (L) then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when Flow_Indicator => if L.Flow_Depth + L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when ')' => if L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when Line_Feed | Carriage_Return => Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); exit Inline_Loop; when End_Of_Input => Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); if L.Pos /= L.Line_Start then T.End_Pos := Cur_Mark (L); end if; L.State := Stream_End'Access; exit Multiline_Loop; when others => null; end case; end loop Inline_Loop; End_Line (L); declare Newlines : Positive := 1; begin Newline_Loop : loop case Start_Line (L) is when Content => if L.Pos - L.Line_Start - 1 <= L.Indentation then L.State := After_Newline_State; exit Multiline_Loop; end if; exit Newline_Loop; when Directives_End_Marker => L.State := Line_Dir_End'Access; exit Multiline_Loop; when Document_End_Marker => L.State := Line_Doc_End'Access; exit Multiline_Loop; when Stream_End => exit Multiline_Loop; when Comment => End_Line (L); L.State := Line_Start'Access; exit Multiline_Loop; when Newline => End_Line (L); end case; Newlines := Newlines + 1; end loop Newline_Loop; if (L.Cur = ':' and then not Next_Is_Plain_Safe (L)) or else L.Cur = '#' or else (L.Cur in Flow_Indicator and L.Flow_Depth + L.Annotation_Depth > 0) or else (L.Cur = ')' and L.Annotation_Depth > 0) then L.State := After_Newline_State; exit Multiline_Loop; end if; L.Seen_Multiline := True; if Newlines = 1 then Target.Append (' '); else Target.Append ((1 .. Newlines - 1 => Line_Feed)); end if; end; end loop Multiline_Loop; L.Value := Target.Lock; end Read_Plain_Scalar; procedure Process_Quoted_Whitespace (L : in out Instance; Init : Natural; Target : in out Text.Builder.Reference) is Newlines : Natural := Init; First_Space : constant Positive := L.Pos - 1; begin loop case L.Cur is when ' ' => null; when Line_Feed => Handle_LF (L); L.Cur := L.Next; exit; when Carriage_Return => Handle_CR (L); L.Cur := L.Next; exit; when others => Target.Append (L.Buffer (First_Space .. L.Pos - 2)); return; end case; L.Cur := Next (L); end loop; L.Seen_Multiline := True; loop case Start_Line (L) is when Content | Comment => exit; when Directives_End_Marker => raise Lexer_Error with "Illegal '---' within quoted scalar"; when Document_End_Marker => raise Lexer_Error with "Illegal '...' within quoted scalar"; when Newline => End_Line (L); when Stream_End => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; end case; Newlines := Newlines + 1; end loop; if Newlines = 0 then null; elsif Newlines = 1 then Target.Append (' '); else Target.Append ((1 .. Newlines - 1 => Line_Feed)); end if; end Process_Quoted_Whitespace; procedure Read_Single_Quoted_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); Literal_Start : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; Literal_Start := L.Pos; L.Cur := Next (L); loop case L.Cur is when End_Of_Input => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; when ''' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); if L.Cur = ''' then Target.Append ('''); Literal_Start := L.Pos; L.Cur := Next (L); else exit; end if; when ' ' | Line_Feed | Carriage_Return => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Process_Quoted_Whitespace (L, 1, Target); Literal_Start := L.Pos - 1; when others => L.Cur := Next (L); end case; end loop; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Single_Quoted_Scalar); L.Value := Target.Lock; end Read_Single_Quoted_Scalar; subtype Hex_Code_Point is Natural range 0 .. 16#1FFFFF#; procedure Read_Hex_Sequence (L : in out Instance; Length : Positive; Target : in out Text.Builder.Reference) is Char_Pos : Hex_Code_Point := 0; Start_Pos : constant Positive := L.Pos; begin -- first, we make sure that this is a valid escape sequence. it is -- important to not calculate its value directly because that may lead -- to an overflow before we checked that the escape sequence is -- syntactically correct. We only want to report that the value is out of -- range if it is a valid escape sequence. for I in 0 .. Length - 1 loop if not (L.Buffer (Start_Pos + I) in Digit | 'a' .. 'f' | 'A' .. 'F') then raise Lexer_Error with "Invalid character in hex escape sequence: " & Escaped (L.Buffer (Start_Pos + I)); end if; end loop; for Exponent in reverse 0 .. Length - 1 loop L.Cur := Next (L); case L.Cur is when Digit => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('0')); when 'a' .. 'f' => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('a') + 10); when 'A' .. 'F' => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('A') + 10); when others => null; -- cannot happen because of the check above end case; end loop; Target.Append (Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode ( "" & Wide_Wide_Character'Val (Char_Pos))); exception when Constraint_Error => raise Lexer_Error with "Invalid hex escape sequence (value too large): " & L.Buffer (Start_Pos .. Start_Pos + Length - 1); end Read_Hex_Sequence; procedure Read_Double_Quoted_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); Literal_Start : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; Literal_Start := L.Pos; L.Cur := Next (L); loop <<Handle_Char>> case L.Cur is when End_Of_Input => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; when '\' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); Literal_Start := L.Pos; case L.Cur is when '0' => Target.Append (Character'Val (0)); when 'a' => Target.Append (Character'Val (7)); when 'b' => Target.Append (Character'Val (8)); when 't' | Character'Val (9) => Target.Append (Character'Val (9)); when 'n' => Target.Append (Line_Feed); when 'v' => Target.Append (Character'Val (11)); when 'f' => Target.Append (Character'Val (12)); when 'r' => Target.Append (Carriage_Return); when 'e' => Target.Append (Character'Val (27)); when ' ' | '"' | '/' | '\' => Target.Append (L.Cur); when 'N' => Target.Append (Next_Line); when '_' => Target.Append (Non_Breaking_Space); when 'L' => Target.Append (Line_Separator); when 'P' => Target.Append (Paragraph_Separator); when 'x' => Read_Hex_Sequence (L, 2, Target); Literal_Start := L.Pos; when 'u' => Read_Hex_Sequence (L, 4, Target); Literal_Start := L.Pos; when 'U' => Read_Hex_Sequence (L, 8, Target); Literal_Start := L.Pos; when Line_Feed | Carriage_Return => Process_Quoted_Whitespace (L, 0, Target); Literal_Start := L.Pos - 1; goto Handle_Char; when others => raise Lexer_Error with "Illegal character in escape sequence: " & Escaped (L.Cur); end case; when '"' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; when ' ' | Line_Feed | Carriage_Return => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Process_Quoted_Whitespace (L, 1, Target); Literal_Start := L.Pos - 1; goto Handle_Char; when others => null; end case; L.Cur := Next (L); end loop; L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Double_Quoted_Scalar); L.Value := Target.Lock; end Read_Double_Quoted_Scalar; procedure Read_Block_Scalar (L : in out Instance; T : out Token) is type Chomp_Style is (Clip, Strip, Keep); Chomp : Chomp_Style := Clip; Indent : Natural := 0; Separation_Lines : Natural := 0; Content_Start : Positive; Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); begin Start_Token (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>, Kind => (if L.Cur = '>' then Folded_Scalar else Literal_Scalar)); -- header loop L.Cur := Next (L); case L.Cur is when '+' => if Chomp /= Clip then raise Lexer_Error with "Multiple chomping indicators!"; end if; Chomp := Keep; when '-' => if Chomp /= Clip then raise Lexer_Error with "Multiple chomping indicators!"; end if; Chomp := Strip; when '1' .. '9' => if Indent /= 0 then raise Lexer_Error with "Multiple indentation indicators!"; end if; Indent := Natural'Max (0, L.Indentation) + Character'Pos (L.Cur) - Character'Pos ('0'); when ' ' => while L.Cur = ' ' loop L.Cur := Next (L); end loop; if not (L.Cur in Comment_Or_Line_End) then raise Lexer_Error with "Illegal character after block scalar header: " & Escaped (L.Cur); end if; exit; when Line_End => exit; when others => raise Lexer_Error with "Illegal character in block scalar header: " & Escaped (L.Cur); end case; end loop; End_Line (L); -- determining indentation and leading empty lines declare Max_Leading_Spaces : Natural := 0; begin loop if Indent = 0 then while L.Cur = ' ' loop L.Cur := Next (L); end loop; else Max_Leading_Spaces := L.Line_Start + Indent; while L.Cur = ' ' and L.Pos <= Max_Leading_Spaces loop L.Cur := Next (L); end loop; end if; case L.Cur is when Line_Feed | Carriage_Return => T.End_Pos := Cur_Mark (L); Max_Leading_Spaces := Natural'Max (Max_Leading_Spaces, L.Pos - 1 - L.Line_Start); End_Line (L); Separation_Lines := Separation_Lines + 1; when End_Of_Input => L.State := Stream_End'Access; goto End_Of_Input_Target; when others => if Indent = 0 then Indent := L.Pos - L.Line_Start - 1; if Indent <= Indentation_Type'Max (0, L.Indentation) then L.State := Line_Indentation'Access; goto Finalize; elsif Indent < Max_Leading_Spaces then raise Lexer_Error with "Leading all-spaces line contains too many spaces."; end if; elsif L.Pos - L.Line_Start - 1 < Indent then goto Finalize; end if; exit; end case; end loop; if Separation_Lines > 0 then Target.Append ((1 .. Separation_Lines => Line_Feed)); end if; end; -- read block scalar content Block_Content : loop -- content of line Content_Start := L.Pos - 1; while not (L.Cur in Line_End) loop L.Cur := Next (L); end loop; Target.Append (L.Buffer (Content_Start .. L.Pos - 2)); Separation_Lines := 0; if L.Cur = End_Of_Input then L.State := Stream_End'Access; goto End_Of_Input_Target; end if; Separation_Lines := Separation_Lines + 1; T.End_Pos := Cur_Mark (L); End_Line (L); -- empty lines and indentation of next line loop declare Indent_Pos : constant Natural := L.Line_Start + Indent; begin while L.Cur = ' ' and L.Pos - 1 < Indent_Pos loop L.Cur := Next (L); end loop; case L.Cur is when Carriage_Return | Line_Feed => T.End_Pos := Cur_Mark (L); Separation_Lines := Separation_Lines + 1; End_Line (L); when End_Of_Input => L.State := Stream_End'Access; goto End_Of_Input_Target; when others => if L.Pos - 1 < Indent_Pos then exit Block_Content; else exit; end if; end case; end; end loop; -- line folding if T.Kind = Literal_Scalar then Target.Append ((1 .. Separation_Lines => Line_Feed)); elsif Separation_Lines = 1 then Target.Append (' '); else Target.Append ((1 .. Separation_Lines - 1 => Line_Feed)); end if; end loop Block_Content; if L.Pos - L.Line_Start - 1 > Indentation_Type'Max (0, L.Indentation) then if L.Cur = '#' then L.State := Expect_Line_End'Access; else raise Lexer_Error with "This line at " & Escaped (L.Cur) & " is less indented than necessary." & L.Cur_Line'Img; end if; elsif L.Pos = L.Line_Start + 1 then L.State := Line_Start'Access; else L.State := Line_Indentation'Access; end if; <<Finalize>> T.End_Pos := Cur_Mark (L); goto Finish; <<End_Of_Input_Target>> -- if we encounter the stream end directly after a newline character, -- we must have stored the T.End_Pos beforehand because we cannot -- calculate it back (we do not know how long the recent line was). if L.Pos /= L.Line_Start + 1 then T.End_Pos := Cur_Mark (L); -- the generated End_Pos is *after* the stream end char, which is one -- too far; compensate here. T.End_Pos.Index := T.End_Pos.Index - 1; T.End_Pos.Column := T.End_Pos.Column - 1; end if; <<Finish>> T.End_Pos := Cur_Mark (L); -- handling trailing empty lines case Chomp is when Strip => null; when Clip => if Target.Length > 0 then Target.Append (Line_Feed); end if; when Keep => Target.Append ((1 .. Separation_Lines => Line_Feed)); end case; L.Value := Target.Lock; end Read_Block_Scalar; procedure Read_URI (L : in out Instance; Restricted : Boolean) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); End_With_Space : constant Boolean := L.Cur /= '<'; Literal_Start : Positive; begin if End_With_Space then if (not Restricted) and L.Cur in '[' | ']' | ',' then raise Lexer_Error with "Flow indicator cannot start tag prefix"; end if; Literal_Start := L.Pos - 1; else Literal_Start := L.Pos; L.Cur := Next (L); end if; loop case L.Cur is when Space_Or_Line_End => if End_With_Space then Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; else raise Lexer_Error with "Unclosed verbatim tag"; end if; when '%' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Read_Hex_Sequence (L, 2, Target); Literal_Start := L.Pos; when Tag_Char => null; when '[' | ']' | ',' => if Restricted then Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; end if; when '!' => if Restricted then raise Lexer_Error with "Illegal '!' in tag suffix!"; end if; when '>' => if End_With_Space then raise Lexer_Error with "Illegal character in URI: "">"""; else Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); exit; end if; when others => raise Lexer_Error with "Illegal character in URI: " & Escaped (L.Cur); end case; L.Cur := Next (L); end loop; L.Value := Target.Lock; end Read_URI; end Yaml.Lexer.Evaluation;
26364
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Strings.UTF_Encoding.Strings; with Ada.Strings.UTF_Encoding.Wide_Strings; with Ada.Strings.UTF_Encoding.Wide_Wide_Strings; with Text.Builder; package body Yaml.Lexer.Evaluation is ----------------------------------------------------------------------------- -- constant UTF-8 strings that may be generated from escape sequences ----------------------------------------------------------------------------- function Next_Line return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#85#))); function Non_Breaking_Space return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#A0#))); function Line_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Wide_Strings.Encode ("" & Wide_Character'Val (16#2028#))); function Paragraph_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Wide_Strings.Encode ("" & Wide_Character'Val (16#2029#))); ----------------------------------------------------------------------------- -- implementation ----------------------------------------------------------------------------- procedure Read_Plain_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); After_Newline_State : constant State_Type := (if L.Flow_Depth + L.Annotation_Depth = 0 then Line_Indentation'Access else Flow_Line_Indentation'Access); Line_Start_Pos : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>, Kind => Plain_Scalar); Multiline_Loop : loop Line_Start_Pos := L.Pos - 1; Inline_Loop : loop L.Cur := Next (L); case L.Cur is when ' ' => T.End_Pos := Cur_Mark (L); declare Space_Start : constant Positive := L.Pos - 1; begin Space_Loop : loop L.Cur := Next (L); case L.Cur is when Line_Feed | Carriage_Return => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); exit Inline_Loop; when End_Of_Input => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Stream_End'Access; exit Multiline_Loop; when '#' => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Expect_Line_End'Access; exit Multiline_Loop; when ':' => if not Next_Is_Plain_Safe (L) then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when Flow_Indicator => if L.Flow_Depth + L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when ')' => if L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when ' ' => null; when others => exit Space_Loop; end case; end loop Space_Loop; end; when ':' => if not Next_Is_Plain_Safe (L) then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when Flow_Indicator => if L.Flow_Depth + L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when ')' => if L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when Line_Feed | Carriage_Return => Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); exit Inline_Loop; when End_Of_Input => Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); if L.Pos /= L.Line_Start then T.End_Pos := Cur_Mark (L); end if; L.State := Stream_End'Access; exit Multiline_Loop; when others => null; end case; end loop Inline_Loop; End_Line (L); declare Newlines : Positive := 1; begin Newline_Loop : loop case Start_Line (L) is when Content => if L.Pos - L.Line_Start - 1 <= L.Indentation then L.State := After_Newline_State; exit Multiline_Loop; end if; exit Newline_Loop; when Directives_End_Marker => L.State := Line_Dir_End'Access; exit Multiline_Loop; when Document_End_Marker => L.State := Line_Doc_End'Access; exit Multiline_Loop; when Stream_End => exit Multiline_Loop; when Comment => End_Line (L); L.State := Line_Start'Access; exit Multiline_Loop; when Newline => End_Line (L); end case; Newlines := Newlines + 1; end loop Newline_Loop; if (L.Cur = ':' and then not Next_Is_Plain_Safe (L)) or else L.Cur = '#' or else (L.Cur in Flow_Indicator and L.Flow_Depth + L.Annotation_Depth > 0) or else (L.Cur = ')' and L.Annotation_Depth > 0) then L.State := After_Newline_State; exit Multiline_Loop; end if; L.Seen_Multiline := True; if Newlines = 1 then Target.Append (' '); else Target.Append ((1 .. Newlines - 1 => Line_Feed)); end if; end; end loop Multiline_Loop; L.Value := Target.Lock; end Read_Plain_Scalar; procedure Process_Quoted_Whitespace (L : in out Instance; Init : Natural; Target : in out Text.Builder.Reference) is Newlines : Natural := Init; First_Space : constant Positive := L.Pos - 1; begin loop case L.Cur is when ' ' => null; when Line_Feed => Handle_LF (L); L.Cur := L.Next; exit; when Carriage_Return => Handle_CR (L); L.Cur := L.Next; exit; when others => Target.Append (L.Buffer (First_Space .. L.Pos - 2)); return; end case; L.Cur := Next (L); end loop; L.Seen_Multiline := True; loop case Start_Line (L) is when Content | Comment => exit; when Directives_End_Marker => raise Lexer_Error with "Illegal '---' within quoted scalar"; when Document_End_Marker => raise Lexer_Error with "Illegal '...' within quoted scalar"; when Newline => End_Line (L); when Stream_End => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; end case; Newlines := Newlines + 1; end loop; if Newlines = 0 then null; elsif Newlines = 1 then Target.Append (' '); else Target.Append ((1 .. Newlines - 1 => Line_Feed)); end if; end Process_Quoted_Whitespace; procedure Read_Single_Quoted_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); Literal_Start : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; Literal_Start := L.Pos; L.Cur := Next (L); loop case L.Cur is when End_Of_Input => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; when ''' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); if L.Cur = ''' then Target.Append ('''); Literal_Start := L.Pos; L.Cur := Next (L); else exit; end if; when ' ' | Line_Feed | Carriage_Return => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Process_Quoted_Whitespace (L, 1, Target); Literal_Start := L.Pos - 1; when others => L.Cur := Next (L); end case; end loop; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Single_Quoted_Scalar); L.Value := Target.Lock; end Read_Single_Quoted_Scalar; subtype Hex_Code_Point is Natural range 0 .. 16#1FFFFF#; procedure Read_Hex_Sequence (L : in out Instance; Length : Positive; Target : in out Text.Builder.Reference) is Char_Pos : Hex_Code_Point := 0; Start_Pos : constant Positive := L.Pos; begin -- first, we make sure that this is a valid escape sequence. it is -- important to not calculate its value directly because that may lead -- to an overflow before we checked that the escape sequence is -- syntactically correct. We only want to report that the value is out of -- range if it is a valid escape sequence. for I in 0 .. Length - 1 loop if not (L.Buffer (Start_Pos + I) in Digit | 'a' .. 'f' | 'A' .. 'F') then raise Lexer_Error with "Invalid character in hex escape sequence: " & Escaped (L.Buffer (Start_Pos + I)); end if; end loop; for Exponent in reverse 0 .. Length - 1 loop L.Cur := Next (L); case L.Cur is when Digit => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('0')); when 'a' .. 'f' => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('a') + 10); when 'A' .. 'F' => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('A') + 10); when others => null; -- cannot happen because of the check above end case; end loop; Target.Append (Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode ( "" & Wide_Wide_Character'Val (Char_Pos))); exception when Constraint_Error => raise Lexer_Error with "Invalid hex escape sequence (value too large): " & L.Buffer (Start_Pos .. Start_Pos + Length - 1); end Read_Hex_Sequence; procedure Read_Double_Quoted_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); Literal_Start : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; Literal_Start := L.Pos; L.Cur := Next (L); loop <<Handle_Char>> case L.Cur is when End_Of_Input => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; when '\' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); Literal_Start := L.Pos; case L.Cur is when '0' => Target.Append (Character'Val (0)); when 'a' => Target.Append (Character'Val (7)); when 'b' => Target.Append (Character'Val (8)); when 't' | Character'Val (9) => Target.Append (Character'Val (9)); when 'n' => Target.Append (Line_Feed); when 'v' => Target.Append (Character'Val (11)); when 'f' => Target.Append (Character'Val (12)); when 'r' => Target.Append (Carriage_Return); when 'e' => Target.Append (Character'Val (27)); when ' ' | '"' | '/' | '\' => Target.Append (L.Cur); when 'N' => Target.Append (Next_Line); when '_' => Target.Append (Non_Breaking_Space); when 'L' => Target.Append (Line_Separator); when 'P' => Target.Append (Paragraph_Separator); when 'x' => Read_Hex_Sequence (L, 2, Target); Literal_Start := L.Pos; when 'u' => Read_Hex_Sequence (L, 4, Target); Literal_Start := L.Pos; when 'U' => Read_Hex_Sequence (L, 8, Target); Literal_Start := L.Pos; when Line_Feed | Carriage_Return => Process_Quoted_Whitespace (L, 0, Target); Literal_Start := L.Pos - 1; goto Handle_Char; when others => raise Lexer_Error with "Illegal character in escape sequence: " & Escaped (L.Cur); end case; when '"' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; when ' ' | Line_Feed | Carriage_Return => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Process_Quoted_Whitespace (L, 1, Target); Literal_Start := L.Pos - 1; goto Handle_Char; when others => null; end case; L.Cur := Next (L); end loop; L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Double_Quoted_Scalar); L.Value := Target.Lock; end Read_Double_Quoted_Scalar; procedure Read_Block_Scalar (L : in out Instance; T : out Token) is type Chomp_Style is (Clip, Strip, Keep); Chomp : Chomp_Style := Clip; Indent : Natural := 0; Separation_Lines : Natural := 0; Content_Start : Positive; Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); begin Start_Token (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>, Kind => (if L.Cur = '>' then Folded_Scalar else Literal_Scalar)); -- header loop L.Cur := Next (L); case L.Cur is when '+' => if Chomp /= Clip then raise Lexer_Error with "Multiple chomping indicators!"; end if; Chomp := Keep; when '-' => if Chomp /= Clip then raise Lexer_Error with "Multiple chomping indicators!"; end if; Chomp := Strip; when '1' .. '9' => if Indent /= 0 then raise Lexer_Error with "Multiple indentation indicators!"; end if; Indent := Natural'Max (0, L.Indentation) + Character'Pos (L.Cur) - Character'Pos ('0'); when ' ' => while L.Cur = ' ' loop L.Cur := Next (L); end loop; if not (L.Cur in Comment_Or_Line_End) then raise Lexer_Error with "Illegal character after block scalar header: " & Escaped (L.Cur); end if; exit; when Line_End => exit; when others => raise Lexer_Error with "Illegal character in block scalar header: " & Escaped (L.Cur); end case; end loop; End_Line (L); -- determining indentation and leading empty lines declare Max_Leading_Spaces : Natural := 0; begin loop if Indent = 0 then while L.Cur = ' ' loop L.Cur := Next (L); end loop; else Max_Leading_Spaces := L.Line_Start + Indent; while L.Cur = ' ' and L.Pos <= Max_Leading_Spaces loop L.Cur := Next (L); end loop; end if; case L.Cur is when Line_Feed | Carriage_Return => T.End_Pos := Cur_Mark (L); Max_Leading_Spaces := Natural'Max (Max_Leading_Spaces, L.Pos - 1 - L.Line_Start); End_Line (L); Separation_Lines := Separation_Lines + 1; when End_Of_Input => L.State := Stream_End'Access; goto End_Of_Input_Target; when others => if Indent = 0 then Indent := L.Pos - L.Line_Start - 1; if Indent <= Indentation_Type'Max (0, L.Indentation) then L.State := Line_Indentation'Access; goto Finalize; elsif Indent < Max_Leading_Spaces then raise Lexer_Error with "Leading all-spaces line contains too many spaces."; end if; elsif L.Pos - L.Line_Start - 1 < Indent then goto Finalize; end if; exit; end case; end loop; if Separation_Lines > 0 then Target.Append ((1 .. Separation_Lines => Line_Feed)); end if; end; -- read block scalar content Block_Content : loop -- content of line Content_Start := L.Pos - 1; while not (L.Cur in Line_End) loop L.Cur := Next (L); end loop; Target.Append (L.Buffer (Content_Start .. L.Pos - 2)); Separation_Lines := 0; if L.Cur = End_Of_Input then L.State := Stream_End'Access; goto End_Of_Input_Target; end if; Separation_Lines := Separation_Lines + 1; T.End_Pos := Cur_Mark (L); End_Line (L); -- empty lines and indentation of next line loop declare Indent_Pos : constant Natural := L.Line_Start + Indent; begin while L.Cur = ' ' and L.Pos - 1 < Indent_Pos loop L.Cur := Next (L); end loop; case L.Cur is when Carriage_Return | Line_Feed => T.End_Pos := Cur_Mark (L); Separation_Lines := Separation_Lines + 1; End_Line (L); when End_Of_Input => L.State := Stream_End'Access; goto End_Of_Input_Target; when others => if L.Pos - 1 < Indent_Pos then exit Block_Content; else exit; end if; end case; end; end loop; -- line folding if T.Kind = Literal_Scalar then Target.Append ((1 .. Separation_Lines => Line_Feed)); elsif Separation_Lines = 1 then Target.Append (' '); else Target.Append ((1 .. Separation_Lines - 1 => Line_Feed)); end if; end loop Block_Content; if L.Pos - L.Line_Start - 1 > Indentation_Type'Max (0, L.Indentation) then if L.Cur = '#' then L.State := Expect_Line_End'Access; else raise Lexer_Error with "This line at " & Escaped (L.Cur) & " is less indented than necessary." & L.Cur_Line'Img; end if; elsif L.Pos = L.Line_Start + 1 then L.State := Line_Start'Access; else L.State := Line_Indentation'Access; end if; <<Finalize>> T.End_Pos := Cur_Mark (L); goto Finish; <<End_Of_Input_Target>> -- if we encounter the stream end directly after a newline character, -- we must have stored the T.End_Pos beforehand because we cannot -- calculate it back (we do not know how long the recent line was). if L.Pos /= L.Line_Start + 1 then T.End_Pos := Cur_Mark (L); -- the generated End_Pos is *after* the stream end char, which is one -- too far; compensate here. T.End_Pos.Index := T.End_Pos.Index - 1; T.End_Pos.Column := T.End_Pos.Column - 1; end if; <<Finish>> T.End_Pos := Cur_Mark (L); -- handling trailing empty lines case Chomp is when Strip => null; when Clip => if Target.Length > 0 then Target.Append (Line_Feed); end if; when Keep => Target.Append ((1 .. Separation_Lines => Line_Feed)); end case; L.Value := Target.Lock; end Read_Block_Scalar; procedure Read_URI (L : in out Instance; Restricted : Boolean) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); End_With_Space : constant Boolean := L.Cur /= '<'; Literal_Start : Positive; begin if End_With_Space then if (not Restricted) and L.Cur in '[' | ']' | ',' then raise Lexer_Error with "Flow indicator cannot start tag prefix"; end if; Literal_Start := L.Pos - 1; else Literal_Start := L.Pos; L.Cur := Next (L); end if; loop case L.Cur is when Space_Or_Line_End => if End_With_Space then Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; else raise Lexer_Error with "Unclosed verbatim tag"; end if; when '%' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Read_Hex_Sequence (L, 2, Target); Literal_Start := L.Pos; when Tag_Char => null; when '[' | ']' | ',' => if Restricted then Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; end if; when '!' => if Restricted then raise Lexer_Error with "Illegal '!' in tag suffix!"; end if; when '>' => if End_With_Space then raise Lexer_Error with "Illegal character in URI: "">"""; else Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); exit; end if; when others => raise Lexer_Error with "Illegal character in URI: " & Escaped (L.Cur); end case; L.Cur := Next (L); end loop; L.Value := Target.Lock; end Read_URI; end Yaml.Lexer.Evaluation;
true
-- part of AdaYaml, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Strings.UTF_Encoding.Strings; with Ada.Strings.UTF_Encoding.Wide_Strings; with Ada.Strings.UTF_Encoding.Wide_Wide_Strings; with Text.Builder; package body Yaml.Lexer.Evaluation is ----------------------------------------------------------------------------- -- constant UTF-8 strings that may be generated from escape sequences ----------------------------------------------------------------------------- function Next_Line return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#85#))); function Non_Breaking_Space return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#A0#))); function Line_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Wide_Strings.Encode ("" & Wide_Character'Val (16#2028#))); function Paragraph_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is (Ada.Strings.UTF_Encoding.Wide_Strings.Encode ("" & Wide_Character'Val (16#2029#))); ----------------------------------------------------------------------------- -- implementation ----------------------------------------------------------------------------- procedure Read_Plain_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); After_Newline_State : constant State_Type := (if L.Flow_Depth + L.Annotation_Depth = 0 then Line_Indentation'Access else Flow_Line_Indentation'Access); Line_Start_Pos : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>, Kind => Plain_Scalar); Multiline_Loop : loop Line_Start_Pos := L.Pos - 1; Inline_Loop : loop L.Cur := Next (L); case L.Cur is when ' ' => T.End_Pos := Cur_Mark (L); declare Space_Start : constant Positive := L.Pos - 1; begin Space_Loop : loop L.Cur := Next (L); case L.Cur is when Line_Feed | Carriage_Return => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); exit Inline_Loop; when End_Of_Input => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Stream_End'Access; exit Multiline_Loop; when '#' => Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Expect_Line_End'Access; exit Multiline_Loop; when ':' => if not Next_Is_Plain_Safe (L) then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when Flow_Indicator => if L.Flow_Depth + L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when ')' => if L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. Space_Start - 1)); L.State := Inside_Line'Access; exit Multiline_Loop; end if; exit Space_Loop; when ' ' => null; when others => exit Space_Loop; end case; end loop Space_Loop; end; when ':' => if not Next_Is_Plain_Safe (L) then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when Flow_Indicator => if L.Flow_Depth + L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when ')' => if L.Annotation_Depth > 0 then Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); L.State := Inside_Line'Access; exit Multiline_Loop; end if; when Line_Feed | Carriage_Return => Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); T.End_Pos := Cur_Mark (L); exit Inline_Loop; when End_Of_Input => Target.Append (L.Buffer (Line_Start_Pos .. L.Pos - 2)); if L.Pos /= L.Line_Start then T.End_Pos := Cur_Mark (L); end if; L.State := Stream_End'Access; exit Multiline_Loop; when others => null; end case; end loop Inline_Loop; End_Line (L); declare Newlines : Positive := 1; begin Newline_Loop : loop case Start_Line (L) is when Content => if L.Pos - L.Line_Start - 1 <= L.Indentation then L.State := After_Newline_State; exit Multiline_Loop; end if; exit Newline_Loop; when Directives_End_Marker => L.State := Line_Dir_End'Access; exit Multiline_Loop; when Document_End_Marker => L.State := Line_Doc_End'Access; exit Multiline_Loop; when Stream_End => exit Multiline_Loop; when Comment => End_Line (L); L.State := Line_Start'Access; exit Multiline_Loop; when Newline => End_Line (L); end case; Newlines := Newlines + 1; end loop Newline_Loop; if (L.Cur = ':' and then not Next_Is_Plain_Safe (L)) or else L.Cur = '#' or else (L.Cur in Flow_Indicator and L.Flow_Depth + L.Annotation_Depth > 0) or else (L.Cur = ')' and L.Annotation_Depth > 0) then L.State := After_Newline_State; exit Multiline_Loop; end if; L.Seen_Multiline := True; if Newlines = 1 then Target.Append (' '); else Target.Append ((1 .. Newlines - 1 => Line_Feed)); end if; end; end loop Multiline_Loop; L.Value := Target.Lock; end Read_Plain_Scalar; procedure Process_Quoted_Whitespace (L : in out Instance; Init : Natural; Target : in out Text.Builder.Reference) is Newlines : Natural := Init; First_Space : constant Positive := L.Pos - 1; begin loop case L.Cur is when ' ' => null; when Line_Feed => Handle_LF (L); L.Cur := L.Next; exit; when Carriage_Return => Handle_CR (L); L.Cur := L.Next; exit; when others => Target.Append (L.Buffer (First_Space .. L.Pos - 2)); return; end case; L.Cur := Next (L); end loop; L.Seen_Multiline := True; loop case Start_Line (L) is when Content | Comment => exit; when Directives_End_Marker => raise Lexer_Error with "Illegal '---' within quoted scalar"; when Document_End_Marker => raise Lexer_Error with "Illegal '...' within quoted scalar"; when Newline => End_Line (L); when Stream_End => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; end case; Newlines := Newlines + 1; end loop; if Newlines = 0 then null; elsif Newlines = 1 then Target.Append (' '); else Target.Append ((1 .. Newlines - 1 => Line_Feed)); end if; end Process_Quoted_Whitespace; procedure Read_Single_Quoted_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); Literal_Start : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; Literal_Start := L.Pos; L.Cur := Next (L); loop case L.Cur is when End_Of_Input => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; when ''' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); if L.Cur = ''' then Target.Append ('''); Literal_Start := L.Pos; L.Cur := Next (L); else exit; end if; when ' ' | Line_Feed | Carriage_Return => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Process_Quoted_Whitespace (L, 1, Target); Literal_Start := L.Pos - 1; when others => L.Cur := Next (L); end case; end loop; T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Single_Quoted_Scalar); L.Value := Target.Lock; end Read_Single_Quoted_Scalar; subtype Hex_Code_Point is Natural range 0 .. 16#1FFFFF#; procedure Read_Hex_Sequence (L : in out Instance; Length : Positive; Target : in out Text.Builder.Reference) is Char_Pos : Hex_Code_Point := 0; Start_Pos : constant Positive := L.Pos; begin -- first, we make sure that this is a valid escape sequence. it is -- important to not calculate its value directly because that may lead -- to an overflow before we checked that the escape sequence is -- syntactically correct. We only want to report that the value is out of -- range if it is a valid escape sequence. for I in 0 .. Length - 1 loop if not (L.Buffer (Start_Pos + I) in Digit | 'a' .. 'f' | 'A' .. 'F') then raise Lexer_Error with "Invalid character in hex escape sequence: " & Escaped (L.Buffer (Start_Pos + I)); end if; end loop; for Exponent in reverse 0 .. Length - 1 loop L.Cur := Next (L); case L.Cur is when Digit => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('0')); when 'a' .. 'f' => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('a') + 10); when 'A' .. 'F' => Char_Pos := Char_Pos + (16 ** Exponent) * (Character'Pos (L.Cur) - Character'Pos ('A') + 10); when others => null; -- cannot happen because of the check above end case; end loop; Target.Append (Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode ( "" & Wide_Wide_Character'Val (Char_Pos))); exception when Constraint_Error => raise Lexer_Error with "Invalid hex escape sequence (value too large): " & L.Buffer (Start_Pos .. Start_Pos + Length - 1); end Read_Hex_Sequence; procedure Read_Double_Quoted_Scalar (L : in out Instance; T : out Token) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); Literal_Start : Positive; begin L.Seen_Multiline := False; Start_Token (L); if L.Proposed_Indentation /= -1 then L.Indentation := L.Proposed_Indentation; L.Proposed_Indentation := -1; end if; Literal_Start := L.Pos; L.Cur := Next (L); loop <<Handle_Char>> case L.Cur is when End_Of_Input => raise Lexer_Error with "Unexpected end of input (quoted string not closed)"; when '\' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); Literal_Start := L.Pos; case L.Cur is when '0' => Target.Append (Character'Val (0)); when 'a' => Target.Append (Character'Val (7)); when 'b' => Target.Append (Character'Val (8)); when 't' | Character'Val (9) => Target.Append (Character'Val (9)); when 'n' => Target.Append (Line_Feed); when 'v' => Target.Append (Character'Val (11)); when 'f' => Target.Append (Character'Val (12)); when 'r' => Target.Append (Carriage_Return); when 'e' => Target.Append (Character'Val (27)); when ' ' | '"' | '/' | '\' => Target.Append (L.Cur); when 'N' => Target.Append (Next_Line); when '_' => Target.Append (Non_Breaking_Space); when 'L' => Target.Append (Line_Separator); when 'P' => Target.Append (Paragraph_Separator); when 'x' => Read_Hex_Sequence (L, 2, Target); Literal_Start := L.Pos; when 'u' => Read_Hex_Sequence (L, 4, Target); Literal_Start := L.Pos; when 'U' => Read_Hex_Sequence (L, 8, Target); Literal_Start := L.Pos; when Line_Feed | Carriage_Return => Process_Quoted_Whitespace (L, 0, Target); Literal_Start := L.Pos - 1; goto Handle_Char; when others => raise Lexer_Error with "Illegal character in escape sequence: " & Escaped (L.Cur); end case; when '"' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; when ' ' | Line_Feed | Carriage_Return => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Process_Quoted_Whitespace (L, 1, Target); Literal_Start := L.Pos - 1; goto Handle_Char; when others => null; end case; L.Cur := Next (L); end loop; L.Cur := Next (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L), Kind => Double_Quoted_Scalar); L.Value := Target.Lock; end Read_Double_Quoted_Scalar; procedure Read_Block_Scalar (L : in out Instance; T : out Token) is type Chomp_Style is (Clip, Strip, Keep); Chomp : Chomp_Style := Clip; Indent : Natural := 0; Separation_Lines : Natural := 0; Content_Start : Positive; Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); begin Start_Token (L); T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>, Kind => (if L.Cur = '>' then Folded_Scalar else Literal_Scalar)); -- header loop L.Cur := Next (L); case L.Cur is when '+' => if Chomp /= Clip then raise Lexer_Error with "Multiple chomping indicators!"; end if; Chomp := Keep; when '-' => if Chomp /= Clip then raise Lexer_Error with "Multiple chomping indicators!"; end if; Chomp := Strip; when '1' .. '9' => if Indent /= 0 then raise Lexer_Error with "Multiple indentation indicators!"; end if; Indent := Natural'Max (0, L.Indentation) + Character'Pos (L.Cur) - Character'Pos ('0'); when ' ' => while L.Cur = ' ' loop L.Cur := Next (L); end loop; if not (L.Cur in Comment_Or_Line_End) then raise Lexer_Error with "Illegal character after block scalar header: " & Escaped (L.Cur); end if; exit; when Line_End => exit; when others => raise Lexer_Error with "Illegal character in block scalar header: " & Escaped (L.Cur); end case; end loop; End_Line (L); -- determining indentation and leading empty lines declare Max_Leading_Spaces : Natural := 0; begin loop if Indent = 0 then while L.Cur = ' ' loop L.Cur := Next (L); end loop; else Max_Leading_Spaces := L.Line_Start + Indent; while L.Cur = ' ' and L.Pos <= Max_Leading_Spaces loop L.Cur := Next (L); end loop; end if; case L.Cur is when Line_Feed | Carriage_Return => T.End_Pos := Cur_Mark (L); Max_Leading_Spaces := Natural'Max (Max_Leading_Spaces, L.Pos - 1 - L.Line_Start); End_Line (L); Separation_Lines := Separation_Lines + 1; when End_Of_Input => L.State := Stream_End'Access; goto End_Of_Input_Target; when others => if Indent = 0 then Indent := L.Pos - L.Line_Start - 1; if Indent <= Indentation_Type'Max (0, L.Indentation) then L.State := Line_Indentation'Access; goto Finalize; elsif Indent < Max_Leading_Spaces then raise Lexer_Error with "Leading all-spaces line contains too many spaces."; end if; elsif L.Pos - L.Line_Start - 1 < Indent then goto Finalize; end if; exit; end case; end loop; if Separation_Lines > 0 then Target.Append ((1 .. Separation_Lines => Line_Feed)); end if; end; -- read block scalar content Block_Content : loop -- content of line Content_Start := L.Pos - 1; while not (L.Cur in Line_End) loop L.Cur := Next (L); end loop; Target.Append (L.Buffer (Content_Start .. L.Pos - 2)); Separation_Lines := 0; if L.Cur = End_Of_Input then L.State := Stream_End'Access; goto End_Of_Input_Target; end if; Separation_Lines := Separation_Lines + 1; T.End_Pos := Cur_Mark (L); End_Line (L); -- empty lines and indentation of next line loop declare Indent_Pos : constant Natural := L.Line_Start + Indent; begin while L.Cur = ' ' and L.Pos - 1 < Indent_Pos loop L.Cur := Next (L); end loop; case L.Cur is when Carriage_Return | Line_Feed => T.End_Pos := Cur_Mark (L); Separation_Lines := Separation_Lines + 1; End_Line (L); when End_Of_Input => L.State := Stream_End'Access; goto End_Of_Input_Target; when others => if L.Pos - 1 < Indent_Pos then exit Block_Content; else exit; end if; end case; end; end loop; -- line folding if T.Kind = Literal_Scalar then Target.Append ((1 .. Separation_Lines => Line_Feed)); elsif Separation_Lines = 1 then Target.Append (' '); else Target.Append ((1 .. Separation_Lines - 1 => Line_Feed)); end if; end loop Block_Content; if L.Pos - L.Line_Start - 1 > Indentation_Type'Max (0, L.Indentation) then if L.Cur = '#' then L.State := Expect_Line_End'Access; else raise Lexer_Error with "This line at " & Escaped (L.Cur) & " is less indented than necessary." & L.Cur_Line'Img; end if; elsif L.Pos = L.Line_Start + 1 then L.State := Line_Start'Access; else L.State := Line_Indentation'Access; end if; <<Finalize>> T.End_Pos := Cur_Mark (L); goto Finish; <<End_Of_Input_Target>> -- if we encounter the stream end directly after a newline character, -- we must have stored the T.End_Pos beforehand because we cannot -- calculate it back (we do not know how long the recent line was). if L.Pos /= L.Line_Start + 1 then T.End_Pos := Cur_Mark (L); -- the generated End_Pos is *after* the stream end char, which is one -- too far; compensate here. T.End_Pos.Index := T.End_Pos.Index - 1; T.End_Pos.Column := T.End_Pos.Column - 1; end if; <<Finish>> T.End_Pos := Cur_Mark (L); -- handling trailing empty lines case Chomp is when Strip => null; when Clip => if Target.Length > 0 then Target.Append (Line_Feed); end if; when Keep => Target.Append ((1 .. Separation_Lines => Line_Feed)); end case; L.Value := Target.Lock; end Read_Block_Scalar; procedure Read_URI (L : in out Instance; Restricted : Boolean) is Target : Text.Builder.Reference := Text.Builder.Create (L.Pool); End_With_Space : constant Boolean := L.Cur /= '<'; Literal_Start : Positive; begin if End_With_Space then if (not Restricted) and L.Cur in '[' | ']' | ',' then raise Lexer_Error with "Flow indicator cannot start tag prefix"; end if; Literal_Start := L.Pos - 1; else Literal_Start := L.Pos; L.Cur := Next (L); end if; loop case L.Cur is when Space_Or_Line_End => if End_With_Space then Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; else raise Lexer_Error with "Unclosed verbatim tag"; end if; when '%' => Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); Read_Hex_Sequence (L, 2, Target); Literal_Start := L.Pos; when Tag_Char => null; when '[' | ']' | ',' => if Restricted then Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); exit; end if; when '!' => if Restricted then raise Lexer_Error with "Illegal '!' in tag suffix!"; end if; when '>' => if End_With_Space then raise Lexer_Error with "Illegal character in URI: "">"""; else Target.Append (L.Buffer (Literal_Start .. L.Pos - 2)); L.Cur := Next (L); exit; end if; when others => raise Lexer_Error with "Illegal character in URI: " & Escaped (L.Cur); end case; L.Cur := Next (L); end loop; L.Value := Target.Lock; end Read_URI; end Yaml.Lexer.Evaluation;
[ { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rig", "end": 829, "score": 0.9998876452445984, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ", "end": 849, "score": 0.9999326467514038, "start": 831, "tag": "EMAIL", "value": "[email protected]" } ]
source/amf/uml/amf-uml-information_flows.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- 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. ------------------------------------------------------------------------------ -- An information flow specifies that one or more information items -- circulates from its sources to its targets. Information flows require some -- kind of information channel for transmitting information items from the -- source to the destination. An information channel is represented in -- various ways depending on the nature of its sources and targets. It may be -- represented by connectors, links, associations, or even dependencies. For -- example, if the source and destination are parts in some composite -- structure such as a collaboration, then the information channel is likely -- to be represented by a connector between them. Or, if the source and -- target are objects (which are a kind of instance specification), they may -- be represented by a link that joins the two, and so on. ------------------------------------------------------------------------------ limited with AMF.UML.Activity_Edges.Collections; limited with AMF.UML.Classifiers.Collections; limited with AMF.UML.Connectors.Collections; with AMF.UML.Directed_Relationships; limited with AMF.UML.Messages.Collections; limited with AMF.UML.Named_Elements.Collections; with AMF.UML.Packageable_Elements; limited with AMF.UML.Relationships.Collections; package AMF.UML.Information_Flows is pragma Preelaborate; type UML_Information_Flow is limited interface and AMF.UML.Directed_Relationships.UML_Directed_Relationship and AMF.UML.Packageable_Elements.UML_Packageable_Element; type UML_Information_Flow_Access is access all UML_Information_Flow'Class; for UML_Information_Flow_Access'Storage_Size use 0; not overriding function Get_Conveyed (Self : not null access constant UML_Information_Flow) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Getter of InformationFlow::conveyed. -- -- Specifies the information items that may circulate on this information -- flow. not overriding function Get_Information_Source (Self : not null access constant UML_Information_Flow) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Getter of InformationFlow::informationSource. -- -- Defines from which source the conveyed InformationItems are initiated. not overriding function Get_Information_Target (Self : not null access constant UML_Information_Flow) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Getter of InformationFlow::informationTarget. -- -- Defines to which target the conveyed InformationItems are directed. not overriding function Get_Realization (Self : not null access constant UML_Information_Flow) return AMF.UML.Relationships.Collections.Set_Of_UML_Relationship is abstract; -- Getter of InformationFlow::realization. -- -- Determines which Relationship will realize the specified flow not overriding function Get_Realizing_Activity_Edge (Self : not null access constant UML_Information_Flow) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is abstract; -- Getter of InformationFlow::realizingActivityEdge. -- -- Determines which ActivityEdges will realize the specified flow. not overriding function Get_Realizing_Connector (Self : not null access constant UML_Information_Flow) return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is abstract; -- Getter of InformationFlow::realizingConnector. -- -- Determines which Connectors will realize the specified flow. not overriding function Get_Realizing_Message (Self : not null access constant UML_Information_Flow) return AMF.UML.Messages.Collections.Set_Of_UML_Message is abstract; -- Getter of InformationFlow::realizingMessage. -- -- Determines which Messages will realize the specified flow. end AMF.UML.Information_Flows;
5476
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- 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. ------------------------------------------------------------------------------ -- An information flow specifies that one or more information items -- circulates from its sources to its targets. Information flows require some -- kind of information channel for transmitting information items from the -- source to the destination. An information channel is represented in -- various ways depending on the nature of its sources and targets. It may be -- represented by connectors, links, associations, or even dependencies. For -- example, if the source and destination are parts in some composite -- structure such as a collaboration, then the information channel is likely -- to be represented by a connector between them. Or, if the source and -- target are objects (which are a kind of instance specification), they may -- be represented by a link that joins the two, and so on. ------------------------------------------------------------------------------ limited with AMF.UML.Activity_Edges.Collections; limited with AMF.UML.Classifiers.Collections; limited with AMF.UML.Connectors.Collections; with AMF.UML.Directed_Relationships; limited with AMF.UML.Messages.Collections; limited with AMF.UML.Named_Elements.Collections; with AMF.UML.Packageable_Elements; limited with AMF.UML.Relationships.Collections; package AMF.UML.Information_Flows is pragma Preelaborate; type UML_Information_Flow is limited interface and AMF.UML.Directed_Relationships.UML_Directed_Relationship and AMF.UML.Packageable_Elements.UML_Packageable_Element; type UML_Information_Flow_Access is access all UML_Information_Flow'Class; for UML_Information_Flow_Access'Storage_Size use 0; not overriding function Get_Conveyed (Self : not null access constant UML_Information_Flow) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Getter of InformationFlow::conveyed. -- -- Specifies the information items that may circulate on this information -- flow. not overriding function Get_Information_Source (Self : not null access constant UML_Information_Flow) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Getter of InformationFlow::informationSource. -- -- Defines from which source the conveyed InformationItems are initiated. not overriding function Get_Information_Target (Self : not null access constant UML_Information_Flow) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Getter of InformationFlow::informationTarget. -- -- Defines to which target the conveyed InformationItems are directed. not overriding function Get_Realization (Self : not null access constant UML_Information_Flow) return AMF.UML.Relationships.Collections.Set_Of_UML_Relationship is abstract; -- Getter of InformationFlow::realization. -- -- Determines which Relationship will realize the specified flow not overriding function Get_Realizing_Activity_Edge (Self : not null access constant UML_Information_Flow) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is abstract; -- Getter of InformationFlow::realizingActivityEdge. -- -- Determines which ActivityEdges will realize the specified flow. not overriding function Get_Realizing_Connector (Self : not null access constant UML_Information_Flow) return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is abstract; -- Getter of InformationFlow::realizingConnector. -- -- Determines which Connectors will realize the specified flow. not overriding function Get_Realizing_Message (Self : not null access constant UML_Information_Flow) return AMF.UML.Messages.Collections.Set_Of_UML_Message is abstract; -- Getter of InformationFlow::realizingMessage. -- -- Determines which Messages will realize the specified flow. end AMF.UML.Information_Flows;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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. ------------------------------------------------------------------------------ -- An information flow specifies that one or more information items -- circulates from its sources to its targets. Information flows require some -- kind of information channel for transmitting information items from the -- source to the destination. An information channel is represented in -- various ways depending on the nature of its sources and targets. It may be -- represented by connectors, links, associations, or even dependencies. For -- example, if the source and destination are parts in some composite -- structure such as a collaboration, then the information channel is likely -- to be represented by a connector between them. Or, if the source and -- target are objects (which are a kind of instance specification), they may -- be represented by a link that joins the two, and so on. ------------------------------------------------------------------------------ limited with AMF.UML.Activity_Edges.Collections; limited with AMF.UML.Classifiers.Collections; limited with AMF.UML.Connectors.Collections; with AMF.UML.Directed_Relationships; limited with AMF.UML.Messages.Collections; limited with AMF.UML.Named_Elements.Collections; with AMF.UML.Packageable_Elements; limited with AMF.UML.Relationships.Collections; package AMF.UML.Information_Flows is pragma Preelaborate; type UML_Information_Flow is limited interface and AMF.UML.Directed_Relationships.UML_Directed_Relationship and AMF.UML.Packageable_Elements.UML_Packageable_Element; type UML_Information_Flow_Access is access all UML_Information_Flow'Class; for UML_Information_Flow_Access'Storage_Size use 0; not overriding function Get_Conveyed (Self : not null access constant UML_Information_Flow) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Getter of InformationFlow::conveyed. -- -- Specifies the information items that may circulate on this information -- flow. not overriding function Get_Information_Source (Self : not null access constant UML_Information_Flow) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Getter of InformationFlow::informationSource. -- -- Defines from which source the conveyed InformationItems are initiated. not overriding function Get_Information_Target (Self : not null access constant UML_Information_Flow) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Getter of InformationFlow::informationTarget. -- -- Defines to which target the conveyed InformationItems are directed. not overriding function Get_Realization (Self : not null access constant UML_Information_Flow) return AMF.UML.Relationships.Collections.Set_Of_UML_Relationship is abstract; -- Getter of InformationFlow::realization. -- -- Determines which Relationship will realize the specified flow not overriding function Get_Realizing_Activity_Edge (Self : not null access constant UML_Information_Flow) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is abstract; -- Getter of InformationFlow::realizingActivityEdge. -- -- Determines which ActivityEdges will realize the specified flow. not overriding function Get_Realizing_Connector (Self : not null access constant UML_Information_Flow) return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is abstract; -- Getter of InformationFlow::realizingConnector. -- -- Determines which Connectors will realize the specified flow. not overriding function Get_Realizing_Message (Self : not null access constant UML_Information_Flow) return AMF.UML.Messages.Collections.Set_Of_UML_Message is abstract; -- Getter of InformationFlow::realizingMessage. -- -- Determines which Messages will realize the specified flow. end AMF.UML.Information_Flows;
[ { "context": "--\n-- Jan & Uwe R. Zimmer, Australia, July 2011\n--\n\npackage", "end": 9, "score": 0.9998652935028076, "start": 6, "tag": "NAME", "value": "Jan" }, { "context": "--\n-- Jan & Uwe R. Zimmer, Australia, July 2011\n--\n\npackage Callback_Proced", "end": 25, "score": 0.9998518824577332, "start": 12, "tag": "NAME", "value": "Uwe R. Zimmer" } ]
Sources/callback_procedures.ads
ForYouEyesOnly/Space-Convoy
1
-- -- Jan & Uwe R. Zimmer, Australia, July 2011 -- package Callback_Procedures is pragma Elaborate_Body; procedure Main_Operations; end Callback_Procedures;
22499
-- -- <NAME> & <NAME>, Australia, July 2011 -- package Callback_Procedures is pragma Elaborate_Body; procedure Main_Operations; end Callback_Procedures;
true
-- -- PI:NAME:<NAME>END_PI & PI:NAME:<NAME>END_PI, Australia, July 2011 -- package Callback_Procedures is pragma Elaborate_Body; procedure Main_Operations; end Callback_Procedures;
[ { "context": ", Log of Gamma Function\n-- Copyright (C) 1995-2018 Jonathan S. Parker\n--\n-- Permission to use, copy, modify, and/or dis", "end": 166, "score": 0.9998775124549866, "start": 148, "tag": "NAME", "value": "Jonathan S. Parker" } ]
disorderly/gamma.ads
jscparker/math_packages
30
------------------------------------------------------------------------------- -- package Gamma, Log of Gamma Function -- Copyright (C) 1995-2018 Jonathan S. Parker -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------- -- package Gamma -- -- Natural logarithm of Gamma function for positive real arguments. -- -- Uses Stieltjes' Continued Fraction method arg > 14, and rational -- polynomial approximations for 0 < arg < 16. -- -- Meant to be good to better than 30 digits (if you can instantiate -- with a 30 digit Real). That's why the rational -- polynomial approximations are so complicated at x < 16, and -- why the order of the Stieltjes' Continued Fraction is so high. -- But ordinarily you use a 15 digit Real. generic type Real is digits <>; package Gamma is pragma Pure (Gamma); function Log_Gamma (x : in Real) return Real; -- For x > 0 only. Natural logarithm of Gamma function. -- -- Uses Stieltjes' Continued Fraction method above x=14. -- For 0 < x < 10 uses simplest rational approx. -- Probably good to a lot better than 32 digits. function Log_Gamma_0_to_16 (x : in Real) return Real; -- This is the part that uses a rational polynomial approx. -- Only good for 0 < x < 16 ! procedure Test_Stieltjes_Coefficients; private Real_Epsilon : constant Real := (+0.125) * Real'Epsilon; -- have to modify this if Real is abstract extended end Gamma;
19440
------------------------------------------------------------------------------- -- package Gamma, Log of Gamma Function -- Copyright (C) 1995-2018 <NAME> -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------- -- package Gamma -- -- Natural logarithm of Gamma function for positive real arguments. -- -- Uses Stieltjes' Continued Fraction method arg > 14, and rational -- polynomial approximations for 0 < arg < 16. -- -- Meant to be good to better than 30 digits (if you can instantiate -- with a 30 digit Real). That's why the rational -- polynomial approximations are so complicated at x < 16, and -- why the order of the Stieltjes' Continued Fraction is so high. -- But ordinarily you use a 15 digit Real. generic type Real is digits <>; package Gamma is pragma Pure (Gamma); function Log_Gamma (x : in Real) return Real; -- For x > 0 only. Natural logarithm of Gamma function. -- -- Uses Stieltjes' Continued Fraction method above x=14. -- For 0 < x < 10 uses simplest rational approx. -- Probably good to a lot better than 32 digits. function Log_Gamma_0_to_16 (x : in Real) return Real; -- This is the part that uses a rational polynomial approx. -- Only good for 0 < x < 16 ! procedure Test_Stieltjes_Coefficients; private Real_Epsilon : constant Real := (+0.125) * Real'Epsilon; -- have to modify this if Real is abstract extended end Gamma;
true
------------------------------------------------------------------------------- -- package Gamma, Log of Gamma Function -- Copyright (C) 1995-2018 PI:NAME:<NAME>END_PI -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------------------------------- -- package Gamma -- -- Natural logarithm of Gamma function for positive real arguments. -- -- Uses Stieltjes' Continued Fraction method arg > 14, and rational -- polynomial approximations for 0 < arg < 16. -- -- Meant to be good to better than 30 digits (if you can instantiate -- with a 30 digit Real). That's why the rational -- polynomial approximations are so complicated at x < 16, and -- why the order of the Stieltjes' Continued Fraction is so high. -- But ordinarily you use a 15 digit Real. generic type Real is digits <>; package Gamma is pragma Pure (Gamma); function Log_Gamma (x : in Real) return Real; -- For x > 0 only. Natural logarithm of Gamma function. -- -- Uses Stieltjes' Continued Fraction method above x=14. -- For 0 < x < 10 uses simplest rational approx. -- Probably good to a lot better than 32 digits. function Log_Gamma_0_to_16 (x : in Real) return Real; -- This is the part that uses a rational polynomial approx. -- Only good for 0 < x < 16 ! procedure Test_Stieltjes_Coefficients; private Real_Epsilon : constant Real := (+0.125) * Real'Epsilon; -- have to modify this if Real is abstract extended end Gamma;
[ { "context": "ing for banded matrices\n-- Copyright (C) 1995-2018 Jonathan S. Parker \n-- \n-- Permission to use, copy, modify, and/or d", "end": 210, "score": 0.9998791217803955, "start": 192, "tag": "NAME", "value": "Jonathan S. Parker" } ]
linear_algebra/banded_lu.adb
jscparker/math_packages
30
--------------------------------------------------------------------------------- -- package body Banded_LU, LU decomposition, equation solving for banded matrices -- Copyright (C) 1995-2018 Jonathan S. Parker -- -- 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 Text_IO; package body Banded_LU is ------------- -- Product -- ------------- -- Matrix Vector multiplication function Product (A : in Banded_Matrix; X : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) return Column is Result : Column := (others => Zero); Sum : Real; Col_First, Col_Last : Integer; begin for Row in Starting_Index .. Final_Index loop Sum := Zero; Col_First := Integer'Max (Row - No_Of_Off_Diagonals, Starting_Index); Col_Last := Integer'Min (Row + No_Of_Off_Diagonals, Final_Index); for Col in Col_First .. Col_Last loop Sum := Sum + A (Row)(Col - Row) * X (Col); end loop; Result(Row) := Sum; end loop; return Result; end Product; --------------------- -- Refine_Solution -- --------------------- -- if No_Of_Iterations=0 then usual solution is returned. -- if No_Of_Iterations=1 then solution is refined iteratively once. -- -- Not necessarily much use if error is due to ill-conditioning of Matrix A. -- -- Iterative refinement of the solution returned by LU_decompose() and -- Solve(). Uses the Newton-like iteration for the solution of A*X = b, -- -- X_{k+1} = X_k + A_Inverse_Approximate * (b - A*X_k). -- -- Here A_Inverse_Approximate (we will call it V below) represents the -- solution returned by LU_decompose() followed by Solve(). -- -- if y = exact error in 1st iteration: y = X_inf - X_1, then y is the -- exact solution of A*y = d_1 where d_1 = b - A*X_1. -- Let V denote approximate inverse of A. Iterate for y using -- -- Delta_Y_{k+1} == Y_{k+1} - Y_k = V*(d_1 - A*Y_k). -- -- Remember Y = exact error in 1st iteration = SUM (Delta_Y_k's). -- Here's the actual method: -- -- Let d_1 = b - A*X_1 (the standard Residual: 1st estimate of error in A*X = b) -- Delta_Y_1 = V*d_1 -- Let d_2 = d_1 - A*Delta_Y_1 -- Delta_Y_2 = V*(d_1 - A*Delta_Y_1) = V*d_2 -- Let d_3 = d_2 - A*Delta_Y_2 -- Delta_Y_3 = V*(d_1 - A*Delta_Y_1 - A*Delta_Y_2) = V*d_3 -- -- so: d_k = d_{k-1} - A*Delta_Y_{k-1}; Delta_Y_k = V*d_k -- -- Sum the Delta_Y_k's to get the correction to X_1: Y = SUM (Delta_Y_k's). -- procedure Refine_Solution (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; A : in Banded_Matrix; No_Of_Iterations : in Natural := 1; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Delta_Y, X_1, A_Y : Column := (others => 0.0); D_k : Column := (others => 0.0); Y_f : Column := (others => 0.0); begin -- Get X_1 as defined above. Solve (X_1, B, A_LU, Diag_Inverse, Final_Index, Starting_Index); if No_Of_Iterations > 0 then A_Y := Product(A, X_1, Final_Index, Starting_Index); -- D_1: for I in Starting_Index .. Final_Index loop D_k(I) := B(I) - A_Y(I); end loop; Solve (Delta_Y, D_k, A_LU, Diag_Inverse, Final_Index, Starting_Index); -- Y_f is Sum of all the iterated Delta_Y's. Initialize it: Y_f := Delta_Y; for Iteration in 1..No_Of_Iterations-1 loop -- get d_k = d_k - A*Delta_Y_k A_Y := Product (A, Delta_Y, Final_Index, Starting_Index); for I in Starting_Index .. Final_Index loop D_k(I) := D_k(I) - A_Y(I); end loop; -- get Delta_Y = V*D_k: Solve (Delta_Y, D_k, A_LU, Diag_Inverse, Final_Index, Starting_Index); -- Accumulate Y_f: the full correction to X_1: for I in Starting_Index .. Final_Index loop Y_f(I) := Y_f(I) + Delta_Y(I); end loop; end loop; end if; for I in Starting_Index..Final_Index loop X(I) := Y_f(I) + X_1(I); end loop; end Refine_Solution; ---------------- -- Matrix_Val -- ---------------- -- Translates (Row, Col) to (I, Diagonal_id) using -- the formula I = Row, and Diagonal_id = Col - Row. -- -- Banded Matrices are by definition 0 everywhere except on the -- diagonal bands. So 0 is returned if (Row, Col) is not in the -- banded region. function Matrix_Val (A : Banded_Matrix; Row : Index; Col : Index) return Real is Diag_ID : constant Integer := (Col - Row); Result : Real; begin if Abs Diag_ID > No_Of_Off_Diagonals then Result := 0.0; else Result := A(Row)(Diag_ID); end if; return Result; end; ------------------ -- LU_Decompose -- ------------------ -- Translates from (Row, Col) indices to (I, Diagonal) -- with the formula I = Row, and Diagonal = Col - Row. procedure LU_Decompose (A : in out Banded_Matrix; Diag_Inverse : out Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Stage : Index; Sum : Real; Col_First, Row_Last : Integer; Min_Allowed_Pivot_Ratio, Min_Allowed_Pivot_Val : Real; Reciprocal_Pivot_Val, Pivot_Val, Abs_Pivot_Val : Real; Max_Pivot_Val : Real := Min_Allowed_Real; Min_Pivot_Ratio : constant Real := 2.0**(-Real'Machine_Mantissa) * 1.0E-3; begin Diag_Inverse := (Others => 0.0); if Final_Index - Starting_Index + 1 < No_Of_Off_Diagonals + 1 then text_io.put ("Matrix Size must be >= No_Of_Off_Diagonals+1."); raise Constraint_Error; end if; Min_Allowed_Pivot_Ratio := Min_Pivot_Ratio; -- Step 0. 1 X 1 matrices: They can't exist because of above. -- Step 1. The outer loop. -- At each stage we calculate row "stage" of the Upper matrix U -- and Column "Stage" of the Lower matrix L. -- The matrix A is overwritten with these, because the elements -- of A in those places are never needed in future stages. -- However, the elements of L ARE needed in those places, -- so to get those elements we will be accessing A (which stores them). for Stage in Starting_Index..Final_Index-1 loop Row_Last := Integer'Min (Stage + No_Of_Off_Diagonals, Final_Index); if Stage > Starting_Index then for J in Stage .. Row_Last loop Sum := 0.0; --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(J)(K)*U(K)(Stage); -- Sum := Sum + A(J)(K)*A(K)(Stage); --end loop; Col_First := Integer'Max (J - No_Of_Off_Diagonals, Starting_Index); for K in Col_First..Stage-1 loop Sum := Sum + A(J)(K-J)*A(K)(Stage-K); end loop; --L(J)(Stage) := L(J)(Stage) - Sum; --L(J)(Stage-J) := L(J)(Stage-J) - Sum; A(J)(Stage-J) := A(J)(Stage-J) - Sum; end loop; end if; -- Step 2: Get row "stage" of U and -- column "stage" of L. Notice these formulas update -- only (Stage+1..Last) elements of the respective row -- and column, and depend on only (1..Stage) elements -- of U and L, which were calculated previously, and stored in A. Pivot_Val := A(Stage)(0); Abs_Pivot_Val := Abs (Pivot_Val); if Abs_Pivot_Val > Max_Pivot_Val then Max_Pivot_Val := Abs_Pivot_Val; end if; Min_Allowed_Pivot_Val := Max_Pivot_Val*Min_Allowed_Pivot_Ratio + Min_Allowed_Real; if (Abs_Pivot_Val < Min_Allowed_Pivot_Val) then Min_Allowed_Pivot_Val := Real'Copy_Sign (Min_Allowed_Pivot_Val, Pivot_Val); Reciprocal_Pivot_Val := 1.0 / Min_Allowed_Pivot_Val; else Reciprocal_Pivot_Val := 1.0 / Pivot_Val; end if; if (Abs_Pivot_Val < Min_Allowed_Real) then Reciprocal_Pivot_Val := 0.0; end if; Diag_Inverse(Stage) := Reciprocal_Pivot_Val; for J in Stage+1..Row_Last loop Sum := 0.0; if Stage > Starting_Index then --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(Stage)(K)*U(K)(J); -- Sum := Sum + A(Stage)(K)*A(K)(J); --end loop; Col_First := Integer'Max (Starting_Index, J - No_Of_Off_Diagonals); for K in Col_First..Stage-1 loop Sum := Sum + A(Stage)(K-Stage) * A(K)(J-K); end loop; end if; --U(Stage)(J) := (A(Stage)(J) - Sum) * Scale_Factor; A(Stage)(J-Stage) := (A(Stage)(J-Stage) - Sum) * Reciprocal_Pivot_Val; end loop; end loop; -- Step 3: Get final row and column. Stage := Final_Index; Sum := 0.0; --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(Stage)(K)*U(K)(Stage); -- Sum := Sum + A(Stage)(K)*A(K)(Stage); --end loop; Col_First := Integer'Max(Starting_Index, Integer(Stage)-No_Of_Off_Diagonals); for K in Col_First..Stage-1 loop Sum := Sum + A(Stage)(K-Stage)*A(K)(Stage-K); end loop; A(Stage)(0) := A(Stage)(0) - Sum; Pivot_Val := A(Stage)(0); Abs_Pivot_Val := Abs (Pivot_Val); if Abs_Pivot_Val > Max_Pivot_Val then Max_Pivot_Val := Abs_Pivot_Val; end if; Min_Allowed_Pivot_Val := Max_Pivot_Val*Min_Allowed_Pivot_Ratio + Min_Allowed_Real; if Abs_Pivot_Val < Min_Allowed_Pivot_Val then Min_Allowed_Pivot_Val := Real'Copy_Sign (Min_Allowed_Pivot_Val, Pivot_Val); Reciprocal_Pivot_Val := 1.0 / Min_Allowed_Pivot_Val; else Reciprocal_Pivot_Val := 1.0 / Pivot_Val; end if; if Abs_Pivot_Val < Min_Allowed_Real then Reciprocal_Pivot_Val := 0.0; end if; Diag_Inverse(Stage) := Reciprocal_Pivot_Val; end LU_Decompose; ----------- -- Solve -- ----------- procedure Solve (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Z : Column; ID_of_1st_non_0 : Index := Starting_Index; Sum : Real; Col_First : Index; Col_Last : Index; begin for Row in Index loop X(Row) := 0.0; end loop; -- An optimization to make matrix inversion efficient. -- in Banded_Matrix inversion, the input vector B is -- is a unit vector: it is all zeros except for a 1.0. Need to -- to find 1st non-zero element of B: for I in Starting_Index..Final_Index loop if Abs (B(I)) > 0.0 then ID_of_1st_non_0 := I; exit; end if; end loop; -- In solving for Z in the equation L Z = B, the Z's will -- all be zero up to the 1st non-zero element of B. if ID_of_1st_non_0 > Index'First then for I in Starting_Index..ID_of_1st_non_0-1 loop Z(I) := 0.0; end loop; end if; -- The matrix equation is in the form L * U * X = B. -- First assume U * X is Z, and -- solve for Z in the equation L Z = B. Z(ID_of_1st_non_0) := B(ID_of_1st_non_0) * Diag_Inverse(ID_of_1st_non_0); if ID_of_1st_non_0 < Final_Index then for Row in ID_of_1st_non_0+1..Final_Index loop Sum := 0.0; Col_First := Integer'Max (Starting_Index, Row - No_Of_Off_Diagonals); for Col in Col_First .. Row-1 loop Sum := Sum + A_LU(Row)(Col-Row) * Z(Col); end loop; Z(Row) := (B(Row) - Sum) * Diag_Inverse(Row); end loop; end if; -- Solve for X in the equation U X = Z. X(Final_Index) := Z(Final_Index); if Final_Index > Starting_Index then for Row in reverse Starting_Index..Final_Index-1 loop Sum := 0.0; Col_Last := Integer'Min (Final_Index, Row + No_Of_Off_Diagonals); for Col in Row+1 .. Col_Last loop Sum := Sum + A_LU(Row)(Col-Row) * X(Col); end loop; X(Row) := (Z(Row) - Sum); end loop; end if; end Solve; end Banded_LU;
25061
--------------------------------------------------------------------------------- -- package body Banded_LU, LU decomposition, equation solving for banded matrices -- Copyright (C) 1995-2018 <NAME> -- -- 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 Text_IO; package body Banded_LU is ------------- -- Product -- ------------- -- Matrix Vector multiplication function Product (A : in Banded_Matrix; X : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) return Column is Result : Column := (others => Zero); Sum : Real; Col_First, Col_Last : Integer; begin for Row in Starting_Index .. Final_Index loop Sum := Zero; Col_First := Integer'Max (Row - No_Of_Off_Diagonals, Starting_Index); Col_Last := Integer'Min (Row + No_Of_Off_Diagonals, Final_Index); for Col in Col_First .. Col_Last loop Sum := Sum + A (Row)(Col - Row) * X (Col); end loop; Result(Row) := Sum; end loop; return Result; end Product; --------------------- -- Refine_Solution -- --------------------- -- if No_Of_Iterations=0 then usual solution is returned. -- if No_Of_Iterations=1 then solution is refined iteratively once. -- -- Not necessarily much use if error is due to ill-conditioning of Matrix A. -- -- Iterative refinement of the solution returned by LU_decompose() and -- Solve(). Uses the Newton-like iteration for the solution of A*X = b, -- -- X_{k+1} = X_k + A_Inverse_Approximate * (b - A*X_k). -- -- Here A_Inverse_Approximate (we will call it V below) represents the -- solution returned by LU_decompose() followed by Solve(). -- -- if y = exact error in 1st iteration: y = X_inf - X_1, then y is the -- exact solution of A*y = d_1 where d_1 = b - A*X_1. -- Let V denote approximate inverse of A. Iterate for y using -- -- Delta_Y_{k+1} == Y_{k+1} - Y_k = V*(d_1 - A*Y_k). -- -- Remember Y = exact error in 1st iteration = SUM (Delta_Y_k's). -- Here's the actual method: -- -- Let d_1 = b - A*X_1 (the standard Residual: 1st estimate of error in A*X = b) -- Delta_Y_1 = V*d_1 -- Let d_2 = d_1 - A*Delta_Y_1 -- Delta_Y_2 = V*(d_1 - A*Delta_Y_1) = V*d_2 -- Let d_3 = d_2 - A*Delta_Y_2 -- Delta_Y_3 = V*(d_1 - A*Delta_Y_1 - A*Delta_Y_2) = V*d_3 -- -- so: d_k = d_{k-1} - A*Delta_Y_{k-1}; Delta_Y_k = V*d_k -- -- Sum the Delta_Y_k's to get the correction to X_1: Y = SUM (Delta_Y_k's). -- procedure Refine_Solution (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; A : in Banded_Matrix; No_Of_Iterations : in Natural := 1; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Delta_Y, X_1, A_Y : Column := (others => 0.0); D_k : Column := (others => 0.0); Y_f : Column := (others => 0.0); begin -- Get X_1 as defined above. Solve (X_1, B, A_LU, Diag_Inverse, Final_Index, Starting_Index); if No_Of_Iterations > 0 then A_Y := Product(A, X_1, Final_Index, Starting_Index); -- D_1: for I in Starting_Index .. Final_Index loop D_k(I) := B(I) - A_Y(I); end loop; Solve (Delta_Y, D_k, A_LU, Diag_Inverse, Final_Index, Starting_Index); -- Y_f is Sum of all the iterated Delta_Y's. Initialize it: Y_f := Delta_Y; for Iteration in 1..No_Of_Iterations-1 loop -- get d_k = d_k - A*Delta_Y_k A_Y := Product (A, Delta_Y, Final_Index, Starting_Index); for I in Starting_Index .. Final_Index loop D_k(I) := D_k(I) - A_Y(I); end loop; -- get Delta_Y = V*D_k: Solve (Delta_Y, D_k, A_LU, Diag_Inverse, Final_Index, Starting_Index); -- Accumulate Y_f: the full correction to X_1: for I in Starting_Index .. Final_Index loop Y_f(I) := Y_f(I) + Delta_Y(I); end loop; end loop; end if; for I in Starting_Index..Final_Index loop X(I) := Y_f(I) + X_1(I); end loop; end Refine_Solution; ---------------- -- Matrix_Val -- ---------------- -- Translates (Row, Col) to (I, Diagonal_id) using -- the formula I = Row, and Diagonal_id = Col - Row. -- -- Banded Matrices are by definition 0 everywhere except on the -- diagonal bands. So 0 is returned if (Row, Col) is not in the -- banded region. function Matrix_Val (A : Banded_Matrix; Row : Index; Col : Index) return Real is Diag_ID : constant Integer := (Col - Row); Result : Real; begin if Abs Diag_ID > No_Of_Off_Diagonals then Result := 0.0; else Result := A(Row)(Diag_ID); end if; return Result; end; ------------------ -- LU_Decompose -- ------------------ -- Translates from (Row, Col) indices to (I, Diagonal) -- with the formula I = Row, and Diagonal = Col - Row. procedure LU_Decompose (A : in out Banded_Matrix; Diag_Inverse : out Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Stage : Index; Sum : Real; Col_First, Row_Last : Integer; Min_Allowed_Pivot_Ratio, Min_Allowed_Pivot_Val : Real; Reciprocal_Pivot_Val, Pivot_Val, Abs_Pivot_Val : Real; Max_Pivot_Val : Real := Min_Allowed_Real; Min_Pivot_Ratio : constant Real := 2.0**(-Real'Machine_Mantissa) * 1.0E-3; begin Diag_Inverse := (Others => 0.0); if Final_Index - Starting_Index + 1 < No_Of_Off_Diagonals + 1 then text_io.put ("Matrix Size must be >= No_Of_Off_Diagonals+1."); raise Constraint_Error; end if; Min_Allowed_Pivot_Ratio := Min_Pivot_Ratio; -- Step 0. 1 X 1 matrices: They can't exist because of above. -- Step 1. The outer loop. -- At each stage we calculate row "stage" of the Upper matrix U -- and Column "Stage" of the Lower matrix L. -- The matrix A is overwritten with these, because the elements -- of A in those places are never needed in future stages. -- However, the elements of L ARE needed in those places, -- so to get those elements we will be accessing A (which stores them). for Stage in Starting_Index..Final_Index-1 loop Row_Last := Integer'Min (Stage + No_Of_Off_Diagonals, Final_Index); if Stage > Starting_Index then for J in Stage .. Row_Last loop Sum := 0.0; --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(J)(K)*U(K)(Stage); -- Sum := Sum + A(J)(K)*A(K)(Stage); --end loop; Col_First := Integer'Max (J - No_Of_Off_Diagonals, Starting_Index); for K in Col_First..Stage-1 loop Sum := Sum + A(J)(K-J)*A(K)(Stage-K); end loop; --L(J)(Stage) := L(J)(Stage) - Sum; --L(J)(Stage-J) := L(J)(Stage-J) - Sum; A(J)(Stage-J) := A(J)(Stage-J) - Sum; end loop; end if; -- Step 2: Get row "stage" of U and -- column "stage" of L. Notice these formulas update -- only (Stage+1..Last) elements of the respective row -- and column, and depend on only (1..Stage) elements -- of U and L, which were calculated previously, and stored in A. Pivot_Val := A(Stage)(0); Abs_Pivot_Val := Abs (Pivot_Val); if Abs_Pivot_Val > Max_Pivot_Val then Max_Pivot_Val := Abs_Pivot_Val; end if; Min_Allowed_Pivot_Val := Max_Pivot_Val*Min_Allowed_Pivot_Ratio + Min_Allowed_Real; if (Abs_Pivot_Val < Min_Allowed_Pivot_Val) then Min_Allowed_Pivot_Val := Real'Copy_Sign (Min_Allowed_Pivot_Val, Pivot_Val); Reciprocal_Pivot_Val := 1.0 / Min_Allowed_Pivot_Val; else Reciprocal_Pivot_Val := 1.0 / Pivot_Val; end if; if (Abs_Pivot_Val < Min_Allowed_Real) then Reciprocal_Pivot_Val := 0.0; end if; Diag_Inverse(Stage) := Reciprocal_Pivot_Val; for J in Stage+1..Row_Last loop Sum := 0.0; if Stage > Starting_Index then --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(Stage)(K)*U(K)(J); -- Sum := Sum + A(Stage)(K)*A(K)(J); --end loop; Col_First := Integer'Max (Starting_Index, J - No_Of_Off_Diagonals); for K in Col_First..Stage-1 loop Sum := Sum + A(Stage)(K-Stage) * A(K)(J-K); end loop; end if; --U(Stage)(J) := (A(Stage)(J) - Sum) * Scale_Factor; A(Stage)(J-Stage) := (A(Stage)(J-Stage) - Sum) * Reciprocal_Pivot_Val; end loop; end loop; -- Step 3: Get final row and column. Stage := Final_Index; Sum := 0.0; --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(Stage)(K)*U(K)(Stage); -- Sum := Sum + A(Stage)(K)*A(K)(Stage); --end loop; Col_First := Integer'Max(Starting_Index, Integer(Stage)-No_Of_Off_Diagonals); for K in Col_First..Stage-1 loop Sum := Sum + A(Stage)(K-Stage)*A(K)(Stage-K); end loop; A(Stage)(0) := A(Stage)(0) - Sum; Pivot_Val := A(Stage)(0); Abs_Pivot_Val := Abs (Pivot_Val); if Abs_Pivot_Val > Max_Pivot_Val then Max_Pivot_Val := Abs_Pivot_Val; end if; Min_Allowed_Pivot_Val := Max_Pivot_Val*Min_Allowed_Pivot_Ratio + Min_Allowed_Real; if Abs_Pivot_Val < Min_Allowed_Pivot_Val then Min_Allowed_Pivot_Val := Real'Copy_Sign (Min_Allowed_Pivot_Val, Pivot_Val); Reciprocal_Pivot_Val := 1.0 / Min_Allowed_Pivot_Val; else Reciprocal_Pivot_Val := 1.0 / Pivot_Val; end if; if Abs_Pivot_Val < Min_Allowed_Real then Reciprocal_Pivot_Val := 0.0; end if; Diag_Inverse(Stage) := Reciprocal_Pivot_Val; end LU_Decompose; ----------- -- Solve -- ----------- procedure Solve (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Z : Column; ID_of_1st_non_0 : Index := Starting_Index; Sum : Real; Col_First : Index; Col_Last : Index; begin for Row in Index loop X(Row) := 0.0; end loop; -- An optimization to make matrix inversion efficient. -- in Banded_Matrix inversion, the input vector B is -- is a unit vector: it is all zeros except for a 1.0. Need to -- to find 1st non-zero element of B: for I in Starting_Index..Final_Index loop if Abs (B(I)) > 0.0 then ID_of_1st_non_0 := I; exit; end if; end loop; -- In solving for Z in the equation L Z = B, the Z's will -- all be zero up to the 1st non-zero element of B. if ID_of_1st_non_0 > Index'First then for I in Starting_Index..ID_of_1st_non_0-1 loop Z(I) := 0.0; end loop; end if; -- The matrix equation is in the form L * U * X = B. -- First assume U * X is Z, and -- solve for Z in the equation L Z = B. Z(ID_of_1st_non_0) := B(ID_of_1st_non_0) * Diag_Inverse(ID_of_1st_non_0); if ID_of_1st_non_0 < Final_Index then for Row in ID_of_1st_non_0+1..Final_Index loop Sum := 0.0; Col_First := Integer'Max (Starting_Index, Row - No_Of_Off_Diagonals); for Col in Col_First .. Row-1 loop Sum := Sum + A_LU(Row)(Col-Row) * Z(Col); end loop; Z(Row) := (B(Row) - Sum) * Diag_Inverse(Row); end loop; end if; -- Solve for X in the equation U X = Z. X(Final_Index) := Z(Final_Index); if Final_Index > Starting_Index then for Row in reverse Starting_Index..Final_Index-1 loop Sum := 0.0; Col_Last := Integer'Min (Final_Index, Row + No_Of_Off_Diagonals); for Col in Row+1 .. Col_Last loop Sum := Sum + A_LU(Row)(Col-Row) * X(Col); end loop; X(Row) := (Z(Row) - Sum); end loop; end if; end Solve; end Banded_LU;
true
--------------------------------------------------------------------------------- -- package body Banded_LU, LU decomposition, equation solving for banded matrices -- Copyright (C) 1995-2018 PI:NAME:<NAME>END_PI -- -- 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 Text_IO; package body Banded_LU is ------------- -- Product -- ------------- -- Matrix Vector multiplication function Product (A : in Banded_Matrix; X : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) return Column is Result : Column := (others => Zero); Sum : Real; Col_First, Col_Last : Integer; begin for Row in Starting_Index .. Final_Index loop Sum := Zero; Col_First := Integer'Max (Row - No_Of_Off_Diagonals, Starting_Index); Col_Last := Integer'Min (Row + No_Of_Off_Diagonals, Final_Index); for Col in Col_First .. Col_Last loop Sum := Sum + A (Row)(Col - Row) * X (Col); end loop; Result(Row) := Sum; end loop; return Result; end Product; --------------------- -- Refine_Solution -- --------------------- -- if No_Of_Iterations=0 then usual solution is returned. -- if No_Of_Iterations=1 then solution is refined iteratively once. -- -- Not necessarily much use if error is due to ill-conditioning of Matrix A. -- -- Iterative refinement of the solution returned by LU_decompose() and -- Solve(). Uses the Newton-like iteration for the solution of A*X = b, -- -- X_{k+1} = X_k + A_Inverse_Approximate * (b - A*X_k). -- -- Here A_Inverse_Approximate (we will call it V below) represents the -- solution returned by LU_decompose() followed by Solve(). -- -- if y = exact error in 1st iteration: y = X_inf - X_1, then y is the -- exact solution of A*y = d_1 where d_1 = b - A*X_1. -- Let V denote approximate inverse of A. Iterate for y using -- -- Delta_Y_{k+1} == Y_{k+1} - Y_k = V*(d_1 - A*Y_k). -- -- Remember Y = exact error in 1st iteration = SUM (Delta_Y_k's). -- Here's the actual method: -- -- Let d_1 = b - A*X_1 (the standard Residual: 1st estimate of error in A*X = b) -- Delta_Y_1 = V*d_1 -- Let d_2 = d_1 - A*Delta_Y_1 -- Delta_Y_2 = V*(d_1 - A*Delta_Y_1) = V*d_2 -- Let d_3 = d_2 - A*Delta_Y_2 -- Delta_Y_3 = V*(d_1 - A*Delta_Y_1 - A*Delta_Y_2) = V*d_3 -- -- so: d_k = d_{k-1} - A*Delta_Y_{k-1}; Delta_Y_k = V*d_k -- -- Sum the Delta_Y_k's to get the correction to X_1: Y = SUM (Delta_Y_k's). -- procedure Refine_Solution (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; A : in Banded_Matrix; No_Of_Iterations : in Natural := 1; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Delta_Y, X_1, A_Y : Column := (others => 0.0); D_k : Column := (others => 0.0); Y_f : Column := (others => 0.0); begin -- Get X_1 as defined above. Solve (X_1, B, A_LU, Diag_Inverse, Final_Index, Starting_Index); if No_Of_Iterations > 0 then A_Y := Product(A, X_1, Final_Index, Starting_Index); -- D_1: for I in Starting_Index .. Final_Index loop D_k(I) := B(I) - A_Y(I); end loop; Solve (Delta_Y, D_k, A_LU, Diag_Inverse, Final_Index, Starting_Index); -- Y_f is Sum of all the iterated Delta_Y's. Initialize it: Y_f := Delta_Y; for Iteration in 1..No_Of_Iterations-1 loop -- get d_k = d_k - A*Delta_Y_k A_Y := Product (A, Delta_Y, Final_Index, Starting_Index); for I in Starting_Index .. Final_Index loop D_k(I) := D_k(I) - A_Y(I); end loop; -- get Delta_Y = V*D_k: Solve (Delta_Y, D_k, A_LU, Diag_Inverse, Final_Index, Starting_Index); -- Accumulate Y_f: the full correction to X_1: for I in Starting_Index .. Final_Index loop Y_f(I) := Y_f(I) + Delta_Y(I); end loop; end loop; end if; for I in Starting_Index..Final_Index loop X(I) := Y_f(I) + X_1(I); end loop; end Refine_Solution; ---------------- -- Matrix_Val -- ---------------- -- Translates (Row, Col) to (I, Diagonal_id) using -- the formula I = Row, and Diagonal_id = Col - Row. -- -- Banded Matrices are by definition 0 everywhere except on the -- diagonal bands. So 0 is returned if (Row, Col) is not in the -- banded region. function Matrix_Val (A : Banded_Matrix; Row : Index; Col : Index) return Real is Diag_ID : constant Integer := (Col - Row); Result : Real; begin if Abs Diag_ID > No_Of_Off_Diagonals then Result := 0.0; else Result := A(Row)(Diag_ID); end if; return Result; end; ------------------ -- LU_Decompose -- ------------------ -- Translates from (Row, Col) indices to (I, Diagonal) -- with the formula I = Row, and Diagonal = Col - Row. procedure LU_Decompose (A : in out Banded_Matrix; Diag_Inverse : out Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Stage : Index; Sum : Real; Col_First, Row_Last : Integer; Min_Allowed_Pivot_Ratio, Min_Allowed_Pivot_Val : Real; Reciprocal_Pivot_Val, Pivot_Val, Abs_Pivot_Val : Real; Max_Pivot_Val : Real := Min_Allowed_Real; Min_Pivot_Ratio : constant Real := 2.0**(-Real'Machine_Mantissa) * 1.0E-3; begin Diag_Inverse := (Others => 0.0); if Final_Index - Starting_Index + 1 < No_Of_Off_Diagonals + 1 then text_io.put ("Matrix Size must be >= No_Of_Off_Diagonals+1."); raise Constraint_Error; end if; Min_Allowed_Pivot_Ratio := Min_Pivot_Ratio; -- Step 0. 1 X 1 matrices: They can't exist because of above. -- Step 1. The outer loop. -- At each stage we calculate row "stage" of the Upper matrix U -- and Column "Stage" of the Lower matrix L. -- The matrix A is overwritten with these, because the elements -- of A in those places are never needed in future stages. -- However, the elements of L ARE needed in those places, -- so to get those elements we will be accessing A (which stores them). for Stage in Starting_Index..Final_Index-1 loop Row_Last := Integer'Min (Stage + No_Of_Off_Diagonals, Final_Index); if Stage > Starting_Index then for J in Stage .. Row_Last loop Sum := 0.0; --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(J)(K)*U(K)(Stage); -- Sum := Sum + A(J)(K)*A(K)(Stage); --end loop; Col_First := Integer'Max (J - No_Of_Off_Diagonals, Starting_Index); for K in Col_First..Stage-1 loop Sum := Sum + A(J)(K-J)*A(K)(Stage-K); end loop; --L(J)(Stage) := L(J)(Stage) - Sum; --L(J)(Stage-J) := L(J)(Stage-J) - Sum; A(J)(Stage-J) := A(J)(Stage-J) - Sum; end loop; end if; -- Step 2: Get row "stage" of U and -- column "stage" of L. Notice these formulas update -- only (Stage+1..Last) elements of the respective row -- and column, and depend on only (1..Stage) elements -- of U and L, which were calculated previously, and stored in A. Pivot_Val := A(Stage)(0); Abs_Pivot_Val := Abs (Pivot_Val); if Abs_Pivot_Val > Max_Pivot_Val then Max_Pivot_Val := Abs_Pivot_Val; end if; Min_Allowed_Pivot_Val := Max_Pivot_Val*Min_Allowed_Pivot_Ratio + Min_Allowed_Real; if (Abs_Pivot_Val < Min_Allowed_Pivot_Val) then Min_Allowed_Pivot_Val := Real'Copy_Sign (Min_Allowed_Pivot_Val, Pivot_Val); Reciprocal_Pivot_Val := 1.0 / Min_Allowed_Pivot_Val; else Reciprocal_Pivot_Val := 1.0 / Pivot_Val; end if; if (Abs_Pivot_Val < Min_Allowed_Real) then Reciprocal_Pivot_Val := 0.0; end if; Diag_Inverse(Stage) := Reciprocal_Pivot_Val; for J in Stage+1..Row_Last loop Sum := 0.0; if Stage > Starting_Index then --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(Stage)(K)*U(K)(J); -- Sum := Sum + A(Stage)(K)*A(K)(J); --end loop; Col_First := Integer'Max (Starting_Index, J - No_Of_Off_Diagonals); for K in Col_First..Stage-1 loop Sum := Sum + A(Stage)(K-Stage) * A(K)(J-K); end loop; end if; --U(Stage)(J) := (A(Stage)(J) - Sum) * Scale_Factor; A(Stage)(J-Stage) := (A(Stage)(J-Stage) - Sum) * Reciprocal_Pivot_Val; end loop; end loop; -- Step 3: Get final row and column. Stage := Final_Index; Sum := 0.0; --for K in Starting_Index .. Stage-1 loop -- --Sum := Sum + L(Stage)(K)*U(K)(Stage); -- Sum := Sum + A(Stage)(K)*A(K)(Stage); --end loop; Col_First := Integer'Max(Starting_Index, Integer(Stage)-No_Of_Off_Diagonals); for K in Col_First..Stage-1 loop Sum := Sum + A(Stage)(K-Stage)*A(K)(Stage-K); end loop; A(Stage)(0) := A(Stage)(0) - Sum; Pivot_Val := A(Stage)(0); Abs_Pivot_Val := Abs (Pivot_Val); if Abs_Pivot_Val > Max_Pivot_Val then Max_Pivot_Val := Abs_Pivot_Val; end if; Min_Allowed_Pivot_Val := Max_Pivot_Val*Min_Allowed_Pivot_Ratio + Min_Allowed_Real; if Abs_Pivot_Val < Min_Allowed_Pivot_Val then Min_Allowed_Pivot_Val := Real'Copy_Sign (Min_Allowed_Pivot_Val, Pivot_Val); Reciprocal_Pivot_Val := 1.0 / Min_Allowed_Pivot_Val; else Reciprocal_Pivot_Val := 1.0 / Pivot_Val; end if; if Abs_Pivot_Val < Min_Allowed_Real then Reciprocal_Pivot_Val := 0.0; end if; Diag_Inverse(Stage) := Reciprocal_Pivot_Val; end LU_Decompose; ----------- -- Solve -- ----------- procedure Solve (X : out Column; B : in Column; A_LU : in Banded_Matrix; Diag_Inverse : in Column; Final_Index : in Index := Index'Last; Starting_Index : in Index := Index'First) is Z : Column; ID_of_1st_non_0 : Index := Starting_Index; Sum : Real; Col_First : Index; Col_Last : Index; begin for Row in Index loop X(Row) := 0.0; end loop; -- An optimization to make matrix inversion efficient. -- in Banded_Matrix inversion, the input vector B is -- is a unit vector: it is all zeros except for a 1.0. Need to -- to find 1st non-zero element of B: for I in Starting_Index..Final_Index loop if Abs (B(I)) > 0.0 then ID_of_1st_non_0 := I; exit; end if; end loop; -- In solving for Z in the equation L Z = B, the Z's will -- all be zero up to the 1st non-zero element of B. if ID_of_1st_non_0 > Index'First then for I in Starting_Index..ID_of_1st_non_0-1 loop Z(I) := 0.0; end loop; end if; -- The matrix equation is in the form L * U * X = B. -- First assume U * X is Z, and -- solve for Z in the equation L Z = B. Z(ID_of_1st_non_0) := B(ID_of_1st_non_0) * Diag_Inverse(ID_of_1st_non_0); if ID_of_1st_non_0 < Final_Index then for Row in ID_of_1st_non_0+1..Final_Index loop Sum := 0.0; Col_First := Integer'Max (Starting_Index, Row - No_Of_Off_Diagonals); for Col in Col_First .. Row-1 loop Sum := Sum + A_LU(Row)(Col-Row) * Z(Col); end loop; Z(Row) := (B(Row) - Sum) * Diag_Inverse(Row); end loop; end if; -- Solve for X in the equation U X = Z. X(Final_Index) := Z(Final_Index); if Final_Index > Starting_Index then for Row in reverse Starting_Index..Final_Index-1 loop Sum := 0.0; Col_Last := Integer'Min (Final_Index, Row + No_Of_Off_Diagonals); for Col in Row+1 .. Col_Last loop Sum := Sum + A_LU(Row)(Col-Row) * X(Col); end loop; X(Row) := (Z(Row) - Sum); end loop; end if; end Solve; end Banded_LU;
[ { "context": "- Reader for TCP/IP sockets\n-- Copyright (C) 2014 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 163, "score": 0.9998679161071777, "start": 148, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2014 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 194, "score": 0.9998761415481567, "start": 179, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "4 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 221, "score": 0.9999269247055054, "start": 196, "tag": "EMAIL", "value": "[email protected]" } ]
mat/src/mat-readers-streams-sockets.ads
stcarrez/mat
7
----------------------------------------------------------------------- -- mat-readers-sockets -- Reader for TCP/IP sockets -- Copyright (C) 2014 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 Ada.Containers.Doubly_Linked_Lists; with Util.Streams.Sockets; with GNAT.Sockets; package MAT.Readers.Streams.Sockets is type Socket_Listener_Type is new Ada.Finalization.Limited_Controlled with private; -- Initialize the socket listener. overriding procedure Initialize (Listener : in out Socket_Listener_Type); -- Destroy the socket listener. overriding procedure Finalize (Listener : in out Socket_Listener_Type); -- Open the socket to accept connections and start the listener task. procedure Start (Listener : in out Socket_Listener_Type; List : in MAT.Events.Probes.Reader_List_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type); -- Stop the listener socket. procedure Stop (Listener : in out Socket_Listener_Type); -- Create a target instance for the new client. procedure Create_Target (Listener : in out Socket_Listener_Type; Client : in GNAT.Sockets.Socket_Type; Address : in GNAT.Sockets.Sock_Addr_Type); type Socket_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with private; type Socket_Reader_Type_Access is access all Socket_Reader_Type'Class; procedure Close (Reader : in out Socket_Reader_Type); private type Socket_Listener_Type_Access is access all Socket_Listener_Type; task type Socket_Listener_Task is entry Start (Listener : in Socket_Listener_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type); end Socket_Listener_Task; task type Socket_Reader_Task is entry Start (Reader : in Socket_Reader_Type_Access; Client : in GNAT.Sockets.Socket_Type); end Socket_Reader_Task; type Socket_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with record Socket : aliased Util.Streams.Sockets.Socket_Stream; Server : Socket_Reader_Task; Client : GNAT.Sockets.Socket_Type; Stop : Boolean := False; end record; package Socket_Client_Lists is new Ada.Containers.Doubly_Linked_Lists (Element_Type => Socket_Reader_Type_Access); type Socket_Listener_Type is new Ada.Finalization.Limited_Controlled with record List : MAT.Events.Probes.Reader_List_Type_Access; Accept_Selector : aliased GNAT.Sockets.Selector_Type; Listener : Socket_Listener_Task; Clients : Socket_Client_Lists.List; end record; end MAT.Readers.Streams.Sockets;
12394
----------------------------------------------------------------------- -- mat-readers-sockets -- Reader for TCP/IP sockets -- Copyright (C) 2014 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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 Ada.Containers.Doubly_Linked_Lists; with Util.Streams.Sockets; with GNAT.Sockets; package MAT.Readers.Streams.Sockets is type Socket_Listener_Type is new Ada.Finalization.Limited_Controlled with private; -- Initialize the socket listener. overriding procedure Initialize (Listener : in out Socket_Listener_Type); -- Destroy the socket listener. overriding procedure Finalize (Listener : in out Socket_Listener_Type); -- Open the socket to accept connections and start the listener task. procedure Start (Listener : in out Socket_Listener_Type; List : in MAT.Events.Probes.Reader_List_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type); -- Stop the listener socket. procedure Stop (Listener : in out Socket_Listener_Type); -- Create a target instance for the new client. procedure Create_Target (Listener : in out Socket_Listener_Type; Client : in GNAT.Sockets.Socket_Type; Address : in GNAT.Sockets.Sock_Addr_Type); type Socket_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with private; type Socket_Reader_Type_Access is access all Socket_Reader_Type'Class; procedure Close (Reader : in out Socket_Reader_Type); private type Socket_Listener_Type_Access is access all Socket_Listener_Type; task type Socket_Listener_Task is entry Start (Listener : in Socket_Listener_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type); end Socket_Listener_Task; task type Socket_Reader_Task is entry Start (Reader : in Socket_Reader_Type_Access; Client : in GNAT.Sockets.Socket_Type); end Socket_Reader_Task; type Socket_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with record Socket : aliased Util.Streams.Sockets.Socket_Stream; Server : Socket_Reader_Task; Client : GNAT.Sockets.Socket_Type; Stop : Boolean := False; end record; package Socket_Client_Lists is new Ada.Containers.Doubly_Linked_Lists (Element_Type => Socket_Reader_Type_Access); type Socket_Listener_Type is new Ada.Finalization.Limited_Controlled with record List : MAT.Events.Probes.Reader_List_Type_Access; Accept_Selector : aliased GNAT.Sockets.Selector_Type; Listener : Socket_Listener_Task; Clients : Socket_Client_Lists.List; end record; end MAT.Readers.Streams.Sockets;
true
----------------------------------------------------------------------- -- mat-readers-sockets -- Reader for TCP/IP sockets -- Copyright (C) 2014 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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 Ada.Containers.Doubly_Linked_Lists; with Util.Streams.Sockets; with GNAT.Sockets; package MAT.Readers.Streams.Sockets is type Socket_Listener_Type is new Ada.Finalization.Limited_Controlled with private; -- Initialize the socket listener. overriding procedure Initialize (Listener : in out Socket_Listener_Type); -- Destroy the socket listener. overriding procedure Finalize (Listener : in out Socket_Listener_Type); -- Open the socket to accept connections and start the listener task. procedure Start (Listener : in out Socket_Listener_Type; List : in MAT.Events.Probes.Reader_List_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type); -- Stop the listener socket. procedure Stop (Listener : in out Socket_Listener_Type); -- Create a target instance for the new client. procedure Create_Target (Listener : in out Socket_Listener_Type; Client : in GNAT.Sockets.Socket_Type; Address : in GNAT.Sockets.Sock_Addr_Type); type Socket_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with private; type Socket_Reader_Type_Access is access all Socket_Reader_Type'Class; procedure Close (Reader : in out Socket_Reader_Type); private type Socket_Listener_Type_Access is access all Socket_Listener_Type; task type Socket_Listener_Task is entry Start (Listener : in Socket_Listener_Type_Access; Address : in GNAT.Sockets.Sock_Addr_Type); end Socket_Listener_Task; task type Socket_Reader_Task is entry Start (Reader : in Socket_Reader_Type_Access; Client : in GNAT.Sockets.Socket_Type); end Socket_Reader_Task; type Socket_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with record Socket : aliased Util.Streams.Sockets.Socket_Stream; Server : Socket_Reader_Task; Client : GNAT.Sockets.Socket_Type; Stop : Boolean := False; end record; package Socket_Client_Lists is new Ada.Containers.Doubly_Linked_Lists (Element_Type => Socket_Reader_Type_Access); type Socket_Listener_Type is new Ada.Finalization.Limited_Controlled with record List : MAT.Events.Probes.Reader_List_Type_Access; Accept_Selector : aliased GNAT.Sockets.Selector_Type; Listener : Socket_Listener_Task; Clients : Socket_Client_Lists.List; end record; end MAT.Readers.Streams.Sockets;
[ { "context": "hts reserved.\n--\n-- This software was developed by John Self of the Arcadia project\n-- at the University of Ca", "end": 133, "score": 0.9998561143875122, "start": 124, "tag": "NAME", "value": "John Self" }, { "context": "LAR PURPOSE.\n\n-- TITLE skeleton manager\n-- AUTHOR: John Self (UCI)\n-- DESCRIPTION outputs skeleton sections wh", "end": 973, "score": 0.999858021736145, "start": 964, "tag": "NAME", "value": "John Self" } ]
tools/aflex/src/skeleton_manager.ads
svn2github/matreshka
24
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by John Self of the Arcadia project -- at the University of California, Irvine. -- -- 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. -- TITLE skeleton manager -- AUTHOR: John Self (UCI) -- DESCRIPTION outputs skeleton sections when called by gen. -- NOTES allows use of internal or external skeleton -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/skeleton_managerS.a,v 1.3 90/01/12 15:20:38 self Exp Locker: self $ package Skeleton_Manager is procedure Skel_Out; -- skelout - write out one section of the skeleton file -- -- DESCRIPTION -- Either outputs internal skeleton, or from a file with "%%" dividers -- if a skeleton file is specified by the user. -- Copies from skelfile to stdout until a line beginning with "%%" or -- EOF is found. procedure Set_External_Skeleton; end Skeleton_Manager;
21241
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by <NAME> of the Arcadia project -- at the University of California, Irvine. -- -- 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. -- TITLE skeleton manager -- AUTHOR: <NAME> (UCI) -- DESCRIPTION outputs skeleton sections when called by gen. -- NOTES allows use of internal or external skeleton -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/skeleton_managerS.a,v 1.3 90/01/12 15:20:38 self Exp Locker: self $ package Skeleton_Manager is procedure Skel_Out; -- skelout - write out one section of the skeleton file -- -- DESCRIPTION -- Either outputs internal skeleton, or from a file with "%%" dividers -- if a skeleton file is specified by the user. -- Copies from skelfile to stdout until a line beginning with "%%" or -- EOF is found. procedure Set_External_Skeleton; end Skeleton_Manager;
true
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by PI:NAME:<NAME>END_PI of the Arcadia project -- at the University of California, Irvine. -- -- 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. -- TITLE skeleton manager -- AUTHOR: PI:NAME:<NAME>END_PI (UCI) -- DESCRIPTION outputs skeleton sections when called by gen. -- NOTES allows use of internal or external skeleton -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/skeleton_managerS.a,v 1.3 90/01/12 15:20:38 self Exp Locker: self $ package Skeleton_Manager is procedure Skel_Out; -- skelout - write out one section of the skeleton file -- -- DESCRIPTION -- Either outputs internal skeleton, or from a file with "%%" dividers -- if a skeleton file is specified by the user. -- Copies from skelfile to stdout until a line beginning with "%%" or -- EOF is found. procedure Set_External_Skeleton; end Skeleton_Manager;
[ { "context": "-- part of OpenGLAda, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 44, "score": 0.999841570854187, "start": 32, "tag": "NAME", "value": "Felix Krause" } ]
src/generator/tokenization.adb
Roldak/OpenGLAda
0
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with Ada.Characters.Handling; with Ada.Direct_IO; with Ada.Directories; with Ada.Strings.Maps; package body Tokenization is function Case_Insensitive_Hash (S : String) return Ada.Containers.Hash_Type is begin return Ada.Strings.Hash (Ada.Characters.Handling.To_Lower (S)); end Case_Insensitive_Hash; function Case_Insensitive_Equals (Left, Right : String) return Boolean is use Ada.Characters.Handling; begin return To_Lower (Left) = To_Lower (Right); end Case_Insensitive_Equals; use Ada.Strings.Maps; Inline_Separators : constant Character_Set := To_Set (Character'Val (9)) or To_Set (' '); Newlines : constant Character_Set := To_Set (Character'Val (10)) or To_Set (Character'Val (13)); Separators : constant Character_Set := Inline_Separators or Newlines; Single_Delimiters : constant Character_Set := To_Set ("&'()*+,-./:;<=>|"); Compound_Delimiters : constant array(1 .. 10) of String (1 .. 2) := ("=>", "..", "**", ":=", "/=", ">=", "<=", "<<", ">>", "<>"); function Tokenize (File_Path : String) return Tokenizer is File_Size : constant Natural := Natural (Ada.Directories.Size (File_Path)); subtype File_String is String (1 .. File_Size); package File_String_IO is new Ada.Direct_IO (File_String); File : File_String_IO.File_Type; begin File_String_IO.Open (File, File_String_IO.In_File, File_Path); return Ret : Tokenizer := Tokenizer'(Length => File_Size, Pos => 1, Depth => 0, Cur_Line => 1, Cur_Column => 1, others => <>) do File_String_IO.Read (File, Ret.Input); File_String_IO.Close (File); Ret.Symbol_Table.Insert ("access", Keyword_Access); Ret.Symbol_Table.Insert ("constant", Keyword_Constant); Ret.Symbol_Table.Insert ("dynamic", Keyword_Dynamic); Ret.Symbol_Table.Insert ("end", Keyword_End); Ret.Symbol_Table.Insert ("function", Keyword_Function); Ret.Symbol_Table.Insert ("in", Keyword_In); Ret.Symbol_Table.Insert ("is", Keyword_Is); Ret.Symbol_Table.Insert ("out", Keyword_Out); Ret.Symbol_Table.Insert ("package", Keyword_Package); Ret.Symbol_Table.Insert ("pragma", Keyword_Pragma); Ret.Symbol_Table.Insert ("procedure", Keyword_Procedure); Ret.Symbol_Table.Insert ("return", Keyword_Return); Ret.Symbol_Table.Insert ("spec", Keyword_Spec); Ret.Symbol_Table.Insert ("static", Keyword_Static); Ret.Symbol_Table.Insert ("subtype", Keyword_Subtype); Ret.Symbol_Table.Insert ("type", Keyword_Type); Ret.Symbol_Table.Insert ("use", Keyword_Use); Ret.Symbol_Table.Insert ("with", Keyword_With); Ret.Symbol_Table.Insert ("wrapper", Keyword_Wrapper); end return; end Tokenize; function Id (Object : in out Tokenizer; Symbol : String) return Symbol_Id is use String_Indexer; use type Ada.Containers.Count_Type; Position: Cursor; Inserted: Boolean; begin Object.Symbol_Table.Insert (Symbol, Symbol_Id (Object.Symbol_Table.Length + 1), Position, Inserted); return Element (Position); end Id; function Next (Object : in out Tokenizer) return Token is I : Positive := Object.Pos; Cur : Character; New_Line : Positive := Object.Cur_Line; New_Column : Positive := Object.Cur_Column; function Next_Char return Character is begin return Ret : constant Character := Object.Input (I) do I := I + 1; if Ret = Character'Val (10) then -- Linefeed New_Line := New_Line + 1; New_Column := 1; else New_Column := New_Column + 1; end if; end return; end Next_Char; procedure Update_Pos is begin Object.Pos := I; Object.Cur_Line := New_Line; Object.Cur_Column := New_Column; end Update_Pos; procedure Skip (Set : Character_Set) is begin while I <= Object.Input'Length loop exit when not Is_In (Object.Input (I), Set); Cur := Next_Char; end loop; end Skip; begin Skip (Separators); Update_Pos; Object.Prev_Line := Object.Cur_Line; Object.Prev_Column := Object.Cur_Column; if I > Object.Input'Length then return Token'(Kind => Stream_End, Length => 0, Content => ""); end if; Cur := Next_Char; if Is_In (Cur, Single_Delimiters) then if I <= Object.Input'Length then declare Next : constant Character := Object.Input (I); begin if Cur = '-' and Next = '-' then Cur := Next_Char; -- properly advance I/line/column Skip (not Newlines); return Ret : constant Token := Token'(Kind => Comment, Length => I - Object.Pos - 2, Content => Object.Input (Object.Pos + 2 .. I - 1)) do Update_Pos; end return; else declare Possible_Compound : constant String := Cur & Next; begin for J in 1 .. 10 loop if Compound_Delimiters (J) = Possible_Compound then Cur := Next_Char; -- properly advace I/line/column Update_Pos; return Token'(Kind => Delimiter, Length => 2, Content => Possible_Compound); end if; end loop; Update_Pos; if Cur = '(' then Object.Depth := Object.Depth + 1; elsif Cur = ')' then if Object.Depth = 0 then raise Tokenization_Error with "Extra `)`!"; end if; Object.Depth := Object.Depth - 1; end if; return Token'(Kind => Delimiter, Length => 1, Content => (1 => Cur)); end; end if; end; else Update_Pos; return Token'(Kind => Delimiter, Length => 1, Content => (1 => Cur)); end if; elsif Cur = '"' then while I <= Object.Input'Length loop <<continue>> Cur := Next_Char; if Cur = '"' then if I <= Object.Input'Length then if Object.Input (I) = '"' then Cur := Next_Char; -- properly advance I/line/column goto continue; end if; end if; return Ret : constant Token := Token'(Kind => String_Literal, Length => I - Object.Pos - 2, Content => Object.Input (Object.Pos + 1 .. I - 2)) do Update_Pos; end return; end if; end loop; raise Tokenization_Error with "Unclosed string literal"; else Skip (not (Separators or Single_Delimiters)); return Ret : Token := Token'(Kind => Identifier, Length => I - Object.Pos, Content => Object.Input (Object.Pos .. I - 1), Id => <>) do Ret.Id := Id (Object, Ret.Content); Update_Pos; end return; end if; end Next; function Paren_Depth (Object : Tokenizer) return Natural is begin return Object.Depth; end Paren_Depth; function Line (Object : Tokenizer) return Positive is (Object.Prev_Line); function Column (Object : Tokenizer) return Positive is (Object.Prev_Column); function To_String (T : Token) return String is begin if T.Kind = Identifier and then Is_Keyword (T.Id) then return "KEYWORD'(""" & T.Content & """)"; else return T.Kind'Img & "'(""" & T.Content & """)"; end if; end To_String; function Is_Keyword (Id : Symbol_Id) return Boolean is (Id < Keyword_Wrapper); function Copy (T : Token) return Token is begin case T.Kind is when Identifier => return Token'(Kind => Identifier, Length => T.Length, Content => T.Content, Id => T.Id); when Numeric_Literal => return Token'(Kind => Numeric_Literal, Length => T.Length, Content => T.Content); when String_Literal => return Token'(Kind => String_Literal, Length => T.Length, Content => T.Content); when Delimiter => return Token'(Kind => Delimiter, Length => T.Length, Content => T.Content); when Comment => return Token'(Kind => Comment, Length => T.Length, Content => T.Content); when Stream_End => return Token'(Kind => Stream_End, Length => 0, Content => ""); end case; end Copy; procedure Register_Symbol (Object : in out Tokenizer; Symbol : String; New_Id : out Symbol_Id) is begin New_Id := Id (Object, Symbol); end Register_Symbol; end Tokenization;
18000
-- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" with Ada.Characters.Handling; with Ada.Direct_IO; with Ada.Directories; with Ada.Strings.Maps; package body Tokenization is function Case_Insensitive_Hash (S : String) return Ada.Containers.Hash_Type is begin return Ada.Strings.Hash (Ada.Characters.Handling.To_Lower (S)); end Case_Insensitive_Hash; function Case_Insensitive_Equals (Left, Right : String) return Boolean is use Ada.Characters.Handling; begin return To_Lower (Left) = To_Lower (Right); end Case_Insensitive_Equals; use Ada.Strings.Maps; Inline_Separators : constant Character_Set := To_Set (Character'Val (9)) or To_Set (' '); Newlines : constant Character_Set := To_Set (Character'Val (10)) or To_Set (Character'Val (13)); Separators : constant Character_Set := Inline_Separators or Newlines; Single_Delimiters : constant Character_Set := To_Set ("&'()*+,-./:;<=>|"); Compound_Delimiters : constant array(1 .. 10) of String (1 .. 2) := ("=>", "..", "**", ":=", "/=", ">=", "<=", "<<", ">>", "<>"); function Tokenize (File_Path : String) return Tokenizer is File_Size : constant Natural := Natural (Ada.Directories.Size (File_Path)); subtype File_String is String (1 .. File_Size); package File_String_IO is new Ada.Direct_IO (File_String); File : File_String_IO.File_Type; begin File_String_IO.Open (File, File_String_IO.In_File, File_Path); return Ret : Tokenizer := Tokenizer'(Length => File_Size, Pos => 1, Depth => 0, Cur_Line => 1, Cur_Column => 1, others => <>) do File_String_IO.Read (File, Ret.Input); File_String_IO.Close (File); Ret.Symbol_Table.Insert ("access", Keyword_Access); Ret.Symbol_Table.Insert ("constant", Keyword_Constant); Ret.Symbol_Table.Insert ("dynamic", Keyword_Dynamic); Ret.Symbol_Table.Insert ("end", Keyword_End); Ret.Symbol_Table.Insert ("function", Keyword_Function); Ret.Symbol_Table.Insert ("in", Keyword_In); Ret.Symbol_Table.Insert ("is", Keyword_Is); Ret.Symbol_Table.Insert ("out", Keyword_Out); Ret.Symbol_Table.Insert ("package", Keyword_Package); Ret.Symbol_Table.Insert ("pragma", Keyword_Pragma); Ret.Symbol_Table.Insert ("procedure", Keyword_Procedure); Ret.Symbol_Table.Insert ("return", Keyword_Return); Ret.Symbol_Table.Insert ("spec", Keyword_Spec); Ret.Symbol_Table.Insert ("static", Keyword_Static); Ret.Symbol_Table.Insert ("subtype", Keyword_Subtype); Ret.Symbol_Table.Insert ("type", Keyword_Type); Ret.Symbol_Table.Insert ("use", Keyword_Use); Ret.Symbol_Table.Insert ("with", Keyword_With); Ret.Symbol_Table.Insert ("wrapper", Keyword_Wrapper); end return; end Tokenize; function Id (Object : in out Tokenizer; Symbol : String) return Symbol_Id is use String_Indexer; use type Ada.Containers.Count_Type; Position: Cursor; Inserted: Boolean; begin Object.Symbol_Table.Insert (Symbol, Symbol_Id (Object.Symbol_Table.Length + 1), Position, Inserted); return Element (Position); end Id; function Next (Object : in out Tokenizer) return Token is I : Positive := Object.Pos; Cur : Character; New_Line : Positive := Object.Cur_Line; New_Column : Positive := Object.Cur_Column; function Next_Char return Character is begin return Ret : constant Character := Object.Input (I) do I := I + 1; if Ret = Character'Val (10) then -- Linefeed New_Line := New_Line + 1; New_Column := 1; else New_Column := New_Column + 1; end if; end return; end Next_Char; procedure Update_Pos is begin Object.Pos := I; Object.Cur_Line := New_Line; Object.Cur_Column := New_Column; end Update_Pos; procedure Skip (Set : Character_Set) is begin while I <= Object.Input'Length loop exit when not Is_In (Object.Input (I), Set); Cur := Next_Char; end loop; end Skip; begin Skip (Separators); Update_Pos; Object.Prev_Line := Object.Cur_Line; Object.Prev_Column := Object.Cur_Column; if I > Object.Input'Length then return Token'(Kind => Stream_End, Length => 0, Content => ""); end if; Cur := Next_Char; if Is_In (Cur, Single_Delimiters) then if I <= Object.Input'Length then declare Next : constant Character := Object.Input (I); begin if Cur = '-' and Next = '-' then Cur := Next_Char; -- properly advance I/line/column Skip (not Newlines); return Ret : constant Token := Token'(Kind => Comment, Length => I - Object.Pos - 2, Content => Object.Input (Object.Pos + 2 .. I - 1)) do Update_Pos; end return; else declare Possible_Compound : constant String := Cur & Next; begin for J in 1 .. 10 loop if Compound_Delimiters (J) = Possible_Compound then Cur := Next_Char; -- properly advace I/line/column Update_Pos; return Token'(Kind => Delimiter, Length => 2, Content => Possible_Compound); end if; end loop; Update_Pos; if Cur = '(' then Object.Depth := Object.Depth + 1; elsif Cur = ')' then if Object.Depth = 0 then raise Tokenization_Error with "Extra `)`!"; end if; Object.Depth := Object.Depth - 1; end if; return Token'(Kind => Delimiter, Length => 1, Content => (1 => Cur)); end; end if; end; else Update_Pos; return Token'(Kind => Delimiter, Length => 1, Content => (1 => Cur)); end if; elsif Cur = '"' then while I <= Object.Input'Length loop <<continue>> Cur := Next_Char; if Cur = '"' then if I <= Object.Input'Length then if Object.Input (I) = '"' then Cur := Next_Char; -- properly advance I/line/column goto continue; end if; end if; return Ret : constant Token := Token'(Kind => String_Literal, Length => I - Object.Pos - 2, Content => Object.Input (Object.Pos + 1 .. I - 2)) do Update_Pos; end return; end if; end loop; raise Tokenization_Error with "Unclosed string literal"; else Skip (not (Separators or Single_Delimiters)); return Ret : Token := Token'(Kind => Identifier, Length => I - Object.Pos, Content => Object.Input (Object.Pos .. I - 1), Id => <>) do Ret.Id := Id (Object, Ret.Content); Update_Pos; end return; end if; end Next; function Paren_Depth (Object : Tokenizer) return Natural is begin return Object.Depth; end Paren_Depth; function Line (Object : Tokenizer) return Positive is (Object.Prev_Line); function Column (Object : Tokenizer) return Positive is (Object.Prev_Column); function To_String (T : Token) return String is begin if T.Kind = Identifier and then Is_Keyword (T.Id) then return "KEYWORD'(""" & T.Content & """)"; else return T.Kind'Img & "'(""" & T.Content & """)"; end if; end To_String; function Is_Keyword (Id : Symbol_Id) return Boolean is (Id < Keyword_Wrapper); function Copy (T : Token) return Token is begin case T.Kind is when Identifier => return Token'(Kind => Identifier, Length => T.Length, Content => T.Content, Id => T.Id); when Numeric_Literal => return Token'(Kind => Numeric_Literal, Length => T.Length, Content => T.Content); when String_Literal => return Token'(Kind => String_Literal, Length => T.Length, Content => T.Content); when Delimiter => return Token'(Kind => Delimiter, Length => T.Length, Content => T.Content); when Comment => return Token'(Kind => Comment, Length => T.Length, Content => T.Content); when Stream_End => return Token'(Kind => Stream_End, Length => 0, Content => ""); end case; end Copy; procedure Register_Symbol (Object : in out Tokenizer; Symbol : String; New_Id : out Symbol_Id) is begin New_Id := Id (Object, Symbol); end Register_Symbol; end Tokenization;
true
-- part of OpenGLAda, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "COPYING" with Ada.Characters.Handling; with Ada.Direct_IO; with Ada.Directories; with Ada.Strings.Maps; package body Tokenization is function Case_Insensitive_Hash (S : String) return Ada.Containers.Hash_Type is begin return Ada.Strings.Hash (Ada.Characters.Handling.To_Lower (S)); end Case_Insensitive_Hash; function Case_Insensitive_Equals (Left, Right : String) return Boolean is use Ada.Characters.Handling; begin return To_Lower (Left) = To_Lower (Right); end Case_Insensitive_Equals; use Ada.Strings.Maps; Inline_Separators : constant Character_Set := To_Set (Character'Val (9)) or To_Set (' '); Newlines : constant Character_Set := To_Set (Character'Val (10)) or To_Set (Character'Val (13)); Separators : constant Character_Set := Inline_Separators or Newlines; Single_Delimiters : constant Character_Set := To_Set ("&'()*+,-./:;<=>|"); Compound_Delimiters : constant array(1 .. 10) of String (1 .. 2) := ("=>", "..", "**", ":=", "/=", ">=", "<=", "<<", ">>", "<>"); function Tokenize (File_Path : String) return Tokenizer is File_Size : constant Natural := Natural (Ada.Directories.Size (File_Path)); subtype File_String is String (1 .. File_Size); package File_String_IO is new Ada.Direct_IO (File_String); File : File_String_IO.File_Type; begin File_String_IO.Open (File, File_String_IO.In_File, File_Path); return Ret : Tokenizer := Tokenizer'(Length => File_Size, Pos => 1, Depth => 0, Cur_Line => 1, Cur_Column => 1, others => <>) do File_String_IO.Read (File, Ret.Input); File_String_IO.Close (File); Ret.Symbol_Table.Insert ("access", Keyword_Access); Ret.Symbol_Table.Insert ("constant", Keyword_Constant); Ret.Symbol_Table.Insert ("dynamic", Keyword_Dynamic); Ret.Symbol_Table.Insert ("end", Keyword_End); Ret.Symbol_Table.Insert ("function", Keyword_Function); Ret.Symbol_Table.Insert ("in", Keyword_In); Ret.Symbol_Table.Insert ("is", Keyword_Is); Ret.Symbol_Table.Insert ("out", Keyword_Out); Ret.Symbol_Table.Insert ("package", Keyword_Package); Ret.Symbol_Table.Insert ("pragma", Keyword_Pragma); Ret.Symbol_Table.Insert ("procedure", Keyword_Procedure); Ret.Symbol_Table.Insert ("return", Keyword_Return); Ret.Symbol_Table.Insert ("spec", Keyword_Spec); Ret.Symbol_Table.Insert ("static", Keyword_Static); Ret.Symbol_Table.Insert ("subtype", Keyword_Subtype); Ret.Symbol_Table.Insert ("type", Keyword_Type); Ret.Symbol_Table.Insert ("use", Keyword_Use); Ret.Symbol_Table.Insert ("with", Keyword_With); Ret.Symbol_Table.Insert ("wrapper", Keyword_Wrapper); end return; end Tokenize; function Id (Object : in out Tokenizer; Symbol : String) return Symbol_Id is use String_Indexer; use type Ada.Containers.Count_Type; Position: Cursor; Inserted: Boolean; begin Object.Symbol_Table.Insert (Symbol, Symbol_Id (Object.Symbol_Table.Length + 1), Position, Inserted); return Element (Position); end Id; function Next (Object : in out Tokenizer) return Token is I : Positive := Object.Pos; Cur : Character; New_Line : Positive := Object.Cur_Line; New_Column : Positive := Object.Cur_Column; function Next_Char return Character is begin return Ret : constant Character := Object.Input (I) do I := I + 1; if Ret = Character'Val (10) then -- Linefeed New_Line := New_Line + 1; New_Column := 1; else New_Column := New_Column + 1; end if; end return; end Next_Char; procedure Update_Pos is begin Object.Pos := I; Object.Cur_Line := New_Line; Object.Cur_Column := New_Column; end Update_Pos; procedure Skip (Set : Character_Set) is begin while I <= Object.Input'Length loop exit when not Is_In (Object.Input (I), Set); Cur := Next_Char; end loop; end Skip; begin Skip (Separators); Update_Pos; Object.Prev_Line := Object.Cur_Line; Object.Prev_Column := Object.Cur_Column; if I > Object.Input'Length then return Token'(Kind => Stream_End, Length => 0, Content => ""); end if; Cur := Next_Char; if Is_In (Cur, Single_Delimiters) then if I <= Object.Input'Length then declare Next : constant Character := Object.Input (I); begin if Cur = '-' and Next = '-' then Cur := Next_Char; -- properly advance I/line/column Skip (not Newlines); return Ret : constant Token := Token'(Kind => Comment, Length => I - Object.Pos - 2, Content => Object.Input (Object.Pos + 2 .. I - 1)) do Update_Pos; end return; else declare Possible_Compound : constant String := Cur & Next; begin for J in 1 .. 10 loop if Compound_Delimiters (J) = Possible_Compound then Cur := Next_Char; -- properly advace I/line/column Update_Pos; return Token'(Kind => Delimiter, Length => 2, Content => Possible_Compound); end if; end loop; Update_Pos; if Cur = '(' then Object.Depth := Object.Depth + 1; elsif Cur = ')' then if Object.Depth = 0 then raise Tokenization_Error with "Extra `)`!"; end if; Object.Depth := Object.Depth - 1; end if; return Token'(Kind => Delimiter, Length => 1, Content => (1 => Cur)); end; end if; end; else Update_Pos; return Token'(Kind => Delimiter, Length => 1, Content => (1 => Cur)); end if; elsif Cur = '"' then while I <= Object.Input'Length loop <<continue>> Cur := Next_Char; if Cur = '"' then if I <= Object.Input'Length then if Object.Input (I) = '"' then Cur := Next_Char; -- properly advance I/line/column goto continue; end if; end if; return Ret : constant Token := Token'(Kind => String_Literal, Length => I - Object.Pos - 2, Content => Object.Input (Object.Pos + 1 .. I - 2)) do Update_Pos; end return; end if; end loop; raise Tokenization_Error with "Unclosed string literal"; else Skip (not (Separators or Single_Delimiters)); return Ret : Token := Token'(Kind => Identifier, Length => I - Object.Pos, Content => Object.Input (Object.Pos .. I - 1), Id => <>) do Ret.Id := Id (Object, Ret.Content); Update_Pos; end return; end if; end Next; function Paren_Depth (Object : Tokenizer) return Natural is begin return Object.Depth; end Paren_Depth; function Line (Object : Tokenizer) return Positive is (Object.Prev_Line); function Column (Object : Tokenizer) return Positive is (Object.Prev_Column); function To_String (T : Token) return String is begin if T.Kind = Identifier and then Is_Keyword (T.Id) then return "KEYWORD'(""" & T.Content & """)"; else return T.Kind'Img & "'(""" & T.Content & """)"; end if; end To_String; function Is_Keyword (Id : Symbol_Id) return Boolean is (Id < Keyword_Wrapper); function Copy (T : Token) return Token is begin case T.Kind is when Identifier => return Token'(Kind => Identifier, Length => T.Length, Content => T.Content, Id => T.Id); when Numeric_Literal => return Token'(Kind => Numeric_Literal, Length => T.Length, Content => T.Content); when String_Literal => return Token'(Kind => String_Literal, Length => T.Length, Content => T.Content); when Delimiter => return Token'(Kind => Delimiter, Length => T.Length, Content => T.Content); when Comment => return Token'(Kind => Comment, Length => T.Length, Content => T.Content); when Stream_End => return Token'(Kind => Stream_End, Length => 0, Content => ""); end case; end Copy; procedure Register_Symbol (Object : in out Tokenizer; Symbol : String; New_Id : out Symbol_Id) is begin New_Id := Id (Object, Symbol); end Register_Symbol; end Tokenization;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.999853789806366, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999301433563232, "start": 37, "tag": "EMAIL", "value": "[email protected]" } ]
source/coroutines-polling.adb
reznikmm/coroutines
3
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; package body Coroutines.Polling is use type Interfaces.C.int; function epoll_create1 (Flag : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_create1"; pragma Warnings (Off); EPOLL_CLOEXEC : constant := 8#02000000#; EPOLLIN : constant := 16#001#; EPOLLPRI : constant := 16#002#; EPOLLOUT : constant := 16#004#; EPOLLRDNORM : constant := 16#040#; EPOLLRDBAND : constant := 16#080#; EPOLLWRNORM : constant := 16#100#; EPOLLWRBAND : constant := 16#200#; EPOLLMSG : constant := 16#400#; EPOLLERR : constant := 16#008#; EPOLLHUP : constant := 16#010#; EPOLLRDHUP : constant := 16#2000#; -- EPOLLEXCLUSIVE = 1u << 28, EPOLLEXCLUSIVE : constant := 16#1000_0000#; -- EPOLLWAKEUP = 1u << 29, EPOLLWAKEUP : constant := 16#2000_0000#; -- EPOLLONESHOT = 1u << 30, EPOLLONESHOT : constant := 16#4000_0000#; -- EPOLLET = 1u << 31 EPOLLET : constant := 16#8000_0000#; EPOLL_CTL_ADD : constant := 1; EPOLL_CTL_DEL : constant := 2; EPOLL_CTL_MOD : constant := 3; pragma Warnings (On); type Polling_Manager; type Polling_Manager_Access is access all Polling_Manager'Class; type Polling_Event is new Event_Object with record FD : Polling.FD; Events : Polling_Kind_Set; Context : Coroutines.Context; Manager : Polling_Manager_Access; Ready : Boolean := False; Active : Boolean := False; -- Already in epfd Drop : Boolean := False; -- Already in epfd, but should not end record; overriding procedure Activate (Self : in out Polling_Event); overriding function Ready (Self : Polling_Event) return Boolean; overriding procedure Deactivate (Self : in out Polling_Event); type Polling_Event_Access is access all Polling_Event; function Hash (Value : FD) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (Value)); type epoll_event is record events : Interfaces.Unsigned_32; data : Polling_Event_Access; end record with Convention => C, Size => 12 * 8, Alignment => 4; for epoll_event use record events at 0 range 0 .. 31; data at 4 range 64 - Long_Integer'Size .. 63; end record; function epoll_ctl (epfd : Interfaces.C.int; op : Interfaces.C.int; fd : Interfaces.C.int; event : epoll_event) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_ctl"; type epoll_event_array is array (Ada.Containers.Count_Type range <>) of epoll_event with Alignment => 4, Component_Size => 12 * 8; function epoll_wait (epfd : Interfaces.C.int; events : out epoll_event_array; maxevents : Interfaces.C.int; timeout : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_wait"; package Event_Maps is new Ada.Containers.Hashed_Maps (Key_Type => FD, Element_Type => Polling_Event_Access, Hash => Hash, Equivalent_Keys => Interfaces.C."="); package Event_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Polling_Event_Access); type Polling_Manager is new Coroutine_Manager with record epfd : FD; Active : Event_Maps.Map; -- Events in epfd Unused : Event_Vectors.Vector; -- Events not in epfd end record; overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id); overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration); function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32; Manager : aliased Polling_Manager; -------------- -- Activate -- -------------- overriding procedure Activate (Self : in out Polling_Event) is Error : Interfaces.C.int; begin if not Self.Active then Error := epoll_ctl (epfd => Self.Manager.epfd, op => EPOLL_CTL_ADD, fd => Self.FD, event => (To_C (Self.Events), Self'Unchecked_Access)); pragma Assert (Error = 0); Self.Active := True; Self.Manager.Active.Insert (Self.FD, Self'Unchecked_Access); end if; end Activate; ---------------- -- Deactivate -- ---------------- overriding procedure Deactivate (Self : in out Polling_Event) is begin Self.Drop := True; end Deactivate; ---------------------------- -- Get_Always_Ready_Event -- ---------------------------- overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id) is begin raise Constraint_Error; end Get_Always_Ready_Event; ---------------- -- Initialize -- ---------------- procedure Initialize is begin pragma Assert (Coroutines.Manager = null, "Register Pooling first!"); Coroutines.Manager := Manager'Access; Manager.epfd := epoll_create1 (EPOLL_CLOEXEC); end Initialize; --------------- -- New_Round -- --------------- overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration) is Error : Interfaces.C.int; Last : constant Positive := Self.Unused.Last_Index + 1; begin -- Remove unused FD from epfd for J of Self.Active loop if J.Drop then Error := epoll_ctl (epfd => Self.epfd, op => EPOLL_CTL_DEL, fd => J.FD, event => (0, null)); pragma Assert (Error = 0); Self.Unused.Append (J); end if; end loop; -- Remove unused FD from Active for J in Last .. Self.Unused.Last_Index loop Self.Active.Delete (Self.Unused (J).FD); end loop; declare Events : epoll_event_array (1 .. Self.Active.Length); begin Error := epoll_wait (epfd => Self.epfd, events => Events, maxevents => Events'Length, timeout => Interfaces.C.int (1000.0 * Timeout)); if Error >= 0 then for J in 1 .. Ada.Containers.Count_Type (Error) loop Queue.Append (Events (J).data.Context); Events (J).data.Ready := True; end loop; end if; end; end New_Round; ----------- -- Ready -- ----------- overriding function Ready (Self : Polling_Event) return Boolean is begin return Self.Ready; end Ready; ---------- -- To_C -- ---------- function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32 is use type Interfaces.Unsigned_32; Mapping : constant array (Polling_Kind) of Interfaces.Unsigned_32 := (Input => EPOLLIN, Output => EPOLLOUT, Error => EPOLLERR, Close => EPOLLHUP); Result : Interfaces.Unsigned_32 := 0; begin for J in Value'Range loop if Value (J) then Result := Result + Mapping (J); end if; end loop; return Result; end To_C; ----------- -- Watch -- ----------- function Watch (File : FD; Events : Polling_Kind_Set) return Event_Id is Cursor : constant Event_Maps.Cursor := Manager.Active.Find (File); Result : Polling_Event_Access; Error : Interfaces.C.int; begin if Event_Maps.Has_Element (Cursor) then Result := Event_Maps.Element (Cursor); Result.Context := Current_Context; Result.Ready := False; Result.Drop := False; if Result.Events = Events then return Event_Id (Result); else Error := epoll_ctl (epfd => Manager.epfd, op => EPOLL_CTL_DEL, fd => File, event => (0, null)); pragma Assert (Error = 0); end if; elsif Manager.Unused.Is_Empty then Result := new Polling_Event; else Result := Manager.Unused.Last_Element; Manager.Unused.Delete_Last; end if; Result.all := (Event_Object with FD => File, Events => Events, Context => Current_Context, Manager => Manager'Access, Ready => False, Active => False, Drop => False); return Event_Id (Result); end Watch; end Coroutines.Polling;
23451
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; package body Coroutines.Polling is use type Interfaces.C.int; function epoll_create1 (Flag : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_create1"; pragma Warnings (Off); EPOLL_CLOEXEC : constant := 8#02000000#; EPOLLIN : constant := 16#001#; EPOLLPRI : constant := 16#002#; EPOLLOUT : constant := 16#004#; EPOLLRDNORM : constant := 16#040#; EPOLLRDBAND : constant := 16#080#; EPOLLWRNORM : constant := 16#100#; EPOLLWRBAND : constant := 16#200#; EPOLLMSG : constant := 16#400#; EPOLLERR : constant := 16#008#; EPOLLHUP : constant := 16#010#; EPOLLRDHUP : constant := 16#2000#; -- EPOLLEXCLUSIVE = 1u << 28, EPOLLEXCLUSIVE : constant := 16#1000_0000#; -- EPOLLWAKEUP = 1u << 29, EPOLLWAKEUP : constant := 16#2000_0000#; -- EPOLLONESHOT = 1u << 30, EPOLLONESHOT : constant := 16#4000_0000#; -- EPOLLET = 1u << 31 EPOLLET : constant := 16#8000_0000#; EPOLL_CTL_ADD : constant := 1; EPOLL_CTL_DEL : constant := 2; EPOLL_CTL_MOD : constant := 3; pragma Warnings (On); type Polling_Manager; type Polling_Manager_Access is access all Polling_Manager'Class; type Polling_Event is new Event_Object with record FD : Polling.FD; Events : Polling_Kind_Set; Context : Coroutines.Context; Manager : Polling_Manager_Access; Ready : Boolean := False; Active : Boolean := False; -- Already in epfd Drop : Boolean := False; -- Already in epfd, but should not end record; overriding procedure Activate (Self : in out Polling_Event); overriding function Ready (Self : Polling_Event) return Boolean; overriding procedure Deactivate (Self : in out Polling_Event); type Polling_Event_Access is access all Polling_Event; function Hash (Value : FD) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (Value)); type epoll_event is record events : Interfaces.Unsigned_32; data : Polling_Event_Access; end record with Convention => C, Size => 12 * 8, Alignment => 4; for epoll_event use record events at 0 range 0 .. 31; data at 4 range 64 - Long_Integer'Size .. 63; end record; function epoll_ctl (epfd : Interfaces.C.int; op : Interfaces.C.int; fd : Interfaces.C.int; event : epoll_event) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_ctl"; type epoll_event_array is array (Ada.Containers.Count_Type range <>) of epoll_event with Alignment => 4, Component_Size => 12 * 8; function epoll_wait (epfd : Interfaces.C.int; events : out epoll_event_array; maxevents : Interfaces.C.int; timeout : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_wait"; package Event_Maps is new Ada.Containers.Hashed_Maps (Key_Type => FD, Element_Type => Polling_Event_Access, Hash => Hash, Equivalent_Keys => Interfaces.C."="); package Event_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Polling_Event_Access); type Polling_Manager is new Coroutine_Manager with record epfd : FD; Active : Event_Maps.Map; -- Events in epfd Unused : Event_Vectors.Vector; -- Events not in epfd end record; overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id); overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration); function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32; Manager : aliased Polling_Manager; -------------- -- Activate -- -------------- overriding procedure Activate (Self : in out Polling_Event) is Error : Interfaces.C.int; begin if not Self.Active then Error := epoll_ctl (epfd => Self.Manager.epfd, op => EPOLL_CTL_ADD, fd => Self.FD, event => (To_C (Self.Events), Self'Unchecked_Access)); pragma Assert (Error = 0); Self.Active := True; Self.Manager.Active.Insert (Self.FD, Self'Unchecked_Access); end if; end Activate; ---------------- -- Deactivate -- ---------------- overriding procedure Deactivate (Self : in out Polling_Event) is begin Self.Drop := True; end Deactivate; ---------------------------- -- Get_Always_Ready_Event -- ---------------------------- overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id) is begin raise Constraint_Error; end Get_Always_Ready_Event; ---------------- -- Initialize -- ---------------- procedure Initialize is begin pragma Assert (Coroutines.Manager = null, "Register Pooling first!"); Coroutines.Manager := Manager'Access; Manager.epfd := epoll_create1 (EPOLL_CLOEXEC); end Initialize; --------------- -- New_Round -- --------------- overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration) is Error : Interfaces.C.int; Last : constant Positive := Self.Unused.Last_Index + 1; begin -- Remove unused FD from epfd for J of Self.Active loop if J.Drop then Error := epoll_ctl (epfd => Self.epfd, op => EPOLL_CTL_DEL, fd => J.FD, event => (0, null)); pragma Assert (Error = 0); Self.Unused.Append (J); end if; end loop; -- Remove unused FD from Active for J in Last .. Self.Unused.Last_Index loop Self.Active.Delete (Self.Unused (J).FD); end loop; declare Events : epoll_event_array (1 .. Self.Active.Length); begin Error := epoll_wait (epfd => Self.epfd, events => Events, maxevents => Events'Length, timeout => Interfaces.C.int (1000.0 * Timeout)); if Error >= 0 then for J in 1 .. Ada.Containers.Count_Type (Error) loop Queue.Append (Events (J).data.Context); Events (J).data.Ready := True; end loop; end if; end; end New_Round; ----------- -- Ready -- ----------- overriding function Ready (Self : Polling_Event) return Boolean is begin return Self.Ready; end Ready; ---------- -- To_C -- ---------- function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32 is use type Interfaces.Unsigned_32; Mapping : constant array (Polling_Kind) of Interfaces.Unsigned_32 := (Input => EPOLLIN, Output => EPOLLOUT, Error => EPOLLERR, Close => EPOLLHUP); Result : Interfaces.Unsigned_32 := 0; begin for J in Value'Range loop if Value (J) then Result := Result + Mapping (J); end if; end loop; return Result; end To_C; ----------- -- Watch -- ----------- function Watch (File : FD; Events : Polling_Kind_Set) return Event_Id is Cursor : constant Event_Maps.Cursor := Manager.Active.Find (File); Result : Polling_Event_Access; Error : Interfaces.C.int; begin if Event_Maps.Has_Element (Cursor) then Result := Event_Maps.Element (Cursor); Result.Context := Current_Context; Result.Ready := False; Result.Drop := False; if Result.Events = Events then return Event_Id (Result); else Error := epoll_ctl (epfd => Manager.epfd, op => EPOLL_CTL_DEL, fd => File, event => (0, null)); pragma Assert (Error = 0); end if; elsif Manager.Unused.Is_Empty then Result := new Polling_Event; else Result := Manager.Unused.Last_Element; Manager.Unused.Delete_Last; end if; Result.all := (Event_Object with FD => File, Events => Events, Context => Current_Context, Manager => Manager'Access, Ready => False, Active => False, Drop => False); return Event_Id (Result); end Watch; end Coroutines.Polling;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; package body Coroutines.Polling is use type Interfaces.C.int; function epoll_create1 (Flag : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_create1"; pragma Warnings (Off); EPOLL_CLOEXEC : constant := 8#02000000#; EPOLLIN : constant := 16#001#; EPOLLPRI : constant := 16#002#; EPOLLOUT : constant := 16#004#; EPOLLRDNORM : constant := 16#040#; EPOLLRDBAND : constant := 16#080#; EPOLLWRNORM : constant := 16#100#; EPOLLWRBAND : constant := 16#200#; EPOLLMSG : constant := 16#400#; EPOLLERR : constant := 16#008#; EPOLLHUP : constant := 16#010#; EPOLLRDHUP : constant := 16#2000#; -- EPOLLEXCLUSIVE = 1u << 28, EPOLLEXCLUSIVE : constant := 16#1000_0000#; -- EPOLLWAKEUP = 1u << 29, EPOLLWAKEUP : constant := 16#2000_0000#; -- EPOLLONESHOT = 1u << 30, EPOLLONESHOT : constant := 16#4000_0000#; -- EPOLLET = 1u << 31 EPOLLET : constant := 16#8000_0000#; EPOLL_CTL_ADD : constant := 1; EPOLL_CTL_DEL : constant := 2; EPOLL_CTL_MOD : constant := 3; pragma Warnings (On); type Polling_Manager; type Polling_Manager_Access is access all Polling_Manager'Class; type Polling_Event is new Event_Object with record FD : Polling.FD; Events : Polling_Kind_Set; Context : Coroutines.Context; Manager : Polling_Manager_Access; Ready : Boolean := False; Active : Boolean := False; -- Already in epfd Drop : Boolean := False; -- Already in epfd, but should not end record; overriding procedure Activate (Self : in out Polling_Event); overriding function Ready (Self : Polling_Event) return Boolean; overriding procedure Deactivate (Self : in out Polling_Event); type Polling_Event_Access is access all Polling_Event; function Hash (Value : FD) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (Value)); type epoll_event is record events : Interfaces.Unsigned_32; data : Polling_Event_Access; end record with Convention => C, Size => 12 * 8, Alignment => 4; for epoll_event use record events at 0 range 0 .. 31; data at 4 range 64 - Long_Integer'Size .. 63; end record; function epoll_ctl (epfd : Interfaces.C.int; op : Interfaces.C.int; fd : Interfaces.C.int; event : epoll_event) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_ctl"; type epoll_event_array is array (Ada.Containers.Count_Type range <>) of epoll_event with Alignment => 4, Component_Size => 12 * 8; function epoll_wait (epfd : Interfaces.C.int; events : out epoll_event_array; maxevents : Interfaces.C.int; timeout : Interfaces.C.int) return Interfaces.C.int with Import, Convention => C, External_Name => "epoll_wait"; package Event_Maps is new Ada.Containers.Hashed_Maps (Key_Type => FD, Element_Type => Polling_Event_Access, Hash => Hash, Equivalent_Keys => Interfaces.C."="); package Event_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Polling_Event_Access); type Polling_Manager is new Coroutine_Manager with record epfd : FD; Active : Event_Maps.Map; -- Events in epfd Unused : Event_Vectors.Vector; -- Events not in epfd end record; overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id); overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration); function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32; Manager : aliased Polling_Manager; -------------- -- Activate -- -------------- overriding procedure Activate (Self : in out Polling_Event) is Error : Interfaces.C.int; begin if not Self.Active then Error := epoll_ctl (epfd => Self.Manager.epfd, op => EPOLL_CTL_ADD, fd => Self.FD, event => (To_C (Self.Events), Self'Unchecked_Access)); pragma Assert (Error = 0); Self.Active := True; Self.Manager.Active.Insert (Self.FD, Self'Unchecked_Access); end if; end Activate; ---------------- -- Deactivate -- ---------------- overriding procedure Deactivate (Self : in out Polling_Event) is begin Self.Drop := True; end Deactivate; ---------------------------- -- Get_Always_Ready_Event -- ---------------------------- overriding procedure Get_Always_Ready_Event (Self : in out Polling_Manager; Result : out Event_Id) is begin raise Constraint_Error; end Get_Always_Ready_Event; ---------------- -- Initialize -- ---------------- procedure Initialize is begin pragma Assert (Coroutines.Manager = null, "Register Pooling first!"); Coroutines.Manager := Manager'Access; Manager.epfd := epoll_create1 (EPOLL_CLOEXEC); end Initialize; --------------- -- New_Round -- --------------- overriding procedure New_Round (Self : in out Polling_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration) is Error : Interfaces.C.int; Last : constant Positive := Self.Unused.Last_Index + 1; begin -- Remove unused FD from epfd for J of Self.Active loop if J.Drop then Error := epoll_ctl (epfd => Self.epfd, op => EPOLL_CTL_DEL, fd => J.FD, event => (0, null)); pragma Assert (Error = 0); Self.Unused.Append (J); end if; end loop; -- Remove unused FD from Active for J in Last .. Self.Unused.Last_Index loop Self.Active.Delete (Self.Unused (J).FD); end loop; declare Events : epoll_event_array (1 .. Self.Active.Length); begin Error := epoll_wait (epfd => Self.epfd, events => Events, maxevents => Events'Length, timeout => Interfaces.C.int (1000.0 * Timeout)); if Error >= 0 then for J in 1 .. Ada.Containers.Count_Type (Error) loop Queue.Append (Events (J).data.Context); Events (J).data.Ready := True; end loop; end if; end; end New_Round; ----------- -- Ready -- ----------- overriding function Ready (Self : Polling_Event) return Boolean is begin return Self.Ready; end Ready; ---------- -- To_C -- ---------- function To_C (Value : Polling_Kind_Set) return Interfaces.Unsigned_32 is use type Interfaces.Unsigned_32; Mapping : constant array (Polling_Kind) of Interfaces.Unsigned_32 := (Input => EPOLLIN, Output => EPOLLOUT, Error => EPOLLERR, Close => EPOLLHUP); Result : Interfaces.Unsigned_32 := 0; begin for J in Value'Range loop if Value (J) then Result := Result + Mapping (J); end if; end loop; return Result; end To_C; ----------- -- Watch -- ----------- function Watch (File : FD; Events : Polling_Kind_Set) return Event_Id is Cursor : constant Event_Maps.Cursor := Manager.Active.Find (File); Result : Polling_Event_Access; Error : Interfaces.C.int; begin if Event_Maps.Has_Element (Cursor) then Result := Event_Maps.Element (Cursor); Result.Context := Current_Context; Result.Ready := False; Result.Drop := False; if Result.Events = Events then return Event_Id (Result); else Error := epoll_ctl (epfd => Manager.epfd, op => EPOLL_CTL_DEL, fd => File, event => (0, null)); pragma Assert (Error = 0); end if; elsif Manager.Unused.Is_Empty then Result := new Polling_Event; else Result := Manager.Unused.Last_Element; Manager.Unused.Delete_Last; end if; Result.all := (Event_Object with FD => File, Events => Events, Context => Current_Context, Manager => Manager'Access, Ready => False, Active => False, Drop => False); return Event_Id (Result); end Watch; end Coroutines.Polling;
[ { "context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2018 onox <[email protected]>\n--\n-- Licensed under the A", "end": 70, "score": 0.9990179538726807, "start": 66, "tag": "USERNAME", "value": "onox" }, { "context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2018 onox <[email protected]>\n--\n-- Licensed under the Apache License, Versio", "end": 91, "score": 0.9999246001243591, "start": 72, "tag": "EMAIL", "value": "[email protected]" } ]
orka/src/gl/implementation/gl-pixels-queries.adb
onox/orka
52
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 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 GL.API; with GL.Enums.Internalformat; package body GL.Pixels.Queries is use all type Enums.Internalformat.Parameter; function Get_Support (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Support is Result : Support := None; begin API.Get_Internal_Format_Support.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Support; function Get_Size (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Size is Result : Size := 0; begin API.Get_Internal_Format.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Size; function Get_Long_Size (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Long_Size is Result : Long_Size := 0; begin API.Get_Internal_Format_Long.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Long_Size; function Get_Boolean (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Boolean is (Get_Size (Format, Kind, Parameter) = 1); function Get_Size (Format : Compressed_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Size is Result : Size := 0; begin API.Get_Internal_Format_C.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Size; ----------------------------------------------------------------------------- function Sample_Counts (Format : Internal_Format; Kind : LE.Texture_Kind) return Size_Array is Count : Size := 0; begin API.Get_Internal_Format.Ref (Kind, Format, Num_Sample_Counts, 1, Count); declare Result : Size_Array (1 .. Count) := (others => 0); begin API.Get_Internal_Format_A.Ref (Kind, Format, Samples, Result'Length, Result); return Result; end; end Sample_Counts; function Supported (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Internalformat_Supported)); function Preferred (Format : Internal_Format; Kind : LE.Texture_Kind) return Internal_Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Internal_Format); begin API.Get_Internal_Format.Ref (Kind, Format, Internalformat_Preferred, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format"; end if; return Convert (GL.Types.Int (Result)); end Preferred; ----------------------------------------------------------------------------- function Red_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Red_Size)); function Green_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Green_Size)); function Blue_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Blue_Size)); function Alpha_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Alpha_Size)); function Depth_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Depth_Size)); function Stencil_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Stencil_Size)); function Shared_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Shared_Size)); ----------------------------------------------------------------------------- function Max_Width (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Width)); function Max_Height (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Height)); function Max_Depth (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Depth)); function Max_Layers (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Layers)); function Max_Combined_Dimensions (Format : Internal_Format; Kind : LE.Texture_Kind) return Long_Size is (Get_Long_Size (Format, Kind, Max_Combined_Dimensions)); ----------------------------------------------------------------------------- function Color_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Color_Components)); function Depth_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Depth_Components)); function Stencil_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Stencil_Components)); function Color_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Color_Renderable)); function Depth_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Depth_Renderable)); function Stencil_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Stencil_Renderable)); ----------------------------------------------------------------------------- function Framebuffer_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Renderable)); function Framebuffer_Renderable_Layered (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Renderable_Layered)); function Framebuffer_Blend (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Blend)); ----------------------------------------------------------------------------- function Texture_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Texture_Image_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for uploading to texture"; end if; return Convert (GL.Types.Int (Result)); end Texture_Format; function Texture_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Texture_Image_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for uploading to texture"; end if; return Convert (GL.Types.Int (Result)); end Texture_Type; function Get_Texture_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Get_Texture_Image_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for downloading to texture"; end if; return Convert (GL.Types.Int (Result)); end Get_Texture_Format; function Get_Texture_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Get_Texture_Image_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for downloading to texture"; end if; return Convert (GL.Types.Int (Result)); end Get_Texture_Type; ----------------------------------------------------------------------------- function Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Mipmap)); function Manual_Generate_Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Manual_Generate_Mipmap)); function Auto_Generate_Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Auto_Generate_Mipmap)); ----------------------------------------------------------------------------- function Color_Encoding (Format : Internal_Format; Kind : LE.Texture_Kind) return Encoding is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Encoding); begin API.Get_Internal_Format.Ref (Kind, Format, Color_Encoding, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for color encoding"; end if; return Convert (GL.Types.Int (Result)); end Color_Encoding; function sRGB_Read (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Read)); function sRGB_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Write)); function sRGB_Decode_Sampling_Time (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Decode_ARB)); ----------------------------------------------------------------------------- function Filter (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Filter)); function Vertex_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Vertex_Texture)); function Tess_Control_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Tess_Control_Texture)); function Tess_Evaluation_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Tess_Evaluation_Texture)); function Geometry_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Geometry_Texture)); function Fragment_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Fragment_Texture)); function Compute_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Compute_Texture)); function Texture_Shadow (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Shadow)); function Texture_Gather (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Gather)); function Texture_Gather_Shadow (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Gather_Shadow)); ----------------------------------------------------------------------------- function Shader_Image_Load (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Load)); function Shader_Image_Store (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Store)); function Shader_Image_Atomic (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Atomic)); ----------------------------------------------------------------------------- function Image_Texel_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Image_Texel_Size)); function Image_Pixel_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Image_Pixel_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Pixel_Format; function Image_Pixel_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Image_Pixel_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Pixel_Type; function Image_Format_Compatibility (Format : Internal_Format; Kind : LE.Texture_Kind) return Image_Format_Compatibility_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Image_Format_Compatibility_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.Image_Format_Compatibility_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Format_Compatibility; function Simultaneous_Texture_And_Depth_Test (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Depth_Test)); function Simultaneous_Texture_And_Stencil_Test (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Stencil_Test)); function Simultaneous_Texture_And_Depth_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Depth_Write)); function Simultaneous_Texture_And_Stencil_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Stencil_Write)); ----------------------------------------------------------------------------- function Texture_Compressed_Block_Width (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Width)); function Texture_Compressed_Block_Height (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Height)); function Texture_Compressed_Block_Size (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Size)); ----------------------------------------------------------------------------- function Clear_Buffer (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Clear_Buffer)); function Texture_View (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_View)); function Image_Compatibility_Class (Format : Internal_Format; Kind : LE.Texture_Kind) return Image_Class is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Image_Class); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.Image_Compatibility_Class, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Compatibility_Class; function View_Compatibility_Class (Format : Internal_Format; Kind : LE.Texture_Kind) return View_Class is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => View_Class); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.View_Compatibility_Class, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for texture view"; end if; return Convert (GL.Types.Int (Result)); end View_Compatibility_Class; end GL.Pixels.Queries;
25946
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <<EMAIL>> -- -- 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 GL.API; with GL.Enums.Internalformat; package body GL.Pixels.Queries is use all type Enums.Internalformat.Parameter; function Get_Support (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Support is Result : Support := None; begin API.Get_Internal_Format_Support.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Support; function Get_Size (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Size is Result : Size := 0; begin API.Get_Internal_Format.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Size; function Get_Long_Size (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Long_Size is Result : Long_Size := 0; begin API.Get_Internal_Format_Long.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Long_Size; function Get_Boolean (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Boolean is (Get_Size (Format, Kind, Parameter) = 1); function Get_Size (Format : Compressed_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Size is Result : Size := 0; begin API.Get_Internal_Format_C.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Size; ----------------------------------------------------------------------------- function Sample_Counts (Format : Internal_Format; Kind : LE.Texture_Kind) return Size_Array is Count : Size := 0; begin API.Get_Internal_Format.Ref (Kind, Format, Num_Sample_Counts, 1, Count); declare Result : Size_Array (1 .. Count) := (others => 0); begin API.Get_Internal_Format_A.Ref (Kind, Format, Samples, Result'Length, Result); return Result; end; end Sample_Counts; function Supported (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Internalformat_Supported)); function Preferred (Format : Internal_Format; Kind : LE.Texture_Kind) return Internal_Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Internal_Format); begin API.Get_Internal_Format.Ref (Kind, Format, Internalformat_Preferred, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format"; end if; return Convert (GL.Types.Int (Result)); end Preferred; ----------------------------------------------------------------------------- function Red_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Red_Size)); function Green_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Green_Size)); function Blue_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Blue_Size)); function Alpha_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Alpha_Size)); function Depth_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Depth_Size)); function Stencil_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Stencil_Size)); function Shared_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Shared_Size)); ----------------------------------------------------------------------------- function Max_Width (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Width)); function Max_Height (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Height)); function Max_Depth (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Depth)); function Max_Layers (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Layers)); function Max_Combined_Dimensions (Format : Internal_Format; Kind : LE.Texture_Kind) return Long_Size is (Get_Long_Size (Format, Kind, Max_Combined_Dimensions)); ----------------------------------------------------------------------------- function Color_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Color_Components)); function Depth_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Depth_Components)); function Stencil_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Stencil_Components)); function Color_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Color_Renderable)); function Depth_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Depth_Renderable)); function Stencil_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Stencil_Renderable)); ----------------------------------------------------------------------------- function Framebuffer_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Renderable)); function Framebuffer_Renderable_Layered (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Renderable_Layered)); function Framebuffer_Blend (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Blend)); ----------------------------------------------------------------------------- function Texture_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Texture_Image_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for uploading to texture"; end if; return Convert (GL.Types.Int (Result)); end Texture_Format; function Texture_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Texture_Image_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for uploading to texture"; end if; return Convert (GL.Types.Int (Result)); end Texture_Type; function Get_Texture_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Get_Texture_Image_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for downloading to texture"; end if; return Convert (GL.Types.Int (Result)); end Get_Texture_Format; function Get_Texture_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Get_Texture_Image_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for downloading to texture"; end if; return Convert (GL.Types.Int (Result)); end Get_Texture_Type; ----------------------------------------------------------------------------- function Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Mipmap)); function Manual_Generate_Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Manual_Generate_Mipmap)); function Auto_Generate_Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Auto_Generate_Mipmap)); ----------------------------------------------------------------------------- function Color_Encoding (Format : Internal_Format; Kind : LE.Texture_Kind) return Encoding is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Encoding); begin API.Get_Internal_Format.Ref (Kind, Format, Color_Encoding, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for color encoding"; end if; return Convert (GL.Types.Int (Result)); end Color_Encoding; function sRGB_Read (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Read)); function sRGB_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Write)); function sRGB_Decode_Sampling_Time (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Decode_ARB)); ----------------------------------------------------------------------------- function Filter (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Filter)); function Vertex_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Vertex_Texture)); function Tess_Control_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Tess_Control_Texture)); function Tess_Evaluation_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Tess_Evaluation_Texture)); function Geometry_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Geometry_Texture)); function Fragment_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Fragment_Texture)); function Compute_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Compute_Texture)); function Texture_Shadow (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Shadow)); function Texture_Gather (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Gather)); function Texture_Gather_Shadow (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Gather_Shadow)); ----------------------------------------------------------------------------- function Shader_Image_Load (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Load)); function Shader_Image_Store (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Store)); function Shader_Image_Atomic (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Atomic)); ----------------------------------------------------------------------------- function Image_Texel_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Image_Texel_Size)); function Image_Pixel_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Image_Pixel_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Pixel_Format; function Image_Pixel_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Image_Pixel_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Pixel_Type; function Image_Format_Compatibility (Format : Internal_Format; Kind : LE.Texture_Kind) return Image_Format_Compatibility_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Image_Format_Compatibility_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.Image_Format_Compatibility_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Format_Compatibility; function Simultaneous_Texture_And_Depth_Test (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Depth_Test)); function Simultaneous_Texture_And_Stencil_Test (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Stencil_Test)); function Simultaneous_Texture_And_Depth_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Depth_Write)); function Simultaneous_Texture_And_Stencil_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Stencil_Write)); ----------------------------------------------------------------------------- function Texture_Compressed_Block_Width (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Width)); function Texture_Compressed_Block_Height (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Height)); function Texture_Compressed_Block_Size (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Size)); ----------------------------------------------------------------------------- function Clear_Buffer (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Clear_Buffer)); function Texture_View (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_View)); function Image_Compatibility_Class (Format : Internal_Format; Kind : LE.Texture_Kind) return Image_Class is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Image_Class); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.Image_Compatibility_Class, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Compatibility_Class; function View_Compatibility_Class (Format : Internal_Format; Kind : LE.Texture_Kind) return View_Class is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => View_Class); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.View_Compatibility_Class, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for texture view"; end if; return Convert (GL.Types.Int (Result)); end View_Compatibility_Class; end GL.Pixels.Queries;
true
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <PI:EMAIL:<EMAIL>END_PI> -- -- 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 GL.API; with GL.Enums.Internalformat; package body GL.Pixels.Queries is use all type Enums.Internalformat.Parameter; function Get_Support (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Support is Result : Support := None; begin API.Get_Internal_Format_Support.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Support; function Get_Size (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Size is Result : Size := 0; begin API.Get_Internal_Format.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Size; function Get_Long_Size (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Long_Size is Result : Long_Size := 0; begin API.Get_Internal_Format_Long.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Long_Size; function Get_Boolean (Format : Internal_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Boolean is (Get_Size (Format, Kind, Parameter) = 1); function Get_Size (Format : Compressed_Format; Kind : LE.Texture_Kind; Parameter : Enums.Internalformat.Parameter) return Size is Result : Size := 0; begin API.Get_Internal_Format_C.Ref (Kind, Format, Parameter, 1, Result); return Result; end Get_Size; ----------------------------------------------------------------------------- function Sample_Counts (Format : Internal_Format; Kind : LE.Texture_Kind) return Size_Array is Count : Size := 0; begin API.Get_Internal_Format.Ref (Kind, Format, Num_Sample_Counts, 1, Count); declare Result : Size_Array (1 .. Count) := (others => 0); begin API.Get_Internal_Format_A.Ref (Kind, Format, Samples, Result'Length, Result); return Result; end; end Sample_Counts; function Supported (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Internalformat_Supported)); function Preferred (Format : Internal_Format; Kind : LE.Texture_Kind) return Internal_Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Internal_Format); begin API.Get_Internal_Format.Ref (Kind, Format, Internalformat_Preferred, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format"; end if; return Convert (GL.Types.Int (Result)); end Preferred; ----------------------------------------------------------------------------- function Red_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Red_Size)); function Green_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Green_Size)); function Blue_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Blue_Size)); function Alpha_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Alpha_Size)); function Depth_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Depth_Size)); function Stencil_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Stencil_Size)); function Shared_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Internalformat_Shared_Size)); ----------------------------------------------------------------------------- function Max_Width (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Width)); function Max_Height (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Height)); function Max_Depth (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Depth)); function Max_Layers (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Max_Layers)); function Max_Combined_Dimensions (Format : Internal_Format; Kind : LE.Texture_Kind) return Long_Size is (Get_Long_Size (Format, Kind, Max_Combined_Dimensions)); ----------------------------------------------------------------------------- function Color_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Color_Components)); function Depth_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Depth_Components)); function Stencil_Components (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Stencil_Components)); function Color_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Color_Renderable)); function Depth_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Depth_Renderable)); function Stencil_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Stencil_Renderable)); ----------------------------------------------------------------------------- function Framebuffer_Renderable (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Renderable)); function Framebuffer_Renderable_Layered (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Renderable_Layered)); function Framebuffer_Blend (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Framebuffer_Blend)); ----------------------------------------------------------------------------- function Texture_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Texture_Image_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for uploading to texture"; end if; return Convert (GL.Types.Int (Result)); end Texture_Format; function Texture_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Texture_Image_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for uploading to texture"; end if; return Convert (GL.Types.Int (Result)); end Texture_Type; function Get_Texture_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Get_Texture_Image_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for downloading to texture"; end if; return Convert (GL.Types.Int (Result)); end Get_Texture_Format; function Get_Texture_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Get_Texture_Image_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for downloading to texture"; end if; return Convert (GL.Types.Int (Result)); end Get_Texture_Type; ----------------------------------------------------------------------------- function Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Boolean is (Get_Boolean (Format, Kind, Mipmap)); function Manual_Generate_Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Manual_Generate_Mipmap)); function Auto_Generate_Mipmap (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Auto_Generate_Mipmap)); ----------------------------------------------------------------------------- function Color_Encoding (Format : Internal_Format; Kind : LE.Texture_Kind) return Encoding is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Encoding); begin API.Get_Internal_Format.Ref (Kind, Format, Color_Encoding, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for color encoding"; end if; return Convert (GL.Types.Int (Result)); end Color_Encoding; function sRGB_Read (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Read)); function sRGB_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Write)); function sRGB_Decode_Sampling_Time (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, sRGB_Decode_ARB)); ----------------------------------------------------------------------------- function Filter (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Filter)); function Vertex_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Vertex_Texture)); function Tess_Control_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Tess_Control_Texture)); function Tess_Evaluation_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Tess_Evaluation_Texture)); function Geometry_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Geometry_Texture)); function Fragment_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Fragment_Texture)); function Compute_Texture (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Compute_Texture)); function Texture_Shadow (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Shadow)); function Texture_Gather (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Gather)); function Texture_Gather_Shadow (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_Gather_Shadow)); ----------------------------------------------------------------------------- function Shader_Image_Load (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Load)); function Shader_Image_Store (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Store)); function Shader_Image_Atomic (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Shader_Image_Atomic)); ----------------------------------------------------------------------------- function Image_Texel_Size (Format : Internal_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Image_Texel_Size)); function Image_Pixel_Format (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Format is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Format); begin API.Get_Internal_Format.Ref (Kind, Format, Image_Pixel_Format, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Pixel_Format; function Image_Pixel_Type (Format : Internal_Format; Kind : LE.Texture_Kind) return Pixels.Data_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Pixels.Data_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Image_Pixel_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Pixel_Type; function Image_Format_Compatibility (Format : Internal_Format; Kind : LE.Texture_Kind) return Image_Format_Compatibility_Type is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Image_Format_Compatibility_Type); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.Image_Format_Compatibility_Type, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Format_Compatibility; function Simultaneous_Texture_And_Depth_Test (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Depth_Test)); function Simultaneous_Texture_And_Stencil_Test (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Stencil_Test)); function Simultaneous_Texture_And_Depth_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Depth_Write)); function Simultaneous_Texture_And_Stencil_Write (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Simultaneous_Texture_And_Stencil_Write)); ----------------------------------------------------------------------------- function Texture_Compressed_Block_Width (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Width)); function Texture_Compressed_Block_Height (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Height)); function Texture_Compressed_Block_Size (Format : Compressed_Format; Kind : LE.Texture_Kind) return Size is (Get_Size (Format, Kind, Texture_Compressed_Block_Size)); ----------------------------------------------------------------------------- function Clear_Buffer (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Clear_Buffer)); function Texture_View (Format : Internal_Format; Kind : LE.Texture_Kind) return Support is (Get_Support (Format, Kind, Texture_View)); function Image_Compatibility_Class (Format : Internal_Format; Kind : LE.Texture_Kind) return Image_Class is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => Image_Class); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.Image_Compatibility_Class, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for image texture"; end if; return Convert (GL.Types.Int (Result)); end Image_Compatibility_Class; function View_Compatibility_Class (Format : Internal_Format; Kind : LE.Texture_Kind) return View_Class is Result : Size := 0; function Convert is new Ada.Unchecked_Conversion (Source => GL.Types.Int, Target => View_Class); begin API.Get_Internal_Format.Ref (Kind, Format, Enums.Internalformat.View_Compatibility_Class, 1, Result); if Result = 0 then raise Constraint_Error with "Invalid internal format for texture view"; end if; return Convert (GL.Types.Int (Result)); end View_Compatibility_Class; end GL.Pixels.Queries;
[ { "context": "-- Copyright 2017-2021 Jeff Foley. All rights reserved.\n-- Use of this source code ", "end": 33, "score": 0.9998480677604675, "start": 23, "tag": "NAME", "value": "Jeff Foley" } ]
resources/scripts/archive/archivetoday.ads
hartley94ad/Amass
1
-- Copyright 2017-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. name = "ArchiveToday" type = "archive" function start() setratelimit(5) end function vertical(ctx, domain) scrape(ctx, "http://archive.is/*." .. domain) end
18409
-- Copyright 2017-2021 <NAME>. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "ArchiveToday" type = "archive" function start() setratelimit(5) end function vertical(ctx, domain) scrape(ctx, "http://archive.is/*." .. domain) end
true
-- Copyright 2017-2021 PI:NAME:<NAME>END_PI. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "ArchiveToday" type = "archive" function start() setratelimit(5) end function vertical(ctx, domain) scrape(ctx, "http://archive.is/*." .. domain) end
[ { "context": " BY THE REPRESENTATION CLAUSE.\n\n-- HISTORY:\n-- JET 08/12/87 CREATED ORIGINAL TEST.\n-- DHH 04/11", "end": 1524, "score": 0.8602942228317261, "start": 1521, "tag": "NAME", "value": "JET" } ]
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd2a32e.ada
best08618/asylo
7
-- CD2A32E.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 WHEN A SIZE SPECIFICATION IS GIVEN FOR AN -- INTEGER TYPE, THEN OPERATIONS ON VALUES OF SUCH A TYPE -- WITH THE SMALLEST APPROPRIATE UNSIGNED SIZE ARE NOT -- AFFECTED BY THE REPRESENTATION CLAUSE. -- HISTORY: -- JET 08/12/87 CREATED ORIGINAL TEST. -- DHH 04/11/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED -- SIZE CLAUSE VALUE TO 7, AND CHANGED OPERATOR ON -- 'SIZE CHECKS. -- JRL 03/27/92 ELIMINATED REDUNDANT TESTING. WITH REPORT; USE REPORT; PROCEDURE CD2A32E IS BASIC_SIZE : CONSTANT := 7; TYPE INT IS RANGE 0 .. 126; FOR INT'SIZE USE BASIC_SIZE; I0 : INT := 0; I1 : INT := 63; I2 : INT := 126; TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE 0 .. 2) OF INT; INTARRAY : ARRAY_TYPE := (0, 63, 126); TYPE REC_TYPE IS RECORD COMP0 : INT := 0; COMP1 : INT := 63; COMP2 : INT := 126; END RECORD; IREC : REC_TYPE; FUNCTION IDENT (I : INT) RETURN INT IS BEGIN IF EQUAL (0,0) THEN RETURN I; ELSE RETURN 0; END IF; END IDENT; PROCEDURE PROC (PI0, PI2 : INT; PIO1, PIO2 : IN OUT INT; PO2 : OUT INT) IS BEGIN IF PI0'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR PI0'SIZE"); END IF; IF NOT ((PI0 < IDENT (1)) AND (IDENT (PI2) > IDENT (PIO1)) AND (PIO1 <= IDENT (63)) AND (IDENT (126) = PI2)) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 1"); END IF; IF NOT (((PI0 + PI2) = PIO2) AND ((PI2 - PIO1) = PIO1) AND ((PIO1 * IDENT (2)) = PI2) AND ((PIO2 / PIO1) = IDENT (2)) AND ((PIO1 ** 1) = IDENT (63)) AND ((PIO2 REM 10) = IDENT (6)) AND ((PIO1 MOD 10) = IDENT (3))) THEN FAILED ("INCORRECT RESULTS FOR BINARY ARITHMETIC " & "OPERATORS - 1"); END IF; IF INT'POS (PI0) /= IDENT_INT (0) OR INT'POS (PIO1) /= IDENT_INT (63) OR INT'POS (PI2) /= IDENT_INT (126) THEN FAILED ("INCORRECT VALUE FOR INT'POS - 1"); END IF; IF INT'SUCC (PI0) /= IDENT (1) OR INT'SUCC (PIO1) /= IDENT (64) THEN FAILED ("INCORRECT VALUE FOR INT'SUCC - 1"); END IF; IF INT'IMAGE (PI0) /= IDENT_STR (" 0") OR INT'IMAGE (PIO1) /= IDENT_STR (" 63") OR INT'IMAGE (PI2) /= IDENT_STR (" 126") THEN FAILED ("INCORRECT VALUE FOR INT'IMAGE - 1"); END IF; PO2 := 126; END PROC; BEGIN TEST ("CD2A32E", "CHECK THAT WHEN A SIZE SPECIFICATION IS " & "GIVEN FOR AN INTEGER TYPE, THEN " & "OPERATIONS ON VALUES OF SUCH A TYPE WITH " & "THE SMALLEST APPROPRIATE UNSIGNED SIZE ARE " & "NOT AFFECTED BY THE REPRESENTATION CLAUSE"); PROC (0, 126, I1, I2, I2); IF INT'SIZE /= IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR INT'SIZE"); END IF; IF I1'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR I1'SIZE"); END IF; FOR I IN IDENT (I0) .. IDENT (I2) LOOP IF NOT (I IN I0 .. I2) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 2"); END IF; END LOOP; IF NOT ((+I2 = I2) AND (-I1 = -63) AND (ABS I2 = I2)) THEN FAILED ("INCORRECT RESULTS FOR UNARY ARITHMETIC " & "OPERATORS - 2"); END IF; IF INT'VAL (0) /= IDENT (I0) OR INT'VAL (63) /= IDENT (I1) OR INT'VAL (126) /= IDENT (I2) THEN FAILED ("INCORRECT VALUE FOR INT'VAL - 2"); END IF; IF INT'PRED (I1) /= IDENT (62) OR INT'PRED (I2) /= IDENT (125) THEN FAILED ("INCORRECT VALUE FOR INT'PRED - 2"); END IF; IF INT'VALUE ("0") /= IDENT (I0) OR INT'VALUE ("63") /= IDENT (I1) OR INT'VALUE ("126") /= IDENT (I2) THEN FAILED ("INCORRECT VALUE FOR INT'VALUE - 2"); END IF; IF INTARRAY(1)'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR INTARRAY(1)'SIZE"); END IF; IF NOT ((INTARRAY(0) < IDENT (1)) AND (IDENT (INTARRAY(2)) > IDENT (INTARRAY(1))) AND (INTARRAY(1) <= IDENT (63)) AND (IDENT (126) = INTARRAY(2))) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 3"); END IF; FOR I IN IDENT (INTARRAY(0)) .. IDENT (INTARRAY(2)) LOOP IF NOT (I IN INTARRAY(0) .. INTARRAY(2)) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 3"); END IF; END LOOP; IF NOT (((INTARRAY(0) + INTARRAY(2)) = INTARRAY(2)) AND ((INTARRAY(2) - INTARRAY(1)) = INTARRAY(1)) AND ((INTARRAY(1) * IDENT (2)) = INTARRAY(2)) AND ((INTARRAY(2) / INTARRAY(1)) = IDENT (2)) AND ((INTARRAY(1) ** 1) = IDENT (63)) AND ((INTARRAY(2) REM 10) = IDENT (6)) AND ((INTARRAY(1) MOD 10) = IDENT (3))) THEN FAILED ("INCORRECT RESULTS FOR BINARY ARITHMETIC " & "OPERATORS - 3"); END IF; IF INT'POS (INTARRAY(0)) /= IDENT_INT (0) OR INT'POS (INTARRAY(1)) /= IDENT_INT (63) OR INT'POS (INTARRAY(2)) /= IDENT_INT (126) THEN FAILED ("INCORRECT VALUE FOR INT'POS - 3"); END IF; IF INT'SUCC (INTARRAY(0)) /= IDENT (1) OR INT'SUCC (INTARRAY(1)) /= IDENT (64) THEN FAILED ("INCORRECT VALUE FOR INT'SUCC - 3"); END IF; IF INT'IMAGE (INTARRAY(0)) /= IDENT_STR (" 0") OR INT'IMAGE (INTARRAY(1)) /= IDENT_STR (" 63") OR INT'IMAGE (INTARRAY(2)) /= IDENT_STR (" 126") THEN FAILED ("INCORRECT VALUE FOR INT'IMAGE - 3"); END IF; IF IREC.COMP2'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR IREC.COMP2'SIZE"); END IF; IF NOT ((IREC.COMP0 < IDENT (1)) AND (IDENT (IREC.COMP2) > IDENT (IREC.COMP1)) AND (IREC.COMP1 <= IDENT (63)) AND (IDENT (126) = IREC.COMP2)) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 4"); END IF; FOR I IN IDENT (IREC.COMP0) .. IDENT (IREC.COMP2) LOOP IF NOT (I IN IREC.COMP0 .. IREC.COMP2) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 4"); END IF; END LOOP; IF NOT ((+IREC.COMP2 = IREC.COMP2) AND (-IREC.COMP1 = -63) AND (ABS IREC.COMP2 = IREC.COMP2)) THEN FAILED ("INCORRECT RESULTS FOR UNARY ARITHMETIC " & "OPERATORS - 4"); END IF; IF INT'VAL (0) /= IDENT (IREC.COMP0) OR INT'VAL (63) /= IDENT (IREC.COMP1) OR INT'VAL (126) /= IDENT (IREC.COMP2) THEN FAILED ("INCORRECT VALUE FOR INT'VAL - 4"); END IF; IF INT'PRED (IREC.COMP1) /= IDENT (62) OR INT'PRED (IREC.COMP2) /= IDENT (125) THEN FAILED ("INCORRECT VALUE FOR INT'PRED - 4"); END IF; IF INT'VALUE ("0") /= IDENT (IREC.COMP0) OR INT'VALUE ("63") /= IDENT (IREC.COMP1) OR INT'VALUE ("126") /= IDENT (IREC.COMP2) THEN FAILED ("INCORRECT VALUE FOR INT'VALUE - 4"); END IF; RESULT; END CD2A32E;
17590
-- CD2A32E.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 WHEN A SIZE SPECIFICATION IS GIVEN FOR AN -- INTEGER TYPE, THEN OPERATIONS ON VALUES OF SUCH A TYPE -- WITH THE SMALLEST APPROPRIATE UNSIGNED SIZE ARE NOT -- AFFECTED BY THE REPRESENTATION CLAUSE. -- HISTORY: -- <NAME> 08/12/87 CREATED ORIGINAL TEST. -- DHH 04/11/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED -- SIZE CLAUSE VALUE TO 7, AND CHANGED OPERATOR ON -- 'SIZE CHECKS. -- JRL 03/27/92 ELIMINATED REDUNDANT TESTING. WITH REPORT; USE REPORT; PROCEDURE CD2A32E IS BASIC_SIZE : CONSTANT := 7; TYPE INT IS RANGE 0 .. 126; FOR INT'SIZE USE BASIC_SIZE; I0 : INT := 0; I1 : INT := 63; I2 : INT := 126; TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE 0 .. 2) OF INT; INTARRAY : ARRAY_TYPE := (0, 63, 126); TYPE REC_TYPE IS RECORD COMP0 : INT := 0; COMP1 : INT := 63; COMP2 : INT := 126; END RECORD; IREC : REC_TYPE; FUNCTION IDENT (I : INT) RETURN INT IS BEGIN IF EQUAL (0,0) THEN RETURN I; ELSE RETURN 0; END IF; END IDENT; PROCEDURE PROC (PI0, PI2 : INT; PIO1, PIO2 : IN OUT INT; PO2 : OUT INT) IS BEGIN IF PI0'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR PI0'SIZE"); END IF; IF NOT ((PI0 < IDENT (1)) AND (IDENT (PI2) > IDENT (PIO1)) AND (PIO1 <= IDENT (63)) AND (IDENT (126) = PI2)) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 1"); END IF; IF NOT (((PI0 + PI2) = PIO2) AND ((PI2 - PIO1) = PIO1) AND ((PIO1 * IDENT (2)) = PI2) AND ((PIO2 / PIO1) = IDENT (2)) AND ((PIO1 ** 1) = IDENT (63)) AND ((PIO2 REM 10) = IDENT (6)) AND ((PIO1 MOD 10) = IDENT (3))) THEN FAILED ("INCORRECT RESULTS FOR BINARY ARITHMETIC " & "OPERATORS - 1"); END IF; IF INT'POS (PI0) /= IDENT_INT (0) OR INT'POS (PIO1) /= IDENT_INT (63) OR INT'POS (PI2) /= IDENT_INT (126) THEN FAILED ("INCORRECT VALUE FOR INT'POS - 1"); END IF; IF INT'SUCC (PI0) /= IDENT (1) OR INT'SUCC (PIO1) /= IDENT (64) THEN FAILED ("INCORRECT VALUE FOR INT'SUCC - 1"); END IF; IF INT'IMAGE (PI0) /= IDENT_STR (" 0") OR INT'IMAGE (PIO1) /= IDENT_STR (" 63") OR INT'IMAGE (PI2) /= IDENT_STR (" 126") THEN FAILED ("INCORRECT VALUE FOR INT'IMAGE - 1"); END IF; PO2 := 126; END PROC; BEGIN TEST ("CD2A32E", "CHECK THAT WHEN A SIZE SPECIFICATION IS " & "GIVEN FOR AN INTEGER TYPE, THEN " & "OPERATIONS ON VALUES OF SUCH A TYPE WITH " & "THE SMALLEST APPROPRIATE UNSIGNED SIZE ARE " & "NOT AFFECTED BY THE REPRESENTATION CLAUSE"); PROC (0, 126, I1, I2, I2); IF INT'SIZE /= IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR INT'SIZE"); END IF; IF I1'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR I1'SIZE"); END IF; FOR I IN IDENT (I0) .. IDENT (I2) LOOP IF NOT (I IN I0 .. I2) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 2"); END IF; END LOOP; IF NOT ((+I2 = I2) AND (-I1 = -63) AND (ABS I2 = I2)) THEN FAILED ("INCORRECT RESULTS FOR UNARY ARITHMETIC " & "OPERATORS - 2"); END IF; IF INT'VAL (0) /= IDENT (I0) OR INT'VAL (63) /= IDENT (I1) OR INT'VAL (126) /= IDENT (I2) THEN FAILED ("INCORRECT VALUE FOR INT'VAL - 2"); END IF; IF INT'PRED (I1) /= IDENT (62) OR INT'PRED (I2) /= IDENT (125) THEN FAILED ("INCORRECT VALUE FOR INT'PRED - 2"); END IF; IF INT'VALUE ("0") /= IDENT (I0) OR INT'VALUE ("63") /= IDENT (I1) OR INT'VALUE ("126") /= IDENT (I2) THEN FAILED ("INCORRECT VALUE FOR INT'VALUE - 2"); END IF; IF INTARRAY(1)'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR INTARRAY(1)'SIZE"); END IF; IF NOT ((INTARRAY(0) < IDENT (1)) AND (IDENT (INTARRAY(2)) > IDENT (INTARRAY(1))) AND (INTARRAY(1) <= IDENT (63)) AND (IDENT (126) = INTARRAY(2))) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 3"); END IF; FOR I IN IDENT (INTARRAY(0)) .. IDENT (INTARRAY(2)) LOOP IF NOT (I IN INTARRAY(0) .. INTARRAY(2)) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 3"); END IF; END LOOP; IF NOT (((INTARRAY(0) + INTARRAY(2)) = INTARRAY(2)) AND ((INTARRAY(2) - INTARRAY(1)) = INTARRAY(1)) AND ((INTARRAY(1) * IDENT (2)) = INTARRAY(2)) AND ((INTARRAY(2) / INTARRAY(1)) = IDENT (2)) AND ((INTARRAY(1) ** 1) = IDENT (63)) AND ((INTARRAY(2) REM 10) = IDENT (6)) AND ((INTARRAY(1) MOD 10) = IDENT (3))) THEN FAILED ("INCORRECT RESULTS FOR BINARY ARITHMETIC " & "OPERATORS - 3"); END IF; IF INT'POS (INTARRAY(0)) /= IDENT_INT (0) OR INT'POS (INTARRAY(1)) /= IDENT_INT (63) OR INT'POS (INTARRAY(2)) /= IDENT_INT (126) THEN FAILED ("INCORRECT VALUE FOR INT'POS - 3"); END IF; IF INT'SUCC (INTARRAY(0)) /= IDENT (1) OR INT'SUCC (INTARRAY(1)) /= IDENT (64) THEN FAILED ("INCORRECT VALUE FOR INT'SUCC - 3"); END IF; IF INT'IMAGE (INTARRAY(0)) /= IDENT_STR (" 0") OR INT'IMAGE (INTARRAY(1)) /= IDENT_STR (" 63") OR INT'IMAGE (INTARRAY(2)) /= IDENT_STR (" 126") THEN FAILED ("INCORRECT VALUE FOR INT'IMAGE - 3"); END IF; IF IREC.COMP2'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR IREC.COMP2'SIZE"); END IF; IF NOT ((IREC.COMP0 < IDENT (1)) AND (IDENT (IREC.COMP2) > IDENT (IREC.COMP1)) AND (IREC.COMP1 <= IDENT (63)) AND (IDENT (126) = IREC.COMP2)) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 4"); END IF; FOR I IN IDENT (IREC.COMP0) .. IDENT (IREC.COMP2) LOOP IF NOT (I IN IREC.COMP0 .. IREC.COMP2) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 4"); END IF; END LOOP; IF NOT ((+IREC.COMP2 = IREC.COMP2) AND (-IREC.COMP1 = -63) AND (ABS IREC.COMP2 = IREC.COMP2)) THEN FAILED ("INCORRECT RESULTS FOR UNARY ARITHMETIC " & "OPERATORS - 4"); END IF; IF INT'VAL (0) /= IDENT (IREC.COMP0) OR INT'VAL (63) /= IDENT (IREC.COMP1) OR INT'VAL (126) /= IDENT (IREC.COMP2) THEN FAILED ("INCORRECT VALUE FOR INT'VAL - 4"); END IF; IF INT'PRED (IREC.COMP1) /= IDENT (62) OR INT'PRED (IREC.COMP2) /= IDENT (125) THEN FAILED ("INCORRECT VALUE FOR INT'PRED - 4"); END IF; IF INT'VALUE ("0") /= IDENT (IREC.COMP0) OR INT'VALUE ("63") /= IDENT (IREC.COMP1) OR INT'VALUE ("126") /= IDENT (IREC.COMP2) THEN FAILED ("INCORRECT VALUE FOR INT'VALUE - 4"); END IF; RESULT; END CD2A32E;
true
-- CD2A32E.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 WHEN A SIZE SPECIFICATION IS GIVEN FOR AN -- INTEGER TYPE, THEN OPERATIONS ON VALUES OF SUCH A TYPE -- WITH THE SMALLEST APPROPRIATE UNSIGNED SIZE ARE NOT -- AFFECTED BY THE REPRESENTATION CLAUSE. -- HISTORY: -- PI:NAME:<NAME>END_PI 08/12/87 CREATED ORIGINAL TEST. -- DHH 04/11/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA', CHANGED -- SIZE CLAUSE VALUE TO 7, AND CHANGED OPERATOR ON -- 'SIZE CHECKS. -- JRL 03/27/92 ELIMINATED REDUNDANT TESTING. WITH REPORT; USE REPORT; PROCEDURE CD2A32E IS BASIC_SIZE : CONSTANT := 7; TYPE INT IS RANGE 0 .. 126; FOR INT'SIZE USE BASIC_SIZE; I0 : INT := 0; I1 : INT := 63; I2 : INT := 126; TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE 0 .. 2) OF INT; INTARRAY : ARRAY_TYPE := (0, 63, 126); TYPE REC_TYPE IS RECORD COMP0 : INT := 0; COMP1 : INT := 63; COMP2 : INT := 126; END RECORD; IREC : REC_TYPE; FUNCTION IDENT (I : INT) RETURN INT IS BEGIN IF EQUAL (0,0) THEN RETURN I; ELSE RETURN 0; END IF; END IDENT; PROCEDURE PROC (PI0, PI2 : INT; PIO1, PIO2 : IN OUT INT; PO2 : OUT INT) IS BEGIN IF PI0'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR PI0'SIZE"); END IF; IF NOT ((PI0 < IDENT (1)) AND (IDENT (PI2) > IDENT (PIO1)) AND (PIO1 <= IDENT (63)) AND (IDENT (126) = PI2)) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 1"); END IF; IF NOT (((PI0 + PI2) = PIO2) AND ((PI2 - PIO1) = PIO1) AND ((PIO1 * IDENT (2)) = PI2) AND ((PIO2 / PIO1) = IDENT (2)) AND ((PIO1 ** 1) = IDENT (63)) AND ((PIO2 REM 10) = IDENT (6)) AND ((PIO1 MOD 10) = IDENT (3))) THEN FAILED ("INCORRECT RESULTS FOR BINARY ARITHMETIC " & "OPERATORS - 1"); END IF; IF INT'POS (PI0) /= IDENT_INT (0) OR INT'POS (PIO1) /= IDENT_INT (63) OR INT'POS (PI2) /= IDENT_INT (126) THEN FAILED ("INCORRECT VALUE FOR INT'POS - 1"); END IF; IF INT'SUCC (PI0) /= IDENT (1) OR INT'SUCC (PIO1) /= IDENT (64) THEN FAILED ("INCORRECT VALUE FOR INT'SUCC - 1"); END IF; IF INT'IMAGE (PI0) /= IDENT_STR (" 0") OR INT'IMAGE (PIO1) /= IDENT_STR (" 63") OR INT'IMAGE (PI2) /= IDENT_STR (" 126") THEN FAILED ("INCORRECT VALUE FOR INT'IMAGE - 1"); END IF; PO2 := 126; END PROC; BEGIN TEST ("CD2A32E", "CHECK THAT WHEN A SIZE SPECIFICATION IS " & "GIVEN FOR AN INTEGER TYPE, THEN " & "OPERATIONS ON VALUES OF SUCH A TYPE WITH " & "THE SMALLEST APPROPRIATE UNSIGNED SIZE ARE " & "NOT AFFECTED BY THE REPRESENTATION CLAUSE"); PROC (0, 126, I1, I2, I2); IF INT'SIZE /= IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR INT'SIZE"); END IF; IF I1'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR I1'SIZE"); END IF; FOR I IN IDENT (I0) .. IDENT (I2) LOOP IF NOT (I IN I0 .. I2) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 2"); END IF; END LOOP; IF NOT ((+I2 = I2) AND (-I1 = -63) AND (ABS I2 = I2)) THEN FAILED ("INCORRECT RESULTS FOR UNARY ARITHMETIC " & "OPERATORS - 2"); END IF; IF INT'VAL (0) /= IDENT (I0) OR INT'VAL (63) /= IDENT (I1) OR INT'VAL (126) /= IDENT (I2) THEN FAILED ("INCORRECT VALUE FOR INT'VAL - 2"); END IF; IF INT'PRED (I1) /= IDENT (62) OR INT'PRED (I2) /= IDENT (125) THEN FAILED ("INCORRECT VALUE FOR INT'PRED - 2"); END IF; IF INT'VALUE ("0") /= IDENT (I0) OR INT'VALUE ("63") /= IDENT (I1) OR INT'VALUE ("126") /= IDENT (I2) THEN FAILED ("INCORRECT VALUE FOR INT'VALUE - 2"); END IF; IF INTARRAY(1)'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR INTARRAY(1)'SIZE"); END IF; IF NOT ((INTARRAY(0) < IDENT (1)) AND (IDENT (INTARRAY(2)) > IDENT (INTARRAY(1))) AND (INTARRAY(1) <= IDENT (63)) AND (IDENT (126) = INTARRAY(2))) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 3"); END IF; FOR I IN IDENT (INTARRAY(0)) .. IDENT (INTARRAY(2)) LOOP IF NOT (I IN INTARRAY(0) .. INTARRAY(2)) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 3"); END IF; END LOOP; IF NOT (((INTARRAY(0) + INTARRAY(2)) = INTARRAY(2)) AND ((INTARRAY(2) - INTARRAY(1)) = INTARRAY(1)) AND ((INTARRAY(1) * IDENT (2)) = INTARRAY(2)) AND ((INTARRAY(2) / INTARRAY(1)) = IDENT (2)) AND ((INTARRAY(1) ** 1) = IDENT (63)) AND ((INTARRAY(2) REM 10) = IDENT (6)) AND ((INTARRAY(1) MOD 10) = IDENT (3))) THEN FAILED ("INCORRECT RESULTS FOR BINARY ARITHMETIC " & "OPERATORS - 3"); END IF; IF INT'POS (INTARRAY(0)) /= IDENT_INT (0) OR INT'POS (INTARRAY(1)) /= IDENT_INT (63) OR INT'POS (INTARRAY(2)) /= IDENT_INT (126) THEN FAILED ("INCORRECT VALUE FOR INT'POS - 3"); END IF; IF INT'SUCC (INTARRAY(0)) /= IDENT (1) OR INT'SUCC (INTARRAY(1)) /= IDENT (64) THEN FAILED ("INCORRECT VALUE FOR INT'SUCC - 3"); END IF; IF INT'IMAGE (INTARRAY(0)) /= IDENT_STR (" 0") OR INT'IMAGE (INTARRAY(1)) /= IDENT_STR (" 63") OR INT'IMAGE (INTARRAY(2)) /= IDENT_STR (" 126") THEN FAILED ("INCORRECT VALUE FOR INT'IMAGE - 3"); END IF; IF IREC.COMP2'SIZE < IDENT_INT (BASIC_SIZE) THEN FAILED ("INCORRECT VALUE FOR IREC.COMP2'SIZE"); END IF; IF NOT ((IREC.COMP0 < IDENT (1)) AND (IDENT (IREC.COMP2) > IDENT (IREC.COMP1)) AND (IREC.COMP1 <= IDENT (63)) AND (IDENT (126) = IREC.COMP2)) THEN FAILED ("INCORRECT RESULTS FOR RELATIONAL " & "OPERATORS - 4"); END IF; FOR I IN IDENT (IREC.COMP0) .. IDENT (IREC.COMP2) LOOP IF NOT (I IN IREC.COMP0 .. IREC.COMP2) OR (I NOT IN IDENT(0) .. IDENT(126)) THEN FAILED ("INCORRECT RESULTS FOR MEMBERSHIP " & "OPERATORS - 4"); END IF; END LOOP; IF NOT ((+IREC.COMP2 = IREC.COMP2) AND (-IREC.COMP1 = -63) AND (ABS IREC.COMP2 = IREC.COMP2)) THEN FAILED ("INCORRECT RESULTS FOR UNARY ARITHMETIC " & "OPERATORS - 4"); END IF; IF INT'VAL (0) /= IDENT (IREC.COMP0) OR INT'VAL (63) /= IDENT (IREC.COMP1) OR INT'VAL (126) /= IDENT (IREC.COMP2) THEN FAILED ("INCORRECT VALUE FOR INT'VAL - 4"); END IF; IF INT'PRED (IREC.COMP1) /= IDENT (62) OR INT'PRED (IREC.COMP2) /= IDENT (125) THEN FAILED ("INCORRECT VALUE FOR INT'PRED - 4"); END IF; IF INT'VALUE ("0") /= IDENT (IREC.COMP0) OR INT'VALUE ("63") /= IDENT (IREC.COMP1) OR INT'VALUE ("126") /= IDENT (IREC.COMP2) THEN FAILED ("INCORRECT VALUE FOR INT'VALUE - 4"); END IF; RESULT; END CD2A32E;
[ { "context": "es -- Request routing\n-- Copyright (C) 2015, 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 154, "score": 0.9998685717582703, "start": 139, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "ight (C) 2015, 2019 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 185, "score": 0.9998777508735657, "start": 170, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 212, "score": 0.9999278783798218, "start": 187, "tag": "EMAIL", "value": "[email protected]" } ]
src/servlet-routes-servlets.adb
My-Colaborations/ada-servlet
6
----------------------------------------------------------------------- -- servlet-routes -- Request routing -- Copyright (C) 2015, 2019 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.Unchecked_Deallocation; package body Servlet.Routes.Servlets is use type Servlet.Filters.Filter_Access; use type Servlet.Filters.Filter_List_Access; procedure Free is new Ada.Unchecked_Deallocation (Object => Servlet.Filters.Filter_List, Name => Servlet.Filters.Filter_List_Access); -- ------------------------------ -- Get the servlet to call for the route. -- ------------------------------ function Get_Servlet (Route : in Servlet_Route_Type) return Servlet.Core.Servlet_Access is begin return Route.Servlet; end Get_Servlet; -- ------------------------------ -- Append the filter to the filter list defined by the mapping node. -- ------------------------------ procedure Append_Filter (Route : in out Servlet_Route_Type; Filter : in Servlet.Filters.Filter_Access) is List : Servlet.Filters.Filter_List_Access; begin -- Filters are executed through the <b>Filter_Chain.Do_Filter</b> method -- starting from the last position to the first. To append a filter, -- it must be inserted as first position of the list. if Route.Filters = null then List := new Servlet.Filters.Filter_List (1 .. 1); else -- Check that the filter is not already executed. for I in Route.Filters'Range loop if Route.Filters (I) = Filter then return; end if; end loop; List := new Servlet.Filters.Filter_List (1 .. Route.Filters'Last + 1); List (2 .. List'Last) := Route.Filters.all; Free (Route.Filters); end if; List (List'First) := Filter; Route.Filters := List; end Append_Filter; -- ------------------------------ -- Release the storage held by the route. -- ------------------------------ overriding procedure Finalize (Route : in out Servlet_Route_Type) is begin Free (Route.Filters); end Finalize; -- ------------------------------ -- Get the servlet to call for the route. -- ------------------------------ overriding function Get_Servlet (Route : in Proxy_Route_Type) return Servlet.Core.Servlet_Access is begin if not Route.Route.Is_Null then return Servlet_Route_Type'Class (Route.Route.Value.Element.all).Get_Servlet; else return Route.Servlet; end if; end Get_Servlet; end Servlet.Routes.Servlets;
18052
----------------------------------------------------------------------- -- servlet-routes -- Request routing -- Copyright (C) 2015, 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; package body Servlet.Routes.Servlets is use type Servlet.Filters.Filter_Access; use type Servlet.Filters.Filter_List_Access; procedure Free is new Ada.Unchecked_Deallocation (Object => Servlet.Filters.Filter_List, Name => Servlet.Filters.Filter_List_Access); -- ------------------------------ -- Get the servlet to call for the route. -- ------------------------------ function Get_Servlet (Route : in Servlet_Route_Type) return Servlet.Core.Servlet_Access is begin return Route.Servlet; end Get_Servlet; -- ------------------------------ -- Append the filter to the filter list defined by the mapping node. -- ------------------------------ procedure Append_Filter (Route : in out Servlet_Route_Type; Filter : in Servlet.Filters.Filter_Access) is List : Servlet.Filters.Filter_List_Access; begin -- Filters are executed through the <b>Filter_Chain.Do_Filter</b> method -- starting from the last position to the first. To append a filter, -- it must be inserted as first position of the list. if Route.Filters = null then List := new Servlet.Filters.Filter_List (1 .. 1); else -- Check that the filter is not already executed. for I in Route.Filters'Range loop if Route.Filters (I) = Filter then return; end if; end loop; List := new Servlet.Filters.Filter_List (1 .. Route.Filters'Last + 1); List (2 .. List'Last) := Route.Filters.all; Free (Route.Filters); end if; List (List'First) := Filter; Route.Filters := List; end Append_Filter; -- ------------------------------ -- Release the storage held by the route. -- ------------------------------ overriding procedure Finalize (Route : in out Servlet_Route_Type) is begin Free (Route.Filters); end Finalize; -- ------------------------------ -- Get the servlet to call for the route. -- ------------------------------ overriding function Get_Servlet (Route : in Proxy_Route_Type) return Servlet.Core.Servlet_Access is begin if not Route.Route.Is_Null then return Servlet_Route_Type'Class (Route.Route.Value.Element.all).Get_Servlet; else return Route.Servlet; end if; end Get_Servlet; end Servlet.Routes.Servlets;
true
----------------------------------------------------------------------- -- servlet-routes -- Request routing -- Copyright (C) 2015, 2019 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; package body Servlet.Routes.Servlets is use type Servlet.Filters.Filter_Access; use type Servlet.Filters.Filter_List_Access; procedure Free is new Ada.Unchecked_Deallocation (Object => Servlet.Filters.Filter_List, Name => Servlet.Filters.Filter_List_Access); -- ------------------------------ -- Get the servlet to call for the route. -- ------------------------------ function Get_Servlet (Route : in Servlet_Route_Type) return Servlet.Core.Servlet_Access is begin return Route.Servlet; end Get_Servlet; -- ------------------------------ -- Append the filter to the filter list defined by the mapping node. -- ------------------------------ procedure Append_Filter (Route : in out Servlet_Route_Type; Filter : in Servlet.Filters.Filter_Access) is List : Servlet.Filters.Filter_List_Access; begin -- Filters are executed through the <b>Filter_Chain.Do_Filter</b> method -- starting from the last position to the first. To append a filter, -- it must be inserted as first position of the list. if Route.Filters = null then List := new Servlet.Filters.Filter_List (1 .. 1); else -- Check that the filter is not already executed. for I in Route.Filters'Range loop if Route.Filters (I) = Filter then return; end if; end loop; List := new Servlet.Filters.Filter_List (1 .. Route.Filters'Last + 1); List (2 .. List'Last) := Route.Filters.all; Free (Route.Filters); end if; List (List'First) := Filter; Route.Filters := List; end Append_Filter; -- ------------------------------ -- Release the storage held by the route. -- ------------------------------ overriding procedure Finalize (Route : in out Servlet_Route_Type) is begin Free (Route.Filters); end Finalize; -- ------------------------------ -- Get the servlet to call for the route. -- ------------------------------ overriding function Get_Servlet (Route : in Proxy_Route_Type) return Servlet.Core.Servlet_Access is begin if not Route.Route.Is_Null then return Servlet_Route_Type'Class (Route.Route.Value.Element.all).Get_Servlet; else return Route.Servlet; end if; end Get_Servlet; end Servlet.Routes.Servlets;
[ { "context": "Module: Software Configuration\n--\n-- Authors: Martin Becker ([email protected])\nwith FM25v0x;\n\n-- @summar", "end": 186, "score": 0.9998438954353333, "start": 173, "tag": "NAME", "value": "Martin Becker" }, { "context": "tware Configuration\n--\n-- Authors: Martin Becker ([email protected])\nwith FM25v0x;\n\n-- @summary\n-- Target-specific ", "end": 208, "score": 0.999934196472168, "start": 188, "tag": "EMAIL", "value": "[email protected]" } ]
software/hal/boards/pixracer_v1/hil/hil-devices-nvram.ads
TUM-EI-RCS/StratoX
12
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Module: Software Configuration -- -- Authors: Martin Becker ([email protected]) with FM25v0x; -- @summary -- Target-specific types for the NVRAM in Pixracer V1. package HIL.Devices.NVRAM with SPARK_Mode is -- Pixracer has 256kbit FRAM package FM25v02 is new FM25v0x (2**15); subtype NVRAM_Address is FM25v02.Address; end HIL.Devices.NVRAM;
2626
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Module: Software Configuration -- -- Authors: <NAME> (<EMAIL>) with FM25v0x; -- @summary -- Target-specific types for the NVRAM in Pixracer V1. package HIL.Devices.NVRAM with SPARK_Mode is -- Pixracer has 256kbit FRAM package FM25v02 is new FM25v0x (2**15); subtype NVRAM_Address is FM25v02.Address; end HIL.Devices.NVRAM;
true
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Module: Software Configuration -- -- Authors: PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) with FM25v0x; -- @summary -- Target-specific types for the NVRAM in Pixracer V1. package HIL.Devices.NVRAM with SPARK_Mode is -- Pixracer has 256kbit FRAM package FM25v02 is new FM25v0x (2**15); subtype NVRAM_Address is FM25v02.Address; end HIL.Devices.NVRAM;
[ { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rig", "end": 829, "score": 0.9998860359191895, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ", "end": 849, "score": 0.9999326467514038, "start": 831, "tag": "EMAIL", "value": "[email protected]" } ]
source/sql/sqlite3/matreshka-internals-sql_drivers-sqlite3-databases.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- 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 Interfaces.C; with League.Strings.Internals; with Matreshka.Internals.SQL_Drivers.SQLite3.Queries; with Matreshka.Internals.Strings.C; package body Matreshka.Internals.SQL_Drivers.SQLite3.Databases is use type Interfaces.C.int; procedure Call (Self : not null access SQLite3_Database'Class; Code : Interfaces.C.int); -- Process return code, constructs error message when code is error. ---------- -- Call -- ---------- procedure Call (Self : not null access SQLite3_Database'Class; Code : Interfaces.C.int) is begin -- Clear previous error state. Self.Success := True; Self.Error.Clear; case Code is when SQLITE_OK => null; when others => Self.Success := False; Self.Error := Matreshka.Internals.Strings.C.To_Valid_Universal_String (sqlite3_errmsg16 (Self.Handle)); end case; end Call; ----------- -- Close -- ----------- overriding procedure Close (Self : not null access SQLite3_Database) is begin Self.Invalidate_Queries; if Self.Handle /= null then Self.Call (sqlite3_close (Self.Handle)); Self.Handle := null; end if; end Close; ------------ -- Commit -- ------------ overriding procedure Commit (Self : not null access SQLite3_Database) is begin if Self.Handle /= null then declare Query : Matreshka.Internals.SQL_Drivers.Query_Access := Self.Query; begin if not Query.Prepare (League.Strings.To_Universal_String ("COMMIT")) then Self.Success := False; Self.Error := Query.Error_Message; elsif not Query.Execute then Self.Success := False; Self.Error := Query.Error_Message; end if; Matreshka.Internals.SQL_Drivers.Dereference (Query); end; end if; end Commit; --------------------- -- Database_Handle -- --------------------- function Database_Handle (Self : not null access constant SQLite3_Database'Class) return sqlite3_Access is begin return Self.Handle; end Database_Handle; ------------------- -- Error_Message -- ------------------- overriding function Error_Message (Self : not null access SQLite3_Database) return League.Strings.Universal_String is begin return Self.Error; end Error_Message; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : not null access SQLite3_Database) is begin if Self.Handle /= null then Self.Close; end if; end Finalize; ---------- -- Open -- ---------- overriding function Open (Self : not null access SQLite3_Database; Options : SQL.Options.SQL_Options) return Boolean is File_Name : constant League.Strings.Universal_String := Options.Get (League.Strings.To_Universal_String ("filename")); begin if Self.Handle = null then Self.Call (sqlite3_open16 (League.Strings.Internals.Internal (File_Name).Value, Self.Handle'Unchecked_Access)); else Self.Success := False; end if; return Self.Success; end Open; ----------- -- Query -- ----------- overriding function Query (Self : not null access SQLite3_Database) return not null Query_Access is begin return Aux : constant not null Query_Access := new Queries.SQLite3_Query do Queries.Initialize (Queries.SQLite3_Query'Class (Aux.all)'Access, Self); end return; end Query; end Matreshka.Internals.SQL_Drivers.SQLite3.Databases;
27387
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- 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 Interfaces.C; with League.Strings.Internals; with Matreshka.Internals.SQL_Drivers.SQLite3.Queries; with Matreshka.Internals.Strings.C; package body Matreshka.Internals.SQL_Drivers.SQLite3.Databases is use type Interfaces.C.int; procedure Call (Self : not null access SQLite3_Database'Class; Code : Interfaces.C.int); -- Process return code, constructs error message when code is error. ---------- -- Call -- ---------- procedure Call (Self : not null access SQLite3_Database'Class; Code : Interfaces.C.int) is begin -- Clear previous error state. Self.Success := True; Self.Error.Clear; case Code is when SQLITE_OK => null; when others => Self.Success := False; Self.Error := Matreshka.Internals.Strings.C.To_Valid_Universal_String (sqlite3_errmsg16 (Self.Handle)); end case; end Call; ----------- -- Close -- ----------- overriding procedure Close (Self : not null access SQLite3_Database) is begin Self.Invalidate_Queries; if Self.Handle /= null then Self.Call (sqlite3_close (Self.Handle)); Self.Handle := null; end if; end Close; ------------ -- Commit -- ------------ overriding procedure Commit (Self : not null access SQLite3_Database) is begin if Self.Handle /= null then declare Query : Matreshka.Internals.SQL_Drivers.Query_Access := Self.Query; begin if not Query.Prepare (League.Strings.To_Universal_String ("COMMIT")) then Self.Success := False; Self.Error := Query.Error_Message; elsif not Query.Execute then Self.Success := False; Self.Error := Query.Error_Message; end if; Matreshka.Internals.SQL_Drivers.Dereference (Query); end; end if; end Commit; --------------------- -- Database_Handle -- --------------------- function Database_Handle (Self : not null access constant SQLite3_Database'Class) return sqlite3_Access is begin return Self.Handle; end Database_Handle; ------------------- -- Error_Message -- ------------------- overriding function Error_Message (Self : not null access SQLite3_Database) return League.Strings.Universal_String is begin return Self.Error; end Error_Message; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : not null access SQLite3_Database) is begin if Self.Handle /= null then Self.Close; end if; end Finalize; ---------- -- Open -- ---------- overriding function Open (Self : not null access SQLite3_Database; Options : SQL.Options.SQL_Options) return Boolean is File_Name : constant League.Strings.Universal_String := Options.Get (League.Strings.To_Universal_String ("filename")); begin if Self.Handle = null then Self.Call (sqlite3_open16 (League.Strings.Internals.Internal (File_Name).Value, Self.Handle'Unchecked_Access)); else Self.Success := False; end if; return Self.Success; end Open; ----------- -- Query -- ----------- overriding function Query (Self : not null access SQLite3_Database) return not null Query_Access is begin return Aux : constant not null Query_Access := new Queries.SQLite3_Query do Queries.Initialize (Queries.SQLite3_Query'Class (Aux.all)'Access, Self); end return; end Query; end Matreshka.Internals.SQL_Drivers.SQLite3.Databases;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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 Interfaces.C; with League.Strings.Internals; with Matreshka.Internals.SQL_Drivers.SQLite3.Queries; with Matreshka.Internals.Strings.C; package body Matreshka.Internals.SQL_Drivers.SQLite3.Databases is use type Interfaces.C.int; procedure Call (Self : not null access SQLite3_Database'Class; Code : Interfaces.C.int); -- Process return code, constructs error message when code is error. ---------- -- Call -- ---------- procedure Call (Self : not null access SQLite3_Database'Class; Code : Interfaces.C.int) is begin -- Clear previous error state. Self.Success := True; Self.Error.Clear; case Code is when SQLITE_OK => null; when others => Self.Success := False; Self.Error := Matreshka.Internals.Strings.C.To_Valid_Universal_String (sqlite3_errmsg16 (Self.Handle)); end case; end Call; ----------- -- Close -- ----------- overriding procedure Close (Self : not null access SQLite3_Database) is begin Self.Invalidate_Queries; if Self.Handle /= null then Self.Call (sqlite3_close (Self.Handle)); Self.Handle := null; end if; end Close; ------------ -- Commit -- ------------ overriding procedure Commit (Self : not null access SQLite3_Database) is begin if Self.Handle /= null then declare Query : Matreshka.Internals.SQL_Drivers.Query_Access := Self.Query; begin if not Query.Prepare (League.Strings.To_Universal_String ("COMMIT")) then Self.Success := False; Self.Error := Query.Error_Message; elsif not Query.Execute then Self.Success := False; Self.Error := Query.Error_Message; end if; Matreshka.Internals.SQL_Drivers.Dereference (Query); end; end if; end Commit; --------------------- -- Database_Handle -- --------------------- function Database_Handle (Self : not null access constant SQLite3_Database'Class) return sqlite3_Access is begin return Self.Handle; end Database_Handle; ------------------- -- Error_Message -- ------------------- overriding function Error_Message (Self : not null access SQLite3_Database) return League.Strings.Universal_String is begin return Self.Error; end Error_Message; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : not null access SQLite3_Database) is begin if Self.Handle /= null then Self.Close; end if; end Finalize; ---------- -- Open -- ---------- overriding function Open (Self : not null access SQLite3_Database; Options : SQL.Options.SQL_Options) return Boolean is File_Name : constant League.Strings.Universal_String := Options.Get (League.Strings.To_Universal_String ("filename")); begin if Self.Handle = null then Self.Call (sqlite3_open16 (League.Strings.Internals.Internal (File_Name).Value, Self.Handle'Unchecked_Access)); else Self.Success := False; end if; return Self.Success; end Open; ----------- -- Query -- ----------- overriding function Query (Self : not null access SQLite3_Database) return not null Query_Access is begin return Aux : constant not null Query_Access := new Queries.SQLite3_Query do Queries.Initialize (Queries.SQLite3_Query'Class (Aux.all)'Access, Self); end return; end Query; end Matreshka.Internals.SQL_Drivers.SQLite3.Databases;
[ { "context": "s\n\n -- GStreamer\n -- *\n -- * Copyright (C) 2006 Andy Wingo <wingo at pobox.com>\n -- *\n -- * This library i", "end": 447, "score": 0.9998230338096619, "start": 437, "tag": "NAME", "value": "Andy Wingo" } ]
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_check_gstbufferstraw_h.ads
persan/A-gst
1
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstbufferstraw_h is -- GStreamer -- * -- * Copyright (C) 2006 Andy Wingo <wingo at pobox.com> -- * -- * 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. -- procedure gst_buffer_straw_start_pipeline (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/check/gstbufferstraw.h:29 pragma Import (C, gst_buffer_straw_start_pipeline, "gst_buffer_straw_start_pipeline"); function gst_buffer_straw_get_buffer (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/check/gstbufferstraw.h:30 pragma Import (C, gst_buffer_straw_get_buffer, "gst_buffer_straw_get_buffer"); procedure gst_buffer_straw_stop_pipeline (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/check/gstbufferstraw.h:31 pragma Import (C, gst_buffer_straw_stop_pipeline, "gst_buffer_straw_stop_pipeline"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstbufferstraw_h;
11271
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstbufferstraw_h is -- GStreamer -- * -- * Copyright (C) 2006 <NAME> <wingo at pobox.com> -- * -- * 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. -- procedure gst_buffer_straw_start_pipeline (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/check/gstbufferstraw.h:29 pragma Import (C, gst_buffer_straw_start_pipeline, "gst_buffer_straw_start_pipeline"); function gst_buffer_straw_get_buffer (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/check/gstbufferstraw.h:30 pragma Import (C, gst_buffer_straw_get_buffer, "gst_buffer_straw_get_buffer"); procedure gst_buffer_straw_stop_pipeline (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/check/gstbufferstraw.h:31 pragma Import (C, gst_buffer_straw_stop_pipeline, "gst_buffer_straw_stop_pipeline"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstbufferstraw_h;
true
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstbufferstraw_h is -- GStreamer -- * -- * Copyright (C) 2006 PI:NAME:<NAME>END_PI <wingo at pobox.com> -- * -- * 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. -- procedure gst_buffer_straw_start_pipeline (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/check/gstbufferstraw.h:29 pragma Import (C, gst_buffer_straw_start_pipeline, "gst_buffer_straw_start_pipeline"); function gst_buffer_straw_get_buffer (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/check/gstbufferstraw.h:30 pragma Import (C, gst_buffer_straw_get_buffer, "gst_buffer_straw_get_buffer"); procedure gst_buffer_straw_stop_pipeline (bin : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/check/gstbufferstraw.h:31 pragma Import (C, gst_buffer_straw_stop_pipeline, "gst_buffer_straw_stop_pipeline"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_check_gstbufferstraw_h;
[ { "context": "-base -- Database for files\n-- Copyright (C) 2014 Stephane.Carrez\n-- Written by Stephane.Carrez (Stephane.Carrez@g", "end": 147, "score": 0.9998831748962402, "start": 132, "tag": "NAME", "value": "Stephane.Carrez" }, { "context": " Copyright (C) 2014 Stephane.Carrez\n-- Written by Stephane.Carrez ([email protected])\n--\n-- Licensed under", "end": 178, "score": 0.9998869299888611, "start": 163, "tag": "NAME", "value": "Stephane.Carrez" }, { "context": "4 Stephane.Carrez\n-- Written by Stephane.Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 205, "score": 0.9999256134033203, "start": 180, "tag": "EMAIL", "value": "[email protected]" } ]
src/babel-base.ads
stcarrez/babel
1
----------------------------------------------------------------------- -- babel-base -- Database for files -- Copyright (C) 2014 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; with Babel.Files; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; type Database_Access is access all Database'Class; -- Insert the file in the database. procedure Insert (Into : in out Database; File : in Babel.Files.File_Type) is abstract; procedure Iterate (From : in Database; Process : not null access procedure (File : in Babel.Files.File_Type)) is abstract; procedure Copy (Into : in out Database'Class; From : in Database'Class); private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
20748
----------------------------------------------------------------------- -- babel-base -- Database for files -- Copyright (C) 2014 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with ADO; with Babel.Files; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; type Database_Access is access all Database'Class; -- Insert the file in the database. procedure Insert (Into : in out Database; File : in Babel.Files.File_Type) is abstract; procedure Iterate (From : in Database; Process : not null access procedure (File : in Babel.Files.File_Type)) is abstract; procedure Copy (Into : in out Database'Class; From : in Database'Class); private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
true
----------------------------------------------------------------------- -- babel-base -- Database for files -- Copyright (C) 2014 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with ADO; with Babel.Files; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; type Database_Access is access all Database'Class; -- Insert the file in the database. procedure Insert (Into : in out Database; File : in Babel.Files.File_Type) is abstract; procedure Iterate (From : in Database; Process : not null access procedure (File : in Babel.Files.File_Type)) is abstract; procedure Copy (Into : in out Database'Class; From : in Database'Class); private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
[ { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998670816421509, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999315142631531, "start": 45, "tag": "EMAIL", "value": "[email protected]" } ]
source/oasis/program-elements.adb
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Element_Iterators; with Program.Elements.Pragmas; with Program.Elements.Defining_Names; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Character_Literals; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Defining_Expanded_Names; with Program.Elements.Declarations; with Program.Elements.Type_Declarations; with Program.Elements.Task_Type_Declarations; with Program.Elements.Protected_Type_Declarations; with Program.Elements.Subtype_Declarations; with Program.Elements.Object_Declarations; with Program.Elements.Single_Task_Declarations; with Program.Elements.Single_Protected_Declarations; with Program.Elements.Number_Declarations; with Program.Elements.Enumeration_Literal_Specifications; with Program.Elements.Discriminant_Specifications; with Program.Elements.Component_Declarations; with Program.Elements.Loop_Parameter_Specifications; with Program.Elements.Generalized_Iterator_Specifications; with Program.Elements.Element_Iterator_Specifications; with Program.Elements.Procedure_Declarations; with Program.Elements.Function_Declarations; with Program.Elements.Parameter_Specifications; with Program.Elements.Procedure_Body_Declarations; with Program.Elements.Function_Body_Declarations; with Program.Elements.Return_Object_Specifications; with Program.Elements.Package_Declarations; with Program.Elements.Package_Body_Declarations; with Program.Elements.Object_Renaming_Declarations; with Program.Elements.Exception_Renaming_Declarations; with Program.Elements.Procedure_Renaming_Declarations; with Program.Elements.Function_Renaming_Declarations; with Program.Elements.Package_Renaming_Declarations; with Program.Elements.Generic_Package_Renaming_Declarations; with Program.Elements.Generic_Procedure_Renaming_Declarations; with Program.Elements.Generic_Function_Renaming_Declarations; with Program.Elements.Task_Body_Declarations; with Program.Elements.Protected_Body_Declarations; with Program.Elements.Entry_Declarations; with Program.Elements.Entry_Body_Declarations; with Program.Elements.Entry_Index_Specifications; with Program.Elements.Procedure_Body_Stubs; with Program.Elements.Function_Body_Stubs; with Program.Elements.Package_Body_Stubs; with Program.Elements.Task_Body_Stubs; with Program.Elements.Protected_Body_Stubs; with Program.Elements.Exception_Declarations; with Program.Elements.Choice_Parameter_Specifications; with Program.Elements.Generic_Package_Declarations; with Program.Elements.Generic_Procedure_Declarations; with Program.Elements.Generic_Function_Declarations; with Program.Elements.Package_Instantiations; with Program.Elements.Procedure_Instantiations; with Program.Elements.Function_Instantiations; with Program.Elements.Formal_Object_Declarations; with Program.Elements.Formal_Type_Declarations; with Program.Elements.Formal_Procedure_Declarations; with Program.Elements.Formal_Function_Declarations; with Program.Elements.Formal_Package_Declarations; with Program.Elements.Definitions; with Program.Elements.Type_Definitions; with Program.Elements.Subtype_Indications; with Program.Elements.Constraints; with Program.Elements.Component_Definitions; with Program.Elements.Discrete_Ranges; with Program.Elements.Discrete_Subtype_Indications; with Program.Elements.Discrete_Range_Attribute_References; with Program.Elements.Discrete_Simple_Expression_Ranges; with Program.Elements.Unknown_Discriminant_Parts; with Program.Elements.Known_Discriminant_Parts; with Program.Elements.Record_Definitions; with Program.Elements.Null_Components; with Program.Elements.Variant_Parts; with Program.Elements.Variants; with Program.Elements.Others_Choices; with Program.Elements.Anonymous_Access_Definitions; with Program.Elements.Anonymous_Access_To_Objects; with Program.Elements.Anonymous_Access_To_Procedures; with Program.Elements.Anonymous_Access_To_Functions; with Program.Elements.Private_Type_Definitions; with Program.Elements.Private_Extension_Definitions; with Program.Elements.Incomplete_Type_Definitions; with Program.Elements.Task_Definitions; with Program.Elements.Protected_Definitions; with Program.Elements.Formal_Type_Definitions; with Program.Elements.Aspect_Specifications; with Program.Elements.Real_Range_Specifications; with Program.Elements.Expressions; with Program.Elements.Numeric_Literals; with Program.Elements.String_Literals; with Program.Elements.Identifiers; with Program.Elements.Operator_Symbols; with Program.Elements.Character_Literals; with Program.Elements.Explicit_Dereferences; with Program.Elements.Infix_Operators; with Program.Elements.Function_Calls; with Program.Elements.Indexed_Components; with Program.Elements.Slices; with Program.Elements.Selected_Components; with Program.Elements.Attribute_References; with Program.Elements.Record_Aggregates; with Program.Elements.Extension_Aggregates; with Program.Elements.Array_Aggregates; with Program.Elements.Short_Circuit_Operations; with Program.Elements.Membership_Tests; with Program.Elements.Null_Literals; with Program.Elements.Parenthesized_Expressions; with Program.Elements.Raise_Expressions; with Program.Elements.Type_Conversions; with Program.Elements.Qualified_Expressions; with Program.Elements.Allocators; with Program.Elements.Case_Expressions; with Program.Elements.If_Expressions; with Program.Elements.Quantified_Expressions; with Program.Elements.Associations; with Program.Elements.Discriminant_Associations; with Program.Elements.Record_Component_Associations; with Program.Elements.Array_Component_Associations; with Program.Elements.Parameter_Associations; with Program.Elements.Formal_Package_Associations; with Program.Elements.Statements; with Program.Elements.Null_Statements; with Program.Elements.Assignment_Statements; with Program.Elements.If_Statements; with Program.Elements.Case_Statements; with Program.Elements.Loop_Statements; with Program.Elements.While_Loop_Statements; with Program.Elements.For_Loop_Statements; with Program.Elements.Block_Statements; with Program.Elements.Exit_Statements; with Program.Elements.Goto_Statements; with Program.Elements.Call_Statements; with Program.Elements.Simple_Return_Statements; with Program.Elements.Extended_Return_Statements; with Program.Elements.Accept_Statements; with Program.Elements.Requeue_Statements; with Program.Elements.Delay_Statements; with Program.Elements.Terminate_Alternative_Statements; with Program.Elements.Select_Statements; with Program.Elements.Abort_Statements; with Program.Elements.Raise_Statements; with Program.Elements.Code_Statements; with Program.Elements.Paths; with Program.Elements.Elsif_Paths; with Program.Elements.Case_Paths; with Program.Elements.Select_Paths; with Program.Elements.Case_Expression_Paths; with Program.Elements.Elsif_Expression_Paths; with Program.Elements.Clauses; with Program.Elements.Use_Clauses; with Program.Elements.With_Clauses; with Program.Elements.Representation_Clauses; with Program.Elements.Component_Clauses; with Program.Elements.Derived_Types; with Program.Elements.Derived_Record_Extensions; with Program.Elements.Enumeration_Types; with Program.Elements.Signed_Integer_Types; with Program.Elements.Modular_Types; with Program.Elements.Root_Types; with Program.Elements.Floating_Point_Types; with Program.Elements.Ordinary_Fixed_Point_Types; with Program.Elements.Decimal_Fixed_Point_Types; with Program.Elements.Unconstrained_Array_Types; with Program.Elements.Constrained_Array_Types; with Program.Elements.Record_Types; with Program.Elements.Interface_Types; with Program.Elements.Object_Access_Types; with Program.Elements.Procedure_Access_Types; with Program.Elements.Function_Access_Types; with Program.Elements.Formal_Private_Type_Definitions; with Program.Elements.Formal_Derived_Type_Definitions; with Program.Elements.Formal_Discrete_Type_Definitions; with Program.Elements.Formal_Signed_Integer_Type_Definitions; with Program.Elements.Formal_Modular_Type_Definitions; with Program.Elements.Formal_Floating_Point_Definitions; with Program.Elements.Formal_Ordinary_Fixed_Point_Definitions; with Program.Elements.Formal_Decimal_Fixed_Point_Definitions; with Program.Elements.Formal_Unconstrained_Array_Types; with Program.Elements.Formal_Constrained_Array_Types; with Program.Elements.Formal_Access_Types; with Program.Elements.Formal_Object_Access_Types; with Program.Elements.Formal_Procedure_Access_Types; with Program.Elements.Formal_Function_Access_Types; with Program.Elements.Formal_Interface_Types; with Program.Elements.Access_Types; with Program.Elements.Range_Attribute_References; with Program.Elements.Simple_Expression_Ranges; with Program.Elements.Digits_Constraints; with Program.Elements.Delta_Constraints; with Program.Elements.Index_Constraints; with Program.Elements.Discriminant_Constraints; with Program.Elements.Attribute_Definition_Clauses; with Program.Elements.Enumeration_Representation_Clauses; with Program.Elements.Record_Representation_Clauses; with Program.Elements.At_Clauses; with Program.Elements.Exception_Handlers; package body Program.Elements is function Each_Enclosing_Element (Self : not null access Element'Class) return Program.Element_Iterators.Enclosing_Element_Iterator is begin return Program.Element_Iterators.To_Enclosing_Element_Iterator (Element_Access (Self)); end Each_Enclosing_Element; function Each_Child (Self : not null access Element'Class; Filter : Program.Element_Iterators.Element_Checker) return Program.Element_Iterators.Child_Iterator is begin return Program.Element_Iterators.To_Child_Iterator (Element_Access (Self), Filter); end Each_Child; function Each_Child (Self : not null access Element'Class) return Program.Element_Iterators.Child_Iterator is begin return Program.Element_Iterators.To_Child_Iterator (Element_Access (Self)); end Each_Child; function To_Pragma (Self : access Element'Class) return Program.Elements.Pragmas.Pragma_Access is begin return Program.Elements.Pragmas.Pragma_Access (Self); end To_Pragma; function To_Defining_Name (Self : access Element'Class) return Program.Elements.Defining_Names.Defining_Name_Access is begin return Program.Elements.Defining_Names.Defining_Name_Access (Self); end To_Defining_Name; function To_Defining_Identifier (Self : access Element'Class) return Program.Elements.Defining_Identifiers .Defining_Identifier_Access is begin return Program.Elements.Defining_Identifiers.Defining_Identifier_Access (Self); end To_Defining_Identifier; function To_Defining_Character_Literal (Self : access Element'Class) return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access is begin return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access (Self); end To_Defining_Character_Literal; function To_Defining_Operator_Symbol (Self : access Element'Class) return Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access is begin return Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access (Self); end To_Defining_Operator_Symbol; function To_Defining_Expanded_Name (Self : access Element'Class) return Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access is begin return Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access (Self); end To_Defining_Expanded_Name; function To_Declaration (Self : access Element'Class) return Program.Elements.Declarations.Declaration_Access is begin return Program.Elements.Declarations.Declaration_Access (Self); end To_Declaration; function To_Type_Declaration (Self : access Element'Class) return Program.Elements.Type_Declarations.Type_Declaration_Access is begin return Program.Elements.Type_Declarations.Type_Declaration_Access (Self); end To_Type_Declaration; function To_Task_Type_Declaration (Self : access Element'Class) return Program.Elements.Task_Type_Declarations .Task_Type_Declaration_Access is begin return Program.Elements.Task_Type_Declarations .Task_Type_Declaration_Access (Self); end To_Task_Type_Declaration; function To_Protected_Type_Declaration (Self : access Element'Class) return Program.Elements.Protected_Type_Declarations .Protected_Type_Declaration_Access is begin return Program.Elements.Protected_Type_Declarations .Protected_Type_Declaration_Access (Self); end To_Protected_Type_Declaration; function To_Subtype_Declaration (Self : access Element'Class) return Program.Elements.Subtype_Declarations .Subtype_Declaration_Access is begin return Program.Elements.Subtype_Declarations.Subtype_Declaration_Access (Self); end To_Subtype_Declaration; function To_Object_Declaration (Self : access Element'Class) return Program.Elements.Object_Declarations.Object_Declaration_Access is begin return Program.Elements.Object_Declarations.Object_Declaration_Access (Self); end To_Object_Declaration; function To_Single_Task_Declaration (Self : access Element'Class) return Program.Elements.Single_Task_Declarations .Single_Task_Declaration_Access is begin return Program.Elements.Single_Task_Declarations .Single_Task_Declaration_Access (Self); end To_Single_Task_Declaration; function To_Single_Protected_Declaration (Self : access Element'Class) return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Access is begin return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Access (Self); end To_Single_Protected_Declaration; function To_Number_Declaration (Self : access Element'Class) return Program.Elements.Number_Declarations.Number_Declaration_Access is begin return Program.Elements.Number_Declarations.Number_Declaration_Access (Self); end To_Number_Declaration; function To_Enumeration_Literal_Specification (Self : access Element'Class) return Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access is begin return Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access (Self); end To_Enumeration_Literal_Specification; function To_Discriminant_Specification (Self : access Element'Class) return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Access is begin return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Access (Self); end To_Discriminant_Specification; function To_Component_Declaration (Self : access Element'Class) return Program.Elements.Component_Declarations .Component_Declaration_Access is begin return Program.Elements.Component_Declarations .Component_Declaration_Access (Self); end To_Component_Declaration; function To_Loop_Parameter_Specification (Self : access Element'Class) return Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access is begin return Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access (Self); end To_Loop_Parameter_Specification; function To_Generalized_Iterator_Specification (Self : access Element'Class) return Program.Elements.Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access is begin return Program.Elements.Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access (Self); end To_Generalized_Iterator_Specification; function To_Element_Iterator_Specification (Self : access Element'Class) return Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access is begin return Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access (Self); end To_Element_Iterator_Specification; function To_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Declarations .Procedure_Declaration_Access is begin return Program.Elements.Procedure_Declarations .Procedure_Declaration_Access (Self); end To_Procedure_Declaration; function To_Function_Declaration (Self : access Element'Class) return Program.Elements.Function_Declarations .Function_Declaration_Access is begin return Program.Elements.Function_Declarations.Function_Declaration_Access (Self); end To_Function_Declaration; function To_Parameter_Specification (Self : access Element'Class) return Program.Elements.Parameter_Specifications .Parameter_Specification_Access is begin return Program.Elements.Parameter_Specifications .Parameter_Specification_Access (Self); end To_Parameter_Specification; function To_Procedure_Body_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access is begin return Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access (Self); end To_Procedure_Body_Declaration; function To_Function_Body_Declaration (Self : access Element'Class) return Program.Elements.Function_Body_Declarations .Function_Body_Declaration_Access is begin return Program.Elements.Function_Body_Declarations .Function_Body_Declaration_Access (Self); end To_Function_Body_Declaration; function To_Return_Object_Specification (Self : access Element'Class) return Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access is begin return Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access (Self); end To_Return_Object_Specification; function To_Package_Declaration (Self : access Element'Class) return Program.Elements.Package_Declarations .Package_Declaration_Access is begin return Program.Elements.Package_Declarations.Package_Declaration_Access (Self); end To_Package_Declaration; function To_Package_Body_Declaration (Self : access Element'Class) return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Access is begin return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Access (Self); end To_Package_Body_Declaration; function To_Object_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Object_Renaming_Declarations .Object_Renaming_Declaration_Access is begin return Program.Elements.Object_Renaming_Declarations .Object_Renaming_Declaration_Access (Self); end To_Object_Renaming_Declaration; function To_Exception_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Exception_Renaming_Declarations .Exception_Renaming_Declaration_Access is begin return Program.Elements.Exception_Renaming_Declarations .Exception_Renaming_Declaration_Access (Self); end To_Exception_Renaming_Declaration; function To_Procedure_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Renaming_Declarations .Procedure_Renaming_Declaration_Access is begin return Program.Elements.Procedure_Renaming_Declarations .Procedure_Renaming_Declaration_Access (Self); end To_Procedure_Renaming_Declaration; function To_Function_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Function_Renaming_Declarations .Function_Renaming_Declaration_Access is begin return Program.Elements.Function_Renaming_Declarations .Function_Renaming_Declaration_Access (Self); end To_Function_Renaming_Declaration; function To_Package_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Package_Renaming_Declarations .Package_Renaming_Declaration_Access is begin return Program.Elements.Package_Renaming_Declarations .Package_Renaming_Declaration_Access (Self); end To_Package_Renaming_Declaration; function To_Generic_Package_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Package_Renaming_Declarations .Generic_Package_Renaming_Declaration_Access is begin return Program.Elements.Generic_Package_Renaming_Declarations .Generic_Package_Renaming_Declaration_Access (Self); end To_Generic_Package_Renaming_Declaration; function To_Generic_Procedure_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Procedure_Renaming_Declarations .Generic_Procedure_Renaming_Declaration_Access is begin return Program.Elements.Generic_Procedure_Renaming_Declarations .Generic_Procedure_Renaming_Declaration_Access (Self); end To_Generic_Procedure_Renaming_Declaration; function To_Generic_Function_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Function_Renaming_Declarations .Generic_Function_Renaming_Declaration_Access is begin return Program.Elements.Generic_Function_Renaming_Declarations .Generic_Function_Renaming_Declaration_Access (Self); end To_Generic_Function_Renaming_Declaration; function To_Task_Body_Declaration (Self : access Element'Class) return Program.Elements.Task_Body_Declarations .Task_Body_Declaration_Access is begin return Program.Elements.Task_Body_Declarations .Task_Body_Declaration_Access (Self); end To_Task_Body_Declaration; function To_Protected_Body_Declaration (Self : access Element'Class) return Program.Elements.Protected_Body_Declarations .Protected_Body_Declaration_Access is begin return Program.Elements.Protected_Body_Declarations .Protected_Body_Declaration_Access (Self); end To_Protected_Body_Declaration; function To_Entry_Declaration (Self : access Element'Class) return Program.Elements.Entry_Declarations.Entry_Declaration_Access is begin return Program.Elements.Entry_Declarations.Entry_Declaration_Access (Self); end To_Entry_Declaration; function To_Entry_Body_Declaration (Self : access Element'Class) return Program.Elements.Entry_Body_Declarations .Entry_Body_Declaration_Access is begin return Program.Elements.Entry_Body_Declarations .Entry_Body_Declaration_Access (Self); end To_Entry_Body_Declaration; function To_Entry_Index_Specification (Self : access Element'Class) return Program.Elements.Entry_Index_Specifications .Entry_Index_Specification_Access is begin return Program.Elements.Entry_Index_Specifications .Entry_Index_Specification_Access (Self); end To_Entry_Index_Specification; function To_Procedure_Body_Stub (Self : access Element'Class) return Program.Elements.Procedure_Body_Stubs .Procedure_Body_Stub_Access is begin return Program.Elements.Procedure_Body_Stubs.Procedure_Body_Stub_Access (Self); end To_Procedure_Body_Stub; function To_Function_Body_Stub (Self : access Element'Class) return Program.Elements.Function_Body_Stubs.Function_Body_Stub_Access is begin return Program.Elements.Function_Body_Stubs.Function_Body_Stub_Access (Self); end To_Function_Body_Stub; function To_Package_Body_Stub (Self : access Element'Class) return Program.Elements.Package_Body_Stubs.Package_Body_Stub_Access is begin return Program.Elements.Package_Body_Stubs.Package_Body_Stub_Access (Self); end To_Package_Body_Stub; function To_Task_Body_Stub (Self : access Element'Class) return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access is begin return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access (Self); end To_Task_Body_Stub; function To_Protected_Body_Stub (Self : access Element'Class) return Program.Elements.Protected_Body_Stubs .Protected_Body_Stub_Access is begin return Program.Elements.Protected_Body_Stubs.Protected_Body_Stub_Access (Self); end To_Protected_Body_Stub; function To_Exception_Declaration (Self : access Element'Class) return Program.Elements.Exception_Declarations .Exception_Declaration_Access is begin return Program.Elements.Exception_Declarations .Exception_Declaration_Access (Self); end To_Exception_Declaration; function To_Choice_Parameter_Specification (Self : access Element'Class) return Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access is begin return Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access (Self); end To_Choice_Parameter_Specification; function To_Generic_Package_Declaration (Self : access Element'Class) return Program.Elements.Generic_Package_Declarations .Generic_Package_Declaration_Access is begin return Program.Elements.Generic_Package_Declarations .Generic_Package_Declaration_Access (Self); end To_Generic_Package_Declaration; function To_Generic_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Access is begin return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Access (Self); end To_Generic_Procedure_Declaration; function To_Generic_Function_Declaration (Self : access Element'Class) return Program.Elements.Generic_Function_Declarations .Generic_Function_Declaration_Access is begin return Program.Elements.Generic_Function_Declarations .Generic_Function_Declaration_Access (Self); end To_Generic_Function_Declaration; function To_Package_Instantiation (Self : access Element'Class) return Program.Elements.Package_Instantiations .Package_Instantiation_Access is begin return Program.Elements.Package_Instantiations .Package_Instantiation_Access (Self); end To_Package_Instantiation; function To_Procedure_Instantiation (Self : access Element'Class) return Program.Elements.Procedure_Instantiations .Procedure_Instantiation_Access is begin return Program.Elements.Procedure_Instantiations .Procedure_Instantiation_Access (Self); end To_Procedure_Instantiation; function To_Function_Instantiation (Self : access Element'Class) return Program.Elements.Function_Instantiations .Function_Instantiation_Access is begin return Program.Elements.Function_Instantiations .Function_Instantiation_Access (Self); end To_Function_Instantiation; function To_Formal_Object_Declaration (Self : access Element'Class) return Program.Elements.Formal_Object_Declarations .Formal_Object_Declaration_Access is begin return Program.Elements.Formal_Object_Declarations .Formal_Object_Declaration_Access (Self); end To_Formal_Object_Declaration; function To_Formal_Type_Declaration (Self : access Element'Class) return Program.Elements.Formal_Type_Declarations .Formal_Type_Declaration_Access is begin return Program.Elements.Formal_Type_Declarations .Formal_Type_Declaration_Access (Self); end To_Formal_Type_Declaration; function To_Formal_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Formal_Procedure_Declarations .Formal_Procedure_Declaration_Access is begin return Program.Elements.Formal_Procedure_Declarations .Formal_Procedure_Declaration_Access (Self); end To_Formal_Procedure_Declaration; function To_Formal_Function_Declaration (Self : access Element'Class) return Program.Elements.Formal_Function_Declarations .Formal_Function_Declaration_Access is begin return Program.Elements.Formal_Function_Declarations .Formal_Function_Declaration_Access (Self); end To_Formal_Function_Declaration; function To_Formal_Package_Declaration (Self : access Element'Class) return Program.Elements.Formal_Package_Declarations .Formal_Package_Declaration_Access is begin return Program.Elements.Formal_Package_Declarations .Formal_Package_Declaration_Access (Self); end To_Formal_Package_Declaration; function To_Definition (Self : access Element'Class) return Program.Elements.Definitions.Definition_Access is begin return Program.Elements.Definitions.Definition_Access (Self); end To_Definition; function To_Type_Definition (Self : access Element'Class) return Program.Elements.Type_Definitions.Type_Definition_Access is begin return Program.Elements.Type_Definitions.Type_Definition_Access (Self); end To_Type_Definition; function To_Subtype_Indication (Self : access Element'Class) return Program.Elements.Subtype_Indications.Subtype_Indication_Access is begin return Program.Elements.Subtype_Indications.Subtype_Indication_Access (Self); end To_Subtype_Indication; function To_Constraint (Self : access Element'Class) return Program.Elements.Constraints.Constraint_Access is begin return Program.Elements.Constraints.Constraint_Access (Self); end To_Constraint; function To_Component_Definition (Self : access Element'Class) return Program.Elements.Component_Definitions .Component_Definition_Access is begin return Program.Elements.Component_Definitions.Component_Definition_Access (Self); end To_Component_Definition; function To_Discrete_Range (Self : access Element'Class) return Program.Elements.Discrete_Ranges.Discrete_Range_Access is begin return Program.Elements.Discrete_Ranges.Discrete_Range_Access (Self); end To_Discrete_Range; function To_Discrete_Subtype_Indication (Self : access Element'Class) return Program.Elements.Discrete_Subtype_Indications .Discrete_Subtype_Indication_Access is begin return Program.Elements.Discrete_Subtype_Indications .Discrete_Subtype_Indication_Access (Self); end To_Discrete_Subtype_Indication; function To_Discrete_Range_Attribute_Reference (Self : access Element'Class) return Program.Elements.Discrete_Range_Attribute_References .Discrete_Range_Attribute_Reference_Access is begin return Program.Elements.Discrete_Range_Attribute_References .Discrete_Range_Attribute_Reference_Access (Self); end To_Discrete_Range_Attribute_Reference; function To_Discrete_Simple_Expression_Range (Self : access Element'Class) return Program.Elements.Discrete_Simple_Expression_Ranges .Discrete_Simple_Expression_Range_Access is begin return Program.Elements.Discrete_Simple_Expression_Ranges .Discrete_Simple_Expression_Range_Access (Self); end To_Discrete_Simple_Expression_Range; function To_Unknown_Discriminant_Part (Self : access Element'Class) return Program.Elements.Unknown_Discriminant_Parts .Unknown_Discriminant_Part_Access is begin return Program.Elements.Unknown_Discriminant_Parts .Unknown_Discriminant_Part_Access (Self); end To_Unknown_Discriminant_Part; function To_Known_Discriminant_Part (Self : access Element'Class) return Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access is begin return Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access (Self); end To_Known_Discriminant_Part; function To_Record_Definition (Self : access Element'Class) return Program.Elements.Record_Definitions.Record_Definition_Access is begin return Program.Elements.Record_Definitions.Record_Definition_Access (Self); end To_Record_Definition; function To_Null_Component (Self : access Element'Class) return Program.Elements.Null_Components.Null_Component_Access is begin return Program.Elements.Null_Components.Null_Component_Access (Self); end To_Null_Component; function To_Variant_Part (Self : access Element'Class) return Program.Elements.Variant_Parts.Variant_Part_Access is begin return Program.Elements.Variant_Parts.Variant_Part_Access (Self); end To_Variant_Part; function To_Variant (Self : access Element'Class) return Program.Elements.Variants.Variant_Access is begin return Program.Elements.Variants.Variant_Access (Self); end To_Variant; function To_Others_Choice (Self : access Element'Class) return Program.Elements.Others_Choices.Others_Choice_Access is begin return Program.Elements.Others_Choices.Others_Choice_Access (Self); end To_Others_Choice; function To_Anonymous_Access_Definition (Self : access Element'Class) return Program.Elements.Anonymous_Access_Definitions .Anonymous_Access_Definition_Access is begin return Program.Elements.Anonymous_Access_Definitions .Anonymous_Access_Definition_Access (Self); end To_Anonymous_Access_Definition; function To_Anonymous_Access_To_Object (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Objects .Anonymous_Access_To_Object_Access is begin return Program.Elements.Anonymous_Access_To_Objects .Anonymous_Access_To_Object_Access (Self); end To_Anonymous_Access_To_Object; function To_Anonymous_Access_To_Procedure (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Access is begin return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Access (Self); end To_Anonymous_Access_To_Procedure; function To_Anonymous_Access_To_Function (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Access is begin return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Access (Self); end To_Anonymous_Access_To_Function; function To_Private_Type_Definition (Self : access Element'Class) return Program.Elements.Private_Type_Definitions .Private_Type_Definition_Access is begin return Program.Elements.Private_Type_Definitions .Private_Type_Definition_Access (Self); end To_Private_Type_Definition; function To_Private_Extension_Definition (Self : access Element'Class) return Program.Elements.Private_Extension_Definitions .Private_Extension_Definition_Access is begin return Program.Elements.Private_Extension_Definitions .Private_Extension_Definition_Access (Self); end To_Private_Extension_Definition; function To_Incomplete_Type_Definition (Self : access Element'Class) return Program.Elements.Incomplete_Type_Definitions .Incomplete_Type_Definition_Access is begin return Program.Elements.Incomplete_Type_Definitions .Incomplete_Type_Definition_Access (Self); end To_Incomplete_Type_Definition; function To_Task_Definition (Self : access Element'Class) return Program.Elements.Task_Definitions.Task_Definition_Access is begin return Program.Elements.Task_Definitions.Task_Definition_Access (Self); end To_Task_Definition; function To_Protected_Definition (Self : access Element'Class) return Program.Elements.Protected_Definitions .Protected_Definition_Access is begin return Program.Elements.Protected_Definitions.Protected_Definition_Access (Self); end To_Protected_Definition; function To_Formal_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Type_Definitions .Formal_Type_Definition_Access is begin return Program.Elements.Formal_Type_Definitions .Formal_Type_Definition_Access (Self); end To_Formal_Type_Definition; function To_Aspect_Specification (Self : access Element'Class) return Program.Elements.Aspect_Specifications .Aspect_Specification_Access is begin return Program.Elements.Aspect_Specifications.Aspect_Specification_Access (Self); end To_Aspect_Specification; function To_Real_Range_Specification (Self : access Element'Class) return Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access is begin return Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access (Self); end To_Real_Range_Specification; function To_Expression (Self : access Element'Class) return Program.Elements.Expressions.Expression_Access is begin return Program.Elements.Expressions.Expression_Access (Self); end To_Expression; function To_Numeric_Literal (Self : access Element'Class) return Program.Elements.Numeric_Literals.Numeric_Literal_Access is begin return Program.Elements.Numeric_Literals.Numeric_Literal_Access (Self); end To_Numeric_Literal; function To_String_Literal (Self : access Element'Class) return Program.Elements.String_Literals.String_Literal_Access is begin return Program.Elements.String_Literals.String_Literal_Access (Self); end To_String_Literal; function To_Identifier (Self : access Element'Class) return Program.Elements.Identifiers.Identifier_Access is begin return Program.Elements.Identifiers.Identifier_Access (Self); end To_Identifier; function To_Operator_Symbol (Self : access Element'Class) return Program.Elements.Operator_Symbols.Operator_Symbol_Access is begin return Program.Elements.Operator_Symbols.Operator_Symbol_Access (Self); end To_Operator_Symbol; function To_Character_Literal (Self : access Element'Class) return Program.Elements.Character_Literals.Character_Literal_Access is begin return Program.Elements.Character_Literals.Character_Literal_Access (Self); end To_Character_Literal; function To_Explicit_Dereference (Self : access Element'Class) return Program.Elements.Explicit_Dereferences .Explicit_Dereference_Access is begin return Program.Elements.Explicit_Dereferences.Explicit_Dereference_Access (Self); end To_Explicit_Dereference; function To_Infix_Operator (Self : access Element'Class) return Program.Elements.Infix_Operators.Infix_Operator_Access is begin return Program.Elements.Infix_Operators.Infix_Operator_Access (Self); end To_Infix_Operator; function To_Function_Call (Self : access Element'Class) return Program.Elements.Function_Calls.Function_Call_Access is begin return Program.Elements.Function_Calls.Function_Call_Access (Self); end To_Function_Call; function To_Indexed_Component (Self : access Element'Class) return Program.Elements.Indexed_Components.Indexed_Component_Access is begin return Program.Elements.Indexed_Components.Indexed_Component_Access (Self); end To_Indexed_Component; function To_Slice (Self : access Element'Class) return Program.Elements.Slices.Slice_Access is begin return Program.Elements.Slices.Slice_Access (Self); end To_Slice; function To_Selected_Component (Self : access Element'Class) return Program.Elements.Selected_Components.Selected_Component_Access is begin return Program.Elements.Selected_Components.Selected_Component_Access (Self); end To_Selected_Component; function To_Attribute_Reference (Self : access Element'Class) return Program.Elements.Attribute_References .Attribute_Reference_Access is begin return Program.Elements.Attribute_References.Attribute_Reference_Access (Self); end To_Attribute_Reference; function To_Record_Aggregate (Self : access Element'Class) return Program.Elements.Record_Aggregates.Record_Aggregate_Access is begin return Program.Elements.Record_Aggregates.Record_Aggregate_Access (Self); end To_Record_Aggregate; function To_Extension_Aggregate (Self : access Element'Class) return Program.Elements.Extension_Aggregates .Extension_Aggregate_Access is begin return Program.Elements.Extension_Aggregates.Extension_Aggregate_Access (Self); end To_Extension_Aggregate; function To_Array_Aggregate (Self : access Element'Class) return Program.Elements.Array_Aggregates.Array_Aggregate_Access is begin return Program.Elements.Array_Aggregates.Array_Aggregate_Access (Self); end To_Array_Aggregate; function To_Short_Circuit_Operation (Self : access Element'Class) return Program.Elements.Short_Circuit_Operations .Short_Circuit_Operation_Access is begin return Program.Elements.Short_Circuit_Operations .Short_Circuit_Operation_Access (Self); end To_Short_Circuit_Operation; function To_Membership_Test (Self : access Element'Class) return Program.Elements.Membership_Tests.Membership_Test_Access is begin return Program.Elements.Membership_Tests.Membership_Test_Access (Self); end To_Membership_Test; function To_Null_Literal (Self : access Element'Class) return Program.Elements.Null_Literals.Null_Literal_Access is begin return Program.Elements.Null_Literals.Null_Literal_Access (Self); end To_Null_Literal; function To_Parenthesized_Expression (Self : access Element'Class) return Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access is begin return Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access (Self); end To_Parenthesized_Expression; function To_Raise_Expression (Self : access Element'Class) return Program.Elements.Raise_Expressions.Raise_Expression_Access is begin return Program.Elements.Raise_Expressions.Raise_Expression_Access (Self); end To_Raise_Expression; function To_Type_Conversion (Self : access Element'Class) return Program.Elements.Type_Conversions.Type_Conversion_Access is begin return Program.Elements.Type_Conversions.Type_Conversion_Access (Self); end To_Type_Conversion; function To_Qualified_Expression (Self : access Element'Class) return Program.Elements.Qualified_Expressions .Qualified_Expression_Access is begin return Program.Elements.Qualified_Expressions.Qualified_Expression_Access (Self); end To_Qualified_Expression; function To_Allocator (Self : access Element'Class) return Program.Elements.Allocators.Allocator_Access is begin return Program.Elements.Allocators.Allocator_Access (Self); end To_Allocator; function To_Case_Expression (Self : access Element'Class) return Program.Elements.Case_Expressions.Case_Expression_Access is begin return Program.Elements.Case_Expressions.Case_Expression_Access (Self); end To_Case_Expression; function To_If_Expression (Self : access Element'Class) return Program.Elements.If_Expressions.If_Expression_Access is begin return Program.Elements.If_Expressions.If_Expression_Access (Self); end To_If_Expression; function To_Quantified_Expression (Self : access Element'Class) return Program.Elements.Quantified_Expressions .Quantified_Expression_Access is begin return Program.Elements.Quantified_Expressions .Quantified_Expression_Access (Self); end To_Quantified_Expression; function To_Association (Self : access Element'Class) return Program.Elements.Associations.Association_Access is begin return Program.Elements.Associations.Association_Access (Self); end To_Association; function To_Discriminant_Association (Self : access Element'Class) return Program.Elements.Discriminant_Associations .Discriminant_Association_Access is begin return Program.Elements.Discriminant_Associations .Discriminant_Association_Access (Self); end To_Discriminant_Association; function To_Record_Component_Association (Self : access Element'Class) return Program.Elements.Record_Component_Associations .Record_Component_Association_Access is begin return Program.Elements.Record_Component_Associations .Record_Component_Association_Access (Self); end To_Record_Component_Association; function To_Array_Component_Association (Self : access Element'Class) return Program.Elements.Array_Component_Associations .Array_Component_Association_Access is begin return Program.Elements.Array_Component_Associations .Array_Component_Association_Access (Self); end To_Array_Component_Association; function To_Parameter_Association (Self : access Element'Class) return Program.Elements.Parameter_Associations .Parameter_Association_Access is begin return Program.Elements.Parameter_Associations .Parameter_Association_Access (Self); end To_Parameter_Association; function To_Formal_Package_Association (Self : access Element'Class) return Program.Elements.Formal_Package_Associations .Formal_Package_Association_Access is begin return Program.Elements.Formal_Package_Associations .Formal_Package_Association_Access (Self); end To_Formal_Package_Association; function To_Statement (Self : access Element'Class) return Program.Elements.Statements.Statement_Access is begin return Program.Elements.Statements.Statement_Access (Self); end To_Statement; function To_Null_Statement (Self : access Element'Class) return Program.Elements.Null_Statements.Null_Statement_Access is begin return Program.Elements.Null_Statements.Null_Statement_Access (Self); end To_Null_Statement; function To_Assignment_Statement (Self : access Element'Class) return Program.Elements.Assignment_Statements .Assignment_Statement_Access is begin return Program.Elements.Assignment_Statements.Assignment_Statement_Access (Self); end To_Assignment_Statement; function To_If_Statement (Self : access Element'Class) return Program.Elements.If_Statements.If_Statement_Access is begin return Program.Elements.If_Statements.If_Statement_Access (Self); end To_If_Statement; function To_Case_Statement (Self : access Element'Class) return Program.Elements.Case_Statements.Case_Statement_Access is begin return Program.Elements.Case_Statements.Case_Statement_Access (Self); end To_Case_Statement; function To_Loop_Statement (Self : access Element'Class) return Program.Elements.Loop_Statements.Loop_Statement_Access is begin return Program.Elements.Loop_Statements.Loop_Statement_Access (Self); end To_Loop_Statement; function To_While_Loop_Statement (Self : access Element'Class) return Program.Elements.While_Loop_Statements .While_Loop_Statement_Access is begin return Program.Elements.While_Loop_Statements.While_Loop_Statement_Access (Self); end To_While_Loop_Statement; function To_For_Loop_Statement (Self : access Element'Class) return Program.Elements.For_Loop_Statements.For_Loop_Statement_Access is begin return Program.Elements.For_Loop_Statements.For_Loop_Statement_Access (Self); end To_For_Loop_Statement; function To_Block_Statement (Self : access Element'Class) return Program.Elements.Block_Statements.Block_Statement_Access is begin return Program.Elements.Block_Statements.Block_Statement_Access (Self); end To_Block_Statement; function To_Exit_Statement (Self : access Element'Class) return Program.Elements.Exit_Statements.Exit_Statement_Access is begin return Program.Elements.Exit_Statements.Exit_Statement_Access (Self); end To_Exit_Statement; function To_Goto_Statement (Self : access Element'Class) return Program.Elements.Goto_Statements.Goto_Statement_Access is begin return Program.Elements.Goto_Statements.Goto_Statement_Access (Self); end To_Goto_Statement; function To_Call_Statement (Self : access Element'Class) return Program.Elements.Call_Statements.Call_Statement_Access is begin return Program.Elements.Call_Statements.Call_Statement_Access (Self); end To_Call_Statement; function To_Simple_Return_Statement (Self : access Element'Class) return Program.Elements.Simple_Return_Statements .Simple_Return_Statement_Access is begin return Program.Elements.Simple_Return_Statements .Simple_Return_Statement_Access (Self); end To_Simple_Return_Statement; function To_Extended_Return_Statement (Self : access Element'Class) return Program.Elements.Extended_Return_Statements .Extended_Return_Statement_Access is begin return Program.Elements.Extended_Return_Statements .Extended_Return_Statement_Access (Self); end To_Extended_Return_Statement; function To_Accept_Statement (Self : access Element'Class) return Program.Elements.Accept_Statements.Accept_Statement_Access is begin return Program.Elements.Accept_Statements.Accept_Statement_Access (Self); end To_Accept_Statement; function To_Requeue_Statement (Self : access Element'Class) return Program.Elements.Requeue_Statements.Requeue_Statement_Access is begin return Program.Elements.Requeue_Statements.Requeue_Statement_Access (Self); end To_Requeue_Statement; function To_Delay_Statement (Self : access Element'Class) return Program.Elements.Delay_Statements.Delay_Statement_Access is begin return Program.Elements.Delay_Statements.Delay_Statement_Access (Self); end To_Delay_Statement; function To_Terminate_Alternative_Statement (Self : access Element'Class) return Program.Elements.Terminate_Alternative_Statements .Terminate_Alternative_Statement_Access is begin return Program.Elements.Terminate_Alternative_Statements .Terminate_Alternative_Statement_Access (Self); end To_Terminate_Alternative_Statement; function To_Select_Statement (Self : access Element'Class) return Program.Elements.Select_Statements.Select_Statement_Access is begin return Program.Elements.Select_Statements.Select_Statement_Access (Self); end To_Select_Statement; function To_Abort_Statement (Self : access Element'Class) return Program.Elements.Abort_Statements.Abort_Statement_Access is begin return Program.Elements.Abort_Statements.Abort_Statement_Access (Self); end To_Abort_Statement; function To_Raise_Statement (Self : access Element'Class) return Program.Elements.Raise_Statements.Raise_Statement_Access is begin return Program.Elements.Raise_Statements.Raise_Statement_Access (Self); end To_Raise_Statement; function To_Code_Statement (Self : access Element'Class) return Program.Elements.Code_Statements.Code_Statement_Access is begin return Program.Elements.Code_Statements.Code_Statement_Access (Self); end To_Code_Statement; function To_Path (Self : access Element'Class) return Program.Elements.Paths.Path_Access is begin return Program.Elements.Paths.Path_Access (Self); end To_Path; function To_Elsif_Path (Self : access Element'Class) return Program.Elements.Elsif_Paths.Elsif_Path_Access is begin return Program.Elements.Elsif_Paths.Elsif_Path_Access (Self); end To_Elsif_Path; function To_Case_Path (Self : access Element'Class) return Program.Elements.Case_Paths.Case_Path_Access is begin return Program.Elements.Case_Paths.Case_Path_Access (Self); end To_Case_Path; function To_Select_Path (Self : access Element'Class) return Program.Elements.Select_Paths.Select_Path_Access is begin return Program.Elements.Select_Paths.Select_Path_Access (Self); end To_Select_Path; function To_Case_Expression_Path (Self : access Element'Class) return Program.Elements.Case_Expression_Paths .Case_Expression_Path_Access is begin return Program.Elements.Case_Expression_Paths.Case_Expression_Path_Access (Self); end To_Case_Expression_Path; function To_Elsif_Expression_Path (Self : access Element'Class) return Program.Elements.Elsif_Expression_Paths .Elsif_Expression_Path_Access is begin return Program.Elements.Elsif_Expression_Paths .Elsif_Expression_Path_Access (Self); end To_Elsif_Expression_Path; function To_Clause (Self : access Element'Class) return Program.Elements.Clauses.Clause_Access is begin return Program.Elements.Clauses.Clause_Access (Self); end To_Clause; function To_Use_Clause (Self : access Element'Class) return Program.Elements.Use_Clauses.Use_Clause_Access is begin return Program.Elements.Use_Clauses.Use_Clause_Access (Self); end To_Use_Clause; function To_With_Clause (Self : access Element'Class) return Program.Elements.With_Clauses.With_Clause_Access is begin return Program.Elements.With_Clauses.With_Clause_Access (Self); end To_With_Clause; function To_Representation_Clause (Self : access Element'Class) return Program.Elements.Representation_Clauses .Representation_Clause_Access is begin return Program.Elements.Representation_Clauses .Representation_Clause_Access (Self); end To_Representation_Clause; function To_Component_Clause (Self : access Element'Class) return Program.Elements.Component_Clauses.Component_Clause_Access is begin return Program.Elements.Component_Clauses.Component_Clause_Access (Self); end To_Component_Clause; function To_Derived_Type (Self : access Element'Class) return Program.Elements.Derived_Types.Derived_Type_Access is begin return Program.Elements.Derived_Types.Derived_Type_Access (Self); end To_Derived_Type; function To_Derived_Record_Extension (Self : access Element'Class) return Program.Elements.Derived_Record_Extensions .Derived_Record_Extension_Access is begin return Program.Elements.Derived_Record_Extensions .Derived_Record_Extension_Access (Self); end To_Derived_Record_Extension; function To_Enumeration_Type (Self : access Element'Class) return Program.Elements.Enumeration_Types.Enumeration_Type_Access is begin return Program.Elements.Enumeration_Types.Enumeration_Type_Access (Self); end To_Enumeration_Type; function To_Signed_Integer_Type (Self : access Element'Class) return Program.Elements.Signed_Integer_Types .Signed_Integer_Type_Access is begin return Program.Elements.Signed_Integer_Types.Signed_Integer_Type_Access (Self); end To_Signed_Integer_Type; function To_Modular_Type (Self : access Element'Class) return Program.Elements.Modular_Types.Modular_Type_Access is begin return Program.Elements.Modular_Types.Modular_Type_Access (Self); end To_Modular_Type; function To_Root_Type (Self : access Element'Class) return Program.Elements.Root_Types.Root_Type_Access is begin return Program.Elements.Root_Types.Root_Type_Access (Self); end To_Root_Type; function To_Floating_Point_Type (Self : access Element'Class) return Program.Elements.Floating_Point_Types .Floating_Point_Type_Access is begin return Program.Elements.Floating_Point_Types.Floating_Point_Type_Access (Self); end To_Floating_Point_Type; function To_Ordinary_Fixed_Point_Type (Self : access Element'Class) return Program.Elements.Ordinary_Fixed_Point_Types .Ordinary_Fixed_Point_Type_Access is begin return Program.Elements.Ordinary_Fixed_Point_Types .Ordinary_Fixed_Point_Type_Access (Self); end To_Ordinary_Fixed_Point_Type; function To_Decimal_Fixed_Point_Type (Self : access Element'Class) return Program.Elements.Decimal_Fixed_Point_Types .Decimal_Fixed_Point_Type_Access is begin return Program.Elements.Decimal_Fixed_Point_Types .Decimal_Fixed_Point_Type_Access (Self); end To_Decimal_Fixed_Point_Type; function To_Unconstrained_Array_Type (Self : access Element'Class) return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access is begin return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access (Self); end To_Unconstrained_Array_Type; function To_Constrained_Array_Type (Self : access Element'Class) return Program.Elements.Constrained_Array_Types .Constrained_Array_Type_Access is begin return Program.Elements.Constrained_Array_Types .Constrained_Array_Type_Access (Self); end To_Constrained_Array_Type; function To_Record_Type (Self : access Element'Class) return Program.Elements.Record_Types.Record_Type_Access is begin return Program.Elements.Record_Types.Record_Type_Access (Self); end To_Record_Type; function To_Interface_Type (Self : access Element'Class) return Program.Elements.Interface_Types.Interface_Type_Access is begin return Program.Elements.Interface_Types.Interface_Type_Access (Self); end To_Interface_Type; function To_Object_Access_Type (Self : access Element'Class) return Program.Elements.Object_Access_Types.Object_Access_Type_Access is begin return Program.Elements.Object_Access_Types.Object_Access_Type_Access (Self); end To_Object_Access_Type; function To_Procedure_Access_Type (Self : access Element'Class) return Program.Elements.Procedure_Access_Types .Procedure_Access_Type_Access is begin return Program.Elements.Procedure_Access_Types .Procedure_Access_Type_Access (Self); end To_Procedure_Access_Type; function To_Function_Access_Type (Self : access Element'Class) return Program.Elements.Function_Access_Types .Function_Access_Type_Access is begin return Program.Elements.Function_Access_Types.Function_Access_Type_Access (Self); end To_Function_Access_Type; function To_Formal_Private_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Access is begin return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Access (Self); end To_Formal_Private_Type_Definition; function To_Formal_Derived_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Derived_Type_Definitions .Formal_Derived_Type_Definition_Access is begin return Program.Elements.Formal_Derived_Type_Definitions .Formal_Derived_Type_Definition_Access (Self); end To_Formal_Derived_Type_Definition; function To_Formal_Discrete_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Discrete_Type_Definitions .Formal_Discrete_Type_Definition_Access is begin return Program.Elements.Formal_Discrete_Type_Definitions .Formal_Discrete_Type_Definition_Access (Self); end To_Formal_Discrete_Type_Definition; function To_Formal_Signed_Integer_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Access is begin return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Access (Self); end To_Formal_Signed_Integer_Type_Definition; function To_Formal_Modular_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Modular_Type_Definitions .Formal_Modular_Type_Definition_Access is begin return Program.Elements.Formal_Modular_Type_Definitions .Formal_Modular_Type_Definition_Access (Self); end To_Formal_Modular_Type_Definition; function To_Formal_Floating_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Floating_Point_Definitions .Formal_Floating_Point_Definition_Access is begin return Program.Elements.Formal_Floating_Point_Definitions .Formal_Floating_Point_Definition_Access (Self); end To_Formal_Floating_Point_Definition; function To_Formal_Ordinary_Fixed_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions .Formal_Ordinary_Fixed_Point_Definition_Access is begin return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions .Formal_Ordinary_Fixed_Point_Definition_Access (Self); end To_Formal_Ordinary_Fixed_Point_Definition; function To_Formal_Decimal_Fixed_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Access is begin return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Access (Self); end To_Formal_Decimal_Fixed_Point_Definition; function To_Formal_Unconstrained_Array_Type (Self : access Element'Class) return Program.Elements.Formal_Unconstrained_Array_Types .Formal_Unconstrained_Array_Type_Access is begin return Program.Elements.Formal_Unconstrained_Array_Types .Formal_Unconstrained_Array_Type_Access (Self); end To_Formal_Unconstrained_Array_Type; function To_Formal_Constrained_Array_Type (Self : access Element'Class) return Program.Elements.Formal_Constrained_Array_Types .Formal_Constrained_Array_Type_Access is begin return Program.Elements.Formal_Constrained_Array_Types .Formal_Constrained_Array_Type_Access (Self); end To_Formal_Constrained_Array_Type; function To_Formal_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Access_Types.Formal_Access_Type_Access is begin return Program.Elements.Formal_Access_Types.Formal_Access_Type_Access (Self); end To_Formal_Access_Type; function To_Formal_Object_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Object_Access_Types .Formal_Object_Access_Type_Access is begin return Program.Elements.Formal_Object_Access_Types .Formal_Object_Access_Type_Access (Self); end To_Formal_Object_Access_Type; function To_Formal_Procedure_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Access is begin return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Access (Self); end To_Formal_Procedure_Access_Type; function To_Formal_Function_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Function_Access_Types .Formal_Function_Access_Type_Access is begin return Program.Elements.Formal_Function_Access_Types .Formal_Function_Access_Type_Access (Self); end To_Formal_Function_Access_Type; function To_Formal_Interface_Type (Self : access Element'Class) return Program.Elements.Formal_Interface_Types .Formal_Interface_Type_Access is begin return Program.Elements.Formal_Interface_Types .Formal_Interface_Type_Access (Self); end To_Formal_Interface_Type; function To_Access_Type (Self : access Element'Class) return Program.Elements.Access_Types.Access_Type_Access is begin return Program.Elements.Access_Types.Access_Type_Access (Self); end To_Access_Type; function To_Range_Attribute_Reference (Self : access Element'Class) return Program.Elements.Range_Attribute_References .Range_Attribute_Reference_Access is begin return Program.Elements.Range_Attribute_References .Range_Attribute_Reference_Access (Self); end To_Range_Attribute_Reference; function To_Simple_Expression_Range (Self : access Element'Class) return Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access is begin return Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access (Self); end To_Simple_Expression_Range; function To_Digits_Constraint (Self : access Element'Class) return Program.Elements.Digits_Constraints.Digits_Constraint_Access is begin return Program.Elements.Digits_Constraints.Digits_Constraint_Access (Self); end To_Digits_Constraint; function To_Delta_Constraint (Self : access Element'Class) return Program.Elements.Delta_Constraints.Delta_Constraint_Access is begin return Program.Elements.Delta_Constraints.Delta_Constraint_Access (Self); end To_Delta_Constraint; function To_Index_Constraint (Self : access Element'Class) return Program.Elements.Index_Constraints.Index_Constraint_Access is begin return Program.Elements.Index_Constraints.Index_Constraint_Access (Self); end To_Index_Constraint; function To_Discriminant_Constraint (Self : access Element'Class) return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Access is begin return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Access (Self); end To_Discriminant_Constraint; function To_Attribute_Definition_Clause (Self : access Element'Class) return Program.Elements.Attribute_Definition_Clauses .Attribute_Definition_Clause_Access is begin return Program.Elements.Attribute_Definition_Clauses .Attribute_Definition_Clause_Access (Self); end To_Attribute_Definition_Clause; function To_Enumeration_Representation_Clause (Self : access Element'Class) return Program.Elements.Enumeration_Representation_Clauses .Enumeration_Representation_Clause_Access is begin return Program.Elements.Enumeration_Representation_Clauses .Enumeration_Representation_Clause_Access (Self); end To_Enumeration_Representation_Clause; function To_Record_Representation_Clause (Self : access Element'Class) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Access is begin return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Access (Self); end To_Record_Representation_Clause; function To_At_Clause (Self : access Element'Class) return Program.Elements.At_Clauses.At_Clause_Access is begin return Program.Elements.At_Clauses.At_Clause_Access (Self); end To_At_Clause; function To_Exception_Handler (Self : access Element'Class) return Program.Elements.Exception_Handlers.Exception_Handler_Access is begin return Program.Elements.Exception_Handlers.Exception_Handler_Access (Self); end To_Exception_Handler; end Program.Elements;
17236
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Element_Iterators; with Program.Elements.Pragmas; with Program.Elements.Defining_Names; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Character_Literals; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Defining_Expanded_Names; with Program.Elements.Declarations; with Program.Elements.Type_Declarations; with Program.Elements.Task_Type_Declarations; with Program.Elements.Protected_Type_Declarations; with Program.Elements.Subtype_Declarations; with Program.Elements.Object_Declarations; with Program.Elements.Single_Task_Declarations; with Program.Elements.Single_Protected_Declarations; with Program.Elements.Number_Declarations; with Program.Elements.Enumeration_Literal_Specifications; with Program.Elements.Discriminant_Specifications; with Program.Elements.Component_Declarations; with Program.Elements.Loop_Parameter_Specifications; with Program.Elements.Generalized_Iterator_Specifications; with Program.Elements.Element_Iterator_Specifications; with Program.Elements.Procedure_Declarations; with Program.Elements.Function_Declarations; with Program.Elements.Parameter_Specifications; with Program.Elements.Procedure_Body_Declarations; with Program.Elements.Function_Body_Declarations; with Program.Elements.Return_Object_Specifications; with Program.Elements.Package_Declarations; with Program.Elements.Package_Body_Declarations; with Program.Elements.Object_Renaming_Declarations; with Program.Elements.Exception_Renaming_Declarations; with Program.Elements.Procedure_Renaming_Declarations; with Program.Elements.Function_Renaming_Declarations; with Program.Elements.Package_Renaming_Declarations; with Program.Elements.Generic_Package_Renaming_Declarations; with Program.Elements.Generic_Procedure_Renaming_Declarations; with Program.Elements.Generic_Function_Renaming_Declarations; with Program.Elements.Task_Body_Declarations; with Program.Elements.Protected_Body_Declarations; with Program.Elements.Entry_Declarations; with Program.Elements.Entry_Body_Declarations; with Program.Elements.Entry_Index_Specifications; with Program.Elements.Procedure_Body_Stubs; with Program.Elements.Function_Body_Stubs; with Program.Elements.Package_Body_Stubs; with Program.Elements.Task_Body_Stubs; with Program.Elements.Protected_Body_Stubs; with Program.Elements.Exception_Declarations; with Program.Elements.Choice_Parameter_Specifications; with Program.Elements.Generic_Package_Declarations; with Program.Elements.Generic_Procedure_Declarations; with Program.Elements.Generic_Function_Declarations; with Program.Elements.Package_Instantiations; with Program.Elements.Procedure_Instantiations; with Program.Elements.Function_Instantiations; with Program.Elements.Formal_Object_Declarations; with Program.Elements.Formal_Type_Declarations; with Program.Elements.Formal_Procedure_Declarations; with Program.Elements.Formal_Function_Declarations; with Program.Elements.Formal_Package_Declarations; with Program.Elements.Definitions; with Program.Elements.Type_Definitions; with Program.Elements.Subtype_Indications; with Program.Elements.Constraints; with Program.Elements.Component_Definitions; with Program.Elements.Discrete_Ranges; with Program.Elements.Discrete_Subtype_Indications; with Program.Elements.Discrete_Range_Attribute_References; with Program.Elements.Discrete_Simple_Expression_Ranges; with Program.Elements.Unknown_Discriminant_Parts; with Program.Elements.Known_Discriminant_Parts; with Program.Elements.Record_Definitions; with Program.Elements.Null_Components; with Program.Elements.Variant_Parts; with Program.Elements.Variants; with Program.Elements.Others_Choices; with Program.Elements.Anonymous_Access_Definitions; with Program.Elements.Anonymous_Access_To_Objects; with Program.Elements.Anonymous_Access_To_Procedures; with Program.Elements.Anonymous_Access_To_Functions; with Program.Elements.Private_Type_Definitions; with Program.Elements.Private_Extension_Definitions; with Program.Elements.Incomplete_Type_Definitions; with Program.Elements.Task_Definitions; with Program.Elements.Protected_Definitions; with Program.Elements.Formal_Type_Definitions; with Program.Elements.Aspect_Specifications; with Program.Elements.Real_Range_Specifications; with Program.Elements.Expressions; with Program.Elements.Numeric_Literals; with Program.Elements.String_Literals; with Program.Elements.Identifiers; with Program.Elements.Operator_Symbols; with Program.Elements.Character_Literals; with Program.Elements.Explicit_Dereferences; with Program.Elements.Infix_Operators; with Program.Elements.Function_Calls; with Program.Elements.Indexed_Components; with Program.Elements.Slices; with Program.Elements.Selected_Components; with Program.Elements.Attribute_References; with Program.Elements.Record_Aggregates; with Program.Elements.Extension_Aggregates; with Program.Elements.Array_Aggregates; with Program.Elements.Short_Circuit_Operations; with Program.Elements.Membership_Tests; with Program.Elements.Null_Literals; with Program.Elements.Parenthesized_Expressions; with Program.Elements.Raise_Expressions; with Program.Elements.Type_Conversions; with Program.Elements.Qualified_Expressions; with Program.Elements.Allocators; with Program.Elements.Case_Expressions; with Program.Elements.If_Expressions; with Program.Elements.Quantified_Expressions; with Program.Elements.Associations; with Program.Elements.Discriminant_Associations; with Program.Elements.Record_Component_Associations; with Program.Elements.Array_Component_Associations; with Program.Elements.Parameter_Associations; with Program.Elements.Formal_Package_Associations; with Program.Elements.Statements; with Program.Elements.Null_Statements; with Program.Elements.Assignment_Statements; with Program.Elements.If_Statements; with Program.Elements.Case_Statements; with Program.Elements.Loop_Statements; with Program.Elements.While_Loop_Statements; with Program.Elements.For_Loop_Statements; with Program.Elements.Block_Statements; with Program.Elements.Exit_Statements; with Program.Elements.Goto_Statements; with Program.Elements.Call_Statements; with Program.Elements.Simple_Return_Statements; with Program.Elements.Extended_Return_Statements; with Program.Elements.Accept_Statements; with Program.Elements.Requeue_Statements; with Program.Elements.Delay_Statements; with Program.Elements.Terminate_Alternative_Statements; with Program.Elements.Select_Statements; with Program.Elements.Abort_Statements; with Program.Elements.Raise_Statements; with Program.Elements.Code_Statements; with Program.Elements.Paths; with Program.Elements.Elsif_Paths; with Program.Elements.Case_Paths; with Program.Elements.Select_Paths; with Program.Elements.Case_Expression_Paths; with Program.Elements.Elsif_Expression_Paths; with Program.Elements.Clauses; with Program.Elements.Use_Clauses; with Program.Elements.With_Clauses; with Program.Elements.Representation_Clauses; with Program.Elements.Component_Clauses; with Program.Elements.Derived_Types; with Program.Elements.Derived_Record_Extensions; with Program.Elements.Enumeration_Types; with Program.Elements.Signed_Integer_Types; with Program.Elements.Modular_Types; with Program.Elements.Root_Types; with Program.Elements.Floating_Point_Types; with Program.Elements.Ordinary_Fixed_Point_Types; with Program.Elements.Decimal_Fixed_Point_Types; with Program.Elements.Unconstrained_Array_Types; with Program.Elements.Constrained_Array_Types; with Program.Elements.Record_Types; with Program.Elements.Interface_Types; with Program.Elements.Object_Access_Types; with Program.Elements.Procedure_Access_Types; with Program.Elements.Function_Access_Types; with Program.Elements.Formal_Private_Type_Definitions; with Program.Elements.Formal_Derived_Type_Definitions; with Program.Elements.Formal_Discrete_Type_Definitions; with Program.Elements.Formal_Signed_Integer_Type_Definitions; with Program.Elements.Formal_Modular_Type_Definitions; with Program.Elements.Formal_Floating_Point_Definitions; with Program.Elements.Formal_Ordinary_Fixed_Point_Definitions; with Program.Elements.Formal_Decimal_Fixed_Point_Definitions; with Program.Elements.Formal_Unconstrained_Array_Types; with Program.Elements.Formal_Constrained_Array_Types; with Program.Elements.Formal_Access_Types; with Program.Elements.Formal_Object_Access_Types; with Program.Elements.Formal_Procedure_Access_Types; with Program.Elements.Formal_Function_Access_Types; with Program.Elements.Formal_Interface_Types; with Program.Elements.Access_Types; with Program.Elements.Range_Attribute_References; with Program.Elements.Simple_Expression_Ranges; with Program.Elements.Digits_Constraints; with Program.Elements.Delta_Constraints; with Program.Elements.Index_Constraints; with Program.Elements.Discriminant_Constraints; with Program.Elements.Attribute_Definition_Clauses; with Program.Elements.Enumeration_Representation_Clauses; with Program.Elements.Record_Representation_Clauses; with Program.Elements.At_Clauses; with Program.Elements.Exception_Handlers; package body Program.Elements is function Each_Enclosing_Element (Self : not null access Element'Class) return Program.Element_Iterators.Enclosing_Element_Iterator is begin return Program.Element_Iterators.To_Enclosing_Element_Iterator (Element_Access (Self)); end Each_Enclosing_Element; function Each_Child (Self : not null access Element'Class; Filter : Program.Element_Iterators.Element_Checker) return Program.Element_Iterators.Child_Iterator is begin return Program.Element_Iterators.To_Child_Iterator (Element_Access (Self), Filter); end Each_Child; function Each_Child (Self : not null access Element'Class) return Program.Element_Iterators.Child_Iterator is begin return Program.Element_Iterators.To_Child_Iterator (Element_Access (Self)); end Each_Child; function To_Pragma (Self : access Element'Class) return Program.Elements.Pragmas.Pragma_Access is begin return Program.Elements.Pragmas.Pragma_Access (Self); end To_Pragma; function To_Defining_Name (Self : access Element'Class) return Program.Elements.Defining_Names.Defining_Name_Access is begin return Program.Elements.Defining_Names.Defining_Name_Access (Self); end To_Defining_Name; function To_Defining_Identifier (Self : access Element'Class) return Program.Elements.Defining_Identifiers .Defining_Identifier_Access is begin return Program.Elements.Defining_Identifiers.Defining_Identifier_Access (Self); end To_Defining_Identifier; function To_Defining_Character_Literal (Self : access Element'Class) return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access is begin return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access (Self); end To_Defining_Character_Literal; function To_Defining_Operator_Symbol (Self : access Element'Class) return Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access is begin return Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access (Self); end To_Defining_Operator_Symbol; function To_Defining_Expanded_Name (Self : access Element'Class) return Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access is begin return Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access (Self); end To_Defining_Expanded_Name; function To_Declaration (Self : access Element'Class) return Program.Elements.Declarations.Declaration_Access is begin return Program.Elements.Declarations.Declaration_Access (Self); end To_Declaration; function To_Type_Declaration (Self : access Element'Class) return Program.Elements.Type_Declarations.Type_Declaration_Access is begin return Program.Elements.Type_Declarations.Type_Declaration_Access (Self); end To_Type_Declaration; function To_Task_Type_Declaration (Self : access Element'Class) return Program.Elements.Task_Type_Declarations .Task_Type_Declaration_Access is begin return Program.Elements.Task_Type_Declarations .Task_Type_Declaration_Access (Self); end To_Task_Type_Declaration; function To_Protected_Type_Declaration (Self : access Element'Class) return Program.Elements.Protected_Type_Declarations .Protected_Type_Declaration_Access is begin return Program.Elements.Protected_Type_Declarations .Protected_Type_Declaration_Access (Self); end To_Protected_Type_Declaration; function To_Subtype_Declaration (Self : access Element'Class) return Program.Elements.Subtype_Declarations .Subtype_Declaration_Access is begin return Program.Elements.Subtype_Declarations.Subtype_Declaration_Access (Self); end To_Subtype_Declaration; function To_Object_Declaration (Self : access Element'Class) return Program.Elements.Object_Declarations.Object_Declaration_Access is begin return Program.Elements.Object_Declarations.Object_Declaration_Access (Self); end To_Object_Declaration; function To_Single_Task_Declaration (Self : access Element'Class) return Program.Elements.Single_Task_Declarations .Single_Task_Declaration_Access is begin return Program.Elements.Single_Task_Declarations .Single_Task_Declaration_Access (Self); end To_Single_Task_Declaration; function To_Single_Protected_Declaration (Self : access Element'Class) return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Access is begin return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Access (Self); end To_Single_Protected_Declaration; function To_Number_Declaration (Self : access Element'Class) return Program.Elements.Number_Declarations.Number_Declaration_Access is begin return Program.Elements.Number_Declarations.Number_Declaration_Access (Self); end To_Number_Declaration; function To_Enumeration_Literal_Specification (Self : access Element'Class) return Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access is begin return Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access (Self); end To_Enumeration_Literal_Specification; function To_Discriminant_Specification (Self : access Element'Class) return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Access is begin return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Access (Self); end To_Discriminant_Specification; function To_Component_Declaration (Self : access Element'Class) return Program.Elements.Component_Declarations .Component_Declaration_Access is begin return Program.Elements.Component_Declarations .Component_Declaration_Access (Self); end To_Component_Declaration; function To_Loop_Parameter_Specification (Self : access Element'Class) return Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access is begin return Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access (Self); end To_Loop_Parameter_Specification; function To_Generalized_Iterator_Specification (Self : access Element'Class) return Program.Elements.Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access is begin return Program.Elements.Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access (Self); end To_Generalized_Iterator_Specification; function To_Element_Iterator_Specification (Self : access Element'Class) return Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access is begin return Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access (Self); end To_Element_Iterator_Specification; function To_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Declarations .Procedure_Declaration_Access is begin return Program.Elements.Procedure_Declarations .Procedure_Declaration_Access (Self); end To_Procedure_Declaration; function To_Function_Declaration (Self : access Element'Class) return Program.Elements.Function_Declarations .Function_Declaration_Access is begin return Program.Elements.Function_Declarations.Function_Declaration_Access (Self); end To_Function_Declaration; function To_Parameter_Specification (Self : access Element'Class) return Program.Elements.Parameter_Specifications .Parameter_Specification_Access is begin return Program.Elements.Parameter_Specifications .Parameter_Specification_Access (Self); end To_Parameter_Specification; function To_Procedure_Body_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access is begin return Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access (Self); end To_Procedure_Body_Declaration; function To_Function_Body_Declaration (Self : access Element'Class) return Program.Elements.Function_Body_Declarations .Function_Body_Declaration_Access is begin return Program.Elements.Function_Body_Declarations .Function_Body_Declaration_Access (Self); end To_Function_Body_Declaration; function To_Return_Object_Specification (Self : access Element'Class) return Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access is begin return Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access (Self); end To_Return_Object_Specification; function To_Package_Declaration (Self : access Element'Class) return Program.Elements.Package_Declarations .Package_Declaration_Access is begin return Program.Elements.Package_Declarations.Package_Declaration_Access (Self); end To_Package_Declaration; function To_Package_Body_Declaration (Self : access Element'Class) return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Access is begin return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Access (Self); end To_Package_Body_Declaration; function To_Object_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Object_Renaming_Declarations .Object_Renaming_Declaration_Access is begin return Program.Elements.Object_Renaming_Declarations .Object_Renaming_Declaration_Access (Self); end To_Object_Renaming_Declaration; function To_Exception_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Exception_Renaming_Declarations .Exception_Renaming_Declaration_Access is begin return Program.Elements.Exception_Renaming_Declarations .Exception_Renaming_Declaration_Access (Self); end To_Exception_Renaming_Declaration; function To_Procedure_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Renaming_Declarations .Procedure_Renaming_Declaration_Access is begin return Program.Elements.Procedure_Renaming_Declarations .Procedure_Renaming_Declaration_Access (Self); end To_Procedure_Renaming_Declaration; function To_Function_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Function_Renaming_Declarations .Function_Renaming_Declaration_Access is begin return Program.Elements.Function_Renaming_Declarations .Function_Renaming_Declaration_Access (Self); end To_Function_Renaming_Declaration; function To_Package_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Package_Renaming_Declarations .Package_Renaming_Declaration_Access is begin return Program.Elements.Package_Renaming_Declarations .Package_Renaming_Declaration_Access (Self); end To_Package_Renaming_Declaration; function To_Generic_Package_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Package_Renaming_Declarations .Generic_Package_Renaming_Declaration_Access is begin return Program.Elements.Generic_Package_Renaming_Declarations .Generic_Package_Renaming_Declaration_Access (Self); end To_Generic_Package_Renaming_Declaration; function To_Generic_Procedure_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Procedure_Renaming_Declarations .Generic_Procedure_Renaming_Declaration_Access is begin return Program.Elements.Generic_Procedure_Renaming_Declarations .Generic_Procedure_Renaming_Declaration_Access (Self); end To_Generic_Procedure_Renaming_Declaration; function To_Generic_Function_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Function_Renaming_Declarations .Generic_Function_Renaming_Declaration_Access is begin return Program.Elements.Generic_Function_Renaming_Declarations .Generic_Function_Renaming_Declaration_Access (Self); end To_Generic_Function_Renaming_Declaration; function To_Task_Body_Declaration (Self : access Element'Class) return Program.Elements.Task_Body_Declarations .Task_Body_Declaration_Access is begin return Program.Elements.Task_Body_Declarations .Task_Body_Declaration_Access (Self); end To_Task_Body_Declaration; function To_Protected_Body_Declaration (Self : access Element'Class) return Program.Elements.Protected_Body_Declarations .Protected_Body_Declaration_Access is begin return Program.Elements.Protected_Body_Declarations .Protected_Body_Declaration_Access (Self); end To_Protected_Body_Declaration; function To_Entry_Declaration (Self : access Element'Class) return Program.Elements.Entry_Declarations.Entry_Declaration_Access is begin return Program.Elements.Entry_Declarations.Entry_Declaration_Access (Self); end To_Entry_Declaration; function To_Entry_Body_Declaration (Self : access Element'Class) return Program.Elements.Entry_Body_Declarations .Entry_Body_Declaration_Access is begin return Program.Elements.Entry_Body_Declarations .Entry_Body_Declaration_Access (Self); end To_Entry_Body_Declaration; function To_Entry_Index_Specification (Self : access Element'Class) return Program.Elements.Entry_Index_Specifications .Entry_Index_Specification_Access is begin return Program.Elements.Entry_Index_Specifications .Entry_Index_Specification_Access (Self); end To_Entry_Index_Specification; function To_Procedure_Body_Stub (Self : access Element'Class) return Program.Elements.Procedure_Body_Stubs .Procedure_Body_Stub_Access is begin return Program.Elements.Procedure_Body_Stubs.Procedure_Body_Stub_Access (Self); end To_Procedure_Body_Stub; function To_Function_Body_Stub (Self : access Element'Class) return Program.Elements.Function_Body_Stubs.Function_Body_Stub_Access is begin return Program.Elements.Function_Body_Stubs.Function_Body_Stub_Access (Self); end To_Function_Body_Stub; function To_Package_Body_Stub (Self : access Element'Class) return Program.Elements.Package_Body_Stubs.Package_Body_Stub_Access is begin return Program.Elements.Package_Body_Stubs.Package_Body_Stub_Access (Self); end To_Package_Body_Stub; function To_Task_Body_Stub (Self : access Element'Class) return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access is begin return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access (Self); end To_Task_Body_Stub; function To_Protected_Body_Stub (Self : access Element'Class) return Program.Elements.Protected_Body_Stubs .Protected_Body_Stub_Access is begin return Program.Elements.Protected_Body_Stubs.Protected_Body_Stub_Access (Self); end To_Protected_Body_Stub; function To_Exception_Declaration (Self : access Element'Class) return Program.Elements.Exception_Declarations .Exception_Declaration_Access is begin return Program.Elements.Exception_Declarations .Exception_Declaration_Access (Self); end To_Exception_Declaration; function To_Choice_Parameter_Specification (Self : access Element'Class) return Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access is begin return Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access (Self); end To_Choice_Parameter_Specification; function To_Generic_Package_Declaration (Self : access Element'Class) return Program.Elements.Generic_Package_Declarations .Generic_Package_Declaration_Access is begin return Program.Elements.Generic_Package_Declarations .Generic_Package_Declaration_Access (Self); end To_Generic_Package_Declaration; function To_Generic_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Access is begin return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Access (Self); end To_Generic_Procedure_Declaration; function To_Generic_Function_Declaration (Self : access Element'Class) return Program.Elements.Generic_Function_Declarations .Generic_Function_Declaration_Access is begin return Program.Elements.Generic_Function_Declarations .Generic_Function_Declaration_Access (Self); end To_Generic_Function_Declaration; function To_Package_Instantiation (Self : access Element'Class) return Program.Elements.Package_Instantiations .Package_Instantiation_Access is begin return Program.Elements.Package_Instantiations .Package_Instantiation_Access (Self); end To_Package_Instantiation; function To_Procedure_Instantiation (Self : access Element'Class) return Program.Elements.Procedure_Instantiations .Procedure_Instantiation_Access is begin return Program.Elements.Procedure_Instantiations .Procedure_Instantiation_Access (Self); end To_Procedure_Instantiation; function To_Function_Instantiation (Self : access Element'Class) return Program.Elements.Function_Instantiations .Function_Instantiation_Access is begin return Program.Elements.Function_Instantiations .Function_Instantiation_Access (Self); end To_Function_Instantiation; function To_Formal_Object_Declaration (Self : access Element'Class) return Program.Elements.Formal_Object_Declarations .Formal_Object_Declaration_Access is begin return Program.Elements.Formal_Object_Declarations .Formal_Object_Declaration_Access (Self); end To_Formal_Object_Declaration; function To_Formal_Type_Declaration (Self : access Element'Class) return Program.Elements.Formal_Type_Declarations .Formal_Type_Declaration_Access is begin return Program.Elements.Formal_Type_Declarations .Formal_Type_Declaration_Access (Self); end To_Formal_Type_Declaration; function To_Formal_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Formal_Procedure_Declarations .Formal_Procedure_Declaration_Access is begin return Program.Elements.Formal_Procedure_Declarations .Formal_Procedure_Declaration_Access (Self); end To_Formal_Procedure_Declaration; function To_Formal_Function_Declaration (Self : access Element'Class) return Program.Elements.Formal_Function_Declarations .Formal_Function_Declaration_Access is begin return Program.Elements.Formal_Function_Declarations .Formal_Function_Declaration_Access (Self); end To_Formal_Function_Declaration; function To_Formal_Package_Declaration (Self : access Element'Class) return Program.Elements.Formal_Package_Declarations .Formal_Package_Declaration_Access is begin return Program.Elements.Formal_Package_Declarations .Formal_Package_Declaration_Access (Self); end To_Formal_Package_Declaration; function To_Definition (Self : access Element'Class) return Program.Elements.Definitions.Definition_Access is begin return Program.Elements.Definitions.Definition_Access (Self); end To_Definition; function To_Type_Definition (Self : access Element'Class) return Program.Elements.Type_Definitions.Type_Definition_Access is begin return Program.Elements.Type_Definitions.Type_Definition_Access (Self); end To_Type_Definition; function To_Subtype_Indication (Self : access Element'Class) return Program.Elements.Subtype_Indications.Subtype_Indication_Access is begin return Program.Elements.Subtype_Indications.Subtype_Indication_Access (Self); end To_Subtype_Indication; function To_Constraint (Self : access Element'Class) return Program.Elements.Constraints.Constraint_Access is begin return Program.Elements.Constraints.Constraint_Access (Self); end To_Constraint; function To_Component_Definition (Self : access Element'Class) return Program.Elements.Component_Definitions .Component_Definition_Access is begin return Program.Elements.Component_Definitions.Component_Definition_Access (Self); end To_Component_Definition; function To_Discrete_Range (Self : access Element'Class) return Program.Elements.Discrete_Ranges.Discrete_Range_Access is begin return Program.Elements.Discrete_Ranges.Discrete_Range_Access (Self); end To_Discrete_Range; function To_Discrete_Subtype_Indication (Self : access Element'Class) return Program.Elements.Discrete_Subtype_Indications .Discrete_Subtype_Indication_Access is begin return Program.Elements.Discrete_Subtype_Indications .Discrete_Subtype_Indication_Access (Self); end To_Discrete_Subtype_Indication; function To_Discrete_Range_Attribute_Reference (Self : access Element'Class) return Program.Elements.Discrete_Range_Attribute_References .Discrete_Range_Attribute_Reference_Access is begin return Program.Elements.Discrete_Range_Attribute_References .Discrete_Range_Attribute_Reference_Access (Self); end To_Discrete_Range_Attribute_Reference; function To_Discrete_Simple_Expression_Range (Self : access Element'Class) return Program.Elements.Discrete_Simple_Expression_Ranges .Discrete_Simple_Expression_Range_Access is begin return Program.Elements.Discrete_Simple_Expression_Ranges .Discrete_Simple_Expression_Range_Access (Self); end To_Discrete_Simple_Expression_Range; function To_Unknown_Discriminant_Part (Self : access Element'Class) return Program.Elements.Unknown_Discriminant_Parts .Unknown_Discriminant_Part_Access is begin return Program.Elements.Unknown_Discriminant_Parts .Unknown_Discriminant_Part_Access (Self); end To_Unknown_Discriminant_Part; function To_Known_Discriminant_Part (Self : access Element'Class) return Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access is begin return Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access (Self); end To_Known_Discriminant_Part; function To_Record_Definition (Self : access Element'Class) return Program.Elements.Record_Definitions.Record_Definition_Access is begin return Program.Elements.Record_Definitions.Record_Definition_Access (Self); end To_Record_Definition; function To_Null_Component (Self : access Element'Class) return Program.Elements.Null_Components.Null_Component_Access is begin return Program.Elements.Null_Components.Null_Component_Access (Self); end To_Null_Component; function To_Variant_Part (Self : access Element'Class) return Program.Elements.Variant_Parts.Variant_Part_Access is begin return Program.Elements.Variant_Parts.Variant_Part_Access (Self); end To_Variant_Part; function To_Variant (Self : access Element'Class) return Program.Elements.Variants.Variant_Access is begin return Program.Elements.Variants.Variant_Access (Self); end To_Variant; function To_Others_Choice (Self : access Element'Class) return Program.Elements.Others_Choices.Others_Choice_Access is begin return Program.Elements.Others_Choices.Others_Choice_Access (Self); end To_Others_Choice; function To_Anonymous_Access_Definition (Self : access Element'Class) return Program.Elements.Anonymous_Access_Definitions .Anonymous_Access_Definition_Access is begin return Program.Elements.Anonymous_Access_Definitions .Anonymous_Access_Definition_Access (Self); end To_Anonymous_Access_Definition; function To_Anonymous_Access_To_Object (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Objects .Anonymous_Access_To_Object_Access is begin return Program.Elements.Anonymous_Access_To_Objects .Anonymous_Access_To_Object_Access (Self); end To_Anonymous_Access_To_Object; function To_Anonymous_Access_To_Procedure (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Access is begin return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Access (Self); end To_Anonymous_Access_To_Procedure; function To_Anonymous_Access_To_Function (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Access is begin return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Access (Self); end To_Anonymous_Access_To_Function; function To_Private_Type_Definition (Self : access Element'Class) return Program.Elements.Private_Type_Definitions .Private_Type_Definition_Access is begin return Program.Elements.Private_Type_Definitions .Private_Type_Definition_Access (Self); end To_Private_Type_Definition; function To_Private_Extension_Definition (Self : access Element'Class) return Program.Elements.Private_Extension_Definitions .Private_Extension_Definition_Access is begin return Program.Elements.Private_Extension_Definitions .Private_Extension_Definition_Access (Self); end To_Private_Extension_Definition; function To_Incomplete_Type_Definition (Self : access Element'Class) return Program.Elements.Incomplete_Type_Definitions .Incomplete_Type_Definition_Access is begin return Program.Elements.Incomplete_Type_Definitions .Incomplete_Type_Definition_Access (Self); end To_Incomplete_Type_Definition; function To_Task_Definition (Self : access Element'Class) return Program.Elements.Task_Definitions.Task_Definition_Access is begin return Program.Elements.Task_Definitions.Task_Definition_Access (Self); end To_Task_Definition; function To_Protected_Definition (Self : access Element'Class) return Program.Elements.Protected_Definitions .Protected_Definition_Access is begin return Program.Elements.Protected_Definitions.Protected_Definition_Access (Self); end To_Protected_Definition; function To_Formal_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Type_Definitions .Formal_Type_Definition_Access is begin return Program.Elements.Formal_Type_Definitions .Formal_Type_Definition_Access (Self); end To_Formal_Type_Definition; function To_Aspect_Specification (Self : access Element'Class) return Program.Elements.Aspect_Specifications .Aspect_Specification_Access is begin return Program.Elements.Aspect_Specifications.Aspect_Specification_Access (Self); end To_Aspect_Specification; function To_Real_Range_Specification (Self : access Element'Class) return Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access is begin return Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access (Self); end To_Real_Range_Specification; function To_Expression (Self : access Element'Class) return Program.Elements.Expressions.Expression_Access is begin return Program.Elements.Expressions.Expression_Access (Self); end To_Expression; function To_Numeric_Literal (Self : access Element'Class) return Program.Elements.Numeric_Literals.Numeric_Literal_Access is begin return Program.Elements.Numeric_Literals.Numeric_Literal_Access (Self); end To_Numeric_Literal; function To_String_Literal (Self : access Element'Class) return Program.Elements.String_Literals.String_Literal_Access is begin return Program.Elements.String_Literals.String_Literal_Access (Self); end To_String_Literal; function To_Identifier (Self : access Element'Class) return Program.Elements.Identifiers.Identifier_Access is begin return Program.Elements.Identifiers.Identifier_Access (Self); end To_Identifier; function To_Operator_Symbol (Self : access Element'Class) return Program.Elements.Operator_Symbols.Operator_Symbol_Access is begin return Program.Elements.Operator_Symbols.Operator_Symbol_Access (Self); end To_Operator_Symbol; function To_Character_Literal (Self : access Element'Class) return Program.Elements.Character_Literals.Character_Literal_Access is begin return Program.Elements.Character_Literals.Character_Literal_Access (Self); end To_Character_Literal; function To_Explicit_Dereference (Self : access Element'Class) return Program.Elements.Explicit_Dereferences .Explicit_Dereference_Access is begin return Program.Elements.Explicit_Dereferences.Explicit_Dereference_Access (Self); end To_Explicit_Dereference; function To_Infix_Operator (Self : access Element'Class) return Program.Elements.Infix_Operators.Infix_Operator_Access is begin return Program.Elements.Infix_Operators.Infix_Operator_Access (Self); end To_Infix_Operator; function To_Function_Call (Self : access Element'Class) return Program.Elements.Function_Calls.Function_Call_Access is begin return Program.Elements.Function_Calls.Function_Call_Access (Self); end To_Function_Call; function To_Indexed_Component (Self : access Element'Class) return Program.Elements.Indexed_Components.Indexed_Component_Access is begin return Program.Elements.Indexed_Components.Indexed_Component_Access (Self); end To_Indexed_Component; function To_Slice (Self : access Element'Class) return Program.Elements.Slices.Slice_Access is begin return Program.Elements.Slices.Slice_Access (Self); end To_Slice; function To_Selected_Component (Self : access Element'Class) return Program.Elements.Selected_Components.Selected_Component_Access is begin return Program.Elements.Selected_Components.Selected_Component_Access (Self); end To_Selected_Component; function To_Attribute_Reference (Self : access Element'Class) return Program.Elements.Attribute_References .Attribute_Reference_Access is begin return Program.Elements.Attribute_References.Attribute_Reference_Access (Self); end To_Attribute_Reference; function To_Record_Aggregate (Self : access Element'Class) return Program.Elements.Record_Aggregates.Record_Aggregate_Access is begin return Program.Elements.Record_Aggregates.Record_Aggregate_Access (Self); end To_Record_Aggregate; function To_Extension_Aggregate (Self : access Element'Class) return Program.Elements.Extension_Aggregates .Extension_Aggregate_Access is begin return Program.Elements.Extension_Aggregates.Extension_Aggregate_Access (Self); end To_Extension_Aggregate; function To_Array_Aggregate (Self : access Element'Class) return Program.Elements.Array_Aggregates.Array_Aggregate_Access is begin return Program.Elements.Array_Aggregates.Array_Aggregate_Access (Self); end To_Array_Aggregate; function To_Short_Circuit_Operation (Self : access Element'Class) return Program.Elements.Short_Circuit_Operations .Short_Circuit_Operation_Access is begin return Program.Elements.Short_Circuit_Operations .Short_Circuit_Operation_Access (Self); end To_Short_Circuit_Operation; function To_Membership_Test (Self : access Element'Class) return Program.Elements.Membership_Tests.Membership_Test_Access is begin return Program.Elements.Membership_Tests.Membership_Test_Access (Self); end To_Membership_Test; function To_Null_Literal (Self : access Element'Class) return Program.Elements.Null_Literals.Null_Literal_Access is begin return Program.Elements.Null_Literals.Null_Literal_Access (Self); end To_Null_Literal; function To_Parenthesized_Expression (Self : access Element'Class) return Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access is begin return Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access (Self); end To_Parenthesized_Expression; function To_Raise_Expression (Self : access Element'Class) return Program.Elements.Raise_Expressions.Raise_Expression_Access is begin return Program.Elements.Raise_Expressions.Raise_Expression_Access (Self); end To_Raise_Expression; function To_Type_Conversion (Self : access Element'Class) return Program.Elements.Type_Conversions.Type_Conversion_Access is begin return Program.Elements.Type_Conversions.Type_Conversion_Access (Self); end To_Type_Conversion; function To_Qualified_Expression (Self : access Element'Class) return Program.Elements.Qualified_Expressions .Qualified_Expression_Access is begin return Program.Elements.Qualified_Expressions.Qualified_Expression_Access (Self); end To_Qualified_Expression; function To_Allocator (Self : access Element'Class) return Program.Elements.Allocators.Allocator_Access is begin return Program.Elements.Allocators.Allocator_Access (Self); end To_Allocator; function To_Case_Expression (Self : access Element'Class) return Program.Elements.Case_Expressions.Case_Expression_Access is begin return Program.Elements.Case_Expressions.Case_Expression_Access (Self); end To_Case_Expression; function To_If_Expression (Self : access Element'Class) return Program.Elements.If_Expressions.If_Expression_Access is begin return Program.Elements.If_Expressions.If_Expression_Access (Self); end To_If_Expression; function To_Quantified_Expression (Self : access Element'Class) return Program.Elements.Quantified_Expressions .Quantified_Expression_Access is begin return Program.Elements.Quantified_Expressions .Quantified_Expression_Access (Self); end To_Quantified_Expression; function To_Association (Self : access Element'Class) return Program.Elements.Associations.Association_Access is begin return Program.Elements.Associations.Association_Access (Self); end To_Association; function To_Discriminant_Association (Self : access Element'Class) return Program.Elements.Discriminant_Associations .Discriminant_Association_Access is begin return Program.Elements.Discriminant_Associations .Discriminant_Association_Access (Self); end To_Discriminant_Association; function To_Record_Component_Association (Self : access Element'Class) return Program.Elements.Record_Component_Associations .Record_Component_Association_Access is begin return Program.Elements.Record_Component_Associations .Record_Component_Association_Access (Self); end To_Record_Component_Association; function To_Array_Component_Association (Self : access Element'Class) return Program.Elements.Array_Component_Associations .Array_Component_Association_Access is begin return Program.Elements.Array_Component_Associations .Array_Component_Association_Access (Self); end To_Array_Component_Association; function To_Parameter_Association (Self : access Element'Class) return Program.Elements.Parameter_Associations .Parameter_Association_Access is begin return Program.Elements.Parameter_Associations .Parameter_Association_Access (Self); end To_Parameter_Association; function To_Formal_Package_Association (Self : access Element'Class) return Program.Elements.Formal_Package_Associations .Formal_Package_Association_Access is begin return Program.Elements.Formal_Package_Associations .Formal_Package_Association_Access (Self); end To_Formal_Package_Association; function To_Statement (Self : access Element'Class) return Program.Elements.Statements.Statement_Access is begin return Program.Elements.Statements.Statement_Access (Self); end To_Statement; function To_Null_Statement (Self : access Element'Class) return Program.Elements.Null_Statements.Null_Statement_Access is begin return Program.Elements.Null_Statements.Null_Statement_Access (Self); end To_Null_Statement; function To_Assignment_Statement (Self : access Element'Class) return Program.Elements.Assignment_Statements .Assignment_Statement_Access is begin return Program.Elements.Assignment_Statements.Assignment_Statement_Access (Self); end To_Assignment_Statement; function To_If_Statement (Self : access Element'Class) return Program.Elements.If_Statements.If_Statement_Access is begin return Program.Elements.If_Statements.If_Statement_Access (Self); end To_If_Statement; function To_Case_Statement (Self : access Element'Class) return Program.Elements.Case_Statements.Case_Statement_Access is begin return Program.Elements.Case_Statements.Case_Statement_Access (Self); end To_Case_Statement; function To_Loop_Statement (Self : access Element'Class) return Program.Elements.Loop_Statements.Loop_Statement_Access is begin return Program.Elements.Loop_Statements.Loop_Statement_Access (Self); end To_Loop_Statement; function To_While_Loop_Statement (Self : access Element'Class) return Program.Elements.While_Loop_Statements .While_Loop_Statement_Access is begin return Program.Elements.While_Loop_Statements.While_Loop_Statement_Access (Self); end To_While_Loop_Statement; function To_For_Loop_Statement (Self : access Element'Class) return Program.Elements.For_Loop_Statements.For_Loop_Statement_Access is begin return Program.Elements.For_Loop_Statements.For_Loop_Statement_Access (Self); end To_For_Loop_Statement; function To_Block_Statement (Self : access Element'Class) return Program.Elements.Block_Statements.Block_Statement_Access is begin return Program.Elements.Block_Statements.Block_Statement_Access (Self); end To_Block_Statement; function To_Exit_Statement (Self : access Element'Class) return Program.Elements.Exit_Statements.Exit_Statement_Access is begin return Program.Elements.Exit_Statements.Exit_Statement_Access (Self); end To_Exit_Statement; function To_Goto_Statement (Self : access Element'Class) return Program.Elements.Goto_Statements.Goto_Statement_Access is begin return Program.Elements.Goto_Statements.Goto_Statement_Access (Self); end To_Goto_Statement; function To_Call_Statement (Self : access Element'Class) return Program.Elements.Call_Statements.Call_Statement_Access is begin return Program.Elements.Call_Statements.Call_Statement_Access (Self); end To_Call_Statement; function To_Simple_Return_Statement (Self : access Element'Class) return Program.Elements.Simple_Return_Statements .Simple_Return_Statement_Access is begin return Program.Elements.Simple_Return_Statements .Simple_Return_Statement_Access (Self); end To_Simple_Return_Statement; function To_Extended_Return_Statement (Self : access Element'Class) return Program.Elements.Extended_Return_Statements .Extended_Return_Statement_Access is begin return Program.Elements.Extended_Return_Statements .Extended_Return_Statement_Access (Self); end To_Extended_Return_Statement; function To_Accept_Statement (Self : access Element'Class) return Program.Elements.Accept_Statements.Accept_Statement_Access is begin return Program.Elements.Accept_Statements.Accept_Statement_Access (Self); end To_Accept_Statement; function To_Requeue_Statement (Self : access Element'Class) return Program.Elements.Requeue_Statements.Requeue_Statement_Access is begin return Program.Elements.Requeue_Statements.Requeue_Statement_Access (Self); end To_Requeue_Statement; function To_Delay_Statement (Self : access Element'Class) return Program.Elements.Delay_Statements.Delay_Statement_Access is begin return Program.Elements.Delay_Statements.Delay_Statement_Access (Self); end To_Delay_Statement; function To_Terminate_Alternative_Statement (Self : access Element'Class) return Program.Elements.Terminate_Alternative_Statements .Terminate_Alternative_Statement_Access is begin return Program.Elements.Terminate_Alternative_Statements .Terminate_Alternative_Statement_Access (Self); end To_Terminate_Alternative_Statement; function To_Select_Statement (Self : access Element'Class) return Program.Elements.Select_Statements.Select_Statement_Access is begin return Program.Elements.Select_Statements.Select_Statement_Access (Self); end To_Select_Statement; function To_Abort_Statement (Self : access Element'Class) return Program.Elements.Abort_Statements.Abort_Statement_Access is begin return Program.Elements.Abort_Statements.Abort_Statement_Access (Self); end To_Abort_Statement; function To_Raise_Statement (Self : access Element'Class) return Program.Elements.Raise_Statements.Raise_Statement_Access is begin return Program.Elements.Raise_Statements.Raise_Statement_Access (Self); end To_Raise_Statement; function To_Code_Statement (Self : access Element'Class) return Program.Elements.Code_Statements.Code_Statement_Access is begin return Program.Elements.Code_Statements.Code_Statement_Access (Self); end To_Code_Statement; function To_Path (Self : access Element'Class) return Program.Elements.Paths.Path_Access is begin return Program.Elements.Paths.Path_Access (Self); end To_Path; function To_Elsif_Path (Self : access Element'Class) return Program.Elements.Elsif_Paths.Elsif_Path_Access is begin return Program.Elements.Elsif_Paths.Elsif_Path_Access (Self); end To_Elsif_Path; function To_Case_Path (Self : access Element'Class) return Program.Elements.Case_Paths.Case_Path_Access is begin return Program.Elements.Case_Paths.Case_Path_Access (Self); end To_Case_Path; function To_Select_Path (Self : access Element'Class) return Program.Elements.Select_Paths.Select_Path_Access is begin return Program.Elements.Select_Paths.Select_Path_Access (Self); end To_Select_Path; function To_Case_Expression_Path (Self : access Element'Class) return Program.Elements.Case_Expression_Paths .Case_Expression_Path_Access is begin return Program.Elements.Case_Expression_Paths.Case_Expression_Path_Access (Self); end To_Case_Expression_Path; function To_Elsif_Expression_Path (Self : access Element'Class) return Program.Elements.Elsif_Expression_Paths .Elsif_Expression_Path_Access is begin return Program.Elements.Elsif_Expression_Paths .Elsif_Expression_Path_Access (Self); end To_Elsif_Expression_Path; function To_Clause (Self : access Element'Class) return Program.Elements.Clauses.Clause_Access is begin return Program.Elements.Clauses.Clause_Access (Self); end To_Clause; function To_Use_Clause (Self : access Element'Class) return Program.Elements.Use_Clauses.Use_Clause_Access is begin return Program.Elements.Use_Clauses.Use_Clause_Access (Self); end To_Use_Clause; function To_With_Clause (Self : access Element'Class) return Program.Elements.With_Clauses.With_Clause_Access is begin return Program.Elements.With_Clauses.With_Clause_Access (Self); end To_With_Clause; function To_Representation_Clause (Self : access Element'Class) return Program.Elements.Representation_Clauses .Representation_Clause_Access is begin return Program.Elements.Representation_Clauses .Representation_Clause_Access (Self); end To_Representation_Clause; function To_Component_Clause (Self : access Element'Class) return Program.Elements.Component_Clauses.Component_Clause_Access is begin return Program.Elements.Component_Clauses.Component_Clause_Access (Self); end To_Component_Clause; function To_Derived_Type (Self : access Element'Class) return Program.Elements.Derived_Types.Derived_Type_Access is begin return Program.Elements.Derived_Types.Derived_Type_Access (Self); end To_Derived_Type; function To_Derived_Record_Extension (Self : access Element'Class) return Program.Elements.Derived_Record_Extensions .Derived_Record_Extension_Access is begin return Program.Elements.Derived_Record_Extensions .Derived_Record_Extension_Access (Self); end To_Derived_Record_Extension; function To_Enumeration_Type (Self : access Element'Class) return Program.Elements.Enumeration_Types.Enumeration_Type_Access is begin return Program.Elements.Enumeration_Types.Enumeration_Type_Access (Self); end To_Enumeration_Type; function To_Signed_Integer_Type (Self : access Element'Class) return Program.Elements.Signed_Integer_Types .Signed_Integer_Type_Access is begin return Program.Elements.Signed_Integer_Types.Signed_Integer_Type_Access (Self); end To_Signed_Integer_Type; function To_Modular_Type (Self : access Element'Class) return Program.Elements.Modular_Types.Modular_Type_Access is begin return Program.Elements.Modular_Types.Modular_Type_Access (Self); end To_Modular_Type; function To_Root_Type (Self : access Element'Class) return Program.Elements.Root_Types.Root_Type_Access is begin return Program.Elements.Root_Types.Root_Type_Access (Self); end To_Root_Type; function To_Floating_Point_Type (Self : access Element'Class) return Program.Elements.Floating_Point_Types .Floating_Point_Type_Access is begin return Program.Elements.Floating_Point_Types.Floating_Point_Type_Access (Self); end To_Floating_Point_Type; function To_Ordinary_Fixed_Point_Type (Self : access Element'Class) return Program.Elements.Ordinary_Fixed_Point_Types .Ordinary_Fixed_Point_Type_Access is begin return Program.Elements.Ordinary_Fixed_Point_Types .Ordinary_Fixed_Point_Type_Access (Self); end To_Ordinary_Fixed_Point_Type; function To_Decimal_Fixed_Point_Type (Self : access Element'Class) return Program.Elements.Decimal_Fixed_Point_Types .Decimal_Fixed_Point_Type_Access is begin return Program.Elements.Decimal_Fixed_Point_Types .Decimal_Fixed_Point_Type_Access (Self); end To_Decimal_Fixed_Point_Type; function To_Unconstrained_Array_Type (Self : access Element'Class) return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access is begin return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access (Self); end To_Unconstrained_Array_Type; function To_Constrained_Array_Type (Self : access Element'Class) return Program.Elements.Constrained_Array_Types .Constrained_Array_Type_Access is begin return Program.Elements.Constrained_Array_Types .Constrained_Array_Type_Access (Self); end To_Constrained_Array_Type; function To_Record_Type (Self : access Element'Class) return Program.Elements.Record_Types.Record_Type_Access is begin return Program.Elements.Record_Types.Record_Type_Access (Self); end To_Record_Type; function To_Interface_Type (Self : access Element'Class) return Program.Elements.Interface_Types.Interface_Type_Access is begin return Program.Elements.Interface_Types.Interface_Type_Access (Self); end To_Interface_Type; function To_Object_Access_Type (Self : access Element'Class) return Program.Elements.Object_Access_Types.Object_Access_Type_Access is begin return Program.Elements.Object_Access_Types.Object_Access_Type_Access (Self); end To_Object_Access_Type; function To_Procedure_Access_Type (Self : access Element'Class) return Program.Elements.Procedure_Access_Types .Procedure_Access_Type_Access is begin return Program.Elements.Procedure_Access_Types .Procedure_Access_Type_Access (Self); end To_Procedure_Access_Type; function To_Function_Access_Type (Self : access Element'Class) return Program.Elements.Function_Access_Types .Function_Access_Type_Access is begin return Program.Elements.Function_Access_Types.Function_Access_Type_Access (Self); end To_Function_Access_Type; function To_Formal_Private_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Access is begin return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Access (Self); end To_Formal_Private_Type_Definition; function To_Formal_Derived_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Derived_Type_Definitions .Formal_Derived_Type_Definition_Access is begin return Program.Elements.Formal_Derived_Type_Definitions .Formal_Derived_Type_Definition_Access (Self); end To_Formal_Derived_Type_Definition; function To_Formal_Discrete_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Discrete_Type_Definitions .Formal_Discrete_Type_Definition_Access is begin return Program.Elements.Formal_Discrete_Type_Definitions .Formal_Discrete_Type_Definition_Access (Self); end To_Formal_Discrete_Type_Definition; function To_Formal_Signed_Integer_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Access is begin return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Access (Self); end To_Formal_Signed_Integer_Type_Definition; function To_Formal_Modular_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Modular_Type_Definitions .Formal_Modular_Type_Definition_Access is begin return Program.Elements.Formal_Modular_Type_Definitions .Formal_Modular_Type_Definition_Access (Self); end To_Formal_Modular_Type_Definition; function To_Formal_Floating_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Floating_Point_Definitions .Formal_Floating_Point_Definition_Access is begin return Program.Elements.Formal_Floating_Point_Definitions .Formal_Floating_Point_Definition_Access (Self); end To_Formal_Floating_Point_Definition; function To_Formal_Ordinary_Fixed_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions .Formal_Ordinary_Fixed_Point_Definition_Access is begin return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions .Formal_Ordinary_Fixed_Point_Definition_Access (Self); end To_Formal_Ordinary_Fixed_Point_Definition; function To_Formal_Decimal_Fixed_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Access is begin return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Access (Self); end To_Formal_Decimal_Fixed_Point_Definition; function To_Formal_Unconstrained_Array_Type (Self : access Element'Class) return Program.Elements.Formal_Unconstrained_Array_Types .Formal_Unconstrained_Array_Type_Access is begin return Program.Elements.Formal_Unconstrained_Array_Types .Formal_Unconstrained_Array_Type_Access (Self); end To_Formal_Unconstrained_Array_Type; function To_Formal_Constrained_Array_Type (Self : access Element'Class) return Program.Elements.Formal_Constrained_Array_Types .Formal_Constrained_Array_Type_Access is begin return Program.Elements.Formal_Constrained_Array_Types .Formal_Constrained_Array_Type_Access (Self); end To_Formal_Constrained_Array_Type; function To_Formal_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Access_Types.Formal_Access_Type_Access is begin return Program.Elements.Formal_Access_Types.Formal_Access_Type_Access (Self); end To_Formal_Access_Type; function To_Formal_Object_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Object_Access_Types .Formal_Object_Access_Type_Access is begin return Program.Elements.Formal_Object_Access_Types .Formal_Object_Access_Type_Access (Self); end To_Formal_Object_Access_Type; function To_Formal_Procedure_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Access is begin return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Access (Self); end To_Formal_Procedure_Access_Type; function To_Formal_Function_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Function_Access_Types .Formal_Function_Access_Type_Access is begin return Program.Elements.Formal_Function_Access_Types .Formal_Function_Access_Type_Access (Self); end To_Formal_Function_Access_Type; function To_Formal_Interface_Type (Self : access Element'Class) return Program.Elements.Formal_Interface_Types .Formal_Interface_Type_Access is begin return Program.Elements.Formal_Interface_Types .Formal_Interface_Type_Access (Self); end To_Formal_Interface_Type; function To_Access_Type (Self : access Element'Class) return Program.Elements.Access_Types.Access_Type_Access is begin return Program.Elements.Access_Types.Access_Type_Access (Self); end To_Access_Type; function To_Range_Attribute_Reference (Self : access Element'Class) return Program.Elements.Range_Attribute_References .Range_Attribute_Reference_Access is begin return Program.Elements.Range_Attribute_References .Range_Attribute_Reference_Access (Self); end To_Range_Attribute_Reference; function To_Simple_Expression_Range (Self : access Element'Class) return Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access is begin return Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access (Self); end To_Simple_Expression_Range; function To_Digits_Constraint (Self : access Element'Class) return Program.Elements.Digits_Constraints.Digits_Constraint_Access is begin return Program.Elements.Digits_Constraints.Digits_Constraint_Access (Self); end To_Digits_Constraint; function To_Delta_Constraint (Self : access Element'Class) return Program.Elements.Delta_Constraints.Delta_Constraint_Access is begin return Program.Elements.Delta_Constraints.Delta_Constraint_Access (Self); end To_Delta_Constraint; function To_Index_Constraint (Self : access Element'Class) return Program.Elements.Index_Constraints.Index_Constraint_Access is begin return Program.Elements.Index_Constraints.Index_Constraint_Access (Self); end To_Index_Constraint; function To_Discriminant_Constraint (Self : access Element'Class) return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Access is begin return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Access (Self); end To_Discriminant_Constraint; function To_Attribute_Definition_Clause (Self : access Element'Class) return Program.Elements.Attribute_Definition_Clauses .Attribute_Definition_Clause_Access is begin return Program.Elements.Attribute_Definition_Clauses .Attribute_Definition_Clause_Access (Self); end To_Attribute_Definition_Clause; function To_Enumeration_Representation_Clause (Self : access Element'Class) return Program.Elements.Enumeration_Representation_Clauses .Enumeration_Representation_Clause_Access is begin return Program.Elements.Enumeration_Representation_Clauses .Enumeration_Representation_Clause_Access (Self); end To_Enumeration_Representation_Clause; function To_Record_Representation_Clause (Self : access Element'Class) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Access is begin return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Access (Self); end To_Record_Representation_Clause; function To_At_Clause (Self : access Element'Class) return Program.Elements.At_Clauses.At_Clause_Access is begin return Program.Elements.At_Clauses.At_Clause_Access (Self); end To_At_Clause; function To_Exception_Handler (Self : access Element'Class) return Program.Elements.Exception_Handlers.Exception_Handler_Access is begin return Program.Elements.Exception_Handlers.Exception_Handler_Access (Self); end To_Exception_Handler; end Program.Elements;
true
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Element_Iterators; with Program.Elements.Pragmas; with Program.Elements.Defining_Names; with Program.Elements.Defining_Identifiers; with Program.Elements.Defining_Character_Literals; with Program.Elements.Defining_Operator_Symbols; with Program.Elements.Defining_Expanded_Names; with Program.Elements.Declarations; with Program.Elements.Type_Declarations; with Program.Elements.Task_Type_Declarations; with Program.Elements.Protected_Type_Declarations; with Program.Elements.Subtype_Declarations; with Program.Elements.Object_Declarations; with Program.Elements.Single_Task_Declarations; with Program.Elements.Single_Protected_Declarations; with Program.Elements.Number_Declarations; with Program.Elements.Enumeration_Literal_Specifications; with Program.Elements.Discriminant_Specifications; with Program.Elements.Component_Declarations; with Program.Elements.Loop_Parameter_Specifications; with Program.Elements.Generalized_Iterator_Specifications; with Program.Elements.Element_Iterator_Specifications; with Program.Elements.Procedure_Declarations; with Program.Elements.Function_Declarations; with Program.Elements.Parameter_Specifications; with Program.Elements.Procedure_Body_Declarations; with Program.Elements.Function_Body_Declarations; with Program.Elements.Return_Object_Specifications; with Program.Elements.Package_Declarations; with Program.Elements.Package_Body_Declarations; with Program.Elements.Object_Renaming_Declarations; with Program.Elements.Exception_Renaming_Declarations; with Program.Elements.Procedure_Renaming_Declarations; with Program.Elements.Function_Renaming_Declarations; with Program.Elements.Package_Renaming_Declarations; with Program.Elements.Generic_Package_Renaming_Declarations; with Program.Elements.Generic_Procedure_Renaming_Declarations; with Program.Elements.Generic_Function_Renaming_Declarations; with Program.Elements.Task_Body_Declarations; with Program.Elements.Protected_Body_Declarations; with Program.Elements.Entry_Declarations; with Program.Elements.Entry_Body_Declarations; with Program.Elements.Entry_Index_Specifications; with Program.Elements.Procedure_Body_Stubs; with Program.Elements.Function_Body_Stubs; with Program.Elements.Package_Body_Stubs; with Program.Elements.Task_Body_Stubs; with Program.Elements.Protected_Body_Stubs; with Program.Elements.Exception_Declarations; with Program.Elements.Choice_Parameter_Specifications; with Program.Elements.Generic_Package_Declarations; with Program.Elements.Generic_Procedure_Declarations; with Program.Elements.Generic_Function_Declarations; with Program.Elements.Package_Instantiations; with Program.Elements.Procedure_Instantiations; with Program.Elements.Function_Instantiations; with Program.Elements.Formal_Object_Declarations; with Program.Elements.Formal_Type_Declarations; with Program.Elements.Formal_Procedure_Declarations; with Program.Elements.Formal_Function_Declarations; with Program.Elements.Formal_Package_Declarations; with Program.Elements.Definitions; with Program.Elements.Type_Definitions; with Program.Elements.Subtype_Indications; with Program.Elements.Constraints; with Program.Elements.Component_Definitions; with Program.Elements.Discrete_Ranges; with Program.Elements.Discrete_Subtype_Indications; with Program.Elements.Discrete_Range_Attribute_References; with Program.Elements.Discrete_Simple_Expression_Ranges; with Program.Elements.Unknown_Discriminant_Parts; with Program.Elements.Known_Discriminant_Parts; with Program.Elements.Record_Definitions; with Program.Elements.Null_Components; with Program.Elements.Variant_Parts; with Program.Elements.Variants; with Program.Elements.Others_Choices; with Program.Elements.Anonymous_Access_Definitions; with Program.Elements.Anonymous_Access_To_Objects; with Program.Elements.Anonymous_Access_To_Procedures; with Program.Elements.Anonymous_Access_To_Functions; with Program.Elements.Private_Type_Definitions; with Program.Elements.Private_Extension_Definitions; with Program.Elements.Incomplete_Type_Definitions; with Program.Elements.Task_Definitions; with Program.Elements.Protected_Definitions; with Program.Elements.Formal_Type_Definitions; with Program.Elements.Aspect_Specifications; with Program.Elements.Real_Range_Specifications; with Program.Elements.Expressions; with Program.Elements.Numeric_Literals; with Program.Elements.String_Literals; with Program.Elements.Identifiers; with Program.Elements.Operator_Symbols; with Program.Elements.Character_Literals; with Program.Elements.Explicit_Dereferences; with Program.Elements.Infix_Operators; with Program.Elements.Function_Calls; with Program.Elements.Indexed_Components; with Program.Elements.Slices; with Program.Elements.Selected_Components; with Program.Elements.Attribute_References; with Program.Elements.Record_Aggregates; with Program.Elements.Extension_Aggregates; with Program.Elements.Array_Aggregates; with Program.Elements.Short_Circuit_Operations; with Program.Elements.Membership_Tests; with Program.Elements.Null_Literals; with Program.Elements.Parenthesized_Expressions; with Program.Elements.Raise_Expressions; with Program.Elements.Type_Conversions; with Program.Elements.Qualified_Expressions; with Program.Elements.Allocators; with Program.Elements.Case_Expressions; with Program.Elements.If_Expressions; with Program.Elements.Quantified_Expressions; with Program.Elements.Associations; with Program.Elements.Discriminant_Associations; with Program.Elements.Record_Component_Associations; with Program.Elements.Array_Component_Associations; with Program.Elements.Parameter_Associations; with Program.Elements.Formal_Package_Associations; with Program.Elements.Statements; with Program.Elements.Null_Statements; with Program.Elements.Assignment_Statements; with Program.Elements.If_Statements; with Program.Elements.Case_Statements; with Program.Elements.Loop_Statements; with Program.Elements.While_Loop_Statements; with Program.Elements.For_Loop_Statements; with Program.Elements.Block_Statements; with Program.Elements.Exit_Statements; with Program.Elements.Goto_Statements; with Program.Elements.Call_Statements; with Program.Elements.Simple_Return_Statements; with Program.Elements.Extended_Return_Statements; with Program.Elements.Accept_Statements; with Program.Elements.Requeue_Statements; with Program.Elements.Delay_Statements; with Program.Elements.Terminate_Alternative_Statements; with Program.Elements.Select_Statements; with Program.Elements.Abort_Statements; with Program.Elements.Raise_Statements; with Program.Elements.Code_Statements; with Program.Elements.Paths; with Program.Elements.Elsif_Paths; with Program.Elements.Case_Paths; with Program.Elements.Select_Paths; with Program.Elements.Case_Expression_Paths; with Program.Elements.Elsif_Expression_Paths; with Program.Elements.Clauses; with Program.Elements.Use_Clauses; with Program.Elements.With_Clauses; with Program.Elements.Representation_Clauses; with Program.Elements.Component_Clauses; with Program.Elements.Derived_Types; with Program.Elements.Derived_Record_Extensions; with Program.Elements.Enumeration_Types; with Program.Elements.Signed_Integer_Types; with Program.Elements.Modular_Types; with Program.Elements.Root_Types; with Program.Elements.Floating_Point_Types; with Program.Elements.Ordinary_Fixed_Point_Types; with Program.Elements.Decimal_Fixed_Point_Types; with Program.Elements.Unconstrained_Array_Types; with Program.Elements.Constrained_Array_Types; with Program.Elements.Record_Types; with Program.Elements.Interface_Types; with Program.Elements.Object_Access_Types; with Program.Elements.Procedure_Access_Types; with Program.Elements.Function_Access_Types; with Program.Elements.Formal_Private_Type_Definitions; with Program.Elements.Formal_Derived_Type_Definitions; with Program.Elements.Formal_Discrete_Type_Definitions; with Program.Elements.Formal_Signed_Integer_Type_Definitions; with Program.Elements.Formal_Modular_Type_Definitions; with Program.Elements.Formal_Floating_Point_Definitions; with Program.Elements.Formal_Ordinary_Fixed_Point_Definitions; with Program.Elements.Formal_Decimal_Fixed_Point_Definitions; with Program.Elements.Formal_Unconstrained_Array_Types; with Program.Elements.Formal_Constrained_Array_Types; with Program.Elements.Formal_Access_Types; with Program.Elements.Formal_Object_Access_Types; with Program.Elements.Formal_Procedure_Access_Types; with Program.Elements.Formal_Function_Access_Types; with Program.Elements.Formal_Interface_Types; with Program.Elements.Access_Types; with Program.Elements.Range_Attribute_References; with Program.Elements.Simple_Expression_Ranges; with Program.Elements.Digits_Constraints; with Program.Elements.Delta_Constraints; with Program.Elements.Index_Constraints; with Program.Elements.Discriminant_Constraints; with Program.Elements.Attribute_Definition_Clauses; with Program.Elements.Enumeration_Representation_Clauses; with Program.Elements.Record_Representation_Clauses; with Program.Elements.At_Clauses; with Program.Elements.Exception_Handlers; package body Program.Elements is function Each_Enclosing_Element (Self : not null access Element'Class) return Program.Element_Iterators.Enclosing_Element_Iterator is begin return Program.Element_Iterators.To_Enclosing_Element_Iterator (Element_Access (Self)); end Each_Enclosing_Element; function Each_Child (Self : not null access Element'Class; Filter : Program.Element_Iterators.Element_Checker) return Program.Element_Iterators.Child_Iterator is begin return Program.Element_Iterators.To_Child_Iterator (Element_Access (Self), Filter); end Each_Child; function Each_Child (Self : not null access Element'Class) return Program.Element_Iterators.Child_Iterator is begin return Program.Element_Iterators.To_Child_Iterator (Element_Access (Self)); end Each_Child; function To_Pragma (Self : access Element'Class) return Program.Elements.Pragmas.Pragma_Access is begin return Program.Elements.Pragmas.Pragma_Access (Self); end To_Pragma; function To_Defining_Name (Self : access Element'Class) return Program.Elements.Defining_Names.Defining_Name_Access is begin return Program.Elements.Defining_Names.Defining_Name_Access (Self); end To_Defining_Name; function To_Defining_Identifier (Self : access Element'Class) return Program.Elements.Defining_Identifiers .Defining_Identifier_Access is begin return Program.Elements.Defining_Identifiers.Defining_Identifier_Access (Self); end To_Defining_Identifier; function To_Defining_Character_Literal (Self : access Element'Class) return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access is begin return Program.Elements.Defining_Character_Literals .Defining_Character_Literal_Access (Self); end To_Defining_Character_Literal; function To_Defining_Operator_Symbol (Self : access Element'Class) return Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access is begin return Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access (Self); end To_Defining_Operator_Symbol; function To_Defining_Expanded_Name (Self : access Element'Class) return Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access is begin return Program.Elements.Defining_Expanded_Names .Defining_Expanded_Name_Access (Self); end To_Defining_Expanded_Name; function To_Declaration (Self : access Element'Class) return Program.Elements.Declarations.Declaration_Access is begin return Program.Elements.Declarations.Declaration_Access (Self); end To_Declaration; function To_Type_Declaration (Self : access Element'Class) return Program.Elements.Type_Declarations.Type_Declaration_Access is begin return Program.Elements.Type_Declarations.Type_Declaration_Access (Self); end To_Type_Declaration; function To_Task_Type_Declaration (Self : access Element'Class) return Program.Elements.Task_Type_Declarations .Task_Type_Declaration_Access is begin return Program.Elements.Task_Type_Declarations .Task_Type_Declaration_Access (Self); end To_Task_Type_Declaration; function To_Protected_Type_Declaration (Self : access Element'Class) return Program.Elements.Protected_Type_Declarations .Protected_Type_Declaration_Access is begin return Program.Elements.Protected_Type_Declarations .Protected_Type_Declaration_Access (Self); end To_Protected_Type_Declaration; function To_Subtype_Declaration (Self : access Element'Class) return Program.Elements.Subtype_Declarations .Subtype_Declaration_Access is begin return Program.Elements.Subtype_Declarations.Subtype_Declaration_Access (Self); end To_Subtype_Declaration; function To_Object_Declaration (Self : access Element'Class) return Program.Elements.Object_Declarations.Object_Declaration_Access is begin return Program.Elements.Object_Declarations.Object_Declaration_Access (Self); end To_Object_Declaration; function To_Single_Task_Declaration (Self : access Element'Class) return Program.Elements.Single_Task_Declarations .Single_Task_Declaration_Access is begin return Program.Elements.Single_Task_Declarations .Single_Task_Declaration_Access (Self); end To_Single_Task_Declaration; function To_Single_Protected_Declaration (Self : access Element'Class) return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Access is begin return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Access (Self); end To_Single_Protected_Declaration; function To_Number_Declaration (Self : access Element'Class) return Program.Elements.Number_Declarations.Number_Declaration_Access is begin return Program.Elements.Number_Declarations.Number_Declaration_Access (Self); end To_Number_Declaration; function To_Enumeration_Literal_Specification (Self : access Element'Class) return Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access is begin return Program.Elements.Enumeration_Literal_Specifications .Enumeration_Literal_Specification_Access (Self); end To_Enumeration_Literal_Specification; function To_Discriminant_Specification (Self : access Element'Class) return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Access is begin return Program.Elements.Discriminant_Specifications .Discriminant_Specification_Access (Self); end To_Discriminant_Specification; function To_Component_Declaration (Self : access Element'Class) return Program.Elements.Component_Declarations .Component_Declaration_Access is begin return Program.Elements.Component_Declarations .Component_Declaration_Access (Self); end To_Component_Declaration; function To_Loop_Parameter_Specification (Self : access Element'Class) return Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access is begin return Program.Elements.Loop_Parameter_Specifications .Loop_Parameter_Specification_Access (Self); end To_Loop_Parameter_Specification; function To_Generalized_Iterator_Specification (Self : access Element'Class) return Program.Elements.Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access is begin return Program.Elements.Generalized_Iterator_Specifications .Generalized_Iterator_Specification_Access (Self); end To_Generalized_Iterator_Specification; function To_Element_Iterator_Specification (Self : access Element'Class) return Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access is begin return Program.Elements.Element_Iterator_Specifications .Element_Iterator_Specification_Access (Self); end To_Element_Iterator_Specification; function To_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Declarations .Procedure_Declaration_Access is begin return Program.Elements.Procedure_Declarations .Procedure_Declaration_Access (Self); end To_Procedure_Declaration; function To_Function_Declaration (Self : access Element'Class) return Program.Elements.Function_Declarations .Function_Declaration_Access is begin return Program.Elements.Function_Declarations.Function_Declaration_Access (Self); end To_Function_Declaration; function To_Parameter_Specification (Self : access Element'Class) return Program.Elements.Parameter_Specifications .Parameter_Specification_Access is begin return Program.Elements.Parameter_Specifications .Parameter_Specification_Access (Self); end To_Parameter_Specification; function To_Procedure_Body_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access is begin return Program.Elements.Procedure_Body_Declarations .Procedure_Body_Declaration_Access (Self); end To_Procedure_Body_Declaration; function To_Function_Body_Declaration (Self : access Element'Class) return Program.Elements.Function_Body_Declarations .Function_Body_Declaration_Access is begin return Program.Elements.Function_Body_Declarations .Function_Body_Declaration_Access (Self); end To_Function_Body_Declaration; function To_Return_Object_Specification (Self : access Element'Class) return Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access is begin return Program.Elements.Return_Object_Specifications .Return_Object_Specification_Access (Self); end To_Return_Object_Specification; function To_Package_Declaration (Self : access Element'Class) return Program.Elements.Package_Declarations .Package_Declaration_Access is begin return Program.Elements.Package_Declarations.Package_Declaration_Access (Self); end To_Package_Declaration; function To_Package_Body_Declaration (Self : access Element'Class) return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Access is begin return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Access (Self); end To_Package_Body_Declaration; function To_Object_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Object_Renaming_Declarations .Object_Renaming_Declaration_Access is begin return Program.Elements.Object_Renaming_Declarations .Object_Renaming_Declaration_Access (Self); end To_Object_Renaming_Declaration; function To_Exception_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Exception_Renaming_Declarations .Exception_Renaming_Declaration_Access is begin return Program.Elements.Exception_Renaming_Declarations .Exception_Renaming_Declaration_Access (Self); end To_Exception_Renaming_Declaration; function To_Procedure_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Procedure_Renaming_Declarations .Procedure_Renaming_Declaration_Access is begin return Program.Elements.Procedure_Renaming_Declarations .Procedure_Renaming_Declaration_Access (Self); end To_Procedure_Renaming_Declaration; function To_Function_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Function_Renaming_Declarations .Function_Renaming_Declaration_Access is begin return Program.Elements.Function_Renaming_Declarations .Function_Renaming_Declaration_Access (Self); end To_Function_Renaming_Declaration; function To_Package_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Package_Renaming_Declarations .Package_Renaming_Declaration_Access is begin return Program.Elements.Package_Renaming_Declarations .Package_Renaming_Declaration_Access (Self); end To_Package_Renaming_Declaration; function To_Generic_Package_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Package_Renaming_Declarations .Generic_Package_Renaming_Declaration_Access is begin return Program.Elements.Generic_Package_Renaming_Declarations .Generic_Package_Renaming_Declaration_Access (Self); end To_Generic_Package_Renaming_Declaration; function To_Generic_Procedure_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Procedure_Renaming_Declarations .Generic_Procedure_Renaming_Declaration_Access is begin return Program.Elements.Generic_Procedure_Renaming_Declarations .Generic_Procedure_Renaming_Declaration_Access (Self); end To_Generic_Procedure_Renaming_Declaration; function To_Generic_Function_Renaming_Declaration (Self : access Element'Class) return Program.Elements.Generic_Function_Renaming_Declarations .Generic_Function_Renaming_Declaration_Access is begin return Program.Elements.Generic_Function_Renaming_Declarations .Generic_Function_Renaming_Declaration_Access (Self); end To_Generic_Function_Renaming_Declaration; function To_Task_Body_Declaration (Self : access Element'Class) return Program.Elements.Task_Body_Declarations .Task_Body_Declaration_Access is begin return Program.Elements.Task_Body_Declarations .Task_Body_Declaration_Access (Self); end To_Task_Body_Declaration; function To_Protected_Body_Declaration (Self : access Element'Class) return Program.Elements.Protected_Body_Declarations .Protected_Body_Declaration_Access is begin return Program.Elements.Protected_Body_Declarations .Protected_Body_Declaration_Access (Self); end To_Protected_Body_Declaration; function To_Entry_Declaration (Self : access Element'Class) return Program.Elements.Entry_Declarations.Entry_Declaration_Access is begin return Program.Elements.Entry_Declarations.Entry_Declaration_Access (Self); end To_Entry_Declaration; function To_Entry_Body_Declaration (Self : access Element'Class) return Program.Elements.Entry_Body_Declarations .Entry_Body_Declaration_Access is begin return Program.Elements.Entry_Body_Declarations .Entry_Body_Declaration_Access (Self); end To_Entry_Body_Declaration; function To_Entry_Index_Specification (Self : access Element'Class) return Program.Elements.Entry_Index_Specifications .Entry_Index_Specification_Access is begin return Program.Elements.Entry_Index_Specifications .Entry_Index_Specification_Access (Self); end To_Entry_Index_Specification; function To_Procedure_Body_Stub (Self : access Element'Class) return Program.Elements.Procedure_Body_Stubs .Procedure_Body_Stub_Access is begin return Program.Elements.Procedure_Body_Stubs.Procedure_Body_Stub_Access (Self); end To_Procedure_Body_Stub; function To_Function_Body_Stub (Self : access Element'Class) return Program.Elements.Function_Body_Stubs.Function_Body_Stub_Access is begin return Program.Elements.Function_Body_Stubs.Function_Body_Stub_Access (Self); end To_Function_Body_Stub; function To_Package_Body_Stub (Self : access Element'Class) return Program.Elements.Package_Body_Stubs.Package_Body_Stub_Access is begin return Program.Elements.Package_Body_Stubs.Package_Body_Stub_Access (Self); end To_Package_Body_Stub; function To_Task_Body_Stub (Self : access Element'Class) return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access is begin return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Access (Self); end To_Task_Body_Stub; function To_Protected_Body_Stub (Self : access Element'Class) return Program.Elements.Protected_Body_Stubs .Protected_Body_Stub_Access is begin return Program.Elements.Protected_Body_Stubs.Protected_Body_Stub_Access (Self); end To_Protected_Body_Stub; function To_Exception_Declaration (Self : access Element'Class) return Program.Elements.Exception_Declarations .Exception_Declaration_Access is begin return Program.Elements.Exception_Declarations .Exception_Declaration_Access (Self); end To_Exception_Declaration; function To_Choice_Parameter_Specification (Self : access Element'Class) return Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access is begin return Program.Elements.Choice_Parameter_Specifications .Choice_Parameter_Specification_Access (Self); end To_Choice_Parameter_Specification; function To_Generic_Package_Declaration (Self : access Element'Class) return Program.Elements.Generic_Package_Declarations .Generic_Package_Declaration_Access is begin return Program.Elements.Generic_Package_Declarations .Generic_Package_Declaration_Access (Self); end To_Generic_Package_Declaration; function To_Generic_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Access is begin return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Access (Self); end To_Generic_Procedure_Declaration; function To_Generic_Function_Declaration (Self : access Element'Class) return Program.Elements.Generic_Function_Declarations .Generic_Function_Declaration_Access is begin return Program.Elements.Generic_Function_Declarations .Generic_Function_Declaration_Access (Self); end To_Generic_Function_Declaration; function To_Package_Instantiation (Self : access Element'Class) return Program.Elements.Package_Instantiations .Package_Instantiation_Access is begin return Program.Elements.Package_Instantiations .Package_Instantiation_Access (Self); end To_Package_Instantiation; function To_Procedure_Instantiation (Self : access Element'Class) return Program.Elements.Procedure_Instantiations .Procedure_Instantiation_Access is begin return Program.Elements.Procedure_Instantiations .Procedure_Instantiation_Access (Self); end To_Procedure_Instantiation; function To_Function_Instantiation (Self : access Element'Class) return Program.Elements.Function_Instantiations .Function_Instantiation_Access is begin return Program.Elements.Function_Instantiations .Function_Instantiation_Access (Self); end To_Function_Instantiation; function To_Formal_Object_Declaration (Self : access Element'Class) return Program.Elements.Formal_Object_Declarations .Formal_Object_Declaration_Access is begin return Program.Elements.Formal_Object_Declarations .Formal_Object_Declaration_Access (Self); end To_Formal_Object_Declaration; function To_Formal_Type_Declaration (Self : access Element'Class) return Program.Elements.Formal_Type_Declarations .Formal_Type_Declaration_Access is begin return Program.Elements.Formal_Type_Declarations .Formal_Type_Declaration_Access (Self); end To_Formal_Type_Declaration; function To_Formal_Procedure_Declaration (Self : access Element'Class) return Program.Elements.Formal_Procedure_Declarations .Formal_Procedure_Declaration_Access is begin return Program.Elements.Formal_Procedure_Declarations .Formal_Procedure_Declaration_Access (Self); end To_Formal_Procedure_Declaration; function To_Formal_Function_Declaration (Self : access Element'Class) return Program.Elements.Formal_Function_Declarations .Formal_Function_Declaration_Access is begin return Program.Elements.Formal_Function_Declarations .Formal_Function_Declaration_Access (Self); end To_Formal_Function_Declaration; function To_Formal_Package_Declaration (Self : access Element'Class) return Program.Elements.Formal_Package_Declarations .Formal_Package_Declaration_Access is begin return Program.Elements.Formal_Package_Declarations .Formal_Package_Declaration_Access (Self); end To_Formal_Package_Declaration; function To_Definition (Self : access Element'Class) return Program.Elements.Definitions.Definition_Access is begin return Program.Elements.Definitions.Definition_Access (Self); end To_Definition; function To_Type_Definition (Self : access Element'Class) return Program.Elements.Type_Definitions.Type_Definition_Access is begin return Program.Elements.Type_Definitions.Type_Definition_Access (Self); end To_Type_Definition; function To_Subtype_Indication (Self : access Element'Class) return Program.Elements.Subtype_Indications.Subtype_Indication_Access is begin return Program.Elements.Subtype_Indications.Subtype_Indication_Access (Self); end To_Subtype_Indication; function To_Constraint (Self : access Element'Class) return Program.Elements.Constraints.Constraint_Access is begin return Program.Elements.Constraints.Constraint_Access (Self); end To_Constraint; function To_Component_Definition (Self : access Element'Class) return Program.Elements.Component_Definitions .Component_Definition_Access is begin return Program.Elements.Component_Definitions.Component_Definition_Access (Self); end To_Component_Definition; function To_Discrete_Range (Self : access Element'Class) return Program.Elements.Discrete_Ranges.Discrete_Range_Access is begin return Program.Elements.Discrete_Ranges.Discrete_Range_Access (Self); end To_Discrete_Range; function To_Discrete_Subtype_Indication (Self : access Element'Class) return Program.Elements.Discrete_Subtype_Indications .Discrete_Subtype_Indication_Access is begin return Program.Elements.Discrete_Subtype_Indications .Discrete_Subtype_Indication_Access (Self); end To_Discrete_Subtype_Indication; function To_Discrete_Range_Attribute_Reference (Self : access Element'Class) return Program.Elements.Discrete_Range_Attribute_References .Discrete_Range_Attribute_Reference_Access is begin return Program.Elements.Discrete_Range_Attribute_References .Discrete_Range_Attribute_Reference_Access (Self); end To_Discrete_Range_Attribute_Reference; function To_Discrete_Simple_Expression_Range (Self : access Element'Class) return Program.Elements.Discrete_Simple_Expression_Ranges .Discrete_Simple_Expression_Range_Access is begin return Program.Elements.Discrete_Simple_Expression_Ranges .Discrete_Simple_Expression_Range_Access (Self); end To_Discrete_Simple_Expression_Range; function To_Unknown_Discriminant_Part (Self : access Element'Class) return Program.Elements.Unknown_Discriminant_Parts .Unknown_Discriminant_Part_Access is begin return Program.Elements.Unknown_Discriminant_Parts .Unknown_Discriminant_Part_Access (Self); end To_Unknown_Discriminant_Part; function To_Known_Discriminant_Part (Self : access Element'Class) return Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access is begin return Program.Elements.Known_Discriminant_Parts .Known_Discriminant_Part_Access (Self); end To_Known_Discriminant_Part; function To_Record_Definition (Self : access Element'Class) return Program.Elements.Record_Definitions.Record_Definition_Access is begin return Program.Elements.Record_Definitions.Record_Definition_Access (Self); end To_Record_Definition; function To_Null_Component (Self : access Element'Class) return Program.Elements.Null_Components.Null_Component_Access is begin return Program.Elements.Null_Components.Null_Component_Access (Self); end To_Null_Component; function To_Variant_Part (Self : access Element'Class) return Program.Elements.Variant_Parts.Variant_Part_Access is begin return Program.Elements.Variant_Parts.Variant_Part_Access (Self); end To_Variant_Part; function To_Variant (Self : access Element'Class) return Program.Elements.Variants.Variant_Access is begin return Program.Elements.Variants.Variant_Access (Self); end To_Variant; function To_Others_Choice (Self : access Element'Class) return Program.Elements.Others_Choices.Others_Choice_Access is begin return Program.Elements.Others_Choices.Others_Choice_Access (Self); end To_Others_Choice; function To_Anonymous_Access_Definition (Self : access Element'Class) return Program.Elements.Anonymous_Access_Definitions .Anonymous_Access_Definition_Access is begin return Program.Elements.Anonymous_Access_Definitions .Anonymous_Access_Definition_Access (Self); end To_Anonymous_Access_Definition; function To_Anonymous_Access_To_Object (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Objects .Anonymous_Access_To_Object_Access is begin return Program.Elements.Anonymous_Access_To_Objects .Anonymous_Access_To_Object_Access (Self); end To_Anonymous_Access_To_Object; function To_Anonymous_Access_To_Procedure (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Access is begin return Program.Elements.Anonymous_Access_To_Procedures .Anonymous_Access_To_Procedure_Access (Self); end To_Anonymous_Access_To_Procedure; function To_Anonymous_Access_To_Function (Self : access Element'Class) return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Access is begin return Program.Elements.Anonymous_Access_To_Functions .Anonymous_Access_To_Function_Access (Self); end To_Anonymous_Access_To_Function; function To_Private_Type_Definition (Self : access Element'Class) return Program.Elements.Private_Type_Definitions .Private_Type_Definition_Access is begin return Program.Elements.Private_Type_Definitions .Private_Type_Definition_Access (Self); end To_Private_Type_Definition; function To_Private_Extension_Definition (Self : access Element'Class) return Program.Elements.Private_Extension_Definitions .Private_Extension_Definition_Access is begin return Program.Elements.Private_Extension_Definitions .Private_Extension_Definition_Access (Self); end To_Private_Extension_Definition; function To_Incomplete_Type_Definition (Self : access Element'Class) return Program.Elements.Incomplete_Type_Definitions .Incomplete_Type_Definition_Access is begin return Program.Elements.Incomplete_Type_Definitions .Incomplete_Type_Definition_Access (Self); end To_Incomplete_Type_Definition; function To_Task_Definition (Self : access Element'Class) return Program.Elements.Task_Definitions.Task_Definition_Access is begin return Program.Elements.Task_Definitions.Task_Definition_Access (Self); end To_Task_Definition; function To_Protected_Definition (Self : access Element'Class) return Program.Elements.Protected_Definitions .Protected_Definition_Access is begin return Program.Elements.Protected_Definitions.Protected_Definition_Access (Self); end To_Protected_Definition; function To_Formal_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Type_Definitions .Formal_Type_Definition_Access is begin return Program.Elements.Formal_Type_Definitions .Formal_Type_Definition_Access (Self); end To_Formal_Type_Definition; function To_Aspect_Specification (Self : access Element'Class) return Program.Elements.Aspect_Specifications .Aspect_Specification_Access is begin return Program.Elements.Aspect_Specifications.Aspect_Specification_Access (Self); end To_Aspect_Specification; function To_Real_Range_Specification (Self : access Element'Class) return Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access is begin return Program.Elements.Real_Range_Specifications .Real_Range_Specification_Access (Self); end To_Real_Range_Specification; function To_Expression (Self : access Element'Class) return Program.Elements.Expressions.Expression_Access is begin return Program.Elements.Expressions.Expression_Access (Self); end To_Expression; function To_Numeric_Literal (Self : access Element'Class) return Program.Elements.Numeric_Literals.Numeric_Literal_Access is begin return Program.Elements.Numeric_Literals.Numeric_Literal_Access (Self); end To_Numeric_Literal; function To_String_Literal (Self : access Element'Class) return Program.Elements.String_Literals.String_Literal_Access is begin return Program.Elements.String_Literals.String_Literal_Access (Self); end To_String_Literal; function To_Identifier (Self : access Element'Class) return Program.Elements.Identifiers.Identifier_Access is begin return Program.Elements.Identifiers.Identifier_Access (Self); end To_Identifier; function To_Operator_Symbol (Self : access Element'Class) return Program.Elements.Operator_Symbols.Operator_Symbol_Access is begin return Program.Elements.Operator_Symbols.Operator_Symbol_Access (Self); end To_Operator_Symbol; function To_Character_Literal (Self : access Element'Class) return Program.Elements.Character_Literals.Character_Literal_Access is begin return Program.Elements.Character_Literals.Character_Literal_Access (Self); end To_Character_Literal; function To_Explicit_Dereference (Self : access Element'Class) return Program.Elements.Explicit_Dereferences .Explicit_Dereference_Access is begin return Program.Elements.Explicit_Dereferences.Explicit_Dereference_Access (Self); end To_Explicit_Dereference; function To_Infix_Operator (Self : access Element'Class) return Program.Elements.Infix_Operators.Infix_Operator_Access is begin return Program.Elements.Infix_Operators.Infix_Operator_Access (Self); end To_Infix_Operator; function To_Function_Call (Self : access Element'Class) return Program.Elements.Function_Calls.Function_Call_Access is begin return Program.Elements.Function_Calls.Function_Call_Access (Self); end To_Function_Call; function To_Indexed_Component (Self : access Element'Class) return Program.Elements.Indexed_Components.Indexed_Component_Access is begin return Program.Elements.Indexed_Components.Indexed_Component_Access (Self); end To_Indexed_Component; function To_Slice (Self : access Element'Class) return Program.Elements.Slices.Slice_Access is begin return Program.Elements.Slices.Slice_Access (Self); end To_Slice; function To_Selected_Component (Self : access Element'Class) return Program.Elements.Selected_Components.Selected_Component_Access is begin return Program.Elements.Selected_Components.Selected_Component_Access (Self); end To_Selected_Component; function To_Attribute_Reference (Self : access Element'Class) return Program.Elements.Attribute_References .Attribute_Reference_Access is begin return Program.Elements.Attribute_References.Attribute_Reference_Access (Self); end To_Attribute_Reference; function To_Record_Aggregate (Self : access Element'Class) return Program.Elements.Record_Aggregates.Record_Aggregate_Access is begin return Program.Elements.Record_Aggregates.Record_Aggregate_Access (Self); end To_Record_Aggregate; function To_Extension_Aggregate (Self : access Element'Class) return Program.Elements.Extension_Aggregates .Extension_Aggregate_Access is begin return Program.Elements.Extension_Aggregates.Extension_Aggregate_Access (Self); end To_Extension_Aggregate; function To_Array_Aggregate (Self : access Element'Class) return Program.Elements.Array_Aggregates.Array_Aggregate_Access is begin return Program.Elements.Array_Aggregates.Array_Aggregate_Access (Self); end To_Array_Aggregate; function To_Short_Circuit_Operation (Self : access Element'Class) return Program.Elements.Short_Circuit_Operations .Short_Circuit_Operation_Access is begin return Program.Elements.Short_Circuit_Operations .Short_Circuit_Operation_Access (Self); end To_Short_Circuit_Operation; function To_Membership_Test (Self : access Element'Class) return Program.Elements.Membership_Tests.Membership_Test_Access is begin return Program.Elements.Membership_Tests.Membership_Test_Access (Self); end To_Membership_Test; function To_Null_Literal (Self : access Element'Class) return Program.Elements.Null_Literals.Null_Literal_Access is begin return Program.Elements.Null_Literals.Null_Literal_Access (Self); end To_Null_Literal; function To_Parenthesized_Expression (Self : access Element'Class) return Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access is begin return Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access (Self); end To_Parenthesized_Expression; function To_Raise_Expression (Self : access Element'Class) return Program.Elements.Raise_Expressions.Raise_Expression_Access is begin return Program.Elements.Raise_Expressions.Raise_Expression_Access (Self); end To_Raise_Expression; function To_Type_Conversion (Self : access Element'Class) return Program.Elements.Type_Conversions.Type_Conversion_Access is begin return Program.Elements.Type_Conversions.Type_Conversion_Access (Self); end To_Type_Conversion; function To_Qualified_Expression (Self : access Element'Class) return Program.Elements.Qualified_Expressions .Qualified_Expression_Access is begin return Program.Elements.Qualified_Expressions.Qualified_Expression_Access (Self); end To_Qualified_Expression; function To_Allocator (Self : access Element'Class) return Program.Elements.Allocators.Allocator_Access is begin return Program.Elements.Allocators.Allocator_Access (Self); end To_Allocator; function To_Case_Expression (Self : access Element'Class) return Program.Elements.Case_Expressions.Case_Expression_Access is begin return Program.Elements.Case_Expressions.Case_Expression_Access (Self); end To_Case_Expression; function To_If_Expression (Self : access Element'Class) return Program.Elements.If_Expressions.If_Expression_Access is begin return Program.Elements.If_Expressions.If_Expression_Access (Self); end To_If_Expression; function To_Quantified_Expression (Self : access Element'Class) return Program.Elements.Quantified_Expressions .Quantified_Expression_Access is begin return Program.Elements.Quantified_Expressions .Quantified_Expression_Access (Self); end To_Quantified_Expression; function To_Association (Self : access Element'Class) return Program.Elements.Associations.Association_Access is begin return Program.Elements.Associations.Association_Access (Self); end To_Association; function To_Discriminant_Association (Self : access Element'Class) return Program.Elements.Discriminant_Associations .Discriminant_Association_Access is begin return Program.Elements.Discriminant_Associations .Discriminant_Association_Access (Self); end To_Discriminant_Association; function To_Record_Component_Association (Self : access Element'Class) return Program.Elements.Record_Component_Associations .Record_Component_Association_Access is begin return Program.Elements.Record_Component_Associations .Record_Component_Association_Access (Self); end To_Record_Component_Association; function To_Array_Component_Association (Self : access Element'Class) return Program.Elements.Array_Component_Associations .Array_Component_Association_Access is begin return Program.Elements.Array_Component_Associations .Array_Component_Association_Access (Self); end To_Array_Component_Association; function To_Parameter_Association (Self : access Element'Class) return Program.Elements.Parameter_Associations .Parameter_Association_Access is begin return Program.Elements.Parameter_Associations .Parameter_Association_Access (Self); end To_Parameter_Association; function To_Formal_Package_Association (Self : access Element'Class) return Program.Elements.Formal_Package_Associations .Formal_Package_Association_Access is begin return Program.Elements.Formal_Package_Associations .Formal_Package_Association_Access (Self); end To_Formal_Package_Association; function To_Statement (Self : access Element'Class) return Program.Elements.Statements.Statement_Access is begin return Program.Elements.Statements.Statement_Access (Self); end To_Statement; function To_Null_Statement (Self : access Element'Class) return Program.Elements.Null_Statements.Null_Statement_Access is begin return Program.Elements.Null_Statements.Null_Statement_Access (Self); end To_Null_Statement; function To_Assignment_Statement (Self : access Element'Class) return Program.Elements.Assignment_Statements .Assignment_Statement_Access is begin return Program.Elements.Assignment_Statements.Assignment_Statement_Access (Self); end To_Assignment_Statement; function To_If_Statement (Self : access Element'Class) return Program.Elements.If_Statements.If_Statement_Access is begin return Program.Elements.If_Statements.If_Statement_Access (Self); end To_If_Statement; function To_Case_Statement (Self : access Element'Class) return Program.Elements.Case_Statements.Case_Statement_Access is begin return Program.Elements.Case_Statements.Case_Statement_Access (Self); end To_Case_Statement; function To_Loop_Statement (Self : access Element'Class) return Program.Elements.Loop_Statements.Loop_Statement_Access is begin return Program.Elements.Loop_Statements.Loop_Statement_Access (Self); end To_Loop_Statement; function To_While_Loop_Statement (Self : access Element'Class) return Program.Elements.While_Loop_Statements .While_Loop_Statement_Access is begin return Program.Elements.While_Loop_Statements.While_Loop_Statement_Access (Self); end To_While_Loop_Statement; function To_For_Loop_Statement (Self : access Element'Class) return Program.Elements.For_Loop_Statements.For_Loop_Statement_Access is begin return Program.Elements.For_Loop_Statements.For_Loop_Statement_Access (Self); end To_For_Loop_Statement; function To_Block_Statement (Self : access Element'Class) return Program.Elements.Block_Statements.Block_Statement_Access is begin return Program.Elements.Block_Statements.Block_Statement_Access (Self); end To_Block_Statement; function To_Exit_Statement (Self : access Element'Class) return Program.Elements.Exit_Statements.Exit_Statement_Access is begin return Program.Elements.Exit_Statements.Exit_Statement_Access (Self); end To_Exit_Statement; function To_Goto_Statement (Self : access Element'Class) return Program.Elements.Goto_Statements.Goto_Statement_Access is begin return Program.Elements.Goto_Statements.Goto_Statement_Access (Self); end To_Goto_Statement; function To_Call_Statement (Self : access Element'Class) return Program.Elements.Call_Statements.Call_Statement_Access is begin return Program.Elements.Call_Statements.Call_Statement_Access (Self); end To_Call_Statement; function To_Simple_Return_Statement (Self : access Element'Class) return Program.Elements.Simple_Return_Statements .Simple_Return_Statement_Access is begin return Program.Elements.Simple_Return_Statements .Simple_Return_Statement_Access (Self); end To_Simple_Return_Statement; function To_Extended_Return_Statement (Self : access Element'Class) return Program.Elements.Extended_Return_Statements .Extended_Return_Statement_Access is begin return Program.Elements.Extended_Return_Statements .Extended_Return_Statement_Access (Self); end To_Extended_Return_Statement; function To_Accept_Statement (Self : access Element'Class) return Program.Elements.Accept_Statements.Accept_Statement_Access is begin return Program.Elements.Accept_Statements.Accept_Statement_Access (Self); end To_Accept_Statement; function To_Requeue_Statement (Self : access Element'Class) return Program.Elements.Requeue_Statements.Requeue_Statement_Access is begin return Program.Elements.Requeue_Statements.Requeue_Statement_Access (Self); end To_Requeue_Statement; function To_Delay_Statement (Self : access Element'Class) return Program.Elements.Delay_Statements.Delay_Statement_Access is begin return Program.Elements.Delay_Statements.Delay_Statement_Access (Self); end To_Delay_Statement; function To_Terminate_Alternative_Statement (Self : access Element'Class) return Program.Elements.Terminate_Alternative_Statements .Terminate_Alternative_Statement_Access is begin return Program.Elements.Terminate_Alternative_Statements .Terminate_Alternative_Statement_Access (Self); end To_Terminate_Alternative_Statement; function To_Select_Statement (Self : access Element'Class) return Program.Elements.Select_Statements.Select_Statement_Access is begin return Program.Elements.Select_Statements.Select_Statement_Access (Self); end To_Select_Statement; function To_Abort_Statement (Self : access Element'Class) return Program.Elements.Abort_Statements.Abort_Statement_Access is begin return Program.Elements.Abort_Statements.Abort_Statement_Access (Self); end To_Abort_Statement; function To_Raise_Statement (Self : access Element'Class) return Program.Elements.Raise_Statements.Raise_Statement_Access is begin return Program.Elements.Raise_Statements.Raise_Statement_Access (Self); end To_Raise_Statement; function To_Code_Statement (Self : access Element'Class) return Program.Elements.Code_Statements.Code_Statement_Access is begin return Program.Elements.Code_Statements.Code_Statement_Access (Self); end To_Code_Statement; function To_Path (Self : access Element'Class) return Program.Elements.Paths.Path_Access is begin return Program.Elements.Paths.Path_Access (Self); end To_Path; function To_Elsif_Path (Self : access Element'Class) return Program.Elements.Elsif_Paths.Elsif_Path_Access is begin return Program.Elements.Elsif_Paths.Elsif_Path_Access (Self); end To_Elsif_Path; function To_Case_Path (Self : access Element'Class) return Program.Elements.Case_Paths.Case_Path_Access is begin return Program.Elements.Case_Paths.Case_Path_Access (Self); end To_Case_Path; function To_Select_Path (Self : access Element'Class) return Program.Elements.Select_Paths.Select_Path_Access is begin return Program.Elements.Select_Paths.Select_Path_Access (Self); end To_Select_Path; function To_Case_Expression_Path (Self : access Element'Class) return Program.Elements.Case_Expression_Paths .Case_Expression_Path_Access is begin return Program.Elements.Case_Expression_Paths.Case_Expression_Path_Access (Self); end To_Case_Expression_Path; function To_Elsif_Expression_Path (Self : access Element'Class) return Program.Elements.Elsif_Expression_Paths .Elsif_Expression_Path_Access is begin return Program.Elements.Elsif_Expression_Paths .Elsif_Expression_Path_Access (Self); end To_Elsif_Expression_Path; function To_Clause (Self : access Element'Class) return Program.Elements.Clauses.Clause_Access is begin return Program.Elements.Clauses.Clause_Access (Self); end To_Clause; function To_Use_Clause (Self : access Element'Class) return Program.Elements.Use_Clauses.Use_Clause_Access is begin return Program.Elements.Use_Clauses.Use_Clause_Access (Self); end To_Use_Clause; function To_With_Clause (Self : access Element'Class) return Program.Elements.With_Clauses.With_Clause_Access is begin return Program.Elements.With_Clauses.With_Clause_Access (Self); end To_With_Clause; function To_Representation_Clause (Self : access Element'Class) return Program.Elements.Representation_Clauses .Representation_Clause_Access is begin return Program.Elements.Representation_Clauses .Representation_Clause_Access (Self); end To_Representation_Clause; function To_Component_Clause (Self : access Element'Class) return Program.Elements.Component_Clauses.Component_Clause_Access is begin return Program.Elements.Component_Clauses.Component_Clause_Access (Self); end To_Component_Clause; function To_Derived_Type (Self : access Element'Class) return Program.Elements.Derived_Types.Derived_Type_Access is begin return Program.Elements.Derived_Types.Derived_Type_Access (Self); end To_Derived_Type; function To_Derived_Record_Extension (Self : access Element'Class) return Program.Elements.Derived_Record_Extensions .Derived_Record_Extension_Access is begin return Program.Elements.Derived_Record_Extensions .Derived_Record_Extension_Access (Self); end To_Derived_Record_Extension; function To_Enumeration_Type (Self : access Element'Class) return Program.Elements.Enumeration_Types.Enumeration_Type_Access is begin return Program.Elements.Enumeration_Types.Enumeration_Type_Access (Self); end To_Enumeration_Type; function To_Signed_Integer_Type (Self : access Element'Class) return Program.Elements.Signed_Integer_Types .Signed_Integer_Type_Access is begin return Program.Elements.Signed_Integer_Types.Signed_Integer_Type_Access (Self); end To_Signed_Integer_Type; function To_Modular_Type (Self : access Element'Class) return Program.Elements.Modular_Types.Modular_Type_Access is begin return Program.Elements.Modular_Types.Modular_Type_Access (Self); end To_Modular_Type; function To_Root_Type (Self : access Element'Class) return Program.Elements.Root_Types.Root_Type_Access is begin return Program.Elements.Root_Types.Root_Type_Access (Self); end To_Root_Type; function To_Floating_Point_Type (Self : access Element'Class) return Program.Elements.Floating_Point_Types .Floating_Point_Type_Access is begin return Program.Elements.Floating_Point_Types.Floating_Point_Type_Access (Self); end To_Floating_Point_Type; function To_Ordinary_Fixed_Point_Type (Self : access Element'Class) return Program.Elements.Ordinary_Fixed_Point_Types .Ordinary_Fixed_Point_Type_Access is begin return Program.Elements.Ordinary_Fixed_Point_Types .Ordinary_Fixed_Point_Type_Access (Self); end To_Ordinary_Fixed_Point_Type; function To_Decimal_Fixed_Point_Type (Self : access Element'Class) return Program.Elements.Decimal_Fixed_Point_Types .Decimal_Fixed_Point_Type_Access is begin return Program.Elements.Decimal_Fixed_Point_Types .Decimal_Fixed_Point_Type_Access (Self); end To_Decimal_Fixed_Point_Type; function To_Unconstrained_Array_Type (Self : access Element'Class) return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access is begin return Program.Elements.Unconstrained_Array_Types .Unconstrained_Array_Type_Access (Self); end To_Unconstrained_Array_Type; function To_Constrained_Array_Type (Self : access Element'Class) return Program.Elements.Constrained_Array_Types .Constrained_Array_Type_Access is begin return Program.Elements.Constrained_Array_Types .Constrained_Array_Type_Access (Self); end To_Constrained_Array_Type; function To_Record_Type (Self : access Element'Class) return Program.Elements.Record_Types.Record_Type_Access is begin return Program.Elements.Record_Types.Record_Type_Access (Self); end To_Record_Type; function To_Interface_Type (Self : access Element'Class) return Program.Elements.Interface_Types.Interface_Type_Access is begin return Program.Elements.Interface_Types.Interface_Type_Access (Self); end To_Interface_Type; function To_Object_Access_Type (Self : access Element'Class) return Program.Elements.Object_Access_Types.Object_Access_Type_Access is begin return Program.Elements.Object_Access_Types.Object_Access_Type_Access (Self); end To_Object_Access_Type; function To_Procedure_Access_Type (Self : access Element'Class) return Program.Elements.Procedure_Access_Types .Procedure_Access_Type_Access is begin return Program.Elements.Procedure_Access_Types .Procedure_Access_Type_Access (Self); end To_Procedure_Access_Type; function To_Function_Access_Type (Self : access Element'Class) return Program.Elements.Function_Access_Types .Function_Access_Type_Access is begin return Program.Elements.Function_Access_Types.Function_Access_Type_Access (Self); end To_Function_Access_Type; function To_Formal_Private_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Access is begin return Program.Elements.Formal_Private_Type_Definitions .Formal_Private_Type_Definition_Access (Self); end To_Formal_Private_Type_Definition; function To_Formal_Derived_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Derived_Type_Definitions .Formal_Derived_Type_Definition_Access is begin return Program.Elements.Formal_Derived_Type_Definitions .Formal_Derived_Type_Definition_Access (Self); end To_Formal_Derived_Type_Definition; function To_Formal_Discrete_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Discrete_Type_Definitions .Formal_Discrete_Type_Definition_Access is begin return Program.Elements.Formal_Discrete_Type_Definitions .Formal_Discrete_Type_Definition_Access (Self); end To_Formal_Discrete_Type_Definition; function To_Formal_Signed_Integer_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Access is begin return Program.Elements.Formal_Signed_Integer_Type_Definitions .Formal_Signed_Integer_Type_Definition_Access (Self); end To_Formal_Signed_Integer_Type_Definition; function To_Formal_Modular_Type_Definition (Self : access Element'Class) return Program.Elements.Formal_Modular_Type_Definitions .Formal_Modular_Type_Definition_Access is begin return Program.Elements.Formal_Modular_Type_Definitions .Formal_Modular_Type_Definition_Access (Self); end To_Formal_Modular_Type_Definition; function To_Formal_Floating_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Floating_Point_Definitions .Formal_Floating_Point_Definition_Access is begin return Program.Elements.Formal_Floating_Point_Definitions .Formal_Floating_Point_Definition_Access (Self); end To_Formal_Floating_Point_Definition; function To_Formal_Ordinary_Fixed_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions .Formal_Ordinary_Fixed_Point_Definition_Access is begin return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions .Formal_Ordinary_Fixed_Point_Definition_Access (Self); end To_Formal_Ordinary_Fixed_Point_Definition; function To_Formal_Decimal_Fixed_Point_Definition (Self : access Element'Class) return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Access is begin return Program.Elements.Formal_Decimal_Fixed_Point_Definitions .Formal_Decimal_Fixed_Point_Definition_Access (Self); end To_Formal_Decimal_Fixed_Point_Definition; function To_Formal_Unconstrained_Array_Type (Self : access Element'Class) return Program.Elements.Formal_Unconstrained_Array_Types .Formal_Unconstrained_Array_Type_Access is begin return Program.Elements.Formal_Unconstrained_Array_Types .Formal_Unconstrained_Array_Type_Access (Self); end To_Formal_Unconstrained_Array_Type; function To_Formal_Constrained_Array_Type (Self : access Element'Class) return Program.Elements.Formal_Constrained_Array_Types .Formal_Constrained_Array_Type_Access is begin return Program.Elements.Formal_Constrained_Array_Types .Formal_Constrained_Array_Type_Access (Self); end To_Formal_Constrained_Array_Type; function To_Formal_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Access_Types.Formal_Access_Type_Access is begin return Program.Elements.Formal_Access_Types.Formal_Access_Type_Access (Self); end To_Formal_Access_Type; function To_Formal_Object_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Object_Access_Types .Formal_Object_Access_Type_Access is begin return Program.Elements.Formal_Object_Access_Types .Formal_Object_Access_Type_Access (Self); end To_Formal_Object_Access_Type; function To_Formal_Procedure_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Access is begin return Program.Elements.Formal_Procedure_Access_Types .Formal_Procedure_Access_Type_Access (Self); end To_Formal_Procedure_Access_Type; function To_Formal_Function_Access_Type (Self : access Element'Class) return Program.Elements.Formal_Function_Access_Types .Formal_Function_Access_Type_Access is begin return Program.Elements.Formal_Function_Access_Types .Formal_Function_Access_Type_Access (Self); end To_Formal_Function_Access_Type; function To_Formal_Interface_Type (Self : access Element'Class) return Program.Elements.Formal_Interface_Types .Formal_Interface_Type_Access is begin return Program.Elements.Formal_Interface_Types .Formal_Interface_Type_Access (Self); end To_Formal_Interface_Type; function To_Access_Type (Self : access Element'Class) return Program.Elements.Access_Types.Access_Type_Access is begin return Program.Elements.Access_Types.Access_Type_Access (Self); end To_Access_Type; function To_Range_Attribute_Reference (Self : access Element'Class) return Program.Elements.Range_Attribute_References .Range_Attribute_Reference_Access is begin return Program.Elements.Range_Attribute_References .Range_Attribute_Reference_Access (Self); end To_Range_Attribute_Reference; function To_Simple_Expression_Range (Self : access Element'Class) return Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access is begin return Program.Elements.Simple_Expression_Ranges .Simple_Expression_Range_Access (Self); end To_Simple_Expression_Range; function To_Digits_Constraint (Self : access Element'Class) return Program.Elements.Digits_Constraints.Digits_Constraint_Access is begin return Program.Elements.Digits_Constraints.Digits_Constraint_Access (Self); end To_Digits_Constraint; function To_Delta_Constraint (Self : access Element'Class) return Program.Elements.Delta_Constraints.Delta_Constraint_Access is begin return Program.Elements.Delta_Constraints.Delta_Constraint_Access (Self); end To_Delta_Constraint; function To_Index_Constraint (Self : access Element'Class) return Program.Elements.Index_Constraints.Index_Constraint_Access is begin return Program.Elements.Index_Constraints.Index_Constraint_Access (Self); end To_Index_Constraint; function To_Discriminant_Constraint (Self : access Element'Class) return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Access is begin return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Access (Self); end To_Discriminant_Constraint; function To_Attribute_Definition_Clause (Self : access Element'Class) return Program.Elements.Attribute_Definition_Clauses .Attribute_Definition_Clause_Access is begin return Program.Elements.Attribute_Definition_Clauses .Attribute_Definition_Clause_Access (Self); end To_Attribute_Definition_Clause; function To_Enumeration_Representation_Clause (Self : access Element'Class) return Program.Elements.Enumeration_Representation_Clauses .Enumeration_Representation_Clause_Access is begin return Program.Elements.Enumeration_Representation_Clauses .Enumeration_Representation_Clause_Access (Self); end To_Enumeration_Representation_Clause; function To_Record_Representation_Clause (Self : access Element'Class) return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Access is begin return Program.Elements.Record_Representation_Clauses .Record_Representation_Clause_Access (Self); end To_Record_Representation_Clause; function To_At_Clause (Self : access Element'Class) return Program.Elements.At_Clauses.At_Clause_Access is begin return Program.Elements.At_Clauses.At_Clause_Access (Self); end To_At_Clause; function To_Exception_Handler (Self : access Element'Class) return Program.Elements.Exception_Handlers.Exception_Handler_Access is begin return Program.Elements.Exception_Handlers.Exception_Handler_Access (Self); end To_Exception_Handler; end Program.Elements;
[ { "context": "e\nEPL.Types;\n\n-- Edward Parse Library.\n--\n-- ©2015 E. Fish; All Rights Reserved.\nFunction EPL.Bracket( Data ", "end": 135, "score": 0.9997391104698181, "start": 128, "tag": "NAME", "value": "E. Fish" } ]
src/epl-bracket.ads
OneWingedShark/Risi
1
Pragma Ada_2012; Pragma Wide_Character_Encoding( UTF8 ); With EPL.Types; Use EPL.Types; -- Edward Parse Library. -- -- ©2015 E. Fish; All Rights Reserved. Function EPL.Bracket( Data : String; Style : Bracket ) return String;
22455
Pragma Ada_2012; Pragma Wide_Character_Encoding( UTF8 ); With EPL.Types; Use EPL.Types; -- Edward Parse Library. -- -- ©2015 <NAME>; All Rights Reserved. Function EPL.Bracket( Data : String; Style : Bracket ) return String;
true
Pragma Ada_2012; Pragma Wide_Character_Encoding( UTF8 ); With EPL.Types; Use EPL.Types; -- Edward Parse Library. -- -- ©2015 PI:NAME:<NAME>END_PI; All Rights Reserved. Function EPL.Bracket( Data : String; Style : Bracket ) return String;
[ { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998659491539001, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999306201934814, "start": 45, "tag": "EMAIL", "value": "[email protected]" } ]
source/nodes/program-storage_pools-instance.ads
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package Program.Storage_Pools.Instance is Pool : aliased Storage_Pool; Pool_Access : constant Storage_Pool_Access := Pool'Access with Export, External_Name => "pool_access"; end Program.Storage_Pools.Instance;
26025
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package Program.Storage_Pools.Instance is Pool : aliased Storage_Pool; Pool_Access : constant Storage_Pool_Access := Pool'Access with Export, External_Name => "pool_access"; end Program.Storage_Pools.Instance;
true
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package Program.Storage_Pools.Instance is Pool : aliased Storage_Pool; Pool_Access : constant Storage_Pool_Access := Pool'Access with Export, External_Name => "pool_access"; end Program.Storage_Pools.Instance;
[ { "context": "lications\n-- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 204, "score": 0.9998635053634644, "start": 189, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9, 2010, 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 235, "score": 0.9998801946640015, "start": 220, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "2 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 262, "score": 0.9999293088912964, "start": 237, "tag": "EMAIL", "value": "[email protected]" } ]
src/asf-applications-main-configs.ads
Letractively/ada-asf
0
----------------------------------------------------------------------- -- applications-main-configs -- Configuration support for ASF Applications -- Copyright (C) 2009, 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 EL.Contexts.Default; with EL.Contexts.Properties; with ASF.Contexts.Faces; with ASF.Applications.Main; with Util.Beans.Objects; with Util.Serialize.IO.XML; with Util.Serialize.Mappers.Record_Mapper; package ASF.Applications.Main.Configs is -- Read the configuration file associated with the application. This includes: -- <ul> -- <li>The servlet and filter mappings</li> -- <li>The managed bean definitions</li> -- <li>The navigation rules</li> -- </ul> procedure Read_Configuration (App : in out Application'Class; File : in String); -- Setup the XML parser to read the managed bean definitions. -- By instantiating this package, the <b>Reader</b> gets populated with the XML mappings -- to read the servlet, managed beans and navigation rules. generic Reader : in out Util.Serialize.IO.XML.Parser; App : in ASF.Contexts.Faces.Application_Access; Context : in EL.Contexts.Default.Default_Context_Access; package Reader_Config is Prop_Context : aliased EL.Contexts.Properties.Property_Resolver; end Reader_Config; -- Create the configuration parameter definition instance. generic -- The parameter name. Name : in String; -- The default value. Default : in String; package Parameter is -- Returns the configuration parameter. function P return Config_Param; pragma Inline_Always (P); end Parameter; -- ------------------------------ -- Application Specific Configuration -- ------------------------------ -- Read the application specific configuration by using the XML mapper. -- The application configuration looks like: -- -- <application> -- <message-bundle>name</message-bundle> -- <message-bundle var='name'>bundle-name</message-bundle> -- </application> -- type Application_Config is limited record Name : Util.Beans.Objects.Object; App : ASF.Contexts.Faces.Application_Access; end record; type Application_Config_Access is access all Application_Config; type Application_Fields is (TAG_MESSAGE_BUNDLE, TAG_MESSAGE_VAR, TAG_DEFAULT_LOCALE, TAG_SUPPORTED_LOCALE); -- Save in the application config object the value associated with the given field. -- When the <b>TAG_MESSAGE_BUNDLE</b> field is reached, insert the new bundle definition -- in the application. procedure Set_Member (N : in out Application_Config; Field : in Application_Fields; Value : in Util.Beans.Objects.Object); private package Application_Mapper is new Util.Serialize.Mappers.Record_Mapper (Element_Type => Application_Config, Element_Type_Access => Application_Config_Access, Fields => Application_Fields, Set_Member => Set_Member); end ASF.Applications.Main.Configs;
25857
----------------------------------------------------------------------- -- applications-main-configs -- Configuration support for ASF Applications -- Copyright (C) 2009, 2010, 2011, 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Contexts.Default; with EL.Contexts.Properties; with ASF.Contexts.Faces; with ASF.Applications.Main; with Util.Beans.Objects; with Util.Serialize.IO.XML; with Util.Serialize.Mappers.Record_Mapper; package ASF.Applications.Main.Configs is -- Read the configuration file associated with the application. This includes: -- <ul> -- <li>The servlet and filter mappings</li> -- <li>The managed bean definitions</li> -- <li>The navigation rules</li> -- </ul> procedure Read_Configuration (App : in out Application'Class; File : in String); -- Setup the XML parser to read the managed bean definitions. -- By instantiating this package, the <b>Reader</b> gets populated with the XML mappings -- to read the servlet, managed beans and navigation rules. generic Reader : in out Util.Serialize.IO.XML.Parser; App : in ASF.Contexts.Faces.Application_Access; Context : in EL.Contexts.Default.Default_Context_Access; package Reader_Config is Prop_Context : aliased EL.Contexts.Properties.Property_Resolver; end Reader_Config; -- Create the configuration parameter definition instance. generic -- The parameter name. Name : in String; -- The default value. Default : in String; package Parameter is -- Returns the configuration parameter. function P return Config_Param; pragma Inline_Always (P); end Parameter; -- ------------------------------ -- Application Specific Configuration -- ------------------------------ -- Read the application specific configuration by using the XML mapper. -- The application configuration looks like: -- -- <application> -- <message-bundle>name</message-bundle> -- <message-bundle var='name'>bundle-name</message-bundle> -- </application> -- type Application_Config is limited record Name : Util.Beans.Objects.Object; App : ASF.Contexts.Faces.Application_Access; end record; type Application_Config_Access is access all Application_Config; type Application_Fields is (TAG_MESSAGE_BUNDLE, TAG_MESSAGE_VAR, TAG_DEFAULT_LOCALE, TAG_SUPPORTED_LOCALE); -- Save in the application config object the value associated with the given field. -- When the <b>TAG_MESSAGE_BUNDLE</b> field is reached, insert the new bundle definition -- in the application. procedure Set_Member (N : in out Application_Config; Field : in Application_Fields; Value : in Util.Beans.Objects.Object); private package Application_Mapper is new Util.Serialize.Mappers.Record_Mapper (Element_Type => Application_Config, Element_Type_Access => Application_Config_Access, Fields => Application_Fields, Set_Member => Set_Member); end ASF.Applications.Main.Configs;
true
----------------------------------------------------------------------- -- applications-main-configs -- Configuration support for ASF Applications -- Copyright (C) 2009, 2010, 2011, 2012 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Contexts.Default; with EL.Contexts.Properties; with ASF.Contexts.Faces; with ASF.Applications.Main; with Util.Beans.Objects; with Util.Serialize.IO.XML; with Util.Serialize.Mappers.Record_Mapper; package ASF.Applications.Main.Configs is -- Read the configuration file associated with the application. This includes: -- <ul> -- <li>The servlet and filter mappings</li> -- <li>The managed bean definitions</li> -- <li>The navigation rules</li> -- </ul> procedure Read_Configuration (App : in out Application'Class; File : in String); -- Setup the XML parser to read the managed bean definitions. -- By instantiating this package, the <b>Reader</b> gets populated with the XML mappings -- to read the servlet, managed beans and navigation rules. generic Reader : in out Util.Serialize.IO.XML.Parser; App : in ASF.Contexts.Faces.Application_Access; Context : in EL.Contexts.Default.Default_Context_Access; package Reader_Config is Prop_Context : aliased EL.Contexts.Properties.Property_Resolver; end Reader_Config; -- Create the configuration parameter definition instance. generic -- The parameter name. Name : in String; -- The default value. Default : in String; package Parameter is -- Returns the configuration parameter. function P return Config_Param; pragma Inline_Always (P); end Parameter; -- ------------------------------ -- Application Specific Configuration -- ------------------------------ -- Read the application specific configuration by using the XML mapper. -- The application configuration looks like: -- -- <application> -- <message-bundle>name</message-bundle> -- <message-bundle var='name'>bundle-name</message-bundle> -- </application> -- type Application_Config is limited record Name : Util.Beans.Objects.Object; App : ASF.Contexts.Faces.Application_Access; end record; type Application_Config_Access is access all Application_Config; type Application_Fields is (TAG_MESSAGE_BUNDLE, TAG_MESSAGE_VAR, TAG_DEFAULT_LOCALE, TAG_SUPPORTED_LOCALE); -- Save in the application config object the value associated with the given field. -- When the <b>TAG_MESSAGE_BUNDLE</b> field is reached, insert the new bundle definition -- in the application. procedure Set_Member (N : in out Application_Config; Field : in Application_Fields; Value : in Util.Beans.Objects.Object); private package Application_Mapper is new Util.Serialize.Mappers.Record_Mapper (Element_Type => Application_Config, Element_Type_Access => Application_Config_Access, Fields => Application_Fields, Set_Member => Set_Member); end ASF.Applications.Main.Configs;
[ { "context": " -- Stream management\n-- Copyright (C) 2014, 2015 Stephane.Carrez\n-- Written by Stephane.Carrez (Stephane.Carrez@g", "end": 155, "score": 0.9998760223388672, "start": 140, "tag": "NAME", "value": "Stephane.Carrez" }, { "context": "ight (C) 2014, 2015 Stephane.Carrez\n-- Written by Stephane.Carrez ([email protected])\n--\n-- Licensed under", "end": 186, "score": 0.9998784065246582, "start": 171, "tag": "NAME", "value": "Stephane.Carrez" }, { "context": "5 Stephane.Carrez\n-- Written by Stephane.Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 213, "score": 0.9999254941940308, "start": 188, "tag": "EMAIL", "value": "[email protected]" } ]
src/babel-streams-refs.adb
stcarrez/babel
1
----------------------------------------------------------------------- -- babel-Streams -- Stream management -- Copyright (C) 2014, 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. ----------------------------------------------------------------------- package body Babel.Streams.Refs is procedure Copy (From : in Stream_Ref; Into : in Stream_Ref) is use type Babel.Files.Buffers.Buffer_Access; From_Stream : constant Stream_Access := From.Value; Into_Stream : constant Stream_Access := Into.Value; Buffer : Babel.Files.Buffers.Buffer_Access; begin From_Stream.Rewind; loop From_Stream.Read (Buffer); exit when Buffer = null; Into_Stream.Write (Buffer); end loop; end Copy; end Babel.Streams.Refs;
23076
----------------------------------------------------------------------- -- babel-Streams -- Stream management -- Copyright (C) 2014, 2015 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Babel.Streams.Refs is procedure Copy (From : in Stream_Ref; Into : in Stream_Ref) is use type Babel.Files.Buffers.Buffer_Access; From_Stream : constant Stream_Access := From.Value; Into_Stream : constant Stream_Access := Into.Value; Buffer : Babel.Files.Buffers.Buffer_Access; begin From_Stream.Rewind; loop From_Stream.Read (Buffer); exit when Buffer = null; Into_Stream.Write (Buffer); end loop; end Copy; end Babel.Streams.Refs;
true
----------------------------------------------------------------------- -- babel-Streams -- Stream management -- Copyright (C) 2014, 2015 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Babel.Streams.Refs is procedure Copy (From : in Stream_Ref; Into : in Stream_Ref) is use type Babel.Files.Buffers.Buffer_Access; From_Stream : constant Stream_Access := From.Value; Into_Stream : constant Stream_Access := Into.Value; Buffer : Babel.Files.Buffers.Buffer_Access; begin From_Stream.Rewind; loop From_Stream.Read (Buffer); exit when Buffer = null; Into_Stream.Write (Buffer); end loop; end Copy; end Babel.Streams.Refs;
[ { "context": "-- part of AdaYaml, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 42, "score": 0.9998409152030945, "start": 30, "tag": "NAME", "value": "Felix Krause" } ]
src/implementation/yaml-transformation.adb
persan/AdaYaml
32
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Unchecked_Deallocation; package body Yaml.Transformation is procedure Adjust (Object : in out Reference) is begin Increase_Refcount (Object.Data); end Adjust; procedure Finalize (Object : in out Reference) is begin Decrease_Refcount (Object.Data); end Finalize; procedure Finalize (Object : in out Instance) is procedure Free is new Ada.Unchecked_Deallocation (Transformator.Instance'Class, Transformator.Pointer); begin for Element of Object.Transformators loop declare Ptr : Transformator.Pointer := Element; begin Free (Ptr); end; end loop; end Finalize; function Transform (Original : Stream_Impl.Reference) return Instance is begin return (Refcount_Base with Original => Original, Transformators => <>); end Transform; function Transform (Original : Stream_Impl.Reference) return Reference is Ptr : constant not null Instance_Access := new Instance'(Refcount_Base with Original => Original, Transformators => <>); begin return (Ada.Finalization.Controlled with Data => Ptr); end Transform; function Value (Object : Reference) return Accessor is ((Data => Object.Data.all'Access)); function Next (Object : in out Instance) return Event is use type Transformator_Vectors.Cursor; Cursor : Transformator_Vectors.Cursor := Object.Transformators.Last; Current : Event; begin Outer : loop while Cursor /= Transformator_Vectors.No_Element loop exit when Transformator_Vectors.Element (Cursor).Has_Next; Transformator_Vectors.Previous (Cursor); end loop; if Cursor = Transformator_Vectors.No_Element then Current := Stream_Impl.Next (Stream_Impl.Value (Object.Original).Data.all); Cursor := Object.Transformators.First; else Current := Transformator_Vectors.Element (Cursor).Next; Transformator_Vectors.Next (Cursor); end if; loop exit Outer when Cursor = Transformator_Vectors.No_Element; Transformator_Vectors.Element (Cursor).Put (Current); exit when not Transformator_Vectors.Element (Cursor).Has_Next; Current := Transformator_Vectors.Element (Cursor).Next; Transformator_Vectors.Next (Cursor); end loop; Transformator_Vectors.Previous (Cursor); end loop Outer; return Current; end Next; procedure Append (Object : in out Instance; T : not null Transformator.Pointer) is begin Object.Transformators.Append (T); end Append; end Yaml.Transformation;
4099
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Unchecked_Deallocation; package body Yaml.Transformation is procedure Adjust (Object : in out Reference) is begin Increase_Refcount (Object.Data); end Adjust; procedure Finalize (Object : in out Reference) is begin Decrease_Refcount (Object.Data); end Finalize; procedure Finalize (Object : in out Instance) is procedure Free is new Ada.Unchecked_Deallocation (Transformator.Instance'Class, Transformator.Pointer); begin for Element of Object.Transformators loop declare Ptr : Transformator.Pointer := Element; begin Free (Ptr); end; end loop; end Finalize; function Transform (Original : Stream_Impl.Reference) return Instance is begin return (Refcount_Base with Original => Original, Transformators => <>); end Transform; function Transform (Original : Stream_Impl.Reference) return Reference is Ptr : constant not null Instance_Access := new Instance'(Refcount_Base with Original => Original, Transformators => <>); begin return (Ada.Finalization.Controlled with Data => Ptr); end Transform; function Value (Object : Reference) return Accessor is ((Data => Object.Data.all'Access)); function Next (Object : in out Instance) return Event is use type Transformator_Vectors.Cursor; Cursor : Transformator_Vectors.Cursor := Object.Transformators.Last; Current : Event; begin Outer : loop while Cursor /= Transformator_Vectors.No_Element loop exit when Transformator_Vectors.Element (Cursor).Has_Next; Transformator_Vectors.Previous (Cursor); end loop; if Cursor = Transformator_Vectors.No_Element then Current := Stream_Impl.Next (Stream_Impl.Value (Object.Original).Data.all); Cursor := Object.Transformators.First; else Current := Transformator_Vectors.Element (Cursor).Next; Transformator_Vectors.Next (Cursor); end if; loop exit Outer when Cursor = Transformator_Vectors.No_Element; Transformator_Vectors.Element (Cursor).Put (Current); exit when not Transformator_Vectors.Element (Cursor).Has_Next; Current := Transformator_Vectors.Element (Cursor).Next; Transformator_Vectors.Next (Cursor); end loop; Transformator_Vectors.Previous (Cursor); end loop Outer; return Current; end Next; procedure Append (Object : in out Instance; T : not null Transformator.Pointer) is begin Object.Transformators.Append (T); end Append; end Yaml.Transformation;
true
-- part of AdaYaml, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Unchecked_Deallocation; package body Yaml.Transformation is procedure Adjust (Object : in out Reference) is begin Increase_Refcount (Object.Data); end Adjust; procedure Finalize (Object : in out Reference) is begin Decrease_Refcount (Object.Data); end Finalize; procedure Finalize (Object : in out Instance) is procedure Free is new Ada.Unchecked_Deallocation (Transformator.Instance'Class, Transformator.Pointer); begin for Element of Object.Transformators loop declare Ptr : Transformator.Pointer := Element; begin Free (Ptr); end; end loop; end Finalize; function Transform (Original : Stream_Impl.Reference) return Instance is begin return (Refcount_Base with Original => Original, Transformators => <>); end Transform; function Transform (Original : Stream_Impl.Reference) return Reference is Ptr : constant not null Instance_Access := new Instance'(Refcount_Base with Original => Original, Transformators => <>); begin return (Ada.Finalization.Controlled with Data => Ptr); end Transform; function Value (Object : Reference) return Accessor is ((Data => Object.Data.all'Access)); function Next (Object : in out Instance) return Event is use type Transformator_Vectors.Cursor; Cursor : Transformator_Vectors.Cursor := Object.Transformators.Last; Current : Event; begin Outer : loop while Cursor /= Transformator_Vectors.No_Element loop exit when Transformator_Vectors.Element (Cursor).Has_Next; Transformator_Vectors.Previous (Cursor); end loop; if Cursor = Transformator_Vectors.No_Element then Current := Stream_Impl.Next (Stream_Impl.Value (Object.Original).Data.all); Cursor := Object.Transformators.First; else Current := Transformator_Vectors.Element (Cursor).Next; Transformator_Vectors.Next (Cursor); end if; loop exit Outer when Cursor = Transformator_Vectors.No_Element; Transformator_Vectors.Element (Cursor).Put (Current); exit when not Transformator_Vectors.Element (Cursor).Has_Next; Current := Transformator_Vectors.Element (Cursor).Next; Transformator_Vectors.Next (Cursor); end loop; Transformator_Vectors.Previous (Cursor); end loop Outer; return Current; end Next; procedure Append (Object : in out Instance; T : not null Transformator.Pointer) is begin Object.Transformators.Append (T); end Append; end Yaml.Transformation;
[ { "context": "-- MIT License\n--\n-- Copyright (c) 2020 Max Reznik\n--\n-- Permission is hereby granted, free of char", "end": 52, "score": 0.9998067617416382, "start": 42, "tag": "NAME", "value": "Max Reznik" } ]
source/runtime/pb_support-memory_streams.adb
mgrojo/protobuf
12
-- MIT License -- -- Copyright (c) 2020 Max Reznik -- -- Permission is hereby granted, free of charge, to any person obtaining a -- copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation -- the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. package body PB_Support.Memory_Streams is ----------- -- Clear -- ----------- procedure Clear (Self : in out Memory_Stream'Class) is begin Self.Data.Clear; Self.Read := 0; end Clear; ---------- -- Data -- ---------- function Data (Self : Memory_Stream'Class) return League.Stream_Element_Vectors.Stream_Element_Vector is begin return Self.Data; end Data; ---------- -- Read -- ---------- overriding procedure Read (Self : in out Memory_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is use type Ada.Streams.Stream_Element_Offset; Count : constant Ada.Streams.Stream_Element_Offset := Ada.Streams.Stream_Element_Offset'Min (Item'Length, Self.Data.Length - Self.Read); begin for J in 1 .. Count loop Item (Item'First + J - 1) := Self.Data.Element (Self.Read + J); end loop; Last := Item'First + Count - 1; Self.Read := Self.Read + Count; end Read; ----------- -- Write -- ----------- overriding procedure Write (Self : in out Memory_Stream; Item : Ada.Streams.Stream_Element_Array) is begin Self.Data.Append (Item); end Write; ------------- -- Written -- ------------- function Written (Self : Memory_Stream'Class) return Ada.Streams.Stream_Element_Count is begin return Self.Data.Length; end Written; end PB_Support.Memory_Streams;
8616
-- MIT License -- -- Copyright (c) 2020 <NAME> -- -- Permission is hereby granted, free of charge, to any person obtaining a -- copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation -- the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. package body PB_Support.Memory_Streams is ----------- -- Clear -- ----------- procedure Clear (Self : in out Memory_Stream'Class) is begin Self.Data.Clear; Self.Read := 0; end Clear; ---------- -- Data -- ---------- function Data (Self : Memory_Stream'Class) return League.Stream_Element_Vectors.Stream_Element_Vector is begin return Self.Data; end Data; ---------- -- Read -- ---------- overriding procedure Read (Self : in out Memory_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is use type Ada.Streams.Stream_Element_Offset; Count : constant Ada.Streams.Stream_Element_Offset := Ada.Streams.Stream_Element_Offset'Min (Item'Length, Self.Data.Length - Self.Read); begin for J in 1 .. Count loop Item (Item'First + J - 1) := Self.Data.Element (Self.Read + J); end loop; Last := Item'First + Count - 1; Self.Read := Self.Read + Count; end Read; ----------- -- Write -- ----------- overriding procedure Write (Self : in out Memory_Stream; Item : Ada.Streams.Stream_Element_Array) is begin Self.Data.Append (Item); end Write; ------------- -- Written -- ------------- function Written (Self : Memory_Stream'Class) return Ada.Streams.Stream_Element_Count is begin return Self.Data.Length; end Written; end PB_Support.Memory_Streams;
true
-- MIT License -- -- Copyright (c) 2020 PI:NAME:<NAME>END_PI -- -- Permission is hereby granted, free of charge, to any person obtaining a -- copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation -- the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. package body PB_Support.Memory_Streams is ----------- -- Clear -- ----------- procedure Clear (Self : in out Memory_Stream'Class) is begin Self.Data.Clear; Self.Read := 0; end Clear; ---------- -- Data -- ---------- function Data (Self : Memory_Stream'Class) return League.Stream_Element_Vectors.Stream_Element_Vector is begin return Self.Data; end Data; ---------- -- Read -- ---------- overriding procedure Read (Self : in out Memory_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is use type Ada.Streams.Stream_Element_Offset; Count : constant Ada.Streams.Stream_Element_Offset := Ada.Streams.Stream_Element_Offset'Min (Item'Length, Self.Data.Length - Self.Read); begin for J in 1 .. Count loop Item (Item'First + J - 1) := Self.Data.Element (Self.Read + J); end loop; Last := Item'First + Count - 1; Self.Read := Self.Read + Count; end Read; ----------- -- Write -- ----------- overriding procedure Write (Self : in out Memory_Stream; Item : Ada.Streams.Stream_Element_Array) is begin Self.Data.Append (Item); end Write; ------------- -- Written -- ------------- function Written (Self : Memory_Stream'Class) return Ada.Streams.Stream_Element_Count is begin return Self.Data.Length; end Written; end PB_Support.Memory_Streams;
[ { "context": "-- SPDX-FileCopyrightText: 2022 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.999854564666748, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2022 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999302625656128, "start": 45, "tag": "EMAIL", "value": "[email protected]" } ]
source/regions/regions-contexts-environments-nodes.ads
reznikmm/declarative-regions
0
-- SPDX-FileCopyrightText: 2022 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Unchecked_Deallocation; with Regions.Entities; with Regions.Shared_Hashed_Maps; private package Regions.Contexts.Environments.Nodes is pragma Preelaborate; type Entity_Node is tagged limited null record; type Entity_Node_Access is access all Entity_Node'Class; function Hash (List : Selected_Entity_Name) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (List)); procedure Free is new Ada.Unchecked_Deallocation (Entity_Node'Class, Entity_Node_Access); package Node_Maps is new Regions.Shared_Hashed_Maps (Selected_Entity_Name, Entity_Node_Access, Ada.Containers.Hash_Type, Regions.Contexts.Change_Count, Hash, "=", "=", Free); package Entity_Maps is new Ada.Containers.Hashed_Maps (Selected_Entity_Name, Regions.Entities.Entity_Access, Hash, "=", Regions.Entities."="); type Environment_Node; function Empty_Map (Self : access Environment_Node) return Node_Maps.Map; type Environment_Node (Context : access Regions.Contexts.Context) is tagged limited record Counter : Natural := 1; Nodes : Node_Maps.Map := Empty_Map (Environment_Node'Unchecked_Access); Cache : Entity_Maps.Map; Nested : Selected_Entity_Name_Lists.List; end record; function Get_Entity (Self : in out Environment_Node'Class; Name : Selected_Entity_Name) return Regions.Entities.Entity_Access; procedure Reference (Self : in out Environment_Node'Class); procedure Unreference (Self : in out Environment_Node'Class; Last : out Boolean); type Base_Entity (Env : not null Environment_Node_Access) is abstract limited new Regions.Entities.Entity with record Name : Selected_Entity_Name; end record; end Regions.Contexts.Environments.Nodes;
16013
-- SPDX-FileCopyrightText: 2022 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Unchecked_Deallocation; with Regions.Entities; with Regions.Shared_Hashed_Maps; private package Regions.Contexts.Environments.Nodes is pragma Preelaborate; type Entity_Node is tagged limited null record; type Entity_Node_Access is access all Entity_Node'Class; function Hash (List : Selected_Entity_Name) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (List)); procedure Free is new Ada.Unchecked_Deallocation (Entity_Node'Class, Entity_Node_Access); package Node_Maps is new Regions.Shared_Hashed_Maps (Selected_Entity_Name, Entity_Node_Access, Ada.Containers.Hash_Type, Regions.Contexts.Change_Count, Hash, "=", "=", Free); package Entity_Maps is new Ada.Containers.Hashed_Maps (Selected_Entity_Name, Regions.Entities.Entity_Access, Hash, "=", Regions.Entities."="); type Environment_Node; function Empty_Map (Self : access Environment_Node) return Node_Maps.Map; type Environment_Node (Context : access Regions.Contexts.Context) is tagged limited record Counter : Natural := 1; Nodes : Node_Maps.Map := Empty_Map (Environment_Node'Unchecked_Access); Cache : Entity_Maps.Map; Nested : Selected_Entity_Name_Lists.List; end record; function Get_Entity (Self : in out Environment_Node'Class; Name : Selected_Entity_Name) return Regions.Entities.Entity_Access; procedure Reference (Self : in out Environment_Node'Class); procedure Unreference (Self : in out Environment_Node'Class; Last : out Boolean); type Base_Entity (Env : not null Environment_Node_Access) is abstract limited new Regions.Entities.Entity with record Name : Selected_Entity_Name; end record; end Regions.Contexts.Environments.Nodes;
true
-- SPDX-FileCopyrightText: 2022 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Unchecked_Deallocation; with Regions.Entities; with Regions.Shared_Hashed_Maps; private package Regions.Contexts.Environments.Nodes is pragma Preelaborate; type Entity_Node is tagged limited null record; type Entity_Node_Access is access all Entity_Node'Class; function Hash (List : Selected_Entity_Name) return Ada.Containers.Hash_Type is (Ada.Containers.Hash_Type'Mod (List)); procedure Free is new Ada.Unchecked_Deallocation (Entity_Node'Class, Entity_Node_Access); package Node_Maps is new Regions.Shared_Hashed_Maps (Selected_Entity_Name, Entity_Node_Access, Ada.Containers.Hash_Type, Regions.Contexts.Change_Count, Hash, "=", "=", Free); package Entity_Maps is new Ada.Containers.Hashed_Maps (Selected_Entity_Name, Regions.Entities.Entity_Access, Hash, "=", Regions.Entities."="); type Environment_Node; function Empty_Map (Self : access Environment_Node) return Node_Maps.Map; type Environment_Node (Context : access Regions.Contexts.Context) is tagged limited record Counter : Natural := 1; Nodes : Node_Maps.Map := Empty_Map (Environment_Node'Unchecked_Access); Cache : Entity_Maps.Map; Nested : Selected_Entity_Name_Lists.List; end record; function Get_Entity (Self : in out Environment_Node'Class; Name : Selected_Entity_Name) return Regions.Entities.Entity_Access; procedure Reference (Self : in out Environment_Node'Class); procedure Unreference (Self : in out Environment_Node'Class; Last : out Boolean); type Base_Entity (Env : not null Environment_Node_Access) is abstract limited new Regions.Entities.Entity with record Name : Selected_Entity_Name; end record; end Regions.Contexts.Environments.Nodes;
[ { "context": "-- part of AdaYaml, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 42, "score": 0.9998356103897095, "start": 30, "tag": "NAME", "value": "Felix Krause" } ]
test/src/yaml-dom-dumping-test.adb
robdaemon/AdaYaml
32
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with AUnit.Assertions; use AUnit.Assertions; package body Yaml.Dom.Dumping.Test is use type Text.Reference; procedure Register_Tests (T : in out TC) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Plain_Scalar_Document'Access, "Plain scalar document"); Register_Routine (T, Quoted_Scalar_Document'Access, "Quoted scalar document"); Register_Routine (T, Explicit_Document'Access, "Explicit document"); end Register_Tests; procedure Set_Up (T : in out TC) is begin T.Pool.Create (8092); end Set_Up; function Name (T : TC) return Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Dumping tests for DOM"); end Name; type Event_Array is array (Positive range <>) of Event; function To_String (Value : Properties) return String is ("{anchor: " & Value.Anchor & ", tag: " & Value.Tag & "}"); procedure Assert_Equal (Expected, Actual : Event) is begin Assert (Expected.Kind = Actual.Kind, "Event kinds differ (expected: " & Expected.Kind'Img & ", actual: " & Actual.Kind'Img & ")"); case Expected.Kind is when Document_Start => Assert (Expected.Implicit_Start = Actual.Implicit_Start, "implicit start differs (expected: " & Expected.Implicit_Start'Img & ", actual: " & Actual.Implicit_Start'Img); when Document_End => Assert (Expected.Implicit_End = Actual.Implicit_End, "implicit end differs (expected: " & Expected.Implicit_End'Img & ", actual: " & Actual.Implicit_End'Img); when Stream_Start | Stream_End | Annotation_End | Sequence_End | Mapping_End => null; when Mapping_Start | Sequence_Start => Assert (Expected.Collection_Style = Actual.Collection_Style, "styles differ (expected: " & Expected.Collection_Style'Img & ", actual: " & Actual.Collection_Style'Img & ")"); Assert (Expected.Collection_Properties = Actual.Collection_Properties, "properties differ (expected: " & To_String (Expected.Collection_Properties) & ", actual: " & To_String (Actual.Collection_Properties) & ")"); when Scalar => Assert (Expected.Scalar_Style = Actual.Scalar_Style, "styles differ (expected: " & Expected.Scalar_Style'Img & ", actual: " & Actual.Scalar_Style'Img & ")"); Assert (Expected.Scalar_Properties = Actual.Scalar_Properties, "properties differ (expected: " & To_String (Expected.Scalar_Properties) & ", actual: " & To_String (Actual.Scalar_Properties) & ")"); Assert (Expected.Content = Actual.Content, "content differs (expected: " & Expected.Content.Value.Data.all & ", actual: " & Actual.Content.Value.Data.all & ")"); when Annotation_Start => Assert (Expected.Annotation_Properties = Actual.Annotation_Properties, "properties differ (expected: " & To_String (Expected.Annotation_Properties) & ", actual: " & To_String (Actual.Annotation_Properties) & ")"); Assert (Expected.Name = Actual.Name, "name differs (expected: " & Expected.Name.Value.Data.all & ", actual: " & Actual.Name.Value.Data.all & ")"); when Alias => Assert (Expected.Target = Actual.Target, "name differs (expected: " & Expected.Target.Value.Data.all & ", actual: " & Actual.Target.Value.Data.all & ")"); end case; end Assert_Equal; procedure Assert_Equals (Doc : Document_Reference; Expected : Event_Array; Implicit_Start, Implicit_End : Boolean := True) is Actual : constant Events.Queue.Reference := To_Event_Queue (Doc); Expected_Index : Positive := Expected'First; Cur : Event; begin Assert (Actual.Value.Length > 2, "actual event sequence does not contain expected stream start / document start events"); Cur := Actual.Value.First; Assert_Equal ((Kind => Stream_Start, others => <>), Cur); Actual.Value.Dequeue; Cur := Actual.Value.First; Assert_Equal ((Kind => Document_Start, Implicit_Start => Implicit_Start, others => <>), Cur); Actual.Value.Dequeue; while Expected_Index <= Expected'Last loop declare Cur : constant Event := Actual.Value.First; begin Assert (Expected_Index <= Expected'Last, "Actual serialization contains more events than expected, first unexpected event: " & Cur.Kind'Img); Assert_Equal (Expected (Expected_Index), Cur); Expected_Index := Expected_Index + 1; end; Actual.Value.Dequeue; end loop; Assert (Actual.Value.Length = 2, "actual event sequence does not contain expected document end / stream end events"); Cur := Actual.Value.First; Assert_Equal ((Kind => Document_End, Implicit_End => Implicit_End, others => <>), Cur); Actual.Value.Dequeue; Cur := Actual.Value.First; Assert_Equal ((Kind => Stream_End, others => <>), Cur); Actual.Value.Dequeue; end Assert_Equals; procedure Plain_Scalar_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool); begin Doc.Set_Root (Doc.New_Scalar ("scalar")); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("scalar"), Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>))); end Plain_Scalar_Document; procedure Quoted_Scalar_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool); begin Doc.Set_Root (Doc.New_Scalar ("quoted scalar", Style => Double_Quoted)); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("quoted scalar"), Scalar_Style => Double_Quoted, Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>))); end Quoted_Scalar_Document; procedure Explicit_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool, False, False); begin Doc.Set_Root (Doc.New_Scalar ("explicit document", Style => Single_Quoted)); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("explicit document"), Scalar_Style => Single_Quoted, Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>)), False, False); end Explicit_Document; end Yaml.Dom.Dumping.Test;
4049
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with AUnit.Assertions; use AUnit.Assertions; package body Yaml.Dom.Dumping.Test is use type Text.Reference; procedure Register_Tests (T : in out TC) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Plain_Scalar_Document'Access, "Plain scalar document"); Register_Routine (T, Quoted_Scalar_Document'Access, "Quoted scalar document"); Register_Routine (T, Explicit_Document'Access, "Explicit document"); end Register_Tests; procedure Set_Up (T : in out TC) is begin T.Pool.Create (8092); end Set_Up; function Name (T : TC) return Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Dumping tests for DOM"); end Name; type Event_Array is array (Positive range <>) of Event; function To_String (Value : Properties) return String is ("{anchor: " & Value.Anchor & ", tag: " & Value.Tag & "}"); procedure Assert_Equal (Expected, Actual : Event) is begin Assert (Expected.Kind = Actual.Kind, "Event kinds differ (expected: " & Expected.Kind'Img & ", actual: " & Actual.Kind'Img & ")"); case Expected.Kind is when Document_Start => Assert (Expected.Implicit_Start = Actual.Implicit_Start, "implicit start differs (expected: " & Expected.Implicit_Start'Img & ", actual: " & Actual.Implicit_Start'Img); when Document_End => Assert (Expected.Implicit_End = Actual.Implicit_End, "implicit end differs (expected: " & Expected.Implicit_End'Img & ", actual: " & Actual.Implicit_End'Img); when Stream_Start | Stream_End | Annotation_End | Sequence_End | Mapping_End => null; when Mapping_Start | Sequence_Start => Assert (Expected.Collection_Style = Actual.Collection_Style, "styles differ (expected: " & Expected.Collection_Style'Img & ", actual: " & Actual.Collection_Style'Img & ")"); Assert (Expected.Collection_Properties = Actual.Collection_Properties, "properties differ (expected: " & To_String (Expected.Collection_Properties) & ", actual: " & To_String (Actual.Collection_Properties) & ")"); when Scalar => Assert (Expected.Scalar_Style = Actual.Scalar_Style, "styles differ (expected: " & Expected.Scalar_Style'Img & ", actual: " & Actual.Scalar_Style'Img & ")"); Assert (Expected.Scalar_Properties = Actual.Scalar_Properties, "properties differ (expected: " & To_String (Expected.Scalar_Properties) & ", actual: " & To_String (Actual.Scalar_Properties) & ")"); Assert (Expected.Content = Actual.Content, "content differs (expected: " & Expected.Content.Value.Data.all & ", actual: " & Actual.Content.Value.Data.all & ")"); when Annotation_Start => Assert (Expected.Annotation_Properties = Actual.Annotation_Properties, "properties differ (expected: " & To_String (Expected.Annotation_Properties) & ", actual: " & To_String (Actual.Annotation_Properties) & ")"); Assert (Expected.Name = Actual.Name, "name differs (expected: " & Expected.Name.Value.Data.all & ", actual: " & Actual.Name.Value.Data.all & ")"); when Alias => Assert (Expected.Target = Actual.Target, "name differs (expected: " & Expected.Target.Value.Data.all & ", actual: " & Actual.Target.Value.Data.all & ")"); end case; end Assert_Equal; procedure Assert_Equals (Doc : Document_Reference; Expected : Event_Array; Implicit_Start, Implicit_End : Boolean := True) is Actual : constant Events.Queue.Reference := To_Event_Queue (Doc); Expected_Index : Positive := Expected'First; Cur : Event; begin Assert (Actual.Value.Length > 2, "actual event sequence does not contain expected stream start / document start events"); Cur := Actual.Value.First; Assert_Equal ((Kind => Stream_Start, others => <>), Cur); Actual.Value.Dequeue; Cur := Actual.Value.First; Assert_Equal ((Kind => Document_Start, Implicit_Start => Implicit_Start, others => <>), Cur); Actual.Value.Dequeue; while Expected_Index <= Expected'Last loop declare Cur : constant Event := Actual.Value.First; begin Assert (Expected_Index <= Expected'Last, "Actual serialization contains more events than expected, first unexpected event: " & Cur.Kind'Img); Assert_Equal (Expected (Expected_Index), Cur); Expected_Index := Expected_Index + 1; end; Actual.Value.Dequeue; end loop; Assert (Actual.Value.Length = 2, "actual event sequence does not contain expected document end / stream end events"); Cur := Actual.Value.First; Assert_Equal ((Kind => Document_End, Implicit_End => Implicit_End, others => <>), Cur); Actual.Value.Dequeue; Cur := Actual.Value.First; Assert_Equal ((Kind => Stream_End, others => <>), Cur); Actual.Value.Dequeue; end Assert_Equals; procedure Plain_Scalar_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool); begin Doc.Set_Root (Doc.New_Scalar ("scalar")); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("scalar"), Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>))); end Plain_Scalar_Document; procedure Quoted_Scalar_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool); begin Doc.Set_Root (Doc.New_Scalar ("quoted scalar", Style => Double_Quoted)); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("quoted scalar"), Scalar_Style => Double_Quoted, Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>))); end Quoted_Scalar_Document; procedure Explicit_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool, False, False); begin Doc.Set_Root (Doc.New_Scalar ("explicit document", Style => Single_Quoted)); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("explicit document"), Scalar_Style => Single_Quoted, Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>)), False, False); end Explicit_Document; end Yaml.Dom.Dumping.Test;
true
-- part of AdaYaml, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "copying.txt" with AUnit.Assertions; use AUnit.Assertions; package body Yaml.Dom.Dumping.Test is use type Text.Reference; procedure Register_Tests (T : in out TC) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Plain_Scalar_Document'Access, "Plain scalar document"); Register_Routine (T, Quoted_Scalar_Document'Access, "Quoted scalar document"); Register_Routine (T, Explicit_Document'Access, "Explicit document"); end Register_Tests; procedure Set_Up (T : in out TC) is begin T.Pool.Create (8092); end Set_Up; function Name (T : TC) return Message_String is pragma Unreferenced (T); begin return AUnit.Format ("Dumping tests for DOM"); end Name; type Event_Array is array (Positive range <>) of Event; function To_String (Value : Properties) return String is ("{anchor: " & Value.Anchor & ", tag: " & Value.Tag & "}"); procedure Assert_Equal (Expected, Actual : Event) is begin Assert (Expected.Kind = Actual.Kind, "Event kinds differ (expected: " & Expected.Kind'Img & ", actual: " & Actual.Kind'Img & ")"); case Expected.Kind is when Document_Start => Assert (Expected.Implicit_Start = Actual.Implicit_Start, "implicit start differs (expected: " & Expected.Implicit_Start'Img & ", actual: " & Actual.Implicit_Start'Img); when Document_End => Assert (Expected.Implicit_End = Actual.Implicit_End, "implicit end differs (expected: " & Expected.Implicit_End'Img & ", actual: " & Actual.Implicit_End'Img); when Stream_Start | Stream_End | Annotation_End | Sequence_End | Mapping_End => null; when Mapping_Start | Sequence_Start => Assert (Expected.Collection_Style = Actual.Collection_Style, "styles differ (expected: " & Expected.Collection_Style'Img & ", actual: " & Actual.Collection_Style'Img & ")"); Assert (Expected.Collection_Properties = Actual.Collection_Properties, "properties differ (expected: " & To_String (Expected.Collection_Properties) & ", actual: " & To_String (Actual.Collection_Properties) & ")"); when Scalar => Assert (Expected.Scalar_Style = Actual.Scalar_Style, "styles differ (expected: " & Expected.Scalar_Style'Img & ", actual: " & Actual.Scalar_Style'Img & ")"); Assert (Expected.Scalar_Properties = Actual.Scalar_Properties, "properties differ (expected: " & To_String (Expected.Scalar_Properties) & ", actual: " & To_String (Actual.Scalar_Properties) & ")"); Assert (Expected.Content = Actual.Content, "content differs (expected: " & Expected.Content.Value.Data.all & ", actual: " & Actual.Content.Value.Data.all & ")"); when Annotation_Start => Assert (Expected.Annotation_Properties = Actual.Annotation_Properties, "properties differ (expected: " & To_String (Expected.Annotation_Properties) & ", actual: " & To_String (Actual.Annotation_Properties) & ")"); Assert (Expected.Name = Actual.Name, "name differs (expected: " & Expected.Name.Value.Data.all & ", actual: " & Actual.Name.Value.Data.all & ")"); when Alias => Assert (Expected.Target = Actual.Target, "name differs (expected: " & Expected.Target.Value.Data.all & ", actual: " & Actual.Target.Value.Data.all & ")"); end case; end Assert_Equal; procedure Assert_Equals (Doc : Document_Reference; Expected : Event_Array; Implicit_Start, Implicit_End : Boolean := True) is Actual : constant Events.Queue.Reference := To_Event_Queue (Doc); Expected_Index : Positive := Expected'First; Cur : Event; begin Assert (Actual.Value.Length > 2, "actual event sequence does not contain expected stream start / document start events"); Cur := Actual.Value.First; Assert_Equal ((Kind => Stream_Start, others => <>), Cur); Actual.Value.Dequeue; Cur := Actual.Value.First; Assert_Equal ((Kind => Document_Start, Implicit_Start => Implicit_Start, others => <>), Cur); Actual.Value.Dequeue; while Expected_Index <= Expected'Last loop declare Cur : constant Event := Actual.Value.First; begin Assert (Expected_Index <= Expected'Last, "Actual serialization contains more events than expected, first unexpected event: " & Cur.Kind'Img); Assert_Equal (Expected (Expected_Index), Cur); Expected_Index := Expected_Index + 1; end; Actual.Value.Dequeue; end loop; Assert (Actual.Value.Length = 2, "actual event sequence does not contain expected document end / stream end events"); Cur := Actual.Value.First; Assert_Equal ((Kind => Document_End, Implicit_End => Implicit_End, others => <>), Cur); Actual.Value.Dequeue; Cur := Actual.Value.First; Assert_Equal ((Kind => Stream_End, others => <>), Cur); Actual.Value.Dequeue; end Assert_Equals; procedure Plain_Scalar_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool); begin Doc.Set_Root (Doc.New_Scalar ("scalar")); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("scalar"), Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>))); end Plain_Scalar_Document; procedure Quoted_Scalar_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool); begin Doc.Set_Root (Doc.New_Scalar ("quoted scalar", Style => Double_Quoted)); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("quoted scalar"), Scalar_Style => Double_Quoted, Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>))); end Quoted_Scalar_Document; procedure Explicit_Document (T : in out Test_Cases.Test_Case'Class) is Doc : constant Document_Reference := New_Document (TC (T).Pool, False, False); begin Doc.Set_Root (Doc.New_Scalar ("explicit document", Style => Single_Quoted)); Assert_Equals (Doc, (1 => (Kind => Scalar, Content => TC (T).Pool.From_String ("explicit document"), Scalar_Style => Single_Quoted, Scalar_Properties => (Tag => Tags.Question_Mark, Anchor => <>), others => <>)), False, False); end Explicit_Document; end Yaml.Dom.Dumping.Test;
[ { "context": "rity Test suite\n-- Copyright (C) 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 171, "score": 0.9998811483383179, "start": 156, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "C) 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 202, "score": 0.9998865127563477, "start": 187, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "3 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 229, "score": 0.9999297857284546, "start": 204, "tag": "EMAIL", "value": "[email protected]" } ]
regtests/security-testsuite.adb
Letractively/ada-security
0
----------------------------------------------------------------------- -- Security testsuite - Ada Security Test suite -- Copyright (C) 2011, 2012, 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. ----------------------------------------------------------------------- with Security.Auth.Tests; with Security.Permissions.Tests; with Security.Policies.Tests; with Security.OAuth.JWT.Tests; with Security.OAuth.Clients.Tests; package body Security.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is Ret : constant Util.Tests.Access_Test_Suite := Tests'Access; begin Security.OAuth.JWT.Tests.Add_Tests (Ret); Security.Auth.Tests.Add_Tests (Ret); Security.Permissions.Tests.Add_Tests (Ret); Security.Policies.Tests.Add_Tests (Ret); Security.OAuth.Clients.Tests.Add_Tests (Ret); return Ret; end Suite; end Security.Testsuite;
29154
----------------------------------------------------------------------- -- Security testsuite - Ada Security Test suite -- Copyright (C) 2011, 2012, 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.Auth.Tests; with Security.Permissions.Tests; with Security.Policies.Tests; with Security.OAuth.JWT.Tests; with Security.OAuth.Clients.Tests; package body Security.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is Ret : constant Util.Tests.Access_Test_Suite := Tests'Access; begin Security.OAuth.JWT.Tests.Add_Tests (Ret); Security.Auth.Tests.Add_Tests (Ret); Security.Permissions.Tests.Add_Tests (Ret); Security.Policies.Tests.Add_Tests (Ret); Security.OAuth.Clients.Tests.Add_Tests (Ret); return Ret; end Suite; end Security.Testsuite;
true
----------------------------------------------------------------------- -- Security testsuite - Ada Security Test suite -- Copyright (C) 2011, 2012, 2013 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.Auth.Tests; with Security.Permissions.Tests; with Security.Policies.Tests; with Security.OAuth.JWT.Tests; with Security.OAuth.Clients.Tests; package body Security.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is Ret : constant Util.Tests.Access_Test_Suite := Tests'Access; begin Security.OAuth.JWT.Tests.Add_Tests (Ret); Security.Auth.Tests.Add_Tests (Ret); Security.Permissions.Tests.Add_Tests (Ret); Security.Policies.Tests.Add_Tests (Ret); Security.OAuth.Clients.Tests.Add_Tests (Ret); return Ret; end Suite; end Security.Testsuite;
[ { "context": " No_Element => No_Aspect,\n Key => Name_Id,\n Hash => AI_Hash,\n Equal ", "end": 5191, "score": 0.9619711637496948, "start": 5187, "tag": "NAME", "value": "Name" }, { "context": "o_Element => No_Aspect,\n Key => Name_Id,\n Hash => AI_Hash,\n Equal ", "end": 5194, "score": 0.5771170854568481, "start": 5192, "tag": "USERNAME", "value": "Id" } ]
Validation/pyFrame3DD-master/gcc-master/gcc/ada/aspects.adb
djamal2727/Main-Bearing-Analytical-Model
0
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A S P E C T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2010-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Nlists; use Nlists; with Sinfo; use Sinfo; with GNAT.HTable; package body Aspects is -- The following array indicates aspects that a subtype inherits from its -- base type. True means that the subtype inherits the aspect from its base -- type. False means it is not inherited. Base_Aspect : constant array (Aspect_Id) of Boolean := (Aspect_Atomic => True, Aspect_Atomic_Components => True, Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Discard_Names => True, Aspect_Independent_Components => True, Aspect_Iterator_Element => True, Aspect_Type_Invariant => True, Aspect_Unchecked_Union => True, Aspect_Variable_Indexing => True, Aspect_Volatile => True, Aspect_Volatile_Full_Access => True, others => False); -- The following array indicates type aspects that are inherited and apply -- to the class-wide type as well. Inherited_Aspect : constant array (Aspect_Id) of Boolean := (Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Implicit_Dereference => True, Aspect_Iterator_Element => True, Aspect_Remote_Types => True, Aspect_Variable_Indexing => True, others => False); ------------------------------------------ -- Hash Table for Aspect Specifications -- ------------------------------------------ type AS_Hash_Range is range 0 .. 510; -- Size of hash table headers function AS_Hash (F : Node_Id) return AS_Hash_Range; -- Hash function for hash table function AS_Hash (F : Node_Id) return AS_Hash_Range is begin return AS_Hash_Range (F mod 511); end AS_Hash; package Aspect_Specifications_Hash_Table is new GNAT.HTable.Simple_HTable (Header_Num => AS_Hash_Range, Element => List_Id, No_Element => No_List, Key => Node_Id, Hash => AS_Hash, Equal => "="); ------------------------------------- -- Hash Table for Aspect Id Values -- ------------------------------------- type AI_Hash_Range is range 0 .. 112; -- Size of hash table headers function AI_Hash (F : Name_Id) return AI_Hash_Range; -- Hash function for hash table function AI_Hash (F : Name_Id) return AI_Hash_Range is begin return AI_Hash_Range (F mod 113); end AI_Hash; package Aspect_Id_Hash_Table is new GNAT.HTable.Simple_HTable (Header_Num => AI_Hash_Range, Element => Aspect_Id, No_Element => No_Aspect, Key => Name_Id, Hash => AI_Hash, Equal => "="); --------------------------- -- Aspect_Specifications -- --------------------------- function Aspect_Specifications (N : Node_Id) return List_Id is begin if Has_Aspects (N) then return Aspect_Specifications_Hash_Table.Get (N); else return No_List; end if; end Aspect_Specifications; -------------------------------- -- Aspects_On_Body_Or_Stub_OK -- -------------------------------- function Aspects_On_Body_Or_Stub_OK (N : Node_Id) return Boolean is Aspect : Node_Id; Aspects : List_Id; begin -- The routine should be invoked on a body [stub] with aspects pragma Assert (Has_Aspects (N)); pragma Assert (Nkind (N) in N_Body_Stub | N_Entry_Body | N_Package_Body | N_Protected_Body | N_Subprogram_Body | N_Task_Body); -- Look through all aspects and see whether they can be applied to a -- body [stub]. Aspects := Aspect_Specifications (N); Aspect := First (Aspects); while Present (Aspect) loop if not Aspect_On_Body_Or_Stub_OK (Get_Aspect_Id (Aspect)) then return False; end if; Next (Aspect); end loop; return True; end Aspects_On_Body_Or_Stub_OK; ---------------------- -- Exchange_Aspects -- ---------------------- procedure Exchange_Aspects (N1 : Node_Id; N2 : Node_Id) is begin pragma Assert (Permits_Aspect_Specifications (N1) and then Permits_Aspect_Specifications (N2)); -- Perform the exchange only when both nodes have lists to be swapped if Has_Aspects (N1) and then Has_Aspects (N2) then declare L1 : constant List_Id := Aspect_Specifications (N1); L2 : constant List_Id := Aspect_Specifications (N2); begin Set_Parent (L1, N2); Set_Parent (L2, N1); Aspect_Specifications_Hash_Table.Set (N1, L2); Aspect_Specifications_Hash_Table.Set (N2, L1); end; end if; end Exchange_Aspects; ----------------- -- Find_Aspect -- ----------------- function Find_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id is Decl : Node_Id; Item : Node_Id; Owner : Entity_Id; Spec : Node_Id; begin Owner := Id; -- Handle various cases of base or inherited aspects for types if Is_Type (Id) then if Base_Aspect (A) then Owner := Base_Type (Owner); end if; if Is_Class_Wide_Type (Owner) and then Inherited_Aspect (A) then Owner := Root_Type (Owner); end if; if Is_Private_Type (Owner) and then Present (Full_View (Owner)) and then not Operational_Aspect (A) then Owner := Full_View (Owner); end if; end if; -- Search the representation items for the desired aspect Item := First_Rep_Item (Owner); while Present (Item) loop if Nkind (Item) = N_Aspect_Specification and then Get_Aspect_Id (Item) = A then return Item; end if; Next_Rep_Item (Item); end loop; -- Note that not all aspects are added to the chain of representation -- items. In such cases, search the list of aspect specifications. First -- find the declaration node where the aspects reside. This is usually -- the parent or the parent of the parent. Decl := Parent (Owner); if not Permits_Aspect_Specifications (Decl) then Decl := Parent (Decl); end if; -- Search the list of aspect specifications for the desired aspect if Permits_Aspect_Specifications (Decl) then Spec := First (Aspect_Specifications (Decl)); while Present (Spec) loop if Get_Aspect_Id (Spec) = A then return Spec; end if; Next (Spec); end loop; end if; -- The entity does not carry any aspects or the desired aspect was not -- found. return Empty; end Find_Aspect; -------------------------- -- Find_Value_Of_Aspect -- -------------------------- function Find_Value_Of_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id is Spec : constant Node_Id := Find_Aspect (Id, A); begin if Present (Spec) then if A = Aspect_Default_Iterator then return Expression (Aspect_Rep_Item (Spec)); else return Expression (Spec); end if; end if; return Empty; end Find_Value_Of_Aspect; ------------------- -- Get_Aspect_Id -- ------------------- function Get_Aspect_Id (Name : Name_Id) return Aspect_Id is begin return Aspect_Id_Hash_Table.Get (Name); end Get_Aspect_Id; function Get_Aspect_Id (Aspect : Node_Id) return Aspect_Id is begin pragma Assert (Nkind (Aspect) = N_Aspect_Specification); return Aspect_Id_Hash_Table.Get (Chars (Identifier (Aspect))); end Get_Aspect_Id; ---------------- -- Has_Aspect -- ---------------- function Has_Aspect (Id : Entity_Id; A : Aspect_Id) return Boolean is begin return Present (Find_Aspect (Id, A)); end Has_Aspect; ------------------ -- Move_Aspects -- ------------------ procedure Move_Aspects (From : Node_Id; To : Node_Id) is pragma Assert (not Has_Aspects (To)); begin if Has_Aspects (From) then Set_Aspect_Specifications (To, Aspect_Specifications (From)); Aspect_Specifications_Hash_Table.Remove (From); Set_Has_Aspects (From, False); end if; end Move_Aspects; --------------------------- -- Move_Or_Merge_Aspects -- --------------------------- procedure Move_Or_Merge_Aspects (From : Node_Id; To : Node_Id) is procedure Relocate_Aspect (Asp : Node_Id); -- Move aspect specification Asp to the aspect specifications of node To --------------------- -- Relocate_Aspect -- --------------------- procedure Relocate_Aspect (Asp : Node_Id) is Asps : List_Id; begin if Has_Aspects (To) then Asps := Aspect_Specifications (To); -- Create a new aspect specification list for node To else Asps := New_List; Set_Aspect_Specifications (To, Asps); Set_Has_Aspects (To); end if; -- Remove the aspect from its original owner and relocate it to node -- To. Remove (Asp); Append (Asp, Asps); end Relocate_Aspect; -- Local variables Asp : Node_Id; Asp_Id : Aspect_Id; Next_Asp : Node_Id; -- Start of processing for Move_Or_Merge_Aspects begin if Has_Aspects (From) then Asp := First (Aspect_Specifications (From)); while Present (Asp) loop -- Store the next aspect now as a potential relocation will alter -- the contents of the list. Next_Asp := Next (Asp); -- When moving or merging aspects from a subprogram body stub that -- also acts as a spec, relocate only those aspects that may apply -- to a body [stub]. Note that a precondition must also be moved -- to the proper body as the pre/post machinery expects it to be -- there. if Nkind (From) = N_Subprogram_Body_Stub and then No (Corresponding_Spec_Of_Stub (From)) then Asp_Id := Get_Aspect_Id (Asp); if Aspect_On_Body_Or_Stub_OK (Asp_Id) or else Asp_Id = Aspect_Pre or else Asp_Id = Aspect_Precondition then Relocate_Aspect (Asp); end if; -- When moving or merging aspects from a single concurrent type -- declaration, relocate only those aspects that may apply to the -- anonymous object created for the type. -- Note: It is better to use Is_Single_Concurrent_Type_Declaration -- here, but Aspects and Sem_Util have incompatible licenses. elsif Nkind (Original_Node (From)) in N_Single_Protected_Declaration | N_Single_Task_Declaration then Asp_Id := Get_Aspect_Id (Asp); if Aspect_On_Anonymous_Object_OK (Asp_Id) then Relocate_Aspect (Asp); end if; -- Default case - relocate the aspect to its new owner else Relocate_Aspect (Asp); end if; Asp := Next_Asp; end loop; -- The relocations may have left node From's aspect specifications -- list empty. If this is the case, simply remove the aspects. if Is_Empty_List (Aspect_Specifications (From)) then Remove_Aspects (From); end if; end if; end Move_Or_Merge_Aspects; ----------------------------------- -- Permits_Aspect_Specifications -- ----------------------------------- Has_Aspect_Specifications_Flag : constant array (Node_Kind) of Boolean := (N_Abstract_Subprogram_Declaration => True, N_Component_Declaration => True, N_Entry_Body => True, N_Entry_Declaration => True, N_Exception_Declaration => True, N_Exception_Renaming_Declaration => True, N_Expression_Function => True, N_Formal_Abstract_Subprogram_Declaration => True, N_Formal_Concrete_Subprogram_Declaration => True, N_Formal_Object_Declaration => True, N_Formal_Package_Declaration => True, N_Formal_Type_Declaration => True, N_Full_Type_Declaration => True, N_Function_Instantiation => True, N_Generic_Package_Declaration => True, N_Generic_Renaming_Declaration => True, N_Generic_Subprogram_Declaration => True, N_Object_Declaration => True, N_Object_Renaming_Declaration => True, N_Package_Body => True, N_Package_Body_Stub => True, N_Package_Declaration => True, N_Package_Instantiation => True, N_Package_Specification => True, N_Package_Renaming_Declaration => True, N_Parameter_Specification => True, N_Private_Extension_Declaration => True, N_Private_Type_Declaration => True, N_Procedure_Instantiation => True, N_Protected_Body => True, N_Protected_Body_Stub => True, N_Protected_Type_Declaration => True, N_Single_Protected_Declaration => True, N_Single_Task_Declaration => True, N_Subprogram_Body => True, N_Subprogram_Body_Stub => True, N_Subprogram_Declaration => True, N_Subprogram_Renaming_Declaration => True, N_Subtype_Declaration => True, N_Task_Body => True, N_Task_Body_Stub => True, N_Task_Type_Declaration => True, others => False); function Permits_Aspect_Specifications (N : Node_Id) return Boolean is begin return Has_Aspect_Specifications_Flag (Nkind (N)); end Permits_Aspect_Specifications; -------------------- -- Remove_Aspects -- -------------------- procedure Remove_Aspects (N : Node_Id) is begin if Has_Aspects (N) then Aspect_Specifications_Hash_Table.Remove (N); Set_Has_Aspects (N, False); end if; end Remove_Aspects; ----------------- -- Same_Aspect -- ----------------- -- Table used for Same_Aspect, maps aspect to canonical aspect type Aspect_To_Aspect_Mapping is array (Aspect_Id) of Aspect_Id; function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping; -- Initialize the Canonical_Aspect mapping below function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping is Result : Aspect_To_Aspect_Mapping; begin -- They all map to themselves... for Aspect in Aspect_Id loop Result (Aspect) := Aspect; end loop; -- ...except for these: Result (Aspect_Dynamic_Predicate) := Aspect_Predicate; Result (Aspect_Inline_Always) := Aspect_Inline; Result (Aspect_Interrupt_Priority) := Aspect_Priority; Result (Aspect_Postcondition) := Aspect_Post; Result (Aspect_Precondition) := Aspect_Pre; Result (Aspect_Shared) := Aspect_Atomic; Result (Aspect_Static_Predicate) := Aspect_Predicate; Result (Aspect_Type_Invariant) := Aspect_Invariant; return Result; end Init_Canonical_Aspect; Canonical_Aspect : constant Aspect_To_Aspect_Mapping := Init_Canonical_Aspect; function Same_Aspect (A1 : Aspect_Id; A2 : Aspect_Id) return Boolean is begin return Canonical_Aspect (A1) = Canonical_Aspect (A2); end Same_Aspect; ------------------------------- -- Set_Aspect_Specifications -- ------------------------------- procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id) is begin pragma Assert (Permits_Aspect_Specifications (N)); pragma Assert (not Has_Aspects (N)); pragma Assert (L /= No_List); Set_Has_Aspects (N); Set_Parent (L, N); Aspect_Specifications_Hash_Table.Set (N, L); end Set_Aspect_Specifications; -- Package initialization sets up Aspect Id hash table begin for J in Aspect_Id loop Aspect_Id_Hash_Table.Set (Aspect_Names (J), J); end loop; end Aspects;
30099
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A S P E C T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2010-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Nlists; use Nlists; with Sinfo; use Sinfo; with GNAT.HTable; package body Aspects is -- The following array indicates aspects that a subtype inherits from its -- base type. True means that the subtype inherits the aspect from its base -- type. False means it is not inherited. Base_Aspect : constant array (Aspect_Id) of Boolean := (Aspect_Atomic => True, Aspect_Atomic_Components => True, Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Discard_Names => True, Aspect_Independent_Components => True, Aspect_Iterator_Element => True, Aspect_Type_Invariant => True, Aspect_Unchecked_Union => True, Aspect_Variable_Indexing => True, Aspect_Volatile => True, Aspect_Volatile_Full_Access => True, others => False); -- The following array indicates type aspects that are inherited and apply -- to the class-wide type as well. Inherited_Aspect : constant array (Aspect_Id) of Boolean := (Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Implicit_Dereference => True, Aspect_Iterator_Element => True, Aspect_Remote_Types => True, Aspect_Variable_Indexing => True, others => False); ------------------------------------------ -- Hash Table for Aspect Specifications -- ------------------------------------------ type AS_Hash_Range is range 0 .. 510; -- Size of hash table headers function AS_Hash (F : Node_Id) return AS_Hash_Range; -- Hash function for hash table function AS_Hash (F : Node_Id) return AS_Hash_Range is begin return AS_Hash_Range (F mod 511); end AS_Hash; package Aspect_Specifications_Hash_Table is new GNAT.HTable.Simple_HTable (Header_Num => AS_Hash_Range, Element => List_Id, No_Element => No_List, Key => Node_Id, Hash => AS_Hash, Equal => "="); ------------------------------------- -- Hash Table for Aspect Id Values -- ------------------------------------- type AI_Hash_Range is range 0 .. 112; -- Size of hash table headers function AI_Hash (F : Name_Id) return AI_Hash_Range; -- Hash function for hash table function AI_Hash (F : Name_Id) return AI_Hash_Range is begin return AI_Hash_Range (F mod 113); end AI_Hash; package Aspect_Id_Hash_Table is new GNAT.HTable.Simple_HTable (Header_Num => AI_Hash_Range, Element => Aspect_Id, No_Element => No_Aspect, Key => <NAME>_Id, Hash => AI_Hash, Equal => "="); --------------------------- -- Aspect_Specifications -- --------------------------- function Aspect_Specifications (N : Node_Id) return List_Id is begin if Has_Aspects (N) then return Aspect_Specifications_Hash_Table.Get (N); else return No_List; end if; end Aspect_Specifications; -------------------------------- -- Aspects_On_Body_Or_Stub_OK -- -------------------------------- function Aspects_On_Body_Or_Stub_OK (N : Node_Id) return Boolean is Aspect : Node_Id; Aspects : List_Id; begin -- The routine should be invoked on a body [stub] with aspects pragma Assert (Has_Aspects (N)); pragma Assert (Nkind (N) in N_Body_Stub | N_Entry_Body | N_Package_Body | N_Protected_Body | N_Subprogram_Body | N_Task_Body); -- Look through all aspects and see whether they can be applied to a -- body [stub]. Aspects := Aspect_Specifications (N); Aspect := First (Aspects); while Present (Aspect) loop if not Aspect_On_Body_Or_Stub_OK (Get_Aspect_Id (Aspect)) then return False; end if; Next (Aspect); end loop; return True; end Aspects_On_Body_Or_Stub_OK; ---------------------- -- Exchange_Aspects -- ---------------------- procedure Exchange_Aspects (N1 : Node_Id; N2 : Node_Id) is begin pragma Assert (Permits_Aspect_Specifications (N1) and then Permits_Aspect_Specifications (N2)); -- Perform the exchange only when both nodes have lists to be swapped if Has_Aspects (N1) and then Has_Aspects (N2) then declare L1 : constant List_Id := Aspect_Specifications (N1); L2 : constant List_Id := Aspect_Specifications (N2); begin Set_Parent (L1, N2); Set_Parent (L2, N1); Aspect_Specifications_Hash_Table.Set (N1, L2); Aspect_Specifications_Hash_Table.Set (N2, L1); end; end if; end Exchange_Aspects; ----------------- -- Find_Aspect -- ----------------- function Find_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id is Decl : Node_Id; Item : Node_Id; Owner : Entity_Id; Spec : Node_Id; begin Owner := Id; -- Handle various cases of base or inherited aspects for types if Is_Type (Id) then if Base_Aspect (A) then Owner := Base_Type (Owner); end if; if Is_Class_Wide_Type (Owner) and then Inherited_Aspect (A) then Owner := Root_Type (Owner); end if; if Is_Private_Type (Owner) and then Present (Full_View (Owner)) and then not Operational_Aspect (A) then Owner := Full_View (Owner); end if; end if; -- Search the representation items for the desired aspect Item := First_Rep_Item (Owner); while Present (Item) loop if Nkind (Item) = N_Aspect_Specification and then Get_Aspect_Id (Item) = A then return Item; end if; Next_Rep_Item (Item); end loop; -- Note that not all aspects are added to the chain of representation -- items. In such cases, search the list of aspect specifications. First -- find the declaration node where the aspects reside. This is usually -- the parent or the parent of the parent. Decl := Parent (Owner); if not Permits_Aspect_Specifications (Decl) then Decl := Parent (Decl); end if; -- Search the list of aspect specifications for the desired aspect if Permits_Aspect_Specifications (Decl) then Spec := First (Aspect_Specifications (Decl)); while Present (Spec) loop if Get_Aspect_Id (Spec) = A then return Spec; end if; Next (Spec); end loop; end if; -- The entity does not carry any aspects or the desired aspect was not -- found. return Empty; end Find_Aspect; -------------------------- -- Find_Value_Of_Aspect -- -------------------------- function Find_Value_Of_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id is Spec : constant Node_Id := Find_Aspect (Id, A); begin if Present (Spec) then if A = Aspect_Default_Iterator then return Expression (Aspect_Rep_Item (Spec)); else return Expression (Spec); end if; end if; return Empty; end Find_Value_Of_Aspect; ------------------- -- Get_Aspect_Id -- ------------------- function Get_Aspect_Id (Name : Name_Id) return Aspect_Id is begin return Aspect_Id_Hash_Table.Get (Name); end Get_Aspect_Id; function Get_Aspect_Id (Aspect : Node_Id) return Aspect_Id is begin pragma Assert (Nkind (Aspect) = N_Aspect_Specification); return Aspect_Id_Hash_Table.Get (Chars (Identifier (Aspect))); end Get_Aspect_Id; ---------------- -- Has_Aspect -- ---------------- function Has_Aspect (Id : Entity_Id; A : Aspect_Id) return Boolean is begin return Present (Find_Aspect (Id, A)); end Has_Aspect; ------------------ -- Move_Aspects -- ------------------ procedure Move_Aspects (From : Node_Id; To : Node_Id) is pragma Assert (not Has_Aspects (To)); begin if Has_Aspects (From) then Set_Aspect_Specifications (To, Aspect_Specifications (From)); Aspect_Specifications_Hash_Table.Remove (From); Set_Has_Aspects (From, False); end if; end Move_Aspects; --------------------------- -- Move_Or_Merge_Aspects -- --------------------------- procedure Move_Or_Merge_Aspects (From : Node_Id; To : Node_Id) is procedure Relocate_Aspect (Asp : Node_Id); -- Move aspect specification Asp to the aspect specifications of node To --------------------- -- Relocate_Aspect -- --------------------- procedure Relocate_Aspect (Asp : Node_Id) is Asps : List_Id; begin if Has_Aspects (To) then Asps := Aspect_Specifications (To); -- Create a new aspect specification list for node To else Asps := New_List; Set_Aspect_Specifications (To, Asps); Set_Has_Aspects (To); end if; -- Remove the aspect from its original owner and relocate it to node -- To. Remove (Asp); Append (Asp, Asps); end Relocate_Aspect; -- Local variables Asp : Node_Id; Asp_Id : Aspect_Id; Next_Asp : Node_Id; -- Start of processing for Move_Or_Merge_Aspects begin if Has_Aspects (From) then Asp := First (Aspect_Specifications (From)); while Present (Asp) loop -- Store the next aspect now as a potential relocation will alter -- the contents of the list. Next_Asp := Next (Asp); -- When moving or merging aspects from a subprogram body stub that -- also acts as a spec, relocate only those aspects that may apply -- to a body [stub]. Note that a precondition must also be moved -- to the proper body as the pre/post machinery expects it to be -- there. if Nkind (From) = N_Subprogram_Body_Stub and then No (Corresponding_Spec_Of_Stub (From)) then Asp_Id := Get_Aspect_Id (Asp); if Aspect_On_Body_Or_Stub_OK (Asp_Id) or else Asp_Id = Aspect_Pre or else Asp_Id = Aspect_Precondition then Relocate_Aspect (Asp); end if; -- When moving or merging aspects from a single concurrent type -- declaration, relocate only those aspects that may apply to the -- anonymous object created for the type. -- Note: It is better to use Is_Single_Concurrent_Type_Declaration -- here, but Aspects and Sem_Util have incompatible licenses. elsif Nkind (Original_Node (From)) in N_Single_Protected_Declaration | N_Single_Task_Declaration then Asp_Id := Get_Aspect_Id (Asp); if Aspect_On_Anonymous_Object_OK (Asp_Id) then Relocate_Aspect (Asp); end if; -- Default case - relocate the aspect to its new owner else Relocate_Aspect (Asp); end if; Asp := Next_Asp; end loop; -- The relocations may have left node From's aspect specifications -- list empty. If this is the case, simply remove the aspects. if Is_Empty_List (Aspect_Specifications (From)) then Remove_Aspects (From); end if; end if; end Move_Or_Merge_Aspects; ----------------------------------- -- Permits_Aspect_Specifications -- ----------------------------------- Has_Aspect_Specifications_Flag : constant array (Node_Kind) of Boolean := (N_Abstract_Subprogram_Declaration => True, N_Component_Declaration => True, N_Entry_Body => True, N_Entry_Declaration => True, N_Exception_Declaration => True, N_Exception_Renaming_Declaration => True, N_Expression_Function => True, N_Formal_Abstract_Subprogram_Declaration => True, N_Formal_Concrete_Subprogram_Declaration => True, N_Formal_Object_Declaration => True, N_Formal_Package_Declaration => True, N_Formal_Type_Declaration => True, N_Full_Type_Declaration => True, N_Function_Instantiation => True, N_Generic_Package_Declaration => True, N_Generic_Renaming_Declaration => True, N_Generic_Subprogram_Declaration => True, N_Object_Declaration => True, N_Object_Renaming_Declaration => True, N_Package_Body => True, N_Package_Body_Stub => True, N_Package_Declaration => True, N_Package_Instantiation => True, N_Package_Specification => True, N_Package_Renaming_Declaration => True, N_Parameter_Specification => True, N_Private_Extension_Declaration => True, N_Private_Type_Declaration => True, N_Procedure_Instantiation => True, N_Protected_Body => True, N_Protected_Body_Stub => True, N_Protected_Type_Declaration => True, N_Single_Protected_Declaration => True, N_Single_Task_Declaration => True, N_Subprogram_Body => True, N_Subprogram_Body_Stub => True, N_Subprogram_Declaration => True, N_Subprogram_Renaming_Declaration => True, N_Subtype_Declaration => True, N_Task_Body => True, N_Task_Body_Stub => True, N_Task_Type_Declaration => True, others => False); function Permits_Aspect_Specifications (N : Node_Id) return Boolean is begin return Has_Aspect_Specifications_Flag (Nkind (N)); end Permits_Aspect_Specifications; -------------------- -- Remove_Aspects -- -------------------- procedure Remove_Aspects (N : Node_Id) is begin if Has_Aspects (N) then Aspect_Specifications_Hash_Table.Remove (N); Set_Has_Aspects (N, False); end if; end Remove_Aspects; ----------------- -- Same_Aspect -- ----------------- -- Table used for Same_Aspect, maps aspect to canonical aspect type Aspect_To_Aspect_Mapping is array (Aspect_Id) of Aspect_Id; function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping; -- Initialize the Canonical_Aspect mapping below function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping is Result : Aspect_To_Aspect_Mapping; begin -- They all map to themselves... for Aspect in Aspect_Id loop Result (Aspect) := Aspect; end loop; -- ...except for these: Result (Aspect_Dynamic_Predicate) := Aspect_Predicate; Result (Aspect_Inline_Always) := Aspect_Inline; Result (Aspect_Interrupt_Priority) := Aspect_Priority; Result (Aspect_Postcondition) := Aspect_Post; Result (Aspect_Precondition) := Aspect_Pre; Result (Aspect_Shared) := Aspect_Atomic; Result (Aspect_Static_Predicate) := Aspect_Predicate; Result (Aspect_Type_Invariant) := Aspect_Invariant; return Result; end Init_Canonical_Aspect; Canonical_Aspect : constant Aspect_To_Aspect_Mapping := Init_Canonical_Aspect; function Same_Aspect (A1 : Aspect_Id; A2 : Aspect_Id) return Boolean is begin return Canonical_Aspect (A1) = Canonical_Aspect (A2); end Same_Aspect; ------------------------------- -- Set_Aspect_Specifications -- ------------------------------- procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id) is begin pragma Assert (Permits_Aspect_Specifications (N)); pragma Assert (not Has_Aspects (N)); pragma Assert (L /= No_List); Set_Has_Aspects (N); Set_Parent (L, N); Aspect_Specifications_Hash_Table.Set (N, L); end Set_Aspect_Specifications; -- Package initialization sets up Aspect Id hash table begin for J in Aspect_Id loop Aspect_Id_Hash_Table.Set (Aspect_Names (J), J); end loop; end Aspects;
true
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A S P E C T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2010-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Nlists; use Nlists; with Sinfo; use Sinfo; with GNAT.HTable; package body Aspects is -- The following array indicates aspects that a subtype inherits from its -- base type. True means that the subtype inherits the aspect from its base -- type. False means it is not inherited. Base_Aspect : constant array (Aspect_Id) of Boolean := (Aspect_Atomic => True, Aspect_Atomic_Components => True, Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Discard_Names => True, Aspect_Independent_Components => True, Aspect_Iterator_Element => True, Aspect_Type_Invariant => True, Aspect_Unchecked_Union => True, Aspect_Variable_Indexing => True, Aspect_Volatile => True, Aspect_Volatile_Full_Access => True, others => False); -- The following array indicates type aspects that are inherited and apply -- to the class-wide type as well. Inherited_Aspect : constant array (Aspect_Id) of Boolean := (Aspect_Constant_Indexing => True, Aspect_Default_Iterator => True, Aspect_Implicit_Dereference => True, Aspect_Iterator_Element => True, Aspect_Remote_Types => True, Aspect_Variable_Indexing => True, others => False); ------------------------------------------ -- Hash Table for Aspect Specifications -- ------------------------------------------ type AS_Hash_Range is range 0 .. 510; -- Size of hash table headers function AS_Hash (F : Node_Id) return AS_Hash_Range; -- Hash function for hash table function AS_Hash (F : Node_Id) return AS_Hash_Range is begin return AS_Hash_Range (F mod 511); end AS_Hash; package Aspect_Specifications_Hash_Table is new GNAT.HTable.Simple_HTable (Header_Num => AS_Hash_Range, Element => List_Id, No_Element => No_List, Key => Node_Id, Hash => AS_Hash, Equal => "="); ------------------------------------- -- Hash Table for Aspect Id Values -- ------------------------------------- type AI_Hash_Range is range 0 .. 112; -- Size of hash table headers function AI_Hash (F : Name_Id) return AI_Hash_Range; -- Hash function for hash table function AI_Hash (F : Name_Id) return AI_Hash_Range is begin return AI_Hash_Range (F mod 113); end AI_Hash; package Aspect_Id_Hash_Table is new GNAT.HTable.Simple_HTable (Header_Num => AI_Hash_Range, Element => Aspect_Id, No_Element => No_Aspect, Key => PI:NAME:<NAME>END_PI_Id, Hash => AI_Hash, Equal => "="); --------------------------- -- Aspect_Specifications -- --------------------------- function Aspect_Specifications (N : Node_Id) return List_Id is begin if Has_Aspects (N) then return Aspect_Specifications_Hash_Table.Get (N); else return No_List; end if; end Aspect_Specifications; -------------------------------- -- Aspects_On_Body_Or_Stub_OK -- -------------------------------- function Aspects_On_Body_Or_Stub_OK (N : Node_Id) return Boolean is Aspect : Node_Id; Aspects : List_Id; begin -- The routine should be invoked on a body [stub] with aspects pragma Assert (Has_Aspects (N)); pragma Assert (Nkind (N) in N_Body_Stub | N_Entry_Body | N_Package_Body | N_Protected_Body | N_Subprogram_Body | N_Task_Body); -- Look through all aspects and see whether they can be applied to a -- body [stub]. Aspects := Aspect_Specifications (N); Aspect := First (Aspects); while Present (Aspect) loop if not Aspect_On_Body_Or_Stub_OK (Get_Aspect_Id (Aspect)) then return False; end if; Next (Aspect); end loop; return True; end Aspects_On_Body_Or_Stub_OK; ---------------------- -- Exchange_Aspects -- ---------------------- procedure Exchange_Aspects (N1 : Node_Id; N2 : Node_Id) is begin pragma Assert (Permits_Aspect_Specifications (N1) and then Permits_Aspect_Specifications (N2)); -- Perform the exchange only when both nodes have lists to be swapped if Has_Aspects (N1) and then Has_Aspects (N2) then declare L1 : constant List_Id := Aspect_Specifications (N1); L2 : constant List_Id := Aspect_Specifications (N2); begin Set_Parent (L1, N2); Set_Parent (L2, N1); Aspect_Specifications_Hash_Table.Set (N1, L2); Aspect_Specifications_Hash_Table.Set (N2, L1); end; end if; end Exchange_Aspects; ----------------- -- Find_Aspect -- ----------------- function Find_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id is Decl : Node_Id; Item : Node_Id; Owner : Entity_Id; Spec : Node_Id; begin Owner := Id; -- Handle various cases of base or inherited aspects for types if Is_Type (Id) then if Base_Aspect (A) then Owner := Base_Type (Owner); end if; if Is_Class_Wide_Type (Owner) and then Inherited_Aspect (A) then Owner := Root_Type (Owner); end if; if Is_Private_Type (Owner) and then Present (Full_View (Owner)) and then not Operational_Aspect (A) then Owner := Full_View (Owner); end if; end if; -- Search the representation items for the desired aspect Item := First_Rep_Item (Owner); while Present (Item) loop if Nkind (Item) = N_Aspect_Specification and then Get_Aspect_Id (Item) = A then return Item; end if; Next_Rep_Item (Item); end loop; -- Note that not all aspects are added to the chain of representation -- items. In such cases, search the list of aspect specifications. First -- find the declaration node where the aspects reside. This is usually -- the parent or the parent of the parent. Decl := Parent (Owner); if not Permits_Aspect_Specifications (Decl) then Decl := Parent (Decl); end if; -- Search the list of aspect specifications for the desired aspect if Permits_Aspect_Specifications (Decl) then Spec := First (Aspect_Specifications (Decl)); while Present (Spec) loop if Get_Aspect_Id (Spec) = A then return Spec; end if; Next (Spec); end loop; end if; -- The entity does not carry any aspects or the desired aspect was not -- found. return Empty; end Find_Aspect; -------------------------- -- Find_Value_Of_Aspect -- -------------------------- function Find_Value_Of_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id is Spec : constant Node_Id := Find_Aspect (Id, A); begin if Present (Spec) then if A = Aspect_Default_Iterator then return Expression (Aspect_Rep_Item (Spec)); else return Expression (Spec); end if; end if; return Empty; end Find_Value_Of_Aspect; ------------------- -- Get_Aspect_Id -- ------------------- function Get_Aspect_Id (Name : Name_Id) return Aspect_Id is begin return Aspect_Id_Hash_Table.Get (Name); end Get_Aspect_Id; function Get_Aspect_Id (Aspect : Node_Id) return Aspect_Id is begin pragma Assert (Nkind (Aspect) = N_Aspect_Specification); return Aspect_Id_Hash_Table.Get (Chars (Identifier (Aspect))); end Get_Aspect_Id; ---------------- -- Has_Aspect -- ---------------- function Has_Aspect (Id : Entity_Id; A : Aspect_Id) return Boolean is begin return Present (Find_Aspect (Id, A)); end Has_Aspect; ------------------ -- Move_Aspects -- ------------------ procedure Move_Aspects (From : Node_Id; To : Node_Id) is pragma Assert (not Has_Aspects (To)); begin if Has_Aspects (From) then Set_Aspect_Specifications (To, Aspect_Specifications (From)); Aspect_Specifications_Hash_Table.Remove (From); Set_Has_Aspects (From, False); end if; end Move_Aspects; --------------------------- -- Move_Or_Merge_Aspects -- --------------------------- procedure Move_Or_Merge_Aspects (From : Node_Id; To : Node_Id) is procedure Relocate_Aspect (Asp : Node_Id); -- Move aspect specification Asp to the aspect specifications of node To --------------------- -- Relocate_Aspect -- --------------------- procedure Relocate_Aspect (Asp : Node_Id) is Asps : List_Id; begin if Has_Aspects (To) then Asps := Aspect_Specifications (To); -- Create a new aspect specification list for node To else Asps := New_List; Set_Aspect_Specifications (To, Asps); Set_Has_Aspects (To); end if; -- Remove the aspect from its original owner and relocate it to node -- To. Remove (Asp); Append (Asp, Asps); end Relocate_Aspect; -- Local variables Asp : Node_Id; Asp_Id : Aspect_Id; Next_Asp : Node_Id; -- Start of processing for Move_Or_Merge_Aspects begin if Has_Aspects (From) then Asp := First (Aspect_Specifications (From)); while Present (Asp) loop -- Store the next aspect now as a potential relocation will alter -- the contents of the list. Next_Asp := Next (Asp); -- When moving or merging aspects from a subprogram body stub that -- also acts as a spec, relocate only those aspects that may apply -- to a body [stub]. Note that a precondition must also be moved -- to the proper body as the pre/post machinery expects it to be -- there. if Nkind (From) = N_Subprogram_Body_Stub and then No (Corresponding_Spec_Of_Stub (From)) then Asp_Id := Get_Aspect_Id (Asp); if Aspect_On_Body_Or_Stub_OK (Asp_Id) or else Asp_Id = Aspect_Pre or else Asp_Id = Aspect_Precondition then Relocate_Aspect (Asp); end if; -- When moving or merging aspects from a single concurrent type -- declaration, relocate only those aspects that may apply to the -- anonymous object created for the type. -- Note: It is better to use Is_Single_Concurrent_Type_Declaration -- here, but Aspects and Sem_Util have incompatible licenses. elsif Nkind (Original_Node (From)) in N_Single_Protected_Declaration | N_Single_Task_Declaration then Asp_Id := Get_Aspect_Id (Asp); if Aspect_On_Anonymous_Object_OK (Asp_Id) then Relocate_Aspect (Asp); end if; -- Default case - relocate the aspect to its new owner else Relocate_Aspect (Asp); end if; Asp := Next_Asp; end loop; -- The relocations may have left node From's aspect specifications -- list empty. If this is the case, simply remove the aspects. if Is_Empty_List (Aspect_Specifications (From)) then Remove_Aspects (From); end if; end if; end Move_Or_Merge_Aspects; ----------------------------------- -- Permits_Aspect_Specifications -- ----------------------------------- Has_Aspect_Specifications_Flag : constant array (Node_Kind) of Boolean := (N_Abstract_Subprogram_Declaration => True, N_Component_Declaration => True, N_Entry_Body => True, N_Entry_Declaration => True, N_Exception_Declaration => True, N_Exception_Renaming_Declaration => True, N_Expression_Function => True, N_Formal_Abstract_Subprogram_Declaration => True, N_Formal_Concrete_Subprogram_Declaration => True, N_Formal_Object_Declaration => True, N_Formal_Package_Declaration => True, N_Formal_Type_Declaration => True, N_Full_Type_Declaration => True, N_Function_Instantiation => True, N_Generic_Package_Declaration => True, N_Generic_Renaming_Declaration => True, N_Generic_Subprogram_Declaration => True, N_Object_Declaration => True, N_Object_Renaming_Declaration => True, N_Package_Body => True, N_Package_Body_Stub => True, N_Package_Declaration => True, N_Package_Instantiation => True, N_Package_Specification => True, N_Package_Renaming_Declaration => True, N_Parameter_Specification => True, N_Private_Extension_Declaration => True, N_Private_Type_Declaration => True, N_Procedure_Instantiation => True, N_Protected_Body => True, N_Protected_Body_Stub => True, N_Protected_Type_Declaration => True, N_Single_Protected_Declaration => True, N_Single_Task_Declaration => True, N_Subprogram_Body => True, N_Subprogram_Body_Stub => True, N_Subprogram_Declaration => True, N_Subprogram_Renaming_Declaration => True, N_Subtype_Declaration => True, N_Task_Body => True, N_Task_Body_Stub => True, N_Task_Type_Declaration => True, others => False); function Permits_Aspect_Specifications (N : Node_Id) return Boolean is begin return Has_Aspect_Specifications_Flag (Nkind (N)); end Permits_Aspect_Specifications; -------------------- -- Remove_Aspects -- -------------------- procedure Remove_Aspects (N : Node_Id) is begin if Has_Aspects (N) then Aspect_Specifications_Hash_Table.Remove (N); Set_Has_Aspects (N, False); end if; end Remove_Aspects; ----------------- -- Same_Aspect -- ----------------- -- Table used for Same_Aspect, maps aspect to canonical aspect type Aspect_To_Aspect_Mapping is array (Aspect_Id) of Aspect_Id; function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping; -- Initialize the Canonical_Aspect mapping below function Init_Canonical_Aspect return Aspect_To_Aspect_Mapping is Result : Aspect_To_Aspect_Mapping; begin -- They all map to themselves... for Aspect in Aspect_Id loop Result (Aspect) := Aspect; end loop; -- ...except for these: Result (Aspect_Dynamic_Predicate) := Aspect_Predicate; Result (Aspect_Inline_Always) := Aspect_Inline; Result (Aspect_Interrupt_Priority) := Aspect_Priority; Result (Aspect_Postcondition) := Aspect_Post; Result (Aspect_Precondition) := Aspect_Pre; Result (Aspect_Shared) := Aspect_Atomic; Result (Aspect_Static_Predicate) := Aspect_Predicate; Result (Aspect_Type_Invariant) := Aspect_Invariant; return Result; end Init_Canonical_Aspect; Canonical_Aspect : constant Aspect_To_Aspect_Mapping := Init_Canonical_Aspect; function Same_Aspect (A1 : Aspect_Id; A2 : Aspect_Id) return Boolean is begin return Canonical_Aspect (A1) = Canonical_Aspect (A2); end Same_Aspect; ------------------------------- -- Set_Aspect_Specifications -- ------------------------------- procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id) is begin pragma Assert (Permits_Aspect_Specifications (N)); pragma Assert (not Has_Aspects (N)); pragma Assert (L /= No_List); Set_Has_Aspects (N); Set_Parent (L, N); Aspect_Specifications_Hash_Table.Set (N, L); end Set_Aspect_Specifications; -- Package initialization sets up Aspect Id hash table begin for J in Aspect_Id loop Aspect_Id_Hash_Table.Set (Aspect_Names (J), J); end loop; end Aspects;
[ { "context": " constant array(1..100) of String(1..4) := (\n \"ach \", \"tun \", \"ep \", \"tur \", \"tash\",\n ", "end": 204, "score": 0.9949027299880981, "start": 201, "tag": "NAME", "value": "ach" }, { "context": "rray(1..100) of String(1..4) := (\n \"ach \", \"tun \", \"ep \", \"tur \", \"tash\",\n \"ine \", ", "end": 215, "score": 0.9908786416053772, "start": 212, "tag": "NAME", "value": "tun" }, { "context": ") of String(1..4) := (\n \"ach \", \"tun \", \"ep \", \"tur \", \"tash\",\n \"ine \", \"me \", ", "end": 225, "score": 0.951111376285553, "start": 223, "tag": "NAME", "value": "ep" }, { "context": "(1..4) := (\n \"ach \", \"tun \", \"ep \", \"tur \", \"tash\",\n \"ine \", \"me \", \"arr \", ", "end": 237, "score": 0.9886242151260376, "start": 234, "tag": "NAME", "value": "tur" }, { "context": "\n \"ach \", \"tun \", \"ep \", \"tur \", \"tash\",\n \"ine \", \"me \", \"arr \", \"et \", ", "end": 249, "score": 0.9753420948982239, "start": 245, "tag": "NAME", "value": "tash" }, { "context": " \"tun \", \"ep \", \"tur \", \"tash\",\n \"ine \", \"me \", \"arr \", \"et \", \"ze \",\n ", "end": 260, "score": 0.9708499908447266, "start": 257, "tag": "NAME", "value": "ine" }, { "context": " \"ep \", \"tur \", \"tash\",\n \"ine \", \"me \", \"arr \", \"et \", \"ze \",\n \"cre \", ", "end": 270, "score": 0.9482560753822327, "start": 268, "tag": "NAME", "value": "me" }, { "context": " \"tur \", \"tash\",\n \"ine \", \"me \", \"arr \", \"et \", \"ze \",\n \"cre \", \"uss \", ", "end": 282, "score": 0.9826493859291077, "start": 279, "tag": "NAME", "value": "arr" }, { "context": " \"tash\",\n \"ine \", \"me \", \"arr \", \"et \", \"ze \",\n \"cre \", \"uss \", \"dar \", ", "end": 292, "score": 0.8221085071563721, "start": 290, "tag": "NAME", "value": "et" }, { "context": " \"me \", \"arr \", \"et \", \"ze \",\n \"cre \", \"uss \", \"dar \", \"ien \", \"her \",\n ", "end": 316, "score": 0.9315989017486572, "start": 313, "tag": "NAME", "value": "cre" }, { "context": " \"arr \", \"et \", \"ze \",\n \"cre \", \"uss \", \"dar \", \"ien \", \"her \",\n \"cant\", ", "end": 327, "score": 0.9506506323814392, "start": 324, "tag": "NAME", "value": "uss" }, { "context": " \"et \", \"ze \",\n \"cre \", \"uss \", \"dar \", \"ien \", \"her \",\n \"cant\", \"jol \", ", "end": 338, "score": 0.9781317710876465, "start": 335, "tag": "NAME", "value": "dar" }, { "context": " \"ze \",\n \"cre \", \"uss \", \"dar \", \"ien \", \"her \",\n \"cant\", \"jol \", \"nar \", ", "end": 349, "score": 0.9033268690109253, "start": 346, "tag": "NAME", "value": "ien" }, { "context": "\n \"cre \", \"uss \", \"dar \", \"ien \", \"her \",\n \"cant\", \"jol \", \"nar \", \"kam \", ", "end": 360, "score": 0.902082622051239, "start": 357, "tag": "NAME", "value": "her" }, { "context": " \"uss \", \"dar \", \"ien \", \"her \",\n \"cant\", \"jol \", \"nar \", \"kam \", \"dorn\",\n ", "end": 373, "score": 0.9877170920372009, "start": 369, "tag": "NAME", "value": "cant" }, { "context": " \"dar \", \"ien \", \"her \",\n \"cant\", \"jol \", \"nar \", \"kam \", \"dorn\",\n \"li \", ", "end": 383, "score": 0.9813355207443237, "start": 380, "tag": "NAME", "value": "jol" }, { "context": " \"ien \", \"her \",\n \"cant\", \"jol \", \"nar \", \"kam \", \"dorn\",\n \"li \", \"sis \", ", "end": 394, "score": 0.9920795559883118, "start": 391, "tag": "NAME", "value": "nar" }, { "context": " \"her \",\n \"cant\", \"jol \", \"nar \", \"kam \", \"dorn\",\n \"li \", \"sis \", \"maal\", ", "end": 405, "score": 0.9815846681594849, "start": 402, "tag": "NAME", "value": "kam" }, { "context": "\n \"cant\", \"jol \", \"nar \", \"kam \", \"dorn\",\n \"li \", \"sis \", \"maal\", \"uk \", ", "end": 417, "score": 0.9917887449264526, "start": 413, "tag": "NAME", "value": "dorn" }, { "context": " \"jol \", \"nar \", \"kam \", \"dorn\",\n \"li \", \"sis \", \"maal\", \"uk \", \"mec \",\n ", "end": 427, "score": 0.9863380193710327, "start": 425, "tag": "NAME", "value": "li" }, { "context": " \"nar \", \"kam \", \"dorn\",\n \"li \", \"sis \", \"maal\", \"uk \", \"mec \",\n \"at \", ", "end": 439, "score": 0.9835229516029358, "start": 436, "tag": "NAME", "value": "sis" }, { "context": " \"kam \", \"dorn\",\n \"li \", \"sis \", \"maal\", \"uk \", \"mec \",\n \"at \", \"ol \", ", "end": 451, "score": 0.9956508874893188, "start": 447, "tag": "NAME", "value": "maal" }, { "context": " \"dorn\",\n \"li \", \"sis \", \"maal\", \"uk \", \"mec \",\n \"at \", \"ol \", \"mi \", ", "end": 460, "score": 0.9682323336601257, "start": 458, "tag": "NAME", "value": "uk" }, { "context": "\n \"li \", \"sis \", \"maal\", \"uk \", \"mec \",\n \"at \", \"ol \", \"mi \", \"ra \", ", "end": 472, "score": 0.9409791231155396, "start": 469, "tag": "NAME", "value": "mec" }, { "context": " \"sis \", \"maal\", \"uk \", \"mec \",\n \"at \", \"ol \", \"mi \", \"ra \", \"ge \",\n ", "end": 483, "score": 0.9294462203979492, "start": 481, "tag": "NAME", "value": "at" }, { "context": " \"maal\", \"uk \", \"mec \",\n \"at \", \"ol \", \"mi \", \"ra \", \"ge \",\n \"mor \", ", "end": 494, "score": 0.9184576869010925, "start": 492, "tag": "NAME", "value": "ol" }, { "context": " \"uk \", \"mec \",\n \"at \", \"ol \", \"mi \", \"ra \", \"ge \",\n \"mor \", \"dai \", ", "end": 505, "score": 0.9469629526138306, "start": 503, "tag": "NAME", "value": "mi" }, { "context": " \"mec \",\n \"at \", \"ol \", \"mi \", \"ra \", \"ge \",\n \"mor \", \"dai \", \"nest\", ", "end": 516, "score": 0.9734401106834412, "start": 514, "tag": "NAME", "value": "ra" }, { "context": "\n \"at \", \"ol \", \"mi \", \"ra \", \"ge \",\n \"mor \", \"dai \", \"nest\", \"phar\", ", "end": 527, "score": 0.9020583629608154, "start": 525, "tag": "NAME", "value": "ge" }, { "context": " \"ol \", \"mi \", \"ra \", \"ge \",\n \"mor \", \"dai \", \"nest\", \"phar\", \"rag \",\n ", "end": 540, "score": 0.9944357872009277, "start": 537, "tag": "NAME", "value": "mor" }, { "context": " \"mi \", \"ra \", \"ge \",\n \"mor \", \"dai \", \"nest\", \"phar\", \"rag \",\n \"ret \", ", "end": 551, "score": 0.9921309947967529, "start": 548, "tag": "NAME", "value": "dai" }, { "context": " \"ra \", \"ge \",\n \"mor \", \"dai \", \"nest\", \"phar\", \"rag \",\n \"ret \", \"ill \", ", "end": 563, "score": 0.9947118759155273, "start": 559, "tag": "NAME", "value": "nest" }, { "context": " \"ge \",\n \"mor \", \"dai \", \"nest\", \"phar\", \"rag \",\n \"ret \", \"ill \", \"on \", ", "end": 574, "score": 0.9973312616348267, "start": 570, "tag": "NAME", "value": "phar" }, { "context": "\n \"mor \", \"dai \", \"nest\", \"phar\", \"rag \",\n \"ret \", \"ill \", \"on \", \"dru \", ", "end": 584, "score": 0.9937230944633484, "start": 581, "tag": "NAME", "value": "rag" }, { "context": " \"dai \", \"nest\", \"phar\", \"rag \",\n \"ret \", \"ill \", \"on \", \"dru \", \"ah \",\n ", "end": 596, "score": 0.9955724477767944, "start": 593, "tag": "NAME", "value": "ret" }, { "context": " \"nest\", \"phar\", \"rag \",\n \"ret \", \"ill \", \"on \", \"dru \", \"ah \",\n \"quin\", ", "end": 607, "score": 0.9891977906227112, "start": 604, "tag": "NAME", "value": "ill" }, { "context": " \"phar\", \"rag \",\n \"ret \", \"ill \", \"on \", \"dru \", \"ah \",\n \"quin\", \"sha \", ", "end": 617, "score": 0.7428566217422485, "start": 615, "tag": "NAME", "value": "on" }, { "context": " \"rag \",\n \"ret \", \"ill \", \"on \", \"dru \", \"ah \",\n \"quin\", \"sha \", \"loq \", ", "end": 629, "score": 0.862456202507019, "start": 626, "tag": "NAME", "value": "dru" }, { "context": "\n \"ret \", \"ill \", \"on \", \"dru \", \"ah \",\n \"quin\", \"sha \", \"loq \", \"tre \", ", "end": 639, "score": 0.9885292649269104, "start": 637, "tag": "NAME", "value": "ah" }, { "context": " \"ill \", \"on \", \"dru \", \"ah \",\n \"quin\", \"sha \", \"loq \", \"tre \", \"lak \",\n ", "end": 653, "score": 0.9966229200363159, "start": 649, "tag": "NAME", "value": "quin" }, { "context": " \"on \", \"dru \", \"ah \",\n \"quin\", \"sha \", \"loq \", \"tre \", \"lak \",\n \"sum \", ", "end": 663, "score": 0.9977216720581055, "start": 660, "tag": "NAME", "value": "sha" }, { "context": " \"dru \", \"ah \",\n \"quin\", \"sha \", \"loq \", \"tre \", \"lak \",\n \"sum \", \"eri \", ", "end": 674, "score": 0.9959207773208618, "start": 671, "tag": "NAME", "value": "loq" }, { "context": " \"ah \",\n \"quin\", \"sha \", \"loq \", \"tre \", \"lak \",\n \"sum \", \"eri \", \"an \", ", "end": 685, "score": 0.9926342964172363, "start": 682, "tag": "NAME", "value": "tre" }, { "context": "\n \"quin\", \"sha \", \"loq \", \"tre \", \"lak \",\n \"sum \", \"eri \", \"an \", \"tsi \", ", "end": 696, "score": 0.971493124961853, "start": 693, "tag": "NAME", "value": "lak" }, { "context": " \"sha \", \"loq \", \"tre \", \"lak \",\n \"sum \", \"eri \", \"an \", \"tsi \", \"win \",\n ", "end": 708, "score": 0.9808463454246521, "start": 705, "tag": "NAME", "value": "sum" }, { "context": " \"loq \", \"tre \", \"lak \",\n \"sum \", \"eri \", \"an \", \"tsi \", \"win \",\n \"ter \", ", "end": 719, "score": 0.9875153303146362, "start": 716, "tag": "NAME", "value": "eri" }, { "context": " \"tre \", \"lak \",\n \"sum \", \"eri \", \"an \", \"tsi \", \"win \",\n \"ter \", \"arch\", ", "end": 729, "score": 0.9746728539466858, "start": 727, "tag": "NAME", "value": "an" }, { "context": " \"lak \",\n \"sum \", \"eri \", \"an \", \"tsi \", \"win \",\n \"ter \", \"arch\", \"on \", ", "end": 741, "score": 0.9571866989135742, "start": 738, "tag": "NAME", "value": "tsi" }, { "context": "\n \"sum \", \"eri \", \"an \", \"tsi \", \"win \",\n \"ter \", \"arch\", \"on \", \"ren \", ", "end": 752, "score": 0.9953340291976929, "start": 749, "tag": "NAME", "value": "win" }, { "context": " \"eri \", \"an \", \"tsi \", \"win \",\n \"ter \", \"arch\", \"on \", \"ren \", \"i \",\n ", "end": 764, "score": 0.9837539792060852, "start": 761, "tag": "NAME", "value": "ter" }, { "context": " \"an \", \"tsi \", \"win \",\n \"ter \", \"arch\", \"on \", \"ren \", \"i \",\n \"pri \", ", "end": 776, "score": 0.9375576972961426, "start": 772, "tag": "NAME", "value": "arch" }, { "context": " \"tsi \", \"win \",\n \"ter \", \"arch\", \"on \", \"ren \", \"i \",\n \"pri \", \"tau \", ", "end": 785, "score": 0.6014946103096008, "start": 783, "tag": "NAME", "value": "on" }, { "context": " \"win \",\n \"ter \", \"arch\", \"on \", \"ren \", \"i \",\n \"pri \", \"tau \", \"cu \", ", "end": 797, "score": 0.9744018316268921, "start": 794, "tag": "NAME", "value": "ren" }, { "context": " \"arch\", \"on \", \"ren \", \"i \",\n \"pri \", \"tau \", \"cu \", \"ry \", \"ven \",\n ", "end": 820, "score": 0.9422855973243713, "start": 817, "tag": "NAME", "value": "pri" }, { "context": " \"on \", \"ren \", \"i \",\n \"pri \", \"tau \", \"cu \", \"ry \", \"ven \",\n \"us \", ", "end": 831, "score": 0.9718663692474365, "start": 828, "tag": "NAME", "value": "tau" }, { "context": " \"ren \", \"i \",\n \"pri \", \"tau \", \"cu \", \"ry \", \"ven \",\n \"us \", \"mar \", ", "end": 841, "score": 0.9335359930992126, "start": 839, "tag": "NAME", "value": "cu" }, { "context": " \"i \",\n \"pri \", \"tau \", \"cu \", \"ry \", \"ven \",\n \"us \", \"mar \", \"jup \", ", "end": 852, "score": 0.9691504240036011, "start": 850, "tag": "NAME", "value": "ry" }, { "context": "\n \"pri \", \"tau \", \"cu \", \"ry \", \"ven \",\n \"us \", \"mar \", \"jup \", \"it \", ", "end": 864, "score": 0.9147250652313232, "start": 861, "tag": "NAME", "value": "ven" }, { "context": " \"tau \", \"cu \", \"ry \", \"ven \",\n \"us \", \"mar \", \"jup \", \"it \", \"er \",\n ", "end": 875, "score": 0.804304838180542, "start": 873, "tag": "NAME", "value": "us" }, { "context": " \"cu \", \"ry \", \"ven \",\n \"us \", \"mar \", \"jup \", \"it \", \"er \",\n \"sat \", ", "end": 887, "score": 0.99626225233078, "start": 884, "tag": "NAME", "value": "mar" }, { "context": " \"ry \", \"ven \",\n \"us \", \"mar \", \"jup \", \"it \", \"er \",\n \"sat \", \"uh \", ", "end": 898, "score": 0.9788953065872192, "start": 895, "tag": "NAME", "value": "jup" }, { "context": " \"ven \",\n \"us \", \"mar \", \"jup \", \"it \", \"er \",\n \"sat \", \"uh \", \"un \", ", "end": 908, "score": 0.9284021854400635, "start": 906, "tag": "NAME", "value": "it" }, { "context": "\n \"us \", \"mar \", \"jup \", \"it \", \"er \",\n \"sat \", \"uh \", \"un \", \"plu \", ", "end": 919, "score": 0.7345885038375854, "start": 917, "tag": "NAME", "value": "er" }, { "context": " \"mar \", \"jup \", \"it \", \"er \",\n \"sat \", \"uh \", \"un \", \"plu \", \"gol \",\n ", "end": 932, "score": 0.7411603331565857, "start": 929, "tag": "NAME", "value": "sat" }, { "context": " \"jup \", \"it \", \"er \",\n \"sat \", \"uh \", \"un \", \"plu \", \"gol \",\n \"kar \", ", "end": 942, "score": 0.5791066288948059, "start": 940, "tag": "NAME", "value": "uh" }, { "context": " \"it \", \"er \",\n \"sat \", \"uh \", \"un \", \"plu \", \"gol \",\n \"kar \", \"lam \", ", "end": 953, "score": 0.6526250243186951, "start": 951, "tag": "NAME", "value": "un" }, { "context": " \"er \",\n \"sat \", \"uh \", \"un \", \"plu \", \"gol \",\n \"kar \", \"lam \", \"wel \", ", "end": 965, "score": 0.6947709321975708, "start": 962, "tag": "NAME", "value": "plu" }, { "context": "\n \"sat \", \"uh \", \"un \", \"plu \", \"gol \",\n \"kar \", \"lam \", \"wel \", \"pik \", ", "end": 976, "score": 0.9450085163116455, "start": 973, "tag": "NAME", "value": "gol" }, { "context": " \"uh \", \"un \", \"plu \", \"gol \",\n \"kar \", \"lam \", \"wel \", \"pik \", \"chu \",\n ", "end": 988, "score": 0.971492350101471, "start": 985, "tag": "NAME", "value": "kar" }, { "context": " \"un \", \"plu \", \"gol \",\n \"kar \", \"lam \", \"wel \", \"pik \", \"chu \",\n \"cha \", ", "end": 999, "score": 0.9565269947052002, "start": 996, "tag": "NAME", "value": "lam" }, { "context": " \"plu \", \"gol \",\n \"kar \", \"lam \", \"wel \", \"pik \", \"chu \",\n \"cha \", \"man \", ", "end": 1010, "score": 0.7600024938583374, "start": 1007, "tag": "NAME", "value": "wel" }, { "context": " \"gol \",\n \"kar \", \"lam \", \"wel \", \"pik \", \"chu \",\n \"cha \", \"man \", \"der \", ", "end": 1021, "score": 0.8248051404953003, "start": 1018, "tag": "NAME", "value": "pik" }, { "context": "\n \"kar \", \"lam \", \"wel \", \"pik \", \"chu \",\n \"cha \", \"man \", \"der \", \"za \", ", "end": 1031, "score": 0.8776921629905701, "start": 1029, "tag": "NAME", "value": "ch" }, { "context": " \"lam \", \"wel \", \"pik \", \"chu \",\n \"cha \", \"man \", \"der \", \"za \", \"bla \",\n ", "end": 1044, "score": 0.9542990922927856, "start": 1041, "tag": "NAME", "value": "cha" }, { "context": " \"wel \", \"pik \", \"chu \",\n \"cha \", \"man \", \"der \", \"za \", \"bla \",\n \"sto \", ", "end": 1055, "score": 0.9848189353942871, "start": 1052, "tag": "NAME", "value": "man" }, { "context": " \"pik \", \"chu \",\n \"cha \", \"man \", \"der \", \"za \", \"bla \",\n \"sto \", \"id \", ", "end": 1066, "score": 0.9292872548103333, "start": 1063, "tag": "NAME", "value": "der" }, { "context": " \"chu \",\n \"cha \", \"man \", \"der \", \"za \", \"bla \",\n \"sto \", \"id \", \"sau \", ", "end": 1076, "score": 0.7909539937973022, "start": 1074, "tag": "NAME", "value": "za" }, { "context": "\n \"cha \", \"man \", \"der \", \"za \", \"bla \",\n \"sto \", \"id \", \"sau \", \"tan \", ", "end": 1087, "score": 0.7701970934867859, "start": 1085, "tag": "NAME", "value": "bl" }, { "context": " \"man \", \"der \", \"za \", \"bla \",\n \"sto \", \"id \", \"sau \", \"tan \", \"sin \",\n ", "end": 1100, "score": 0.7564911842346191, "start": 1097, "tag": "NAME", "value": "sto" }, { "context": " \"der \", \"za \", \"bla \",\n \"sto \", \"id \", \"sau \", \"tan \", \"sin \",\n \"cos \", ", "end": 1110, "score": 0.7946181893348694, "start": 1108, "tag": "NAME", "value": "id" }, { "context": " \"za \", \"bla \",\n \"sto \", \"id \", \"sau \", \"tan \", \"sin \",\n \"cos \", \"chut\", ", "end": 1122, "score": 0.7876925468444824, "start": 1119, "tag": "NAME", "value": "sau" }, { "context": " \"bla \",\n \"sto \", \"id \", \"sau \", \"tan \", \"sin \",\n \"cos \", \"chut\", \"stri\", ", "end": 1133, "score": 0.9047175645828247, "start": 1130, "tag": "NAME", "value": "tan" }, { "context": "\n \"sto \", \"id \", \"sau \", \"tan \", \"sin \",\n \"cos \", \"chut\", \"stri\", \"stra\", ", "end": 1144, "score": 0.8504914045333862, "start": 1141, "tag": "NAME", "value": "sin" }, { "context": " \"id \", \"sau \", \"tan \", \"sin \",\n \"cos \", \"chut\", \"stri\", \"stra\", \"stru\",\n ", "end": 1156, "score": 0.7013300061225891, "start": 1153, "tag": "NAME", "value": "cos" }, { "context": " \"sau \", \"tan \", \"sin \",\n \"cos \", \"chut\", \"stri\", \"stra\", \"stru\",\n \"skro\", ", "end": 1166, "score": 0.6252554059028625, "start": 1164, "tag": "NAME", "value": "ch" }, { "context": " \"tan \", \"sin \",\n \"cos \", \"chut\", \"stri\", \"stra\", \"stru\",\n \"skro\", \"skre\", ", "end": 1179, "score": 0.5431506037712097, "start": 1175, "tag": "NAME", "value": "stri" }, { "context": " \"chut\", \"stri\", \"stra\", \"stru\",\n \"skro\", \"skre\", \"cet \", \"nya \", \"nyu \",\n ", "end": 1211, "score": 0.6051250100135803, "start": 1209, "tag": "NAME", "value": "sk" }, { "context": " \"stri\", \"stra\", \"stru\",\n \"skro\", \"skre\", \"cet \", \"nya \", \"nyu \",\n \"ple \", ", "end": 1222, "score": 0.6111240386962891, "start": 1220, "tag": "NAME", "value": "sk" }, { "context": " \"stra\", \"stru\",\n \"skro\", \"skre\", \"cet \", \"nya \", \"nyu \",\n \"ple \", \"pra \",", "end": 1232, "score": 0.7991591691970825, "start": 1231, "tag": "NAME", "value": "c" }, { "context": " \"stru\",\n \"skro\", \"skre\", \"cet \", \"nya \", \"nyu \",\n \"ple \", \"pra \", \"ble \", ", "end": 1245, "score": 0.9220139980316162, "start": 1242, "tag": "NAME", "value": "nya" }, { "context": "\n \"skro\", \"skre\", \"cet \", \"nya \", \"nyu \",\n \"ple \", \"pra \", \"ble \", \"glu \", ", "end": 1255, "score": 0.9225193858146667, "start": 1253, "tag": "NAME", "value": "ny" }, { "context": " \"skre\", \"cet \", \"nya \", \"nyu \",\n \"ple \", \"pra \", \"ble \", \"glu \", \"geo \");\n ", "end": 1268, "score": 0.9453926682472229, "start": 1265, "tag": "NAME", "value": "ple" }, { "context": " \"cet \", \"nya \", \"nyu \",\n \"ple \", \"pra \", \"ble \", \"glu \", \"geo \");\n \n Num, ", "end": 1279, "score": 0.7768893241882324, "start": 1276, "tag": "NAME", "value": "pra" } ]
tentaplugg_albin/20180604/upg2/upg3.adb
albinjal/ada_basic
3
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Characters.Handling; procedure Upg3 is Syl_Arr : constant array(1..100) of String(1..4) := ( "ach ", "tun ", "ep ", "tur ", "tash", "ine ", "me ", "arr ", "et ", "ze ", "cre ", "uss ", "dar ", "ien ", "her ", "cant", "jol ", "nar ", "kam ", "dorn", "li ", "sis ", "maal", "uk ", "mec ", "at ", "ol ", "mi ", "ra ", "ge ", "mor ", "dai ", "nest", "phar", "rag ", "ret ", "ill ", "on ", "dru ", "ah ", "quin", "sha ", "loq ", "tre ", "lak ", "sum ", "eri ", "an ", "tsi ", "win ", "ter ", "arch", "on ", "ren ", "i ", "pri ", "tau ", "cu ", "ry ", "ven ", "us ", "mar ", "jup ", "it ", "er ", "sat ", "uh ", "un ", "plu ", "gol ", "kar ", "lam ", "wel ", "pik ", "chu ", "cha ", "man ", "der ", "za ", "bla ", "sto ", "id ", "sau ", "tan ", "sin ", "cos ", "chut", "stri", "stra", "stru", "skro", "skre", "cet ", "nya ", "nyu ", "ple ", "pra ", "ble ", "glu ", "geo "); Num, I: Integer; Index: Integer := 1; Ut: String(1..200); Stav: String(1..4); Ver: Boolean := True; begin Put("Mata in antal stavelser: "); Get(Num); Put("Mata in stavelseindex: "); for X in 1..Num loop Get(I); if I < 0 then Stav := Syl_Arr(-I); Ut(Index) := '-'; Ver := True; Index := Index + 1; else Stav := Syl_Arr(I); end if; for Z in 1..4 loop if Stav(Z) /= ' ' then if Ver = True then Ut(Index) := Ada.Characters.Handling.To_Upper(Stav(Z)); else Ut(Index) := Stav(Z); end if; Ver := False; Index := Index + 1; end if; end loop; end loop; Put("Genererat planetnamn: "); Put(Ut(1..Index)); end;
16345
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Characters.Handling; procedure Upg3 is Syl_Arr : constant array(1..100) of String(1..4) := ( "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "ze ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>", "<NAME> ", "<NAME> ", "<NAME>", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>", "<NAME>", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>", "<NAME> ", "<NAME> ", "i ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>u ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>a ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME> ", "<NAME>ut", "<NAME>", "stra", "stru", "<NAME>ro", "<NAME>re", "<NAME>et ", "<NAME> ", "<NAME>u ", "<NAME> ", "<NAME> ", "ble ", "glu ", "geo "); Num, I: Integer; Index: Integer := 1; Ut: String(1..200); Stav: String(1..4); Ver: Boolean := True; begin Put("Mata in antal stavelser: "); Get(Num); Put("Mata in stavelseindex: "); for X in 1..Num loop Get(I); if I < 0 then Stav := Syl_Arr(-I); Ut(Index) := '-'; Ver := True; Index := Index + 1; else Stav := Syl_Arr(I); end if; for Z in 1..4 loop if Stav(Z) /= ' ' then if Ver = True then Ut(Index) := Ada.Characters.Handling.To_Upper(Stav(Z)); else Ut(Index) := Stav(Z); end if; Ver := False; Index := Index + 1; end if; end loop; end loop; Put("Genererat planetnamn: "); Put(Ut(1..Index)); end;
true
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Characters.Handling; procedure Upg3 is Syl_Arr : constant array(1..100) of String(1..4) := ( "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "ze ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "i ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PIu ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PIa ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PIut", "PI:NAME:<NAME>END_PI", "stra", "stru", "PI:NAME:<NAME>END_PIro", "PI:NAME:<NAME>END_PIre", "PI:NAME:<NAME>END_PIet ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PIu ", "PI:NAME:<NAME>END_PI ", "PI:NAME:<NAME>END_PI ", "ble ", "glu ", "geo "); Num, I: Integer; Index: Integer := 1; Ut: String(1..200); Stav: String(1..4); Ver: Boolean := True; begin Put("Mata in antal stavelser: "); Get(Num); Put("Mata in stavelseindex: "); for X in 1..Num loop Get(I); if I < 0 then Stav := Syl_Arr(-I); Ut(Index) := '-'; Ver := True; Index := Index + 1; else Stav := Syl_Arr(I); end if; for Z in 1..4 loop if Stav(Z) /= ' ' then if Ver = True then Ut(Index) := Ada.Characters.Handling.To_Upper(Stav(Z)); else Ut(Index) := Stav(Z); end if; Ver := False; Index := Index + 1; end if; end loop; end loop; Put("Genererat planetnamn: "); Put(Ut(1..Index)); end;
[ { "context": "ight (C) 2003, 2007, 2010 - 2013, 2015, 2017, 2018 Stephen Leake. All Rights Reserved.\r\n -- E-Mail: stephen_le", "end": 154, "score": 0.9998218417167664, "start": 141, "tag": "NAME", "value": "Stephen Leake" }, { "context": "ephen Leake. All Rights Reserved.\r\n -- E-Mail: [email protected]\r\n --\r\n -- This library is free software; you", "end": 215, "score": 0.9999344944953918, "start": 194, "tag": "EMAIL", "value": "[email protected]" } ]
.emacs.d/elpa/ada-ref-man-2012.5/progs/arm_texi.adb
caqg/linux-home
0
with Ada.Exceptions; with Ada.Strings.Fixed; package body ARM_Texinfo is -- Copyright (C) 2003, 2007, 2010 - 2013, 2015, 2017, 2018 Stephen Leake. All Rights Reserved. -- E-Mail: [email protected] -- -- This library is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, 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 General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file gnu-3-0.txt. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- MA 02111-1307, USA. -- --------------------------------------- -- -- Edit History: -- -- Ancient - S L - Developed package as add-on to Arm_Form. -- 10/19/11 - RLB - Integrated outside-developed package into Arm_Form. -- Commented out/replaced Ada 2005 features (this is -- Ada 95 code). Updated for a few other changes since -- the last update. -- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header. -- 4/ 1/12 - S L - Implemented remaining Texinfo implementation. -- 4/22/12 - S L - Move @dircategory, @direntry before first @node. -- 4/28/12 - S L - Add @w{} after @anchor; otherwise following whitespace -- is dropped. -- 8/31/12 - RLB - Added Output_Path. -- 10/18/12 - RLB - Added additional hanging styles. -- 11/26/12 - RLB - Added subdivision names to Clause_Header and -- Revised_Clause_Header. -- 3/12/13 - S L - use correct version in direntry use Ada.Text_IO; Indentation : constant := 5; -- VERSION: This is fragile; it changes with each version of the manual. Index_Clause_Name : constant String := "Index"; Operators_Clause : constant String := "operators"; Last_Index_Clause : constant Character := 'Y'; ---------- -- local subprograms procedure Check_Not_In_Paragraph (Output_Object : in Texinfo_Output_Type) is begin if Output_Object.In_Paragraph then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "In paragraph"); end if; end Check_Not_In_Paragraph; procedure Check_Valid (Output_Object : in Texinfo_Output_Type) is begin if not Output_Object.Is_Valid then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Not valid object"); end if; end Check_Valid; procedure Unexpected_State (Output_Object : in Texinfo_Output_Type) is begin Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Unexpected state: " & State_Type'Image (Output_Object.State)); end Unexpected_State; procedure Escape_Put (Output_Object : in Texinfo_Output_Type; Char : in Character; Preserve_Space : in Boolean := False) is begin -- Escape special chars if Char = '@' then Put (Output_Object.File, "@@"); elsif Char = '{' then Put (Output_Object.File, "@{"); elsif Char = '}' then Put (Output_Object.File, "@}"); elsif Char = ''' then -- Avoid makeinfo converting '' into " Put (Output_Object.File, "'@w{}"); elsif Char = '`' then -- Avoid makeinfo converting `` into " Put (Output_Object.File, "`@w{}"); elsif Char = '-' then Put (Output_Object.File, "@minus{}"); elsif Char = ' ' and Preserve_Space then -- Don't allow collapsing spaces Put (Output_Object.File, "@w{ }"); elsif Char = '\' then -- This confuses texi2dvi if not escaped. Put (Output_Object.File, "@code{\}"); else Put (Output_Object.File, Char); end if; end Escape_Put; procedure Escape_Put (Output_Object : in Texinfo_Output_Type; Text : in String; Preserve_Space : in Boolean := False) is begin for I in Text'Range loop Escape_Put (Output_Object, Text (I), Preserve_Space); end loop; end Escape_Put; procedure End_Title_Page (Output_Object : in out Texinfo_Output_Type) is use ARM_Contents; procedure Put_Top_Menu_Item (Title : in Title_Type; Level : in Level_Type; Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- we are only concerned with version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Level is when Section | Normative_Annex | Informative_Annex | Plain_Annex => Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Level, Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Title); when Unnumbered_Section | Clause | Subclause | Subsubclause => null; when ARM_Contents.Dead_Clause => raise Program_Error with "Dead_Clause header??"; -- No headers for dead clauses. end case; end Put_Top_Menu_Item; procedure Put_Top_Menu is new For_Each (Put_Top_Menu_Item); begin New_Line (Output_Object.File); -- Terminate unneeded "@center" Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* Front Matter:: Copyright, Foreword, etc."); -- Not a section in ARM sources Put_Top_Menu; Put_Line (Output_Object.File, "* Index :: Index"); -- Not in ARM sources Put_Line (Output_Object.File, "@end menu"); -- @node current Put_Line (Output_Object.File, "@node Front Matter"); Put_Line (Output_Object.File, "@chapter Front Matter"); end End_Title_Page; procedure Get_Clause_Section (Clause_String : in String; Section_Number : out ARM_Contents.Section_Number_Type; Clause_Integer : out Natural) is -- This is a partial inverse of ARM_Contents.Make_Clause_Number. -- -- Clause_String has "section.clause.subclause", possibly no subclause. -- -- "section" can be a number, a letter "N", or "Annex N", where -- -- 'N' = Character'Val (Character'Pos('A') + (Section_Number - ANNEX_START) Section_Dot : constant Natural := Ada.Strings.Fixed.Index (Source => Clause_String, Pattern => "."); Clause_Dot : constant Natural := Ada.Strings.Fixed.Index (Source => Clause_String (Section_Dot + 1 .. Clause_String'Last), Pattern => "."); use type ARM_Contents.Section_Number_Type; begin if Section_Dot = 8 then -- Section is "Annex N" Section_Number := ARM_Contents.ANNEX_START + Character'Pos (Clause_String (Clause_String'First + 6)) - Character'Pos ('A'); elsif Character'Pos (Clause_String (Clause_String'First)) >= Character'Pos ('A') then -- Section is letter. Section_Number := ARM_Contents.ANNEX_START + Character'Pos (Clause_String (Clause_String'First)) - Character'Pos ('A'); else Section_Number := ARM_Contents.Section_Number_Type'Value (Clause_String (Clause_String'First .. Section_Dot - 1)); end if; if Clause_Dot = 0 then Clause_Integer := Natural'Value (Clause_String (Section_Dot + 1 .. Clause_String'Last)); else Clause_Integer := Natural'Value (Clause_String (Section_Dot + 1 .. Clause_Dot - 1)); end if; end Get_Clause_Section; procedure Handle_Indent (Output_Object : in Texinfo_Output_Type; Texinfo_Item : in String; Extra_Indent : in ARM_Output.Paragraph_Indent_Type := 0) is use type ARM_Output.Paragraph_Indent_Type; begin for I in 1 .. Output_Object.Indent + Extra_Indent loop Put_Line (Output_Object.File, Texinfo_Item); end loop; end Handle_Indent; procedure Add_To_Column_Item (Output_Object : in out Texinfo_Output_Type; Text : in String) is begin if Output_Object.Column_Text (Output_Object.Current_Column) = null or else Output_Object.Column_Text (Output_Object.Current_Column).Row /= Output_Object.Current_Row then -- Start a new row. Output_Object.Column_Text (Output_Object.Current_Column) := new Column_Text_Item_Type' (Text => (others => ' '), Length => 0, Row => Output_Object.Current_Row, Next => Output_Object.Column_Text (Output_Object.Current_Column)); end if; if Output_Object.Column_Text (Output_Object.Current_Column).Length + Text'Length > Output_Object.Column_Text (Output_Object.Current_Column).Text'Length then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Column item full, but more text: " & Output_Object.Column_Text (Output_Object.Current_Column).Text (1 .. Output_Object.Column_Text (Output_Object.Current_Column).Length)); else declare Current_Text : Column_Text_Item_Type renames Output_Object.Column_Text (Output_Object.Current_Column).all; begin Current_Text.Text (Current_Text.Length + 1 .. Current_Text.Length + Text'Length) := Text; Current_Text.Length := Current_Text.Length + Text'Length; if Output_Object.Column_Widths (Output_Object.Current_Column) < Current_Text.Length then Output_Object.Column_Widths (Output_Object.Current_Column) := Current_Text.Length; end if; end; end if; end Add_To_Column_Item; procedure Pad_Columns (Output_Object : in out Texinfo_Output_Type) -- Ensure that all columns have the same number of (possibly -- empty) rows, for table headers. is Item : Column_Text_Ptr; First_New_Row : Natural; begin for Col in 1 .. Output_Object.Column_Count loop Item := Output_Object.Column_Text (Col); if Item = null then First_New_Row := 1; else First_New_Row := Item.Row + 1; end if; for I in First_New_Row .. Output_Object.Max_Row loop Output_Object.Column_Text (Col) := new Column_Text_Item_Type' (Text => (others => ' '), Length => 1, Row => I, Next => Output_Object.Column_Text (Col)); end loop; end loop; end Pad_Columns; procedure Output_Column_Widths (Output_Object : in out Texinfo_Output_Type) is begin New_Line (Output_Object.File); Put (Output_Object.File, "@multitable "); for I in 1 .. Output_Object.Column_Count loop Put (Output_Object.File, " {" & String'(1 .. Output_Object.Column_Widths (I) => 'w') & "}"); end loop; end Output_Column_Widths; procedure Output_Columns (Output_Object : in out Texinfo_Output_Type) is Row : Natural := 1; Item : Column_Text_Ptr; Temp : Column_Text_Ptr; begin Rows : loop New_Line (Output_Object.File); Put (Output_Object.File, "@item "); -- For all columns, output the items for this row. Note that -- the last row is at the front of each column list; the -- first row is at the end. We delete the rows as we output -- them, so the one we want is always at the end of the -- column list. Columns : for Col in 1 .. Output_Object.Column_Count loop Item := Output_Object.Column_Text (Col); if Item = null then -- Previously finished column null; elsif Item.Next = null then -- This is the last item in the column. if Item.Row /= Row then -- This column is empty for this row. Item := null; else -- Output Item, and mark that we're done outputing -- this column. Output_Object.Column_Text (Col) := null; end if; else -- Find first item for this row in the column. while Item.Next /= null and then Item.Next.Row /= Row loop Item := Item.Next; end loop; -- Output Item.Next, take it out of list. Temp := Item; Item := Item.Next; Temp.Next := null; end if; if Item /= null then -- Output the item Escape_Put (Output_Object, Item.Text (1 .. Item.Length), Preserve_Space => True); Free (Item); if Col /= Output_Object.Column_Count then Put (Output_Object.File, " @tab "); end if; else -- This column is empty for this row if Col < Output_Object.Column_Count then Put (Output_Object.File, " @tab "); end if; end if; end loop Columns; if Output_Object.Column_Text = Column_Text_Ptrs_Type'(others => null) then -- We've output everything. exit Rows; end if; -- End the row: Row := Row + 1; end loop Rows; end Output_Columns; procedure Index_Menu (Output_Object : in out Texinfo_Output_Type) is begin Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* operators::"); Put_Line (Output_Object.File, "* A::"); Put_Line (Output_Object.File, "* B::"); Put_Line (Output_Object.File, "* C::"); Put_Line (Output_Object.File, "* D::"); Put_Line (Output_Object.File, "* E::"); Put_Line (Output_Object.File, "* F::"); Put_Line (Output_Object.File, "* G::"); Put_Line (Output_Object.File, "* H::"); Put_Line (Output_Object.File, "* I::"); Put_Line (Output_Object.File, "* J::"); Put_Line (Output_Object.File, "* K::"); Put_Line (Output_Object.File, "* L::"); Put_Line (Output_Object.File, "* M::"); Put_Line (Output_Object.File, "* N::"); Put_Line (Output_Object.File, "* O::"); Put_Line (Output_Object.File, "* P::"); Put_Line (Output_Object.File, "* Q::"); Put_Line (Output_Object.File, "* R::"); Put_Line (Output_Object.File, "* S::"); Put_Line (Output_Object.File, "* T::"); Put_Line (Output_Object.File, "* U::"); Put_Line (Output_Object.File, "* V::"); Put_Line (Output_Object.File, "* W::"); Put_Line (Output_Object.File, "* X::"); Put_Line (Output_Object.File, "* Y::"); -- Put_Line (Output_Object.File, "* Z::"); -- VERSION: No entries in Z Put_Line (Output_Object.File, "@end menu"); -- @node current Put_Line (Output_Object.File, "@node " & Operators_Clause); Put_Line (Output_Object.File, "@section operators"); end Index_Menu; ---------- -- Public subprograms. Alphabetical order procedure AI_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; AI_Number : in String) is begin Ordinary_Text (Output_Object, AI_Number & Text); end AI_Reference; procedure Category_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : String) is begin Check_Not_In_Paragraph (Output_Object); -- Can't be in a multi-column setting. -- -- Don't use @heading; that causes a weird underline in info, -- that isn't centered! Put_Line (Output_Object.File, "@center @emph{" & Header_Text & "}"); New_Line (Output_Object.File, 2); end Category_Header; procedure Clause_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False) is pragma Unreferenced (No_Page_Break); pragma Unreferenced (Top_Level_Subdivision_Name); Title : constant String := Clause_Number & " " & Header_Text; use ARM_Contents; Section_Number : Section_Number_Type; Clause_Integer : Natural; procedure Put_Clause_Menu_Item (Item_Title : in Title_Type; Item_Level : in Level_Type; Item_Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- only version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Item_Level is when Section | Unnumbered_Section | Normative_Annex | Informative_Annex | Plain_Annex | Subclause | Subsubclause => -- We are doing Clause here null; when Clause => if Item_Clause_Number.Section < Section_Number then null; elsif Item_Clause_Number.Section = Section_Number then Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Item_Level, Item_Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Item_Title); else Quit := True; end if; when Dead_Clause => raise Program_Error with "Dead Clause in menu??"; -- No dead clauses should be output. end case; end Put_Clause_Menu_Item; procedure Put_Clause_Menu is new For_Each (Put_Clause_Menu_Item); procedure Put_Subclause_Menu_Item (Item_Title : in Title_Type; Item_Level : in Level_Type; Item_Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- only version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Item_Level is when Section | Unnumbered_Section | Normative_Annex | Informative_Annex | Plain_Annex | Clause | Subsubclause => -- We are doing Subclause here null; when Subclause => if Item_Clause_Number.Section < Section_Number then null; elsif Item_Clause_Number.Section = Section_Number then if Item_Clause_Number.Clause < Clause_Integer then null; elsif Item_Clause_Number.Clause = Clause_Integer then Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Item_Level, Item_Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Item_Title); else Quit := True; end if; else Quit := True; end if; when Dead_Clause => raise Program_Error with "Dead clause in submenu??"; -- No dead clauses should be output. end case; end Put_Subclause_Menu_Item; procedure Put_Subclause_Menu is new For_Each (Put_Subclause_Menu_Item); begin Check_Not_In_Paragraph (Output_Object); -- Handle special cases if Clause_Number = "" and Header_Text = "Table of Contents" then -- Actual contents output in TOC_Marker below. return; elsif Header_Text = "The Standard Libraries" then -- This section has no content; don't confuse makeinfo. return; elsif Header_Text = Index_Clause_Name then Put_Line (Output_Object.File, "@node " & Index_Clause_Name); Put_Line (Output_Object.File, "@chapter Index"); Output_Object.State := Index_Start; return; end if; case Level is when Section | Normative_Annex | Informative_Annex | Plain_Annex => -- Menu of these done at @node Top null; when Unnumbered_Section => -- Unnumbered sections are not in ARM_Contents, but there's -- currently only one of them, so they are not worth adding; -- just hard-code the menu here. Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Section_Number = 0 and Clause_Integer = 1 then Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* 0.1 :: Foreword to this version of the Ada Reference Manual"); Put_Line (Output_Object.File, "* 0.2 :: Foreword"); Put_Line (Output_Object.File, "* 0.3 :: Introduction"); Put_Line (Output_Object.File, "* 0.99 :: International Standard"); Put_Line (Output_Object.File, "@end menu"); end if; when Clause => -- Output menu of Clauses in this section, if we haven't already Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Output_Object.Menu_Section /= Section_Number then Put_Line (Output_Object.File, "@menu"); Put_Clause_Menu; Put_Line (Output_Object.File, "@end menu"); Output_Object.Menu_Section := Section_Number; Output_Object.Menu_Clause := 0; end if; when Subclause => -- Output menu of Subclauses in this Clause, if we haven't already Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Output_Object.Menu_Section = Section_Number and Output_Object.Menu_Clause /= Clause_Integer then Put_Line (Output_Object.File, "@menu"); Put_Subclause_Menu; Put_Line (Output_Object.File, "@end menu"); Output_Object.Menu_Clause := Clause_Integer; end if; when Subsubclause => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Clause_Header: Subsubclause"); when Dead_Clause => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Clause_Header: Dead_clause"); end case; Put_Line (Output_Object.File, "@node " & Clause_Number); case Level is when Section => Put_Line (Output_Object.File, "@chapter " & Title); when Normative_Annex | Informative_Annex | Plain_Annex => Put_Line (Output_Object.File, "@chapter " & Title); when Clause | Unnumbered_Section => Put_Line (Output_Object.File, "@section " & Title); when Subclause => Put_Line (Output_Object.File, "@subsection " & Title); when Subsubclause => Put_Line (Output_Object.File, "@subsubsection " & Title); when Dead_Clause => raise Program_Error with "Dead_Clause in header?"; -- No output of dead clauses. end case; end Clause_Header; procedure Clause_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Clause_Number : in String) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => -- If this happens, we need to store escaped text in columns. Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "clause reference in multi-column"); when Normal => if Text = Clause_Number then Put (Output_Object.File, "@ref{" & Clause_Number & "}"); else Put (Output_Object.File, "@ref{" & Clause_Number & "} " & Text); end if; when Title | Index_Start | Index => Unexpected_State (Output_Object); end case; end Clause_Reference; procedure Close (Output_Object : in out Texinfo_Output_Type) is begin Check_Valid (Output_Object); Put_Line (Output_Object.File, "@bye"); Close (Output_Object.File); Output_Object.Is_Valid := False; end Close; procedure Create (Output_Object : in out Texinfo_Output_Type; File_Prefix : in String; Output_Path : in String; Change_Version : in ARM_Contents.Change_Version_Type; Title : in String) is File_Name : constant String := Output_Path & Ada.Strings.Fixed.Trim (File_Prefix, Ada.Strings.Right) & ".texinfo"; begin if Output_Object.Is_Valid then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Already valid object"); end if; Output_Object.Is_Valid := True; Create (Output_Object.File, Out_File, File_Name); Put_Line (Output_Object.File, "\input texinfo"); Put_Line (Output_Object.File, "@documentencoding ISO-8859-1"); Put_Line (Output_Object.File, "@dircategory GNU Ada tools"); Put_Line (Output_Object.File, "@direntry"); case Change_Version is when '2' => Put_Line (Output_Object.File, "* Ada Reference Manual: (arm2005)."); Put_Line (Output_Object.File, "* Annotated ARM: (arm2005)."); when '3' => Put_Line (Output_Object.File, "* Ada Reference Manual: (arm2012)."); Put_Line (Output_Object.File, "* Annotated ARM: (arm2012)."); when '4' => Put_Line (Output_Object.File, "* Ada Reference Manual TC1: (arm2012)."); Put_Line (Output_Object.File, "* Annotated ARM TC1: (arm2012)."); when others => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "unsupported Change_Version"); end case; Put_Line (Output_Object.File, "@end direntry"); Put_Line (Output_Object.File, "@settitle " & Title); Put_Line (Output_Object.File, "@paragraphindent none"); Put_Line (Output_Object.File, "@exampleindent" & Integer'Image (Indentation)); Put_Line (Output_Object.File, "@node Top"); Put_Line (Output_Object.File, "@top " & Title); Output_Object.State := ARM_Texinfo.Title; Output_Object.First_Word_Last := 0; end Create; procedure DR_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; DR_Number : in String) is begin Ordinary_Text (Output_Object, DR_Number & Text); end DR_Reference; procedure End_Hang_Item (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin Output_Object.End_Hang_Seen := True; case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => Handle_Indent (Output_Object, "@quotation"); when Index | Title => null; when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => Handle_Indent (Output_Object, "@example"); when Bulleted | Small_Bulleted => Handle_Indent (Output_Object, "@itemize"); when Nested_Bulleted | Small_Nested_Bulleted => Handle_Indent (Output_Object, "@itemize", Extra_Indent => 1); when Enumerated | Small_Enumerated => -- Number has just been output; start text. Put (Output_Object.File, "@w{ }"); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@quotation"); end case; end End_Hang_Item; procedure Text_Format (Output_Object : in out Texinfo_Output_Type; Format : in ARM_Output.Format_Type) is begin -- We only handle italic, for annotated syntax item names if Format.Italic /= Output_Object.Format.Italic then -- Info format does not support fonts, so we use <> Put (Output_Object.File, (if Format.Italic then '<' else '>')); end if; Output_Object.Format := Format; end Text_Format; procedure End_Paragraph (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin Output_Object.In_Paragraph := False; case Output_Object.State is when Contents => null; when Multi_Column => -- Skip a row, to separate paragraphs in a column. Output_Object.Current_Row := Output_Object.Current_Row + 2; when Title => if Output_Object.Line_Empty then null; else New_Line (Output_Object.File, 2); Put (Output_Object.File, "@center "); Output_Object.Line_Empty := True; end if; when Normal => case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end quotation"); New_Line (Output_Object.File); when Index | Title => New_Line (Output_Object.File, 2); when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end example"); New_Line (Output_Object.File); when Bulleted | Small_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize"); New_Line (Output_Object.File); when Nested_Bulleted | Small_Nested_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize", Extra_Indent => 1); New_Line (Output_Object.File); when Enumerated | Small_Enumerated => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize"); New_Line (Output_Object.File); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => New_Line (Output_Object.File); if Output_Object.End_Hang_Seen then Handle_Indent (Output_Object, "@end quotation"); end if; New_Line (Output_Object.File); end case; when Index_Start => Output_Object.State := Index; Index_Menu (Output_Object); when Index => -- Keep index items tightly grouped. Put_Line (Output_Object.File, "@*"); when Table_Header => Unexpected_State (Output_Object); end case; end End_Paragraph; procedure Hard_Space (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => -- Can't do line breaks in columns Add_To_Column_Item (Output_Object, " "); when Title => if Output_Object.Line_Empty then null; else Put (Output_Object.File, "@w{ }"); end if; when Normal | Index_Start | Index => Put (Output_Object.File, "@w{ }"); end case; end Hard_Space; procedure Index_Line_Break (Output_Object : in out Texinfo_Output_Type; Clear_Keep_with_Next : in Boolean) is pragma Unreferenced (Clear_Keep_with_Next); begin Put_Line (Output_Object.File, "@*"); end Index_Line_Break; procedure Index_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Index_Key : in Natural; Clause_Number : in String) is pragma Unreferenced (Clause_Number); -- Text is clause_number & paragraph number (optional). begin Put (Output_Object.File, "@ref{" & Integer'Image (Index_Key) & ", " & Text & "}"); end Index_Reference; procedure Index_Target (Output_Object : in out Texinfo_Output_Type; Index_Key : in Natural) is begin -- Add an empty non-break object, because @anchor ignores -- whitespace after it, which often occurs in the current -- Scribe-like source. Put (Output_Object.File, "@anchor{" & Integer'Image (Index_Key) & "}@w{}"); end Index_Target; procedure Line_Break (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin case Output_Object.State is when Title => if Output_Object.Line_Empty then null; else Put_Line (Output_Object.File, "@*"); Output_Object.Line_Empty := True; end if; when Contents => null; when Multi_Column | Table_Header => Output_Object.Current_Row := Output_Object.Current_Row + 1; if Output_Object.Max_Row < Output_Object.Current_Row then Output_Object.Max_Row := Output_Object.Current_Row; end if; when Index_Start => -- This doesn't happen Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Line_Break Index_Start"); when Normal | Index => case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary | Index | Title => Put_Line (Output_Object.File, "@*"); when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => New_Line (Output_Object.File); when Bulleted | Small_Bulleted | Nested_Bulleted | Small_Nested_Bulleted | Enumerated | Small_Enumerated | Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => Put_Line (Output_Object.File, "@*"); end case; end case; end Line_Break; procedure Local_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String; Clause_Number : in String) is pragma Unreferenced (Target); pragma Unreferenced (Clause_Number); begin -- These are typically references to words in the grammar -- summary. Mildly useful, but the best we can do is: -- -- "@ref{" & Target & "," & Text & "}" -- -- makeinfo prepends 'see' and postpends '.', so it screws up -- the text. For example, section 2.1 (1) ends up with "the -- @ref{S0229, compilation}s." => "the see compilation: S0229." -- Emacs info-mode suppresses the ': S0229', but not the 'see' -- and the trailing '.'. So we just output the text. Ordinary_Text (Output_Object, Text); end Local_Link; procedure Local_Link_End (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String) is begin -- These work better than local links, because they are not in -- the middle of plurals. First use is section 3.1 (1). Put (Output_Object.File, " (@pxref{" & Target & "," & Clause_Number & "})"); end Local_Link_End; procedure Local_Link_Start (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String) is pragma Unreferenced (Output_Object); pragma Unreferenced (Target); pragma Unreferenced (Clause_Number); begin -- implemented in Local_Link_End null; end Local_Link_Start; procedure Local_Target (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String) is begin -- Add an empty non-break object, because @anchor ignores -- whitespace after it, which often occurs in the current -- Scheme source. Put (Output_Object.File, "@anchor{" & Target & "}@w{}"); Ordinary_Text (Output_Object, Text); end Local_Target; procedure New_Column (Output_Object : in out Texinfo_Output_Type) is begin if Output_Object.Column_Count >= 4 then Output_Object.Current_Column := Output_Object.Current_Column + 1; Output_Object.Current_Row := 1; end if; end New_Column; procedure New_Page (Output_Object : in out Texinfo_Output_Type; Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page) is pragma Unreferenced (Kind); pragma Unreferenced (Output_Object); begin -- No such thing in Info. null; end New_Page; procedure Ordinary_Character (Output_Object : in out Texinfo_Output_Type; Char : in Character) is Copyright : constant String := "Copyright"; begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Add_To_Column_Item (Output_Object, "" & Char); when Title => -- Check for end of title page; indicated by line starting with "Copyright" if Output_Object.Line_Empty then if Output_Object.First_Word_Last > 0 then if Copyright (Output_Object.First_Word_Last + 1) = Char then Output_Object.First_Word_Last := Output_Object.First_Word_Last + 1; Output_Object.First_Word (Output_Object.First_Word_Last) := Char; if Output_Object.First_Word_Last = Copyright'Last then End_Title_Page (Output_Object); Output_Object.State := Normal; Ordinary_Text (Output_Object, Output_Object.First_Word (1 .. Output_Object.First_Word_Last)); end if; else -- First word is not Copyright; output it Ordinary_Text (Output_Object, Output_Object.First_Word (1 .. Output_Object.First_Word_Last)); Output_Object.Line_Empty := False; end if; else -- No non-space seen yet if Char = ' ' then null; elsif Char = Copyright (1) then Output_Object.First_Word_Last := 1; Output_Object.First_Word (1) := Char; else Escape_Put (Output_Object, Char); Output_Object.Line_Empty := False; end if; end if; else -- Line already has stuff on it Escape_Put (Output_Object, Char); end if; when Normal => Output_Object.Line_Empty := Char /= ' '; Escape_Put (Output_Object, Char); when Index_Start => Escape_Put (Output_Object, Char); if Char = '&' then -- give debugger a place to break Put_Line ("first index entry"); end if; when Index => case Char is when ' ' | ',' | '[' | ']' => Put (Output_Object.File, Char); when 'A' .. Last_Index_Clause => -- Index section heading -- @node current Put_Line (Output_Object.File, "@node " & Char); -- Add non-break space so Emacs info will use big bold -- font for single letter titles. Put_Line (Output_Object.File, "@section " & Char & "@w{ }"); when others => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Unexpected char in Index: " & Char); end case; end case; end Ordinary_Character; procedure Ordinary_Text (Output_Object : in out Texinfo_Output_Type; Text : in String) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Add_To_Column_Item (Output_Object, Text); when Normal | Title | Index_Start | Index => Output_Object.Line_Empty := False; Escape_Put (Output_Object, Text); end case; end Ordinary_Text; procedure Picture (Output_Object : in out Texinfo_Output_Type; Name : in String; Descr : in String; Alignment : in ARM_Output.Picture_Alignment; Height, Width : in Natural; Border : in ARM_Output.Border_Kind) is pragma Unreferenced (Border); pragma Unreferenced (Width); pragma Unreferenced (Height); pragma Unreferenced (Alignment); pragma Unreferenced (Name); begin Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Picture: " & Descr); end Picture; procedure Revised_Clause_Header (Output_Object : in out Texinfo_Output_Type; New_Header_Text : in String; Old_Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Version : in ARM_Contents.Change_Version_Type; Old_Version : in ARM_Contents.Change_Version_Type; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False) is pragma Unreferenced (Version); pragma Unreferenced (Old_Version); pragma Unreferenced (Old_Header_Text); begin Clause_Header (Output_Object, New_Header_Text, Level, Clause_Number, Top_Level_Subdivision_Name, No_Page_Break); end Revised_Clause_Header; procedure Section (Output_Object : in out Texinfo_Output_Type; Section_Title : in String; Section_Name : in String) is pragma Unreferenced (Section_Name); pragma Unreferenced (Section_Title); pragma Unreferenced (Output_Object); begin -- This is redundant with the various Clause functions null; end Section; procedure Separator_Line (Output_Object : in out Texinfo_Output_Type; Is_Thin : Boolean := True) is begin -- Can't be in a multi-column setting. New_Line (Output_Object.File); if Is_Thin then Put_Line (Output_Object.File, "----------"); else Put_Line (Output_Object.File, "=========="); end if; end Separator_Line; procedure Set_Columns (Output_Object : in out Texinfo_Output_Type; Number_of_Columns : in ARM_Output.Column_Count) is begin Check_Valid (Output_Object); Check_Not_In_Paragraph (Output_Object); -- 2 and 3 column formats are displayed without any columns. -- This is mainly used for the syntax cross-reference and -- index, and these definitely look better without columns. -- -- 4 or more columns are output as a table. Note that we assume -- such items are formated with explicit New_Column calls, and -- do not contain any nested paragraph formats. case Output_Object.State is when Normal => if Number_of_Columns >= 4 then Output_Object.State := Multi_Column; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Column_Widths := (others => 0); -- Accumulate all column rows in Output_Text, then output -- when done, so we can set the correct column width in -- the header. Each column is a linked list of allocated -- Column_Text_Item_Type. else null; end if; when Multi_Column => if Number_of_Columns = 1 then -- Finished accumulating columns, output the columns as a table. Output_Column_Widths (Output_Object); Output_Columns (Output_Object); New_Line (Output_Object.File); Put_Line (Output_Object.File, "@end multitable"); New_Line (Output_Object.File); Output_Object.State := Normal; else Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "New multi-column section before end of old"); end if; when Index_Start | Index => null; when Table_Header | Contents | Title => Unexpected_State (Output_Object); end case; Output_Object.Column_Count := Number_of_Columns; end Set_Columns; procedure Soft_Hyphen_Break (Output_Object : in out Texinfo_Output_Type) is begin Put (Output_Object.File, "@-"); end Soft_Hyphen_Break; procedure Soft_Line_Break (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents | Title => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@-"); when Multi_Column | Table_Header => Unexpected_State (Output_Object); end case; end Soft_Line_Break; procedure Special_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Special_Character_Type) is begin -- We use Ordinary_Text, so this is output to columns when appropriate. case Char is when ARM_Output.EM_Dash => Ordinary_Text (Output_Object, "--"); when ARM_Output.EN_Dash => Ordinary_Text (Output_Object, "-"); -- used for '-' in binary_adding_operator when ARM_Output.GEQ => Ordinary_Text (Output_Object, ">="); when ARM_Output.LEQ => Ordinary_Text (Output_Object, "<="); when ARM_Output.NEQ => Ordinary_Text (Output_Object, "/="); when ARM_Output.PI => Ordinary_Text (Output_Object, "PI"); when ARM_Output.Left_Ceiling => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support ceiling in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@code{ceiling("); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Right_Ceiling => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support ceiling in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, ")}"); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Left_Floor => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support floor in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@code{floor("); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Right_Floor => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support floor in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, ")}"); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Thin_Space => Ordinary_Text (Output_Object, " "); when ARM_Output.Left_Quote => Ordinary_Text (Output_Object, "`"); when ARM_Output.Right_Quote => Ordinary_Text (Output_Object, "'"); when ARM_Output.Left_Double_Quote => Ordinary_Text (Output_Object, """"); when ARM_Output.Right_Double_Quote => Ordinary_Text (Output_Object, """"); when ARM_Output.Small_Dotless_I => Ordinary_Text (Output_Object, "i"); when ARM_Output.Capital_Dotted_I => Ordinary_Text (Output_Object, "I"); end case; end Special_Character; procedure Start_Paragraph (Output_Object : in out Texinfo_Output_Type; Style : in ARM_Output.Paragraph_Style_Type; Indent : in ARM_Output.Paragraph_Indent_Type; Number : in String; No_Prefix : in Boolean := False; Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS; No_Breaks : in Boolean := False; Keep_with_Next : in Boolean := False; Space_After : in ARM_Output.Space_After_Type := ARM_Output.Normal; Justification : in ARM_Output.Justification_Type := ARM_Output.Default) is pragma Unreferenced (Justification); pragma Unreferenced (Space_After); pragma Unreferenced (Keep_with_Next); pragma Unreferenced (No_Breaks); pragma Unreferenced (Tab_Stops); use ARM_Output; begin Check_Valid (Output_Object); Check_Not_In_Paragraph (Output_Object); -- Note: makeinfo will do most of the formatting, so No_Breaks, -- Keep_with_Next, Space_After, and Justification have no -- effect here. In addition, info format has no support for -- fonts, so the font aspects of Style are ignored as well. But -- we try to respect the indentation and margin aspects. -- TexInfo does not directly support tabs, but does use a fixed -- font, so we could emulate them. But then we'd have to track -- output characters; let's see if we really need it. case Output_Object.State is when Contents => null; when Normal => if Number'Length > 0 then Put_Line (Output_Object.File, Number & " @*"); end if; Output_Object.In_Paragraph := True; Output_Object.Style := Style; Output_Object.Indent := Indent; case Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => Handle_Indent (Output_Object, "@quotation"); when Index | Title => null; when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => Handle_Indent (Output_Object, "@example"); when Bulleted | Small_Bulleted => Handle_Indent (Output_Object, "@itemize @bullet"); if not No_Prefix then Put (Output_Object.File, "@item "); end if; when Nested_Bulleted | Small_Nested_Bulleted => Handle_Indent (Output_Object, "@itemize @bullet", Extra_Indent => 1); if not No_Prefix then Put (Output_Object.File, "@item "); end if; when Enumerated | Small_Enumerated => Handle_Indent (Output_Object, "@itemize @w{}"); Put (Output_Object.File, "@item "); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => if No_Prefix then -- Still in hanging part Handle_Indent (Output_Object, "@quotation"); Output_Object.End_Hang_Seen := True; else Output_Object.End_Hang_Seen := False; end if; end case; when Index_Start | Index | Title | Multi_Column | Table_Header => if Number'Length > 0 then Unexpected_State (Output_Object); end if; Output_Object.In_Paragraph := True; Output_Object.Style := Style; Output_Object.Indent := Indent; end case; end Start_Paragraph; procedure Start_Table (Output_Object : in out Texinfo_Output_Type; Columns : in ARM_Output.Column_Count; First_Column_Width : in ARM_Output.Column_Count; Last_Column_Width : in ARM_Output.Column_Count; Alignment : in ARM_Output.Column_Text_Alignment; No_Page_Break : in Boolean; Has_Border : in Boolean; Small_Text_Size : in Boolean; Header_Kind : in ARM_Output.Header_Kind_Type) is pragma Unreferenced (Small_Text_Size); pragma Unreferenced (Has_Border); pragma Unreferenced (No_Page_Break); pragma Unreferenced (Alignment); pragma Unreferenced (Last_Column_Width); pragma Unreferenced (First_Column_Width); use ARM_Output; begin Output_Object.Column_Count := Columns; case Header_Kind is when Both_Caption_and_Header => New_Line (Output_Object.File); -- Next text output will be the caption, which we don't -- format in any special way (first example is F.3.2 (19)). -- Then Table_Marker (End_Caption) is called, which will -- start the actual table. when Header_Only => -- Same as Table_Marker, End_Caption. case Columns is when 1 => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Table with 1 column"); when 2 => -- @table doesn't work inside @display; PDFTex fails with @table here. -- https://lists.gnu.org/archive/html/bug-texinfo/2004-10/txtJLetHrEhdc.txt New_Line (Output_Object.File); Put_Line (Output_Object.File, "@multitable {wwwwwwwwww} {wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww}"); Put (Output_Object.File, "@headitem "); when others => New_Line (Output_Object.File); Put (Output_Object.File, "@multitable"); Output_Object.State := Table_Header; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Max_Row := 0; -- The next text output via Ordinary_Text or -- Ordinary_Character is the table headers. We -- capture them in Output_Object.Column_Text, and -- use them to set the table column widths. end case; when No_Headers => null; end case; end Start_Table; procedure Tab (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Tab in multi-column"); when Title => if Output_Object.Line_Empty then null; else Put (Output_Object.File, "@w{ }"); end if; when Normal | Index_Start | Index => -- Just three spaces for now, for indented trees Put (Output_Object.File, "@w{ }"); end case; end Tab; procedure Table_Marker (Output_Object : in out Texinfo_Output_Type; Marker : in ARM_Output.Table_Marker_Type) is begin case Marker is when ARM_Output.End_Caption => -- Start the actual table case Output_Object.Column_Count is when 1 => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Table with 1 column"); when 2 => New_Line (Output_Object.File); Put_Line (Output_Object.File, "@multitable {wwwwwwwwww} {wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww}"); Put (Output_Object.File, "@headitem "); when others => New_Line (Output_Object.File); Put (Output_Object.File, "@multitable"); Output_Object.State := Table_Header; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Max_Row := 0; -- The next text output via Ordinary_Text or -- Ordinary_Character is the table headers. We -- capture them in Output_Object.Column_Text, and -- use them to set the table column widths. end case; when ARM_Output.End_Item => case Output_Object.State is when Table_Header => Output_Object.Current_Column := Output_Object.Current_Column + 1; Output_Object.Current_Row := 1; when Normal => case Output_Object.Column_Count is when 2 => New_Line (Output_Object.File); Put (Output_Object.File, "@tab "); when others => Put (Output_Object.File, " @tab "); end case; when Multi_Column | Contents | Title | Index_Start | Index => Unexpected_State (Output_Object); end case; when ARM_Output.End_Header => case Output_Object.State is when Table_Header => Output_Object.State := Normal; for I in 1 .. Output_Object.Column_Count loop Put (Output_Object.File, " {" & Output_Object.Column_Text (I).Text (1 .. Output_Object.Column_Text (I).Length) & "}"); end loop; New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Pad_Columns (Output_Object); Output_Columns (Output_Object); New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Output_Object.Current_Column := 1; when Normal => -- A two-column table; header has been output New_Line (Output_Object.File); Put (Output_Object.File, "@item "); when Contents | Multi_Column | Title | Index_Start | Index => Unexpected_State (Output_Object); end case; when ARM_Output.End_Row | ARM_Output.End_Row_Next_Is_Last => New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Output_Object.Current_Column := 1; when ARM_Output.End_Table => case Output_Object.Column_Count is when 2 => New_Line (Output_Object.File); Put_Line (Output_Object.File, "@end multitable"); when others => Put_Line (Output_Object.File, "@end multitable"); end case; end case; end Table_Marker; procedure TOC_Marker (Output_Object : in out Texinfo_Output_Type; For_Start : in Boolean) is begin -- We use menus, not @contents (since makeinfo ignores -- @contents in info mode). The menus (including the top menu) -- are generated from data stored in ARM_Contents during the -- scan pass. if For_Start then Output_Object.State := Contents; -- Ignore futher output until For_Start = False. else Output_Object.State := Normal; end if; end TOC_Marker; procedure Unicode_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Unicode_Type) is begin -- Used in section 2.3 Identifiers examples, 2.5 character -- literals examples, 2.6 string literals examples, 3.3.1 -- Object Declarations examples, 4.4 Expressions examples Put (Output_Object.File, "[Unicode" & ARM_Output.Unicode_Type'Image (Char) & "]"); end Unicode_Character; procedure URL_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; URL : in String) is begin Put (Output_Object.File, "@uref{" & URL & "," & Text & "}"); end URL_Link; end ARM_Texinfo;
30698
with Ada.Exceptions; with Ada.Strings.Fixed; package body ARM_Texinfo is -- Copyright (C) 2003, 2007, 2010 - 2013, 2015, 2017, 2018 <NAME>. All Rights Reserved. -- E-Mail: <EMAIL> -- -- This library is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, 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 General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file gnu-3-0.txt. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- MA 02111-1307, USA. -- --------------------------------------- -- -- Edit History: -- -- Ancient - S L - Developed package as add-on to Arm_Form. -- 10/19/11 - RLB - Integrated outside-developed package into Arm_Form. -- Commented out/replaced Ada 2005 features (this is -- Ada 95 code). Updated for a few other changes since -- the last update. -- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header. -- 4/ 1/12 - S L - Implemented remaining Texinfo implementation. -- 4/22/12 - S L - Move @dircategory, @direntry before first @node. -- 4/28/12 - S L - Add @w{} after @anchor; otherwise following whitespace -- is dropped. -- 8/31/12 - RLB - Added Output_Path. -- 10/18/12 - RLB - Added additional hanging styles. -- 11/26/12 - RLB - Added subdivision names to Clause_Header and -- Revised_Clause_Header. -- 3/12/13 - S L - use correct version in direntry use Ada.Text_IO; Indentation : constant := 5; -- VERSION: This is fragile; it changes with each version of the manual. Index_Clause_Name : constant String := "Index"; Operators_Clause : constant String := "operators"; Last_Index_Clause : constant Character := 'Y'; ---------- -- local subprograms procedure Check_Not_In_Paragraph (Output_Object : in Texinfo_Output_Type) is begin if Output_Object.In_Paragraph then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "In paragraph"); end if; end Check_Not_In_Paragraph; procedure Check_Valid (Output_Object : in Texinfo_Output_Type) is begin if not Output_Object.Is_Valid then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Not valid object"); end if; end Check_Valid; procedure Unexpected_State (Output_Object : in Texinfo_Output_Type) is begin Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Unexpected state: " & State_Type'Image (Output_Object.State)); end Unexpected_State; procedure Escape_Put (Output_Object : in Texinfo_Output_Type; Char : in Character; Preserve_Space : in Boolean := False) is begin -- Escape special chars if Char = '@' then Put (Output_Object.File, "@@"); elsif Char = '{' then Put (Output_Object.File, "@{"); elsif Char = '}' then Put (Output_Object.File, "@}"); elsif Char = ''' then -- Avoid makeinfo converting '' into " Put (Output_Object.File, "'@w{}"); elsif Char = '`' then -- Avoid makeinfo converting `` into " Put (Output_Object.File, "`@w{}"); elsif Char = '-' then Put (Output_Object.File, "@minus{}"); elsif Char = ' ' and Preserve_Space then -- Don't allow collapsing spaces Put (Output_Object.File, "@w{ }"); elsif Char = '\' then -- This confuses texi2dvi if not escaped. Put (Output_Object.File, "@code{\}"); else Put (Output_Object.File, Char); end if; end Escape_Put; procedure Escape_Put (Output_Object : in Texinfo_Output_Type; Text : in String; Preserve_Space : in Boolean := False) is begin for I in Text'Range loop Escape_Put (Output_Object, Text (I), Preserve_Space); end loop; end Escape_Put; procedure End_Title_Page (Output_Object : in out Texinfo_Output_Type) is use ARM_Contents; procedure Put_Top_Menu_Item (Title : in Title_Type; Level : in Level_Type; Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- we are only concerned with version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Level is when Section | Normative_Annex | Informative_Annex | Plain_Annex => Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Level, Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Title); when Unnumbered_Section | Clause | Subclause | Subsubclause => null; when ARM_Contents.Dead_Clause => raise Program_Error with "Dead_Clause header??"; -- No headers for dead clauses. end case; end Put_Top_Menu_Item; procedure Put_Top_Menu is new For_Each (Put_Top_Menu_Item); begin New_Line (Output_Object.File); -- Terminate unneeded "@center" Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* Front Matter:: Copyright, Foreword, etc."); -- Not a section in ARM sources Put_Top_Menu; Put_Line (Output_Object.File, "* Index :: Index"); -- Not in ARM sources Put_Line (Output_Object.File, "@end menu"); -- @node current Put_Line (Output_Object.File, "@node Front Matter"); Put_Line (Output_Object.File, "@chapter Front Matter"); end End_Title_Page; procedure Get_Clause_Section (Clause_String : in String; Section_Number : out ARM_Contents.Section_Number_Type; Clause_Integer : out Natural) is -- This is a partial inverse of ARM_Contents.Make_Clause_Number. -- -- Clause_String has "section.clause.subclause", possibly no subclause. -- -- "section" can be a number, a letter "N", or "Annex N", where -- -- 'N' = Character'Val (Character'Pos('A') + (Section_Number - ANNEX_START) Section_Dot : constant Natural := Ada.Strings.Fixed.Index (Source => Clause_String, Pattern => "."); Clause_Dot : constant Natural := Ada.Strings.Fixed.Index (Source => Clause_String (Section_Dot + 1 .. Clause_String'Last), Pattern => "."); use type ARM_Contents.Section_Number_Type; begin if Section_Dot = 8 then -- Section is "Annex N" Section_Number := ARM_Contents.ANNEX_START + Character'Pos (Clause_String (Clause_String'First + 6)) - Character'Pos ('A'); elsif Character'Pos (Clause_String (Clause_String'First)) >= Character'Pos ('A') then -- Section is letter. Section_Number := ARM_Contents.ANNEX_START + Character'Pos (Clause_String (Clause_String'First)) - Character'Pos ('A'); else Section_Number := ARM_Contents.Section_Number_Type'Value (Clause_String (Clause_String'First .. Section_Dot - 1)); end if; if Clause_Dot = 0 then Clause_Integer := Natural'Value (Clause_String (Section_Dot + 1 .. Clause_String'Last)); else Clause_Integer := Natural'Value (Clause_String (Section_Dot + 1 .. Clause_Dot - 1)); end if; end Get_Clause_Section; procedure Handle_Indent (Output_Object : in Texinfo_Output_Type; Texinfo_Item : in String; Extra_Indent : in ARM_Output.Paragraph_Indent_Type := 0) is use type ARM_Output.Paragraph_Indent_Type; begin for I in 1 .. Output_Object.Indent + Extra_Indent loop Put_Line (Output_Object.File, Texinfo_Item); end loop; end Handle_Indent; procedure Add_To_Column_Item (Output_Object : in out Texinfo_Output_Type; Text : in String) is begin if Output_Object.Column_Text (Output_Object.Current_Column) = null or else Output_Object.Column_Text (Output_Object.Current_Column).Row /= Output_Object.Current_Row then -- Start a new row. Output_Object.Column_Text (Output_Object.Current_Column) := new Column_Text_Item_Type' (Text => (others => ' '), Length => 0, Row => Output_Object.Current_Row, Next => Output_Object.Column_Text (Output_Object.Current_Column)); end if; if Output_Object.Column_Text (Output_Object.Current_Column).Length + Text'Length > Output_Object.Column_Text (Output_Object.Current_Column).Text'Length then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Column item full, but more text: " & Output_Object.Column_Text (Output_Object.Current_Column).Text (1 .. Output_Object.Column_Text (Output_Object.Current_Column).Length)); else declare Current_Text : Column_Text_Item_Type renames Output_Object.Column_Text (Output_Object.Current_Column).all; begin Current_Text.Text (Current_Text.Length + 1 .. Current_Text.Length + Text'Length) := Text; Current_Text.Length := Current_Text.Length + Text'Length; if Output_Object.Column_Widths (Output_Object.Current_Column) < Current_Text.Length then Output_Object.Column_Widths (Output_Object.Current_Column) := Current_Text.Length; end if; end; end if; end Add_To_Column_Item; procedure Pad_Columns (Output_Object : in out Texinfo_Output_Type) -- Ensure that all columns have the same number of (possibly -- empty) rows, for table headers. is Item : Column_Text_Ptr; First_New_Row : Natural; begin for Col in 1 .. Output_Object.Column_Count loop Item := Output_Object.Column_Text (Col); if Item = null then First_New_Row := 1; else First_New_Row := Item.Row + 1; end if; for I in First_New_Row .. Output_Object.Max_Row loop Output_Object.Column_Text (Col) := new Column_Text_Item_Type' (Text => (others => ' '), Length => 1, Row => I, Next => Output_Object.Column_Text (Col)); end loop; end loop; end Pad_Columns; procedure Output_Column_Widths (Output_Object : in out Texinfo_Output_Type) is begin New_Line (Output_Object.File); Put (Output_Object.File, "@multitable "); for I in 1 .. Output_Object.Column_Count loop Put (Output_Object.File, " {" & String'(1 .. Output_Object.Column_Widths (I) => 'w') & "}"); end loop; end Output_Column_Widths; procedure Output_Columns (Output_Object : in out Texinfo_Output_Type) is Row : Natural := 1; Item : Column_Text_Ptr; Temp : Column_Text_Ptr; begin Rows : loop New_Line (Output_Object.File); Put (Output_Object.File, "@item "); -- For all columns, output the items for this row. Note that -- the last row is at the front of each column list; the -- first row is at the end. We delete the rows as we output -- them, so the one we want is always at the end of the -- column list. Columns : for Col in 1 .. Output_Object.Column_Count loop Item := Output_Object.Column_Text (Col); if Item = null then -- Previously finished column null; elsif Item.Next = null then -- This is the last item in the column. if Item.Row /= Row then -- This column is empty for this row. Item := null; else -- Output Item, and mark that we're done outputing -- this column. Output_Object.Column_Text (Col) := null; end if; else -- Find first item for this row in the column. while Item.Next /= null and then Item.Next.Row /= Row loop Item := Item.Next; end loop; -- Output Item.Next, take it out of list. Temp := Item; Item := Item.Next; Temp.Next := null; end if; if Item /= null then -- Output the item Escape_Put (Output_Object, Item.Text (1 .. Item.Length), Preserve_Space => True); Free (Item); if Col /= Output_Object.Column_Count then Put (Output_Object.File, " @tab "); end if; else -- This column is empty for this row if Col < Output_Object.Column_Count then Put (Output_Object.File, " @tab "); end if; end if; end loop Columns; if Output_Object.Column_Text = Column_Text_Ptrs_Type'(others => null) then -- We've output everything. exit Rows; end if; -- End the row: Row := Row + 1; end loop Rows; end Output_Columns; procedure Index_Menu (Output_Object : in out Texinfo_Output_Type) is begin Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* operators::"); Put_Line (Output_Object.File, "* A::"); Put_Line (Output_Object.File, "* B::"); Put_Line (Output_Object.File, "* C::"); Put_Line (Output_Object.File, "* D::"); Put_Line (Output_Object.File, "* E::"); Put_Line (Output_Object.File, "* F::"); Put_Line (Output_Object.File, "* G::"); Put_Line (Output_Object.File, "* H::"); Put_Line (Output_Object.File, "* I::"); Put_Line (Output_Object.File, "* J::"); Put_Line (Output_Object.File, "* K::"); Put_Line (Output_Object.File, "* L::"); Put_Line (Output_Object.File, "* M::"); Put_Line (Output_Object.File, "* N::"); Put_Line (Output_Object.File, "* O::"); Put_Line (Output_Object.File, "* P::"); Put_Line (Output_Object.File, "* Q::"); Put_Line (Output_Object.File, "* R::"); Put_Line (Output_Object.File, "* S::"); Put_Line (Output_Object.File, "* T::"); Put_Line (Output_Object.File, "* U::"); Put_Line (Output_Object.File, "* V::"); Put_Line (Output_Object.File, "* W::"); Put_Line (Output_Object.File, "* X::"); Put_Line (Output_Object.File, "* Y::"); -- Put_Line (Output_Object.File, "* Z::"); -- VERSION: No entries in Z Put_Line (Output_Object.File, "@end menu"); -- @node current Put_Line (Output_Object.File, "@node " & Operators_Clause); Put_Line (Output_Object.File, "@section operators"); end Index_Menu; ---------- -- Public subprograms. Alphabetical order procedure AI_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; AI_Number : in String) is begin Ordinary_Text (Output_Object, AI_Number & Text); end AI_Reference; procedure Category_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : String) is begin Check_Not_In_Paragraph (Output_Object); -- Can't be in a multi-column setting. -- -- Don't use @heading; that causes a weird underline in info, -- that isn't centered! Put_Line (Output_Object.File, "@center @emph{" & Header_Text & "}"); New_Line (Output_Object.File, 2); end Category_Header; procedure Clause_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False) is pragma Unreferenced (No_Page_Break); pragma Unreferenced (Top_Level_Subdivision_Name); Title : constant String := Clause_Number & " " & Header_Text; use ARM_Contents; Section_Number : Section_Number_Type; Clause_Integer : Natural; procedure Put_Clause_Menu_Item (Item_Title : in Title_Type; Item_Level : in Level_Type; Item_Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- only version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Item_Level is when Section | Unnumbered_Section | Normative_Annex | Informative_Annex | Plain_Annex | Subclause | Subsubclause => -- We are doing Clause here null; when Clause => if Item_Clause_Number.Section < Section_Number then null; elsif Item_Clause_Number.Section = Section_Number then Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Item_Level, Item_Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Item_Title); else Quit := True; end if; when Dead_Clause => raise Program_Error with "Dead Clause in menu??"; -- No dead clauses should be output. end case; end Put_Clause_Menu_Item; procedure Put_Clause_Menu is new For_Each (Put_Clause_Menu_Item); procedure Put_Subclause_Menu_Item (Item_Title : in Title_Type; Item_Level : in Level_Type; Item_Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- only version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Item_Level is when Section | Unnumbered_Section | Normative_Annex | Informative_Annex | Plain_Annex | Clause | Subsubclause => -- We are doing Subclause here null; when Subclause => if Item_Clause_Number.Section < Section_Number then null; elsif Item_Clause_Number.Section = Section_Number then if Item_Clause_Number.Clause < Clause_Integer then null; elsif Item_Clause_Number.Clause = Clause_Integer then Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Item_Level, Item_Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Item_Title); else Quit := True; end if; else Quit := True; end if; when Dead_Clause => raise Program_Error with "Dead clause in submenu??"; -- No dead clauses should be output. end case; end Put_Subclause_Menu_Item; procedure Put_Subclause_Menu is new For_Each (Put_Subclause_Menu_Item); begin Check_Not_In_Paragraph (Output_Object); -- Handle special cases if Clause_Number = "" and Header_Text = "Table of Contents" then -- Actual contents output in TOC_Marker below. return; elsif Header_Text = "The Standard Libraries" then -- This section has no content; don't confuse makeinfo. return; elsif Header_Text = Index_Clause_Name then Put_Line (Output_Object.File, "@node " & Index_Clause_Name); Put_Line (Output_Object.File, "@chapter Index"); Output_Object.State := Index_Start; return; end if; case Level is when Section | Normative_Annex | Informative_Annex | Plain_Annex => -- Menu of these done at @node Top null; when Unnumbered_Section => -- Unnumbered sections are not in ARM_Contents, but there's -- currently only one of them, so they are not worth adding; -- just hard-code the menu here. Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Section_Number = 0 and Clause_Integer = 1 then Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* 0.1 :: Foreword to this version of the Ada Reference Manual"); Put_Line (Output_Object.File, "* 0.2 :: Foreword"); Put_Line (Output_Object.File, "* 0.3 :: Introduction"); Put_Line (Output_Object.File, "* 0.99 :: International Standard"); Put_Line (Output_Object.File, "@end menu"); end if; when Clause => -- Output menu of Clauses in this section, if we haven't already Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Output_Object.Menu_Section /= Section_Number then Put_Line (Output_Object.File, "@menu"); Put_Clause_Menu; Put_Line (Output_Object.File, "@end menu"); Output_Object.Menu_Section := Section_Number; Output_Object.Menu_Clause := 0; end if; when Subclause => -- Output menu of Subclauses in this Clause, if we haven't already Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Output_Object.Menu_Section = Section_Number and Output_Object.Menu_Clause /= Clause_Integer then Put_Line (Output_Object.File, "@menu"); Put_Subclause_Menu; Put_Line (Output_Object.File, "@end menu"); Output_Object.Menu_Clause := Clause_Integer; end if; when Subsubclause => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Clause_Header: Subsubclause"); when Dead_Clause => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Clause_Header: Dead_clause"); end case; Put_Line (Output_Object.File, "@node " & Clause_Number); case Level is when Section => Put_Line (Output_Object.File, "@chapter " & Title); when Normative_Annex | Informative_Annex | Plain_Annex => Put_Line (Output_Object.File, "@chapter " & Title); when Clause | Unnumbered_Section => Put_Line (Output_Object.File, "@section " & Title); when Subclause => Put_Line (Output_Object.File, "@subsection " & Title); when Subsubclause => Put_Line (Output_Object.File, "@subsubsection " & Title); when Dead_Clause => raise Program_Error with "Dead_Clause in header?"; -- No output of dead clauses. end case; end Clause_Header; procedure Clause_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Clause_Number : in String) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => -- If this happens, we need to store escaped text in columns. Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "clause reference in multi-column"); when Normal => if Text = Clause_Number then Put (Output_Object.File, "@ref{" & Clause_Number & "}"); else Put (Output_Object.File, "@ref{" & Clause_Number & "} " & Text); end if; when Title | Index_Start | Index => Unexpected_State (Output_Object); end case; end Clause_Reference; procedure Close (Output_Object : in out Texinfo_Output_Type) is begin Check_Valid (Output_Object); Put_Line (Output_Object.File, "@bye"); Close (Output_Object.File); Output_Object.Is_Valid := False; end Close; procedure Create (Output_Object : in out Texinfo_Output_Type; File_Prefix : in String; Output_Path : in String; Change_Version : in ARM_Contents.Change_Version_Type; Title : in String) is File_Name : constant String := Output_Path & Ada.Strings.Fixed.Trim (File_Prefix, Ada.Strings.Right) & ".texinfo"; begin if Output_Object.Is_Valid then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Already valid object"); end if; Output_Object.Is_Valid := True; Create (Output_Object.File, Out_File, File_Name); Put_Line (Output_Object.File, "\input texinfo"); Put_Line (Output_Object.File, "@documentencoding ISO-8859-1"); Put_Line (Output_Object.File, "@dircategory GNU Ada tools"); Put_Line (Output_Object.File, "@direntry"); case Change_Version is when '2' => Put_Line (Output_Object.File, "* Ada Reference Manual: (arm2005)."); Put_Line (Output_Object.File, "* Annotated ARM: (arm2005)."); when '3' => Put_Line (Output_Object.File, "* Ada Reference Manual: (arm2012)."); Put_Line (Output_Object.File, "* Annotated ARM: (arm2012)."); when '4' => Put_Line (Output_Object.File, "* Ada Reference Manual TC1: (arm2012)."); Put_Line (Output_Object.File, "* Annotated ARM TC1: (arm2012)."); when others => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "unsupported Change_Version"); end case; Put_Line (Output_Object.File, "@end direntry"); Put_Line (Output_Object.File, "@settitle " & Title); Put_Line (Output_Object.File, "@paragraphindent none"); Put_Line (Output_Object.File, "@exampleindent" & Integer'Image (Indentation)); Put_Line (Output_Object.File, "@node Top"); Put_Line (Output_Object.File, "@top " & Title); Output_Object.State := ARM_Texinfo.Title; Output_Object.First_Word_Last := 0; end Create; procedure DR_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; DR_Number : in String) is begin Ordinary_Text (Output_Object, DR_Number & Text); end DR_Reference; procedure End_Hang_Item (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin Output_Object.End_Hang_Seen := True; case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => Handle_Indent (Output_Object, "@quotation"); when Index | Title => null; when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => Handle_Indent (Output_Object, "@example"); when Bulleted | Small_Bulleted => Handle_Indent (Output_Object, "@itemize"); when Nested_Bulleted | Small_Nested_Bulleted => Handle_Indent (Output_Object, "@itemize", Extra_Indent => 1); when Enumerated | Small_Enumerated => -- Number has just been output; start text. Put (Output_Object.File, "@w{ }"); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@quotation"); end case; end End_Hang_Item; procedure Text_Format (Output_Object : in out Texinfo_Output_Type; Format : in ARM_Output.Format_Type) is begin -- We only handle italic, for annotated syntax item names if Format.Italic /= Output_Object.Format.Italic then -- Info format does not support fonts, so we use <> Put (Output_Object.File, (if Format.Italic then '<' else '>')); end if; Output_Object.Format := Format; end Text_Format; procedure End_Paragraph (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin Output_Object.In_Paragraph := False; case Output_Object.State is when Contents => null; when Multi_Column => -- Skip a row, to separate paragraphs in a column. Output_Object.Current_Row := Output_Object.Current_Row + 2; when Title => if Output_Object.Line_Empty then null; else New_Line (Output_Object.File, 2); Put (Output_Object.File, "@center "); Output_Object.Line_Empty := True; end if; when Normal => case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end quotation"); New_Line (Output_Object.File); when Index | Title => New_Line (Output_Object.File, 2); when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end example"); New_Line (Output_Object.File); when Bulleted | Small_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize"); New_Line (Output_Object.File); when Nested_Bulleted | Small_Nested_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize", Extra_Indent => 1); New_Line (Output_Object.File); when Enumerated | Small_Enumerated => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize"); New_Line (Output_Object.File); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => New_Line (Output_Object.File); if Output_Object.End_Hang_Seen then Handle_Indent (Output_Object, "@end quotation"); end if; New_Line (Output_Object.File); end case; when Index_Start => Output_Object.State := Index; Index_Menu (Output_Object); when Index => -- Keep index items tightly grouped. Put_Line (Output_Object.File, "@*"); when Table_Header => Unexpected_State (Output_Object); end case; end End_Paragraph; procedure Hard_Space (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => -- Can't do line breaks in columns Add_To_Column_Item (Output_Object, " "); when Title => if Output_Object.Line_Empty then null; else Put (Output_Object.File, "@w{ }"); end if; when Normal | Index_Start | Index => Put (Output_Object.File, "@w{ }"); end case; end Hard_Space; procedure Index_Line_Break (Output_Object : in out Texinfo_Output_Type; Clear_Keep_with_Next : in Boolean) is pragma Unreferenced (Clear_Keep_with_Next); begin Put_Line (Output_Object.File, "@*"); end Index_Line_Break; procedure Index_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Index_Key : in Natural; Clause_Number : in String) is pragma Unreferenced (Clause_Number); -- Text is clause_number & paragraph number (optional). begin Put (Output_Object.File, "@ref{" & Integer'Image (Index_Key) & ", " & Text & "}"); end Index_Reference; procedure Index_Target (Output_Object : in out Texinfo_Output_Type; Index_Key : in Natural) is begin -- Add an empty non-break object, because @anchor ignores -- whitespace after it, which often occurs in the current -- Scribe-like source. Put (Output_Object.File, "@anchor{" & Integer'Image (Index_Key) & "}@w{}"); end Index_Target; procedure Line_Break (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin case Output_Object.State is when Title => if Output_Object.Line_Empty then null; else Put_Line (Output_Object.File, "@*"); Output_Object.Line_Empty := True; end if; when Contents => null; when Multi_Column | Table_Header => Output_Object.Current_Row := Output_Object.Current_Row + 1; if Output_Object.Max_Row < Output_Object.Current_Row then Output_Object.Max_Row := Output_Object.Current_Row; end if; when Index_Start => -- This doesn't happen Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Line_Break Index_Start"); when Normal | Index => case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary | Index | Title => Put_Line (Output_Object.File, "@*"); when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => New_Line (Output_Object.File); when Bulleted | Small_Bulleted | Nested_Bulleted | Small_Nested_Bulleted | Enumerated | Small_Enumerated | Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => Put_Line (Output_Object.File, "@*"); end case; end case; end Line_Break; procedure Local_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String; Clause_Number : in String) is pragma Unreferenced (Target); pragma Unreferenced (Clause_Number); begin -- These are typically references to words in the grammar -- summary. Mildly useful, but the best we can do is: -- -- "@ref{" & Target & "," & Text & "}" -- -- makeinfo prepends 'see' and postpends '.', so it screws up -- the text. For example, section 2.1 (1) ends up with "the -- @ref{S0229, compilation}s." => "the see compilation: S0229." -- Emacs info-mode suppresses the ': S0229', but not the 'see' -- and the trailing '.'. So we just output the text. Ordinary_Text (Output_Object, Text); end Local_Link; procedure Local_Link_End (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String) is begin -- These work better than local links, because they are not in -- the middle of plurals. First use is section 3.1 (1). Put (Output_Object.File, " (@pxref{" & Target & "," & Clause_Number & "})"); end Local_Link_End; procedure Local_Link_Start (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String) is pragma Unreferenced (Output_Object); pragma Unreferenced (Target); pragma Unreferenced (Clause_Number); begin -- implemented in Local_Link_End null; end Local_Link_Start; procedure Local_Target (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String) is begin -- Add an empty non-break object, because @anchor ignores -- whitespace after it, which often occurs in the current -- Scheme source. Put (Output_Object.File, "@anchor{" & Target & "}@w{}"); Ordinary_Text (Output_Object, Text); end Local_Target; procedure New_Column (Output_Object : in out Texinfo_Output_Type) is begin if Output_Object.Column_Count >= 4 then Output_Object.Current_Column := Output_Object.Current_Column + 1; Output_Object.Current_Row := 1; end if; end New_Column; procedure New_Page (Output_Object : in out Texinfo_Output_Type; Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page) is pragma Unreferenced (Kind); pragma Unreferenced (Output_Object); begin -- No such thing in Info. null; end New_Page; procedure Ordinary_Character (Output_Object : in out Texinfo_Output_Type; Char : in Character) is Copyright : constant String := "Copyright"; begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Add_To_Column_Item (Output_Object, "" & Char); when Title => -- Check for end of title page; indicated by line starting with "Copyright" if Output_Object.Line_Empty then if Output_Object.First_Word_Last > 0 then if Copyright (Output_Object.First_Word_Last + 1) = Char then Output_Object.First_Word_Last := Output_Object.First_Word_Last + 1; Output_Object.First_Word (Output_Object.First_Word_Last) := Char; if Output_Object.First_Word_Last = Copyright'Last then End_Title_Page (Output_Object); Output_Object.State := Normal; Ordinary_Text (Output_Object, Output_Object.First_Word (1 .. Output_Object.First_Word_Last)); end if; else -- First word is not Copyright; output it Ordinary_Text (Output_Object, Output_Object.First_Word (1 .. Output_Object.First_Word_Last)); Output_Object.Line_Empty := False; end if; else -- No non-space seen yet if Char = ' ' then null; elsif Char = Copyright (1) then Output_Object.First_Word_Last := 1; Output_Object.First_Word (1) := Char; else Escape_Put (Output_Object, Char); Output_Object.Line_Empty := False; end if; end if; else -- Line already has stuff on it Escape_Put (Output_Object, Char); end if; when Normal => Output_Object.Line_Empty := Char /= ' '; Escape_Put (Output_Object, Char); when Index_Start => Escape_Put (Output_Object, Char); if Char = '&' then -- give debugger a place to break Put_Line ("first index entry"); end if; when Index => case Char is when ' ' | ',' | '[' | ']' => Put (Output_Object.File, Char); when 'A' .. Last_Index_Clause => -- Index section heading -- @node current Put_Line (Output_Object.File, "@node " & Char); -- Add non-break space so Emacs info will use big bold -- font for single letter titles. Put_Line (Output_Object.File, "@section " & Char & "@w{ }"); when others => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Unexpected char in Index: " & Char); end case; end case; end Ordinary_Character; procedure Ordinary_Text (Output_Object : in out Texinfo_Output_Type; Text : in String) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Add_To_Column_Item (Output_Object, Text); when Normal | Title | Index_Start | Index => Output_Object.Line_Empty := False; Escape_Put (Output_Object, Text); end case; end Ordinary_Text; procedure Picture (Output_Object : in out Texinfo_Output_Type; Name : in String; Descr : in String; Alignment : in ARM_Output.Picture_Alignment; Height, Width : in Natural; Border : in ARM_Output.Border_Kind) is pragma Unreferenced (Border); pragma Unreferenced (Width); pragma Unreferenced (Height); pragma Unreferenced (Alignment); pragma Unreferenced (Name); begin Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Picture: " & Descr); end Picture; procedure Revised_Clause_Header (Output_Object : in out Texinfo_Output_Type; New_Header_Text : in String; Old_Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Version : in ARM_Contents.Change_Version_Type; Old_Version : in ARM_Contents.Change_Version_Type; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False) is pragma Unreferenced (Version); pragma Unreferenced (Old_Version); pragma Unreferenced (Old_Header_Text); begin Clause_Header (Output_Object, New_Header_Text, Level, Clause_Number, Top_Level_Subdivision_Name, No_Page_Break); end Revised_Clause_Header; procedure Section (Output_Object : in out Texinfo_Output_Type; Section_Title : in String; Section_Name : in String) is pragma Unreferenced (Section_Name); pragma Unreferenced (Section_Title); pragma Unreferenced (Output_Object); begin -- This is redundant with the various Clause functions null; end Section; procedure Separator_Line (Output_Object : in out Texinfo_Output_Type; Is_Thin : Boolean := True) is begin -- Can't be in a multi-column setting. New_Line (Output_Object.File); if Is_Thin then Put_Line (Output_Object.File, "----------"); else Put_Line (Output_Object.File, "=========="); end if; end Separator_Line; procedure Set_Columns (Output_Object : in out Texinfo_Output_Type; Number_of_Columns : in ARM_Output.Column_Count) is begin Check_Valid (Output_Object); Check_Not_In_Paragraph (Output_Object); -- 2 and 3 column formats are displayed without any columns. -- This is mainly used for the syntax cross-reference and -- index, and these definitely look better without columns. -- -- 4 or more columns are output as a table. Note that we assume -- such items are formated with explicit New_Column calls, and -- do not contain any nested paragraph formats. case Output_Object.State is when Normal => if Number_of_Columns >= 4 then Output_Object.State := Multi_Column; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Column_Widths := (others => 0); -- Accumulate all column rows in Output_Text, then output -- when done, so we can set the correct column width in -- the header. Each column is a linked list of allocated -- Column_Text_Item_Type. else null; end if; when Multi_Column => if Number_of_Columns = 1 then -- Finished accumulating columns, output the columns as a table. Output_Column_Widths (Output_Object); Output_Columns (Output_Object); New_Line (Output_Object.File); Put_Line (Output_Object.File, "@end multitable"); New_Line (Output_Object.File); Output_Object.State := Normal; else Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "New multi-column section before end of old"); end if; when Index_Start | Index => null; when Table_Header | Contents | Title => Unexpected_State (Output_Object); end case; Output_Object.Column_Count := Number_of_Columns; end Set_Columns; procedure Soft_Hyphen_Break (Output_Object : in out Texinfo_Output_Type) is begin Put (Output_Object.File, "@-"); end Soft_Hyphen_Break; procedure Soft_Line_Break (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents | Title => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@-"); when Multi_Column | Table_Header => Unexpected_State (Output_Object); end case; end Soft_Line_Break; procedure Special_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Special_Character_Type) is begin -- We use Ordinary_Text, so this is output to columns when appropriate. case Char is when ARM_Output.EM_Dash => Ordinary_Text (Output_Object, "--"); when ARM_Output.EN_Dash => Ordinary_Text (Output_Object, "-"); -- used for '-' in binary_adding_operator when ARM_Output.GEQ => Ordinary_Text (Output_Object, ">="); when ARM_Output.LEQ => Ordinary_Text (Output_Object, "<="); when ARM_Output.NEQ => Ordinary_Text (Output_Object, "/="); when ARM_Output.PI => Ordinary_Text (Output_Object, "PI"); when ARM_Output.Left_Ceiling => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support ceiling in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@code{ceiling("); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Right_Ceiling => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support ceiling in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, ")}"); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Left_Floor => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support floor in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@code{floor("); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Right_Floor => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support floor in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, ")}"); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Thin_Space => Ordinary_Text (Output_Object, " "); when ARM_Output.Left_Quote => Ordinary_Text (Output_Object, "`"); when ARM_Output.Right_Quote => Ordinary_Text (Output_Object, "'"); when ARM_Output.Left_Double_Quote => Ordinary_Text (Output_Object, """"); when ARM_Output.Right_Double_Quote => Ordinary_Text (Output_Object, """"); when ARM_Output.Small_Dotless_I => Ordinary_Text (Output_Object, "i"); when ARM_Output.Capital_Dotted_I => Ordinary_Text (Output_Object, "I"); end case; end Special_Character; procedure Start_Paragraph (Output_Object : in out Texinfo_Output_Type; Style : in ARM_Output.Paragraph_Style_Type; Indent : in ARM_Output.Paragraph_Indent_Type; Number : in String; No_Prefix : in Boolean := False; Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS; No_Breaks : in Boolean := False; Keep_with_Next : in Boolean := False; Space_After : in ARM_Output.Space_After_Type := ARM_Output.Normal; Justification : in ARM_Output.Justification_Type := ARM_Output.Default) is pragma Unreferenced (Justification); pragma Unreferenced (Space_After); pragma Unreferenced (Keep_with_Next); pragma Unreferenced (No_Breaks); pragma Unreferenced (Tab_Stops); use ARM_Output; begin Check_Valid (Output_Object); Check_Not_In_Paragraph (Output_Object); -- Note: makeinfo will do most of the formatting, so No_Breaks, -- Keep_with_Next, Space_After, and Justification have no -- effect here. In addition, info format has no support for -- fonts, so the font aspects of Style are ignored as well. But -- we try to respect the indentation and margin aspects. -- TexInfo does not directly support tabs, but does use a fixed -- font, so we could emulate them. But then we'd have to track -- output characters; let's see if we really need it. case Output_Object.State is when Contents => null; when Normal => if Number'Length > 0 then Put_Line (Output_Object.File, Number & " @*"); end if; Output_Object.In_Paragraph := True; Output_Object.Style := Style; Output_Object.Indent := Indent; case Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => Handle_Indent (Output_Object, "@quotation"); when Index | Title => null; when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => Handle_Indent (Output_Object, "@example"); when Bulleted | Small_Bulleted => Handle_Indent (Output_Object, "@itemize @bullet"); if not No_Prefix then Put (Output_Object.File, "@item "); end if; when Nested_Bulleted | Small_Nested_Bulleted => Handle_Indent (Output_Object, "@itemize @bullet", Extra_Indent => 1); if not No_Prefix then Put (Output_Object.File, "@item "); end if; when Enumerated | Small_Enumerated => Handle_Indent (Output_Object, "@itemize @w{}"); Put (Output_Object.File, "@item "); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => if No_Prefix then -- Still in hanging part Handle_Indent (Output_Object, "@quotation"); Output_Object.End_Hang_Seen := True; else Output_Object.End_Hang_Seen := False; end if; end case; when Index_Start | Index | Title | Multi_Column | Table_Header => if Number'Length > 0 then Unexpected_State (Output_Object); end if; Output_Object.In_Paragraph := True; Output_Object.Style := Style; Output_Object.Indent := Indent; end case; end Start_Paragraph; procedure Start_Table (Output_Object : in out Texinfo_Output_Type; Columns : in ARM_Output.Column_Count; First_Column_Width : in ARM_Output.Column_Count; Last_Column_Width : in ARM_Output.Column_Count; Alignment : in ARM_Output.Column_Text_Alignment; No_Page_Break : in Boolean; Has_Border : in Boolean; Small_Text_Size : in Boolean; Header_Kind : in ARM_Output.Header_Kind_Type) is pragma Unreferenced (Small_Text_Size); pragma Unreferenced (Has_Border); pragma Unreferenced (No_Page_Break); pragma Unreferenced (Alignment); pragma Unreferenced (Last_Column_Width); pragma Unreferenced (First_Column_Width); use ARM_Output; begin Output_Object.Column_Count := Columns; case Header_Kind is when Both_Caption_and_Header => New_Line (Output_Object.File); -- Next text output will be the caption, which we don't -- format in any special way (first example is F.3.2 (19)). -- Then Table_Marker (End_Caption) is called, which will -- start the actual table. when Header_Only => -- Same as Table_Marker, End_Caption. case Columns is when 1 => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Table with 1 column"); when 2 => -- @table doesn't work inside @display; PDFTex fails with @table here. -- https://lists.gnu.org/archive/html/bug-texinfo/2004-10/txtJLetHrEhdc.txt New_Line (Output_Object.File); Put_Line (Output_Object.File, "@multitable {wwwwwwwwww} {wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww}"); Put (Output_Object.File, "@headitem "); when others => New_Line (Output_Object.File); Put (Output_Object.File, "@multitable"); Output_Object.State := Table_Header; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Max_Row := 0; -- The next text output via Ordinary_Text or -- Ordinary_Character is the table headers. We -- capture them in Output_Object.Column_Text, and -- use them to set the table column widths. end case; when No_Headers => null; end case; end Start_Table; procedure Tab (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Tab in multi-column"); when Title => if Output_Object.Line_Empty then null; else Put (Output_Object.File, "@w{ }"); end if; when Normal | Index_Start | Index => -- Just three spaces for now, for indented trees Put (Output_Object.File, "@w{ }"); end case; end Tab; procedure Table_Marker (Output_Object : in out Texinfo_Output_Type; Marker : in ARM_Output.Table_Marker_Type) is begin case Marker is when ARM_Output.End_Caption => -- Start the actual table case Output_Object.Column_Count is when 1 => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Table with 1 column"); when 2 => New_Line (Output_Object.File); Put_Line (Output_Object.File, "@multitable {wwwwwwwwww} {wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww}"); Put (Output_Object.File, "@headitem "); when others => New_Line (Output_Object.File); Put (Output_Object.File, "@multitable"); Output_Object.State := Table_Header; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Max_Row := 0; -- The next text output via Ordinary_Text or -- Ordinary_Character is the table headers. We -- capture them in Output_Object.Column_Text, and -- use them to set the table column widths. end case; when ARM_Output.End_Item => case Output_Object.State is when Table_Header => Output_Object.Current_Column := Output_Object.Current_Column + 1; Output_Object.Current_Row := 1; when Normal => case Output_Object.Column_Count is when 2 => New_Line (Output_Object.File); Put (Output_Object.File, "@tab "); when others => Put (Output_Object.File, " @tab "); end case; when Multi_Column | Contents | Title | Index_Start | Index => Unexpected_State (Output_Object); end case; when ARM_Output.End_Header => case Output_Object.State is when Table_Header => Output_Object.State := Normal; for I in 1 .. Output_Object.Column_Count loop Put (Output_Object.File, " {" & Output_Object.Column_Text (I).Text (1 .. Output_Object.Column_Text (I).Length) & "}"); end loop; New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Pad_Columns (Output_Object); Output_Columns (Output_Object); New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Output_Object.Current_Column := 1; when Normal => -- A two-column table; header has been output New_Line (Output_Object.File); Put (Output_Object.File, "@item "); when Contents | Multi_Column | Title | Index_Start | Index => Unexpected_State (Output_Object); end case; when ARM_Output.End_Row | ARM_Output.End_Row_Next_Is_Last => New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Output_Object.Current_Column := 1; when ARM_Output.End_Table => case Output_Object.Column_Count is when 2 => New_Line (Output_Object.File); Put_Line (Output_Object.File, "@end multitable"); when others => Put_Line (Output_Object.File, "@end multitable"); end case; end case; end Table_Marker; procedure TOC_Marker (Output_Object : in out Texinfo_Output_Type; For_Start : in Boolean) is begin -- We use menus, not @contents (since makeinfo ignores -- @contents in info mode). The menus (including the top menu) -- are generated from data stored in ARM_Contents during the -- scan pass. if For_Start then Output_Object.State := Contents; -- Ignore futher output until For_Start = False. else Output_Object.State := Normal; end if; end TOC_Marker; procedure Unicode_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Unicode_Type) is begin -- Used in section 2.3 Identifiers examples, 2.5 character -- literals examples, 2.6 string literals examples, 3.3.1 -- Object Declarations examples, 4.4 Expressions examples Put (Output_Object.File, "[Unicode" & ARM_Output.Unicode_Type'Image (Char) & "]"); end Unicode_Character; procedure URL_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; URL : in String) is begin Put (Output_Object.File, "@uref{" & URL & "," & Text & "}"); end URL_Link; end ARM_Texinfo;
true
with Ada.Exceptions; with Ada.Strings.Fixed; package body ARM_Texinfo is -- Copyright (C) 2003, 2007, 2010 - 2013, 2015, 2017, 2018 PI:NAME:<NAME>END_PI. All Rights Reserved. -- E-Mail: PI:EMAIL:<EMAIL>END_PI -- -- This library is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, 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 General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file gnu-3-0.txt. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- MA 02111-1307, USA. -- --------------------------------------- -- -- Edit History: -- -- Ancient - S L - Developed package as add-on to Arm_Form. -- 10/19/11 - RLB - Integrated outside-developed package into Arm_Form. -- Commented out/replaced Ada 2005 features (this is -- Ada 95 code). Updated for a few other changes since -- the last update. -- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header. -- 4/ 1/12 - S L - Implemented remaining Texinfo implementation. -- 4/22/12 - S L - Move @dircategory, @direntry before first @node. -- 4/28/12 - S L - Add @w{} after @anchor; otherwise following whitespace -- is dropped. -- 8/31/12 - RLB - Added Output_Path. -- 10/18/12 - RLB - Added additional hanging styles. -- 11/26/12 - RLB - Added subdivision names to Clause_Header and -- Revised_Clause_Header. -- 3/12/13 - S L - use correct version in direntry use Ada.Text_IO; Indentation : constant := 5; -- VERSION: This is fragile; it changes with each version of the manual. Index_Clause_Name : constant String := "Index"; Operators_Clause : constant String := "operators"; Last_Index_Clause : constant Character := 'Y'; ---------- -- local subprograms procedure Check_Not_In_Paragraph (Output_Object : in Texinfo_Output_Type) is begin if Output_Object.In_Paragraph then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "In paragraph"); end if; end Check_Not_In_Paragraph; procedure Check_Valid (Output_Object : in Texinfo_Output_Type) is begin if not Output_Object.Is_Valid then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Not valid object"); end if; end Check_Valid; procedure Unexpected_State (Output_Object : in Texinfo_Output_Type) is begin Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Unexpected state: " & State_Type'Image (Output_Object.State)); end Unexpected_State; procedure Escape_Put (Output_Object : in Texinfo_Output_Type; Char : in Character; Preserve_Space : in Boolean := False) is begin -- Escape special chars if Char = '@' then Put (Output_Object.File, "@@"); elsif Char = '{' then Put (Output_Object.File, "@{"); elsif Char = '}' then Put (Output_Object.File, "@}"); elsif Char = ''' then -- Avoid makeinfo converting '' into " Put (Output_Object.File, "'@w{}"); elsif Char = '`' then -- Avoid makeinfo converting `` into " Put (Output_Object.File, "`@w{}"); elsif Char = '-' then Put (Output_Object.File, "@minus{}"); elsif Char = ' ' and Preserve_Space then -- Don't allow collapsing spaces Put (Output_Object.File, "@w{ }"); elsif Char = '\' then -- This confuses texi2dvi if not escaped. Put (Output_Object.File, "@code{\}"); else Put (Output_Object.File, Char); end if; end Escape_Put; procedure Escape_Put (Output_Object : in Texinfo_Output_Type; Text : in String; Preserve_Space : in Boolean := False) is begin for I in Text'Range loop Escape_Put (Output_Object, Text (I), Preserve_Space); end loop; end Escape_Put; procedure End_Title_Page (Output_Object : in out Texinfo_Output_Type) is use ARM_Contents; procedure Put_Top_Menu_Item (Title : in Title_Type; Level : in Level_Type; Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- we are only concerned with version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Level is when Section | Normative_Annex | Informative_Annex | Plain_Annex => Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Level, Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Title); when Unnumbered_Section | Clause | Subclause | Subsubclause => null; when ARM_Contents.Dead_Clause => raise Program_Error with "Dead_Clause header??"; -- No headers for dead clauses. end case; end Put_Top_Menu_Item; procedure Put_Top_Menu is new For_Each (Put_Top_Menu_Item); begin New_Line (Output_Object.File); -- Terminate unneeded "@center" Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* Front Matter:: Copyright, Foreword, etc."); -- Not a section in ARM sources Put_Top_Menu; Put_Line (Output_Object.File, "* Index :: Index"); -- Not in ARM sources Put_Line (Output_Object.File, "@end menu"); -- @node current Put_Line (Output_Object.File, "@node Front Matter"); Put_Line (Output_Object.File, "@chapter Front Matter"); end End_Title_Page; procedure Get_Clause_Section (Clause_String : in String; Section_Number : out ARM_Contents.Section_Number_Type; Clause_Integer : out Natural) is -- This is a partial inverse of ARM_Contents.Make_Clause_Number. -- -- Clause_String has "section.clause.subclause", possibly no subclause. -- -- "section" can be a number, a letter "N", or "Annex N", where -- -- 'N' = Character'Val (Character'Pos('A') + (Section_Number - ANNEX_START) Section_Dot : constant Natural := Ada.Strings.Fixed.Index (Source => Clause_String, Pattern => "."); Clause_Dot : constant Natural := Ada.Strings.Fixed.Index (Source => Clause_String (Section_Dot + 1 .. Clause_String'Last), Pattern => "."); use type ARM_Contents.Section_Number_Type; begin if Section_Dot = 8 then -- Section is "Annex N" Section_Number := ARM_Contents.ANNEX_START + Character'Pos (Clause_String (Clause_String'First + 6)) - Character'Pos ('A'); elsif Character'Pos (Clause_String (Clause_String'First)) >= Character'Pos ('A') then -- Section is letter. Section_Number := ARM_Contents.ANNEX_START + Character'Pos (Clause_String (Clause_String'First)) - Character'Pos ('A'); else Section_Number := ARM_Contents.Section_Number_Type'Value (Clause_String (Clause_String'First .. Section_Dot - 1)); end if; if Clause_Dot = 0 then Clause_Integer := Natural'Value (Clause_String (Section_Dot + 1 .. Clause_String'Last)); else Clause_Integer := Natural'Value (Clause_String (Section_Dot + 1 .. Clause_Dot - 1)); end if; end Get_Clause_Section; procedure Handle_Indent (Output_Object : in Texinfo_Output_Type; Texinfo_Item : in String; Extra_Indent : in ARM_Output.Paragraph_Indent_Type := 0) is use type ARM_Output.Paragraph_Indent_Type; begin for I in 1 .. Output_Object.Indent + Extra_Indent loop Put_Line (Output_Object.File, Texinfo_Item); end loop; end Handle_Indent; procedure Add_To_Column_Item (Output_Object : in out Texinfo_Output_Type; Text : in String) is begin if Output_Object.Column_Text (Output_Object.Current_Column) = null or else Output_Object.Column_Text (Output_Object.Current_Column).Row /= Output_Object.Current_Row then -- Start a new row. Output_Object.Column_Text (Output_Object.Current_Column) := new Column_Text_Item_Type' (Text => (others => ' '), Length => 0, Row => Output_Object.Current_Row, Next => Output_Object.Column_Text (Output_Object.Current_Column)); end if; if Output_Object.Column_Text (Output_Object.Current_Column).Length + Text'Length > Output_Object.Column_Text (Output_Object.Current_Column).Text'Length then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Column item full, but more text: " & Output_Object.Column_Text (Output_Object.Current_Column).Text (1 .. Output_Object.Column_Text (Output_Object.Current_Column).Length)); else declare Current_Text : Column_Text_Item_Type renames Output_Object.Column_Text (Output_Object.Current_Column).all; begin Current_Text.Text (Current_Text.Length + 1 .. Current_Text.Length + Text'Length) := Text; Current_Text.Length := Current_Text.Length + Text'Length; if Output_Object.Column_Widths (Output_Object.Current_Column) < Current_Text.Length then Output_Object.Column_Widths (Output_Object.Current_Column) := Current_Text.Length; end if; end; end if; end Add_To_Column_Item; procedure Pad_Columns (Output_Object : in out Texinfo_Output_Type) -- Ensure that all columns have the same number of (possibly -- empty) rows, for table headers. is Item : Column_Text_Ptr; First_New_Row : Natural; begin for Col in 1 .. Output_Object.Column_Count loop Item := Output_Object.Column_Text (Col); if Item = null then First_New_Row := 1; else First_New_Row := Item.Row + 1; end if; for I in First_New_Row .. Output_Object.Max_Row loop Output_Object.Column_Text (Col) := new Column_Text_Item_Type' (Text => (others => ' '), Length => 1, Row => I, Next => Output_Object.Column_Text (Col)); end loop; end loop; end Pad_Columns; procedure Output_Column_Widths (Output_Object : in out Texinfo_Output_Type) is begin New_Line (Output_Object.File); Put (Output_Object.File, "@multitable "); for I in 1 .. Output_Object.Column_Count loop Put (Output_Object.File, " {" & String'(1 .. Output_Object.Column_Widths (I) => 'w') & "}"); end loop; end Output_Column_Widths; procedure Output_Columns (Output_Object : in out Texinfo_Output_Type) is Row : Natural := 1; Item : Column_Text_Ptr; Temp : Column_Text_Ptr; begin Rows : loop New_Line (Output_Object.File); Put (Output_Object.File, "@item "); -- For all columns, output the items for this row. Note that -- the last row is at the front of each column list; the -- first row is at the end. We delete the rows as we output -- them, so the one we want is always at the end of the -- column list. Columns : for Col in 1 .. Output_Object.Column_Count loop Item := Output_Object.Column_Text (Col); if Item = null then -- Previously finished column null; elsif Item.Next = null then -- This is the last item in the column. if Item.Row /= Row then -- This column is empty for this row. Item := null; else -- Output Item, and mark that we're done outputing -- this column. Output_Object.Column_Text (Col) := null; end if; else -- Find first item for this row in the column. while Item.Next /= null and then Item.Next.Row /= Row loop Item := Item.Next; end loop; -- Output Item.Next, take it out of list. Temp := Item; Item := Item.Next; Temp.Next := null; end if; if Item /= null then -- Output the item Escape_Put (Output_Object, Item.Text (1 .. Item.Length), Preserve_Space => True); Free (Item); if Col /= Output_Object.Column_Count then Put (Output_Object.File, " @tab "); end if; else -- This column is empty for this row if Col < Output_Object.Column_Count then Put (Output_Object.File, " @tab "); end if; end if; end loop Columns; if Output_Object.Column_Text = Column_Text_Ptrs_Type'(others => null) then -- We've output everything. exit Rows; end if; -- End the row: Row := Row + 1; end loop Rows; end Output_Columns; procedure Index_Menu (Output_Object : in out Texinfo_Output_Type) is begin Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* operators::"); Put_Line (Output_Object.File, "* A::"); Put_Line (Output_Object.File, "* B::"); Put_Line (Output_Object.File, "* C::"); Put_Line (Output_Object.File, "* D::"); Put_Line (Output_Object.File, "* E::"); Put_Line (Output_Object.File, "* F::"); Put_Line (Output_Object.File, "* G::"); Put_Line (Output_Object.File, "* H::"); Put_Line (Output_Object.File, "* I::"); Put_Line (Output_Object.File, "* J::"); Put_Line (Output_Object.File, "* K::"); Put_Line (Output_Object.File, "* L::"); Put_Line (Output_Object.File, "* M::"); Put_Line (Output_Object.File, "* N::"); Put_Line (Output_Object.File, "* O::"); Put_Line (Output_Object.File, "* P::"); Put_Line (Output_Object.File, "* Q::"); Put_Line (Output_Object.File, "* R::"); Put_Line (Output_Object.File, "* S::"); Put_Line (Output_Object.File, "* T::"); Put_Line (Output_Object.File, "* U::"); Put_Line (Output_Object.File, "* V::"); Put_Line (Output_Object.File, "* W::"); Put_Line (Output_Object.File, "* X::"); Put_Line (Output_Object.File, "* Y::"); -- Put_Line (Output_Object.File, "* Z::"); -- VERSION: No entries in Z Put_Line (Output_Object.File, "@end menu"); -- @node current Put_Line (Output_Object.File, "@node " & Operators_Clause); Put_Line (Output_Object.File, "@section operators"); end Index_Menu; ---------- -- Public subprograms. Alphabetical order procedure AI_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; AI_Number : in String) is begin Ordinary_Text (Output_Object, AI_Number & Text); end AI_Reference; procedure Category_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : String) is begin Check_Not_In_Paragraph (Output_Object); -- Can't be in a multi-column setting. -- -- Don't use @heading; that causes a weird underline in info, -- that isn't centered! Put_Line (Output_Object.File, "@center @emph{" & Header_Text & "}"); New_Line (Output_Object.File, 2); end Category_Header; procedure Clause_Header (Output_Object : in out Texinfo_Output_Type; Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False) is pragma Unreferenced (No_Page_Break); pragma Unreferenced (Top_Level_Subdivision_Name); Title : constant String := Clause_Number & " " & Header_Text; use ARM_Contents; Section_Number : Section_Number_Type; Clause_Integer : Natural; procedure Put_Clause_Menu_Item (Item_Title : in Title_Type; Item_Level : in Level_Type; Item_Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- only version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Item_Level is when Section | Unnumbered_Section | Normative_Annex | Informative_Annex | Plain_Annex | Subclause | Subsubclause => -- We are doing Clause here null; when Clause => if Item_Clause_Number.Section < Section_Number then null; elsif Item_Clause_Number.Section = Section_Number then Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Item_Level, Item_Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Item_Title); else Quit := True; end if; when Dead_Clause => raise Program_Error with "Dead Clause in menu??"; -- No dead clauses should be output. end case; end Put_Clause_Menu_Item; procedure Put_Clause_Menu is new For_Each (Put_Clause_Menu_Item); procedure Put_Subclause_Menu_Item (Item_Title : in Title_Type; Item_Level : in Level_Type; Item_Clause_Number : in Clause_Number_Type; Version : in ARM_Contents.Change_Version_Type; Quit : out Boolean) is pragma Unreferenced (Version); -- only version 2 First_Part : String (1 .. 14); -- Get all Titles aligned. begin Quit := False; case Item_Level is when Section | Unnumbered_Section | Normative_Annex | Informative_Annex | Plain_Annex | Clause | Subsubclause => -- We are doing Subclause here null; when Subclause => if Item_Clause_Number.Section < Section_Number then null; elsif Item_Clause_Number.Section = Section_Number then if Item_Clause_Number.Clause < Clause_Integer then null; elsif Item_Clause_Number.Clause = Clause_Integer then Ada.Strings.Fixed.Move (Source => "* " & Make_Clause_Number (Item_Level, Item_Clause_Number) & " ::", Target => First_Part); Put_Line (Output_Object.File, First_Part & Item_Title); else Quit := True; end if; else Quit := True; end if; when Dead_Clause => raise Program_Error with "Dead clause in submenu??"; -- No dead clauses should be output. end case; end Put_Subclause_Menu_Item; procedure Put_Subclause_Menu is new For_Each (Put_Subclause_Menu_Item); begin Check_Not_In_Paragraph (Output_Object); -- Handle special cases if Clause_Number = "" and Header_Text = "Table of Contents" then -- Actual contents output in TOC_Marker below. return; elsif Header_Text = "The Standard Libraries" then -- This section has no content; don't confuse makeinfo. return; elsif Header_Text = Index_Clause_Name then Put_Line (Output_Object.File, "@node " & Index_Clause_Name); Put_Line (Output_Object.File, "@chapter Index"); Output_Object.State := Index_Start; return; end if; case Level is when Section | Normative_Annex | Informative_Annex | Plain_Annex => -- Menu of these done at @node Top null; when Unnumbered_Section => -- Unnumbered sections are not in ARM_Contents, but there's -- currently only one of them, so they are not worth adding; -- just hard-code the menu here. Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Section_Number = 0 and Clause_Integer = 1 then Put_Line (Output_Object.File, "@menu"); Put_Line (Output_Object.File, "* 0.1 :: Foreword to this version of the Ada Reference Manual"); Put_Line (Output_Object.File, "* 0.2 :: Foreword"); Put_Line (Output_Object.File, "* 0.3 :: Introduction"); Put_Line (Output_Object.File, "* 0.99 :: International Standard"); Put_Line (Output_Object.File, "@end menu"); end if; when Clause => -- Output menu of Clauses in this section, if we haven't already Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Output_Object.Menu_Section /= Section_Number then Put_Line (Output_Object.File, "@menu"); Put_Clause_Menu; Put_Line (Output_Object.File, "@end menu"); Output_Object.Menu_Section := Section_Number; Output_Object.Menu_Clause := 0; end if; when Subclause => -- Output menu of Subclauses in this Clause, if we haven't already Get_Clause_Section (Clause_Number, Section_Number, Clause_Integer); if Output_Object.Menu_Section = Section_Number and Output_Object.Menu_Clause /= Clause_Integer then Put_Line (Output_Object.File, "@menu"); Put_Subclause_Menu; Put_Line (Output_Object.File, "@end menu"); Output_Object.Menu_Clause := Clause_Integer; end if; when Subsubclause => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Clause_Header: Subsubclause"); when Dead_Clause => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Clause_Header: Dead_clause"); end case; Put_Line (Output_Object.File, "@node " & Clause_Number); case Level is when Section => Put_Line (Output_Object.File, "@chapter " & Title); when Normative_Annex | Informative_Annex | Plain_Annex => Put_Line (Output_Object.File, "@chapter " & Title); when Clause | Unnumbered_Section => Put_Line (Output_Object.File, "@section " & Title); when Subclause => Put_Line (Output_Object.File, "@subsection " & Title); when Subsubclause => Put_Line (Output_Object.File, "@subsubsection " & Title); when Dead_Clause => raise Program_Error with "Dead_Clause in header?"; -- No output of dead clauses. end case; end Clause_Header; procedure Clause_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Clause_Number : in String) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => -- If this happens, we need to store escaped text in columns. Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "clause reference in multi-column"); when Normal => if Text = Clause_Number then Put (Output_Object.File, "@ref{" & Clause_Number & "}"); else Put (Output_Object.File, "@ref{" & Clause_Number & "} " & Text); end if; when Title | Index_Start | Index => Unexpected_State (Output_Object); end case; end Clause_Reference; procedure Close (Output_Object : in out Texinfo_Output_Type) is begin Check_Valid (Output_Object); Put_Line (Output_Object.File, "@bye"); Close (Output_Object.File); Output_Object.Is_Valid := False; end Close; procedure Create (Output_Object : in out Texinfo_Output_Type; File_Prefix : in String; Output_Path : in String; Change_Version : in ARM_Contents.Change_Version_Type; Title : in String) is File_Name : constant String := Output_Path & Ada.Strings.Fixed.Trim (File_Prefix, Ada.Strings.Right) & ".texinfo"; begin if Output_Object.Is_Valid then Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Already valid object"); end if; Output_Object.Is_Valid := True; Create (Output_Object.File, Out_File, File_Name); Put_Line (Output_Object.File, "\input texinfo"); Put_Line (Output_Object.File, "@documentencoding ISO-8859-1"); Put_Line (Output_Object.File, "@dircategory GNU Ada tools"); Put_Line (Output_Object.File, "@direntry"); case Change_Version is when '2' => Put_Line (Output_Object.File, "* Ada Reference Manual: (arm2005)."); Put_Line (Output_Object.File, "* Annotated ARM: (arm2005)."); when '3' => Put_Line (Output_Object.File, "* Ada Reference Manual: (arm2012)."); Put_Line (Output_Object.File, "* Annotated ARM: (arm2012)."); when '4' => Put_Line (Output_Object.File, "* Ada Reference Manual TC1: (arm2012)."); Put_Line (Output_Object.File, "* Annotated ARM TC1: (arm2012)."); when others => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "unsupported Change_Version"); end case; Put_Line (Output_Object.File, "@end direntry"); Put_Line (Output_Object.File, "@settitle " & Title); Put_Line (Output_Object.File, "@paragraphindent none"); Put_Line (Output_Object.File, "@exampleindent" & Integer'Image (Indentation)); Put_Line (Output_Object.File, "@node Top"); Put_Line (Output_Object.File, "@top " & Title); Output_Object.State := ARM_Texinfo.Title; Output_Object.First_Word_Last := 0; end Create; procedure DR_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; DR_Number : in String) is begin Ordinary_Text (Output_Object, DR_Number & Text); end DR_Reference; procedure End_Hang_Item (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin Output_Object.End_Hang_Seen := True; case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => Handle_Indent (Output_Object, "@quotation"); when Index | Title => null; when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => Handle_Indent (Output_Object, "@example"); when Bulleted | Small_Bulleted => Handle_Indent (Output_Object, "@itemize"); when Nested_Bulleted | Small_Nested_Bulleted => Handle_Indent (Output_Object, "@itemize", Extra_Indent => 1); when Enumerated | Small_Enumerated => -- Number has just been output; start text. Put (Output_Object.File, "@w{ }"); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@quotation"); end case; end End_Hang_Item; procedure Text_Format (Output_Object : in out Texinfo_Output_Type; Format : in ARM_Output.Format_Type) is begin -- We only handle italic, for annotated syntax item names if Format.Italic /= Output_Object.Format.Italic then -- Info format does not support fonts, so we use <> Put (Output_Object.File, (if Format.Italic then '<' else '>')); end if; Output_Object.Format := Format; end Text_Format; procedure End_Paragraph (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin Output_Object.In_Paragraph := False; case Output_Object.State is when Contents => null; when Multi_Column => -- Skip a row, to separate paragraphs in a column. Output_Object.Current_Row := Output_Object.Current_Row + 2; when Title => if Output_Object.Line_Empty then null; else New_Line (Output_Object.File, 2); Put (Output_Object.File, "@center "); Output_Object.Line_Empty := True; end if; when Normal => case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end quotation"); New_Line (Output_Object.File); when Index | Title => New_Line (Output_Object.File, 2); when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end example"); New_Line (Output_Object.File); when Bulleted | Small_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize"); New_Line (Output_Object.File); when Nested_Bulleted | Small_Nested_Bulleted => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize", Extra_Indent => 1); New_Line (Output_Object.File); when Enumerated | Small_Enumerated => New_Line (Output_Object.File); Handle_Indent (Output_Object, "@end itemize"); New_Line (Output_Object.File); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => New_Line (Output_Object.File); if Output_Object.End_Hang_Seen then Handle_Indent (Output_Object, "@end quotation"); end if; New_Line (Output_Object.File); end case; when Index_Start => Output_Object.State := Index; Index_Menu (Output_Object); when Index => -- Keep index items tightly grouped. Put_Line (Output_Object.File, "@*"); when Table_Header => Unexpected_State (Output_Object); end case; end End_Paragraph; procedure Hard_Space (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => -- Can't do line breaks in columns Add_To_Column_Item (Output_Object, " "); when Title => if Output_Object.Line_Empty then null; else Put (Output_Object.File, "@w{ }"); end if; when Normal | Index_Start | Index => Put (Output_Object.File, "@w{ }"); end case; end Hard_Space; procedure Index_Line_Break (Output_Object : in out Texinfo_Output_Type; Clear_Keep_with_Next : in Boolean) is pragma Unreferenced (Clear_Keep_with_Next); begin Put_Line (Output_Object.File, "@*"); end Index_Line_Break; procedure Index_Reference (Output_Object : in out Texinfo_Output_Type; Text : in String; Index_Key : in Natural; Clause_Number : in String) is pragma Unreferenced (Clause_Number); -- Text is clause_number & paragraph number (optional). begin Put (Output_Object.File, "@ref{" & Integer'Image (Index_Key) & ", " & Text & "}"); end Index_Reference; procedure Index_Target (Output_Object : in out Texinfo_Output_Type; Index_Key : in Natural) is begin -- Add an empty non-break object, because @anchor ignores -- whitespace after it, which often occurs in the current -- Scribe-like source. Put (Output_Object.File, "@anchor{" & Integer'Image (Index_Key) & "}@w{}"); end Index_Target; procedure Line_Break (Output_Object : in out Texinfo_Output_Type) is use ARM_Output; begin case Output_Object.State is when Title => if Output_Object.Line_Empty then null; else Put_Line (Output_Object.File, "@*"); Output_Object.Line_Empty := True; end if; when Contents => null; when Multi_Column | Table_Header => Output_Object.Current_Row := Output_Object.Current_Row + 1; if Output_Object.Max_Row < Output_Object.Current_Row then Output_Object.Max_Row := Output_Object.Current_Row; end if; when Index_Start => -- This doesn't happen Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Line_Break Index_Start"); when Normal | Index => case Output_Object.Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary | Index | Title => Put_Line (Output_Object.File, "@*"); when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => New_Line (Output_Object.File); when Bulleted | Small_Bulleted | Nested_Bulleted | Small_Nested_Bulleted | Enumerated | Small_Enumerated | Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => Put_Line (Output_Object.File, "@*"); end case; end case; end Line_Break; procedure Local_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String; Clause_Number : in String) is pragma Unreferenced (Target); pragma Unreferenced (Clause_Number); begin -- These are typically references to words in the grammar -- summary. Mildly useful, but the best we can do is: -- -- "@ref{" & Target & "," & Text & "}" -- -- makeinfo prepends 'see' and postpends '.', so it screws up -- the text. For example, section 2.1 (1) ends up with "the -- @ref{S0229, compilation}s." => "the see compilation: S0229." -- Emacs info-mode suppresses the ': S0229', but not the 'see' -- and the trailing '.'. So we just output the text. Ordinary_Text (Output_Object, Text); end Local_Link; procedure Local_Link_End (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String) is begin -- These work better than local links, because they are not in -- the middle of plurals. First use is section 3.1 (1). Put (Output_Object.File, " (@pxref{" & Target & "," & Clause_Number & "})"); end Local_Link_End; procedure Local_Link_Start (Output_Object : in out Texinfo_Output_Type; Target : in String; Clause_Number : in String) is pragma Unreferenced (Output_Object); pragma Unreferenced (Target); pragma Unreferenced (Clause_Number); begin -- implemented in Local_Link_End null; end Local_Link_Start; procedure Local_Target (Output_Object : in out Texinfo_Output_Type; Text : in String; Target : in String) is begin -- Add an empty non-break object, because @anchor ignores -- whitespace after it, which often occurs in the current -- Scheme source. Put (Output_Object.File, "@anchor{" & Target & "}@w{}"); Ordinary_Text (Output_Object, Text); end Local_Target; procedure New_Column (Output_Object : in out Texinfo_Output_Type) is begin if Output_Object.Column_Count >= 4 then Output_Object.Current_Column := Output_Object.Current_Column + 1; Output_Object.Current_Row := 1; end if; end New_Column; procedure New_Page (Output_Object : in out Texinfo_Output_Type; Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page) is pragma Unreferenced (Kind); pragma Unreferenced (Output_Object); begin -- No such thing in Info. null; end New_Page; procedure Ordinary_Character (Output_Object : in out Texinfo_Output_Type; Char : in Character) is Copyright : constant String := "Copyright"; begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Add_To_Column_Item (Output_Object, "" & Char); when Title => -- Check for end of title page; indicated by line starting with "Copyright" if Output_Object.Line_Empty then if Output_Object.First_Word_Last > 0 then if Copyright (Output_Object.First_Word_Last + 1) = Char then Output_Object.First_Word_Last := Output_Object.First_Word_Last + 1; Output_Object.First_Word (Output_Object.First_Word_Last) := Char; if Output_Object.First_Word_Last = Copyright'Last then End_Title_Page (Output_Object); Output_Object.State := Normal; Ordinary_Text (Output_Object, Output_Object.First_Word (1 .. Output_Object.First_Word_Last)); end if; else -- First word is not Copyright; output it Ordinary_Text (Output_Object, Output_Object.First_Word (1 .. Output_Object.First_Word_Last)); Output_Object.Line_Empty := False; end if; else -- No non-space seen yet if Char = ' ' then null; elsif Char = Copyright (1) then Output_Object.First_Word_Last := 1; Output_Object.First_Word (1) := Char; else Escape_Put (Output_Object, Char); Output_Object.Line_Empty := False; end if; end if; else -- Line already has stuff on it Escape_Put (Output_Object, Char); end if; when Normal => Output_Object.Line_Empty := Char /= ' '; Escape_Put (Output_Object, Char); when Index_Start => Escape_Put (Output_Object, Char); if Char = '&' then -- give debugger a place to break Put_Line ("first index entry"); end if; when Index => case Char is when ' ' | ',' | '[' | ']' => Put (Output_Object.File, Char); when 'A' .. Last_Index_Clause => -- Index section heading -- @node current Put_Line (Output_Object.File, "@node " & Char); -- Add non-break space so Emacs info will use big bold -- font for single letter titles. Put_Line (Output_Object.File, "@section " & Char & "@w{ }"); when others => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Unexpected char in Index: " & Char); end case; end case; end Ordinary_Character; procedure Ordinary_Text (Output_Object : in out Texinfo_Output_Type; Text : in String) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Add_To_Column_Item (Output_Object, Text); when Normal | Title | Index_Start | Index => Output_Object.Line_Empty := False; Escape_Put (Output_Object, Text); end case; end Ordinary_Text; procedure Picture (Output_Object : in out Texinfo_Output_Type; Name : in String; Descr : in String; Alignment : in ARM_Output.Picture_Alignment; Height, Width : in Natural; Border : in ARM_Output.Border_Kind) is pragma Unreferenced (Border); pragma Unreferenced (Width); pragma Unreferenced (Height); pragma Unreferenced (Alignment); pragma Unreferenced (Name); begin Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Picture: " & Descr); end Picture; procedure Revised_Clause_Header (Output_Object : in out Texinfo_Output_Type; New_Header_Text : in String; Old_Header_Text : in String; Level : in ARM_Contents.Level_Type; Clause_Number : in String; Version : in ARM_Contents.Change_Version_Type; Old_Version : in ARM_Contents.Change_Version_Type; Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; No_Page_Break : in Boolean := False) is pragma Unreferenced (Version); pragma Unreferenced (Old_Version); pragma Unreferenced (Old_Header_Text); begin Clause_Header (Output_Object, New_Header_Text, Level, Clause_Number, Top_Level_Subdivision_Name, No_Page_Break); end Revised_Clause_Header; procedure Section (Output_Object : in out Texinfo_Output_Type; Section_Title : in String; Section_Name : in String) is pragma Unreferenced (Section_Name); pragma Unreferenced (Section_Title); pragma Unreferenced (Output_Object); begin -- This is redundant with the various Clause functions null; end Section; procedure Separator_Line (Output_Object : in out Texinfo_Output_Type; Is_Thin : Boolean := True) is begin -- Can't be in a multi-column setting. New_Line (Output_Object.File); if Is_Thin then Put_Line (Output_Object.File, "----------"); else Put_Line (Output_Object.File, "=========="); end if; end Separator_Line; procedure Set_Columns (Output_Object : in out Texinfo_Output_Type; Number_of_Columns : in ARM_Output.Column_Count) is begin Check_Valid (Output_Object); Check_Not_In_Paragraph (Output_Object); -- 2 and 3 column formats are displayed without any columns. -- This is mainly used for the syntax cross-reference and -- index, and these definitely look better without columns. -- -- 4 or more columns are output as a table. Note that we assume -- such items are formated with explicit New_Column calls, and -- do not contain any nested paragraph formats. case Output_Object.State is when Normal => if Number_of_Columns >= 4 then Output_Object.State := Multi_Column; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Column_Widths := (others => 0); -- Accumulate all column rows in Output_Text, then output -- when done, so we can set the correct column width in -- the header. Each column is a linked list of allocated -- Column_Text_Item_Type. else null; end if; when Multi_Column => if Number_of_Columns = 1 then -- Finished accumulating columns, output the columns as a table. Output_Column_Widths (Output_Object); Output_Columns (Output_Object); New_Line (Output_Object.File); Put_Line (Output_Object.File, "@end multitable"); New_Line (Output_Object.File); Output_Object.State := Normal; else Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "New multi-column section before end of old"); end if; when Index_Start | Index => null; when Table_Header | Contents | Title => Unexpected_State (Output_Object); end case; Output_Object.Column_Count := Number_of_Columns; end Set_Columns; procedure Soft_Hyphen_Break (Output_Object : in out Texinfo_Output_Type) is begin Put (Output_Object.File, "@-"); end Soft_Hyphen_Break; procedure Soft_Line_Break (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents | Title => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@-"); when Multi_Column | Table_Header => Unexpected_State (Output_Object); end case; end Soft_Line_Break; procedure Special_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Special_Character_Type) is begin -- We use Ordinary_Text, so this is output to columns when appropriate. case Char is when ARM_Output.EM_Dash => Ordinary_Text (Output_Object, "--"); when ARM_Output.EN_Dash => Ordinary_Text (Output_Object, "-"); -- used for '-' in binary_adding_operator when ARM_Output.GEQ => Ordinary_Text (Output_Object, ">="); when ARM_Output.LEQ => Ordinary_Text (Output_Object, "<="); when ARM_Output.NEQ => Ordinary_Text (Output_Object, "/="); when ARM_Output.PI => Ordinary_Text (Output_Object, "PI"); when ARM_Output.Left_Ceiling => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support ceiling in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@code{ceiling("); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Right_Ceiling => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support ceiling in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, ")}"); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Left_Floor => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support floor in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, "@code{floor("); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Right_Floor => case Output_Object.State is when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Info does not support floor in multi-column"); when Contents => null; when Normal | Index_Start | Index => Put (Output_Object.File, ")}"); when Title => Unexpected_State (Output_Object); end case; when ARM_Output.Thin_Space => Ordinary_Text (Output_Object, " "); when ARM_Output.Left_Quote => Ordinary_Text (Output_Object, "`"); when ARM_Output.Right_Quote => Ordinary_Text (Output_Object, "'"); when ARM_Output.Left_Double_Quote => Ordinary_Text (Output_Object, """"); when ARM_Output.Right_Double_Quote => Ordinary_Text (Output_Object, """"); when ARM_Output.Small_Dotless_I => Ordinary_Text (Output_Object, "i"); when ARM_Output.Capital_Dotted_I => Ordinary_Text (Output_Object, "I"); end case; end Special_Character; procedure Start_Paragraph (Output_Object : in out Texinfo_Output_Type; Style : in ARM_Output.Paragraph_Style_Type; Indent : in ARM_Output.Paragraph_Indent_Type; Number : in String; No_Prefix : in Boolean := False; Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS; No_Breaks : in Boolean := False; Keep_with_Next : in Boolean := False; Space_After : in ARM_Output.Space_After_Type := ARM_Output.Normal; Justification : in ARM_Output.Justification_Type := ARM_Output.Default) is pragma Unreferenced (Justification); pragma Unreferenced (Space_After); pragma Unreferenced (Keep_with_Next); pragma Unreferenced (No_Breaks); pragma Unreferenced (Tab_Stops); use ARM_Output; begin Check_Valid (Output_Object); Check_Not_In_Paragraph (Output_Object); -- Note: makeinfo will do most of the formatting, so No_Breaks, -- Keep_with_Next, Space_After, and Justification have no -- effect here. In addition, info format has no support for -- fonts, so the font aspects of Style are ignored as well. But -- we try to respect the indentation and margin aspects. -- TexInfo does not directly support tabs, but does use a fixed -- font, so we could emulate them. But then we'd have to track -- output characters; let's see if we really need it. case Output_Object.State is when Contents => null; when Normal => if Number'Length > 0 then Put_Line (Output_Object.File, Number & " @*"); end if; Output_Object.In_Paragraph := True; Output_Object.Style := Style; Output_Object.Indent := Indent; case Style is when Normal | Wide_Above | Small | Small_Wide_Above | Header | Small_Header | Syntax_Summary => Handle_Indent (Output_Object, "@quotation"); when Index | Title => null; when Examples | Small_Examples | Swiss_Examples | Small_Swiss_Examples => Handle_Indent (Output_Object, "@example"); when Bulleted | Small_Bulleted => Handle_Indent (Output_Object, "@itemize @bullet"); if not No_Prefix then Put (Output_Object.File, "@item "); end if; when Nested_Bulleted | Small_Nested_Bulleted => Handle_Indent (Output_Object, "@itemize @bullet", Extra_Indent => 1); if not No_Prefix then Put (Output_Object.File, "@item "); end if; when Enumerated | Small_Enumerated => Handle_Indent (Output_Object, "@itemize @w{}"); Put (Output_Object.File, "@item "); when Giant_Hanging | Small_Giant_Hanging | Wide_Hanging | Small_Wide_Hanging | Medium_Hanging | Small_Medium_Hanging | Narrow_Hanging | Small_Narrow_Hanging | Hanging_in_Bulleted | Small_Hanging_in_Bulleted => if No_Prefix then -- Still in hanging part Handle_Indent (Output_Object, "@quotation"); Output_Object.End_Hang_Seen := True; else Output_Object.End_Hang_Seen := False; end if; end case; when Index_Start | Index | Title | Multi_Column | Table_Header => if Number'Length > 0 then Unexpected_State (Output_Object); end if; Output_Object.In_Paragraph := True; Output_Object.Style := Style; Output_Object.Indent := Indent; end case; end Start_Paragraph; procedure Start_Table (Output_Object : in out Texinfo_Output_Type; Columns : in ARM_Output.Column_Count; First_Column_Width : in ARM_Output.Column_Count; Last_Column_Width : in ARM_Output.Column_Count; Alignment : in ARM_Output.Column_Text_Alignment; No_Page_Break : in Boolean; Has_Border : in Boolean; Small_Text_Size : in Boolean; Header_Kind : in ARM_Output.Header_Kind_Type) is pragma Unreferenced (Small_Text_Size); pragma Unreferenced (Has_Border); pragma Unreferenced (No_Page_Break); pragma Unreferenced (Alignment); pragma Unreferenced (Last_Column_Width); pragma Unreferenced (First_Column_Width); use ARM_Output; begin Output_Object.Column_Count := Columns; case Header_Kind is when Both_Caption_and_Header => New_Line (Output_Object.File); -- Next text output will be the caption, which we don't -- format in any special way (first example is F.3.2 (19)). -- Then Table_Marker (End_Caption) is called, which will -- start the actual table. when Header_Only => -- Same as Table_Marker, End_Caption. case Columns is when 1 => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Table with 1 column"); when 2 => -- @table doesn't work inside @display; PDFTex fails with @table here. -- https://lists.gnu.org/archive/html/bug-texinfo/2004-10/txtJLetHrEhdc.txt New_Line (Output_Object.File); Put_Line (Output_Object.File, "@multitable {wwwwwwwwww} {wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww}"); Put (Output_Object.File, "@headitem "); when others => New_Line (Output_Object.File); Put (Output_Object.File, "@multitable"); Output_Object.State := Table_Header; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Max_Row := 0; -- The next text output via Ordinary_Text or -- Ordinary_Character is the table headers. We -- capture them in Output_Object.Column_Text, and -- use them to set the table column widths. end case; when No_Headers => null; end case; end Start_Table; procedure Tab (Output_Object : in out Texinfo_Output_Type) is begin case Output_Object.State is when Contents => null; when Multi_Column | Table_Header => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Tab in multi-column"); when Title => if Output_Object.Line_Empty then null; else Put (Output_Object.File, "@w{ }"); end if; when Normal | Index_Start | Index => -- Just three spaces for now, for indented trees Put (Output_Object.File, "@w{ }"); end case; end Tab; procedure Table_Marker (Output_Object : in out Texinfo_Output_Type; Marker : in ARM_Output.Table_Marker_Type) is begin case Marker is when ARM_Output.End_Caption => -- Start the actual table case Output_Object.Column_Count is when 1 => Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity, "Table with 1 column"); when 2 => New_Line (Output_Object.File); Put_Line (Output_Object.File, "@multitable {wwwwwwwwww} {wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww}"); Put (Output_Object.File, "@headitem "); when others => New_Line (Output_Object.File); Put (Output_Object.File, "@multitable"); Output_Object.State := Table_Header; Output_Object.Current_Column := 1; Output_Object.Current_Row := 1; Output_Object.Max_Row := 0; -- The next text output via Ordinary_Text or -- Ordinary_Character is the table headers. We -- capture them in Output_Object.Column_Text, and -- use them to set the table column widths. end case; when ARM_Output.End_Item => case Output_Object.State is when Table_Header => Output_Object.Current_Column := Output_Object.Current_Column + 1; Output_Object.Current_Row := 1; when Normal => case Output_Object.Column_Count is when 2 => New_Line (Output_Object.File); Put (Output_Object.File, "@tab "); when others => Put (Output_Object.File, " @tab "); end case; when Multi_Column | Contents | Title | Index_Start | Index => Unexpected_State (Output_Object); end case; when ARM_Output.End_Header => case Output_Object.State is when Table_Header => Output_Object.State := Normal; for I in 1 .. Output_Object.Column_Count loop Put (Output_Object.File, " {" & Output_Object.Column_Text (I).Text (1 .. Output_Object.Column_Text (I).Length) & "}"); end loop; New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Pad_Columns (Output_Object); Output_Columns (Output_Object); New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Output_Object.Current_Column := 1; when Normal => -- A two-column table; header has been output New_Line (Output_Object.File); Put (Output_Object.File, "@item "); when Contents | Multi_Column | Title | Index_Start | Index => Unexpected_State (Output_Object); end case; when ARM_Output.End_Row | ARM_Output.End_Row_Next_Is_Last => New_Line (Output_Object.File); Put (Output_Object.File, "@item "); Output_Object.Current_Column := 1; when ARM_Output.End_Table => case Output_Object.Column_Count is when 2 => New_Line (Output_Object.File); Put_Line (Output_Object.File, "@end multitable"); when others => Put_Line (Output_Object.File, "@end multitable"); end case; end case; end Table_Marker; procedure TOC_Marker (Output_Object : in out Texinfo_Output_Type; For_Start : in Boolean) is begin -- We use menus, not @contents (since makeinfo ignores -- @contents in info mode). The menus (including the top menu) -- are generated from data stored in ARM_Contents during the -- scan pass. if For_Start then Output_Object.State := Contents; -- Ignore futher output until For_Start = False. else Output_Object.State := Normal; end if; end TOC_Marker; procedure Unicode_Character (Output_Object : in out Texinfo_Output_Type; Char : in ARM_Output.Unicode_Type) is begin -- Used in section 2.3 Identifiers examples, 2.5 character -- literals examples, 2.6 string literals examples, 3.3.1 -- Object Declarations examples, 4.4 Expressions examples Put (Output_Object.File, "[Unicode" & ARM_Output.Unicode_Type'Image (Char) & "]"); end Unicode_Character; procedure URL_Link (Output_Object : in out Texinfo_Output_Type; Text : in String; URL : in String) is begin Put (Output_Object.File, "@uref{" & URL & "," & Text & "}"); end URL_Link; end ARM_Texinfo;
[ { "context": "-------------------------------------\n-- Author: Juergen Pfeifer, 1996\n-- Version Control\n-- $Revision: 1.13 $\n-", "end": 2793, "score": 0.9998624920845032, "start": 2778, "tag": "NAME", "value": "Juergen Pfeifer" } ]
Ada95/samples/sample-menu_demo-aux.adb
arc-aosp/external_libncurses
35
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Menu_Demo.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998,2006 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control -- $Revision: 1.13 $ -- $Date: 2006/06/25 14:30:22 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Sample.Manifest; use Sample.Manifest; with Sample.Helpers; use Sample.Helpers; with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.Explanation; use Sample.Explanation; package body Sample.Menu_Demo.Aux is procedure Geometry (M : in Menu; L : out Line_Count; C : out Column_Count; Y : out Line_Position; X : out Column_Position; Fy : out Line_Position; Fx : out Column_Position); procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position; -- Proposed Column for menu Fy : out Line_Position; -- Vertical inner frame Fx : out Column_Position) -- Horiz. inner frame is Spc_Desc : Column_Position; -- spaces between description and item begin Set_Mark (M, Menu_Marker); Spacing (M, Spc_Desc, Fy, Fx); Scale (M, L, C); Fx := Fx + Column_Position (Fy - 1); -- looks a bit nicer L := L + 2 * Fy; -- count for frame at top and bottom C := C + 2 * Fx; -- " -- Calculate horizontal coordinate at the screen center X := (Columns - C) / 2; Y := 1; -- always startin line 1 end Geometry; procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position) -- Proposed Column for menu is Fy : Line_Position; Fx : Column_Position; begin Geometry (M, L, C, Y, X, Fy, Fx); end Geometry; function Create (M : Menu; Title : String; Lin : Line_Position; Col : Column_Position) return Panel is W, S : Window; L : Line_Count; C : Column_Count; Y, Fy : Line_Position; X, Fx : Column_Position; Pan : Panel; begin Geometry (M, L, C, Y, X, Fy, Fx); W := New_Window (L, C, Lin, Col); Set_Meta_Mode (W); Set_KeyPad_Mode (W); if Has_Colors then Set_Background (Win => W, Ch => (Ch => ' ', Color => Menu_Back_Color, Attr => Normal_Video)); Set_Foreground (Men => M, Color => Menu_Fore_Color); Set_Background (Men => M, Color => Menu_Back_Color); Set_Grey (Men => M, Color => Menu_Grey_Color); Erase (W); end if; S := Derived_Window (W, L - Fy, C - Fx, Fy, Fx); Set_Meta_Mode (S); Set_KeyPad_Mode (S); Box (W); Set_Window (M, W); Set_Sub_Window (M, S); if Title'Length > 0 then Window_Title (W, Title); end if; Pan := New_Panel (W); Post (M); return Pan; end Create; procedure Destroy (M : in Menu; P : in out Panel) is W, S : Window; begin W := Get_Window (M); S := Get_Sub_Window (M); Post (M, False); Erase (W); Delete (P); Set_Window (M, Null_Window); Set_Sub_Window (M, Null_Window); Delete (S); Delete (W); Update_Panels; end Destroy; function Get_Request (M : Menu; P : Panel) return Key_Code is W : constant Window := Get_Window (M); K : Real_Key_Code; Ch : Character; begin Top (P); loop K := Get_Key (W); if K in Special_Key_Code'Range then case K is when HELP_CODE => Explain_Context; when EXPLAIN_CODE => Explain ("MENUKEYS"); when Key_Home => return REQ_FIRST_ITEM; when QUIT_CODE => return QUIT; when Key_Cursor_Down => return REQ_DOWN_ITEM; when Key_Cursor_Up => return REQ_UP_ITEM; when Key_Cursor_Left => return REQ_LEFT_ITEM; when Key_Cursor_Right => return REQ_RIGHT_ITEM; when Key_End => return REQ_LAST_ITEM; when Key_Backspace => return REQ_BACK_PATTERN; when Key_Next_Page => return REQ_SCR_DPAGE; when Key_Previous_Page => return REQ_SCR_UPAGE; when others => return K; end case; elsif K in Normal_Key_Code'Range then Ch := Character'Val (K); case Ch is when CAN => return QUIT; -- CTRL-X when SO => return REQ_NEXT_ITEM; -- CTRL-N when DLE => return REQ_PREV_ITEM; -- CTRL-P when NAK => return REQ_SCR_ULINE; -- CTRL-U when EOT => return REQ_SCR_DLINE; -- CTRL-D when ACK => return REQ_SCR_DPAGE; -- CTRL-F when STX => return REQ_SCR_UPAGE; -- CTRL-B when EM => return REQ_CLEAR_PATTERN; -- CTRL-Y when BS => return REQ_BACK_PATTERN; -- CTRL-H when SOH => return REQ_NEXT_MATCH; -- CTRL-A when ENQ => return REQ_PREV_MATCH; -- CTRL-E when DC4 => return REQ_TOGGLE_ITEM; -- CTRL-T when CR | LF => return SELECT_ITEM; when others => return K; end case; else return K; end if; end loop; end Get_Request; end Sample.Menu_Demo.Aux;
22273
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Menu_Demo.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998,2006 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: <NAME>, 1996 -- Version Control -- $Revision: 1.13 $ -- $Date: 2006/06/25 14:30:22 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Sample.Manifest; use Sample.Manifest; with Sample.Helpers; use Sample.Helpers; with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.Explanation; use Sample.Explanation; package body Sample.Menu_Demo.Aux is procedure Geometry (M : in Menu; L : out Line_Count; C : out Column_Count; Y : out Line_Position; X : out Column_Position; Fy : out Line_Position; Fx : out Column_Position); procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position; -- Proposed Column for menu Fy : out Line_Position; -- Vertical inner frame Fx : out Column_Position) -- Horiz. inner frame is Spc_Desc : Column_Position; -- spaces between description and item begin Set_Mark (M, Menu_Marker); Spacing (M, Spc_Desc, Fy, Fx); Scale (M, L, C); Fx := Fx + Column_Position (Fy - 1); -- looks a bit nicer L := L + 2 * Fy; -- count for frame at top and bottom C := C + 2 * Fx; -- " -- Calculate horizontal coordinate at the screen center X := (Columns - C) / 2; Y := 1; -- always startin line 1 end Geometry; procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position) -- Proposed Column for menu is Fy : Line_Position; Fx : Column_Position; begin Geometry (M, L, C, Y, X, Fy, Fx); end Geometry; function Create (M : Menu; Title : String; Lin : Line_Position; Col : Column_Position) return Panel is W, S : Window; L : Line_Count; C : Column_Count; Y, Fy : Line_Position; X, Fx : Column_Position; Pan : Panel; begin Geometry (M, L, C, Y, X, Fy, Fx); W := New_Window (L, C, Lin, Col); Set_Meta_Mode (W); Set_KeyPad_Mode (W); if Has_Colors then Set_Background (Win => W, Ch => (Ch => ' ', Color => Menu_Back_Color, Attr => Normal_Video)); Set_Foreground (Men => M, Color => Menu_Fore_Color); Set_Background (Men => M, Color => Menu_Back_Color); Set_Grey (Men => M, Color => Menu_Grey_Color); Erase (W); end if; S := Derived_Window (W, L - Fy, C - Fx, Fy, Fx); Set_Meta_Mode (S); Set_KeyPad_Mode (S); Box (W); Set_Window (M, W); Set_Sub_Window (M, S); if Title'Length > 0 then Window_Title (W, Title); end if; Pan := New_Panel (W); Post (M); return Pan; end Create; procedure Destroy (M : in Menu; P : in out Panel) is W, S : Window; begin W := Get_Window (M); S := Get_Sub_Window (M); Post (M, False); Erase (W); Delete (P); Set_Window (M, Null_Window); Set_Sub_Window (M, Null_Window); Delete (S); Delete (W); Update_Panels; end Destroy; function Get_Request (M : Menu; P : Panel) return Key_Code is W : constant Window := Get_Window (M); K : Real_Key_Code; Ch : Character; begin Top (P); loop K := Get_Key (W); if K in Special_Key_Code'Range then case K is when HELP_CODE => Explain_Context; when EXPLAIN_CODE => Explain ("MENUKEYS"); when Key_Home => return REQ_FIRST_ITEM; when QUIT_CODE => return QUIT; when Key_Cursor_Down => return REQ_DOWN_ITEM; when Key_Cursor_Up => return REQ_UP_ITEM; when Key_Cursor_Left => return REQ_LEFT_ITEM; when Key_Cursor_Right => return REQ_RIGHT_ITEM; when Key_End => return REQ_LAST_ITEM; when Key_Backspace => return REQ_BACK_PATTERN; when Key_Next_Page => return REQ_SCR_DPAGE; when Key_Previous_Page => return REQ_SCR_UPAGE; when others => return K; end case; elsif K in Normal_Key_Code'Range then Ch := Character'Val (K); case Ch is when CAN => return QUIT; -- CTRL-X when SO => return REQ_NEXT_ITEM; -- CTRL-N when DLE => return REQ_PREV_ITEM; -- CTRL-P when NAK => return REQ_SCR_ULINE; -- CTRL-U when EOT => return REQ_SCR_DLINE; -- CTRL-D when ACK => return REQ_SCR_DPAGE; -- CTRL-F when STX => return REQ_SCR_UPAGE; -- CTRL-B when EM => return REQ_CLEAR_PATTERN; -- CTRL-Y when BS => return REQ_BACK_PATTERN; -- CTRL-H when SOH => return REQ_NEXT_MATCH; -- CTRL-A when ENQ => return REQ_PREV_MATCH; -- CTRL-E when DC4 => return REQ_TOGGLE_ITEM; -- CTRL-T when CR | LF => return SELECT_ITEM; when others => return K; end case; else return K; end if; end loop; end Get_Request; end Sample.Menu_Demo.Aux;
true
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Menu_Demo.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998,2006 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: PI:NAME:<NAME>END_PI, 1996 -- Version Control -- $Revision: 1.13 $ -- $Date: 2006/06/25 14:30:22 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Sample.Manifest; use Sample.Manifest; with Sample.Helpers; use Sample.Helpers; with Sample.Keyboard_Handler; use Sample.Keyboard_Handler; with Sample.Explanation; use Sample.Explanation; package body Sample.Menu_Demo.Aux is procedure Geometry (M : in Menu; L : out Line_Count; C : out Column_Count; Y : out Line_Position; X : out Column_Position; Fy : out Line_Position; Fx : out Column_Position); procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position; -- Proposed Column for menu Fy : out Line_Position; -- Vertical inner frame Fx : out Column_Position) -- Horiz. inner frame is Spc_Desc : Column_Position; -- spaces between description and item begin Set_Mark (M, Menu_Marker); Spacing (M, Spc_Desc, Fy, Fx); Scale (M, L, C); Fx := Fx + Column_Position (Fy - 1); -- looks a bit nicer L := L + 2 * Fy; -- count for frame at top and bottom C := C + 2 * Fx; -- " -- Calculate horizontal coordinate at the screen center X := (Columns - C) / 2; Y := 1; -- always startin line 1 end Geometry; procedure Geometry (M : in Menu; L : out Line_Count; -- Lines used for menu C : out Column_Count; -- Columns used for menu Y : out Line_Position; -- Proposed Line for menu X : out Column_Position) -- Proposed Column for menu is Fy : Line_Position; Fx : Column_Position; begin Geometry (M, L, C, Y, X, Fy, Fx); end Geometry; function Create (M : Menu; Title : String; Lin : Line_Position; Col : Column_Position) return Panel is W, S : Window; L : Line_Count; C : Column_Count; Y, Fy : Line_Position; X, Fx : Column_Position; Pan : Panel; begin Geometry (M, L, C, Y, X, Fy, Fx); W := New_Window (L, C, Lin, Col); Set_Meta_Mode (W); Set_KeyPad_Mode (W); if Has_Colors then Set_Background (Win => W, Ch => (Ch => ' ', Color => Menu_Back_Color, Attr => Normal_Video)); Set_Foreground (Men => M, Color => Menu_Fore_Color); Set_Background (Men => M, Color => Menu_Back_Color); Set_Grey (Men => M, Color => Menu_Grey_Color); Erase (W); end if; S := Derived_Window (W, L - Fy, C - Fx, Fy, Fx); Set_Meta_Mode (S); Set_KeyPad_Mode (S); Box (W); Set_Window (M, W); Set_Sub_Window (M, S); if Title'Length > 0 then Window_Title (W, Title); end if; Pan := New_Panel (W); Post (M); return Pan; end Create; procedure Destroy (M : in Menu; P : in out Panel) is W, S : Window; begin W := Get_Window (M); S := Get_Sub_Window (M); Post (M, False); Erase (W); Delete (P); Set_Window (M, Null_Window); Set_Sub_Window (M, Null_Window); Delete (S); Delete (W); Update_Panels; end Destroy; function Get_Request (M : Menu; P : Panel) return Key_Code is W : constant Window := Get_Window (M); K : Real_Key_Code; Ch : Character; begin Top (P); loop K := Get_Key (W); if K in Special_Key_Code'Range then case K is when HELP_CODE => Explain_Context; when EXPLAIN_CODE => Explain ("MENUKEYS"); when Key_Home => return REQ_FIRST_ITEM; when QUIT_CODE => return QUIT; when Key_Cursor_Down => return REQ_DOWN_ITEM; when Key_Cursor_Up => return REQ_UP_ITEM; when Key_Cursor_Left => return REQ_LEFT_ITEM; when Key_Cursor_Right => return REQ_RIGHT_ITEM; when Key_End => return REQ_LAST_ITEM; when Key_Backspace => return REQ_BACK_PATTERN; when Key_Next_Page => return REQ_SCR_DPAGE; when Key_Previous_Page => return REQ_SCR_UPAGE; when others => return K; end case; elsif K in Normal_Key_Code'Range then Ch := Character'Val (K); case Ch is when CAN => return QUIT; -- CTRL-X when SO => return REQ_NEXT_ITEM; -- CTRL-N when DLE => return REQ_PREV_ITEM; -- CTRL-P when NAK => return REQ_SCR_ULINE; -- CTRL-U when EOT => return REQ_SCR_DLINE; -- CTRL-D when ACK => return REQ_SCR_DPAGE; -- CTRL-F when STX => return REQ_SCR_UPAGE; -- CTRL-B when EM => return REQ_CLEAR_PATTERN; -- CTRL-Y when BS => return REQ_BACK_PATTERN; -- CTRL-H when SOH => return REQ_NEXT_MATCH; -- CTRL-A when ENQ => return REQ_PREV_MATCH; -- CTRL-E when DC4 => return REQ_TOGGLE_ITEM; -- CTRL-T when CR | LF => return SELECT_ITEM; when others => return K; end case; else return K; end if; end loop; end Get_Request; end Sample.Menu_Demo.Aux;
[ { "context": ".Sessions\n-- Copyright (C) 2010, 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 177, "score": 0.9998618960380554, "start": 162, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "0, 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 208, "score": 0.999879002571106, "start": 193, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "3 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 235, "score": 0.9999291300773621, "start": 210, "tag": "EMAIL", "value": "[email protected]" } ]
regtests/asf-servlets-tests.adb
Letractively/ada-asf
0
----------------------------------------------------------------------- -- Sessions Tests - Unit tests for ASF.Sessions -- Copyright (C) 2010, 2011, 2012, 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. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Measures; with ASF.Applications; with ASF.Streams; with ASF.Requests.Mockup; with ASF.Responses.Mockup; package body ASF.Servlets.Tests is use Util.Tests; procedure Do_Get (Server : in Test_Servlet1; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class) is pragma Unreferenced (Server); Output : ASF.Streams.Print_Stream := Response.Get_Output_Stream; begin Output.Write ("URI: " & Request.Get_Request_URI); Response.Set_Status (Responses.SC_OK); end Do_Get; procedure Do_Post (Server : in Test_Servlet2; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class) is begin null; end Do_Post; S1 : aliased Test_Servlet1; S2 : aliased Test_Servlet2; -- ------------------------------ -- Check that the request is done on the good servlet and with the correct servlet path -- and path info. -- ------------------------------ procedure Check_Request (T : in out Test; Ctx : in Servlet_Registry; URI : in String; Servlet_Path : in String; Path_Info : in String) is Dispatcher : constant Request_Dispatcher := Ctx.Get_Request_Dispatcher (Path => URI); Req : ASF.Requests.Mockup.Request; Resp : ASF.Responses.Mockup.Response; Result : Unbounded_String; begin T.Assert (Dispatcher.Mapping /= null, "No mapping found"); Req.Set_Request_URI ("test1"); Req.Set_Method ("GET"); Forward (Dispatcher, Req, Resp); Assert_Equals (T, Servlet_Path, Req.Get_Servlet_Path, "Invalid servlet path"); Assert_Equals (T, Path_Info, Req.Get_Path_Info, "The request path info is invalid"); -- Check the response after the Test_Servlet1.Do_Get method execution. Resp.Read_Content (Result); Assert_Equals (T, ASF.Responses.SC_OK, Resp.Get_Status, "Invalid status"); Assert_Equals (T, "URI: test1", Result, "Invalid content"); Req.Set_Method ("POST"); Forward (Dispatcher, Req, Resp); Assert_Equals (T, ASF.Responses.SC_METHOD_NOT_ALLOWED, Resp.Get_Status, "Invalid status for an operation not implemented"); end Check_Request; -- ------------------------------ -- Test request dispatcher and servlet invocation -- ------------------------------ procedure Test_Request_Dispatcher (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "/p1/p2/p3/*", Name => "Faces"); Check_Request (T, Ctx, "/home/test.jsf", "", "/home/test.jsf"); end Test_Request_Dispatcher; -- ------------------------------ -- Test mapping and servlet path on a request. -- ------------------------------ procedure Test_Servlet_Path (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "/p1/p2/p3/*", Name => "Faces"); Check_Request (T, Ctx, "/p1/p2/p3/home/test.html", "/p1/p2/p3", "/home/test.html"); end Test_Servlet_Path; -- ------------------------------ -- Test add servlet -- ------------------------------ procedure Test_Add_Servlet (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Assert_Equals (T, "Faces", S1.Get_Name, "Invalid name for the servlet"); begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); T.Assert (False, "No exception raised if the servlet is registered several times"); exception when Servlet_Error => null; end; end Test_Add_Servlet; -- ------------------------------ -- Test getting a resource path -- ------------------------------ procedure Test_Get_Resource (T : in out Test) is Ctx : Servlet_Registry; Conf : Applications.Config; S1 : aliased Test_Servlet1; Dir : constant String := "regtests/files"; Path : constant String := Util.Tests.Get_Path (Dir); begin Conf.Load_Properties ("regtests/view.properties"); Conf.Set ("view.dir", Path); Ctx.Set_Init_Parameters (Conf); Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); -- Resource exist, check the returned path. declare P : constant String := Ctx.Get_Resource ("/tests/form-text.xhtml"); begin Assert_Matches (T, ".*/regtests/files/tests/form-text.xhtml", P, "Invalid resource path"); end; -- Resource does not exist declare P : constant String := Ctx.Get_Resource ("/tests/form-text-missing.xhtml"); begin Assert_Equals (T, "", P, "Invalid resource path for missing resource"); end; end Test_Get_Resource; -- ------------------------------ -- Check that the mapping for the given URI matches the server. -- ------------------------------ procedure Check_Mapping (T : in out Test; Ctx : in Servlet_Registry; URI : in String; Server : in Servlet_Access) is Map : constant Mapping_Access := Ctx.Find_Mapping (URI); begin if Map = null then T.Assert (Server = null, "No mapping returned for URI: " & URI); else T.Assert (Server /= null, "A mapping is returned for URI: " & URI); T.Assert (Map.Servlet = Server, "Invalid mapping returned for URI: " & URI); end if; end Check_Mapping; -- ------------------------------ -- Test session creation. -- ------------------------------ procedure Test_Create_Servlet (T : in out Test) is Ctx : Servlet_Registry; Map : Mapping_Access; begin Ctx.Add_Servlet (Name => "Faces", Server => S1'Access); Ctx.Add_Servlet (Name => "Text", Server => S2'Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "*.html", Name => "Faces"); Ctx.Add_Mapping (Pattern => "*.txt", Name => "Text"); -- Ctx.Add_Mapping (Pattern => "/server", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/server/john/*", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/server/info", Server => S1'Access); Ctx.Add_Mapping (Pattern => "/server/list", Server => S1'Access); Ctx.Add_Mapping (Pattern => "/server/list2", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/1/2/3/4/5/6/7/8/9/server/list2", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/1/2/3/4/5/6/7/8/A/server/list2", Server => S1'Access); Ctx.Mappings.Dump_Map (" "); T.Check_Mapping (Ctx, "/joe/black/joe.jsf", S1'Access); T.Check_Mapping (Ctx, "/joe/black/joe.txt", S2'Access); T.Check_Mapping (Ctx, "/server/info", S1'Access); T.Check_Mapping (Ctx, "/server/list2", S2'Access); T.Check_Mapping (Ctx, "/1/2/3/4/5/6/7/8/9/server/list2", S2'Access); T.Check_Mapping (Ctx, "/1/2/3/4/5/6/7/8/A/server/list2", S1'Access); declare St : Util.Measures.Stamp; begin for I in 1 .. 1000 loop Map := Ctx.Find_Mapping (URI => "/joe/black/joe.jsf"); end loop; Util.Measures.Report (St, "Find 1000 mapping (extension)"); end; T.Assert (Map /= null, "No mapping for 'joe.jsf'"); T.Assert (Map.Servlet /= null, "No servlet for mapping for 'joe.jsf'"); T.Assert (Map.Servlet = S1'Access, "Invalid servlet"); -- Util.Measures.Report (St, "10 Session create"); declare St : Util.Measures.Stamp; begin for I in 1 .. 1000 loop Map := Ctx.Find_Mapping (URI => "/1/2/3/4/5/6/7/8/9/server/list2"); end loop; Util.Measures.Report (St, "Find 1000 mapping (path)"); end; T.Assert (Map /= null, "No mapping for '/server/john/joe.jsf'"); T.Assert (Map.Servlet /= null, "No servlet for mapping for 'joe.jsf'"); T.Assert (Map.Servlet = S2'Access, "Invalid servlet"); -- Util.Measures.Report (St, "10 Session create"); end Test_Create_Servlet; package Caller is new Util.Test_Caller (Test, "Servlets"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin -- To document what is tested, register the test methods for each -- operation that is tested. Caller.Add_Test (Suite, "Test ASF.Servlets.Add_Mapping,Find_Mapping", Test_Create_Servlet'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Add_Servlet", Test_Add_Servlet'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Get_Request_Dispatcher", Test_Request_Dispatcher'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Get_Resource", Test_Get_Resource'Access); Caller.Add_Test (Suite, "Test ASF.Requests.Get_Servlet_Path", Test_Servlet_Path'Access); end Add_Tests; end ASF.Servlets.Tests;
714
----------------------------------------------------------------------- -- Sessions Tests - Unit tests for ASF.Sessions -- Copyright (C) 2010, 2011, 2012, 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Measures; with ASF.Applications; with ASF.Streams; with ASF.Requests.Mockup; with ASF.Responses.Mockup; package body ASF.Servlets.Tests is use Util.Tests; procedure Do_Get (Server : in Test_Servlet1; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class) is pragma Unreferenced (Server); Output : ASF.Streams.Print_Stream := Response.Get_Output_Stream; begin Output.Write ("URI: " & Request.Get_Request_URI); Response.Set_Status (Responses.SC_OK); end Do_Get; procedure Do_Post (Server : in Test_Servlet2; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class) is begin null; end Do_Post; S1 : aliased Test_Servlet1; S2 : aliased Test_Servlet2; -- ------------------------------ -- Check that the request is done on the good servlet and with the correct servlet path -- and path info. -- ------------------------------ procedure Check_Request (T : in out Test; Ctx : in Servlet_Registry; URI : in String; Servlet_Path : in String; Path_Info : in String) is Dispatcher : constant Request_Dispatcher := Ctx.Get_Request_Dispatcher (Path => URI); Req : ASF.Requests.Mockup.Request; Resp : ASF.Responses.Mockup.Response; Result : Unbounded_String; begin T.Assert (Dispatcher.Mapping /= null, "No mapping found"); Req.Set_Request_URI ("test1"); Req.Set_Method ("GET"); Forward (Dispatcher, Req, Resp); Assert_Equals (T, Servlet_Path, Req.Get_Servlet_Path, "Invalid servlet path"); Assert_Equals (T, Path_Info, Req.Get_Path_Info, "The request path info is invalid"); -- Check the response after the Test_Servlet1.Do_Get method execution. Resp.Read_Content (Result); Assert_Equals (T, ASF.Responses.SC_OK, Resp.Get_Status, "Invalid status"); Assert_Equals (T, "URI: test1", Result, "Invalid content"); Req.Set_Method ("POST"); Forward (Dispatcher, Req, Resp); Assert_Equals (T, ASF.Responses.SC_METHOD_NOT_ALLOWED, Resp.Get_Status, "Invalid status for an operation not implemented"); end Check_Request; -- ------------------------------ -- Test request dispatcher and servlet invocation -- ------------------------------ procedure Test_Request_Dispatcher (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "/p1/p2/p3/*", Name => "Faces"); Check_Request (T, Ctx, "/home/test.jsf", "", "/home/test.jsf"); end Test_Request_Dispatcher; -- ------------------------------ -- Test mapping and servlet path on a request. -- ------------------------------ procedure Test_Servlet_Path (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "/p1/p2/p3/*", Name => "Faces"); Check_Request (T, Ctx, "/p1/p2/p3/home/test.html", "/p1/p2/p3", "/home/test.html"); end Test_Servlet_Path; -- ------------------------------ -- Test add servlet -- ------------------------------ procedure Test_Add_Servlet (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Assert_Equals (T, "Faces", S1.Get_Name, "Invalid name for the servlet"); begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); T.Assert (False, "No exception raised if the servlet is registered several times"); exception when Servlet_Error => null; end; end Test_Add_Servlet; -- ------------------------------ -- Test getting a resource path -- ------------------------------ procedure Test_Get_Resource (T : in out Test) is Ctx : Servlet_Registry; Conf : Applications.Config; S1 : aliased Test_Servlet1; Dir : constant String := "regtests/files"; Path : constant String := Util.Tests.Get_Path (Dir); begin Conf.Load_Properties ("regtests/view.properties"); Conf.Set ("view.dir", Path); Ctx.Set_Init_Parameters (Conf); Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); -- Resource exist, check the returned path. declare P : constant String := Ctx.Get_Resource ("/tests/form-text.xhtml"); begin Assert_Matches (T, ".*/regtests/files/tests/form-text.xhtml", P, "Invalid resource path"); end; -- Resource does not exist declare P : constant String := Ctx.Get_Resource ("/tests/form-text-missing.xhtml"); begin Assert_Equals (T, "", P, "Invalid resource path for missing resource"); end; end Test_Get_Resource; -- ------------------------------ -- Check that the mapping for the given URI matches the server. -- ------------------------------ procedure Check_Mapping (T : in out Test; Ctx : in Servlet_Registry; URI : in String; Server : in Servlet_Access) is Map : constant Mapping_Access := Ctx.Find_Mapping (URI); begin if Map = null then T.Assert (Server = null, "No mapping returned for URI: " & URI); else T.Assert (Server /= null, "A mapping is returned for URI: " & URI); T.Assert (Map.Servlet = Server, "Invalid mapping returned for URI: " & URI); end if; end Check_Mapping; -- ------------------------------ -- Test session creation. -- ------------------------------ procedure Test_Create_Servlet (T : in out Test) is Ctx : Servlet_Registry; Map : Mapping_Access; begin Ctx.Add_Servlet (Name => "Faces", Server => S1'Access); Ctx.Add_Servlet (Name => "Text", Server => S2'Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "*.html", Name => "Faces"); Ctx.Add_Mapping (Pattern => "*.txt", Name => "Text"); -- Ctx.Add_Mapping (Pattern => "/server", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/server/john/*", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/server/info", Server => S1'Access); Ctx.Add_Mapping (Pattern => "/server/list", Server => S1'Access); Ctx.Add_Mapping (Pattern => "/server/list2", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/1/2/3/4/5/6/7/8/9/server/list2", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/1/2/3/4/5/6/7/8/A/server/list2", Server => S1'Access); Ctx.Mappings.Dump_Map (" "); T.Check_Mapping (Ctx, "/joe/black/joe.jsf", S1'Access); T.Check_Mapping (Ctx, "/joe/black/joe.txt", S2'Access); T.Check_Mapping (Ctx, "/server/info", S1'Access); T.Check_Mapping (Ctx, "/server/list2", S2'Access); T.Check_Mapping (Ctx, "/1/2/3/4/5/6/7/8/9/server/list2", S2'Access); T.Check_Mapping (Ctx, "/1/2/3/4/5/6/7/8/A/server/list2", S1'Access); declare St : Util.Measures.Stamp; begin for I in 1 .. 1000 loop Map := Ctx.Find_Mapping (URI => "/joe/black/joe.jsf"); end loop; Util.Measures.Report (St, "Find 1000 mapping (extension)"); end; T.Assert (Map /= null, "No mapping for 'joe.jsf'"); T.Assert (Map.Servlet /= null, "No servlet for mapping for 'joe.jsf'"); T.Assert (Map.Servlet = S1'Access, "Invalid servlet"); -- Util.Measures.Report (St, "10 Session create"); declare St : Util.Measures.Stamp; begin for I in 1 .. 1000 loop Map := Ctx.Find_Mapping (URI => "/1/2/3/4/5/6/7/8/9/server/list2"); end loop; Util.Measures.Report (St, "Find 1000 mapping (path)"); end; T.Assert (Map /= null, "No mapping for '/server/john/joe.jsf'"); T.Assert (Map.Servlet /= null, "No servlet for mapping for 'joe.jsf'"); T.Assert (Map.Servlet = S2'Access, "Invalid servlet"); -- Util.Measures.Report (St, "10 Session create"); end Test_Create_Servlet; package Caller is new Util.Test_Caller (Test, "Servlets"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin -- To document what is tested, register the test methods for each -- operation that is tested. Caller.Add_Test (Suite, "Test ASF.Servlets.Add_Mapping,Find_Mapping", Test_Create_Servlet'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Add_Servlet", Test_Add_Servlet'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Get_Request_Dispatcher", Test_Request_Dispatcher'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Get_Resource", Test_Get_Resource'Access); Caller.Add_Test (Suite, "Test ASF.Requests.Get_Servlet_Path", Test_Servlet_Path'Access); end Add_Tests; end ASF.Servlets.Tests;
true
----------------------------------------------------------------------- -- Sessions Tests - Unit tests for ASF.Sessions -- Copyright (C) 2010, 2011, 2012, 2013 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Measures; with ASF.Applications; with ASF.Streams; with ASF.Requests.Mockup; with ASF.Responses.Mockup; package body ASF.Servlets.Tests is use Util.Tests; procedure Do_Get (Server : in Test_Servlet1; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class) is pragma Unreferenced (Server); Output : ASF.Streams.Print_Stream := Response.Get_Output_Stream; begin Output.Write ("URI: " & Request.Get_Request_URI); Response.Set_Status (Responses.SC_OK); end Do_Get; procedure Do_Post (Server : in Test_Servlet2; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class) is begin null; end Do_Post; S1 : aliased Test_Servlet1; S2 : aliased Test_Servlet2; -- ------------------------------ -- Check that the request is done on the good servlet and with the correct servlet path -- and path info. -- ------------------------------ procedure Check_Request (T : in out Test; Ctx : in Servlet_Registry; URI : in String; Servlet_Path : in String; Path_Info : in String) is Dispatcher : constant Request_Dispatcher := Ctx.Get_Request_Dispatcher (Path => URI); Req : ASF.Requests.Mockup.Request; Resp : ASF.Responses.Mockup.Response; Result : Unbounded_String; begin T.Assert (Dispatcher.Mapping /= null, "No mapping found"); Req.Set_Request_URI ("test1"); Req.Set_Method ("GET"); Forward (Dispatcher, Req, Resp); Assert_Equals (T, Servlet_Path, Req.Get_Servlet_Path, "Invalid servlet path"); Assert_Equals (T, Path_Info, Req.Get_Path_Info, "The request path info is invalid"); -- Check the response after the Test_Servlet1.Do_Get method execution. Resp.Read_Content (Result); Assert_Equals (T, ASF.Responses.SC_OK, Resp.Get_Status, "Invalid status"); Assert_Equals (T, "URI: test1", Result, "Invalid content"); Req.Set_Method ("POST"); Forward (Dispatcher, Req, Resp); Assert_Equals (T, ASF.Responses.SC_METHOD_NOT_ALLOWED, Resp.Get_Status, "Invalid status for an operation not implemented"); end Check_Request; -- ------------------------------ -- Test request dispatcher and servlet invocation -- ------------------------------ procedure Test_Request_Dispatcher (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "/p1/p2/p3/*", Name => "Faces"); Check_Request (T, Ctx, "/home/test.jsf", "", "/home/test.jsf"); end Test_Request_Dispatcher; -- ------------------------------ -- Test mapping and servlet path on a request. -- ------------------------------ procedure Test_Servlet_Path (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "/p1/p2/p3/*", Name => "Faces"); Check_Request (T, Ctx, "/p1/p2/p3/home/test.html", "/p1/p2/p3", "/home/test.html"); end Test_Servlet_Path; -- ------------------------------ -- Test add servlet -- ------------------------------ procedure Test_Add_Servlet (T : in out Test) is Ctx : Servlet_Registry; S1 : aliased Test_Servlet1; begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); Assert_Equals (T, "Faces", S1.Get_Name, "Invalid name for the servlet"); begin Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); T.Assert (False, "No exception raised if the servlet is registered several times"); exception when Servlet_Error => null; end; end Test_Add_Servlet; -- ------------------------------ -- Test getting a resource path -- ------------------------------ procedure Test_Get_Resource (T : in out Test) is Ctx : Servlet_Registry; Conf : Applications.Config; S1 : aliased Test_Servlet1; Dir : constant String := "regtests/files"; Path : constant String := Util.Tests.Get_Path (Dir); begin Conf.Load_Properties ("regtests/view.properties"); Conf.Set ("view.dir", Path); Ctx.Set_Init_Parameters (Conf); Ctx.Add_Servlet ("Faces", S1'Unchecked_Access); -- Resource exist, check the returned path. declare P : constant String := Ctx.Get_Resource ("/tests/form-text.xhtml"); begin Assert_Matches (T, ".*/regtests/files/tests/form-text.xhtml", P, "Invalid resource path"); end; -- Resource does not exist declare P : constant String := Ctx.Get_Resource ("/tests/form-text-missing.xhtml"); begin Assert_Equals (T, "", P, "Invalid resource path for missing resource"); end; end Test_Get_Resource; -- ------------------------------ -- Check that the mapping for the given URI matches the server. -- ------------------------------ procedure Check_Mapping (T : in out Test; Ctx : in Servlet_Registry; URI : in String; Server : in Servlet_Access) is Map : constant Mapping_Access := Ctx.Find_Mapping (URI); begin if Map = null then T.Assert (Server = null, "No mapping returned for URI: " & URI); else T.Assert (Server /= null, "A mapping is returned for URI: " & URI); T.Assert (Map.Servlet = Server, "Invalid mapping returned for URI: " & URI); end if; end Check_Mapping; -- ------------------------------ -- Test session creation. -- ------------------------------ procedure Test_Create_Servlet (T : in out Test) is Ctx : Servlet_Registry; Map : Mapping_Access; begin Ctx.Add_Servlet (Name => "Faces", Server => S1'Access); Ctx.Add_Servlet (Name => "Text", Server => S2'Access); Ctx.Add_Mapping (Pattern => "*.jsf", Name => "Faces"); Ctx.Add_Mapping (Pattern => "*.html", Name => "Faces"); Ctx.Add_Mapping (Pattern => "*.txt", Name => "Text"); -- Ctx.Add_Mapping (Pattern => "/server", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/server/john/*", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/server/info", Server => S1'Access); Ctx.Add_Mapping (Pattern => "/server/list", Server => S1'Access); Ctx.Add_Mapping (Pattern => "/server/list2", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/1/2/3/4/5/6/7/8/9/server/list2", Server => S2'Access); Ctx.Add_Mapping (Pattern => "/1/2/3/4/5/6/7/8/A/server/list2", Server => S1'Access); Ctx.Mappings.Dump_Map (" "); T.Check_Mapping (Ctx, "/joe/black/joe.jsf", S1'Access); T.Check_Mapping (Ctx, "/joe/black/joe.txt", S2'Access); T.Check_Mapping (Ctx, "/server/info", S1'Access); T.Check_Mapping (Ctx, "/server/list2", S2'Access); T.Check_Mapping (Ctx, "/1/2/3/4/5/6/7/8/9/server/list2", S2'Access); T.Check_Mapping (Ctx, "/1/2/3/4/5/6/7/8/A/server/list2", S1'Access); declare St : Util.Measures.Stamp; begin for I in 1 .. 1000 loop Map := Ctx.Find_Mapping (URI => "/joe/black/joe.jsf"); end loop; Util.Measures.Report (St, "Find 1000 mapping (extension)"); end; T.Assert (Map /= null, "No mapping for 'joe.jsf'"); T.Assert (Map.Servlet /= null, "No servlet for mapping for 'joe.jsf'"); T.Assert (Map.Servlet = S1'Access, "Invalid servlet"); -- Util.Measures.Report (St, "10 Session create"); declare St : Util.Measures.Stamp; begin for I in 1 .. 1000 loop Map := Ctx.Find_Mapping (URI => "/1/2/3/4/5/6/7/8/9/server/list2"); end loop; Util.Measures.Report (St, "Find 1000 mapping (path)"); end; T.Assert (Map /= null, "No mapping for '/server/john/joe.jsf'"); T.Assert (Map.Servlet /= null, "No servlet for mapping for 'joe.jsf'"); T.Assert (Map.Servlet = S2'Access, "Invalid servlet"); -- Util.Measures.Report (St, "10 Session create"); end Test_Create_Servlet; package Caller is new Util.Test_Caller (Test, "Servlets"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin -- To document what is tested, register the test methods for each -- operation that is tested. Caller.Add_Test (Suite, "Test ASF.Servlets.Add_Mapping,Find_Mapping", Test_Create_Servlet'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Add_Servlet", Test_Add_Servlet'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Get_Request_Dispatcher", Test_Request_Dispatcher'Access); Caller.Add_Test (Suite, "Test ASF.Servlets.Get_Resource", Test_Get_Resource'Access); Caller.Add_Test (Suite, "Test ASF.Requests.Get_Servlet_Path", Test_Servlet_Path'Access); end Add_Tests; end ASF.Servlets.Tests;
[ { "context": "files into properties\n-- Copyright (C) 2013, 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 176, "score": 0.9998862147331238, "start": 161, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "ight (C) 2013, 2018 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 207, "score": 0.9998921155929565, "start": 192, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "8 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 234, "score": 0.999925434589386, "start": 209, "tag": "EMAIL", "value": "[email protected]" } ]
src/sys/serialize/util-properties-json.ads
RREE/ada-util
60
----------------------------------------------------------------------- -- util-properties-json -- read json files into properties -- Copyright (C) 2013, 2018 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. ----------------------------------------------------------------------- -- == Reading JSON property files == -- The `Util.Properties.JSON` package provides operations to read a JSON -- content and put the result in a property manager. The JSON content is flattened -- into a set of name/value pairs. The JSON structure is reflected in the name. -- Example: -- -- { "id": "1", id -> 1 -- "info": { "name": "search", info.name -> search -- "count", "12", info.count -> 12 -- "data": { "value": "empty" }}, info.data.value -> empty -- "count": 1 info.count -> 1 -- } -- -- To get the value of a JSON property, the user can use the flatten name. For example: -- -- Value : constant String := Props.Get ("info.data.value"); -- -- The default separator to construct a flatten name is the dot (`.`) but this can be -- changed easily when loading the JSON file by specifying the desired separator: -- -- Util.Properties.JSON.Read_JSON (Props, "config.json", "|"); -- -- Then, the property will be fetch by using: -- -- Value : constant String := Props.Get ("info|data|value"); -- package Util.Properties.JSON is -- Parse the JSON content and put the flattened content in the property manager. procedure Parse_JSON (Manager : in out Util.Properties.Manager'Class; Content : in String; Flatten_Separator : in String := "."); -- Read the JSON file into the property manager. -- The JSON content is flatten into Flatten the JSON content and add the properties. procedure Read_JSON (Manager : in out Util.Properties.Manager'Class; Path : in String; Flatten_Separator : in String := "."); end Util.Properties.JSON;
23398
----------------------------------------------------------------------- -- util-properties-json -- read json files into properties -- Copyright (C) 2013, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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. ----------------------------------------------------------------------- -- == Reading JSON property files == -- The `Util.Properties.JSON` package provides operations to read a JSON -- content and put the result in a property manager. The JSON content is flattened -- into a set of name/value pairs. The JSON structure is reflected in the name. -- Example: -- -- { "id": "1", id -> 1 -- "info": { "name": "search", info.name -> search -- "count", "12", info.count -> 12 -- "data": { "value": "empty" }}, info.data.value -> empty -- "count": 1 info.count -> 1 -- } -- -- To get the value of a JSON property, the user can use the flatten name. For example: -- -- Value : constant String := Props.Get ("info.data.value"); -- -- The default separator to construct a flatten name is the dot (`.`) but this can be -- changed easily when loading the JSON file by specifying the desired separator: -- -- Util.Properties.JSON.Read_JSON (Props, "config.json", "|"); -- -- Then, the property will be fetch by using: -- -- Value : constant String := Props.Get ("info|data|value"); -- package Util.Properties.JSON is -- Parse the JSON content and put the flattened content in the property manager. procedure Parse_JSON (Manager : in out Util.Properties.Manager'Class; Content : in String; Flatten_Separator : in String := "."); -- Read the JSON file into the property manager. -- The JSON content is flatten into Flatten the JSON content and add the properties. procedure Read_JSON (Manager : in out Util.Properties.Manager'Class; Path : in String; Flatten_Separator : in String := "."); end Util.Properties.JSON;
true
----------------------------------------------------------------------- -- util-properties-json -- read json files into properties -- Copyright (C) 2013, 2018 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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. ----------------------------------------------------------------------- -- == Reading JSON property files == -- The `Util.Properties.JSON` package provides operations to read a JSON -- content and put the result in a property manager. The JSON content is flattened -- into a set of name/value pairs. The JSON structure is reflected in the name. -- Example: -- -- { "id": "1", id -> 1 -- "info": { "name": "search", info.name -> search -- "count", "12", info.count -> 12 -- "data": { "value": "empty" }}, info.data.value -> empty -- "count": 1 info.count -> 1 -- } -- -- To get the value of a JSON property, the user can use the flatten name. For example: -- -- Value : constant String := Props.Get ("info.data.value"); -- -- The default separator to construct a flatten name is the dot (`.`) but this can be -- changed easily when loading the JSON file by specifying the desired separator: -- -- Util.Properties.JSON.Read_JSON (Props, "config.json", "|"); -- -- Then, the property will be fetch by using: -- -- Value : constant String := Props.Get ("info|data|value"); -- package Util.Properties.JSON is -- Parse the JSON content and put the flattened content in the property manager. procedure Parse_JSON (Manager : in out Util.Properties.Manager'Class; Content : in String; Flatten_Separator : in String := "."); -- Read the JSON file into the property manager. -- The JSON content is flatten into Flatten the JSON content and add the properties. procedure Read_JSON (Manager : in out Util.Properties.Manager'Class; Path : in String; Flatten_Separator : in String := "."); end Util.Properties.JSON;
[ { "context": "-- Copyright (c) 2006-2020 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 40, "score": 0.9998552203178406, "start": 28, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2006-2020 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 60, "score": 0.9999312162399292, "start": 42, "tag": "EMAIL", "value": "[email protected]" } ]
source/jws-integers.adb
reznikmm/jwt
8
-- Copyright (c) 2006-2020 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body JWS.Integers is type Double is mod 2 ** (2 * Digit_Size); subtype Double_Digit is Double range 0 .. 2 ** Digit_Size - 1; procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; --------- -- Add -- --------- procedure Add (A : in out Number; B : Number) is Result : Number renames A; Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) + Carry; Result (J) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; end Add; --------- -- Add -- --------- procedure Add (A, B : Number; Result : out Number; C : Digit) is Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) * Mult + Carry; Result (J + 1) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; Result (1) := Digit (Carry); end Add; ---------------- -- BER_Decode -- ---------------- procedure BER_Decode (Raw : Ada.Streams.Stream_Element_Array; Value : out Number) is use type Ada.Streams.Stream_Element_Offset; function N (X : Ada.Streams.Stream_Element_Offset) return Digit; ------- -- N -- ------- function N (X : Ada.Streams.Stream_Element_Offset) return Digit is begin if X in Raw'Range then return Digit (Raw (X)); else return 0; end if; end N; X : Ada.Streams.Stream_Element_Offset := Raw'Last; begin for J in reverse Value'Range loop Value (J) := 256 * (256 * (256 * N (X - 3) + N (X - 2)) + N (X - 1)) + N (X); X := X - 4; end loop; end BER_Decode; ---------------- -- BER_Encode -- ---------------- procedure BER_Encode (Value : Number; Raw : out Ada.Streams.Stream_Element_Array) is X : Ada.Streams.Stream_Element_Offset := Raw'Last; V : Digit; begin for J in reverse Value'Range loop V := Value (J); for K in 1 .. 4 loop Raw (X) := Ada.Streams.Stream_Element'Mod (V); V := V / 256; X := Ada.Streams.Stream_Element_Offset'Pred (X); end loop; end loop; end BER_Encode; ---------------- -- BER_Length -- ---------------- function BER_Length (Raw : Ada.Streams.Stream_Element_Array) return Positive is use type Ada.Streams.Stream_Element; Result : constant Natural := Raw'Length / 4; begin if Result = 0 then return 1; elsif Raw'Length = (Result - 1) * 4 + 1 and then Raw (Raw'First) = 0 then -- Last extra byte contains zero return Result - 1; else return Result; end if; end BER_Length; ------------ -- Devide -- ------------ procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) is function Get_Digit (Left, Right : Number) return Digit with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; function Get_Digit (Left, Right : Number) return Digit is QHAT : Double_Digit; RHAT : Double_Digit; Temp : Double; begin if Left (1) = Right (1) then Temp := Double_Digit (Left (2)) + Double_Digit (Right (1)); if Temp >= Digit'Modulus then return Digit'Last; end if; RHAT := Temp; QHAT := Digit'Modulus - 1; elsif Left (1) < Right (1) then declare L12 : constant Double := Digit'Modulus * Double_Digit (Left (1)) + Double_Digit (Left (2)); begin QHAT := L12 / Double_Digit (Right (1)); -- < Digit'Modulus RHAT := L12 mod Double_Digit (Right (1)); end; else raise Program_Error; end if; while QHAT * Double_Digit (Right (2)) > RHAT * Digit'Modulus + Double_Digit (Left (3)) loop QHAT := QHAT - 1; Temp := RHAT + Double_Digit (Right (1)); exit when Temp >= Digit'Modulus; RHAT := Temp; end loop; return Digit (QHAT); end Get_Digit; Ok : Boolean; begin Result := Get_Digit (Left, Right); Subtract (A => Left, B => Right, C => Result, Ok => Ok); if not Ok then Result := Result - 1; Add (A => Left, B => 0 & Right); end if; end Devide; ----------------- -- Fast_Devide -- ----------------- procedure Fast_Devide (A : Number; B : Digit; Result : out Number; Rest : out Digit) is Div : constant Double_Digit := Double_Digit (B); Carry : Double_Digit := 0; Temp : Double; begin for J in A'Range loop Temp := Carry * Digit'Modulus + Double_Digit (A (J)); Result (J) := Digit (Temp / Div); Carry := Temp mod Div; end loop; Rest := Digit (Carry); end Fast_Devide; -------------- -- Multiply -- -------------- procedure Multiply (A, B : Number; Result : out Number) is Mult : constant Number (Result'Range) := B & (A'Range => 0); Temp : Digit; begin Result (B'Range) := (B'Range => 0); for J in 1 .. A'Length loop Temp := A (A'Length - J + 1); Add (Result (1 .. B'Length + J - 1), Mult (1 .. B'Length + J - 1), Result (1 .. B'Length + J), Temp); end loop; end Multiply; -------------------------- -- Normalize_For_Devide -- -------------------------- procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) with Pre => A_Copy'Length >= A'Length + 1; procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) is begin Mult := Digit (Digit'Modulus / (Double_Digit (B (1)) + 1)); if Mult = 1 then A_Copy := (1 .. A_Copy'Length - A'Length => 0) & A; else declare Zero : constant Number (1 .. A_Copy'Length - 1) := (others => 0); begin Add (A => Zero, B => (1 .. Zero'Length - A'Length => 0) & A, Result => A_Copy, C => Mult); end; declare Temp : Number (1 .. B'Length + 1); begin Add (A => (B'Range => 0), B => B, Result => Temp, C => Mult); pragma Assert (Temp (1) = 0); B (1 .. B'Last) := Temp (2 .. Temp'Last); end; end if; end Normalize_For_Devide; procedure Power (Value : Number; Exponent : Number; Module : Number; Result : out Number) is Mult : Number (Module'Range); Mask : Digit := 1; J : Natural := Exponent'Last; begin if Value'Length < Module'Length or else (Value'Length = Module'Length and then Value <= Module) then Mult := (1 .. Module'Length - Value'Length => 0) & Value; else Remainder (Value, Module, Mult); end if; Result := (1 .. Result'Last - 1 => 0) & 1; while J > 0 loop if (Exponent (J) and Mask) /= 0 then declare Temp : Number (1 .. Result'Length + Mult'Length); begin Multiply (Result, Mult, Temp); Remainder (Temp, Module, Result); end; end if; declare Temp : Number (1 .. 2 * Mult'Length); begin Multiply (Mult, Mult, Temp); Remainder (Temp, Module, Mult); end; if Mask = 2 ** (Digit_Size - 1) then J := J - 1; Mask := 1; else Mask := Mask * 2; end if; end loop; end Power; --------------- -- Remainder -- --------------- procedure Remainder (A, B : Number; Result : out Number) is begin if A (B'Last + 1 .. A'Last) = (B'Last + 1 .. A'Last => 0) and then A (B'Range) < B then Result := A (B'Range); elsif B'Length = 1 then declare Ignore : Number (A'Range); begin Fast_Devide (A, B (1), Ignore, Result (1)); end; else declare Length : constant Positive := Positive'Max (B'Length + 2, A'Length + 1); A_Copy : Number (1 .. Length); B_Copy : Number := B; Temp : Number (1 .. 1 + B'Length); Mult : Digit; Ignore : Digit; begin Normalize_For_Devide (A, B_Copy, A_Copy, Mult); Temp (1 .. 1 + B'Length) := A_Copy (1 .. 1 + B'Length); for Index in 1 .. A_Copy'Length - B'Length loop Temp (Temp'Last) := A_Copy (Index + B'Length); Devide (Left => Temp, Right => B_Copy, Result => Ignore); pragma Assert (Temp (1) = 0); Temp (1 .. B'Length) := Temp (2 .. Temp'Last); end loop; if Mult = 1 then Result := Temp (1 .. Result'Length); else Fast_Devide (A => Temp (1 .. Result'Length), B => Mult, Result => Result, Rest => Ignore); end if; end; end if; end Remainder; -------------- -- Subtract -- -------------- procedure Subtract (A : in out Number; B : Number; C : Digit := 1; Ok : out Boolean) is Result : Number renames A; Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Digit := 0; begin for J in reverse 1 .. B'Length loop Temp := Double (A (J + 1)) - Double (B (J)) * Mult - Double_Digit (Carry); Result (J + 1) := Digit'Mod (Temp); Carry := -Digit (Temp / Digit'Modulus); end loop; Ok := A (1) >= Carry; Result (1) := A (1) - Carry; end Subtract; end JWS.Integers;
24384
-- Copyright (c) 2006-2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body JWS.Integers is type Double is mod 2 ** (2 * Digit_Size); subtype Double_Digit is Double range 0 .. 2 ** Digit_Size - 1; procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; --------- -- Add -- --------- procedure Add (A : in out Number; B : Number) is Result : Number renames A; Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) + Carry; Result (J) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; end Add; --------- -- Add -- --------- procedure Add (A, B : Number; Result : out Number; C : Digit) is Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) * Mult + Carry; Result (J + 1) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; Result (1) := Digit (Carry); end Add; ---------------- -- BER_Decode -- ---------------- procedure BER_Decode (Raw : Ada.Streams.Stream_Element_Array; Value : out Number) is use type Ada.Streams.Stream_Element_Offset; function N (X : Ada.Streams.Stream_Element_Offset) return Digit; ------- -- N -- ------- function N (X : Ada.Streams.Stream_Element_Offset) return Digit is begin if X in Raw'Range then return Digit (Raw (X)); else return 0; end if; end N; X : Ada.Streams.Stream_Element_Offset := Raw'Last; begin for J in reverse Value'Range loop Value (J) := 256 * (256 * (256 * N (X - 3) + N (X - 2)) + N (X - 1)) + N (X); X := X - 4; end loop; end BER_Decode; ---------------- -- BER_Encode -- ---------------- procedure BER_Encode (Value : Number; Raw : out Ada.Streams.Stream_Element_Array) is X : Ada.Streams.Stream_Element_Offset := Raw'Last; V : Digit; begin for J in reverse Value'Range loop V := Value (J); for K in 1 .. 4 loop Raw (X) := Ada.Streams.Stream_Element'Mod (V); V := V / 256; X := Ada.Streams.Stream_Element_Offset'Pred (X); end loop; end loop; end BER_Encode; ---------------- -- BER_Length -- ---------------- function BER_Length (Raw : Ada.Streams.Stream_Element_Array) return Positive is use type Ada.Streams.Stream_Element; Result : constant Natural := Raw'Length / 4; begin if Result = 0 then return 1; elsif Raw'Length = (Result - 1) * 4 + 1 and then Raw (Raw'First) = 0 then -- Last extra byte contains zero return Result - 1; else return Result; end if; end BER_Length; ------------ -- Devide -- ------------ procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) is function Get_Digit (Left, Right : Number) return Digit with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; function Get_Digit (Left, Right : Number) return Digit is QHAT : Double_Digit; RHAT : Double_Digit; Temp : Double; begin if Left (1) = Right (1) then Temp := Double_Digit (Left (2)) + Double_Digit (Right (1)); if Temp >= Digit'Modulus then return Digit'Last; end if; RHAT := Temp; QHAT := Digit'Modulus - 1; elsif Left (1) < Right (1) then declare L12 : constant Double := Digit'Modulus * Double_Digit (Left (1)) + Double_Digit (Left (2)); begin QHAT := L12 / Double_Digit (Right (1)); -- < Digit'Modulus RHAT := L12 mod Double_Digit (Right (1)); end; else raise Program_Error; end if; while QHAT * Double_Digit (Right (2)) > RHAT * Digit'Modulus + Double_Digit (Left (3)) loop QHAT := QHAT - 1; Temp := RHAT + Double_Digit (Right (1)); exit when Temp >= Digit'Modulus; RHAT := Temp; end loop; return Digit (QHAT); end Get_Digit; Ok : Boolean; begin Result := Get_Digit (Left, Right); Subtract (A => Left, B => Right, C => Result, Ok => Ok); if not Ok then Result := Result - 1; Add (A => Left, B => 0 & Right); end if; end Devide; ----------------- -- Fast_Devide -- ----------------- procedure Fast_Devide (A : Number; B : Digit; Result : out Number; Rest : out Digit) is Div : constant Double_Digit := Double_Digit (B); Carry : Double_Digit := 0; Temp : Double; begin for J in A'Range loop Temp := Carry * Digit'Modulus + Double_Digit (A (J)); Result (J) := Digit (Temp / Div); Carry := Temp mod Div; end loop; Rest := Digit (Carry); end Fast_Devide; -------------- -- Multiply -- -------------- procedure Multiply (A, B : Number; Result : out Number) is Mult : constant Number (Result'Range) := B & (A'Range => 0); Temp : Digit; begin Result (B'Range) := (B'Range => 0); for J in 1 .. A'Length loop Temp := A (A'Length - J + 1); Add (Result (1 .. B'Length + J - 1), Mult (1 .. B'Length + J - 1), Result (1 .. B'Length + J), Temp); end loop; end Multiply; -------------------------- -- Normalize_For_Devide -- -------------------------- procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) with Pre => A_Copy'Length >= A'Length + 1; procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) is begin Mult := Digit (Digit'Modulus / (Double_Digit (B (1)) + 1)); if Mult = 1 then A_Copy := (1 .. A_Copy'Length - A'Length => 0) & A; else declare Zero : constant Number (1 .. A_Copy'Length - 1) := (others => 0); begin Add (A => Zero, B => (1 .. Zero'Length - A'Length => 0) & A, Result => A_Copy, C => Mult); end; declare Temp : Number (1 .. B'Length + 1); begin Add (A => (B'Range => 0), B => B, Result => Temp, C => Mult); pragma Assert (Temp (1) = 0); B (1 .. B'Last) := Temp (2 .. Temp'Last); end; end if; end Normalize_For_Devide; procedure Power (Value : Number; Exponent : Number; Module : Number; Result : out Number) is Mult : Number (Module'Range); Mask : Digit := 1; J : Natural := Exponent'Last; begin if Value'Length < Module'Length or else (Value'Length = Module'Length and then Value <= Module) then Mult := (1 .. Module'Length - Value'Length => 0) & Value; else Remainder (Value, Module, Mult); end if; Result := (1 .. Result'Last - 1 => 0) & 1; while J > 0 loop if (Exponent (J) and Mask) /= 0 then declare Temp : Number (1 .. Result'Length + Mult'Length); begin Multiply (Result, Mult, Temp); Remainder (Temp, Module, Result); end; end if; declare Temp : Number (1 .. 2 * Mult'Length); begin Multiply (Mult, Mult, Temp); Remainder (Temp, Module, Mult); end; if Mask = 2 ** (Digit_Size - 1) then J := J - 1; Mask := 1; else Mask := Mask * 2; end if; end loop; end Power; --------------- -- Remainder -- --------------- procedure Remainder (A, B : Number; Result : out Number) is begin if A (B'Last + 1 .. A'Last) = (B'Last + 1 .. A'Last => 0) and then A (B'Range) < B then Result := A (B'Range); elsif B'Length = 1 then declare Ignore : Number (A'Range); begin Fast_Devide (A, B (1), Ignore, Result (1)); end; else declare Length : constant Positive := Positive'Max (B'Length + 2, A'Length + 1); A_Copy : Number (1 .. Length); B_Copy : Number := B; Temp : Number (1 .. 1 + B'Length); Mult : Digit; Ignore : Digit; begin Normalize_For_Devide (A, B_Copy, A_Copy, Mult); Temp (1 .. 1 + B'Length) := A_Copy (1 .. 1 + B'Length); for Index in 1 .. A_Copy'Length - B'Length loop Temp (Temp'Last) := A_Copy (Index + B'Length); Devide (Left => Temp, Right => B_Copy, Result => Ignore); pragma Assert (Temp (1) = 0); Temp (1 .. B'Length) := Temp (2 .. Temp'Last); end loop; if Mult = 1 then Result := Temp (1 .. Result'Length); else Fast_Devide (A => Temp (1 .. Result'Length), B => Mult, Result => Result, Rest => Ignore); end if; end; end if; end Remainder; -------------- -- Subtract -- -------------- procedure Subtract (A : in out Number; B : Number; C : Digit := 1; Ok : out Boolean) is Result : Number renames A; Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Digit := 0; begin for J in reverse 1 .. B'Length loop Temp := Double (A (J + 1)) - Double (B (J)) * Mult - Double_Digit (Carry); Result (J + 1) := Digit'Mod (Temp); Carry := -Digit (Temp / Digit'Modulus); end loop; Ok := A (1) >= Carry; Result (1) := A (1) - Carry; end Subtract; end JWS.Integers;
true
-- Copyright (c) 2006-2020 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body JWS.Integers is type Double is mod 2 ** (2 * Digit_Size); subtype Double_Digit is Double range 0 .. 2 ** Digit_Size - 1; procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; --------- -- Add -- --------- procedure Add (A : in out Number; B : Number) is Result : Number renames A; Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) + Carry; Result (J) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; end Add; --------- -- Add -- --------- procedure Add (A, B : Number; Result : out Number; C : Digit) is Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Double_Digit := 0; begin for J in reverse 1 .. A'Length loop Temp := Double (A (J)) + Double (B (J)) * Mult + Carry; Result (J + 1) := Digit'Mod (Temp); Carry := Temp / Digit'Modulus; end loop; Result (1) := Digit (Carry); end Add; ---------------- -- BER_Decode -- ---------------- procedure BER_Decode (Raw : Ada.Streams.Stream_Element_Array; Value : out Number) is use type Ada.Streams.Stream_Element_Offset; function N (X : Ada.Streams.Stream_Element_Offset) return Digit; ------- -- N -- ------- function N (X : Ada.Streams.Stream_Element_Offset) return Digit is begin if X in Raw'Range then return Digit (Raw (X)); else return 0; end if; end N; X : Ada.Streams.Stream_Element_Offset := Raw'Last; begin for J in reverse Value'Range loop Value (J) := 256 * (256 * (256 * N (X - 3) + N (X - 2)) + N (X - 1)) + N (X); X := X - 4; end loop; end BER_Decode; ---------------- -- BER_Encode -- ---------------- procedure BER_Encode (Value : Number; Raw : out Ada.Streams.Stream_Element_Array) is X : Ada.Streams.Stream_Element_Offset := Raw'Last; V : Digit; begin for J in reverse Value'Range loop V := Value (J); for K in 1 .. 4 loop Raw (X) := Ada.Streams.Stream_Element'Mod (V); V := V / 256; X := Ada.Streams.Stream_Element_Offset'Pred (X); end loop; end loop; end BER_Encode; ---------------- -- BER_Length -- ---------------- function BER_Length (Raw : Ada.Streams.Stream_Element_Array) return Positive is use type Ada.Streams.Stream_Element; Result : constant Natural := Raw'Length / 4; begin if Result = 0 then return 1; elsif Raw'Length = (Result - 1) * 4 + 1 and then Raw (Raw'First) = 0 then -- Last extra byte contains zero return Result - 1; else return Result; end if; end BER_Length; ------------ -- Devide -- ------------ procedure Devide (Left : in out Number; Right : in Number; Result : out Digit) is function Get_Digit (Left, Right : Number) return Digit with Pre => Left'Length = Right'Length + 1 and Right'Length >= 2 and Left (Right'Range) < Right; function Get_Digit (Left, Right : Number) return Digit is QHAT : Double_Digit; RHAT : Double_Digit; Temp : Double; begin if Left (1) = Right (1) then Temp := Double_Digit (Left (2)) + Double_Digit (Right (1)); if Temp >= Digit'Modulus then return Digit'Last; end if; RHAT := Temp; QHAT := Digit'Modulus - 1; elsif Left (1) < Right (1) then declare L12 : constant Double := Digit'Modulus * Double_Digit (Left (1)) + Double_Digit (Left (2)); begin QHAT := L12 / Double_Digit (Right (1)); -- < Digit'Modulus RHAT := L12 mod Double_Digit (Right (1)); end; else raise Program_Error; end if; while QHAT * Double_Digit (Right (2)) > RHAT * Digit'Modulus + Double_Digit (Left (3)) loop QHAT := QHAT - 1; Temp := RHAT + Double_Digit (Right (1)); exit when Temp >= Digit'Modulus; RHAT := Temp; end loop; return Digit (QHAT); end Get_Digit; Ok : Boolean; begin Result := Get_Digit (Left, Right); Subtract (A => Left, B => Right, C => Result, Ok => Ok); if not Ok then Result := Result - 1; Add (A => Left, B => 0 & Right); end if; end Devide; ----------------- -- Fast_Devide -- ----------------- procedure Fast_Devide (A : Number; B : Digit; Result : out Number; Rest : out Digit) is Div : constant Double_Digit := Double_Digit (B); Carry : Double_Digit := 0; Temp : Double; begin for J in A'Range loop Temp := Carry * Digit'Modulus + Double_Digit (A (J)); Result (J) := Digit (Temp / Div); Carry := Temp mod Div; end loop; Rest := Digit (Carry); end Fast_Devide; -------------- -- Multiply -- -------------- procedure Multiply (A, B : Number; Result : out Number) is Mult : constant Number (Result'Range) := B & (A'Range => 0); Temp : Digit; begin Result (B'Range) := (B'Range => 0); for J in 1 .. A'Length loop Temp := A (A'Length - J + 1); Add (Result (1 .. B'Length + J - 1), Mult (1 .. B'Length + J - 1), Result (1 .. B'Length + J), Temp); end loop; end Multiply; -------------------------- -- Normalize_For_Devide -- -------------------------- procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) with Pre => A_Copy'Length >= A'Length + 1; procedure Normalize_For_Devide (A : Number; B : in out Number; A_Copy : in out Number; Mult : out Digit) is begin Mult := Digit (Digit'Modulus / (Double_Digit (B (1)) + 1)); if Mult = 1 then A_Copy := (1 .. A_Copy'Length - A'Length => 0) & A; else declare Zero : constant Number (1 .. A_Copy'Length - 1) := (others => 0); begin Add (A => Zero, B => (1 .. Zero'Length - A'Length => 0) & A, Result => A_Copy, C => Mult); end; declare Temp : Number (1 .. B'Length + 1); begin Add (A => (B'Range => 0), B => B, Result => Temp, C => Mult); pragma Assert (Temp (1) = 0); B (1 .. B'Last) := Temp (2 .. Temp'Last); end; end if; end Normalize_For_Devide; procedure Power (Value : Number; Exponent : Number; Module : Number; Result : out Number) is Mult : Number (Module'Range); Mask : Digit := 1; J : Natural := Exponent'Last; begin if Value'Length < Module'Length or else (Value'Length = Module'Length and then Value <= Module) then Mult := (1 .. Module'Length - Value'Length => 0) & Value; else Remainder (Value, Module, Mult); end if; Result := (1 .. Result'Last - 1 => 0) & 1; while J > 0 loop if (Exponent (J) and Mask) /= 0 then declare Temp : Number (1 .. Result'Length + Mult'Length); begin Multiply (Result, Mult, Temp); Remainder (Temp, Module, Result); end; end if; declare Temp : Number (1 .. 2 * Mult'Length); begin Multiply (Mult, Mult, Temp); Remainder (Temp, Module, Mult); end; if Mask = 2 ** (Digit_Size - 1) then J := J - 1; Mask := 1; else Mask := Mask * 2; end if; end loop; end Power; --------------- -- Remainder -- --------------- procedure Remainder (A, B : Number; Result : out Number) is begin if A (B'Last + 1 .. A'Last) = (B'Last + 1 .. A'Last => 0) and then A (B'Range) < B then Result := A (B'Range); elsif B'Length = 1 then declare Ignore : Number (A'Range); begin Fast_Devide (A, B (1), Ignore, Result (1)); end; else declare Length : constant Positive := Positive'Max (B'Length + 2, A'Length + 1); A_Copy : Number (1 .. Length); B_Copy : Number := B; Temp : Number (1 .. 1 + B'Length); Mult : Digit; Ignore : Digit; begin Normalize_For_Devide (A, B_Copy, A_Copy, Mult); Temp (1 .. 1 + B'Length) := A_Copy (1 .. 1 + B'Length); for Index in 1 .. A_Copy'Length - B'Length loop Temp (Temp'Last) := A_Copy (Index + B'Length); Devide (Left => Temp, Right => B_Copy, Result => Ignore); pragma Assert (Temp (1) = 0); Temp (1 .. B'Length) := Temp (2 .. Temp'Last); end loop; if Mult = 1 then Result := Temp (1 .. Result'Length); else Fast_Devide (A => Temp (1 .. Result'Length), B => Mult, Result => Result, Rest => Ignore); end if; end; end if; end Remainder; -------------- -- Subtract -- -------------- procedure Subtract (A : in out Number; B : Number; C : Digit := 1; Ok : out Boolean) is Result : Number renames A; Mult : constant Double_Digit := Double_Digit (C); Temp : Double; Carry : Digit := 0; begin for J in reverse 1 .. B'Length loop Temp := Double (A (J + 1)) - Double (B (J)) * Mult - Double_Digit (Carry); Result (J + 1) := Digit'Mod (Temp); Carry := -Digit (Temp / Digit'Modulus); end loop; Ok := A (1) >= Carry; Result (1) := A (1) - Carry; end Subtract; end JWS.Integers;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998527765274048, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999295473098755, "start": 37, "tag": "EMAIL", "value": "[email protected]" } ]
source/slim-players-displays.adb
reznikmm/slimp
0
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Slim.Messages.grfe; package body Slim.Players.Displays is ----------- -- Clear -- ----------- procedure Clear (Self : in out Display) is begin Self.Buffer := (1 .. Self.Size => 0); end Clear; --------------- -- Draw_Text -- --------------- procedure Draw_Text (Self : in out Display; X, Y : Positive; Font : Slim.Fonts.Font; Text : League.Strings.Universal_String) is procedure Draw_Pixel (X, Y : Positive); procedure Draw_Pixel (X, Y : Positive) is begin Draw_Pixel (Self, X, Y); end Draw_Pixel; procedure Draw_Text is new Slim.Fonts.Draw_Text (Coordinate => Integer, Draw_Pixel => Draw_Pixel); Line : League.Strings.Universal_String := Text; begin while Fonts.Size (Font, Line).Right + X - 1 > 160 loop Line := Line.Head_To (Line.Length - 1); end loop; Draw_Text (Font, Line, X - 1, Y - 1); end Draw_Text; ---------------- -- Draw_Pixel -- ---------------- procedure Draw_Pixel (Self : in out Display; X, Y : Positive; Set : Boolean := True) is use type Ada.Streams.Stream_Element; Index : constant Ada.Streams.Stream_Element_Offset := Ada.Streams.Stream_Element_Offset ((X - 1) * 4 + (32 - Y) / 8 + 1); Mask : constant Ada.Streams.Stream_Element := 2 ** ((Y - 1) mod 8); begin if Set then Self.Buffer (Index) := Self.Buffer (Index) or Mask; else Self.Buffer (Index) := Self.Buffer (Index) and not Mask; end if; end Draw_Pixel; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Display; Player : Players.Player) is begin Self.Socket := Player.Socket; end Initialize; ------------------ -- Send_Message -- ------------------ procedure Send_Message (Self : Display; Transition : Transition_Kind := None; Offset : Natural := 0) is Grfe : Slim.Messages.grfe.Grfe_Message; begin Grfe.Initialize (Self.Buffer, Transition, Offset); Write_Message (Self.Socket, Grfe); end Send_Message; end Slim.Players.Displays;
4033
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Slim.Messages.grfe; package body Slim.Players.Displays is ----------- -- Clear -- ----------- procedure Clear (Self : in out Display) is begin Self.Buffer := (1 .. Self.Size => 0); end Clear; --------------- -- Draw_Text -- --------------- procedure Draw_Text (Self : in out Display; X, Y : Positive; Font : Slim.Fonts.Font; Text : League.Strings.Universal_String) is procedure Draw_Pixel (X, Y : Positive); procedure Draw_Pixel (X, Y : Positive) is begin Draw_Pixel (Self, X, Y); end Draw_Pixel; procedure Draw_Text is new Slim.Fonts.Draw_Text (Coordinate => Integer, Draw_Pixel => Draw_Pixel); Line : League.Strings.Universal_String := Text; begin while Fonts.Size (Font, Line).Right + X - 1 > 160 loop Line := Line.Head_To (Line.Length - 1); end loop; Draw_Text (Font, Line, X - 1, Y - 1); end Draw_Text; ---------------- -- Draw_Pixel -- ---------------- procedure Draw_Pixel (Self : in out Display; X, Y : Positive; Set : Boolean := True) is use type Ada.Streams.Stream_Element; Index : constant Ada.Streams.Stream_Element_Offset := Ada.Streams.Stream_Element_Offset ((X - 1) * 4 + (32 - Y) / 8 + 1); Mask : constant Ada.Streams.Stream_Element := 2 ** ((Y - 1) mod 8); begin if Set then Self.Buffer (Index) := Self.Buffer (Index) or Mask; else Self.Buffer (Index) := Self.Buffer (Index) and not Mask; end if; end Draw_Pixel; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Display; Player : Players.Player) is begin Self.Socket := Player.Socket; end Initialize; ------------------ -- Send_Message -- ------------------ procedure Send_Message (Self : Display; Transition : Transition_Kind := None; Offset : Natural := 0) is Grfe : Slim.Messages.grfe.Grfe_Message; begin Grfe.Initialize (Self.Buffer, Transition, Offset); Write_Message (Self.Socket, Grfe); end Send_Message; end Slim.Players.Displays;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Slim.Messages.grfe; package body Slim.Players.Displays is ----------- -- Clear -- ----------- procedure Clear (Self : in out Display) is begin Self.Buffer := (1 .. Self.Size => 0); end Clear; --------------- -- Draw_Text -- --------------- procedure Draw_Text (Self : in out Display; X, Y : Positive; Font : Slim.Fonts.Font; Text : League.Strings.Universal_String) is procedure Draw_Pixel (X, Y : Positive); procedure Draw_Pixel (X, Y : Positive) is begin Draw_Pixel (Self, X, Y); end Draw_Pixel; procedure Draw_Text is new Slim.Fonts.Draw_Text (Coordinate => Integer, Draw_Pixel => Draw_Pixel); Line : League.Strings.Universal_String := Text; begin while Fonts.Size (Font, Line).Right + X - 1 > 160 loop Line := Line.Head_To (Line.Length - 1); end loop; Draw_Text (Font, Line, X - 1, Y - 1); end Draw_Text; ---------------- -- Draw_Pixel -- ---------------- procedure Draw_Pixel (Self : in out Display; X, Y : Positive; Set : Boolean := True) is use type Ada.Streams.Stream_Element; Index : constant Ada.Streams.Stream_Element_Offset := Ada.Streams.Stream_Element_Offset ((X - 1) * 4 + (32 - Y) / 8 + 1); Mask : constant Ada.Streams.Stream_Element := 2 ** ((Y - 1) mod 8); begin if Set then Self.Buffer (Index) := Self.Buffer (Index) or Mask; else Self.Buffer (Index) := Self.Buffer (Index) and not Mask; end if; end Draw_Pixel; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Display; Player : Players.Player) is begin Self.Socket := Player.Socket; end Initialize; ------------------ -- Send_Message -- ------------------ procedure Send_Message (Self : Display; Transition : Transition_Kind := None; Offset : Natural := 0) is Grfe : Slim.Messages.grfe.Grfe_Message; begin Grfe.Initialize (Self.Buffer, Transition, Offset); Write_Message (Self.Socket, Grfe); end Send_Message; end Slim.Players.Displays;
[ { "context": "utilities\n-- Copyright (C) 2011, 2013, 2018, 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 161, "score": 0.9998762011528015, "start": 146, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "1, 2013, 2018, 2019 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 192, "score": 0.9998793601989746, "start": 177, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 219, "score": 0.9999291300773621, "start": 194, "tag": "EMAIL", "value": "[email protected]" } ]
src/base/dates/util-dates.ads
RREE/ada-util
60
----------------------------------------------------------------------- -- util-dates -- Date utilities -- Copyright (C) 2011, 2013, 2018, 2019 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.Calendar; with Ada.Calendar.Formatting; with Ada.Calendar.Arithmetic; with Ada.Calendar.Time_Zones; -- = Date Utilities = -- The `Util.Dates` package provides various date utilities to help in formatting and parsing -- dates in various standard formats. It completes the standard `Ada.Calendar.Formatting` and -- other packages by implementing specific formatting and parsing. To use the packages -- described here, use the following GNAT project: -- -- with "utilada_base"; -- -- == Date Operations == -- Several operations allow to compute from a given date: -- -- * `Get_Day_Start`: The start of the day (0:00), -- * `Get_Day_End`: The end of the day (23:59:59), -- * `Get_Week_Start`: The start of the week, -- * `Get_Week_End`: The end of the week, -- * `Get_Month_Start`: The start of the month, -- * `Get_Month_End`: The end of the month -- -- The `Date_Record` type represents a date in a split format allowing -- to access easily the day, month, hour and other information. -- -- Now : Ada.Calendar.Time := Ada.Calendar.Clock; -- Week_Start : Ada.Calendar.Time := Get_Week_Start (Now); -- Week_End : Ada.Calendar.Time := Get_Week_End (Now); -- -- @include util-dates-rfc7231.ads -- @include util-dates-iso8601.ads -- @include util-dates-formats.ads package Util.Dates is -- The Unix equivalent of 'struct tm'. type Date_Record is record Date : Ada.Calendar.Time; Year : Ada.Calendar.Year_Number := 1901; Month : Ada.Calendar.Month_Number := 1; Month_Day : Ada.Calendar.Day_Number := 1; Day : Ada.Calendar.Formatting.Day_Name := Ada.Calendar.Formatting.Tuesday; Hour : Ada.Calendar.Formatting.Hour_Number := 0; Minute : Ada.Calendar.Formatting.Minute_Number := 0; Second : Ada.Calendar.Formatting.Second_Number := 0; Sub_Second : Ada.Calendar.Formatting.Second_Duration := 0.0; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset := 0; Leap_Second : Boolean := False; end record; -- Split the date into a date record (See Ada.Calendar.Formatting.Split). procedure Split (Into : out Date_Record; Date : in Ada.Calendar.Time; Time_Zone : in Ada.Calendar.Time_Zones.Time_Offset := 0); -- Return the date from the date record (See Ada.Calendar.Formatting.Time_Of). function Time_Of (Date : in Date_Record) return Ada.Calendar.Time; -- Returns true if the given year is a leap year. function Is_Leap_Year (Year : in Ada.Calendar.Year_Number) return Boolean; -- Returns true if both dates are on the same day. function Is_Same_Day (Date1, Date2 : in Ada.Calendar.Time) return Boolean; function Is_Same_Day (Date1, Date2 : in Date_Record) return Boolean; -- Get the number of days in the given year. function Get_Day_Count (Year : in Ada.Calendar.Year_Number) return Ada.Calendar.Arithmetic.Day_Count; -- Get the number of days in the given month. function Get_Day_Count (Year : in Ada.Calendar.Year_Number; Month : in Ada.Calendar.Month_Number) return Ada.Calendar.Arithmetic.Day_Count; -- Get a time representing the given date at 00:00:00. function Get_Day_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Day_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the given date at 23:59:59. function Get_Day_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Day_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the beginning of the week at 00:00:00. function Get_Week_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Week_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the end of the week at 23:59:99. function Get_Week_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Week_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the beginning of the month at 00:00:00. function Get_Month_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Month_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the end of the month at 23:59:59. function Get_Month_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Month_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; end Util.Dates;
3431
----------------------------------------------------------------------- -- util-dates -- Date utilities -- Copyright (C) 2011, 2013, 2018, 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Ada.Calendar.Formatting; with Ada.Calendar.Arithmetic; with Ada.Calendar.Time_Zones; -- = Date Utilities = -- The `Util.Dates` package provides various date utilities to help in formatting and parsing -- dates in various standard formats. It completes the standard `Ada.Calendar.Formatting` and -- other packages by implementing specific formatting and parsing. To use the packages -- described here, use the following GNAT project: -- -- with "utilada_base"; -- -- == Date Operations == -- Several operations allow to compute from a given date: -- -- * `Get_Day_Start`: The start of the day (0:00), -- * `Get_Day_End`: The end of the day (23:59:59), -- * `Get_Week_Start`: The start of the week, -- * `Get_Week_End`: The end of the week, -- * `Get_Month_Start`: The start of the month, -- * `Get_Month_End`: The end of the month -- -- The `Date_Record` type represents a date in a split format allowing -- to access easily the day, month, hour and other information. -- -- Now : Ada.Calendar.Time := Ada.Calendar.Clock; -- Week_Start : Ada.Calendar.Time := Get_Week_Start (Now); -- Week_End : Ada.Calendar.Time := Get_Week_End (Now); -- -- @include util-dates-rfc7231.ads -- @include util-dates-iso8601.ads -- @include util-dates-formats.ads package Util.Dates is -- The Unix equivalent of 'struct tm'. type Date_Record is record Date : Ada.Calendar.Time; Year : Ada.Calendar.Year_Number := 1901; Month : Ada.Calendar.Month_Number := 1; Month_Day : Ada.Calendar.Day_Number := 1; Day : Ada.Calendar.Formatting.Day_Name := Ada.Calendar.Formatting.Tuesday; Hour : Ada.Calendar.Formatting.Hour_Number := 0; Minute : Ada.Calendar.Formatting.Minute_Number := 0; Second : Ada.Calendar.Formatting.Second_Number := 0; Sub_Second : Ada.Calendar.Formatting.Second_Duration := 0.0; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset := 0; Leap_Second : Boolean := False; end record; -- Split the date into a date record (See Ada.Calendar.Formatting.Split). procedure Split (Into : out Date_Record; Date : in Ada.Calendar.Time; Time_Zone : in Ada.Calendar.Time_Zones.Time_Offset := 0); -- Return the date from the date record (See Ada.Calendar.Formatting.Time_Of). function Time_Of (Date : in Date_Record) return Ada.Calendar.Time; -- Returns true if the given year is a leap year. function Is_Leap_Year (Year : in Ada.Calendar.Year_Number) return Boolean; -- Returns true if both dates are on the same day. function Is_Same_Day (Date1, Date2 : in Ada.Calendar.Time) return Boolean; function Is_Same_Day (Date1, Date2 : in Date_Record) return Boolean; -- Get the number of days in the given year. function Get_Day_Count (Year : in Ada.Calendar.Year_Number) return Ada.Calendar.Arithmetic.Day_Count; -- Get the number of days in the given month. function Get_Day_Count (Year : in Ada.Calendar.Year_Number; Month : in Ada.Calendar.Month_Number) return Ada.Calendar.Arithmetic.Day_Count; -- Get a time representing the given date at 00:00:00. function Get_Day_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Day_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the given date at 23:59:59. function Get_Day_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Day_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the beginning of the week at 00:00:00. function Get_Week_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Week_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the end of the week at 23:59:99. function Get_Week_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Week_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the beginning of the month at 00:00:00. function Get_Month_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Month_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the end of the month at 23:59:59. function Get_Month_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Month_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; end Util.Dates;
true
----------------------------------------------------------------------- -- util-dates -- Date utilities -- Copyright (C) 2011, 2013, 2018, 2019 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Ada.Calendar.Formatting; with Ada.Calendar.Arithmetic; with Ada.Calendar.Time_Zones; -- = Date Utilities = -- The `Util.Dates` package provides various date utilities to help in formatting and parsing -- dates in various standard formats. It completes the standard `Ada.Calendar.Formatting` and -- other packages by implementing specific formatting and parsing. To use the packages -- described here, use the following GNAT project: -- -- with "utilada_base"; -- -- == Date Operations == -- Several operations allow to compute from a given date: -- -- * `Get_Day_Start`: The start of the day (0:00), -- * `Get_Day_End`: The end of the day (23:59:59), -- * `Get_Week_Start`: The start of the week, -- * `Get_Week_End`: The end of the week, -- * `Get_Month_Start`: The start of the month, -- * `Get_Month_End`: The end of the month -- -- The `Date_Record` type represents a date in a split format allowing -- to access easily the day, month, hour and other information. -- -- Now : Ada.Calendar.Time := Ada.Calendar.Clock; -- Week_Start : Ada.Calendar.Time := Get_Week_Start (Now); -- Week_End : Ada.Calendar.Time := Get_Week_End (Now); -- -- @include util-dates-rfc7231.ads -- @include util-dates-iso8601.ads -- @include util-dates-formats.ads package Util.Dates is -- The Unix equivalent of 'struct tm'. type Date_Record is record Date : Ada.Calendar.Time; Year : Ada.Calendar.Year_Number := 1901; Month : Ada.Calendar.Month_Number := 1; Month_Day : Ada.Calendar.Day_Number := 1; Day : Ada.Calendar.Formatting.Day_Name := Ada.Calendar.Formatting.Tuesday; Hour : Ada.Calendar.Formatting.Hour_Number := 0; Minute : Ada.Calendar.Formatting.Minute_Number := 0; Second : Ada.Calendar.Formatting.Second_Number := 0; Sub_Second : Ada.Calendar.Formatting.Second_Duration := 0.0; Time_Zone : Ada.Calendar.Time_Zones.Time_Offset := 0; Leap_Second : Boolean := False; end record; -- Split the date into a date record (See Ada.Calendar.Formatting.Split). procedure Split (Into : out Date_Record; Date : in Ada.Calendar.Time; Time_Zone : in Ada.Calendar.Time_Zones.Time_Offset := 0); -- Return the date from the date record (See Ada.Calendar.Formatting.Time_Of). function Time_Of (Date : in Date_Record) return Ada.Calendar.Time; -- Returns true if the given year is a leap year. function Is_Leap_Year (Year : in Ada.Calendar.Year_Number) return Boolean; -- Returns true if both dates are on the same day. function Is_Same_Day (Date1, Date2 : in Ada.Calendar.Time) return Boolean; function Is_Same_Day (Date1, Date2 : in Date_Record) return Boolean; -- Get the number of days in the given year. function Get_Day_Count (Year : in Ada.Calendar.Year_Number) return Ada.Calendar.Arithmetic.Day_Count; -- Get the number of days in the given month. function Get_Day_Count (Year : in Ada.Calendar.Year_Number; Month : in Ada.Calendar.Month_Number) return Ada.Calendar.Arithmetic.Day_Count; -- Get a time representing the given date at 00:00:00. function Get_Day_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Day_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the given date at 23:59:59. function Get_Day_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Day_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the beginning of the week at 00:00:00. function Get_Week_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Week_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the end of the week at 23:59:99. function Get_Week_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Week_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the beginning of the month at 00:00:00. function Get_Month_Start (Date : in Date_Record) return Ada.Calendar.Time; function Get_Month_Start (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; -- Get a time representing the end of the month at 23:59:59. function Get_Month_End (Date : in Date_Record) return Ada.Calendar.Time; function Get_Month_End (Date : in Ada.Calendar.Time) return Ada.Calendar.Time; end Util.Dates;
[ { "context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- Al", "end": 824, "score": 0.9998865127563477, "start": 811, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2012, Vadim Godunko <[email protected]> --\n-- All rights reserved. ", "end": 844, "score": 0.9999319314956665, "start": 826, "tag": "EMAIL", "value": "[email protected]" } ]
source/amf/uml/amf-internals-factories-standard_profile_l3_factories.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- 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 AMF.Internals.Elements; with AMF.Internals.Extents; with AMF.Internals.Helpers; with AMF.Internals.Links; with AMF.Internals.Listener_Registry; with AMF.Internals.Tables.Standard_Profile_L3_Metamodel; with AMF.Internals.Tables.UML_Constructors; package body AMF.Internals.Factories.Standard_Profile_L3_Factories is ----------------- -- Constructor -- ----------------- function Constructor (Extent : AMF.Internals.AMF_Extent) return not null AMF.Factories.Factory_Access is begin return new Standard_Profile_L3_Factory'(Extent => Extent); end Constructor; ----------------------- -- Convert_To_String -- ----------------------- overriding function Convert_To_String (Self : not null access Standard_Profile_L3_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Value : League.Holders.Holder) return League.Strings.Universal_String is begin raise Program_Error; return League.Strings.Empty_Universal_String; end Convert_To_String; ------------ -- Create -- ------------ overriding function Create (Self : not null access Standard_Profile_L3_Factory; Meta_Class : not null access AMF.CMOF.Classes.CMOF_Class'Class) return not null AMF.Elements.Element_Access is MC : constant AMF.Internals.CMOF_Element := AMF.Internals.Elements.Element_Base'Class (Meta_Class.all).Element; Element : AMF.Internals.AMF_Element; begin if MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Build_Component then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_Build_Component; elsif MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Metamodel then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_Metamodel; elsif MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_System_Model then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_System_Model; else raise Program_Error; end if; AMF.Internals.Extents.Internal_Append (Self.Extent, Element); AMF.Internals.Listener_Registry.Notify_Instance_Create (AMF.Internals.Helpers.To_Element (Element)); return AMF.Internals.Helpers.To_Element (Element); end Create; ------------------------ -- Create_From_String -- ------------------------ overriding function Create_From_String (Self : not null access Standard_Profile_L3_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Image : League.Strings.Universal_String) return League.Holders.Holder is begin raise Program_Error; return League.Holders.Empty_Holder; end Create_From_String; ----------------- -- Create_Link -- ----------------- overriding function Create_Link (Self : not null access Standard_Profile_L3_Factory; Association : not null access AMF.CMOF.Associations.CMOF_Association'Class; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) return not null AMF.Links.Link_Access is pragma Unreferenced (Self); begin return AMF.Internals.Links.Proxy (AMF.Internals.Links.Create_Link (AMF.Internals.Elements.Element_Base'Class (Association.all).Element, AMF.Internals.Helpers.To_Element (First_Element), AMF.Internals.Helpers.To_Element (Second_Element))); end Create_Link; ----------------- -- Get_Package -- ----------------- overriding function Get_Package (Self : not null access constant Standard_Profile_L3_Factory) return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package is pragma Unreferenced (Self); begin return Result : AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package do Result.Add (Get_Package); end return; end Get_Package; ----------------- -- Get_Package -- ----------------- function Get_Package return not null AMF.CMOF.Packages.CMOF_Package_Access is begin return AMF.CMOF.Packages.CMOF_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MM_Standard_Profile_L3_Standard_Profile_L3)); end Get_Package; ---------------------------- -- Create_Build_Component -- ---------------------------- overriding function Create_Build_Component (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.Build_Components.Standard_Profile_L3_Build_Component_Access is begin return AMF.Standard_Profile_L3.Build_Components.Standard_Profile_L3_Build_Component_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Build_Component)))); end Create_Build_Component; ---------------------- -- Create_Metamodel -- ---------------------- overriding function Create_Metamodel (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access is begin return AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Metamodel)))); end Create_Metamodel; ------------------------- -- Create_System_Model -- ------------------------- overriding function Create_System_Model (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.System_Models.Standard_Profile_L3_System_Model_Access is begin return AMF.Standard_Profile_L3.System_Models.Standard_Profile_L3_System_Model_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_System_Model)))); end Create_System_Model; end AMF.Internals.Factories.Standard_Profile_L3_Factories;
26043
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.Elements; with AMF.Internals.Extents; with AMF.Internals.Helpers; with AMF.Internals.Links; with AMF.Internals.Listener_Registry; with AMF.Internals.Tables.Standard_Profile_L3_Metamodel; with AMF.Internals.Tables.UML_Constructors; package body AMF.Internals.Factories.Standard_Profile_L3_Factories is ----------------- -- Constructor -- ----------------- function Constructor (Extent : AMF.Internals.AMF_Extent) return not null AMF.Factories.Factory_Access is begin return new Standard_Profile_L3_Factory'(Extent => Extent); end Constructor; ----------------------- -- Convert_To_String -- ----------------------- overriding function Convert_To_String (Self : not null access Standard_Profile_L3_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Value : League.Holders.Holder) return League.Strings.Universal_String is begin raise Program_Error; return League.Strings.Empty_Universal_String; end Convert_To_String; ------------ -- Create -- ------------ overriding function Create (Self : not null access Standard_Profile_L3_Factory; Meta_Class : not null access AMF.CMOF.Classes.CMOF_Class'Class) return not null AMF.Elements.Element_Access is MC : constant AMF.Internals.CMOF_Element := AMF.Internals.Elements.Element_Base'Class (Meta_Class.all).Element; Element : AMF.Internals.AMF_Element; begin if MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Build_Component then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_Build_Component; elsif MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Metamodel then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_Metamodel; elsif MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_System_Model then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_System_Model; else raise Program_Error; end if; AMF.Internals.Extents.Internal_Append (Self.Extent, Element); AMF.Internals.Listener_Registry.Notify_Instance_Create (AMF.Internals.Helpers.To_Element (Element)); return AMF.Internals.Helpers.To_Element (Element); end Create; ------------------------ -- Create_From_String -- ------------------------ overriding function Create_From_String (Self : not null access Standard_Profile_L3_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Image : League.Strings.Universal_String) return League.Holders.Holder is begin raise Program_Error; return League.Holders.Empty_Holder; end Create_From_String; ----------------- -- Create_Link -- ----------------- overriding function Create_Link (Self : not null access Standard_Profile_L3_Factory; Association : not null access AMF.CMOF.Associations.CMOF_Association'Class; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) return not null AMF.Links.Link_Access is pragma Unreferenced (Self); begin return AMF.Internals.Links.Proxy (AMF.Internals.Links.Create_Link (AMF.Internals.Elements.Element_Base'Class (Association.all).Element, AMF.Internals.Helpers.To_Element (First_Element), AMF.Internals.Helpers.To_Element (Second_Element))); end Create_Link; ----------------- -- Get_Package -- ----------------- overriding function Get_Package (Self : not null access constant Standard_Profile_L3_Factory) return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package is pragma Unreferenced (Self); begin return Result : AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package do Result.Add (Get_Package); end return; end Get_Package; ----------------- -- Get_Package -- ----------------- function Get_Package return not null AMF.CMOF.Packages.CMOF_Package_Access is begin return AMF.CMOF.Packages.CMOF_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MM_Standard_Profile_L3_Standard_Profile_L3)); end Get_Package; ---------------------------- -- Create_Build_Component -- ---------------------------- overriding function Create_Build_Component (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.Build_Components.Standard_Profile_L3_Build_Component_Access is begin return AMF.Standard_Profile_L3.Build_Components.Standard_Profile_L3_Build_Component_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Build_Component)))); end Create_Build_Component; ---------------------- -- Create_Metamodel -- ---------------------- overriding function Create_Metamodel (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access is begin return AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Metamodel)))); end Create_Metamodel; ------------------------- -- Create_System_Model -- ------------------------- overriding function Create_System_Model (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.System_Models.Standard_Profile_L3_System_Model_Access is begin return AMF.Standard_Profile_L3.System_Models.Standard_Profile_L3_System_Model_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_System_Model)))); end Create_System_Model; end AMF.Internals.Factories.Standard_Profile_L3_Factories;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.Elements; with AMF.Internals.Extents; with AMF.Internals.Helpers; with AMF.Internals.Links; with AMF.Internals.Listener_Registry; with AMF.Internals.Tables.Standard_Profile_L3_Metamodel; with AMF.Internals.Tables.UML_Constructors; package body AMF.Internals.Factories.Standard_Profile_L3_Factories is ----------------- -- Constructor -- ----------------- function Constructor (Extent : AMF.Internals.AMF_Extent) return not null AMF.Factories.Factory_Access is begin return new Standard_Profile_L3_Factory'(Extent => Extent); end Constructor; ----------------------- -- Convert_To_String -- ----------------------- overriding function Convert_To_String (Self : not null access Standard_Profile_L3_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Value : League.Holders.Holder) return League.Strings.Universal_String is begin raise Program_Error; return League.Strings.Empty_Universal_String; end Convert_To_String; ------------ -- Create -- ------------ overriding function Create (Self : not null access Standard_Profile_L3_Factory; Meta_Class : not null access AMF.CMOF.Classes.CMOF_Class'Class) return not null AMF.Elements.Element_Access is MC : constant AMF.Internals.CMOF_Element := AMF.Internals.Elements.Element_Base'Class (Meta_Class.all).Element; Element : AMF.Internals.AMF_Element; begin if MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Build_Component then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_Build_Component; elsif MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Metamodel then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_Metamodel; elsif MC = AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_System_Model then Element := AMF.Internals.Tables.UML_Constructors.Create_Standard_Profile_L3_System_Model; else raise Program_Error; end if; AMF.Internals.Extents.Internal_Append (Self.Extent, Element); AMF.Internals.Listener_Registry.Notify_Instance_Create (AMF.Internals.Helpers.To_Element (Element)); return AMF.Internals.Helpers.To_Element (Element); end Create; ------------------------ -- Create_From_String -- ------------------------ overriding function Create_From_String (Self : not null access Standard_Profile_L3_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Image : League.Strings.Universal_String) return League.Holders.Holder is begin raise Program_Error; return League.Holders.Empty_Holder; end Create_From_String; ----------------- -- Create_Link -- ----------------- overriding function Create_Link (Self : not null access Standard_Profile_L3_Factory; Association : not null access AMF.CMOF.Associations.CMOF_Association'Class; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) return not null AMF.Links.Link_Access is pragma Unreferenced (Self); begin return AMF.Internals.Links.Proxy (AMF.Internals.Links.Create_Link (AMF.Internals.Elements.Element_Base'Class (Association.all).Element, AMF.Internals.Helpers.To_Element (First_Element), AMF.Internals.Helpers.To_Element (Second_Element))); end Create_Link; ----------------- -- Get_Package -- ----------------- overriding function Get_Package (Self : not null access constant Standard_Profile_L3_Factory) return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package is pragma Unreferenced (Self); begin return Result : AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package do Result.Add (Get_Package); end return; end Get_Package; ----------------- -- Get_Package -- ----------------- function Get_Package return not null AMF.CMOF.Packages.CMOF_Package_Access is begin return AMF.CMOF.Packages.CMOF_Package_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MM_Standard_Profile_L3_Standard_Profile_L3)); end Get_Package; ---------------------------- -- Create_Build_Component -- ---------------------------- overriding function Create_Build_Component (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.Build_Components.Standard_Profile_L3_Build_Component_Access is begin return AMF.Standard_Profile_L3.Build_Components.Standard_Profile_L3_Build_Component_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Build_Component)))); end Create_Build_Component; ---------------------- -- Create_Metamodel -- ---------------------- overriding function Create_Metamodel (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access is begin return AMF.Standard_Profile_L3.Metamodels.Standard_Profile_L3_Metamodel_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_Metamodel)))); end Create_Metamodel; ------------------------- -- Create_System_Model -- ------------------------- overriding function Create_System_Model (Self : not null access Standard_Profile_L3_Factory) return AMF.Standard_Profile_L3.System_Models.Standard_Profile_L3_System_Model_Access is begin return AMF.Standard_Profile_L3.System_Models.Standard_Profile_L3_System_Model_Access (Self.Create (AMF.CMOF.Classes.CMOF_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.Standard_Profile_L3_Metamodel.MC_Standard_Profile_L3_System_Model)))); end Create_System_Model; end AMF.Internals.Factories.Standard_Profile_L3_Factories;
[ { "context": " library specification\n-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>\n-- Copyright (c) 2004-2016 ", "end": 97, "score": 0.9997812509536743, "start": 85, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "ication\n-- Copyright (c) 2003-2018 Maxim Reznik <[email protected]>\n-- Copyright (c) 2004-2016 AXE Consultants\n-- ", "end": 117, "score": 0.999930739402771, "start": 99, "tag": "EMAIL", "value": "[email protected]" } ]
ada-direct_io.ads
mgrojo/adalib
15
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <[email protected]> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.IO_Exceptions; generic type Element_Type is private; package Ada.Direct_IO is type File_Type is limited private; type File_Mode is (In_File, Inout_File, Out_File); type Count is range 0 .. implementation_defined; subtype Positive_Count is Count range 1 .. Count'Last; -- File management procedure Create (File : in out File_Type; Mode : in File_Mode := Inout_File; Name : in String := ""; Form : in String := ""); procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := ""); procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type); function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String; function Is_Open (File : in File_Type) return Boolean; -- Input and output operations procedure Read (File : in File_Type; Item : out Element_Type; From : in Positive_Count); procedure Read (File : in File_Type; Item : out Element_Type); procedure Write (File : in File_Type; Item : in Element_Type; To : in Positive_Count); procedure Write (File : in File_Type; Item : in Element_Type); procedure Set_Index (File : in File_Type; To : in Positive_Count); function Index (File : in File_Type) return Positive_Count; function Size (File : in File_Type) return Count; function End_Of_File (File : in File_Type) return Boolean; -- Exceptions Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error; private type File_Type is limited null record; end Ada.Direct_IO;
6297
-- Standard Ada library specification -- Copyright (c) 2003-2018 <NAME> <<EMAIL>> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.IO_Exceptions; generic type Element_Type is private; package Ada.Direct_IO is type File_Type is limited private; type File_Mode is (In_File, Inout_File, Out_File); type Count is range 0 .. implementation_defined; subtype Positive_Count is Count range 1 .. Count'Last; -- File management procedure Create (File : in out File_Type; Mode : in File_Mode := Inout_File; Name : in String := ""; Form : in String := ""); procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := ""); procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type); function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String; function Is_Open (File : in File_Type) return Boolean; -- Input and output operations procedure Read (File : in File_Type; Item : out Element_Type; From : in Positive_Count); procedure Read (File : in File_Type; Item : out Element_Type); procedure Write (File : in File_Type; Item : in Element_Type; To : in Positive_Count); procedure Write (File : in File_Type; Item : in Element_Type); procedure Set_Index (File : in File_Type; To : in Positive_Count); function Index (File : in File_Type) return Positive_Count; function Size (File : in File_Type) return Count; function End_Of_File (File : in File_Type) return Boolean; -- Exceptions Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error; private type File_Type is limited null record; end Ada.Direct_IO;
true
-- Standard Ada library specification -- Copyright (c) 2003-2018 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.IO_Exceptions; generic type Element_Type is private; package Ada.Direct_IO is type File_Type is limited private; type File_Mode is (In_File, Inout_File, Out_File); type Count is range 0 .. implementation_defined; subtype Positive_Count is Count range 1 .. Count'Last; -- File management procedure Create (File : in out File_Type; Mode : in File_Mode := Inout_File; Name : in String := ""; Form : in String := ""); procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := ""); procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type); function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String; function Is_Open (File : in File_Type) return Boolean; -- Input and output operations procedure Read (File : in File_Type; Item : out Element_Type; From : in Positive_Count); procedure Read (File : in File_Type; Item : out Element_Type); procedure Write (File : in File_Type; Item : in Element_Type; To : in Positive_Count); procedure Write (File : in File_Type; Item : in Element_Type); procedure Set_Index (File : in File_Type; To : in Positive_Count); function Index (File : in File_Type) return Positive_Count; function Size (File : in File_Type) return Count; function End_Of_File (File : in File_Type) return Boolean; -- Exceptions Status_Error : exception renames IO_Exceptions.Status_Error; Mode_Error : exception renames IO_Exceptions.Mode_Error; Name_Error : exception renames IO_Exceptions.Name_Error; Use_Error : exception renames IO_Exceptions.Use_Error; Device_Error : exception renames IO_Exceptions.Device_Error; End_Error : exception renames IO_Exceptions.End_Error; Data_Error : exception renames IO_Exceptions.Data_Error; private type File_Type is limited null record; end Ada.Direct_IO;
[ { "context": "-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifi", "end": 48, "score": 0.9998679161071777, "start": 38, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 68, "score": 0.9999306201934814, "start": 50, "tag": "EMAIL", "value": "[email protected]" } ]
source/nodes/program-nodes-operator_symbols-set_defining_name.adb
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- procedure Program.Nodes.Operator_Symbols.Set_Defining_Name (Self : not null Program.Elements.Operator_Symbols.Operator_Symbol_Access; Value : Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access) is begin Base_Operator_Symbol (Self.all).Corresponding_Defining_Operator_Symbol := Value; end Program.Nodes.Operator_Symbols.Set_Defining_Name;
7425
-- SPDX-FileCopyrightText: 2020-2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- procedure Program.Nodes.Operator_Symbols.Set_Defining_Name (Self : not null Program.Elements.Operator_Symbols.Operator_Symbol_Access; Value : Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access) is begin Base_Operator_Symbol (Self.all).Corresponding_Defining_Operator_Symbol := Value; end Program.Nodes.Operator_Symbols.Set_Defining_Name;
true
-- SPDX-FileCopyrightText: 2020-2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- procedure Program.Nodes.Operator_Symbols.Set_Defining_Name (Self : not null Program.Elements.Operator_Symbols.Operator_Symbol_Access; Value : Program.Elements.Defining_Operator_Symbols .Defining_Operator_Symbol_Access) is begin Base_Operator_Symbol (Self.all).Corresponding_Defining_Operator_Symbol := Value; end Program.Nodes.Operator_Symbols.Set_Defining_Name;
[ { "context": "d, real - time, 3D engine\r\n --\r\n -- Copyright (c) Gautier de Montmollin/Rod Kay 2007\r\n -- CH - 8810 Horgen\r\n -- SWITZER", "end": 226, "score": 0.9998389482498169, "start": 205, "tag": "NAME", "value": "Gautier de Montmollin" }, { "context": "ne\r\n --\r\n -- Copyright (c) Gautier de Montmollin/Rod Kay 2007\r\n -- CH - 8810 Horgen\r\n -- SWITZERLAND\r\n -", "end": 234, "score": 0.9998534321784973, "start": 227, "tag": "NAME", "value": "Rod Kay" } ]
Sources/Globe_3d/objects/globe_3d-impostor-simple.ads
ForYouEyesOnly/Space-Convoy
1
pragma Style_Checks (Off); pragma Warnings (Off); ------------------------------------------------------------------------- -- GLOBE_3D - GL - based, real - time, 3D engine -- -- Copyright (c) Gautier de Montmollin/Rod Kay 2007 -- CH - 8810 Horgen -- SWITZERLAND -- Permission granted to use this software, without any warranty, -- for any purpose, provided this copyright note remains attached -- and unmodified if sources are distributed further. ------------------------------------------------------------------------- with GL, GL.Geometry, GL.Textures, GL.Skins, GL.skinned_Geometry; package GLOBE_3D.Impostor.Simple is -- tbd : rename 'GLOBE_3D.Impostor.standard' ? -- can impostor any 'visual'. type Impostor is new globe_3d.impostor.Impostor with private; type p_Impostor is access all Impostor'Class; procedure pre_Calculate (o : in out Impostor); function update_Required (o : access Impostor; the_Camera : in globe_3d.p_Camera) return Boolean; procedure update (o : in out Impostor; the_Camera : in p_Camera; texture_Pool : in GL.textures.p_Pool); procedure free (o : in out p_Impostor); private type Impostor is new globe_3d.impostor.Impostor with record current_Camera_look_at_Rotation : globe_3d.Matrix_33; end record; end GLOBE_3D.Impostor.Simple;
23598
pragma Style_Checks (Off); pragma Warnings (Off); ------------------------------------------------------------------------- -- GLOBE_3D - GL - based, real - time, 3D engine -- -- Copyright (c) <NAME>/<NAME> 2007 -- CH - 8810 Horgen -- SWITZERLAND -- Permission granted to use this software, without any warranty, -- for any purpose, provided this copyright note remains attached -- and unmodified if sources are distributed further. ------------------------------------------------------------------------- with GL, GL.Geometry, GL.Textures, GL.Skins, GL.skinned_Geometry; package GLOBE_3D.Impostor.Simple is -- tbd : rename 'GLOBE_3D.Impostor.standard' ? -- can impostor any 'visual'. type Impostor is new globe_3d.impostor.Impostor with private; type p_Impostor is access all Impostor'Class; procedure pre_Calculate (o : in out Impostor); function update_Required (o : access Impostor; the_Camera : in globe_3d.p_Camera) return Boolean; procedure update (o : in out Impostor; the_Camera : in p_Camera; texture_Pool : in GL.textures.p_Pool); procedure free (o : in out p_Impostor); private type Impostor is new globe_3d.impostor.Impostor with record current_Camera_look_at_Rotation : globe_3d.Matrix_33; end record; end GLOBE_3D.Impostor.Simple;
true
pragma Style_Checks (Off); pragma Warnings (Off); ------------------------------------------------------------------------- -- GLOBE_3D - GL - based, real - time, 3D engine -- -- Copyright (c) PI:NAME:<NAME>END_PI/PI:NAME:<NAME>END_PI 2007 -- CH - 8810 Horgen -- SWITZERLAND -- Permission granted to use this software, without any warranty, -- for any purpose, provided this copyright note remains attached -- and unmodified if sources are distributed further. ------------------------------------------------------------------------- with GL, GL.Geometry, GL.Textures, GL.Skins, GL.skinned_Geometry; package GLOBE_3D.Impostor.Simple is -- tbd : rename 'GLOBE_3D.Impostor.standard' ? -- can impostor any 'visual'. type Impostor is new globe_3d.impostor.Impostor with private; type p_Impostor is access all Impostor'Class; procedure pre_Calculate (o : in out Impostor); function update_Required (o : access Impostor; the_Camera : in globe_3d.p_Camera) return Boolean; procedure update (o : in out Impostor; the_Camera : in p_Camera; texture_Pool : in GL.textures.p_Pool); procedure free (o : in out p_Impostor); private type Impostor is new globe_3d.impostor.Impostor with record current_Camera_look_at_Rotation : globe_3d.Matrix_33; end record; end GLOBE_3D.Impostor.Simple;
[ { "context": "Type;\n UserName, FullName, Password, Password2, Fname : Unbounded_String;\n NowDate : Time :", "end": 1706, "score": 0.6042242050170898, "start": 1705, "tag": "PASSWORD", "value": "2" }, { "context": "\n Read_Config(To_String(Fname),UserName => UserName,\n FullName => FullName,\n ", "end": 7401, "score": 0.9738001227378845, "start": 7393, "tag": "NAME", "value": "UserName" }, { "context": "Name => UserName,\n FullName => FullName,\n Password => Password);\n", "end": 7440, "score": 0.6580342650413513, "start": 7436, "tag": "NAME", "value": "Full" }, { "context": "Name => FullName,\n Password => Password);\n if InputPassword = Password then\n\n ", "end": 7487, "score": 0.9977839589118958, "start": 7479, "tag": "PASSWORD", "value": "Password" }, { "context": "Password => Password);\n if InputPassword = Password then\n\n UserLoggedIn := True;\n ", "end": 7526, "score": 0.9920694231987, "start": 7518, "tag": "PASSWORD", "value": "Password" }, { "context": "serLoggedIn := True;\n UserLoggedName := UserName;\n UserLoggedFullName := FullName;\n ", "end": 7605, "score": 0.975827693939209, "start": 7597, "tag": "NAME", "value": "UserName" }, { "context": "ame := UserName;\n UserLoggedFullName := FullName;\n Display_Warning.Warning(To_String(\"L", "end": 7649, "score": 0.7913015484809875, "start": 7641, "tag": "NAME", "value": "FullName" } ]
src/message-login.adb
zenharris/ada-bbs
2
with Message.Reader; use Message.Reader; Package body Message.Login is procedure Read_Config (FileName : in String; UserName : out Unbounded_String; FullName : out Unbounded_String; Password : out Unbounded_String) is HeaderType, HeaderText, scratch : Unbounded_String; File : File_Type; begin Open (File => File, Mode => In_File, Name => Filename); scratch := SUIO.Get_Line(File); while scratch /= "" loop HeaderType := To_Unbounded_String(SU.Slice(scratch,1,SU.Index(scratch,":")-1)); HeaderText := To_Unbounded_String(SU.Slice(scratch,SU.Index(scratch,":")+2,SU.Length(scratch))); if HeaderType = "UserName" then UserName := HeaderText; elsif HeaderType = "FullName" then FullName := HeaderText; elsif HeaderType = "Password" then Password := HeaderText; end if; scratch := SUIO.Get_Line(File); end loop; Close (File); exception when End_Error => Close (File); null; end Read_Config; -- function FileExists (Namen : Unbounded_String) return Boolean is -- File : File_Type; -- begin -- Open (File => File, -- Mode => In_File, -- Name => To_String(Namen)); -- Close (File); -- return True; -- exception -- when End_Error => -- Close (File); -- return True; -- when ADA.IO_EXCEPTIONS.NAME_ERROR => -- return False; -- end FileExists; procedure Create_User is File : File_Type; UserName, FullName, Password, Password2, Fname : Unbounded_String; NowDate : Time := Clock; Width,Columns : Column_Position := 50; Length,Lines : Line_Position := 8; Display_Window : Window; begin Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns); Display_Window := Sub_Window(Win => Standard_Window, Number_Of_Lines => Length, Number_Of_Columns => Width, First_Line_Position => (Lines - Length) / 2, First_Column_Position => (Columns - Width) / 2); Clear(Display_Window); Box(Display_Window); loop Add (Display_Window,Line => 2,Column => 2,Str => "UserName : "); Texaco.Line_Editor(Display_Window, StartLine => 2, StartColumn => 15, Editlength => 16, Edline => UserName, MaxLength => 15, SuppressSpaces => True); -- FName := UserName & ".cfg"; Fname := To_Unbounded_String(Ada.Strings.Fixed.Translate(To_String(UserName), Ada.Strings.Maps.Constants.Lower_Case_Map)); Fname := "users/" & FName & ".cfg"; if Exists (To_String(FName)) then Display_Warning.Warning("That Username is already in use",Down => Integer(Length-1)); UserName := To_Unbounded_String(""); Redraw(Display_Window,0,Integer(Length)-1); Refresh(Display_Window); end if; exit when UserName /= ""; end loop; loop Add (Display_Window,Line => 3,Column => 2,Str => "Full Name : "); Texaco.Line_Editor(Display_Window, StartLine => 3, StartColumn => 15, Editlength => 31, Edline => FullName, MaxLength => 30); exit when FullName /= ""; end loop; loop Add (Display_Window,Line => 4,Column => 2,Str => "Password : "); Texaco.Password_Editor(Display_Window, StartLine => 4, StartColumn => 15, Edline => Password, MaxLength => 15); Add (Display_Window,Line => 5,Column => 2,Str => "Re-Type Password : "); Texaco.Password_Editor(Display_Window, StartLine => 5, StartColumn => 21, Edline => Password2, MaxLength => 15); if Password /= Password2 then Display_Warning.Warning("Passwords Do Not Match",Down => Integer(Length-1)); Password := To_Unbounded_String(""); Password2 := To_Unbounded_String(""); end if; exit when Password /= ""; end loop; if Display_Warning.GetYN("Do You want to save this User Y/N",Down => Integer(Length-1)) then -- FName := UserName & ".cfg"; Create (File => File, Mode => Out_File, Name => To_String(FName)); SUIO.Put_Line(File,"UserName: " & UserName); SUIO.Put_Line(File,"FullName: " & FullName); SUIO.Put_Line(File,"Password: " & Password); SUIO.Put_Line(File,"CreateDate: " & To_Unbounded_String(Image (NowDate))); SUIO.Put_Line(File,To_Unbounded_String("")); Close (File); end if; Clear(Display_Window); Refresh(Display_Window); Delete (Win => Display_Window); end Create_User; procedure Login_User is InputUserName, InputPassword, Fname, UserName,FullName,Password : Unbounded_String; Width,Columns : Column_Position := 50; Length,Lines : Line_Position := 8; Display_Window : Window; begin Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns); Display_Window := Sub_Window(Win => Standard_Window, Number_Of_Lines => Length, Number_Of_Columns => Width, First_Line_Position => (Lines - Length) / 2, First_Column_Position => (Columns - Width) / 2); Clear(Display_Window); Box(Display_Window); loop Add (Display_Window,Line => 2,Column => 2,Str => "UserName : "); Texaco.Line_Editor(Display_Window, StartLine => 2, StartColumn => 15, Editlength => 16, Edline => InputUserName, MaxLength => 15, SuppressSpaces => True); exit when InputUserName /= ""; end loop; loop Add (Display_Window,Line => 3,Column => 2,Str => "Password : "); Texaco.Password_Editor(Display_Window, StartLine => 3, StartColumn => 15, Edline => InputPassword, MaxLength => 15); exit when InputPassword /= ""; end loop; Fname := To_Unbounded_String(Ada.Strings.Fixed.Translate(To_String(InputUserName), Ada.Strings.Maps.Constants.Lower_Case_Map)); Fname := "users/" & Fname & ".cfg"; if Exists (To_String(FName)) then Read_Config(To_String(Fname),UserName => UserName, FullName => FullName, Password => Password); if InputPassword = Password then UserLoggedIn := True; UserLoggedName := UserName; UserLoggedFullName := FullName; Display_Warning.Warning(To_String("Logged in "& UserLoggedName),Down => Integer(Length-1)); else Display_Warning.Warning("Login Failed",Down => Integer(Length-1)); end if; else Display_Warning.Warning("Login Failed",Down => Integer(Length-1)); end if; Clear(Display_Window); Refresh(Display_Window); Delete (Win => Display_Window); end Login_User; end Message.Login;
21180
with Message.Reader; use Message.Reader; Package body Message.Login is procedure Read_Config (FileName : in String; UserName : out Unbounded_String; FullName : out Unbounded_String; Password : out Unbounded_String) is HeaderType, HeaderText, scratch : Unbounded_String; File : File_Type; begin Open (File => File, Mode => In_File, Name => Filename); scratch := SUIO.Get_Line(File); while scratch /= "" loop HeaderType := To_Unbounded_String(SU.Slice(scratch,1,SU.Index(scratch,":")-1)); HeaderText := To_Unbounded_String(SU.Slice(scratch,SU.Index(scratch,":")+2,SU.Length(scratch))); if HeaderType = "UserName" then UserName := HeaderText; elsif HeaderType = "FullName" then FullName := HeaderText; elsif HeaderType = "Password" then Password := HeaderText; end if; scratch := SUIO.Get_Line(File); end loop; Close (File); exception when End_Error => Close (File); null; end Read_Config; -- function FileExists (Namen : Unbounded_String) return Boolean is -- File : File_Type; -- begin -- Open (File => File, -- Mode => In_File, -- Name => To_String(Namen)); -- Close (File); -- return True; -- exception -- when End_Error => -- Close (File); -- return True; -- when ADA.IO_EXCEPTIONS.NAME_ERROR => -- return False; -- end FileExists; procedure Create_User is File : File_Type; UserName, FullName, Password, Password<PASSWORD>, Fname : Unbounded_String; NowDate : Time := Clock; Width,Columns : Column_Position := 50; Length,Lines : Line_Position := 8; Display_Window : Window; begin Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns); Display_Window := Sub_Window(Win => Standard_Window, Number_Of_Lines => Length, Number_Of_Columns => Width, First_Line_Position => (Lines - Length) / 2, First_Column_Position => (Columns - Width) / 2); Clear(Display_Window); Box(Display_Window); loop Add (Display_Window,Line => 2,Column => 2,Str => "UserName : "); Texaco.Line_Editor(Display_Window, StartLine => 2, StartColumn => 15, Editlength => 16, Edline => UserName, MaxLength => 15, SuppressSpaces => True); -- FName := UserName & ".cfg"; Fname := To_Unbounded_String(Ada.Strings.Fixed.Translate(To_String(UserName), Ada.Strings.Maps.Constants.Lower_Case_Map)); Fname := "users/" & FName & ".cfg"; if Exists (To_String(FName)) then Display_Warning.Warning("That Username is already in use",Down => Integer(Length-1)); UserName := To_Unbounded_String(""); Redraw(Display_Window,0,Integer(Length)-1); Refresh(Display_Window); end if; exit when UserName /= ""; end loop; loop Add (Display_Window,Line => 3,Column => 2,Str => "Full Name : "); Texaco.Line_Editor(Display_Window, StartLine => 3, StartColumn => 15, Editlength => 31, Edline => FullName, MaxLength => 30); exit when FullName /= ""; end loop; loop Add (Display_Window,Line => 4,Column => 2,Str => "Password : "); Texaco.Password_Editor(Display_Window, StartLine => 4, StartColumn => 15, Edline => Password, MaxLength => 15); Add (Display_Window,Line => 5,Column => 2,Str => "Re-Type Password : "); Texaco.Password_Editor(Display_Window, StartLine => 5, StartColumn => 21, Edline => Password2, MaxLength => 15); if Password /= Password2 then Display_Warning.Warning("Passwords Do Not Match",Down => Integer(Length-1)); Password := To_Unbounded_String(""); Password2 := To_Unbounded_String(""); end if; exit when Password /= ""; end loop; if Display_Warning.GetYN("Do You want to save this User Y/N",Down => Integer(Length-1)) then -- FName := UserName & ".cfg"; Create (File => File, Mode => Out_File, Name => To_String(FName)); SUIO.Put_Line(File,"UserName: " & UserName); SUIO.Put_Line(File,"FullName: " & FullName); SUIO.Put_Line(File,"Password: " & Password); SUIO.Put_Line(File,"CreateDate: " & To_Unbounded_String(Image (NowDate))); SUIO.Put_Line(File,To_Unbounded_String("")); Close (File); end if; Clear(Display_Window); Refresh(Display_Window); Delete (Win => Display_Window); end Create_User; procedure Login_User is InputUserName, InputPassword, Fname, UserName,FullName,Password : Unbounded_String; Width,Columns : Column_Position := 50; Length,Lines : Line_Position := 8; Display_Window : Window; begin Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns); Display_Window := Sub_Window(Win => Standard_Window, Number_Of_Lines => Length, Number_Of_Columns => Width, First_Line_Position => (Lines - Length) / 2, First_Column_Position => (Columns - Width) / 2); Clear(Display_Window); Box(Display_Window); loop Add (Display_Window,Line => 2,Column => 2,Str => "UserName : "); Texaco.Line_Editor(Display_Window, StartLine => 2, StartColumn => 15, Editlength => 16, Edline => InputUserName, MaxLength => 15, SuppressSpaces => True); exit when InputUserName /= ""; end loop; loop Add (Display_Window,Line => 3,Column => 2,Str => "Password : "); Texaco.Password_Editor(Display_Window, StartLine => 3, StartColumn => 15, Edline => InputPassword, MaxLength => 15); exit when InputPassword /= ""; end loop; Fname := To_Unbounded_String(Ada.Strings.Fixed.Translate(To_String(InputUserName), Ada.Strings.Maps.Constants.Lower_Case_Map)); Fname := "users/" & Fname & ".cfg"; if Exists (To_String(FName)) then Read_Config(To_String(Fname),UserName => <NAME>, FullName => <NAME>Name, Password => <PASSWORD>); if InputPassword = <PASSWORD> then UserLoggedIn := True; UserLoggedName := <NAME>; UserLoggedFullName := <NAME>; Display_Warning.Warning(To_String("Logged in "& UserLoggedName),Down => Integer(Length-1)); else Display_Warning.Warning("Login Failed",Down => Integer(Length-1)); end if; else Display_Warning.Warning("Login Failed",Down => Integer(Length-1)); end if; Clear(Display_Window); Refresh(Display_Window); Delete (Win => Display_Window); end Login_User; end Message.Login;
true
with Message.Reader; use Message.Reader; Package body Message.Login is procedure Read_Config (FileName : in String; UserName : out Unbounded_String; FullName : out Unbounded_String; Password : out Unbounded_String) is HeaderType, HeaderText, scratch : Unbounded_String; File : File_Type; begin Open (File => File, Mode => In_File, Name => Filename); scratch := SUIO.Get_Line(File); while scratch /= "" loop HeaderType := To_Unbounded_String(SU.Slice(scratch,1,SU.Index(scratch,":")-1)); HeaderText := To_Unbounded_String(SU.Slice(scratch,SU.Index(scratch,":")+2,SU.Length(scratch))); if HeaderType = "UserName" then UserName := HeaderText; elsif HeaderType = "FullName" then FullName := HeaderText; elsif HeaderType = "Password" then Password := HeaderText; end if; scratch := SUIO.Get_Line(File); end loop; Close (File); exception when End_Error => Close (File); null; end Read_Config; -- function FileExists (Namen : Unbounded_String) return Boolean is -- File : File_Type; -- begin -- Open (File => File, -- Mode => In_File, -- Name => To_String(Namen)); -- Close (File); -- return True; -- exception -- when End_Error => -- Close (File); -- return True; -- when ADA.IO_EXCEPTIONS.NAME_ERROR => -- return False; -- end FileExists; procedure Create_User is File : File_Type; UserName, FullName, Password, PasswordPI:PASSWORD:<PASSWORD>END_PI, Fname : Unbounded_String; NowDate : Time := Clock; Width,Columns : Column_Position := 50; Length,Lines : Line_Position := 8; Display_Window : Window; begin Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns); Display_Window := Sub_Window(Win => Standard_Window, Number_Of_Lines => Length, Number_Of_Columns => Width, First_Line_Position => (Lines - Length) / 2, First_Column_Position => (Columns - Width) / 2); Clear(Display_Window); Box(Display_Window); loop Add (Display_Window,Line => 2,Column => 2,Str => "UserName : "); Texaco.Line_Editor(Display_Window, StartLine => 2, StartColumn => 15, Editlength => 16, Edline => UserName, MaxLength => 15, SuppressSpaces => True); -- FName := UserName & ".cfg"; Fname := To_Unbounded_String(Ada.Strings.Fixed.Translate(To_String(UserName), Ada.Strings.Maps.Constants.Lower_Case_Map)); Fname := "users/" & FName & ".cfg"; if Exists (To_String(FName)) then Display_Warning.Warning("That Username is already in use",Down => Integer(Length-1)); UserName := To_Unbounded_String(""); Redraw(Display_Window,0,Integer(Length)-1); Refresh(Display_Window); end if; exit when UserName /= ""; end loop; loop Add (Display_Window,Line => 3,Column => 2,Str => "Full Name : "); Texaco.Line_Editor(Display_Window, StartLine => 3, StartColumn => 15, Editlength => 31, Edline => FullName, MaxLength => 30); exit when FullName /= ""; end loop; loop Add (Display_Window,Line => 4,Column => 2,Str => "Password : "); Texaco.Password_Editor(Display_Window, StartLine => 4, StartColumn => 15, Edline => Password, MaxLength => 15); Add (Display_Window,Line => 5,Column => 2,Str => "Re-Type Password : "); Texaco.Password_Editor(Display_Window, StartLine => 5, StartColumn => 21, Edline => Password2, MaxLength => 15); if Password /= Password2 then Display_Warning.Warning("Passwords Do Not Match",Down => Integer(Length-1)); Password := To_Unbounded_String(""); Password2 := To_Unbounded_String(""); end if; exit when Password /= ""; end loop; if Display_Warning.GetYN("Do You want to save this User Y/N",Down => Integer(Length-1)) then -- FName := UserName & ".cfg"; Create (File => File, Mode => Out_File, Name => To_String(FName)); SUIO.Put_Line(File,"UserName: " & UserName); SUIO.Put_Line(File,"FullName: " & FullName); SUIO.Put_Line(File,"Password: " & Password); SUIO.Put_Line(File,"CreateDate: " & To_Unbounded_String(Image (NowDate))); SUIO.Put_Line(File,To_Unbounded_String("")); Close (File); end if; Clear(Display_Window); Refresh(Display_Window); Delete (Win => Display_Window); end Create_User; procedure Login_User is InputUserName, InputPassword, Fname, UserName,FullName,Password : Unbounded_String; Width,Columns : Column_Position := 50; Length,Lines : Line_Position := 8; Display_Window : Window; begin Get_Size(Number_Of_Lines => Lines,Number_Of_Columns => Columns); Display_Window := Sub_Window(Win => Standard_Window, Number_Of_Lines => Length, Number_Of_Columns => Width, First_Line_Position => (Lines - Length) / 2, First_Column_Position => (Columns - Width) / 2); Clear(Display_Window); Box(Display_Window); loop Add (Display_Window,Line => 2,Column => 2,Str => "UserName : "); Texaco.Line_Editor(Display_Window, StartLine => 2, StartColumn => 15, Editlength => 16, Edline => InputUserName, MaxLength => 15, SuppressSpaces => True); exit when InputUserName /= ""; end loop; loop Add (Display_Window,Line => 3,Column => 2,Str => "Password : "); Texaco.Password_Editor(Display_Window, StartLine => 3, StartColumn => 15, Edline => InputPassword, MaxLength => 15); exit when InputPassword /= ""; end loop; Fname := To_Unbounded_String(Ada.Strings.Fixed.Translate(To_String(InputUserName), Ada.Strings.Maps.Constants.Lower_Case_Map)); Fname := "users/" & Fname & ".cfg"; if Exists (To_String(FName)) then Read_Config(To_String(Fname),UserName => PI:NAME:<NAME>END_PI, FullName => PI:NAME:<NAME>END_PIName, Password => PI:PASSWORD:<PASSWORD>END_PI); if InputPassword = PI:PASSWORD:<PASSWORD>END_PI then UserLoggedIn := True; UserLoggedName := PI:NAME:<NAME>END_PI; UserLoggedFullName := PI:NAME:<NAME>END_PI; Display_Warning.Warning(To_String("Logged in "& UserLoggedName),Down => Integer(Length-1)); else Display_Warning.Warning("Login Failed",Down => Integer(Length-1)); end if; else Display_Warning.Warning("Login Failed",Down => Integer(Length-1)); end if; Clear(Display_Window); Refresh(Display_Window); Delete (Win => Display_Window); end Login_User; end Message.Login;
[ { "context": "20.adb GAP library of id's Hans Ulrich Besche\n##\n\nID_GROUP_TREE.next[1920].next[1].next[106]:=\n", "end": 158, "score": 0.999882698059082, "start": 140, "tag": "NAME", "value": "Hans Ulrich Besche" } ]
id6/id1920.adb
hulpke/smallgrp
5
############################################################################# ## #W id1920.adb GAP library of id's Hans Ulrich Besche ## ID_GROUP_TREE.next[1920].next[1].next[106]:= rec( fp:= [ 106, 606, 1106, 1606, 2106 ], next:= [ rec( fp:= [ 31719, 91192, 91483 ], next:= [ rec( fp:= [ 1799, 4105, 15665, 22211, 32867, 42806, 60681, 63076, 63307, 80381, 91343, 92866 ], level:= 4, next:= [ 4389, 4378, 4385, 4390, 4392, 4391, 4383, 4387, 4393, 4394, 4388, 4381 ] ), rec( fp:= [ 23910, 82038 ], level:= 4, next:= [ 4376, 4379 ] ), rec( fp:= [ 5894, 24611, 32022, 36913, 67696 ], level:= 4, next:= [ 4384, 4382, 4386, 4380, 4377 ] ) ] ), rec( fp:= [ 3596, 46537, 65954 ], next:= [ rec( fp:= [ 17955, 21825, 28894, 64608, 84112, 91091 ], level:= 4, next:= [ 26389, 26387, 26381, 26378, 26375, 26384 ] ), rec( fp:= [ 3258, 55402, 63317, 89321, 91884 ], level:= 4, next:= [ 26374, 26383, 26377, 26386, 26380 ] ), rec( fp:= [ 260, 1163, 2317, 11444, 13368, 15475, 18937, 21312, 22246, 22456, 24008, 32394, 34497, 34818, 35183, 35640, 37169, 39268, 49471, 50246, 51707, 52794, 53812, 57267, 62965, 66414, 68416, 75032, 77135, 84867, 86953, 89056, 90334, 93654 ], level:= 4, next:= [ 26394, 26403, 26417, 26382, 26388, 26410, 26408, 26399, 26406, 26390, 26376, 26402, 26397, 26415, 26404, 26396, 26391, 26413, 26395, 26398, 26411, 26401, 26418, 26393, 26385, 26412, 26409, 26405, 26407, 26416, 26400, 26414, 26379, 26392 ] ) ] ), rec( fp:= [ 6681, 64546, 87916 ], next:= [ rec( fp:= [ 305, 4516, 5984, 8497, 12252, 42426, 43829, 56060, 68291, 69792, 74003, 81739, 82023, 86234, 89203, 95755, 97424 ], level:= 4, next:= [ rec( fp:= [ 9915, 19506, 20288, 38032, 81985, 90618, 94996, 97525 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56239, 56222 ] ), rec( desc:= [ 111003 ], fp:= [ 4, 212 ], next:= [ 56209, 56210 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56252, 56253 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56238, 56223 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56272, 56273 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56246, 56247 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56233, 56282 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56232, 56283 ] ) ] ), rec( fp:= [ 13970, 21986, 69906, 90790 ], next:= [ rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56259, 56276 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56262, 56278 ] ), 56219, 56312 ] ), rec( fp:= [ 19331, 56721 ], next:= [ 56317, 56318 ] ), 56206, rec( fp:= [ 31761, 36613 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56189, 56198 ] ), rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56186, 56180 ] ) ] ), rec( fp:= [ 4355, 44735 ], next:= [ 56183, 56192 ] ), rec( fp:= [ 42282, 55213, 80027 ], next:= [ rec( desc:= [ 108003 ], fp:= [ 4, 14 ], next:= [ 56311, 56309 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 14 ], next:= [ 56307, 56306 ] ), rec( desc:= [ 108003 ], fp:= [ 4, 14 ], next:= [ 56310, 56308 ] ) ] ), rec( fp:= [ 17548, 47856, 49766, 56492, 58399, 84815 ], next:= [ rec( desc:= [ 108003 ], fp:= [ 16, 412 ], next:= [ 56266, 56290 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56295, 56242 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56269, 56305 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56296, 56243 ] ), rec( desc:= [ 111003 ], fp:= [ 2, 12 ], next:= [ 56302, 56218 ] ), rec( desc:= [ 111003 ], fp:= [ 214, 412 ], next:= [ 56301, 56217 ] ) ] ), rec( fp:= [ 54978, 88261, 92569, 97018 ], next:= [ 56221, 56314, rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56261, 56281 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56260, 56280 ] ) ] ), rec( fp:= [ 37837, 58250, 58756, 60779, 66473, 82961 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56292, 56240 ] ), rec( desc:= [ 108003 ], fp:= [ 4, 212 ], next:= [ 56265, 56289 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56294, 56245 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56268, 56303 ] ), rec( desc:= [ 110003 ], fp:= [ 214, 412 ], next:= [ 56298, 56214 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56300, 56216 ] ) ] ), rec( fp:= [ 26537, 39417, 66037, 98599 ], next:= [ rec( desc:= [ 110003 ], fp:= [ 6, 214, 412 ], next:= [ 56241, rec( desc:= [ 302009, 210002 ], fp:= [ 4, 14 ], next:= [ 56297, 56291 ] ), 56213 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56267, 56304 ] ), rec( desc:= [ 111003 ], fp:= [ 6, 214, 412 ], next:= [ 56244, rec( desc:= [ 302008, 211002 ], fp:= [ 4, 14 ], next:= [ 56299, 56293 ] ), 56215 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56264, 56288 ] ) ] ), rec( fp:= [ 5214, 28741 ], next:= [ 56201, rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56204, 56195 ] ) ] ), rec( fp:= [ 11551, 17880, 28293, 67663, 77012, 79789, 96420, 98369 ], next:= [ rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56255, 56257 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56234, 56227 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56208, 56211 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56228, 56287 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56236, 56225 ] ), rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56271, 56274 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56249, 56251 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56230, 56285 ] ) ] ), rec( fp:= [ 25, 21820, 32611, 41733, 62165, 65069, 77630, 87058 ], next:= [ rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56254, 56256 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56235, 56226 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56248, 56250 ] ), rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56270, 56275 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56237, 56224 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56207, 56212 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56229, 56286 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56231, 56284 ] ) ] ), rec( fp:= [ 7548, 90187 ], next:= [ 56322, 56321 ] ), rec( fp:= [ 3000, 34505, 70825, 97607 ], next:= [ 56313, 56220, rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56258, 56277 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56263, 56279 ] ) ] ), rec( fp:= [ 48615, 73893, 79848, 89179 ], next:= [ 56316, 56320, 56319, 56315 ] ) ] ), rec( fp:= [ 17834, 65569, 91532, 91988 ], level:= 4, next:= [ rec( fp:= [ 1366, 22098 ], next:= [ 56191, 56182 ] ), rec( fp:= [ 27997, 44842 ], next:= [ 56200, rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56203, 56194 ] ) ] ), rec( fp:= [ 43180, 53294 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56188, 56197 ] ), rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56185, 56179 ] ) ] ), 56205 ] ), rec( fp:= [ 30970, 43201, 55432 ], level:= 4, next:= [ rec( fp:= [ 4290, 67867 ], next:= [ rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56202, 56193 ] ), 56199 ] ), rec( fp:= [ 79486, 99435 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56184, 56178 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56187, 56196 ] ) ] ), rec( fp:= [ 27006, 95627 ], next:= [ 56190, 56181 ] ) ] ) ] ), rec( fp:= [ 6547, 50040, 59410 ], next:= [ rec( fp:= [ 730, 5748, 22057, 24234, 26608, 29697, 33550, 39620, 46693, 54488, 55489, 55680, 57802, 59062, 60652, 64542, 70776, 71718, 72652, 88399, 91941, 97393, 98202, 98223 ], level:= 4, next:= [ rec( fp:= [ 13121, 16308, 48403, 86135 ], next:= [ 137172, 137184, 137167, 137179 ] ), 137213, rec( fp:= [ 32853, 43477, 70610, 85718 ], next:= [ 137168, 137183, 137180, 137171 ] ), 137162, rec( fp:= [ 11617, 58708, 85827 ], next:= [ 137177, 137174, 137186 ] ), 137190, rec( fp:= [ 11676, 21770, 29485, 29616, 47352, 63092, 71652, 72714, 95634, 95910 ], next:= [ 137165, 137195, 137193, 137164, 137191, 137192, 137196, 137163, 137166, 137194 ] ), rec( fp:= [ 794, 15203, 19624 ], next:= [ 137209, 137207, 137211 ] ), rec( fp:= [ 9371, 18136, 55564 ], next:= [ 137203, 137204, 137205 ] ), rec( fp:= [ 25034, 50802, 79312 ], next:= [ 137178, 137173, 137185 ] ), 137188, rec( fp:= [ 33213, 42921, 89828, 96910 ], next:= [ 137198, 137197, 137200, 137199 ] ), 137158, 137160, 137201, 137189, 137206, 137202, rec( fp:= [ 34032, 43770, 74772, 92594 ], next:= [ 137182, 137170, 137169, 137181 ] ), rec( fp:= [ 8404, 55058, 96050 ], next:= [ 137208, 137212, 137210 ] ), rec( fp:= [ 32138, 47429, 96875 ], next:= [ 137150, 137156, 137144 ] ), 137153, rec( fp:= [ 3615, 31020, 83090 ], next:= [ 137176, 137175, 137187 ] ), 137147 ] ), rec( fp:= [ 4414, 17226, 19254, 25243, 44835, 53887 ], level:= 4, next:= [ 137157, rec( fp:= [ 31790, 77214, 96559 ], next:= [ 137149, 137155, 137143 ] ), 137159, 137152, 137146, 137161 ] ), rec( fp:= [ 28392, 43161, 83740 ], level:= 4, next:= [ rec( fp:= [ 32921, 75208, 93178 ], next:= [ 137148, 137142, 137154 ] ), 137151, 137145 ] ) ] ), rec( fp:= [ 1924, 21341, 61695 ], next:= [ rec( fp:= [ 33529, 49275, 53091 ], level:= 4, next:= [ rec( fp:= [ 42323, 50411, 72124, 76311, 91215, 98569 ], next:= [ 199547, 199556, 199568, rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199538, 199562 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199565, 199550 ] ), 199544 ] ), 199559, rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199553, 199541 ] ) ] ), rec( fp:= [ 955, 5213, 6053, 10304, 27180, 28614, 33187, 43095, 50736, 60442, 71691, 77821, 85894 ], level:= 4, next:= [ rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199623, 199624 ] ), rec( fp:= [ 44003, 58259, 77604, 81834, 86136, 86558 ], next:= [ 199549, 199558, 199570, rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199540, 199564 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199567, 199552 ] ), 199546 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199619, 199621 ] ), rec( fp:= [ 7507, 11429, 19556, 32284, 47121, 50759, 63362, 89984 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199686, 199572 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199647, 199636 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199626, 199616 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199602, 199584 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199629, 199618 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199599, 199587 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199644, 199634 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199683, 199575 ] ) ] ), rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199555, 199543 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199620, 199622 ] ), rec( fp:= [ 15429, 15852, 21044, 21942, 45967, 52127, 79075, 84943 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199648, 199635 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199598, 199588 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199682, 199576 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199603, 199583 ] ), rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 199687, 199571 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199643, 199633 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199625, 199615 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199630, 199617 ] ) ] ), rec( fp:= [ 968, 8858, 28596, 61153, 77771, 95146 ], next:= [ 199638, 199637, 199592, 199591, rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 199580, 199579 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199650, 199649 ] ) ] ), rec( fp:= [ 46519, 53405, 71782, 71916, 74493, 77454 ], next:= [ 199589, 199639, rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199582, 199577 ] ), 199641, rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199653, 199651 ] ), 199594 ] ), rec( fp:= [ 610, 3660, 6281, 8517, 9844, 11873, 15485, 16952, 17208, 20864, 26001, 37109, 37251, 42622, 44272, 45483, 45723, 49567, 55465, 60209, 61806, 63189, 63369, 64776, 71295, 80319, 86987, 87028, 91745, 92627 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 13, 211 ], next:= [ 199691, 199657 ] ), rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199671, 199605 ] ), 199612, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199694, 199595 ] ), 199680, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199670, 199606 ] ), 199677, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199669, 199607 ] ), rec( desc:= [ 108003 ], fp:= [ 13, 211 ], next:= [ 199688, 199660 ] ), 199674, 199610, rec( desc:= [ 107003 ], fp:= [ 13, 211 ], next:= [ 199690, 199658 ] ), 199679, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199672, 199604 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 199662, 199665 ] ), 199681, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199696, 199597 ] ), 199611, 199675, 199676, rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199659, 199689 ] ), rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199655, 199693 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 199656, 199692 ] ), 199678, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199695, 199596 ] ), rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199661, 199666 ] ), 199673, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199667, 199609 ] ), rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199668, 199608 ] ), rec( desc:= [ 108003 ], fp:= [ 14, 212 ], next:= [ 199663, 199664 ] ) ] ), rec( fp:= [ 5149, 12028, 18805, 36220, 60000, 69285, 78858, 87716 ], next:= [ rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199627, 199613 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199685, 199573 ] ), rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199646, 199632 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199601, 199585 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199684, 199574 ] ), rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199645, 199631 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199628, 199614 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199600, 199586 ] ) ] ), 199561, rec( fp:= [ 12610, 52211, 55363, 72350, 81388, 82402 ], next:= [ 199642, 199590, 199593, 199640, rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199654, 199652 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199581, 199578 ] ) ] ) ] ), rec( fp:= [ 10653, 86644, 94749 ], level:= 4, next:= [ rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199554, 199542 ] ), rec( fp:= [ 12614, 27833, 45521, 60556, 64804, 77586 ], next:= [ rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199539, 199563 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199566, 199551 ] ), 199569, 199545, 199557, 199548 ] ), 199560 ] ) ] ) ] );
30393
############################################################################# ## #W id1920.adb GAP library of id's <NAME> ## ID_GROUP_TREE.next[1920].next[1].next[106]:= rec( fp:= [ 106, 606, 1106, 1606, 2106 ], next:= [ rec( fp:= [ 31719, 91192, 91483 ], next:= [ rec( fp:= [ 1799, 4105, 15665, 22211, 32867, 42806, 60681, 63076, 63307, 80381, 91343, 92866 ], level:= 4, next:= [ 4389, 4378, 4385, 4390, 4392, 4391, 4383, 4387, 4393, 4394, 4388, 4381 ] ), rec( fp:= [ 23910, 82038 ], level:= 4, next:= [ 4376, 4379 ] ), rec( fp:= [ 5894, 24611, 32022, 36913, 67696 ], level:= 4, next:= [ 4384, 4382, 4386, 4380, 4377 ] ) ] ), rec( fp:= [ 3596, 46537, 65954 ], next:= [ rec( fp:= [ 17955, 21825, 28894, 64608, 84112, 91091 ], level:= 4, next:= [ 26389, 26387, 26381, 26378, 26375, 26384 ] ), rec( fp:= [ 3258, 55402, 63317, 89321, 91884 ], level:= 4, next:= [ 26374, 26383, 26377, 26386, 26380 ] ), rec( fp:= [ 260, 1163, 2317, 11444, 13368, 15475, 18937, 21312, 22246, 22456, 24008, 32394, 34497, 34818, 35183, 35640, 37169, 39268, 49471, 50246, 51707, 52794, 53812, 57267, 62965, 66414, 68416, 75032, 77135, 84867, 86953, 89056, 90334, 93654 ], level:= 4, next:= [ 26394, 26403, 26417, 26382, 26388, 26410, 26408, 26399, 26406, 26390, 26376, 26402, 26397, 26415, 26404, 26396, 26391, 26413, 26395, 26398, 26411, 26401, 26418, 26393, 26385, 26412, 26409, 26405, 26407, 26416, 26400, 26414, 26379, 26392 ] ) ] ), rec( fp:= [ 6681, 64546, 87916 ], next:= [ rec( fp:= [ 305, 4516, 5984, 8497, 12252, 42426, 43829, 56060, 68291, 69792, 74003, 81739, 82023, 86234, 89203, 95755, 97424 ], level:= 4, next:= [ rec( fp:= [ 9915, 19506, 20288, 38032, 81985, 90618, 94996, 97525 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56239, 56222 ] ), rec( desc:= [ 111003 ], fp:= [ 4, 212 ], next:= [ 56209, 56210 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56252, 56253 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56238, 56223 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56272, 56273 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56246, 56247 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56233, 56282 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56232, 56283 ] ) ] ), rec( fp:= [ 13970, 21986, 69906, 90790 ], next:= [ rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56259, 56276 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56262, 56278 ] ), 56219, 56312 ] ), rec( fp:= [ 19331, 56721 ], next:= [ 56317, 56318 ] ), 56206, rec( fp:= [ 31761, 36613 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56189, 56198 ] ), rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56186, 56180 ] ) ] ), rec( fp:= [ 4355, 44735 ], next:= [ 56183, 56192 ] ), rec( fp:= [ 42282, 55213, 80027 ], next:= [ rec( desc:= [ 108003 ], fp:= [ 4, 14 ], next:= [ 56311, 56309 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 14 ], next:= [ 56307, 56306 ] ), rec( desc:= [ 108003 ], fp:= [ 4, 14 ], next:= [ 56310, 56308 ] ) ] ), rec( fp:= [ 17548, 47856, 49766, 56492, 58399, 84815 ], next:= [ rec( desc:= [ 108003 ], fp:= [ 16, 412 ], next:= [ 56266, 56290 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56295, 56242 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56269, 56305 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56296, 56243 ] ), rec( desc:= [ 111003 ], fp:= [ 2, 12 ], next:= [ 56302, 56218 ] ), rec( desc:= [ 111003 ], fp:= [ 214, 412 ], next:= [ 56301, 56217 ] ) ] ), rec( fp:= [ 54978, 88261, 92569, 97018 ], next:= [ 56221, 56314, rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56261, 56281 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56260, 56280 ] ) ] ), rec( fp:= [ 37837, 58250, 58756, 60779, 66473, 82961 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56292, 56240 ] ), rec( desc:= [ 108003 ], fp:= [ 4, 212 ], next:= [ 56265, 56289 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56294, 56245 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56268, 56303 ] ), rec( desc:= [ 110003 ], fp:= [ 214, 412 ], next:= [ 56298, 56214 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56300, 56216 ] ) ] ), rec( fp:= [ 26537, 39417, 66037, 98599 ], next:= [ rec( desc:= [ 110003 ], fp:= [ 6, 214, 412 ], next:= [ 56241, rec( desc:= [ 302009, 210002 ], fp:= [ 4, 14 ], next:= [ 56297, 56291 ] ), 56213 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56267, 56304 ] ), rec( desc:= [ 111003 ], fp:= [ 6, 214, 412 ], next:= [ 56244, rec( desc:= [ 302008, 211002 ], fp:= [ 4, 14 ], next:= [ 56299, 56293 ] ), 56215 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56264, 56288 ] ) ] ), rec( fp:= [ 5214, 28741 ], next:= [ 56201, rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56204, 56195 ] ) ] ), rec( fp:= [ 11551, 17880, 28293, 67663, 77012, 79789, 96420, 98369 ], next:= [ rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56255, 56257 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56234, 56227 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56208, 56211 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56228, 56287 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56236, 56225 ] ), rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56271, 56274 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56249, 56251 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56230, 56285 ] ) ] ), rec( fp:= [ 25, 21820, 32611, 41733, 62165, 65069, 77630, 87058 ], next:= [ rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56254, 56256 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56235, 56226 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56248, 56250 ] ), rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56270, 56275 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56237, 56224 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56207, 56212 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56229, 56286 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56231, 56284 ] ) ] ), rec( fp:= [ 7548, 90187 ], next:= [ 56322, 56321 ] ), rec( fp:= [ 3000, 34505, 70825, 97607 ], next:= [ 56313, 56220, rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56258, 56277 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56263, 56279 ] ) ] ), rec( fp:= [ 48615, 73893, 79848, 89179 ], next:= [ 56316, 56320, 56319, 56315 ] ) ] ), rec( fp:= [ 17834, 65569, 91532, 91988 ], level:= 4, next:= [ rec( fp:= [ 1366, 22098 ], next:= [ 56191, 56182 ] ), rec( fp:= [ 27997, 44842 ], next:= [ 56200, rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56203, 56194 ] ) ] ), rec( fp:= [ 43180, 53294 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56188, 56197 ] ), rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56185, 56179 ] ) ] ), 56205 ] ), rec( fp:= [ 30970, 43201, 55432 ], level:= 4, next:= [ rec( fp:= [ 4290, 67867 ], next:= [ rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56202, 56193 ] ), 56199 ] ), rec( fp:= [ 79486, 99435 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56184, 56178 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56187, 56196 ] ) ] ), rec( fp:= [ 27006, 95627 ], next:= [ 56190, 56181 ] ) ] ) ] ), rec( fp:= [ 6547, 50040, 59410 ], next:= [ rec( fp:= [ 730, 5748, 22057, 24234, 26608, 29697, 33550, 39620, 46693, 54488, 55489, 55680, 57802, 59062, 60652, 64542, 70776, 71718, 72652, 88399, 91941, 97393, 98202, 98223 ], level:= 4, next:= [ rec( fp:= [ 13121, 16308, 48403, 86135 ], next:= [ 137172, 137184, 137167, 137179 ] ), 137213, rec( fp:= [ 32853, 43477, 70610, 85718 ], next:= [ 137168, 137183, 137180, 137171 ] ), 137162, rec( fp:= [ 11617, 58708, 85827 ], next:= [ 137177, 137174, 137186 ] ), 137190, rec( fp:= [ 11676, 21770, 29485, 29616, 47352, 63092, 71652, 72714, 95634, 95910 ], next:= [ 137165, 137195, 137193, 137164, 137191, 137192, 137196, 137163, 137166, 137194 ] ), rec( fp:= [ 794, 15203, 19624 ], next:= [ 137209, 137207, 137211 ] ), rec( fp:= [ 9371, 18136, 55564 ], next:= [ 137203, 137204, 137205 ] ), rec( fp:= [ 25034, 50802, 79312 ], next:= [ 137178, 137173, 137185 ] ), 137188, rec( fp:= [ 33213, 42921, 89828, 96910 ], next:= [ 137198, 137197, 137200, 137199 ] ), 137158, 137160, 137201, 137189, 137206, 137202, rec( fp:= [ 34032, 43770, 74772, 92594 ], next:= [ 137182, 137170, 137169, 137181 ] ), rec( fp:= [ 8404, 55058, 96050 ], next:= [ 137208, 137212, 137210 ] ), rec( fp:= [ 32138, 47429, 96875 ], next:= [ 137150, 137156, 137144 ] ), 137153, rec( fp:= [ 3615, 31020, 83090 ], next:= [ 137176, 137175, 137187 ] ), 137147 ] ), rec( fp:= [ 4414, 17226, 19254, 25243, 44835, 53887 ], level:= 4, next:= [ 137157, rec( fp:= [ 31790, 77214, 96559 ], next:= [ 137149, 137155, 137143 ] ), 137159, 137152, 137146, 137161 ] ), rec( fp:= [ 28392, 43161, 83740 ], level:= 4, next:= [ rec( fp:= [ 32921, 75208, 93178 ], next:= [ 137148, 137142, 137154 ] ), 137151, 137145 ] ) ] ), rec( fp:= [ 1924, 21341, 61695 ], next:= [ rec( fp:= [ 33529, 49275, 53091 ], level:= 4, next:= [ rec( fp:= [ 42323, 50411, 72124, 76311, 91215, 98569 ], next:= [ 199547, 199556, 199568, rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199538, 199562 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199565, 199550 ] ), 199544 ] ), 199559, rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199553, 199541 ] ) ] ), rec( fp:= [ 955, 5213, 6053, 10304, 27180, 28614, 33187, 43095, 50736, 60442, 71691, 77821, 85894 ], level:= 4, next:= [ rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199623, 199624 ] ), rec( fp:= [ 44003, 58259, 77604, 81834, 86136, 86558 ], next:= [ 199549, 199558, 199570, rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199540, 199564 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199567, 199552 ] ), 199546 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199619, 199621 ] ), rec( fp:= [ 7507, 11429, 19556, 32284, 47121, 50759, 63362, 89984 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199686, 199572 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199647, 199636 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199626, 199616 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199602, 199584 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199629, 199618 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199599, 199587 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199644, 199634 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199683, 199575 ] ) ] ), rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199555, 199543 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199620, 199622 ] ), rec( fp:= [ 15429, 15852, 21044, 21942, 45967, 52127, 79075, 84943 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199648, 199635 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199598, 199588 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199682, 199576 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199603, 199583 ] ), rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 199687, 199571 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199643, 199633 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199625, 199615 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199630, 199617 ] ) ] ), rec( fp:= [ 968, 8858, 28596, 61153, 77771, 95146 ], next:= [ 199638, 199637, 199592, 199591, rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 199580, 199579 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199650, 199649 ] ) ] ), rec( fp:= [ 46519, 53405, 71782, 71916, 74493, 77454 ], next:= [ 199589, 199639, rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199582, 199577 ] ), 199641, rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199653, 199651 ] ), 199594 ] ), rec( fp:= [ 610, 3660, 6281, 8517, 9844, 11873, 15485, 16952, 17208, 20864, 26001, 37109, 37251, 42622, 44272, 45483, 45723, 49567, 55465, 60209, 61806, 63189, 63369, 64776, 71295, 80319, 86987, 87028, 91745, 92627 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 13, 211 ], next:= [ 199691, 199657 ] ), rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199671, 199605 ] ), 199612, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199694, 199595 ] ), 199680, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199670, 199606 ] ), 199677, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199669, 199607 ] ), rec( desc:= [ 108003 ], fp:= [ 13, 211 ], next:= [ 199688, 199660 ] ), 199674, 199610, rec( desc:= [ 107003 ], fp:= [ 13, 211 ], next:= [ 199690, 199658 ] ), 199679, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199672, 199604 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 199662, 199665 ] ), 199681, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199696, 199597 ] ), 199611, 199675, 199676, rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199659, 199689 ] ), rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199655, 199693 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 199656, 199692 ] ), 199678, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199695, 199596 ] ), rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199661, 199666 ] ), 199673, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199667, 199609 ] ), rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199668, 199608 ] ), rec( desc:= [ 108003 ], fp:= [ 14, 212 ], next:= [ 199663, 199664 ] ) ] ), rec( fp:= [ 5149, 12028, 18805, 36220, 60000, 69285, 78858, 87716 ], next:= [ rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199627, 199613 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199685, 199573 ] ), rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199646, 199632 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199601, 199585 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199684, 199574 ] ), rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199645, 199631 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199628, 199614 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199600, 199586 ] ) ] ), 199561, rec( fp:= [ 12610, 52211, 55363, 72350, 81388, 82402 ], next:= [ 199642, 199590, 199593, 199640, rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199654, 199652 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199581, 199578 ] ) ] ) ] ), rec( fp:= [ 10653, 86644, 94749 ], level:= 4, next:= [ rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199554, 199542 ] ), rec( fp:= [ 12614, 27833, 45521, 60556, 64804, 77586 ], next:= [ rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199539, 199563 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199566, 199551 ] ), 199569, 199545, 199557, 199548 ] ), 199560 ] ) ] ) ] );
true
############################################################################# ## #W id1920.adb GAP library of id's PI:NAME:<NAME>END_PI ## ID_GROUP_TREE.next[1920].next[1].next[106]:= rec( fp:= [ 106, 606, 1106, 1606, 2106 ], next:= [ rec( fp:= [ 31719, 91192, 91483 ], next:= [ rec( fp:= [ 1799, 4105, 15665, 22211, 32867, 42806, 60681, 63076, 63307, 80381, 91343, 92866 ], level:= 4, next:= [ 4389, 4378, 4385, 4390, 4392, 4391, 4383, 4387, 4393, 4394, 4388, 4381 ] ), rec( fp:= [ 23910, 82038 ], level:= 4, next:= [ 4376, 4379 ] ), rec( fp:= [ 5894, 24611, 32022, 36913, 67696 ], level:= 4, next:= [ 4384, 4382, 4386, 4380, 4377 ] ) ] ), rec( fp:= [ 3596, 46537, 65954 ], next:= [ rec( fp:= [ 17955, 21825, 28894, 64608, 84112, 91091 ], level:= 4, next:= [ 26389, 26387, 26381, 26378, 26375, 26384 ] ), rec( fp:= [ 3258, 55402, 63317, 89321, 91884 ], level:= 4, next:= [ 26374, 26383, 26377, 26386, 26380 ] ), rec( fp:= [ 260, 1163, 2317, 11444, 13368, 15475, 18937, 21312, 22246, 22456, 24008, 32394, 34497, 34818, 35183, 35640, 37169, 39268, 49471, 50246, 51707, 52794, 53812, 57267, 62965, 66414, 68416, 75032, 77135, 84867, 86953, 89056, 90334, 93654 ], level:= 4, next:= [ 26394, 26403, 26417, 26382, 26388, 26410, 26408, 26399, 26406, 26390, 26376, 26402, 26397, 26415, 26404, 26396, 26391, 26413, 26395, 26398, 26411, 26401, 26418, 26393, 26385, 26412, 26409, 26405, 26407, 26416, 26400, 26414, 26379, 26392 ] ) ] ), rec( fp:= [ 6681, 64546, 87916 ], next:= [ rec( fp:= [ 305, 4516, 5984, 8497, 12252, 42426, 43829, 56060, 68291, 69792, 74003, 81739, 82023, 86234, 89203, 95755, 97424 ], level:= 4, next:= [ rec( fp:= [ 9915, 19506, 20288, 38032, 81985, 90618, 94996, 97525 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56239, 56222 ] ), rec( desc:= [ 111003 ], fp:= [ 4, 212 ], next:= [ 56209, 56210 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56252, 56253 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56238, 56223 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56272, 56273 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56246, 56247 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56233, 56282 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56232, 56283 ] ) ] ), rec( fp:= [ 13970, 21986, 69906, 90790 ], next:= [ rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56259, 56276 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56262, 56278 ] ), 56219, 56312 ] ), rec( fp:= [ 19331, 56721 ], next:= [ 56317, 56318 ] ), 56206, rec( fp:= [ 31761, 36613 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56189, 56198 ] ), rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56186, 56180 ] ) ] ), rec( fp:= [ 4355, 44735 ], next:= [ 56183, 56192 ] ), rec( fp:= [ 42282, 55213, 80027 ], next:= [ rec( desc:= [ 108003 ], fp:= [ 4, 14 ], next:= [ 56311, 56309 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 14 ], next:= [ 56307, 56306 ] ), rec( desc:= [ 108003 ], fp:= [ 4, 14 ], next:= [ 56310, 56308 ] ) ] ), rec( fp:= [ 17548, 47856, 49766, 56492, 58399, 84815 ], next:= [ rec( desc:= [ 108003 ], fp:= [ 16, 412 ], next:= [ 56266, 56290 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56295, 56242 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56269, 56305 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56296, 56243 ] ), rec( desc:= [ 111003 ], fp:= [ 2, 12 ], next:= [ 56302, 56218 ] ), rec( desc:= [ 111003 ], fp:= [ 214, 412 ], next:= [ 56301, 56217 ] ) ] ), rec( fp:= [ 54978, 88261, 92569, 97018 ], next:= [ 56221, 56314, rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56261, 56281 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56260, 56280 ] ) ] ), rec( fp:= [ 37837, 58250, 58756, 60779, 66473, 82961 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56292, 56240 ] ), rec( desc:= [ 108003 ], fp:= [ 4, 212 ], next:= [ 56265, 56289 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56294, 56245 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56268, 56303 ] ), rec( desc:= [ 110003 ], fp:= [ 214, 412 ], next:= [ 56298, 56214 ] ), rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56300, 56216 ] ) ] ), rec( fp:= [ 26537, 39417, 66037, 98599 ], next:= [ rec( desc:= [ 110003 ], fp:= [ 6, 214, 412 ], next:= [ 56241, rec( desc:= [ 302009, 210002 ], fp:= [ 4, 14 ], next:= [ 56297, 56291 ] ), 56213 ] ), rec( desc:= [ 106003 ], fp:= [ 4, 14 ], next:= [ 56267, 56304 ] ), rec( desc:= [ 111003 ], fp:= [ 6, 214, 412 ], next:= [ 56244, rec( desc:= [ 302008, 211002 ], fp:= [ 4, 14 ], next:= [ 56299, 56293 ] ), 56215 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56264, 56288 ] ) ] ), rec( fp:= [ 5214, 28741 ], next:= [ 56201, rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56204, 56195 ] ) ] ), rec( fp:= [ 11551, 17880, 28293, 67663, 77012, 79789, 96420, 98369 ], next:= [ rec( desc:= [ 110003 ], fp:= [ 2, 12 ], next:= [ 56255, 56257 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56234, 56227 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56208, 56211 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56228, 56287 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56236, 56225 ] ), rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56271, 56274 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56249, 56251 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56230, 56285 ] ) ] ), rec( fp:= [ 25, 21820, 32611, 41733, 62165, 65069, 77630, 87058 ], next:= [ rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56254, 56256 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56235, 56226 ] ), rec( desc:= [ 109003 ], fp:= [ 4, 212 ], next:= [ 56248, 56250 ] ), rec( desc:= [ 109003 ], fp:= [ 2, 12 ], next:= [ 56270, 56275 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 56237, 56224 ] ), rec( desc:= [ 110003 ], fp:= [ 4, 212 ], next:= [ 56207, 56212 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56229, 56286 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56231, 56284 ] ) ] ), rec( fp:= [ 7548, 90187 ], next:= [ 56322, 56321 ] ), rec( fp:= [ 3000, 34505, 70825, 97607 ], next:= [ 56313, 56220, rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56258, 56277 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 56263, 56279 ] ) ] ), rec( fp:= [ 48615, 73893, 79848, 89179 ], next:= [ 56316, 56320, 56319, 56315 ] ) ] ), rec( fp:= [ 17834, 65569, 91532, 91988 ], level:= 4, next:= [ rec( fp:= [ 1366, 22098 ], next:= [ 56191, 56182 ] ), rec( fp:= [ 27997, 44842 ], next:= [ 56200, rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56203, 56194 ] ) ] ), rec( fp:= [ 43180, 53294 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56188, 56197 ] ), rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56185, 56179 ] ) ] ), 56205 ] ), rec( fp:= [ 30970, 43201, 55432 ], level:= 4, next:= [ rec( fp:= [ 4290, 67867 ], next:= [ rec( desc:= [ 106003 ], fp:= [ 16, 412 ], next:= [ 56202, 56193 ] ), 56199 ] ), rec( fp:= [ 79486, 99435 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 414, 612 ], next:= [ 56184, 56178 ] ), rec( desc:= [ 107003 ], fp:= [ 4, 212 ], next:= [ 56187, 56196 ] ) ] ), rec( fp:= [ 27006, 95627 ], next:= [ 56190, 56181 ] ) ] ) ] ), rec( fp:= [ 6547, 50040, 59410 ], next:= [ rec( fp:= [ 730, 5748, 22057, 24234, 26608, 29697, 33550, 39620, 46693, 54488, 55489, 55680, 57802, 59062, 60652, 64542, 70776, 71718, 72652, 88399, 91941, 97393, 98202, 98223 ], level:= 4, next:= [ rec( fp:= [ 13121, 16308, 48403, 86135 ], next:= [ 137172, 137184, 137167, 137179 ] ), 137213, rec( fp:= [ 32853, 43477, 70610, 85718 ], next:= [ 137168, 137183, 137180, 137171 ] ), 137162, rec( fp:= [ 11617, 58708, 85827 ], next:= [ 137177, 137174, 137186 ] ), 137190, rec( fp:= [ 11676, 21770, 29485, 29616, 47352, 63092, 71652, 72714, 95634, 95910 ], next:= [ 137165, 137195, 137193, 137164, 137191, 137192, 137196, 137163, 137166, 137194 ] ), rec( fp:= [ 794, 15203, 19624 ], next:= [ 137209, 137207, 137211 ] ), rec( fp:= [ 9371, 18136, 55564 ], next:= [ 137203, 137204, 137205 ] ), rec( fp:= [ 25034, 50802, 79312 ], next:= [ 137178, 137173, 137185 ] ), 137188, rec( fp:= [ 33213, 42921, 89828, 96910 ], next:= [ 137198, 137197, 137200, 137199 ] ), 137158, 137160, 137201, 137189, 137206, 137202, rec( fp:= [ 34032, 43770, 74772, 92594 ], next:= [ 137182, 137170, 137169, 137181 ] ), rec( fp:= [ 8404, 55058, 96050 ], next:= [ 137208, 137212, 137210 ] ), rec( fp:= [ 32138, 47429, 96875 ], next:= [ 137150, 137156, 137144 ] ), 137153, rec( fp:= [ 3615, 31020, 83090 ], next:= [ 137176, 137175, 137187 ] ), 137147 ] ), rec( fp:= [ 4414, 17226, 19254, 25243, 44835, 53887 ], level:= 4, next:= [ 137157, rec( fp:= [ 31790, 77214, 96559 ], next:= [ 137149, 137155, 137143 ] ), 137159, 137152, 137146, 137161 ] ), rec( fp:= [ 28392, 43161, 83740 ], level:= 4, next:= [ rec( fp:= [ 32921, 75208, 93178 ], next:= [ 137148, 137142, 137154 ] ), 137151, 137145 ] ) ] ), rec( fp:= [ 1924, 21341, 61695 ], next:= [ rec( fp:= [ 33529, 49275, 53091 ], level:= 4, next:= [ rec( fp:= [ 42323, 50411, 72124, 76311, 91215, 98569 ], next:= [ 199547, 199556, 199568, rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199538, 199562 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199565, 199550 ] ), 199544 ] ), 199559, rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199553, 199541 ] ) ] ), rec( fp:= [ 955, 5213, 6053, 10304, 27180, 28614, 33187, 43095, 50736, 60442, 71691, 77821, 85894 ], level:= 4, next:= [ rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199623, 199624 ] ), rec( fp:= [ 44003, 58259, 77604, 81834, 86136, 86558 ], next:= [ 199549, 199558, 199570, rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199540, 199564 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199567, 199552 ] ), 199546 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199619, 199621 ] ), rec( fp:= [ 7507, 11429, 19556, 32284, 47121, 50759, 63362, 89984 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199686, 199572 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199647, 199636 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199626, 199616 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199602, 199584 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199629, 199618 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199599, 199587 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199644, 199634 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199683, 199575 ] ) ] ), rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199555, 199543 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199620, 199622 ] ), rec( fp:= [ 15429, 15852, 21044, 21942, 45967, 52127, 79075, 84943 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199648, 199635 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199598, 199588 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199682, 199576 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199603, 199583 ] ), rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 199687, 199571 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199643, 199633 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199625, 199615 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199630, 199617 ] ) ] ), rec( fp:= [ 968, 8858, 28596, 61153, 77771, 95146 ], next:= [ 199638, 199637, 199592, 199591, rec( desc:= [ 108003 ], fp:= [ 2, 12 ], next:= [ 199580, 199579 ] ), rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199650, 199649 ] ) ] ), rec( fp:= [ 46519, 53405, 71782, 71916, 74493, 77454 ], next:= [ 199589, 199639, rec( desc:= [ 107003 ], fp:= [ 2, 12 ], next:= [ 199582, 199577 ] ), 199641, rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199653, 199651 ] ), 199594 ] ), rec( fp:= [ 610, 3660, 6281, 8517, 9844, 11873, 15485, 16952, 17208, 20864, 26001, 37109, 37251, 42622, 44272, 45483, 45723, 49567, 55465, 60209, 61806, 63189, 63369, 64776, 71295, 80319, 86987, 87028, 91745, 92627 ], next:= [ rec( desc:= [ 107003 ], fp:= [ 13, 211 ], next:= [ 199691, 199657 ] ), rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199671, 199605 ] ), 199612, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199694, 199595 ] ), 199680, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199670, 199606 ] ), 199677, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199669, 199607 ] ), rec( desc:= [ 108003 ], fp:= [ 13, 211 ], next:= [ 199688, 199660 ] ), 199674, 199610, rec( desc:= [ 107003 ], fp:= [ 13, 211 ], next:= [ 199690, 199658 ] ), 199679, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199672, 199604 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 199662, 199665 ] ), 199681, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199696, 199597 ] ), 199611, 199675, 199676, rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199659, 199689 ] ), rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199655, 199693 ] ), rec( desc:= [ 106003 ], fp:= [ 14, 212 ], next:= [ 199656, 199692 ] ), 199678, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199695, 199596 ] ), rec( desc:= [ 107003 ], fp:= [ 14, 212 ], next:= [ 199661, 199666 ] ), 199673, rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199667, 199609 ] ), rec( desc:= [ 105003 ], fp:= [ 2, 12 ], next:= [ 199668, 199608 ] ), rec( desc:= [ 108003 ], fp:= [ 14, 212 ], next:= [ 199663, 199664 ] ) ] ), rec( fp:= [ 5149, 12028, 18805, 36220, 60000, 69285, 78858, 87716 ], next:= [ rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199627, 199613 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199685, 199573 ] ), rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199646, 199632 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199601, 199585 ] ), rec( desc:= [ 108003 ], fp:= [ 15, 213 ], next:= [ 199684, 199574 ] ), rec( desc:= [ 107003 ], fp:= [ 16, 214 ], next:= [ 199645, 199631 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199628, 199614 ] ), rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199600, 199586 ] ) ] ), 199561, rec( fp:= [ 12610, 52211, 55363, 72350, 81388, 82402 ], next:= [ 199642, 199590, 199593, 199640, rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199654, 199652 ] ), rec( desc:= [ 106003 ], fp:= [ 2, 12 ], next:= [ 199581, 199578 ] ) ] ) ] ), rec( fp:= [ 10653, 86644, 94749 ], level:= 4, next:= [ rec( desc:= [ 105003 ], fp:= [ 17, 215 ], next:= [ 199554, 199542 ] ), rec( fp:= [ 12614, 27833, 45521, 60556, 64804, 77586 ], next:= [ rec( desc:= [ 105003 ], fp:= [ 14, 212 ], next:= [ 199539, 199563 ] ), rec( desc:= [ 105003 ], fp:= [ 13, 211 ], next:= [ 199566, 199551 ] ), 199569, 199545, 199557, 199548 ] ), 199560 ] ) ] ) ] );
[ { "context": "---------------------\n-- G E L A A S I S --\n-", "end": 109, "score": 0.8901723623275757, "start": 108, "tag": "NAME", "value": "G" }, { "context": "---------------------\n-- Copyright (c) 2006-2013, Maxim Reznik\n-- All rights reserved.\n--\n-- Redistribution an", "end": 7840, "score": 0.9997578859329224, "start": 7828, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "the distribution.\n-- * Neither the name of the Maxim Reznik, IE nor the names of its\n-- contributors ma", "end": 8441, "score": 0.9994206428527832, "start": 8429, "tag": "NAME", "value": "Maxim Reznik" } ]
tools/xml2ayacc/xml_io/xml_io-internals.ads
faelys/gela-asis
4
------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Finalization; with Encodings.Unicode; with XML_IO.Base_Readers; package XML_IO.Internals is subtype Unicode_Character is Encodings.Unicode.Unicode_Character; Invalid_Character : constant Unicode_Character := Encodings.Unicode.Empty_Buffer; type Character_Class is (' ', -- space, tab, lf, cr '!', '"', '#', '$', -- '&', ''', '-', '.', -- '/', '0', -- 0 .. 9 ';', '<', '=', '>', '?', 'A', -- A .. F a .. f 'X', -- '[', ']', 'x', 'z', -- yz Bad_Character, End_Of_Buffer ); function Get_Class (Char : in Unicode_Character) return Character_Class; type Internal_State is (In_Misc, In_PI, In_Content, In_Comment, In_Element, In_Empty_Element, In_Apostrophes, In_Quotes, In_CD_Start, In_CD); type Token is (Comment_Text_Token, -- ...--> Name_Token, PI_Text_Token, -- ...?> Value_Token, -- ..['"] Char_Data_Token, Entity_Reference_Token, -- &Name; Char_Reference_Token, -- &#...; CData_Token, -- ...]]> Space_Token, Start_Token, -- '<' PI_Token, -- '<?' Doctype_Token, -- '<!' Comment_Token, -- '<!--' Eq_Token, -- '=' Apostrophe_Token, -- ''' Quote_Token, -- '"' PI_End_Token, -- '?>' Empty_End_Token, -- '/>' End_Element_Token, -- '>' End_Token, -- '</' CD_Start_Token, -- '<![' Square_Token, -- '[' End_Of_Buffer, End_Of_File, Error); subtype Text_Token is Token range Comment_Text_Token .. CData_Token; generic with package Readers is new XML_IO.Base_Readers (<>); with procedure Decode (Buffer : in Readers.XML_String; Index : in out Positive; Free : in Positive; Encoding : in Encodings.Encoding; Char : out Unicode_Character); with function To_Encoding (Name : Readers.XML_String) return Encodings.Encoding; type XML_Unbounded is private; with function To_Unbounded_String (Source : in Readers.XML_String) return XML_Unbounded is <>; with function To_String (Source : in XML_Unbounded) return Readers.XML_String is <>; with function "=" (Left : in Readers.XML_String; Right : in XML_Unbounded) return Boolean is <>; with function "&" (Left : in XML_Unbounded; Right : in Readers.XML_String) return XML_Unbounded is <>; with function "&" (Left : in XML_Unbounded; Right : in XML_Unbounded) return XML_Unbounded is <>; with function To_XML_String (Source : in String) return XML_Unbounded is <>; Nil_Literal : in Readers.XML_String; -- ""; package Implementation is subtype XML_String is Readers.XML_String; type Token_Value is private; function Value (Buffer : in XML_String; Data : in Token_Value) return XML_String; type Reader is abstract new Readers.Reader with private; function More_Pieces (Parser : in Reader) return Boolean; function Piece_Kind (Parser : in Reader) return Piece_Kinds; procedure Next (Buffer : in out XML_String; Parser : in out Reader); function Encoding (Parser : in Reader) return Token_Value; function Encoding (Parser : in Reader) return Encodings.Encoding; function Standalone (Parser : in Reader) return Boolean; function Text (Parser : in Reader) return Token_Value; function Name (Parser : in Reader) return Token_Value; function Attribute_Count (Parser : in Reader) return List_Count; function Attribute_Name (Parser : in Reader; Index : in List_Index) return Token_Value; function Attribute_Value (Parser : in Reader; Index : in List_Index) return Token_Value; procedure Initialize (Buffer : in out XML_String; Parser : in out Reader); procedure Read (Parser : in out Reader; Buffer : in out XML_String; Last : out Natural) is abstract; private type Token_Value is record From : Natural; -- 0 if not started To : Natural; -- 0 if not finished Stored : XML_Unbounded; -- saved part end record; type Token_Values is array (List_Index range <>) of Token_Value; type Token_Values_Access is access all Token_Values; Embeded_Attr : constant := 8; type Piece_State (Kind : Piece_Kinds := End_Document) is record case Kind is when Start_Document => Encoding : Token_Value; Standalone : Boolean; when DTD | End_Document => null; when Start_Element | Entity_Reference | End_Element | Processing_Instruction | Attribute | Namespace => Name : Token_Value; case Kind is when Start_Element => Count : List_Count; Names : Token_Values (1 .. Embeded_Attr); Values : Token_Values (1 .. Embeded_Attr); when Processing_Instruction => PI_Text : Token_Value; when Attribute | Namespace => Value : Token_Value; when others => null; end case; when Comment | Characters | CDATA_Section => Text : Token_Value; end case; end record; type Token_Sub_State is range 0 .. 12; type Tokenizer_State is record Kind : Token; Value : Token_Value; Amp : Token_Value; X : Token_Sub_State; Prev : Character_Class; end record; type Input_State is record Index : Positive; Free : Positive; Prev : Positive; Encoding : Encodings.Encoding; end record; type Reader_State is new Ada.Finalization.Limited_Controlled with record Input : Input_State; Token : Tokenizer_State; In_State : Internal_State; Deep : Natural; Piece : Piece_State; Extra_Names : Token_Values_Access; Extra_Values : Token_Values_Access; end record; type Reader is abstract new Readers.Reader with record The : Reader_State; end record; end Implementation; end XML_IO.Internals; ------------------------------------------------------------------------------ -- 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. ------------------------------------------------------------------------------
1694
------------------------------------------------------------------------------ -- <NAME> E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Finalization; with Encodings.Unicode; with XML_IO.Base_Readers; package XML_IO.Internals is subtype Unicode_Character is Encodings.Unicode.Unicode_Character; Invalid_Character : constant Unicode_Character := Encodings.Unicode.Empty_Buffer; type Character_Class is (' ', -- space, tab, lf, cr '!', '"', '#', '$', -- '&', ''', '-', '.', -- '/', '0', -- 0 .. 9 ';', '<', '=', '>', '?', 'A', -- A .. F a .. f 'X', -- '[', ']', 'x', 'z', -- yz Bad_Character, End_Of_Buffer ); function Get_Class (Char : in Unicode_Character) return Character_Class; type Internal_State is (In_Misc, In_PI, In_Content, In_Comment, In_Element, In_Empty_Element, In_Apostrophes, In_Quotes, In_CD_Start, In_CD); type Token is (Comment_Text_Token, -- ...--> Name_Token, PI_Text_Token, -- ...?> Value_Token, -- ..['"] Char_Data_Token, Entity_Reference_Token, -- &Name; Char_Reference_Token, -- &#...; CData_Token, -- ...]]> Space_Token, Start_Token, -- '<' PI_Token, -- '<?' Doctype_Token, -- '<!' Comment_Token, -- '<!--' Eq_Token, -- '=' Apostrophe_Token, -- ''' Quote_Token, -- '"' PI_End_Token, -- '?>' Empty_End_Token, -- '/>' End_Element_Token, -- '>' End_Token, -- '</' CD_Start_Token, -- '<![' Square_Token, -- '[' End_Of_Buffer, End_Of_File, Error); subtype Text_Token is Token range Comment_Text_Token .. CData_Token; generic with package Readers is new XML_IO.Base_Readers (<>); with procedure Decode (Buffer : in Readers.XML_String; Index : in out Positive; Free : in Positive; Encoding : in Encodings.Encoding; Char : out Unicode_Character); with function To_Encoding (Name : Readers.XML_String) return Encodings.Encoding; type XML_Unbounded is private; with function To_Unbounded_String (Source : in Readers.XML_String) return XML_Unbounded is <>; with function To_String (Source : in XML_Unbounded) return Readers.XML_String is <>; with function "=" (Left : in Readers.XML_String; Right : in XML_Unbounded) return Boolean is <>; with function "&" (Left : in XML_Unbounded; Right : in Readers.XML_String) return XML_Unbounded is <>; with function "&" (Left : in XML_Unbounded; Right : in XML_Unbounded) return XML_Unbounded is <>; with function To_XML_String (Source : in String) return XML_Unbounded is <>; Nil_Literal : in Readers.XML_String; -- ""; package Implementation is subtype XML_String is Readers.XML_String; type Token_Value is private; function Value (Buffer : in XML_String; Data : in Token_Value) return XML_String; type Reader is abstract new Readers.Reader with private; function More_Pieces (Parser : in Reader) return Boolean; function Piece_Kind (Parser : in Reader) return Piece_Kinds; procedure Next (Buffer : in out XML_String; Parser : in out Reader); function Encoding (Parser : in Reader) return Token_Value; function Encoding (Parser : in Reader) return Encodings.Encoding; function Standalone (Parser : in Reader) return Boolean; function Text (Parser : in Reader) return Token_Value; function Name (Parser : in Reader) return Token_Value; function Attribute_Count (Parser : in Reader) return List_Count; function Attribute_Name (Parser : in Reader; Index : in List_Index) return Token_Value; function Attribute_Value (Parser : in Reader; Index : in List_Index) return Token_Value; procedure Initialize (Buffer : in out XML_String; Parser : in out Reader); procedure Read (Parser : in out Reader; Buffer : in out XML_String; Last : out Natural) is abstract; private type Token_Value is record From : Natural; -- 0 if not started To : Natural; -- 0 if not finished Stored : XML_Unbounded; -- saved part end record; type Token_Values is array (List_Index range <>) of Token_Value; type Token_Values_Access is access all Token_Values; Embeded_Attr : constant := 8; type Piece_State (Kind : Piece_Kinds := End_Document) is record case Kind is when Start_Document => Encoding : Token_Value; Standalone : Boolean; when DTD | End_Document => null; when Start_Element | Entity_Reference | End_Element | Processing_Instruction | Attribute | Namespace => Name : Token_Value; case Kind is when Start_Element => Count : List_Count; Names : Token_Values (1 .. Embeded_Attr); Values : Token_Values (1 .. Embeded_Attr); when Processing_Instruction => PI_Text : Token_Value; when Attribute | Namespace => Value : Token_Value; when others => null; end case; when Comment | Characters | CDATA_Section => Text : Token_Value; end case; end record; type Token_Sub_State is range 0 .. 12; type Tokenizer_State is record Kind : Token; Value : Token_Value; Amp : Token_Value; X : Token_Sub_State; Prev : Character_Class; end record; type Input_State is record Index : Positive; Free : Positive; Prev : Positive; Encoding : Encodings.Encoding; end record; type Reader_State is new Ada.Finalization.Limited_Controlled with record Input : Input_State; Token : Tokenizer_State; In_State : Internal_State; Deep : Natural; Piece : Piece_State; Extra_Names : Token_Values_Access; Extra_Values : Token_Values_Access; end record; type Reader is abstract new Readers.Reader with record The : Reader_State; end record; end Implementation; end XML_IO.Internals; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- 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 <NAME>, 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. ------------------------------------------------------------------------------
true
------------------------------------------------------------------------------ -- PI:NAME:<NAME>END_PI E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Finalization; with Encodings.Unicode; with XML_IO.Base_Readers; package XML_IO.Internals is subtype Unicode_Character is Encodings.Unicode.Unicode_Character; Invalid_Character : constant Unicode_Character := Encodings.Unicode.Empty_Buffer; type Character_Class is (' ', -- space, tab, lf, cr '!', '"', '#', '$', -- '&', ''', '-', '.', -- '/', '0', -- 0 .. 9 ';', '<', '=', '>', '?', 'A', -- A .. F a .. f 'X', -- '[', ']', 'x', 'z', -- yz Bad_Character, End_Of_Buffer ); function Get_Class (Char : in Unicode_Character) return Character_Class; type Internal_State is (In_Misc, In_PI, In_Content, In_Comment, In_Element, In_Empty_Element, In_Apostrophes, In_Quotes, In_CD_Start, In_CD); type Token is (Comment_Text_Token, -- ...--> Name_Token, PI_Text_Token, -- ...?> Value_Token, -- ..['"] Char_Data_Token, Entity_Reference_Token, -- &Name; Char_Reference_Token, -- &#...; CData_Token, -- ...]]> Space_Token, Start_Token, -- '<' PI_Token, -- '<?' Doctype_Token, -- '<!' Comment_Token, -- '<!--' Eq_Token, -- '=' Apostrophe_Token, -- ''' Quote_Token, -- '"' PI_End_Token, -- '?>' Empty_End_Token, -- '/>' End_Element_Token, -- '>' End_Token, -- '</' CD_Start_Token, -- '<![' Square_Token, -- '[' End_Of_Buffer, End_Of_File, Error); subtype Text_Token is Token range Comment_Text_Token .. CData_Token; generic with package Readers is new XML_IO.Base_Readers (<>); with procedure Decode (Buffer : in Readers.XML_String; Index : in out Positive; Free : in Positive; Encoding : in Encodings.Encoding; Char : out Unicode_Character); with function To_Encoding (Name : Readers.XML_String) return Encodings.Encoding; type XML_Unbounded is private; with function To_Unbounded_String (Source : in Readers.XML_String) return XML_Unbounded is <>; with function To_String (Source : in XML_Unbounded) return Readers.XML_String is <>; with function "=" (Left : in Readers.XML_String; Right : in XML_Unbounded) return Boolean is <>; with function "&" (Left : in XML_Unbounded; Right : in Readers.XML_String) return XML_Unbounded is <>; with function "&" (Left : in XML_Unbounded; Right : in XML_Unbounded) return XML_Unbounded is <>; with function To_XML_String (Source : in String) return XML_Unbounded is <>; Nil_Literal : in Readers.XML_String; -- ""; package Implementation is subtype XML_String is Readers.XML_String; type Token_Value is private; function Value (Buffer : in XML_String; Data : in Token_Value) return XML_String; type Reader is abstract new Readers.Reader with private; function More_Pieces (Parser : in Reader) return Boolean; function Piece_Kind (Parser : in Reader) return Piece_Kinds; procedure Next (Buffer : in out XML_String; Parser : in out Reader); function Encoding (Parser : in Reader) return Token_Value; function Encoding (Parser : in Reader) return Encodings.Encoding; function Standalone (Parser : in Reader) return Boolean; function Text (Parser : in Reader) return Token_Value; function Name (Parser : in Reader) return Token_Value; function Attribute_Count (Parser : in Reader) return List_Count; function Attribute_Name (Parser : in Reader; Index : in List_Index) return Token_Value; function Attribute_Value (Parser : in Reader; Index : in List_Index) return Token_Value; procedure Initialize (Buffer : in out XML_String; Parser : in out Reader); procedure Read (Parser : in out Reader; Buffer : in out XML_String; Last : out Natural) is abstract; private type Token_Value is record From : Natural; -- 0 if not started To : Natural; -- 0 if not finished Stored : XML_Unbounded; -- saved part end record; type Token_Values is array (List_Index range <>) of Token_Value; type Token_Values_Access is access all Token_Values; Embeded_Attr : constant := 8; type Piece_State (Kind : Piece_Kinds := End_Document) is record case Kind is when Start_Document => Encoding : Token_Value; Standalone : Boolean; when DTD | End_Document => null; when Start_Element | Entity_Reference | End_Element | Processing_Instruction | Attribute | Namespace => Name : Token_Value; case Kind is when Start_Element => Count : List_Count; Names : Token_Values (1 .. Embeded_Attr); Values : Token_Values (1 .. Embeded_Attr); when Processing_Instruction => PI_Text : Token_Value; when Attribute | Namespace => Value : Token_Value; when others => null; end case; when Comment | Characters | CDATA_Section => Text : Token_Value; end case; end record; type Token_Sub_State is range 0 .. 12; type Tokenizer_State is record Kind : Token; Value : Token_Value; Amp : Token_Value; X : Token_Sub_State; Prev : Character_Class; end record; type Input_State is record Index : Positive; Free : Positive; Prev : Positive; Encoding : Encodings.Encoding; end record; type Reader_State is new Ada.Finalization.Limited_Controlled with record Input : Input_State; Token : Tokenizer_State; In_State : Internal_State; Deep : Natural; Piece : Piece_State; Extra_Names : Token_Values_Access; Extra_Values : Token_Values_Access; end record; type Reader is abstract new Readers.Reader with record The : Reader_State; end record; end Implementation; end XML_IO.Internals; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, PI:NAME:<NAME>END_PI -- 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 PI:NAME:<NAME>END_PI, 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. ------------------------------------------------------------------------------
[ { "context": "gen, eigendecomposition\n-- Copyright (C) 2008-2018 Jonathan S. Parker.\n--\n-- Permission to use, copy, modify, and/or di", "end": 166, "score": 0.9998841285705566, "start": 148, "tag": "NAME", "value": "Jonathan S. Parker" }, { "context": "hmetic to raise exceptions.\n --\n -- Algorithm by Robert L. Smith. (Supposed to be better at avoiding\n -- unnecess", "end": 1989, "score": 0.9998323917388916, "start": 1974, "tag": "NAME", "value": "Robert L. Smith" }, { "context": "cedure\n -- hqr2, num. math. 16, 181-204(1970) by Peters and Wilkinson.\n -- handbook for auto. comp., vol.ii-linear al", "end": 15708, "score": 0.9692285060882568, "start": 15688, "tag": "NAME", "value": "Peters and Wilkinson" }, { "context": " shift\n\n if Iteration_id mod 14 = 0 then -- Forsythe_0 needs this.\n t := t + x;\n\n fo", "end": 19805, "score": 0.9863519668579102, "start": 19795, "tag": "USERNAME", "value": "Forsythe_0" } ]
linear_algebra/peters_eigen.adb
jscparker/math_packages
30
---------------------------------------------------------------------- -- package body Peters_Eigen, eigendecomposition -- Copyright (C) 2008-2018 Jonathan S. Parker. -- -- 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 Ada.numerics.Generic_Elementary_Functions; with Hessenberg; with Givens_QR_Method; with Hypot; package body Peters_Eigen is package Givens_Hess is new Hessenberg (Real, Index, Matrix); package Initial_QR is new Givens_QR_Method (Real, Index, Matrix); package Hypo is new Hypot (Real); Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; Half : constant Real := +0.5; Max_Exp : constant Integer := Real'Machine_Emax - Real'Machine_Emax/16; Sqrt_Max_Allowed_Real : constant Real := Two**(Max_Exp / 2); Min_Exp : constant Integer := Real'Machine_Emin - Real'Machine_Emin/16; Sqrt_Min_Allowed_Real : constant Real := Two**(Min_Exp / 2); package Math is new Ada.numerics.Generic_Elementary_Functions(Real); use Math; ---------- -- Div2 -- ---------- -- Complex division, C := A / B -- -- If B = 0, allow the usual real arithmetic to raise exceptions. -- -- Algorithm by Robert L. Smith. (Supposed to be better at avoiding -- unnecessary divisions by 0 (due to underflow) than Eispack version.) -- procedure Div2 (A_r, A_i : in Real; B_r, B_i : in Real; C_r, C_i : out Real) is e, f : Real; begin if Abs (B_i) < Abs (B_r) then e := B_i / B_r; f := B_r + B_i*e; C_r := (A_r + A_i*e) / f; C_i := (A_i - A_r*e) / f; else e := B_r / B_i; f := B_i + B_r*e; C_r := (A_i + A_r*e) / f; C_i :=(-A_r + A_i*e) / f; end if; end Div2; procedure Div (A_re, A_im : in Real; B_re, B_im : in Real; C_r, C_i : out Real) is A_max : constant Real := Real'Max (Abs A_re, Abs A_im); B_max : constant Real := Real'Max (Abs B_re, Abs B_im); A_Scale, B_Scale, Unscale, B_Squ : Real := One; A_Scale_exp, B_Scale_exp : Integer := 0; A_r, A_i, B_r, B_i : Real; begin C_r := Zero; C_i := Zero; if A_max = Zero then -- use default C_r, C_i return; end if; if B_max = Zero then raise Constraint_Error with "Division by 0 in Div"; end if; A_r := A_re; A_i := A_im; if A_max > Two**(Real'Machine_Emax/2 - 2) or else A_max < Two**(Real'Machine_Emin/2 + 2) then A_Scale_exp := -Real'Exponent (A_max); A_Scale := Two**A_Scale_exp; A_r := A_re * A_Scale; A_i := A_im * A_Scale; end if; B_r := B_re; B_i := B_im; if B_max > Two**(Real'Machine_Emax/2 - 2) or else B_max < Two**(Real'Machine_Emin/2 + 2) then B_Scale_exp := -Real'Exponent (B_max); B_Scale := Two**B_Scale_exp; B_r := B_re * B_Scale; B_i := B_im * B_Scale; end if; Unscale := Two**(B_Scale_exp - A_Scale_exp); -- over/under flow if A/B out of range. B_Squ := B_r**2 + B_i**2; C_r := ((A_r*B_r + A_i*B_i) / B_Squ) * Unscale; C_i := ((A_i*B_r - A_r*B_i) / B_Squ) * Unscale; end Div; -------------------- -- Balance_Matrix -- -------------------- -- procedure Balance_Matrix returns Vector D representing a -- diagonal matrix, and Matrix B, -- -- B := D^(-1) * A * D -- -- If we subsequently find the eigendecomposition of B -- -- B*v = lambda*v. -- -- Then -- -- D^(-1)*A*D*v = lambda*v -- -- implies that -- -- A*D*v = lambda*D*v, -- -- so that the eigenvectors of A are D*v, (D times the eigenvectors of B). -- The eigenvalues A and B are unchanged by the transformation. -- -- The eigenvectors v of matrix B are orthonormal, but not the -- eigenvectors D*v of matrix A. -- -- A is written over with B. procedure Balance_Matrix (A : in out Matrix; D : in out Col_Vector; Starting_Col : in Index; Final_Col : in Index; Balance_Policy : in Balance_Code := Partial) is Radix : constant Real := Two ** 1; -- Two**1 most accurate. Radix_Squared : constant Real := Radix ** 2; Reciprocal_Radix : constant Real := 1.0 / Radix; Reciprocal_Radix_Squared : constant Real := Reciprocal_Radix ** 2; Max_Allowed_Iterations : Integer := 16; Converged : Boolean := True; g, f, s : Real; Row_Norm, Col_Norm : Real; Min_Exp : constant Integer := Real'Machine_Emin + 16; Min_Allowed_Real : constant Real := Two ** Min_Exp; Max_Test : constant Real := Two**(Real'Machine_Emax / 2); Min_Test : constant Real := Two**(Real'Machine_Emin / 2); N : constant Integer := 1 + Integer (Real(Final_Col) - Real(Starting_Col)); begin case Balance_Policy is when Full => Max_Allowed_Iterations := 16; when Partial => Max_Allowed_Iterations := 2 + Integer (N / 500); when Disabled => Max_Allowed_Iterations := 0; end case; -- Balance a square block whose -- upper-left corner is (Starting_Col, Starting_Col). -- Lower-right corner is (Final_Col, Final_Col). D := (others => One); Until_Converged: for Interation_id in 1 .. Max_Allowed_Iterations loop Converged := True; for i in Starting_Col .. Final_Col loop Row_Norm := 0.0; Col_Norm := 0.0; for j in Starting_Col .. Final_Col loop if j /= i then Col_Norm := Col_Norm + Abs (A(j, i)); Row_Norm := Row_Norm + Abs (A(i, j)); end if; end loop; -- D(i) is already 1.0. If both norms are > 0.0 -- then calculate f for D(i) and g = 1/f for D(i)^(-1): if (Col_Norm > Min_Allowed_Real) and (Row_Norm > Min_Allowed_Real) then f := 1.0; g := Row_Norm * Reciprocal_Radix; s := Col_Norm + Row_Norm; while Col_Norm < g loop exit when f > Max_Test or else Col_Norm > Max_Test; f := f * Radix; Col_Norm := Col_Norm * Radix_Squared; end loop; g := Row_Norm * Radix; while Col_Norm > g loop exit when f < Min_Test or else Col_Norm < Min_Test; f := f * Reciprocal_Radix; Col_Norm := Col_Norm * Reciprocal_Radix_Squared; end loop; -- If we flunk the following test for all row/cols i, then -- Converged remains True, and we exit the loop and return. if ((Row_Norm + Col_Norm) / f < 0.93 * s) then -- .75 with 3 iters is like .95 with 2 iters Converged := False; D(i) := D(i) * f; -- D(i) initially 1.0 g := One / f; -- (multiplying by D on the right): Scale i_th col by f. for k in Starting_Col .. A'Last(1) loop -- k .. N A(k,i) := f * A(k,i); end loop; -- (multiplying by D^(-1) on the left)): Scale i_th row by g = 1/f for k in A'First(2) .. Final_Col loop -- 1 .. l A(i,k) := g * A(i,k); end loop; end if; end if; -- if both norms are non-zero end loop; -- in i_th row/col exit when Converged; end loop Until_Converged; end Balance_Matrix; ------------------ -- Balance_Undo -- ------------------ -- -- The eigenvectors of A are D*z, (multiply diagonal matrix -- D on the right times the eigenvectors Z of the balanced matrix B). -- procedure Balance_Undo (D : in Col_Vector; Z : in out Matrix; Starting_Col : in Index; Final_Col : in Index) is begin for r in Starting_Col .. Final_Col loop for c in Starting_Col .. Final_Col loop Z(r,c) := Z(r,c) * D(r); end loop; end loop; end Balance_Undo; ------------------------ -- Rotation_Factors_2 -- ------------------------ -- sn = a / sqrt(a**2 + b**2) -- cs = b / sqrt(a**2 + b**2) procedure Rotation_Factors_2 (a, b : in Real; sn_lo, sn_hi, cs_lo, cs_hi : out Real; hypot : out Real) is Abs_a : constant Real := Abs a; Abs_b : constant Real := Abs b; min_over_hypot, max_over_hypot_minus_1 : Real; Min_Allowed_Real : constant Real := Two**(Real'Machine_Emin + 16); begin -- default: cs_hi := One; cs_lo := Zero; sn_hi := Zero; sn_lo := Zero; hypot := One; if Abs_a >= Abs_b then if Abs_a > Min_Allowed_Real then Hypo.Get_Hypotenuse (a, b, hypot, min_over_hypot, max_over_hypot_minus_1); cs_hi := Zero; cs_lo := min_over_hypot; sn_hi := One; sn_lo := max_over_hypot_minus_1; if a < Zero then sn_hi := -sn_hi; sn_lo := -sn_lo; end if; if b < Zero then cs_lo := -cs_lo; end if; end if; else if Abs_b > Min_Allowed_Real then Hypo.Get_Hypotenuse (a, b, hypot, min_over_hypot, max_over_hypot_minus_1); sn_hi := Zero; sn_lo := min_over_hypot; cs_hi := One; cs_lo := max_over_hypot_minus_1; if a < Zero then sn_lo := -sn_lo; end if; if b < Zero then cs_hi := -cs_hi; cs_lo := -cs_lo; end if; end if; end if; end Rotation_Factors_2; --------------------------------------- -- Arg_1_is_Negligible_Respect_Arg_2 -- --------------------------------------- -- IF Abs_x is negligible in comparison to Abs_y then return True. function Arg_1_is_Negligible_Respect_Arg_2 (x, y : Real) return Boolean is Abs_x : constant Real := Abs x; Abs_y : constant Real := Abs y; Min_Allowed_Real : constant Real := Two ** Real'Machine_Emin; Added_Range : constant := 5; -- 2 to 8. 6,7 std. 7 helps with clustered eigs. Effective_Mantissa : constant Integer := Real'Machine_Mantissa + Added_Range; Eps_Factor : constant Real := Two**(-Effective_Mantissa); pragma Assert (Added_Range > 1); -- Stnd setting for Eps_Factor is: 2**(-Real'Machine_Mantissa-2) -- Usually Real'Machine_Mantissa = 53 if Real is 15 digits. begin if Abs_x < Min_Allowed_Real then -- eg, Abs_x = 0.0 return True; elsif Abs_x <= Abs_y*Eps_Factor then -- Abs_x is negligible in comparison to Abs_y return True; else return False; end if; end Arg_1_is_Negligible_Respect_Arg_2; ------------------------ -- Unpack_Eig_Vectors -- ------------------------ procedure Unpack_Eig_Vectors (W_i : in Col_Vector; Z : in out Matrix; -- will exit with Z_r, the real part of Z. Z_i : out Matrix; -- will exit with imaginary part. Starting_Col : in Index; Final_Col : in Index) is begin Z_i := (others => (others => Zero)); -- Im (W) > 0 at column c means that columns c and c+1 of Z are the -- Re and Im parts of the Eigenvector, with eig_val = (W_r(c), Abs(W_i(c))). for c in Starting_Col .. Final_Col-1 loop if W_i(c) > Zero then for j in Starting_Col .. Final_Col loop Z_i(j,c) := Z(j,c+1); Z_i(j,c+1) := -Z(j,c+1); end loop; for j in Starting_Col .. Final_Col loop Z(j,c+1):= Z(j,c); -- the real parts of the above 2 vecs are equal. end loop; if not (W_i(c+1) < Zero) then -- something went very wrong. raise Constraint_Error with "Fatal error in Unpack_Eig_Vectors"; end if; end if; end loop; end Unpack_Eig_Vectors; ---------- -- Norm -- ---------- function Norm (V_r, V_i : in Col_Vector; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) return Real is Max : Real := Zero; Sum, tst : Real := Zero; Scale : Real := One; Scaled : Boolean := False; Scale_Exp : Integer; X, Y : Real; begin for i in Starting_Col .. Final_Col loop tst := Abs (V_r(i)); if tst > Max then Max := tst; end if; tst := Abs (V_i(i)); if tst > Max then Max := tst; end if; end loop; if Max > Sqrt_Max_Allowed_Real then Scale_Exp := Integer'Min (Real'Exponent (Max), Real'Machine_Emax-4); Scale := Two**(-Scale_Exp); Scaled := True; end if; if Max < Sqrt_Min_Allowed_Real then Scale_Exp := Integer'Max (Real'Exponent (Max), Real'Machine_Emin+4); Scale := Two**(-Scale_Exp); Scaled := True; end if; if Scaled then for k in Starting_Col .. Final_Col loop X := Scale * V_r(k); Y := Scale * V_i(k); Sum := Sum + X**2 + Y**2; end loop; else for k in Starting_Col .. Final_Col loop Sum := Sum + V_r(k)**2 + V_i(k)**2; end loop; end if; if Scaled then return Sqrt (Abs Sum) * Two**Scale_Exp; else return Sqrt (Abs Sum); end if; end Norm; ------------------------------ -- Normalize_Column_Vectors -- ------------------------------ procedure Normalize_Column_Vectors (Z_r, Z_i : in out Matrix; Starting_Col : in Index; Final_Col : in Index) is Min_Exp : constant Integer := Real'Machine_Emin/2 + Real'Machine_Emin/4; Min_Allowed_Real : constant Real := Two**Min_Exp; V_r, V_i : Col_Vector; Norm_Factor : Real; begin for Col_id in Starting_Col .. Final_Col loop for j in Starting_Col .. Final_Col loop V_r(j) := Z_r(j, Col_id); end loop; for j in Starting_Col .. Final_Col loop V_i(j) := Z_i(j, Col_id); end loop; Norm_Factor := One / (Norm (V_r, V_i, Starting_Col, Final_Col) + Min_Allowed_Real); for j in Starting_Col .. Final_Col loop Z_r(j, Col_id) := Z_r(j, Col_id) * Norm_Factor; end loop; for j in Starting_Col .. Final_Col loop Z_i(j, Col_id) := Z_i(j, Col_id) * Norm_Factor; end loop; end loop; end Normalize_Column_Vectors; ---------------------------- -- Apply_QR_to_Hessenberg -- ---------------------------- -- Apply_QR_to_Hessenberg is a translation of the algol procedure -- hqr2, num. math. 16, 181-204(1970) by Peters and Wilkinson. -- handbook for auto. comp., vol.ii-linear algebra, 372-395(1971). -- -- Have Z' A Z = H where H and Z are input below. (H is upper Hessenberg.) -- The problem is to further elaborate Z so that A Z = w Z. The -- Col vectors of Z are eigvecs, and the diagonal elements of w are the -- eigvals. procedure Apply_QR_to_Hessenberg (H : in out Matrix; Z : in out Matrix; W_r, W_i : out Col_Vector; Norm : out Real; Unscale_Eigs : out Real; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last; Eigenvectors_Desired : in Boolean := True; Id_of_Failed_Eig : out Integer) is N : constant Real := Real(Final_Col) - Real(Starting_Col) + One; Max_Allowed_Iterations : constant Integer := 128 * Integer (N); Remaining_Iterations : Integer := Max_Allowed_Iterations; Iteration_id : Integer := 1; Emin : constant Integer := Real'Machine_Emin; Min_Exp : constant Integer := Emin - Emin / 16; Min_Allowed_Real : constant Real := Two**(Min_Exp / 2 + 64); pragma Assert (Index'Base'First < Index'First - 1); pragma Assert (Final_Col > Starting_Col); Scale_Eigs : Real; begin W_r := (others => Zero); -- important init. W_i := (others => Zero); Id_of_Failed_Eig := Integer(Starting_Col) - 1; -- means none failed. -- compute matrix Norm Norm := Zero; for c in Starting_Col .. Final_Col loop for r in Starting_Col .. Final_Col loop Norm := Norm + Abs (H(r,c)); end loop; end loop; Unscale_Eigs := One; if Norm > Two ** (Real'Machine_Emax / 2 - 2) then Scale_Eigs := Two ** (- Real'Exponent (Norm)); UnScale_Eigs := One / Scale_Eigs; for c in Starting_Col .. Final_Col loop for r in Starting_Col .. Final_Col loop H(r,c) := H(r,c) * Scale_Eigs; end loop; end loop; end if; Find_All_Eigenvalues: declare Eig_id_0 : Index'Base := Final_Col; Eig_id_2, Eig_id_1 : Index'Base; l_memo, m_memo : Index; Final_k : Boolean; t : Real := Zero; -- essential init tst1, tst2 : Real := Zero; Hmm : Real; x, y : Real; p,q,r,w,zz,xx : Real; Exp_s : Integer; Scale, Scale_Inv : Real; r_div_s, q_div_s, p_div_s : Real; q_div_ps, r_div_ps : Real; s, ss, tmp0 : Real := Zero; begin Get_Next_Eigval: while Eig_id_0 >= Starting_Col loop -- iterate for eigenvalues: Iteration_id := 1; Eig_id_1 := Eig_id_0 - 1; Eig_id_2 := Eig_id_0 - 2; -- look for single small sub-diagonal element loop Find_Next_Root: loop for l in reverse Starting_Col .. Eig_id_0 loop l_memo := l; exit when l = Starting_Col; s := Abs (H(l-1,l-1)) + Abs (H(l,l)); if s < Min_Allowed_Real then s := Norm; end if; exit when Arg_1_is_Negligible_Respect_Arg_2 (H(l,l-1), s); end loop; -- form shift. x := H(Eig_id_0,Eig_id_0); if l_memo = Eig_id_0 then -- 1 root found H(Eig_id_0,Eig_id_0) := x + t; W_r(Eig_id_0) := H(Eig_id_0,Eig_id_0); W_i(Eig_id_0) := Zero; Eig_id_0 := Eig_id_1; goto End_of_Loop_Get_Next_Eigval; -- Notice we just decremented Eig_id_0. end if; y := H(Eig_id_1,Eig_id_1); w := H(Eig_id_0,Eig_id_1) * H(Eig_id_1,Eig_id_0); exit Find_Next_Root when l_memo = Eig_id_1; -- 2 roots found if Remaining_Iterations = 0 then -- didn't converge Id_of_Failed_Eig := Integer (Eig_id_0); return; end if; -- form exceptional shift if Iteration_id mod 14 = 0 then -- Forsythe_0 needs this. t := t + x; for i in Starting_Col .. Eig_id_0 loop H(i,i) := H(i,i) - x; end loop; s := Abs (H(Eig_id_0,Eig_id_1)) + Abs (H(Eig_id_1,Eig_id_2)); x := 0.75 * s; y := x; w := -0.4375 * s * s; end if; Iteration_id := Iteration_id + 1; Remaining_Iterations := Remaining_Iterations - 1; -- look for two consecutive small loop sub-diagonal elements. for m in reverse l_memo .. Eig_id_2 loop m_memo := m; Hmm := H(m,m); r := x - Hmm; s := y - Hmm; p := (r * s - w) / H(m+1,m) + H(m,m+1); q := H(m+1,m+1) - Hmm - r - s; r := H(m+2,m+1); Scale := One / (Abs (p) + Abs (q) + Abs (r) + Min_Allowed_Real); p := p * Scale; q := q * Scale; r := r * Scale; exit when m = l_memo; tst1 := Abs (H(m,m-1)) * (Abs (q) + Abs (r)); tst2 := Abs (p)*(Abs (H(m-1,m-1)) + Abs (Hmm) + Abs (H(m+1,m+1))); exit when Arg_1_is_Negligible_Respect_Arg_2 (tst1, tst2); end loop; for i in m_memo+2 .. Eig_id_0 loop H(i,i-2) := Zero; if (i /= m_memo+2) then H(i,i-3) := Zero; end if; end loop; -- double qr step w/ rows l_memo .. Eig_id_0, columns m_memo .. Eig_id_0 Double_QR: for k in m_memo .. Eig_id_1 loop Final_k := (k = Eig_id_1); if k /= m_memo then p := H(k,k-1); q := H(k+1,k-1); if Final_k then r := Zero; else r := H(k+2,k-1); end if; Scale := Abs (p) + Abs (q) + Abs (r); if Scale < Min_Allowed_Real then goto End_of_Loop_Double_QR; -- and then increment k. end if; if Scale < Two**(Emin / 2) or else Scale > Two**(Real'Emax / 4) then Exp_s := Real'Exponent (Scale); scale := Two ** (Exp_s); Scale_Inv := Two ** (-Exp_s); p := p * Scale_Inv; q := q * Scale_Inv; r := r * Scale_Inv; else scale := One; scale_inv := One; end if; end if; ss := p*p + q*q + r*r; s := Real'Copy_Sign (Sqrt (ss), p); if (k /= m_memo) then H(k,k-1) := -s * Scale; else if (l_memo /= m_memo) then H(k,k-1) := -H(k,k-1); end if; end if; p_div_s := p / s; q_div_s := q / s; r_div_s := r / s; q_div_ps := q / (p + s); r_div_ps := r / (p + s); if not Final_k then -- rows for j in k .. Final_Col loop tmp0 := H(k,j) + (q_div_ps * H(k+1,j) + r_div_ps * H(k+2,j)); H(k,j) := -p_div_s * H(k,j) - (q_div_s*H(k+1,j) + r_div_s*H(k+2,j)); H(k+1,j) := H(k+1,j) - tmp0 * q_div_s; H(k+2,j) := H(k+2,j) - tmp0 * r_div_s; end loop; -- columns for i in Starting_Col .. Index'Min (Eig_id_0,k+3) loop tmp0 := H(i,k) + (q_div_ps * H(i,k+1) + r_div_ps * H(i,k+2)); H(i,k) := -p_div_s * H(i,k) - (q_div_s*H(i,k+1) + r_div_s*H(i,k+2)); H(i,k+1) := H(i,k+1) - tmp0 * q_div_s; H(i,k+2) := H(i,k+2) - tmp0 * r_div_s; end loop; -- accumulate transformations if Eigenvectors_Desired then for i in Starting_Col .. Final_Col loop tmp0 := Z(i,k) + (q_div_ps * Z(i,k+1) + r_div_ps * Z(i,k+2)); Z(i,k) := -p_div_s * Z(i,k) - (q_div_s*Z(i,k+1) + r_div_s*Z(i,k+2)); Z(i,k+1) := Z(i,k+1) - tmp0 * q_div_s; Z(i,k+2) := Z(i,k+2) - tmp0 * r_div_s; end loop; end if; else for j in k .. Final_Col loop tmp0 := H(k,j) + q_div_ps * H(k+1,j); H(k,j) := -p_div_s * H(k,j) - q_div_s * H(k+1,j); H(k+1,j) := H(k+1,j) - q_div_s * tmp0; end loop; -- columns for i in Starting_Col .. Index'Min (Eig_id_0,k+3) loop tmp0 := H(i,k) + q_div_ps * H(i,k+1); H(i,k) := -p_div_s * H(i,k) - q_div_s * H(i,k+1); H(i,k+1) := H(i,k+1) - q_div_s * tmp0; end loop; -- accumulate transformations if Eigenvectors_Desired then for i in Starting_Col .. Final_Col loop tmp0 := Z(i,k) + q_div_ps * Z(i,k+1); Z(i,k) := -p_div_s * Z(i,k) - q_div_s * Z(i,k+1); Z(i,k+1) := Z(i,k+1) - q_div_s * tmp0; end loop; end if; end if; <<End_of_Loop_Double_QR>> null; end loop Double_QR; -- increment k end loop Find_Next_Root; -- two roots found. x, y, w were defined up top as: -- -- x := H(Eig_id_0,Eig_id_0); -- y := H(Eig_id_1,Eig_id_1); -- w := H(Eig_id_0,Eig_id_1) * H(Eig_id_1,Eig_id_0); p := Half * (y - x); q := p * p + w; zz := Sqrt (Abs (q)); H(Eig_id_0,Eig_id_0) := x + t; H(Eig_id_1,Eig_id_1) := y + t; x := x + t; if q >= Zero then -- real pair zz := p + Real'Copy_Sign (zz, p); W_r(Eig_id_1) := x + zz; W_r(Eig_id_0) := W_r(Eig_id_1); if (Abs zz > Min_Allowed_Real) then W_r(Eig_id_0) := x - w / zz; end if; W_i(Eig_id_1) := Zero; W_i(Eig_id_0) := Zero; xx := H(Eig_id_0,Eig_id_1); declare hypot, sn_lo, sn_hi, cs_lo, cs_hi : Real; tmp1, tmp0 : Real; begin Rotation_Factors_2 (xx, zz, sn_lo, sn_hi, cs_lo, cs_hi, hypot); -- sn = a / Sqrt(a*a + b*b), cs = b / Sqrt(a*a + b*b), (a=xx, b = zz) -- rows for j in Eig_id_1 .. Final_Col loop tmp1 := H(Eig_id_1,j); tmp0 := H(Eig_id_0,j); H(Eig_id_1,j) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); H(Eig_id_0,j) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; -- columns for i in Starting_Col .. Eig_id_0 loop tmp1 := H(i,Eig_id_1); tmp0 := H(i,Eig_id_0); H(i,Eig_id_1) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); H(i,Eig_id_0) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; -- columns for i in Starting_Col .. Final_Col loop tmp1 := Z(i,Eig_id_1); tmp0 := Z(i,Eig_id_0); Z(i,Eig_id_1) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); Z(i,Eig_id_0) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; end; else -- complex pair W_r(Eig_id_1) := p + x; W_r(Eig_id_0) := p + x; W_i(Eig_id_1) := zz; W_i(Eig_id_0) :=-zz; end if; Eig_id_0 := Eig_id_2; <<End_of_Loop_Get_Next_Eigval>> null; end loop Get_Next_Eigval; end Find_All_Eigenvalues; end Apply_QR_to_Hessenberg; --------------------------- -- Find_all_Eigenvectors -- --------------------------- -- Backsubstitute to find vectors of upper triangular form H. procedure Find_all_Eigenvectors (H : in out Matrix; Z : in out Matrix; Z_i : out Matrix; W_r, W_i : in Col_Vector; Norm : in Real; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is Eig_Start, Eig_Memo : Index; Eig_2, Eig_1 : Index'Base; ra, sa : Real; p, q, r, s, w, zz : Real; Sum : Real; Min_Exp : constant Integer := Real'Machine_Emin; Min_Allowed_Real : constant Real := Two**(Min_Exp - Min_Exp/16); pragma Assert (Index'Base'First < Index'First - 1); pragma Assert (Final_Col > Starting_Col); begin if Norm = Zero then Z_i := (others => (others => Zero)); return; end if; Get_Next_Eigenvector: for Eig_0 in reverse Starting_Col .. Final_Col loop p := W_r(Eig_0); q := W_i(Eig_0); if Abs W_i(Eig_0) = Zero then -- Make real vector H(Eig_0,Eig_0) := One; Eig_Memo := Eig_0; if Eig_0 > Starting_Col then Get_Real_Vector: for i in reverse Starting_Col .. Eig_0-1 loop w := H(i,i) - p; r := Zero; for j in Eig_Memo .. Eig_0 loop r := r + H(i,j) * H(j,Eig_0); end loop; if W_i(i) < Zero then zz := w; s := r; else Eig_Memo := i; if (Abs W_i(i) < Min_Allowed_Real) then declare t : Real := w; Exp_t : Integer; begin if Abs t < Min_Allowed_Real then Exp_t := Real'Machine_Mantissa + 27; t := Norm * Two**(-Exp_t) + Min_Allowed_Real; end if; H(i,Eig_0) := -r / t; end; else -- solve real equations declare x, y, q, t : Real; begin x := H(i,i+1); y := H(i+1,i); q := (W_r(i) - p)**2 + W_i(i)**2; t := (x * s - zz * r) / q; H(i,Eig_0) := t; if (Abs (x) > Abs (zz)) then H(i+1,Eig_0) := (-r - w * t) / x; else H(i+1,Eig_0) := (-s - y * t) / zz; end if; end; end if; -- overflow control declare t, Scale : Real; Exp_t : Integer; begin t := Abs (H(i,Eig_0)); if t > Min_Allowed_Real then -- "t > Zero" fails Exp_t := Real'Exponent (t); if Exp_t > Real'Machine_Mantissa + 27 then Scale := Two**(-Exp_t); for j in i .. Eig_0 loop H(j,Eig_0) := H(j,Eig_0) * Scale; end loop; end if; end if; end; end if; end loop Get_Real_Vector; -- in i end if; -- if Eig_0 > Starting_Col -- Now go to end of loop Get_Next_Eigenvector, and increment Eig_0. elsif q < Zero then -- Complex vectors. Last vector component chosen imaginary -- so that eigenvector matrix is triangular. Eig_1 := Eig_0 - 1; Eig_2 := Eig_0 - 2; -- check if (Abs (H(Eig_0,Eig_1)) > Abs (H(Eig_1,Eig_0))) then H(Eig_1,Eig_1) := q / H(Eig_0,Eig_1); H(Eig_1,Eig_0) := -(H(Eig_0,Eig_0) - p) / H(Eig_0,Eig_1); else Div (Zero, -H(Eig_1,Eig_0), H(Eig_1,Eig_1)-p, q, H(Eig_1,Eig_1), H(Eig_1,Eig_0)); end if; H(Eig_0,Eig_1) := Zero; H(Eig_0,Eig_0) := One; Eig_Start := Eig_1; Get_Complex_Vector: for i in reverse Starting_Col .. Eig_2 loop w := H(i,i) - p; ra := Zero; sa := Zero; for j in Eig_Start .. Eig_0 loop ra := ra + H(i,j) * H(j,Eig_1); sa := sa + H(i,j) * H(j,Eig_0); end loop; if (W_i(i) < Zero) then zz := w; r := ra; s := sa; goto End_of_Loop_Get_Complex_Vector; end if; Eig_Start := i; -- decrement start of previous loop if (Abs W_i(i) < Min_Allowed_Real) then Div (-ra, -sa, w, q, H(i,Eig_1), H(i,Eig_0)); else -- solve complex equations declare x, y, vr, vi, tst1 : Real; begin x := H(i,i+1); y := H(i+1,i); vr := (W_r(i) - p) * (W_r(i) - p) + W_i(i) * W_i(i) - q * q; vi := (W_r(i) - p) * Two * q; if (Abs vr < Min_Allowed_Real and Abs vi < Min_Allowed_Real) then tst1 := Norm * (Abs(w)+Abs(q)+Abs(x)+Abs(y)+Abs(zz)); vr := tst1 * (Real'Epsilon * Two**(-10)); end if; Div(x*r-zz*ra+q*sa, x*s-zz*sa-q*ra, vr, vi, H(i,Eig_1), H(i,Eig_0)); if (Abs (x) > Abs (zz) + Abs (q)) then H(i+1,Eig_1) := (-ra - w * H(i,Eig_1) + q * H(i,Eig_0)) / x; H(i+1,Eig_0) := (-sa - w * H(i,Eig_0) - q * H(i,Eig_1)) / x; else Div(-r-y*H(i,Eig_1), -s-y*H(i,Eig_0), zz, q, H(i+1,Eig_1), H(i+1,Eig_0)); end if; end; end if; -- overflow control declare t, Scale : Real; Exp_t : Integer; begin t := Real'Max (Abs (H(i,Eig_1)), Abs (H(i,Eig_0))); if t > Min_Allowed_Real then Exp_t := Real'Exponent (t); if Exp_t > Real'Machine_Mantissa + 27 then Scale := Two**(-Exp_t); for j in i .. Eig_0 loop H(j,Eig_1) := H(j,Eig_1) * Scale; H(j,Eig_0) := H(j,Eig_0) * Scale; end loop; end if; end if; end; <<End_of_Loop_Get_Complex_Vector>> null; end loop Get_Complex_Vector; -- increment i end if; -- Abs W_i(Eig_0) < Min_Allowed_Real => do real vecs, else complex. end loop Get_Next_Eigenvector; -- increment Eig_0 -- multiply by transformation matrix to get the eigenvectors. -- Have H v = w v, where Z' A Z = H. Then Z H Z'(Zv) = w (Zv) -- implies that Z*v are the eigvecs of A = Z H Z'. (To save much -- space, the "v" eigenvectors were stored in H). --for j in reverse Starting_Col .. Final_Col loop -- for i in Starting_Col .. Final_Col loop -- Sum := Zero; -- for k in Starting_Col .. j loop -- Sum := Sum + Z(i,k) * H(k,j); -- end loop; -- Z(i,j) := Sum; -- end loop; --end loop; declare Z_row_vec, Z_new_row : array (Starting_Col .. Final_Col) of Real; begin for r in Starting_Col .. Final_Col loop for k in Starting_Col .. Final_Col loop -- reuse a row of Z below Z_row_vec(k) := Z(r, k); end loop; for c in Starting_Col .. Final_Col loop Sum := Zero; for k in Starting_Col .. c loop -- H is upper triangular --Sum := Sum + Z(r, k) * H(k, c); Sum := Sum + Z_row_vec(k) * H(k, c); -- H is Convention(Fortran). end loop; Z_new_row(c) := Sum; end loop; for c in Starting_Col .. Final_Col loop Z(r, c) := Z_new_row(c); end loop; end loop; end; Unpack_Eig_Vectors (W_i, Z, Z_i, Starting_Col, Final_Col); -- Gets (Z_r, Z_i) from Z. Destroys old Z. -- The out parameter Z_i is finally initialized here. end Find_all_Eigenvectors; ------------------------ -- Sort_Eigs_And_Vecs -- ------------------------ procedure Sort_Eigs_And_Vecs (Z_r, Z_i : in out Matrix; -- eigvecs are columns of Z W_r, W_i : in out Col_Vector; -- eigvals are vectors W Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is Max_Eig, tmp : Real; Eig_Size : Col_Vector := (others => Zero); i_Max : Index; begin if Starting_Col < Final_Col then for i in Starting_Col .. Final_Col loop Eig_Size(i) := Hypo.Hypotenuse (W_r(i), W_i(i)); end loop; for i in Starting_Col .. Final_Col-1 loop Max_Eig := Eig_Size(i); i_Max := i; for j in i+1 .. Final_Col loop if Eig_Size(j) > Max_Eig then Max_Eig := Eig_Size(j); i_Max := j; end if; end loop; if i_Max > i then tmp := W_r(i); W_r(i) := W_r(i_Max); W_r(i_Max) := tmp; tmp := W_i(i); W_i(i) := W_i(i_Max); W_i(i_Max) := tmp; tmp := Eig_Size(i); Eig_Size(i) := Eig_Size(i_Max); Eig_Size(i_Max) := tmp; -- swap cols of Z, the eigenvectors: for k in Starting_Col .. Final_Col loop tmp := Z_r(k, i); Z_r(k, i) := Z_r(k, i_Max); Z_r(k, i_Max) := tmp; end loop; for k in Starting_Col .. Final_Col loop tmp := Z_i(k, i); Z_i(k, i) := Z_i(k, i_Max); Z_i(k, i_Max) := tmp; end loop; end if; end loop; end if; end Sort_Eigs_And_Vecs; procedure Transpose (M : in out Matrix; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is tmp : Real; begin for r in Starting_Col .. Final_Col loop for c in Starting_Col .. r loop tmp := M(c,r); M(c,r) := M(r,c); M(r,c) := tmp; end loop; end loop; end Transpose; --------------- -- Decompose -- --------------- procedure Decompose (A : in out Matrix; Z_r, Z_i : out Matrix; W_r, W_i : out Col_Vector; Id_of_Failed_Eig : out Integer; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last; Eigenvectors_Desired : in Boolean := True; Balance_Policy : in Balance_Code := Disabled) is Norm : Real := One; Unscale_Eigs : Real := One; D : Col_Vector := (others => One); begin Id_of_Failed_Eig := Integer (Final_Col); -- init out parameter. Z_r := Givens_Hess.Identity; if Final_Col <= Starting_Col then raise Constraint_Error with "Can't have Final_Col <= Starting_Col"; end if; Balance_Matrix (A, D, Starting_Col, Final_Col, Balance_Policy); -- if matrix was balanced, then multiply D by I to get starting -- point for calculation of the Q matrix: Initial_Q => Z_r. -- -- ** The Q matrices won't be orthogonal if the matrix is balanced. ** for c in Index loop Z_r(c,c) := D(c); end loop; -- More generally, if Initial_Q is not I, but some Z_r: -- --for r in Starting_Col .. Final_Col loop --for c in Starting_Col .. Final_Col loop --Z_r(r,c) := Z_r(r,c) * D(c); --end loop; --end loop; Givens_Hess.Upper_Hessenberg (A => A, Q => Z_r, Starting_Col => Starting_Col, Final_Col => Final_Col, Initial_Q => Z_r); -- A is now in Upper_Hessenberg form, thanks to Z_r: A_true = Z_r' A Z_r. -- Procedure Upper_Hessenberg initializes "out" parameter Z_r. for i in 1 .. 8 loop Initial_QR.Lower_Diagonal_QR_Iteration (A => A, Q => Z_r, Shift => Zero, Starting_Col => Starting_Col, Final_Col => Final_Col); end loop; -- Helps eigvec calculation with several matrices, (eg. Pas_Fib, Vandermonde) -- Next, Z_r is input to Apply_QR_to_Hessenberg, where it is (optionally) -- transformed into the set of eigenvectors of A. -- -- A is now in Upper_Hessenberg form, thanks to Z_r: A_true = Z_r A Z_r'. Apply_QR_to_Hessenberg (A, Z_r, W_r, W_i, Norm, Unscale_Eigs, Starting_Col, Final_Col, Eigenvectors_Desired, -- if true then Z_i will be initialized Id_of_Failed_Eig); -- If Eigenvectors_Desired = False then Z_i remains uninitialized, -- (which may free up space with large matrices). if Eigenvectors_Desired then Find_all_Eigenvectors (A, Z_r, Z_i, W_r, W_i, Norm, Starting_Col, Final_Col); Normalize_Column_Vectors (Z_r, Z_i, Starting_Col, Final_Col); for c in Starting_Col .. Final_Col loop W_r(c) := Unscale_Eigs * W_r(c); W_i(c) := Unscale_Eigs * W_i(c); end loop; end if; end Decompose; end Peters_Eigen;
23916
---------------------------------------------------------------------- -- package body Peters_Eigen, eigendecomposition -- Copyright (C) 2008-2018 <NAME>. -- -- 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 Ada.numerics.Generic_Elementary_Functions; with Hessenberg; with Givens_QR_Method; with Hypot; package body Peters_Eigen is package Givens_Hess is new Hessenberg (Real, Index, Matrix); package Initial_QR is new Givens_QR_Method (Real, Index, Matrix); package Hypo is new Hypot (Real); Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; Half : constant Real := +0.5; Max_Exp : constant Integer := Real'Machine_Emax - Real'Machine_Emax/16; Sqrt_Max_Allowed_Real : constant Real := Two**(Max_Exp / 2); Min_Exp : constant Integer := Real'Machine_Emin - Real'Machine_Emin/16; Sqrt_Min_Allowed_Real : constant Real := Two**(Min_Exp / 2); package Math is new Ada.numerics.Generic_Elementary_Functions(Real); use Math; ---------- -- Div2 -- ---------- -- Complex division, C := A / B -- -- If B = 0, allow the usual real arithmetic to raise exceptions. -- -- Algorithm by <NAME>. (Supposed to be better at avoiding -- unnecessary divisions by 0 (due to underflow) than Eispack version.) -- procedure Div2 (A_r, A_i : in Real; B_r, B_i : in Real; C_r, C_i : out Real) is e, f : Real; begin if Abs (B_i) < Abs (B_r) then e := B_i / B_r; f := B_r + B_i*e; C_r := (A_r + A_i*e) / f; C_i := (A_i - A_r*e) / f; else e := B_r / B_i; f := B_i + B_r*e; C_r := (A_i + A_r*e) / f; C_i :=(-A_r + A_i*e) / f; end if; end Div2; procedure Div (A_re, A_im : in Real; B_re, B_im : in Real; C_r, C_i : out Real) is A_max : constant Real := Real'Max (Abs A_re, Abs A_im); B_max : constant Real := Real'Max (Abs B_re, Abs B_im); A_Scale, B_Scale, Unscale, B_Squ : Real := One; A_Scale_exp, B_Scale_exp : Integer := 0; A_r, A_i, B_r, B_i : Real; begin C_r := Zero; C_i := Zero; if A_max = Zero then -- use default C_r, C_i return; end if; if B_max = Zero then raise Constraint_Error with "Division by 0 in Div"; end if; A_r := A_re; A_i := A_im; if A_max > Two**(Real'Machine_Emax/2 - 2) or else A_max < Two**(Real'Machine_Emin/2 + 2) then A_Scale_exp := -Real'Exponent (A_max); A_Scale := Two**A_Scale_exp; A_r := A_re * A_Scale; A_i := A_im * A_Scale; end if; B_r := B_re; B_i := B_im; if B_max > Two**(Real'Machine_Emax/2 - 2) or else B_max < Two**(Real'Machine_Emin/2 + 2) then B_Scale_exp := -Real'Exponent (B_max); B_Scale := Two**B_Scale_exp; B_r := B_re * B_Scale; B_i := B_im * B_Scale; end if; Unscale := Two**(B_Scale_exp - A_Scale_exp); -- over/under flow if A/B out of range. B_Squ := B_r**2 + B_i**2; C_r := ((A_r*B_r + A_i*B_i) / B_Squ) * Unscale; C_i := ((A_i*B_r - A_r*B_i) / B_Squ) * Unscale; end Div; -------------------- -- Balance_Matrix -- -------------------- -- procedure Balance_Matrix returns Vector D representing a -- diagonal matrix, and Matrix B, -- -- B := D^(-1) * A * D -- -- If we subsequently find the eigendecomposition of B -- -- B*v = lambda*v. -- -- Then -- -- D^(-1)*A*D*v = lambda*v -- -- implies that -- -- A*D*v = lambda*D*v, -- -- so that the eigenvectors of A are D*v, (D times the eigenvectors of B). -- The eigenvalues A and B are unchanged by the transformation. -- -- The eigenvectors v of matrix B are orthonormal, but not the -- eigenvectors D*v of matrix A. -- -- A is written over with B. procedure Balance_Matrix (A : in out Matrix; D : in out Col_Vector; Starting_Col : in Index; Final_Col : in Index; Balance_Policy : in Balance_Code := Partial) is Radix : constant Real := Two ** 1; -- Two**1 most accurate. Radix_Squared : constant Real := Radix ** 2; Reciprocal_Radix : constant Real := 1.0 / Radix; Reciprocal_Radix_Squared : constant Real := Reciprocal_Radix ** 2; Max_Allowed_Iterations : Integer := 16; Converged : Boolean := True; g, f, s : Real; Row_Norm, Col_Norm : Real; Min_Exp : constant Integer := Real'Machine_Emin + 16; Min_Allowed_Real : constant Real := Two ** Min_Exp; Max_Test : constant Real := Two**(Real'Machine_Emax / 2); Min_Test : constant Real := Two**(Real'Machine_Emin / 2); N : constant Integer := 1 + Integer (Real(Final_Col) - Real(Starting_Col)); begin case Balance_Policy is when Full => Max_Allowed_Iterations := 16; when Partial => Max_Allowed_Iterations := 2 + Integer (N / 500); when Disabled => Max_Allowed_Iterations := 0; end case; -- Balance a square block whose -- upper-left corner is (Starting_Col, Starting_Col). -- Lower-right corner is (Final_Col, Final_Col). D := (others => One); Until_Converged: for Interation_id in 1 .. Max_Allowed_Iterations loop Converged := True; for i in Starting_Col .. Final_Col loop Row_Norm := 0.0; Col_Norm := 0.0; for j in Starting_Col .. Final_Col loop if j /= i then Col_Norm := Col_Norm + Abs (A(j, i)); Row_Norm := Row_Norm + Abs (A(i, j)); end if; end loop; -- D(i) is already 1.0. If both norms are > 0.0 -- then calculate f for D(i) and g = 1/f for D(i)^(-1): if (Col_Norm > Min_Allowed_Real) and (Row_Norm > Min_Allowed_Real) then f := 1.0; g := Row_Norm * Reciprocal_Radix; s := Col_Norm + Row_Norm; while Col_Norm < g loop exit when f > Max_Test or else Col_Norm > Max_Test; f := f * Radix; Col_Norm := Col_Norm * Radix_Squared; end loop; g := Row_Norm * Radix; while Col_Norm > g loop exit when f < Min_Test or else Col_Norm < Min_Test; f := f * Reciprocal_Radix; Col_Norm := Col_Norm * Reciprocal_Radix_Squared; end loop; -- If we flunk the following test for all row/cols i, then -- Converged remains True, and we exit the loop and return. if ((Row_Norm + Col_Norm) / f < 0.93 * s) then -- .75 with 3 iters is like .95 with 2 iters Converged := False; D(i) := D(i) * f; -- D(i) initially 1.0 g := One / f; -- (multiplying by D on the right): Scale i_th col by f. for k in Starting_Col .. A'Last(1) loop -- k .. N A(k,i) := f * A(k,i); end loop; -- (multiplying by D^(-1) on the left)): Scale i_th row by g = 1/f for k in A'First(2) .. Final_Col loop -- 1 .. l A(i,k) := g * A(i,k); end loop; end if; end if; -- if both norms are non-zero end loop; -- in i_th row/col exit when Converged; end loop Until_Converged; end Balance_Matrix; ------------------ -- Balance_Undo -- ------------------ -- -- The eigenvectors of A are D*z, (multiply diagonal matrix -- D on the right times the eigenvectors Z of the balanced matrix B). -- procedure Balance_Undo (D : in Col_Vector; Z : in out Matrix; Starting_Col : in Index; Final_Col : in Index) is begin for r in Starting_Col .. Final_Col loop for c in Starting_Col .. Final_Col loop Z(r,c) := Z(r,c) * D(r); end loop; end loop; end Balance_Undo; ------------------------ -- Rotation_Factors_2 -- ------------------------ -- sn = a / sqrt(a**2 + b**2) -- cs = b / sqrt(a**2 + b**2) procedure Rotation_Factors_2 (a, b : in Real; sn_lo, sn_hi, cs_lo, cs_hi : out Real; hypot : out Real) is Abs_a : constant Real := Abs a; Abs_b : constant Real := Abs b; min_over_hypot, max_over_hypot_minus_1 : Real; Min_Allowed_Real : constant Real := Two**(Real'Machine_Emin + 16); begin -- default: cs_hi := One; cs_lo := Zero; sn_hi := Zero; sn_lo := Zero; hypot := One; if Abs_a >= Abs_b then if Abs_a > Min_Allowed_Real then Hypo.Get_Hypotenuse (a, b, hypot, min_over_hypot, max_over_hypot_minus_1); cs_hi := Zero; cs_lo := min_over_hypot; sn_hi := One; sn_lo := max_over_hypot_minus_1; if a < Zero then sn_hi := -sn_hi; sn_lo := -sn_lo; end if; if b < Zero then cs_lo := -cs_lo; end if; end if; else if Abs_b > Min_Allowed_Real then Hypo.Get_Hypotenuse (a, b, hypot, min_over_hypot, max_over_hypot_minus_1); sn_hi := Zero; sn_lo := min_over_hypot; cs_hi := One; cs_lo := max_over_hypot_minus_1; if a < Zero then sn_lo := -sn_lo; end if; if b < Zero then cs_hi := -cs_hi; cs_lo := -cs_lo; end if; end if; end if; end Rotation_Factors_2; --------------------------------------- -- Arg_1_is_Negligible_Respect_Arg_2 -- --------------------------------------- -- IF Abs_x is negligible in comparison to Abs_y then return True. function Arg_1_is_Negligible_Respect_Arg_2 (x, y : Real) return Boolean is Abs_x : constant Real := Abs x; Abs_y : constant Real := Abs y; Min_Allowed_Real : constant Real := Two ** Real'Machine_Emin; Added_Range : constant := 5; -- 2 to 8. 6,7 std. 7 helps with clustered eigs. Effective_Mantissa : constant Integer := Real'Machine_Mantissa + Added_Range; Eps_Factor : constant Real := Two**(-Effective_Mantissa); pragma Assert (Added_Range > 1); -- Stnd setting for Eps_Factor is: 2**(-Real'Machine_Mantissa-2) -- Usually Real'Machine_Mantissa = 53 if Real is 15 digits. begin if Abs_x < Min_Allowed_Real then -- eg, Abs_x = 0.0 return True; elsif Abs_x <= Abs_y*Eps_Factor then -- Abs_x is negligible in comparison to Abs_y return True; else return False; end if; end Arg_1_is_Negligible_Respect_Arg_2; ------------------------ -- Unpack_Eig_Vectors -- ------------------------ procedure Unpack_Eig_Vectors (W_i : in Col_Vector; Z : in out Matrix; -- will exit with Z_r, the real part of Z. Z_i : out Matrix; -- will exit with imaginary part. Starting_Col : in Index; Final_Col : in Index) is begin Z_i := (others => (others => Zero)); -- Im (W) > 0 at column c means that columns c and c+1 of Z are the -- Re and Im parts of the Eigenvector, with eig_val = (W_r(c), Abs(W_i(c))). for c in Starting_Col .. Final_Col-1 loop if W_i(c) > Zero then for j in Starting_Col .. Final_Col loop Z_i(j,c) := Z(j,c+1); Z_i(j,c+1) := -Z(j,c+1); end loop; for j in Starting_Col .. Final_Col loop Z(j,c+1):= Z(j,c); -- the real parts of the above 2 vecs are equal. end loop; if not (W_i(c+1) < Zero) then -- something went very wrong. raise Constraint_Error with "Fatal error in Unpack_Eig_Vectors"; end if; end if; end loop; end Unpack_Eig_Vectors; ---------- -- Norm -- ---------- function Norm (V_r, V_i : in Col_Vector; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) return Real is Max : Real := Zero; Sum, tst : Real := Zero; Scale : Real := One; Scaled : Boolean := False; Scale_Exp : Integer; X, Y : Real; begin for i in Starting_Col .. Final_Col loop tst := Abs (V_r(i)); if tst > Max then Max := tst; end if; tst := Abs (V_i(i)); if tst > Max then Max := tst; end if; end loop; if Max > Sqrt_Max_Allowed_Real then Scale_Exp := Integer'Min (Real'Exponent (Max), Real'Machine_Emax-4); Scale := Two**(-Scale_Exp); Scaled := True; end if; if Max < Sqrt_Min_Allowed_Real then Scale_Exp := Integer'Max (Real'Exponent (Max), Real'Machine_Emin+4); Scale := Two**(-Scale_Exp); Scaled := True; end if; if Scaled then for k in Starting_Col .. Final_Col loop X := Scale * V_r(k); Y := Scale * V_i(k); Sum := Sum + X**2 + Y**2; end loop; else for k in Starting_Col .. Final_Col loop Sum := Sum + V_r(k)**2 + V_i(k)**2; end loop; end if; if Scaled then return Sqrt (Abs Sum) * Two**Scale_Exp; else return Sqrt (Abs Sum); end if; end Norm; ------------------------------ -- Normalize_Column_Vectors -- ------------------------------ procedure Normalize_Column_Vectors (Z_r, Z_i : in out Matrix; Starting_Col : in Index; Final_Col : in Index) is Min_Exp : constant Integer := Real'Machine_Emin/2 + Real'Machine_Emin/4; Min_Allowed_Real : constant Real := Two**Min_Exp; V_r, V_i : Col_Vector; Norm_Factor : Real; begin for Col_id in Starting_Col .. Final_Col loop for j in Starting_Col .. Final_Col loop V_r(j) := Z_r(j, Col_id); end loop; for j in Starting_Col .. Final_Col loop V_i(j) := Z_i(j, Col_id); end loop; Norm_Factor := One / (Norm (V_r, V_i, Starting_Col, Final_Col) + Min_Allowed_Real); for j in Starting_Col .. Final_Col loop Z_r(j, Col_id) := Z_r(j, Col_id) * Norm_Factor; end loop; for j in Starting_Col .. Final_Col loop Z_i(j, Col_id) := Z_i(j, Col_id) * Norm_Factor; end loop; end loop; end Normalize_Column_Vectors; ---------------------------- -- Apply_QR_to_Hessenberg -- ---------------------------- -- Apply_QR_to_Hessenberg is a translation of the algol procedure -- hqr2, num. math. 16, 181-204(1970) by <NAME>. -- handbook for auto. comp., vol.ii-linear algebra, 372-395(1971). -- -- Have Z' A Z = H where H and Z are input below. (H is upper Hessenberg.) -- The problem is to further elaborate Z so that A Z = w Z. The -- Col vectors of Z are eigvecs, and the diagonal elements of w are the -- eigvals. procedure Apply_QR_to_Hessenberg (H : in out Matrix; Z : in out Matrix; W_r, W_i : out Col_Vector; Norm : out Real; Unscale_Eigs : out Real; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last; Eigenvectors_Desired : in Boolean := True; Id_of_Failed_Eig : out Integer) is N : constant Real := Real(Final_Col) - Real(Starting_Col) + One; Max_Allowed_Iterations : constant Integer := 128 * Integer (N); Remaining_Iterations : Integer := Max_Allowed_Iterations; Iteration_id : Integer := 1; Emin : constant Integer := Real'Machine_Emin; Min_Exp : constant Integer := Emin - Emin / 16; Min_Allowed_Real : constant Real := Two**(Min_Exp / 2 + 64); pragma Assert (Index'Base'First < Index'First - 1); pragma Assert (Final_Col > Starting_Col); Scale_Eigs : Real; begin W_r := (others => Zero); -- important init. W_i := (others => Zero); Id_of_Failed_Eig := Integer(Starting_Col) - 1; -- means none failed. -- compute matrix Norm Norm := Zero; for c in Starting_Col .. Final_Col loop for r in Starting_Col .. Final_Col loop Norm := Norm + Abs (H(r,c)); end loop; end loop; Unscale_Eigs := One; if Norm > Two ** (Real'Machine_Emax / 2 - 2) then Scale_Eigs := Two ** (- Real'Exponent (Norm)); UnScale_Eigs := One / Scale_Eigs; for c in Starting_Col .. Final_Col loop for r in Starting_Col .. Final_Col loop H(r,c) := H(r,c) * Scale_Eigs; end loop; end loop; end if; Find_All_Eigenvalues: declare Eig_id_0 : Index'Base := Final_Col; Eig_id_2, Eig_id_1 : Index'Base; l_memo, m_memo : Index; Final_k : Boolean; t : Real := Zero; -- essential init tst1, tst2 : Real := Zero; Hmm : Real; x, y : Real; p,q,r,w,zz,xx : Real; Exp_s : Integer; Scale, Scale_Inv : Real; r_div_s, q_div_s, p_div_s : Real; q_div_ps, r_div_ps : Real; s, ss, tmp0 : Real := Zero; begin Get_Next_Eigval: while Eig_id_0 >= Starting_Col loop -- iterate for eigenvalues: Iteration_id := 1; Eig_id_1 := Eig_id_0 - 1; Eig_id_2 := Eig_id_0 - 2; -- look for single small sub-diagonal element loop Find_Next_Root: loop for l in reverse Starting_Col .. Eig_id_0 loop l_memo := l; exit when l = Starting_Col; s := Abs (H(l-1,l-1)) + Abs (H(l,l)); if s < Min_Allowed_Real then s := Norm; end if; exit when Arg_1_is_Negligible_Respect_Arg_2 (H(l,l-1), s); end loop; -- form shift. x := H(Eig_id_0,Eig_id_0); if l_memo = Eig_id_0 then -- 1 root found H(Eig_id_0,Eig_id_0) := x + t; W_r(Eig_id_0) := H(Eig_id_0,Eig_id_0); W_i(Eig_id_0) := Zero; Eig_id_0 := Eig_id_1; goto End_of_Loop_Get_Next_Eigval; -- Notice we just decremented Eig_id_0. end if; y := H(Eig_id_1,Eig_id_1); w := H(Eig_id_0,Eig_id_1) * H(Eig_id_1,Eig_id_0); exit Find_Next_Root when l_memo = Eig_id_1; -- 2 roots found if Remaining_Iterations = 0 then -- didn't converge Id_of_Failed_Eig := Integer (Eig_id_0); return; end if; -- form exceptional shift if Iteration_id mod 14 = 0 then -- Forsythe_0 needs this. t := t + x; for i in Starting_Col .. Eig_id_0 loop H(i,i) := H(i,i) - x; end loop; s := Abs (H(Eig_id_0,Eig_id_1)) + Abs (H(Eig_id_1,Eig_id_2)); x := 0.75 * s; y := x; w := -0.4375 * s * s; end if; Iteration_id := Iteration_id + 1; Remaining_Iterations := Remaining_Iterations - 1; -- look for two consecutive small loop sub-diagonal elements. for m in reverse l_memo .. Eig_id_2 loop m_memo := m; Hmm := H(m,m); r := x - Hmm; s := y - Hmm; p := (r * s - w) / H(m+1,m) + H(m,m+1); q := H(m+1,m+1) - Hmm - r - s; r := H(m+2,m+1); Scale := One / (Abs (p) + Abs (q) + Abs (r) + Min_Allowed_Real); p := p * Scale; q := q * Scale; r := r * Scale; exit when m = l_memo; tst1 := Abs (H(m,m-1)) * (Abs (q) + Abs (r)); tst2 := Abs (p)*(Abs (H(m-1,m-1)) + Abs (Hmm) + Abs (H(m+1,m+1))); exit when Arg_1_is_Negligible_Respect_Arg_2 (tst1, tst2); end loop; for i in m_memo+2 .. Eig_id_0 loop H(i,i-2) := Zero; if (i /= m_memo+2) then H(i,i-3) := Zero; end if; end loop; -- double qr step w/ rows l_memo .. Eig_id_0, columns m_memo .. Eig_id_0 Double_QR: for k in m_memo .. Eig_id_1 loop Final_k := (k = Eig_id_1); if k /= m_memo then p := H(k,k-1); q := H(k+1,k-1); if Final_k then r := Zero; else r := H(k+2,k-1); end if; Scale := Abs (p) + Abs (q) + Abs (r); if Scale < Min_Allowed_Real then goto End_of_Loop_Double_QR; -- and then increment k. end if; if Scale < Two**(Emin / 2) or else Scale > Two**(Real'Emax / 4) then Exp_s := Real'Exponent (Scale); scale := Two ** (Exp_s); Scale_Inv := Two ** (-Exp_s); p := p * Scale_Inv; q := q * Scale_Inv; r := r * Scale_Inv; else scale := One; scale_inv := One; end if; end if; ss := p*p + q*q + r*r; s := Real'Copy_Sign (Sqrt (ss), p); if (k /= m_memo) then H(k,k-1) := -s * Scale; else if (l_memo /= m_memo) then H(k,k-1) := -H(k,k-1); end if; end if; p_div_s := p / s; q_div_s := q / s; r_div_s := r / s; q_div_ps := q / (p + s); r_div_ps := r / (p + s); if not Final_k then -- rows for j in k .. Final_Col loop tmp0 := H(k,j) + (q_div_ps * H(k+1,j) + r_div_ps * H(k+2,j)); H(k,j) := -p_div_s * H(k,j) - (q_div_s*H(k+1,j) + r_div_s*H(k+2,j)); H(k+1,j) := H(k+1,j) - tmp0 * q_div_s; H(k+2,j) := H(k+2,j) - tmp0 * r_div_s; end loop; -- columns for i in Starting_Col .. Index'Min (Eig_id_0,k+3) loop tmp0 := H(i,k) + (q_div_ps * H(i,k+1) + r_div_ps * H(i,k+2)); H(i,k) := -p_div_s * H(i,k) - (q_div_s*H(i,k+1) + r_div_s*H(i,k+2)); H(i,k+1) := H(i,k+1) - tmp0 * q_div_s; H(i,k+2) := H(i,k+2) - tmp0 * r_div_s; end loop; -- accumulate transformations if Eigenvectors_Desired then for i in Starting_Col .. Final_Col loop tmp0 := Z(i,k) + (q_div_ps * Z(i,k+1) + r_div_ps * Z(i,k+2)); Z(i,k) := -p_div_s * Z(i,k) - (q_div_s*Z(i,k+1) + r_div_s*Z(i,k+2)); Z(i,k+1) := Z(i,k+1) - tmp0 * q_div_s; Z(i,k+2) := Z(i,k+2) - tmp0 * r_div_s; end loop; end if; else for j in k .. Final_Col loop tmp0 := H(k,j) + q_div_ps * H(k+1,j); H(k,j) := -p_div_s * H(k,j) - q_div_s * H(k+1,j); H(k+1,j) := H(k+1,j) - q_div_s * tmp0; end loop; -- columns for i in Starting_Col .. Index'Min (Eig_id_0,k+3) loop tmp0 := H(i,k) + q_div_ps * H(i,k+1); H(i,k) := -p_div_s * H(i,k) - q_div_s * H(i,k+1); H(i,k+1) := H(i,k+1) - q_div_s * tmp0; end loop; -- accumulate transformations if Eigenvectors_Desired then for i in Starting_Col .. Final_Col loop tmp0 := Z(i,k) + q_div_ps * Z(i,k+1); Z(i,k) := -p_div_s * Z(i,k) - q_div_s * Z(i,k+1); Z(i,k+1) := Z(i,k+1) - q_div_s * tmp0; end loop; end if; end if; <<End_of_Loop_Double_QR>> null; end loop Double_QR; -- increment k end loop Find_Next_Root; -- two roots found. x, y, w were defined up top as: -- -- x := H(Eig_id_0,Eig_id_0); -- y := H(Eig_id_1,Eig_id_1); -- w := H(Eig_id_0,Eig_id_1) * H(Eig_id_1,Eig_id_0); p := Half * (y - x); q := p * p + w; zz := Sqrt (Abs (q)); H(Eig_id_0,Eig_id_0) := x + t; H(Eig_id_1,Eig_id_1) := y + t; x := x + t; if q >= Zero then -- real pair zz := p + Real'Copy_Sign (zz, p); W_r(Eig_id_1) := x + zz; W_r(Eig_id_0) := W_r(Eig_id_1); if (Abs zz > Min_Allowed_Real) then W_r(Eig_id_0) := x - w / zz; end if; W_i(Eig_id_1) := Zero; W_i(Eig_id_0) := Zero; xx := H(Eig_id_0,Eig_id_1); declare hypot, sn_lo, sn_hi, cs_lo, cs_hi : Real; tmp1, tmp0 : Real; begin Rotation_Factors_2 (xx, zz, sn_lo, sn_hi, cs_lo, cs_hi, hypot); -- sn = a / Sqrt(a*a + b*b), cs = b / Sqrt(a*a + b*b), (a=xx, b = zz) -- rows for j in Eig_id_1 .. Final_Col loop tmp1 := H(Eig_id_1,j); tmp0 := H(Eig_id_0,j); H(Eig_id_1,j) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); H(Eig_id_0,j) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; -- columns for i in Starting_Col .. Eig_id_0 loop tmp1 := H(i,Eig_id_1); tmp0 := H(i,Eig_id_0); H(i,Eig_id_1) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); H(i,Eig_id_0) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; -- columns for i in Starting_Col .. Final_Col loop tmp1 := Z(i,Eig_id_1); tmp0 := Z(i,Eig_id_0); Z(i,Eig_id_1) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); Z(i,Eig_id_0) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; end; else -- complex pair W_r(Eig_id_1) := p + x; W_r(Eig_id_0) := p + x; W_i(Eig_id_1) := zz; W_i(Eig_id_0) :=-zz; end if; Eig_id_0 := Eig_id_2; <<End_of_Loop_Get_Next_Eigval>> null; end loop Get_Next_Eigval; end Find_All_Eigenvalues; end Apply_QR_to_Hessenberg; --------------------------- -- Find_all_Eigenvectors -- --------------------------- -- Backsubstitute to find vectors of upper triangular form H. procedure Find_all_Eigenvectors (H : in out Matrix; Z : in out Matrix; Z_i : out Matrix; W_r, W_i : in Col_Vector; Norm : in Real; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is Eig_Start, Eig_Memo : Index; Eig_2, Eig_1 : Index'Base; ra, sa : Real; p, q, r, s, w, zz : Real; Sum : Real; Min_Exp : constant Integer := Real'Machine_Emin; Min_Allowed_Real : constant Real := Two**(Min_Exp - Min_Exp/16); pragma Assert (Index'Base'First < Index'First - 1); pragma Assert (Final_Col > Starting_Col); begin if Norm = Zero then Z_i := (others => (others => Zero)); return; end if; Get_Next_Eigenvector: for Eig_0 in reverse Starting_Col .. Final_Col loop p := W_r(Eig_0); q := W_i(Eig_0); if Abs W_i(Eig_0) = Zero then -- Make real vector H(Eig_0,Eig_0) := One; Eig_Memo := Eig_0; if Eig_0 > Starting_Col then Get_Real_Vector: for i in reverse Starting_Col .. Eig_0-1 loop w := H(i,i) - p; r := Zero; for j in Eig_Memo .. Eig_0 loop r := r + H(i,j) * H(j,Eig_0); end loop; if W_i(i) < Zero then zz := w; s := r; else Eig_Memo := i; if (Abs W_i(i) < Min_Allowed_Real) then declare t : Real := w; Exp_t : Integer; begin if Abs t < Min_Allowed_Real then Exp_t := Real'Machine_Mantissa + 27; t := Norm * Two**(-Exp_t) + Min_Allowed_Real; end if; H(i,Eig_0) := -r / t; end; else -- solve real equations declare x, y, q, t : Real; begin x := H(i,i+1); y := H(i+1,i); q := (W_r(i) - p)**2 + W_i(i)**2; t := (x * s - zz * r) / q; H(i,Eig_0) := t; if (Abs (x) > Abs (zz)) then H(i+1,Eig_0) := (-r - w * t) / x; else H(i+1,Eig_0) := (-s - y * t) / zz; end if; end; end if; -- overflow control declare t, Scale : Real; Exp_t : Integer; begin t := Abs (H(i,Eig_0)); if t > Min_Allowed_Real then -- "t > Zero" fails Exp_t := Real'Exponent (t); if Exp_t > Real'Machine_Mantissa + 27 then Scale := Two**(-Exp_t); for j in i .. Eig_0 loop H(j,Eig_0) := H(j,Eig_0) * Scale; end loop; end if; end if; end; end if; end loop Get_Real_Vector; -- in i end if; -- if Eig_0 > Starting_Col -- Now go to end of loop Get_Next_Eigenvector, and increment Eig_0. elsif q < Zero then -- Complex vectors. Last vector component chosen imaginary -- so that eigenvector matrix is triangular. Eig_1 := Eig_0 - 1; Eig_2 := Eig_0 - 2; -- check if (Abs (H(Eig_0,Eig_1)) > Abs (H(Eig_1,Eig_0))) then H(Eig_1,Eig_1) := q / H(Eig_0,Eig_1); H(Eig_1,Eig_0) := -(H(Eig_0,Eig_0) - p) / H(Eig_0,Eig_1); else Div (Zero, -H(Eig_1,Eig_0), H(Eig_1,Eig_1)-p, q, H(Eig_1,Eig_1), H(Eig_1,Eig_0)); end if; H(Eig_0,Eig_1) := Zero; H(Eig_0,Eig_0) := One; Eig_Start := Eig_1; Get_Complex_Vector: for i in reverse Starting_Col .. Eig_2 loop w := H(i,i) - p; ra := Zero; sa := Zero; for j in Eig_Start .. Eig_0 loop ra := ra + H(i,j) * H(j,Eig_1); sa := sa + H(i,j) * H(j,Eig_0); end loop; if (W_i(i) < Zero) then zz := w; r := ra; s := sa; goto End_of_Loop_Get_Complex_Vector; end if; Eig_Start := i; -- decrement start of previous loop if (Abs W_i(i) < Min_Allowed_Real) then Div (-ra, -sa, w, q, H(i,Eig_1), H(i,Eig_0)); else -- solve complex equations declare x, y, vr, vi, tst1 : Real; begin x := H(i,i+1); y := H(i+1,i); vr := (W_r(i) - p) * (W_r(i) - p) + W_i(i) * W_i(i) - q * q; vi := (W_r(i) - p) * Two * q; if (Abs vr < Min_Allowed_Real and Abs vi < Min_Allowed_Real) then tst1 := Norm * (Abs(w)+Abs(q)+Abs(x)+Abs(y)+Abs(zz)); vr := tst1 * (Real'Epsilon * Two**(-10)); end if; Div(x*r-zz*ra+q*sa, x*s-zz*sa-q*ra, vr, vi, H(i,Eig_1), H(i,Eig_0)); if (Abs (x) > Abs (zz) + Abs (q)) then H(i+1,Eig_1) := (-ra - w * H(i,Eig_1) + q * H(i,Eig_0)) / x; H(i+1,Eig_0) := (-sa - w * H(i,Eig_0) - q * H(i,Eig_1)) / x; else Div(-r-y*H(i,Eig_1), -s-y*H(i,Eig_0), zz, q, H(i+1,Eig_1), H(i+1,Eig_0)); end if; end; end if; -- overflow control declare t, Scale : Real; Exp_t : Integer; begin t := Real'Max (Abs (H(i,Eig_1)), Abs (H(i,Eig_0))); if t > Min_Allowed_Real then Exp_t := Real'Exponent (t); if Exp_t > Real'Machine_Mantissa + 27 then Scale := Two**(-Exp_t); for j in i .. Eig_0 loop H(j,Eig_1) := H(j,Eig_1) * Scale; H(j,Eig_0) := H(j,Eig_0) * Scale; end loop; end if; end if; end; <<End_of_Loop_Get_Complex_Vector>> null; end loop Get_Complex_Vector; -- increment i end if; -- Abs W_i(Eig_0) < Min_Allowed_Real => do real vecs, else complex. end loop Get_Next_Eigenvector; -- increment Eig_0 -- multiply by transformation matrix to get the eigenvectors. -- Have H v = w v, where Z' A Z = H. Then Z H Z'(Zv) = w (Zv) -- implies that Z*v are the eigvecs of A = Z H Z'. (To save much -- space, the "v" eigenvectors were stored in H). --for j in reverse Starting_Col .. Final_Col loop -- for i in Starting_Col .. Final_Col loop -- Sum := Zero; -- for k in Starting_Col .. j loop -- Sum := Sum + Z(i,k) * H(k,j); -- end loop; -- Z(i,j) := Sum; -- end loop; --end loop; declare Z_row_vec, Z_new_row : array (Starting_Col .. Final_Col) of Real; begin for r in Starting_Col .. Final_Col loop for k in Starting_Col .. Final_Col loop -- reuse a row of Z below Z_row_vec(k) := Z(r, k); end loop; for c in Starting_Col .. Final_Col loop Sum := Zero; for k in Starting_Col .. c loop -- H is upper triangular --Sum := Sum + Z(r, k) * H(k, c); Sum := Sum + Z_row_vec(k) * H(k, c); -- H is Convention(Fortran). end loop; Z_new_row(c) := Sum; end loop; for c in Starting_Col .. Final_Col loop Z(r, c) := Z_new_row(c); end loop; end loop; end; Unpack_Eig_Vectors (W_i, Z, Z_i, Starting_Col, Final_Col); -- Gets (Z_r, Z_i) from Z. Destroys old Z. -- The out parameter Z_i is finally initialized here. end Find_all_Eigenvectors; ------------------------ -- Sort_Eigs_And_Vecs -- ------------------------ procedure Sort_Eigs_And_Vecs (Z_r, Z_i : in out Matrix; -- eigvecs are columns of Z W_r, W_i : in out Col_Vector; -- eigvals are vectors W Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is Max_Eig, tmp : Real; Eig_Size : Col_Vector := (others => Zero); i_Max : Index; begin if Starting_Col < Final_Col then for i in Starting_Col .. Final_Col loop Eig_Size(i) := Hypo.Hypotenuse (W_r(i), W_i(i)); end loop; for i in Starting_Col .. Final_Col-1 loop Max_Eig := Eig_Size(i); i_Max := i; for j in i+1 .. Final_Col loop if Eig_Size(j) > Max_Eig then Max_Eig := Eig_Size(j); i_Max := j; end if; end loop; if i_Max > i then tmp := W_r(i); W_r(i) := W_r(i_Max); W_r(i_Max) := tmp; tmp := W_i(i); W_i(i) := W_i(i_Max); W_i(i_Max) := tmp; tmp := Eig_Size(i); Eig_Size(i) := Eig_Size(i_Max); Eig_Size(i_Max) := tmp; -- swap cols of Z, the eigenvectors: for k in Starting_Col .. Final_Col loop tmp := Z_r(k, i); Z_r(k, i) := Z_r(k, i_Max); Z_r(k, i_Max) := tmp; end loop; for k in Starting_Col .. Final_Col loop tmp := Z_i(k, i); Z_i(k, i) := Z_i(k, i_Max); Z_i(k, i_Max) := tmp; end loop; end if; end loop; end if; end Sort_Eigs_And_Vecs; procedure Transpose (M : in out Matrix; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is tmp : Real; begin for r in Starting_Col .. Final_Col loop for c in Starting_Col .. r loop tmp := M(c,r); M(c,r) := M(r,c); M(r,c) := tmp; end loop; end loop; end Transpose; --------------- -- Decompose -- --------------- procedure Decompose (A : in out Matrix; Z_r, Z_i : out Matrix; W_r, W_i : out Col_Vector; Id_of_Failed_Eig : out Integer; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last; Eigenvectors_Desired : in Boolean := True; Balance_Policy : in Balance_Code := Disabled) is Norm : Real := One; Unscale_Eigs : Real := One; D : Col_Vector := (others => One); begin Id_of_Failed_Eig := Integer (Final_Col); -- init out parameter. Z_r := Givens_Hess.Identity; if Final_Col <= Starting_Col then raise Constraint_Error with "Can't have Final_Col <= Starting_Col"; end if; Balance_Matrix (A, D, Starting_Col, Final_Col, Balance_Policy); -- if matrix was balanced, then multiply D by I to get starting -- point for calculation of the Q matrix: Initial_Q => Z_r. -- -- ** The Q matrices won't be orthogonal if the matrix is balanced. ** for c in Index loop Z_r(c,c) := D(c); end loop; -- More generally, if Initial_Q is not I, but some Z_r: -- --for r in Starting_Col .. Final_Col loop --for c in Starting_Col .. Final_Col loop --Z_r(r,c) := Z_r(r,c) * D(c); --end loop; --end loop; Givens_Hess.Upper_Hessenberg (A => A, Q => Z_r, Starting_Col => Starting_Col, Final_Col => Final_Col, Initial_Q => Z_r); -- A is now in Upper_Hessenberg form, thanks to Z_r: A_true = Z_r' A Z_r. -- Procedure Upper_Hessenberg initializes "out" parameter Z_r. for i in 1 .. 8 loop Initial_QR.Lower_Diagonal_QR_Iteration (A => A, Q => Z_r, Shift => Zero, Starting_Col => Starting_Col, Final_Col => Final_Col); end loop; -- Helps eigvec calculation with several matrices, (eg. Pas_Fib, Vandermonde) -- Next, Z_r is input to Apply_QR_to_Hessenberg, where it is (optionally) -- transformed into the set of eigenvectors of A. -- -- A is now in Upper_Hessenberg form, thanks to Z_r: A_true = Z_r A Z_r'. Apply_QR_to_Hessenberg (A, Z_r, W_r, W_i, Norm, Unscale_Eigs, Starting_Col, Final_Col, Eigenvectors_Desired, -- if true then Z_i will be initialized Id_of_Failed_Eig); -- If Eigenvectors_Desired = False then Z_i remains uninitialized, -- (which may free up space with large matrices). if Eigenvectors_Desired then Find_all_Eigenvectors (A, Z_r, Z_i, W_r, W_i, Norm, Starting_Col, Final_Col); Normalize_Column_Vectors (Z_r, Z_i, Starting_Col, Final_Col); for c in Starting_Col .. Final_Col loop W_r(c) := Unscale_Eigs * W_r(c); W_i(c) := Unscale_Eigs * W_i(c); end loop; end if; end Decompose; end Peters_Eigen;
true
---------------------------------------------------------------------- -- package body Peters_Eigen, eigendecomposition -- Copyright (C) 2008-2018 PI:NAME:<NAME>END_PI. -- -- 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 Ada.numerics.Generic_Elementary_Functions; with Hessenberg; with Givens_QR_Method; with Hypot; package body Peters_Eigen is package Givens_Hess is new Hessenberg (Real, Index, Matrix); package Initial_QR is new Givens_QR_Method (Real, Index, Matrix); package Hypo is new Hypot (Real); Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; Half : constant Real := +0.5; Max_Exp : constant Integer := Real'Machine_Emax - Real'Machine_Emax/16; Sqrt_Max_Allowed_Real : constant Real := Two**(Max_Exp / 2); Min_Exp : constant Integer := Real'Machine_Emin - Real'Machine_Emin/16; Sqrt_Min_Allowed_Real : constant Real := Two**(Min_Exp / 2); package Math is new Ada.numerics.Generic_Elementary_Functions(Real); use Math; ---------- -- Div2 -- ---------- -- Complex division, C := A / B -- -- If B = 0, allow the usual real arithmetic to raise exceptions. -- -- Algorithm by PI:NAME:<NAME>END_PI. (Supposed to be better at avoiding -- unnecessary divisions by 0 (due to underflow) than Eispack version.) -- procedure Div2 (A_r, A_i : in Real; B_r, B_i : in Real; C_r, C_i : out Real) is e, f : Real; begin if Abs (B_i) < Abs (B_r) then e := B_i / B_r; f := B_r + B_i*e; C_r := (A_r + A_i*e) / f; C_i := (A_i - A_r*e) / f; else e := B_r / B_i; f := B_i + B_r*e; C_r := (A_i + A_r*e) / f; C_i :=(-A_r + A_i*e) / f; end if; end Div2; procedure Div (A_re, A_im : in Real; B_re, B_im : in Real; C_r, C_i : out Real) is A_max : constant Real := Real'Max (Abs A_re, Abs A_im); B_max : constant Real := Real'Max (Abs B_re, Abs B_im); A_Scale, B_Scale, Unscale, B_Squ : Real := One; A_Scale_exp, B_Scale_exp : Integer := 0; A_r, A_i, B_r, B_i : Real; begin C_r := Zero; C_i := Zero; if A_max = Zero then -- use default C_r, C_i return; end if; if B_max = Zero then raise Constraint_Error with "Division by 0 in Div"; end if; A_r := A_re; A_i := A_im; if A_max > Two**(Real'Machine_Emax/2 - 2) or else A_max < Two**(Real'Machine_Emin/2 + 2) then A_Scale_exp := -Real'Exponent (A_max); A_Scale := Two**A_Scale_exp; A_r := A_re * A_Scale; A_i := A_im * A_Scale; end if; B_r := B_re; B_i := B_im; if B_max > Two**(Real'Machine_Emax/2 - 2) or else B_max < Two**(Real'Machine_Emin/2 + 2) then B_Scale_exp := -Real'Exponent (B_max); B_Scale := Two**B_Scale_exp; B_r := B_re * B_Scale; B_i := B_im * B_Scale; end if; Unscale := Two**(B_Scale_exp - A_Scale_exp); -- over/under flow if A/B out of range. B_Squ := B_r**2 + B_i**2; C_r := ((A_r*B_r + A_i*B_i) / B_Squ) * Unscale; C_i := ((A_i*B_r - A_r*B_i) / B_Squ) * Unscale; end Div; -------------------- -- Balance_Matrix -- -------------------- -- procedure Balance_Matrix returns Vector D representing a -- diagonal matrix, and Matrix B, -- -- B := D^(-1) * A * D -- -- If we subsequently find the eigendecomposition of B -- -- B*v = lambda*v. -- -- Then -- -- D^(-1)*A*D*v = lambda*v -- -- implies that -- -- A*D*v = lambda*D*v, -- -- so that the eigenvectors of A are D*v, (D times the eigenvectors of B). -- The eigenvalues A and B are unchanged by the transformation. -- -- The eigenvectors v of matrix B are orthonormal, but not the -- eigenvectors D*v of matrix A. -- -- A is written over with B. procedure Balance_Matrix (A : in out Matrix; D : in out Col_Vector; Starting_Col : in Index; Final_Col : in Index; Balance_Policy : in Balance_Code := Partial) is Radix : constant Real := Two ** 1; -- Two**1 most accurate. Radix_Squared : constant Real := Radix ** 2; Reciprocal_Radix : constant Real := 1.0 / Radix; Reciprocal_Radix_Squared : constant Real := Reciprocal_Radix ** 2; Max_Allowed_Iterations : Integer := 16; Converged : Boolean := True; g, f, s : Real; Row_Norm, Col_Norm : Real; Min_Exp : constant Integer := Real'Machine_Emin + 16; Min_Allowed_Real : constant Real := Two ** Min_Exp; Max_Test : constant Real := Two**(Real'Machine_Emax / 2); Min_Test : constant Real := Two**(Real'Machine_Emin / 2); N : constant Integer := 1 + Integer (Real(Final_Col) - Real(Starting_Col)); begin case Balance_Policy is when Full => Max_Allowed_Iterations := 16; when Partial => Max_Allowed_Iterations := 2 + Integer (N / 500); when Disabled => Max_Allowed_Iterations := 0; end case; -- Balance a square block whose -- upper-left corner is (Starting_Col, Starting_Col). -- Lower-right corner is (Final_Col, Final_Col). D := (others => One); Until_Converged: for Interation_id in 1 .. Max_Allowed_Iterations loop Converged := True; for i in Starting_Col .. Final_Col loop Row_Norm := 0.0; Col_Norm := 0.0; for j in Starting_Col .. Final_Col loop if j /= i then Col_Norm := Col_Norm + Abs (A(j, i)); Row_Norm := Row_Norm + Abs (A(i, j)); end if; end loop; -- D(i) is already 1.0. If both norms are > 0.0 -- then calculate f for D(i) and g = 1/f for D(i)^(-1): if (Col_Norm > Min_Allowed_Real) and (Row_Norm > Min_Allowed_Real) then f := 1.0; g := Row_Norm * Reciprocal_Radix; s := Col_Norm + Row_Norm; while Col_Norm < g loop exit when f > Max_Test or else Col_Norm > Max_Test; f := f * Radix; Col_Norm := Col_Norm * Radix_Squared; end loop; g := Row_Norm * Radix; while Col_Norm > g loop exit when f < Min_Test or else Col_Norm < Min_Test; f := f * Reciprocal_Radix; Col_Norm := Col_Norm * Reciprocal_Radix_Squared; end loop; -- If we flunk the following test for all row/cols i, then -- Converged remains True, and we exit the loop and return. if ((Row_Norm + Col_Norm) / f < 0.93 * s) then -- .75 with 3 iters is like .95 with 2 iters Converged := False; D(i) := D(i) * f; -- D(i) initially 1.0 g := One / f; -- (multiplying by D on the right): Scale i_th col by f. for k in Starting_Col .. A'Last(1) loop -- k .. N A(k,i) := f * A(k,i); end loop; -- (multiplying by D^(-1) on the left)): Scale i_th row by g = 1/f for k in A'First(2) .. Final_Col loop -- 1 .. l A(i,k) := g * A(i,k); end loop; end if; end if; -- if both norms are non-zero end loop; -- in i_th row/col exit when Converged; end loop Until_Converged; end Balance_Matrix; ------------------ -- Balance_Undo -- ------------------ -- -- The eigenvectors of A are D*z, (multiply diagonal matrix -- D on the right times the eigenvectors Z of the balanced matrix B). -- procedure Balance_Undo (D : in Col_Vector; Z : in out Matrix; Starting_Col : in Index; Final_Col : in Index) is begin for r in Starting_Col .. Final_Col loop for c in Starting_Col .. Final_Col loop Z(r,c) := Z(r,c) * D(r); end loop; end loop; end Balance_Undo; ------------------------ -- Rotation_Factors_2 -- ------------------------ -- sn = a / sqrt(a**2 + b**2) -- cs = b / sqrt(a**2 + b**2) procedure Rotation_Factors_2 (a, b : in Real; sn_lo, sn_hi, cs_lo, cs_hi : out Real; hypot : out Real) is Abs_a : constant Real := Abs a; Abs_b : constant Real := Abs b; min_over_hypot, max_over_hypot_minus_1 : Real; Min_Allowed_Real : constant Real := Two**(Real'Machine_Emin + 16); begin -- default: cs_hi := One; cs_lo := Zero; sn_hi := Zero; sn_lo := Zero; hypot := One; if Abs_a >= Abs_b then if Abs_a > Min_Allowed_Real then Hypo.Get_Hypotenuse (a, b, hypot, min_over_hypot, max_over_hypot_minus_1); cs_hi := Zero; cs_lo := min_over_hypot; sn_hi := One; sn_lo := max_over_hypot_minus_1; if a < Zero then sn_hi := -sn_hi; sn_lo := -sn_lo; end if; if b < Zero then cs_lo := -cs_lo; end if; end if; else if Abs_b > Min_Allowed_Real then Hypo.Get_Hypotenuse (a, b, hypot, min_over_hypot, max_over_hypot_minus_1); sn_hi := Zero; sn_lo := min_over_hypot; cs_hi := One; cs_lo := max_over_hypot_minus_1; if a < Zero then sn_lo := -sn_lo; end if; if b < Zero then cs_hi := -cs_hi; cs_lo := -cs_lo; end if; end if; end if; end Rotation_Factors_2; --------------------------------------- -- Arg_1_is_Negligible_Respect_Arg_2 -- --------------------------------------- -- IF Abs_x is negligible in comparison to Abs_y then return True. function Arg_1_is_Negligible_Respect_Arg_2 (x, y : Real) return Boolean is Abs_x : constant Real := Abs x; Abs_y : constant Real := Abs y; Min_Allowed_Real : constant Real := Two ** Real'Machine_Emin; Added_Range : constant := 5; -- 2 to 8. 6,7 std. 7 helps with clustered eigs. Effective_Mantissa : constant Integer := Real'Machine_Mantissa + Added_Range; Eps_Factor : constant Real := Two**(-Effective_Mantissa); pragma Assert (Added_Range > 1); -- Stnd setting for Eps_Factor is: 2**(-Real'Machine_Mantissa-2) -- Usually Real'Machine_Mantissa = 53 if Real is 15 digits. begin if Abs_x < Min_Allowed_Real then -- eg, Abs_x = 0.0 return True; elsif Abs_x <= Abs_y*Eps_Factor then -- Abs_x is negligible in comparison to Abs_y return True; else return False; end if; end Arg_1_is_Negligible_Respect_Arg_2; ------------------------ -- Unpack_Eig_Vectors -- ------------------------ procedure Unpack_Eig_Vectors (W_i : in Col_Vector; Z : in out Matrix; -- will exit with Z_r, the real part of Z. Z_i : out Matrix; -- will exit with imaginary part. Starting_Col : in Index; Final_Col : in Index) is begin Z_i := (others => (others => Zero)); -- Im (W) > 0 at column c means that columns c and c+1 of Z are the -- Re and Im parts of the Eigenvector, with eig_val = (W_r(c), Abs(W_i(c))). for c in Starting_Col .. Final_Col-1 loop if W_i(c) > Zero then for j in Starting_Col .. Final_Col loop Z_i(j,c) := Z(j,c+1); Z_i(j,c+1) := -Z(j,c+1); end loop; for j in Starting_Col .. Final_Col loop Z(j,c+1):= Z(j,c); -- the real parts of the above 2 vecs are equal. end loop; if not (W_i(c+1) < Zero) then -- something went very wrong. raise Constraint_Error with "Fatal error in Unpack_Eig_Vectors"; end if; end if; end loop; end Unpack_Eig_Vectors; ---------- -- Norm -- ---------- function Norm (V_r, V_i : in Col_Vector; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) return Real is Max : Real := Zero; Sum, tst : Real := Zero; Scale : Real := One; Scaled : Boolean := False; Scale_Exp : Integer; X, Y : Real; begin for i in Starting_Col .. Final_Col loop tst := Abs (V_r(i)); if tst > Max then Max := tst; end if; tst := Abs (V_i(i)); if tst > Max then Max := tst; end if; end loop; if Max > Sqrt_Max_Allowed_Real then Scale_Exp := Integer'Min (Real'Exponent (Max), Real'Machine_Emax-4); Scale := Two**(-Scale_Exp); Scaled := True; end if; if Max < Sqrt_Min_Allowed_Real then Scale_Exp := Integer'Max (Real'Exponent (Max), Real'Machine_Emin+4); Scale := Two**(-Scale_Exp); Scaled := True; end if; if Scaled then for k in Starting_Col .. Final_Col loop X := Scale * V_r(k); Y := Scale * V_i(k); Sum := Sum + X**2 + Y**2; end loop; else for k in Starting_Col .. Final_Col loop Sum := Sum + V_r(k)**2 + V_i(k)**2; end loop; end if; if Scaled then return Sqrt (Abs Sum) * Two**Scale_Exp; else return Sqrt (Abs Sum); end if; end Norm; ------------------------------ -- Normalize_Column_Vectors -- ------------------------------ procedure Normalize_Column_Vectors (Z_r, Z_i : in out Matrix; Starting_Col : in Index; Final_Col : in Index) is Min_Exp : constant Integer := Real'Machine_Emin/2 + Real'Machine_Emin/4; Min_Allowed_Real : constant Real := Two**Min_Exp; V_r, V_i : Col_Vector; Norm_Factor : Real; begin for Col_id in Starting_Col .. Final_Col loop for j in Starting_Col .. Final_Col loop V_r(j) := Z_r(j, Col_id); end loop; for j in Starting_Col .. Final_Col loop V_i(j) := Z_i(j, Col_id); end loop; Norm_Factor := One / (Norm (V_r, V_i, Starting_Col, Final_Col) + Min_Allowed_Real); for j in Starting_Col .. Final_Col loop Z_r(j, Col_id) := Z_r(j, Col_id) * Norm_Factor; end loop; for j in Starting_Col .. Final_Col loop Z_i(j, Col_id) := Z_i(j, Col_id) * Norm_Factor; end loop; end loop; end Normalize_Column_Vectors; ---------------------------- -- Apply_QR_to_Hessenberg -- ---------------------------- -- Apply_QR_to_Hessenberg is a translation of the algol procedure -- hqr2, num. math. 16, 181-204(1970) by PI:NAME:<NAME>END_PI. -- handbook for auto. comp., vol.ii-linear algebra, 372-395(1971). -- -- Have Z' A Z = H where H and Z are input below. (H is upper Hessenberg.) -- The problem is to further elaborate Z so that A Z = w Z. The -- Col vectors of Z are eigvecs, and the diagonal elements of w are the -- eigvals. procedure Apply_QR_to_Hessenberg (H : in out Matrix; Z : in out Matrix; W_r, W_i : out Col_Vector; Norm : out Real; Unscale_Eigs : out Real; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last; Eigenvectors_Desired : in Boolean := True; Id_of_Failed_Eig : out Integer) is N : constant Real := Real(Final_Col) - Real(Starting_Col) + One; Max_Allowed_Iterations : constant Integer := 128 * Integer (N); Remaining_Iterations : Integer := Max_Allowed_Iterations; Iteration_id : Integer := 1; Emin : constant Integer := Real'Machine_Emin; Min_Exp : constant Integer := Emin - Emin / 16; Min_Allowed_Real : constant Real := Two**(Min_Exp / 2 + 64); pragma Assert (Index'Base'First < Index'First - 1); pragma Assert (Final_Col > Starting_Col); Scale_Eigs : Real; begin W_r := (others => Zero); -- important init. W_i := (others => Zero); Id_of_Failed_Eig := Integer(Starting_Col) - 1; -- means none failed. -- compute matrix Norm Norm := Zero; for c in Starting_Col .. Final_Col loop for r in Starting_Col .. Final_Col loop Norm := Norm + Abs (H(r,c)); end loop; end loop; Unscale_Eigs := One; if Norm > Two ** (Real'Machine_Emax / 2 - 2) then Scale_Eigs := Two ** (- Real'Exponent (Norm)); UnScale_Eigs := One / Scale_Eigs; for c in Starting_Col .. Final_Col loop for r in Starting_Col .. Final_Col loop H(r,c) := H(r,c) * Scale_Eigs; end loop; end loop; end if; Find_All_Eigenvalues: declare Eig_id_0 : Index'Base := Final_Col; Eig_id_2, Eig_id_1 : Index'Base; l_memo, m_memo : Index; Final_k : Boolean; t : Real := Zero; -- essential init tst1, tst2 : Real := Zero; Hmm : Real; x, y : Real; p,q,r,w,zz,xx : Real; Exp_s : Integer; Scale, Scale_Inv : Real; r_div_s, q_div_s, p_div_s : Real; q_div_ps, r_div_ps : Real; s, ss, tmp0 : Real := Zero; begin Get_Next_Eigval: while Eig_id_0 >= Starting_Col loop -- iterate for eigenvalues: Iteration_id := 1; Eig_id_1 := Eig_id_0 - 1; Eig_id_2 := Eig_id_0 - 2; -- look for single small sub-diagonal element loop Find_Next_Root: loop for l in reverse Starting_Col .. Eig_id_0 loop l_memo := l; exit when l = Starting_Col; s := Abs (H(l-1,l-1)) + Abs (H(l,l)); if s < Min_Allowed_Real then s := Norm; end if; exit when Arg_1_is_Negligible_Respect_Arg_2 (H(l,l-1), s); end loop; -- form shift. x := H(Eig_id_0,Eig_id_0); if l_memo = Eig_id_0 then -- 1 root found H(Eig_id_0,Eig_id_0) := x + t; W_r(Eig_id_0) := H(Eig_id_0,Eig_id_0); W_i(Eig_id_0) := Zero; Eig_id_0 := Eig_id_1; goto End_of_Loop_Get_Next_Eigval; -- Notice we just decremented Eig_id_0. end if; y := H(Eig_id_1,Eig_id_1); w := H(Eig_id_0,Eig_id_1) * H(Eig_id_1,Eig_id_0); exit Find_Next_Root when l_memo = Eig_id_1; -- 2 roots found if Remaining_Iterations = 0 then -- didn't converge Id_of_Failed_Eig := Integer (Eig_id_0); return; end if; -- form exceptional shift if Iteration_id mod 14 = 0 then -- Forsythe_0 needs this. t := t + x; for i in Starting_Col .. Eig_id_0 loop H(i,i) := H(i,i) - x; end loop; s := Abs (H(Eig_id_0,Eig_id_1)) + Abs (H(Eig_id_1,Eig_id_2)); x := 0.75 * s; y := x; w := -0.4375 * s * s; end if; Iteration_id := Iteration_id + 1; Remaining_Iterations := Remaining_Iterations - 1; -- look for two consecutive small loop sub-diagonal elements. for m in reverse l_memo .. Eig_id_2 loop m_memo := m; Hmm := H(m,m); r := x - Hmm; s := y - Hmm; p := (r * s - w) / H(m+1,m) + H(m,m+1); q := H(m+1,m+1) - Hmm - r - s; r := H(m+2,m+1); Scale := One / (Abs (p) + Abs (q) + Abs (r) + Min_Allowed_Real); p := p * Scale; q := q * Scale; r := r * Scale; exit when m = l_memo; tst1 := Abs (H(m,m-1)) * (Abs (q) + Abs (r)); tst2 := Abs (p)*(Abs (H(m-1,m-1)) + Abs (Hmm) + Abs (H(m+1,m+1))); exit when Arg_1_is_Negligible_Respect_Arg_2 (tst1, tst2); end loop; for i in m_memo+2 .. Eig_id_0 loop H(i,i-2) := Zero; if (i /= m_memo+2) then H(i,i-3) := Zero; end if; end loop; -- double qr step w/ rows l_memo .. Eig_id_0, columns m_memo .. Eig_id_0 Double_QR: for k in m_memo .. Eig_id_1 loop Final_k := (k = Eig_id_1); if k /= m_memo then p := H(k,k-1); q := H(k+1,k-1); if Final_k then r := Zero; else r := H(k+2,k-1); end if; Scale := Abs (p) + Abs (q) + Abs (r); if Scale < Min_Allowed_Real then goto End_of_Loop_Double_QR; -- and then increment k. end if; if Scale < Two**(Emin / 2) or else Scale > Two**(Real'Emax / 4) then Exp_s := Real'Exponent (Scale); scale := Two ** (Exp_s); Scale_Inv := Two ** (-Exp_s); p := p * Scale_Inv; q := q * Scale_Inv; r := r * Scale_Inv; else scale := One; scale_inv := One; end if; end if; ss := p*p + q*q + r*r; s := Real'Copy_Sign (Sqrt (ss), p); if (k /= m_memo) then H(k,k-1) := -s * Scale; else if (l_memo /= m_memo) then H(k,k-1) := -H(k,k-1); end if; end if; p_div_s := p / s; q_div_s := q / s; r_div_s := r / s; q_div_ps := q / (p + s); r_div_ps := r / (p + s); if not Final_k then -- rows for j in k .. Final_Col loop tmp0 := H(k,j) + (q_div_ps * H(k+1,j) + r_div_ps * H(k+2,j)); H(k,j) := -p_div_s * H(k,j) - (q_div_s*H(k+1,j) + r_div_s*H(k+2,j)); H(k+1,j) := H(k+1,j) - tmp0 * q_div_s; H(k+2,j) := H(k+2,j) - tmp0 * r_div_s; end loop; -- columns for i in Starting_Col .. Index'Min (Eig_id_0,k+3) loop tmp0 := H(i,k) + (q_div_ps * H(i,k+1) + r_div_ps * H(i,k+2)); H(i,k) := -p_div_s * H(i,k) - (q_div_s*H(i,k+1) + r_div_s*H(i,k+2)); H(i,k+1) := H(i,k+1) - tmp0 * q_div_s; H(i,k+2) := H(i,k+2) - tmp0 * r_div_s; end loop; -- accumulate transformations if Eigenvectors_Desired then for i in Starting_Col .. Final_Col loop tmp0 := Z(i,k) + (q_div_ps * Z(i,k+1) + r_div_ps * Z(i,k+2)); Z(i,k) := -p_div_s * Z(i,k) - (q_div_s*Z(i,k+1) + r_div_s*Z(i,k+2)); Z(i,k+1) := Z(i,k+1) - tmp0 * q_div_s; Z(i,k+2) := Z(i,k+2) - tmp0 * r_div_s; end loop; end if; else for j in k .. Final_Col loop tmp0 := H(k,j) + q_div_ps * H(k+1,j); H(k,j) := -p_div_s * H(k,j) - q_div_s * H(k+1,j); H(k+1,j) := H(k+1,j) - q_div_s * tmp0; end loop; -- columns for i in Starting_Col .. Index'Min (Eig_id_0,k+3) loop tmp0 := H(i,k) + q_div_ps * H(i,k+1); H(i,k) := -p_div_s * H(i,k) - q_div_s * H(i,k+1); H(i,k+1) := H(i,k+1) - q_div_s * tmp0; end loop; -- accumulate transformations if Eigenvectors_Desired then for i in Starting_Col .. Final_Col loop tmp0 := Z(i,k) + q_div_ps * Z(i,k+1); Z(i,k) := -p_div_s * Z(i,k) - q_div_s * Z(i,k+1); Z(i,k+1) := Z(i,k+1) - q_div_s * tmp0; end loop; end if; end if; <<End_of_Loop_Double_QR>> null; end loop Double_QR; -- increment k end loop Find_Next_Root; -- two roots found. x, y, w were defined up top as: -- -- x := H(Eig_id_0,Eig_id_0); -- y := H(Eig_id_1,Eig_id_1); -- w := H(Eig_id_0,Eig_id_1) * H(Eig_id_1,Eig_id_0); p := Half * (y - x); q := p * p + w; zz := Sqrt (Abs (q)); H(Eig_id_0,Eig_id_0) := x + t; H(Eig_id_1,Eig_id_1) := y + t; x := x + t; if q >= Zero then -- real pair zz := p + Real'Copy_Sign (zz, p); W_r(Eig_id_1) := x + zz; W_r(Eig_id_0) := W_r(Eig_id_1); if (Abs zz > Min_Allowed_Real) then W_r(Eig_id_0) := x - w / zz; end if; W_i(Eig_id_1) := Zero; W_i(Eig_id_0) := Zero; xx := H(Eig_id_0,Eig_id_1); declare hypot, sn_lo, sn_hi, cs_lo, cs_hi : Real; tmp1, tmp0 : Real; begin Rotation_Factors_2 (xx, zz, sn_lo, sn_hi, cs_lo, cs_hi, hypot); -- sn = a / Sqrt(a*a + b*b), cs = b / Sqrt(a*a + b*b), (a=xx, b = zz) -- rows for j in Eig_id_1 .. Final_Col loop tmp1 := H(Eig_id_1,j); tmp0 := H(Eig_id_0,j); H(Eig_id_1,j) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); H(Eig_id_0,j) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; -- columns for i in Starting_Col .. Eig_id_0 loop tmp1 := H(i,Eig_id_1); tmp0 := H(i,Eig_id_0); H(i,Eig_id_1) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); H(i,Eig_id_0) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; -- columns for i in Starting_Col .. Final_Col loop tmp1 := Z(i,Eig_id_1); tmp0 := Z(i,Eig_id_0); Z(i,Eig_id_1) := sn_hi*tmp0 + cs_hi*tmp1 + (cs_lo*tmp1 + sn_lo*tmp0); Z(i,Eig_id_0) :=-sn_hi*tmp1 + cs_hi*tmp0 + (cs_lo*tmp0 - sn_lo*tmp1); end loop; end; else -- complex pair W_r(Eig_id_1) := p + x; W_r(Eig_id_0) := p + x; W_i(Eig_id_1) := zz; W_i(Eig_id_0) :=-zz; end if; Eig_id_0 := Eig_id_2; <<End_of_Loop_Get_Next_Eigval>> null; end loop Get_Next_Eigval; end Find_All_Eigenvalues; end Apply_QR_to_Hessenberg; --------------------------- -- Find_all_Eigenvectors -- --------------------------- -- Backsubstitute to find vectors of upper triangular form H. procedure Find_all_Eigenvectors (H : in out Matrix; Z : in out Matrix; Z_i : out Matrix; W_r, W_i : in Col_Vector; Norm : in Real; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is Eig_Start, Eig_Memo : Index; Eig_2, Eig_1 : Index'Base; ra, sa : Real; p, q, r, s, w, zz : Real; Sum : Real; Min_Exp : constant Integer := Real'Machine_Emin; Min_Allowed_Real : constant Real := Two**(Min_Exp - Min_Exp/16); pragma Assert (Index'Base'First < Index'First - 1); pragma Assert (Final_Col > Starting_Col); begin if Norm = Zero then Z_i := (others => (others => Zero)); return; end if; Get_Next_Eigenvector: for Eig_0 in reverse Starting_Col .. Final_Col loop p := W_r(Eig_0); q := W_i(Eig_0); if Abs W_i(Eig_0) = Zero then -- Make real vector H(Eig_0,Eig_0) := One; Eig_Memo := Eig_0; if Eig_0 > Starting_Col then Get_Real_Vector: for i in reverse Starting_Col .. Eig_0-1 loop w := H(i,i) - p; r := Zero; for j in Eig_Memo .. Eig_0 loop r := r + H(i,j) * H(j,Eig_0); end loop; if W_i(i) < Zero then zz := w; s := r; else Eig_Memo := i; if (Abs W_i(i) < Min_Allowed_Real) then declare t : Real := w; Exp_t : Integer; begin if Abs t < Min_Allowed_Real then Exp_t := Real'Machine_Mantissa + 27; t := Norm * Two**(-Exp_t) + Min_Allowed_Real; end if; H(i,Eig_0) := -r / t; end; else -- solve real equations declare x, y, q, t : Real; begin x := H(i,i+1); y := H(i+1,i); q := (W_r(i) - p)**2 + W_i(i)**2; t := (x * s - zz * r) / q; H(i,Eig_0) := t; if (Abs (x) > Abs (zz)) then H(i+1,Eig_0) := (-r - w * t) / x; else H(i+1,Eig_0) := (-s - y * t) / zz; end if; end; end if; -- overflow control declare t, Scale : Real; Exp_t : Integer; begin t := Abs (H(i,Eig_0)); if t > Min_Allowed_Real then -- "t > Zero" fails Exp_t := Real'Exponent (t); if Exp_t > Real'Machine_Mantissa + 27 then Scale := Two**(-Exp_t); for j in i .. Eig_0 loop H(j,Eig_0) := H(j,Eig_0) * Scale; end loop; end if; end if; end; end if; end loop Get_Real_Vector; -- in i end if; -- if Eig_0 > Starting_Col -- Now go to end of loop Get_Next_Eigenvector, and increment Eig_0. elsif q < Zero then -- Complex vectors. Last vector component chosen imaginary -- so that eigenvector matrix is triangular. Eig_1 := Eig_0 - 1; Eig_2 := Eig_0 - 2; -- check if (Abs (H(Eig_0,Eig_1)) > Abs (H(Eig_1,Eig_0))) then H(Eig_1,Eig_1) := q / H(Eig_0,Eig_1); H(Eig_1,Eig_0) := -(H(Eig_0,Eig_0) - p) / H(Eig_0,Eig_1); else Div (Zero, -H(Eig_1,Eig_0), H(Eig_1,Eig_1)-p, q, H(Eig_1,Eig_1), H(Eig_1,Eig_0)); end if; H(Eig_0,Eig_1) := Zero; H(Eig_0,Eig_0) := One; Eig_Start := Eig_1; Get_Complex_Vector: for i in reverse Starting_Col .. Eig_2 loop w := H(i,i) - p; ra := Zero; sa := Zero; for j in Eig_Start .. Eig_0 loop ra := ra + H(i,j) * H(j,Eig_1); sa := sa + H(i,j) * H(j,Eig_0); end loop; if (W_i(i) < Zero) then zz := w; r := ra; s := sa; goto End_of_Loop_Get_Complex_Vector; end if; Eig_Start := i; -- decrement start of previous loop if (Abs W_i(i) < Min_Allowed_Real) then Div (-ra, -sa, w, q, H(i,Eig_1), H(i,Eig_0)); else -- solve complex equations declare x, y, vr, vi, tst1 : Real; begin x := H(i,i+1); y := H(i+1,i); vr := (W_r(i) - p) * (W_r(i) - p) + W_i(i) * W_i(i) - q * q; vi := (W_r(i) - p) * Two * q; if (Abs vr < Min_Allowed_Real and Abs vi < Min_Allowed_Real) then tst1 := Norm * (Abs(w)+Abs(q)+Abs(x)+Abs(y)+Abs(zz)); vr := tst1 * (Real'Epsilon * Two**(-10)); end if; Div(x*r-zz*ra+q*sa, x*s-zz*sa-q*ra, vr, vi, H(i,Eig_1), H(i,Eig_0)); if (Abs (x) > Abs (zz) + Abs (q)) then H(i+1,Eig_1) := (-ra - w * H(i,Eig_1) + q * H(i,Eig_0)) / x; H(i+1,Eig_0) := (-sa - w * H(i,Eig_0) - q * H(i,Eig_1)) / x; else Div(-r-y*H(i,Eig_1), -s-y*H(i,Eig_0), zz, q, H(i+1,Eig_1), H(i+1,Eig_0)); end if; end; end if; -- overflow control declare t, Scale : Real; Exp_t : Integer; begin t := Real'Max (Abs (H(i,Eig_1)), Abs (H(i,Eig_0))); if t > Min_Allowed_Real then Exp_t := Real'Exponent (t); if Exp_t > Real'Machine_Mantissa + 27 then Scale := Two**(-Exp_t); for j in i .. Eig_0 loop H(j,Eig_1) := H(j,Eig_1) * Scale; H(j,Eig_0) := H(j,Eig_0) * Scale; end loop; end if; end if; end; <<End_of_Loop_Get_Complex_Vector>> null; end loop Get_Complex_Vector; -- increment i end if; -- Abs W_i(Eig_0) < Min_Allowed_Real => do real vecs, else complex. end loop Get_Next_Eigenvector; -- increment Eig_0 -- multiply by transformation matrix to get the eigenvectors. -- Have H v = w v, where Z' A Z = H. Then Z H Z'(Zv) = w (Zv) -- implies that Z*v are the eigvecs of A = Z H Z'. (To save much -- space, the "v" eigenvectors were stored in H). --for j in reverse Starting_Col .. Final_Col loop -- for i in Starting_Col .. Final_Col loop -- Sum := Zero; -- for k in Starting_Col .. j loop -- Sum := Sum + Z(i,k) * H(k,j); -- end loop; -- Z(i,j) := Sum; -- end loop; --end loop; declare Z_row_vec, Z_new_row : array (Starting_Col .. Final_Col) of Real; begin for r in Starting_Col .. Final_Col loop for k in Starting_Col .. Final_Col loop -- reuse a row of Z below Z_row_vec(k) := Z(r, k); end loop; for c in Starting_Col .. Final_Col loop Sum := Zero; for k in Starting_Col .. c loop -- H is upper triangular --Sum := Sum + Z(r, k) * H(k, c); Sum := Sum + Z_row_vec(k) * H(k, c); -- H is Convention(Fortran). end loop; Z_new_row(c) := Sum; end loop; for c in Starting_Col .. Final_Col loop Z(r, c) := Z_new_row(c); end loop; end loop; end; Unpack_Eig_Vectors (W_i, Z, Z_i, Starting_Col, Final_Col); -- Gets (Z_r, Z_i) from Z. Destroys old Z. -- The out parameter Z_i is finally initialized here. end Find_all_Eigenvectors; ------------------------ -- Sort_Eigs_And_Vecs -- ------------------------ procedure Sort_Eigs_And_Vecs (Z_r, Z_i : in out Matrix; -- eigvecs are columns of Z W_r, W_i : in out Col_Vector; -- eigvals are vectors W Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is Max_Eig, tmp : Real; Eig_Size : Col_Vector := (others => Zero); i_Max : Index; begin if Starting_Col < Final_Col then for i in Starting_Col .. Final_Col loop Eig_Size(i) := Hypo.Hypotenuse (W_r(i), W_i(i)); end loop; for i in Starting_Col .. Final_Col-1 loop Max_Eig := Eig_Size(i); i_Max := i; for j in i+1 .. Final_Col loop if Eig_Size(j) > Max_Eig then Max_Eig := Eig_Size(j); i_Max := j; end if; end loop; if i_Max > i then tmp := W_r(i); W_r(i) := W_r(i_Max); W_r(i_Max) := tmp; tmp := W_i(i); W_i(i) := W_i(i_Max); W_i(i_Max) := tmp; tmp := Eig_Size(i); Eig_Size(i) := Eig_Size(i_Max); Eig_Size(i_Max) := tmp; -- swap cols of Z, the eigenvectors: for k in Starting_Col .. Final_Col loop tmp := Z_r(k, i); Z_r(k, i) := Z_r(k, i_Max); Z_r(k, i_Max) := tmp; end loop; for k in Starting_Col .. Final_Col loop tmp := Z_i(k, i); Z_i(k, i) := Z_i(k, i_Max); Z_i(k, i_Max) := tmp; end loop; end if; end loop; end if; end Sort_Eigs_And_Vecs; procedure Transpose (M : in out Matrix; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last) is tmp : Real; begin for r in Starting_Col .. Final_Col loop for c in Starting_Col .. r loop tmp := M(c,r); M(c,r) := M(r,c); M(r,c) := tmp; end loop; end loop; end Transpose; --------------- -- Decompose -- --------------- procedure Decompose (A : in out Matrix; Z_r, Z_i : out Matrix; W_r, W_i : out Col_Vector; Id_of_Failed_Eig : out Integer; Starting_Col : in Index := Index'First; Final_Col : in Index := Index'Last; Eigenvectors_Desired : in Boolean := True; Balance_Policy : in Balance_Code := Disabled) is Norm : Real := One; Unscale_Eigs : Real := One; D : Col_Vector := (others => One); begin Id_of_Failed_Eig := Integer (Final_Col); -- init out parameter. Z_r := Givens_Hess.Identity; if Final_Col <= Starting_Col then raise Constraint_Error with "Can't have Final_Col <= Starting_Col"; end if; Balance_Matrix (A, D, Starting_Col, Final_Col, Balance_Policy); -- if matrix was balanced, then multiply D by I to get starting -- point for calculation of the Q matrix: Initial_Q => Z_r. -- -- ** The Q matrices won't be orthogonal if the matrix is balanced. ** for c in Index loop Z_r(c,c) := D(c); end loop; -- More generally, if Initial_Q is not I, but some Z_r: -- --for r in Starting_Col .. Final_Col loop --for c in Starting_Col .. Final_Col loop --Z_r(r,c) := Z_r(r,c) * D(c); --end loop; --end loop; Givens_Hess.Upper_Hessenberg (A => A, Q => Z_r, Starting_Col => Starting_Col, Final_Col => Final_Col, Initial_Q => Z_r); -- A is now in Upper_Hessenberg form, thanks to Z_r: A_true = Z_r' A Z_r. -- Procedure Upper_Hessenberg initializes "out" parameter Z_r. for i in 1 .. 8 loop Initial_QR.Lower_Diagonal_QR_Iteration (A => A, Q => Z_r, Shift => Zero, Starting_Col => Starting_Col, Final_Col => Final_Col); end loop; -- Helps eigvec calculation with several matrices, (eg. Pas_Fib, Vandermonde) -- Next, Z_r is input to Apply_QR_to_Hessenberg, where it is (optionally) -- transformed into the set of eigenvectors of A. -- -- A is now in Upper_Hessenberg form, thanks to Z_r: A_true = Z_r A Z_r'. Apply_QR_to_Hessenberg (A, Z_r, W_r, W_i, Norm, Unscale_Eigs, Starting_Col, Final_Col, Eigenvectors_Desired, -- if true then Z_i will be initialized Id_of_Failed_Eig); -- If Eigenvectors_Desired = False then Z_i remains uninitialized, -- (which may free up space with large matrices). if Eigenvectors_Desired then Find_all_Eigenvectors (A, Z_r, Z_i, W_r, W_i, Norm, Starting_Col, Final_Col); Normalize_Column_Vectors (Z_r, Z_i, Starting_Col, Final_Col); for c in Starting_Col .. Final_Col loop W_r(c) := Unscale_Eigs * W_r(c); W_i(c) := Unscale_Eigs * W_i(c); end loop; end if; end Decompose; end Peters_Eigen;
[ { "context": "-- Copyright (C) 2019 Thierry Rascle <[email protected]>\n-- MIT license. Please refer t", "end": 36, "score": 0.9998762011528015, "start": 22, "tag": "NAME", "value": "Thierry Rascle" }, { "context": "-- Copyright (C) 2019 Thierry Rascle <[email protected]>\n-- MIT license. Please refer to the LICENSE file", "end": 54, "score": 0.9999327659606934, "start": 38, "tag": "EMAIL", "value": "[email protected]" } ]
src/apsepp-test_event_class-generic_r_index_mixin.adb
thierr26/ada-apsepp
0
-- Copyright (C) 2019 Thierry Rascle <[email protected]> -- MIT license. Please refer to the LICENSE file. package body Apsepp.Test_Event_Class.Generic_R_Index_Mixin is ---------------------------------------------------------------------------- overriding procedure Set (Obj : in out Child_W_R_Index; Data : Test_Event_Data) is begin Parent (Obj).Set (Data); -- Inherited procedure call. Obj.R_Index := Data.R_Index; end Set; ---------------------------------------------------------------------------- overriding function R_Index (Obj : Child_W_R_Index) return Test_Routine_Index is (Obj.R_Index); ---------------------------------------------------------------------------- end Apsepp.Test_Event_Class.Generic_R_Index_Mixin;
24323
-- Copyright (C) 2019 <NAME> <<EMAIL>> -- MIT license. Please refer to the LICENSE file. package body Apsepp.Test_Event_Class.Generic_R_Index_Mixin is ---------------------------------------------------------------------------- overriding procedure Set (Obj : in out Child_W_R_Index; Data : Test_Event_Data) is begin Parent (Obj).Set (Data); -- Inherited procedure call. Obj.R_Index := Data.R_Index; end Set; ---------------------------------------------------------------------------- overriding function R_Index (Obj : Child_W_R_Index) return Test_Routine_Index is (Obj.R_Index); ---------------------------------------------------------------------------- end Apsepp.Test_Event_Class.Generic_R_Index_Mixin;
true
-- Copyright (C) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- MIT license. Please refer to the LICENSE file. package body Apsepp.Test_Event_Class.Generic_R_Index_Mixin is ---------------------------------------------------------------------------- overriding procedure Set (Obj : in out Child_W_R_Index; Data : Test_Event_Data) is begin Parent (Obj).Set (Data); -- Inherited procedure call. Obj.R_Index := Data.R_Index; end Set; ---------------------------------------------------------------------------- overriding function R_Index (Obj : Child_W_R_Index) return Test_Routine_Index is (Obj.R_Index); ---------------------------------------------------------------------------- end Apsepp.Test_Event_Class.Generic_R_Index_Mixin;
[ { "context": "Identifier: BSD-3-Clause\n--\n-- Copyright (c) 2017 Eric Bruneton\n-- All rights reserved.\n--\n-- Redistribution an", "end": 81, "score": 0.9998677372932434, "start": 68, "tag": "NAME", "value": "Eric Bruneton" } ]
orka_plugin_atmosphere/src/orka-features-atmosphere-constants.ads
onox/orka
52
-- SPDX-License-Identifier: BSD-3-Clause -- -- Copyright (c) 2017 Eric Bruneton -- All rights reserved. -- -- 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 holders 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. -- This file defines the size of the precomputed texures used in our -- atmosphere model. It also provides tabulated values of the CIE color -- matching functions [1] and the conversion matrix from the XYZ [2] to -- the sRGB [3] color spaces (which are needed to convert the spectral -- radiance samples computed by our algorithm to sRGB luminance values). -- -- [1] https://en.wikipedia.org/wiki/CIE_1931_color_space#Color_matching_functions -- [2] https://en.wikipedia.org/wiki/CIE_1931_color_space -- [3] https://en.wikipedia.org/wiki/SRGB private package Orka.Features.Atmosphere.Constants is pragma Preelaborate; Transmittance_Texture_Width : constant := 256; Transmittance_Texture_Height : constant := 64; Scattering_Texture_R_Size : constant := 32; Scattering_Texture_Mu_Size : constant := 128; Scattering_Texture_Mu_S_Size : constant := 32; Scattering_Texture_Nu_Size : constant := 8; Scattering_Texture_Width : constant := Scattering_Texture_Nu_Size * Scattering_Texture_Mu_S_Size; Scattering_Texture_Height : constant := Scattering_Texture_Mu_Size; Scattering_Texture_Depth : constant := Scattering_Texture_R_Size; Irradiance_Texture_Width : constant := 64; Irradiance_Texture_Height : constant := 16; Max_Luminous_Efficacy : constant Double := 683.0; -- Conversion factor between watts and lumens CIE_2_Deg_Color_Matching_Functions : constant GL.Types.Double_Array := (360.0, 0.000129900000, 0.000003917000, 0.000606100000, 365.0, 0.000232100000, 0.000006965000, 0.001086000000, 370.0, 0.000414900000, 0.000012390000, 0.001946000000, 375.0, 0.000741600000, 0.000022020000, 0.003486000000, 380.0, 0.001368000000, 0.000039000000, 0.006450001000, 385.0, 0.002236000000, 0.000064000000, 0.010549990000, 390.0, 0.004243000000, 0.000120000000, 0.020050010000, 395.0, 0.007650000000, 0.000217000000, 0.036210000000, 400.0, 0.014310000000, 0.000396000000, 0.067850010000, 405.0, 0.023190000000, 0.000640000000, 0.110200000000, 410.0, 0.043510000000, 0.001210000000, 0.207400000000, 415.0, 0.077630000000, 0.002180000000, 0.371300000000, 420.0, 0.134380000000, 0.004000000000, 0.645600000000, 425.0, 0.214770000000, 0.007300000000, 1.039050100000, 430.0, 0.283900000000, 0.011600000000, 1.385600000000, 435.0, 0.328500000000, 0.016840000000, 1.622960000000, 440.0, 0.348280000000, 0.023000000000, 1.747060000000, 445.0, 0.348060000000, 0.029800000000, 1.782600000000, 450.0, 0.336200000000, 0.038000000000, 1.772110000000, 455.0, 0.318700000000, 0.048000000000, 1.744100000000, 460.0, 0.290800000000, 0.060000000000, 1.669200000000, 465.0, 0.251100000000, 0.073900000000, 1.528100000000, 470.0, 0.195360000000, 0.090980000000, 1.287640000000, 475.0, 0.142100000000, 0.112600000000, 1.041900000000, 480.0, 0.095640000000, 0.139020000000, 0.812950100000, 485.0, 0.057950010000, 0.169300000000, 0.616200000000, 490.0, 0.032010000000, 0.208020000000, 0.465180000000, 495.0, 0.014700000000, 0.258600000000, 0.353300000000, 500.0, 0.004900000000, 0.323000000000, 0.272000000000, 505.0, 0.002400000000, 0.407300000000, 0.212300000000, 510.0, 0.009300000000, 0.503000000000, 0.158200000000, 515.0, 0.029100000000, 0.608200000000, 0.111700000000, 520.0, 0.063270000000, 0.710000000000, 0.078249990000, 525.0, 0.109600000000, 0.793200000000, 0.057250010000, 530.0, 0.165500000000, 0.862000000000, 0.042160000000, 535.0, 0.225749900000, 0.914850100000, 0.029840000000, 540.0, 0.290400000000, 0.954000000000, 0.020300000000, 545.0, 0.359700000000, 0.980300000000, 0.013400000000, 550.0, 0.433449900000, 0.994950100000, 0.008749999000, 555.0, 0.512050100000, 1.000000000000, 0.005749999000, 560.0, 0.594500000000, 0.995000000000, 0.003900000000, 565.0, 0.678400000000, 0.978600000000, 0.002749999000, 570.0, 0.762100000000, 0.952000000000, 0.002100000000, 575.0, 0.842500000000, 0.915400000000, 0.001800000000, 580.0, 0.916300000000, 0.870000000000, 0.001650001000, 585.0, 0.978600000000, 0.816300000000, 0.001400000000, 590.0, 1.026300000000, 0.757000000000, 0.001100000000, 595.0, 1.056700000000, 0.694900000000, 0.001000000000, 600.0, 1.062200000000, 0.631000000000, 0.000800000000, 605.0, 1.045600000000, 0.566800000000, 0.000600000000, 610.0, 1.002600000000, 0.503000000000, 0.000340000000, 615.0, 0.938400000000, 0.441200000000, 0.000240000000, 620.0, 0.854449900000, 0.381000000000, 0.000190000000, 625.0, 0.751400000000, 0.321000000000, 0.000100000000, 630.0, 0.642400000000, 0.265000000000, 0.000049999990, 635.0, 0.541900000000, 0.217000000000, 0.000030000000, 640.0, 0.447900000000, 0.175000000000, 0.000020000000, 645.0, 0.360800000000, 0.138200000000, 0.000010000000, 650.0, 0.283500000000, 0.107000000000, 0.000000000000, 655.0, 0.218700000000, 0.081600000000, 0.000000000000, 660.0, 0.164900000000, 0.061000000000, 0.000000000000, 665.0, 0.121200000000, 0.044580000000, 0.000000000000, 670.0, 0.087400000000, 0.032000000000, 0.000000000000, 675.0, 0.063600000000, 0.023200000000, 0.000000000000, 680.0, 0.046770000000, 0.017000000000, 0.000000000000, 685.0, 0.032900000000, 0.011920000000, 0.000000000000, 690.0, 0.022700000000, 0.008210000000, 0.000000000000, 695.0, 0.015840000000, 0.005723000000, 0.000000000000, 700.0, 0.011359160000, 0.004102000000, 0.000000000000, 705.0, 0.008110916000, 0.002929000000, 0.000000000000, 710.0, 0.005790346000, 0.002091000000, 0.000000000000, 715.0, 0.004109457000, 0.001484000000, 0.000000000000, 720.0, 0.002899327000, 0.001047000000, 0.000000000000, 725.0, 0.002049190000, 0.000740000000, 0.000000000000, 730.0, 0.001439971000, 0.000520000000, 0.000000000000, 735.0, 0.000999949300, 0.000361100000, 0.000000000000, 740.0, 0.000690078600, 0.000249200000, 0.000000000000, 745.0, 0.000476021300, 0.000171900000, 0.000000000000, 750.0, 0.000332301100, 0.000120000000, 0.000000000000, 755.0, 0.000234826100, 0.000084800000, 0.000000000000, 760.0, 0.000166150500, 0.000060000000, 0.000000000000, 765.0, 0.000117413000, 0.000042400000, 0.000000000000, 770.0, 0.000083075270, 0.000030000000, 0.000000000000, 775.0, 0.000058706520, 0.000021200000, 0.000000000000, 780.0, 0.000041509940, 0.000014990000, 0.000000000000, 785.0, 0.000029353260, 0.000010600000, 0.000000000000, 790.0, 0.000020673830, 0.000007465700, 0.000000000000, 795.0, 0.000014559770, 0.000005257800, 0.000000000000, 800.0, 0.000010253980, 0.000003702900, 0.000000000000, 805.0, 0.000007221456, 0.000002607800, 0.000000000000, 810.0, 0.000005085868, 0.000001836600, 0.000000000000, 815.0, 0.000003581652, 0.000001293400, 0.000000000000, 820.0, 0.000002522525, 0.000000910930, 0.000000000000, 825.0, 0.000001776509, 0.000000641530, 0.000000000000, 830.0, 0.000001251141, 0.000000451810, 0.000000000000); -- Values from "CIE (1931) 2-deg color matching functions", see -- http://web.archive.org/web/20081228084047/ -- http://www.cvrl.org/database/data/cmfs/ciexyz31.txt XYZ_To_SRGB : constant GL.Types.Double_Array := (+3.2406, -1.5372, -0.4986, -0.9689, +1.8758, +0.0415, +0.0557, -0.2040, +1.0570); -- Conversion matrix from XYZ to linear sRGB color spaces. -- Values from https://en.wikipedia.org/wiki/SRGB end Orka.Features.Atmosphere.Constants;
19824
-- SPDX-License-Identifier: BSD-3-Clause -- -- Copyright (c) 2017 <NAME> -- All rights reserved. -- -- 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 holders 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. -- This file defines the size of the precomputed texures used in our -- atmosphere model. It also provides tabulated values of the CIE color -- matching functions [1] and the conversion matrix from the XYZ [2] to -- the sRGB [3] color spaces (which are needed to convert the spectral -- radiance samples computed by our algorithm to sRGB luminance values). -- -- [1] https://en.wikipedia.org/wiki/CIE_1931_color_space#Color_matching_functions -- [2] https://en.wikipedia.org/wiki/CIE_1931_color_space -- [3] https://en.wikipedia.org/wiki/SRGB private package Orka.Features.Atmosphere.Constants is pragma Preelaborate; Transmittance_Texture_Width : constant := 256; Transmittance_Texture_Height : constant := 64; Scattering_Texture_R_Size : constant := 32; Scattering_Texture_Mu_Size : constant := 128; Scattering_Texture_Mu_S_Size : constant := 32; Scattering_Texture_Nu_Size : constant := 8; Scattering_Texture_Width : constant := Scattering_Texture_Nu_Size * Scattering_Texture_Mu_S_Size; Scattering_Texture_Height : constant := Scattering_Texture_Mu_Size; Scattering_Texture_Depth : constant := Scattering_Texture_R_Size; Irradiance_Texture_Width : constant := 64; Irradiance_Texture_Height : constant := 16; Max_Luminous_Efficacy : constant Double := 683.0; -- Conversion factor between watts and lumens CIE_2_Deg_Color_Matching_Functions : constant GL.Types.Double_Array := (360.0, 0.000129900000, 0.000003917000, 0.000606100000, 365.0, 0.000232100000, 0.000006965000, 0.001086000000, 370.0, 0.000414900000, 0.000012390000, 0.001946000000, 375.0, 0.000741600000, 0.000022020000, 0.003486000000, 380.0, 0.001368000000, 0.000039000000, 0.006450001000, 385.0, 0.002236000000, 0.000064000000, 0.010549990000, 390.0, 0.004243000000, 0.000120000000, 0.020050010000, 395.0, 0.007650000000, 0.000217000000, 0.036210000000, 400.0, 0.014310000000, 0.000396000000, 0.067850010000, 405.0, 0.023190000000, 0.000640000000, 0.110200000000, 410.0, 0.043510000000, 0.001210000000, 0.207400000000, 415.0, 0.077630000000, 0.002180000000, 0.371300000000, 420.0, 0.134380000000, 0.004000000000, 0.645600000000, 425.0, 0.214770000000, 0.007300000000, 1.039050100000, 430.0, 0.283900000000, 0.011600000000, 1.385600000000, 435.0, 0.328500000000, 0.016840000000, 1.622960000000, 440.0, 0.348280000000, 0.023000000000, 1.747060000000, 445.0, 0.348060000000, 0.029800000000, 1.782600000000, 450.0, 0.336200000000, 0.038000000000, 1.772110000000, 455.0, 0.318700000000, 0.048000000000, 1.744100000000, 460.0, 0.290800000000, 0.060000000000, 1.669200000000, 465.0, 0.251100000000, 0.073900000000, 1.528100000000, 470.0, 0.195360000000, 0.090980000000, 1.287640000000, 475.0, 0.142100000000, 0.112600000000, 1.041900000000, 480.0, 0.095640000000, 0.139020000000, 0.812950100000, 485.0, 0.057950010000, 0.169300000000, 0.616200000000, 490.0, 0.032010000000, 0.208020000000, 0.465180000000, 495.0, 0.014700000000, 0.258600000000, 0.353300000000, 500.0, 0.004900000000, 0.323000000000, 0.272000000000, 505.0, 0.002400000000, 0.407300000000, 0.212300000000, 510.0, 0.009300000000, 0.503000000000, 0.158200000000, 515.0, 0.029100000000, 0.608200000000, 0.111700000000, 520.0, 0.063270000000, 0.710000000000, 0.078249990000, 525.0, 0.109600000000, 0.793200000000, 0.057250010000, 530.0, 0.165500000000, 0.862000000000, 0.042160000000, 535.0, 0.225749900000, 0.914850100000, 0.029840000000, 540.0, 0.290400000000, 0.954000000000, 0.020300000000, 545.0, 0.359700000000, 0.980300000000, 0.013400000000, 550.0, 0.433449900000, 0.994950100000, 0.008749999000, 555.0, 0.512050100000, 1.000000000000, 0.005749999000, 560.0, 0.594500000000, 0.995000000000, 0.003900000000, 565.0, 0.678400000000, 0.978600000000, 0.002749999000, 570.0, 0.762100000000, 0.952000000000, 0.002100000000, 575.0, 0.842500000000, 0.915400000000, 0.001800000000, 580.0, 0.916300000000, 0.870000000000, 0.001650001000, 585.0, 0.978600000000, 0.816300000000, 0.001400000000, 590.0, 1.026300000000, 0.757000000000, 0.001100000000, 595.0, 1.056700000000, 0.694900000000, 0.001000000000, 600.0, 1.062200000000, 0.631000000000, 0.000800000000, 605.0, 1.045600000000, 0.566800000000, 0.000600000000, 610.0, 1.002600000000, 0.503000000000, 0.000340000000, 615.0, 0.938400000000, 0.441200000000, 0.000240000000, 620.0, 0.854449900000, 0.381000000000, 0.000190000000, 625.0, 0.751400000000, 0.321000000000, 0.000100000000, 630.0, 0.642400000000, 0.265000000000, 0.000049999990, 635.0, 0.541900000000, 0.217000000000, 0.000030000000, 640.0, 0.447900000000, 0.175000000000, 0.000020000000, 645.0, 0.360800000000, 0.138200000000, 0.000010000000, 650.0, 0.283500000000, 0.107000000000, 0.000000000000, 655.0, 0.218700000000, 0.081600000000, 0.000000000000, 660.0, 0.164900000000, 0.061000000000, 0.000000000000, 665.0, 0.121200000000, 0.044580000000, 0.000000000000, 670.0, 0.087400000000, 0.032000000000, 0.000000000000, 675.0, 0.063600000000, 0.023200000000, 0.000000000000, 680.0, 0.046770000000, 0.017000000000, 0.000000000000, 685.0, 0.032900000000, 0.011920000000, 0.000000000000, 690.0, 0.022700000000, 0.008210000000, 0.000000000000, 695.0, 0.015840000000, 0.005723000000, 0.000000000000, 700.0, 0.011359160000, 0.004102000000, 0.000000000000, 705.0, 0.008110916000, 0.002929000000, 0.000000000000, 710.0, 0.005790346000, 0.002091000000, 0.000000000000, 715.0, 0.004109457000, 0.001484000000, 0.000000000000, 720.0, 0.002899327000, 0.001047000000, 0.000000000000, 725.0, 0.002049190000, 0.000740000000, 0.000000000000, 730.0, 0.001439971000, 0.000520000000, 0.000000000000, 735.0, 0.000999949300, 0.000361100000, 0.000000000000, 740.0, 0.000690078600, 0.000249200000, 0.000000000000, 745.0, 0.000476021300, 0.000171900000, 0.000000000000, 750.0, 0.000332301100, 0.000120000000, 0.000000000000, 755.0, 0.000234826100, 0.000084800000, 0.000000000000, 760.0, 0.000166150500, 0.000060000000, 0.000000000000, 765.0, 0.000117413000, 0.000042400000, 0.000000000000, 770.0, 0.000083075270, 0.000030000000, 0.000000000000, 775.0, 0.000058706520, 0.000021200000, 0.000000000000, 780.0, 0.000041509940, 0.000014990000, 0.000000000000, 785.0, 0.000029353260, 0.000010600000, 0.000000000000, 790.0, 0.000020673830, 0.000007465700, 0.000000000000, 795.0, 0.000014559770, 0.000005257800, 0.000000000000, 800.0, 0.000010253980, 0.000003702900, 0.000000000000, 805.0, 0.000007221456, 0.000002607800, 0.000000000000, 810.0, 0.000005085868, 0.000001836600, 0.000000000000, 815.0, 0.000003581652, 0.000001293400, 0.000000000000, 820.0, 0.000002522525, 0.000000910930, 0.000000000000, 825.0, 0.000001776509, 0.000000641530, 0.000000000000, 830.0, 0.000001251141, 0.000000451810, 0.000000000000); -- Values from "CIE (1931) 2-deg color matching functions", see -- http://web.archive.org/web/20081228084047/ -- http://www.cvrl.org/database/data/cmfs/ciexyz31.txt XYZ_To_SRGB : constant GL.Types.Double_Array := (+3.2406, -1.5372, -0.4986, -0.9689, +1.8758, +0.0415, +0.0557, -0.2040, +1.0570); -- Conversion matrix from XYZ to linear sRGB color spaces. -- Values from https://en.wikipedia.org/wiki/SRGB end Orka.Features.Atmosphere.Constants;
true
-- SPDX-License-Identifier: BSD-3-Clause -- -- Copyright (c) 2017 PI:NAME:<NAME>END_PI -- All rights reserved. -- -- 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 holders 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. -- This file defines the size of the precomputed texures used in our -- atmosphere model. It also provides tabulated values of the CIE color -- matching functions [1] and the conversion matrix from the XYZ [2] to -- the sRGB [3] color spaces (which are needed to convert the spectral -- radiance samples computed by our algorithm to sRGB luminance values). -- -- [1] https://en.wikipedia.org/wiki/CIE_1931_color_space#Color_matching_functions -- [2] https://en.wikipedia.org/wiki/CIE_1931_color_space -- [3] https://en.wikipedia.org/wiki/SRGB private package Orka.Features.Atmosphere.Constants is pragma Preelaborate; Transmittance_Texture_Width : constant := 256; Transmittance_Texture_Height : constant := 64; Scattering_Texture_R_Size : constant := 32; Scattering_Texture_Mu_Size : constant := 128; Scattering_Texture_Mu_S_Size : constant := 32; Scattering_Texture_Nu_Size : constant := 8; Scattering_Texture_Width : constant := Scattering_Texture_Nu_Size * Scattering_Texture_Mu_S_Size; Scattering_Texture_Height : constant := Scattering_Texture_Mu_Size; Scattering_Texture_Depth : constant := Scattering_Texture_R_Size; Irradiance_Texture_Width : constant := 64; Irradiance_Texture_Height : constant := 16; Max_Luminous_Efficacy : constant Double := 683.0; -- Conversion factor between watts and lumens CIE_2_Deg_Color_Matching_Functions : constant GL.Types.Double_Array := (360.0, 0.000129900000, 0.000003917000, 0.000606100000, 365.0, 0.000232100000, 0.000006965000, 0.001086000000, 370.0, 0.000414900000, 0.000012390000, 0.001946000000, 375.0, 0.000741600000, 0.000022020000, 0.003486000000, 380.0, 0.001368000000, 0.000039000000, 0.006450001000, 385.0, 0.002236000000, 0.000064000000, 0.010549990000, 390.0, 0.004243000000, 0.000120000000, 0.020050010000, 395.0, 0.007650000000, 0.000217000000, 0.036210000000, 400.0, 0.014310000000, 0.000396000000, 0.067850010000, 405.0, 0.023190000000, 0.000640000000, 0.110200000000, 410.0, 0.043510000000, 0.001210000000, 0.207400000000, 415.0, 0.077630000000, 0.002180000000, 0.371300000000, 420.0, 0.134380000000, 0.004000000000, 0.645600000000, 425.0, 0.214770000000, 0.007300000000, 1.039050100000, 430.0, 0.283900000000, 0.011600000000, 1.385600000000, 435.0, 0.328500000000, 0.016840000000, 1.622960000000, 440.0, 0.348280000000, 0.023000000000, 1.747060000000, 445.0, 0.348060000000, 0.029800000000, 1.782600000000, 450.0, 0.336200000000, 0.038000000000, 1.772110000000, 455.0, 0.318700000000, 0.048000000000, 1.744100000000, 460.0, 0.290800000000, 0.060000000000, 1.669200000000, 465.0, 0.251100000000, 0.073900000000, 1.528100000000, 470.0, 0.195360000000, 0.090980000000, 1.287640000000, 475.0, 0.142100000000, 0.112600000000, 1.041900000000, 480.0, 0.095640000000, 0.139020000000, 0.812950100000, 485.0, 0.057950010000, 0.169300000000, 0.616200000000, 490.0, 0.032010000000, 0.208020000000, 0.465180000000, 495.0, 0.014700000000, 0.258600000000, 0.353300000000, 500.0, 0.004900000000, 0.323000000000, 0.272000000000, 505.0, 0.002400000000, 0.407300000000, 0.212300000000, 510.0, 0.009300000000, 0.503000000000, 0.158200000000, 515.0, 0.029100000000, 0.608200000000, 0.111700000000, 520.0, 0.063270000000, 0.710000000000, 0.078249990000, 525.0, 0.109600000000, 0.793200000000, 0.057250010000, 530.0, 0.165500000000, 0.862000000000, 0.042160000000, 535.0, 0.225749900000, 0.914850100000, 0.029840000000, 540.0, 0.290400000000, 0.954000000000, 0.020300000000, 545.0, 0.359700000000, 0.980300000000, 0.013400000000, 550.0, 0.433449900000, 0.994950100000, 0.008749999000, 555.0, 0.512050100000, 1.000000000000, 0.005749999000, 560.0, 0.594500000000, 0.995000000000, 0.003900000000, 565.0, 0.678400000000, 0.978600000000, 0.002749999000, 570.0, 0.762100000000, 0.952000000000, 0.002100000000, 575.0, 0.842500000000, 0.915400000000, 0.001800000000, 580.0, 0.916300000000, 0.870000000000, 0.001650001000, 585.0, 0.978600000000, 0.816300000000, 0.001400000000, 590.0, 1.026300000000, 0.757000000000, 0.001100000000, 595.0, 1.056700000000, 0.694900000000, 0.001000000000, 600.0, 1.062200000000, 0.631000000000, 0.000800000000, 605.0, 1.045600000000, 0.566800000000, 0.000600000000, 610.0, 1.002600000000, 0.503000000000, 0.000340000000, 615.0, 0.938400000000, 0.441200000000, 0.000240000000, 620.0, 0.854449900000, 0.381000000000, 0.000190000000, 625.0, 0.751400000000, 0.321000000000, 0.000100000000, 630.0, 0.642400000000, 0.265000000000, 0.000049999990, 635.0, 0.541900000000, 0.217000000000, 0.000030000000, 640.0, 0.447900000000, 0.175000000000, 0.000020000000, 645.0, 0.360800000000, 0.138200000000, 0.000010000000, 650.0, 0.283500000000, 0.107000000000, 0.000000000000, 655.0, 0.218700000000, 0.081600000000, 0.000000000000, 660.0, 0.164900000000, 0.061000000000, 0.000000000000, 665.0, 0.121200000000, 0.044580000000, 0.000000000000, 670.0, 0.087400000000, 0.032000000000, 0.000000000000, 675.0, 0.063600000000, 0.023200000000, 0.000000000000, 680.0, 0.046770000000, 0.017000000000, 0.000000000000, 685.0, 0.032900000000, 0.011920000000, 0.000000000000, 690.0, 0.022700000000, 0.008210000000, 0.000000000000, 695.0, 0.015840000000, 0.005723000000, 0.000000000000, 700.0, 0.011359160000, 0.004102000000, 0.000000000000, 705.0, 0.008110916000, 0.002929000000, 0.000000000000, 710.0, 0.005790346000, 0.002091000000, 0.000000000000, 715.0, 0.004109457000, 0.001484000000, 0.000000000000, 720.0, 0.002899327000, 0.001047000000, 0.000000000000, 725.0, 0.002049190000, 0.000740000000, 0.000000000000, 730.0, 0.001439971000, 0.000520000000, 0.000000000000, 735.0, 0.000999949300, 0.000361100000, 0.000000000000, 740.0, 0.000690078600, 0.000249200000, 0.000000000000, 745.0, 0.000476021300, 0.000171900000, 0.000000000000, 750.0, 0.000332301100, 0.000120000000, 0.000000000000, 755.0, 0.000234826100, 0.000084800000, 0.000000000000, 760.0, 0.000166150500, 0.000060000000, 0.000000000000, 765.0, 0.000117413000, 0.000042400000, 0.000000000000, 770.0, 0.000083075270, 0.000030000000, 0.000000000000, 775.0, 0.000058706520, 0.000021200000, 0.000000000000, 780.0, 0.000041509940, 0.000014990000, 0.000000000000, 785.0, 0.000029353260, 0.000010600000, 0.000000000000, 790.0, 0.000020673830, 0.000007465700, 0.000000000000, 795.0, 0.000014559770, 0.000005257800, 0.000000000000, 800.0, 0.000010253980, 0.000003702900, 0.000000000000, 805.0, 0.000007221456, 0.000002607800, 0.000000000000, 810.0, 0.000005085868, 0.000001836600, 0.000000000000, 815.0, 0.000003581652, 0.000001293400, 0.000000000000, 820.0, 0.000002522525, 0.000000910930, 0.000000000000, 825.0, 0.000001776509, 0.000000641530, 0.000000000000, 830.0, 0.000001251141, 0.000000451810, 0.000000000000); -- Values from "CIE (1931) 2-deg color matching functions", see -- http://web.archive.org/web/20081228084047/ -- http://www.cvrl.org/database/data/cmfs/ciexyz31.txt XYZ_To_SRGB : constant GL.Types.Double_Array := (+3.2406, -1.5372, -0.4986, -0.9689, +1.8758, +0.0415, +0.0557, -0.2040, +1.0570); -- Conversion matrix from XYZ to linear sRGB color spaces. -- Values from https://en.wikipedia.org/wiki/SRGB end Orka.Features.Atmosphere.Constants;
[ { "context": "nit tests\n-- Copyright (C) 2009, 2010, 2017, 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 167, "score": 0.9998763203620911, "start": 152, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9, 2010, 2017, 2018 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under", "end": 198, "score": 0.9998772740364075, "start": 183, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "8 Stephane Carrez\n-- Written by Stephane Carrez ([email protected])\n--\n-- Licensed under the Apache License, Versio", "end": 225, "score": 0.99992835521698, "start": 200, "tag": "EMAIL", "value": "[email protected]" } ]
regtests/regtests.ads
My-Colaborations/ada-ado
0
----------------------------------------------------------------------- -- regtests -- Support for unit tests -- Copyright (C) 2009, 2010, 2017, 2018 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 ADO.Audits; with ADO.Sessions; with ADO.Sessions.Sources; package Regtests is -- Get the database manager to be used for the unit tests function Get_Controller return ADO.Sessions.Sources.Data_Source'Class; -- Get the readonly connection database to be used for the unit tests function Get_Database return ADO.Sessions.Session; -- Get the writeable connection database to be used for the unit tests function Get_Master_Database return ADO.Sessions.Master_Session; -- Set the audit manager on the factory. procedure Set_Audit_Manager (Manager : in ADO.Audits.Audit_Manager_Access); -- Initialize the test database procedure Initialize (Name : in String); end Regtests;
12640
----------------------------------------------------------------------- -- regtests -- Support for unit tests -- Copyright (C) 2009, 2010, 2017, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Audits; with ADO.Sessions; with ADO.Sessions.Sources; package Regtests is -- Get the database manager to be used for the unit tests function Get_Controller return ADO.Sessions.Sources.Data_Source'Class; -- Get the readonly connection database to be used for the unit tests function Get_Database return ADO.Sessions.Session; -- Get the writeable connection database to be used for the unit tests function Get_Master_Database return ADO.Sessions.Master_Session; -- Set the audit manager on the factory. procedure Set_Audit_Manager (Manager : in ADO.Audits.Audit_Manager_Access); -- Initialize the test database procedure Initialize (Name : in String); end Regtests;
true
----------------------------------------------------------------------- -- regtests -- Support for unit tests -- Copyright (C) 2009, 2010, 2017, 2018 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Audits; with ADO.Sessions; with ADO.Sessions.Sources; package Regtests is -- Get the database manager to be used for the unit tests function Get_Controller return ADO.Sessions.Sources.Data_Source'Class; -- Get the readonly connection database to be used for the unit tests function Get_Database return ADO.Sessions.Session; -- Get the writeable connection database to be used for the unit tests function Get_Master_Database return ADO.Sessions.Master_Session; -- Set the audit manager on the factory. procedure Set_Audit_Manager (Manager : in ADO.Audits.Audit_Manager_Access); -- Initialize the test database procedure Initialize (Name : in String); end Regtests;
[ { "context": "rs for use with smart_ptrs\n\n-- Copyright (c) 2016, James Humphry\n--\n-- Permission to use, copy, modify, and/or dis", "end": 109, "score": 0.9998400807380676, "start": 96, "tag": "NAME", "value": "James Humphry" } ]
src/counters/protected_counters.ads
jhumphry/auto_counters
5
-- protected_counters.ads -- Task safe counters for use with smart_ptrs -- Copyright (c) 2016, James Humphry -- -- 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. pragma Profile (No_Implementation_Extensions); with Counters_Spec; package Protected_Counters is protected type Counter is entry Lock; procedure Unlock; procedure Initialize_New_Counter; function Use_Count return Natural; entry Check_Increment_Use_Count; entry Decrement_Use_Count; function Weak_Ptr_Count return Natural; entry Increment_Weak_Ptr_Count; entry Decrement_Weak_Ptr_Count; private Locked : Boolean := True; SP_Count : Natural := 1; WP_Count : Natural := 0; end Counter; type Counter_Ptr is access Counter; function Make_New_Counter return Counter_Ptr; procedure Deallocate_If_Unused (C : in out Counter_Ptr) with Inline; function Use_Count (C : in Counter) return Natural is (C.Use_Count) with Inline; procedure Check_Increment_Use_Count (C : in out Counter) with Inline; procedure Decrement_Use_Count (C : in out Counter) with Inline; function Weak_Ptr_Count (C : in Counter) return Natural is (C.Weak_Ptr_Count) with Inline; procedure Increment_Weak_Ptr_Count (C : in out Counter) with Inline; procedure Decrement_Weak_Ptr_Count (C : in out Counter) with Inline; package Protected_Counters_Spec is new Counters_Spec(Counter => Counter, Counter_Ptr => Counter_Ptr); end Protected_Counters;
29769
-- protected_counters.ads -- Task safe counters for use with smart_ptrs -- Copyright (c) 2016, <NAME> -- -- 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. pragma Profile (No_Implementation_Extensions); with Counters_Spec; package Protected_Counters is protected type Counter is entry Lock; procedure Unlock; procedure Initialize_New_Counter; function Use_Count return Natural; entry Check_Increment_Use_Count; entry Decrement_Use_Count; function Weak_Ptr_Count return Natural; entry Increment_Weak_Ptr_Count; entry Decrement_Weak_Ptr_Count; private Locked : Boolean := True; SP_Count : Natural := 1; WP_Count : Natural := 0; end Counter; type Counter_Ptr is access Counter; function Make_New_Counter return Counter_Ptr; procedure Deallocate_If_Unused (C : in out Counter_Ptr) with Inline; function Use_Count (C : in Counter) return Natural is (C.Use_Count) with Inline; procedure Check_Increment_Use_Count (C : in out Counter) with Inline; procedure Decrement_Use_Count (C : in out Counter) with Inline; function Weak_Ptr_Count (C : in Counter) return Natural is (C.Weak_Ptr_Count) with Inline; procedure Increment_Weak_Ptr_Count (C : in out Counter) with Inline; procedure Decrement_Weak_Ptr_Count (C : in out Counter) with Inline; package Protected_Counters_Spec is new Counters_Spec(Counter => Counter, Counter_Ptr => Counter_Ptr); end Protected_Counters;
true
-- protected_counters.ads -- Task safe counters for use with smart_ptrs -- Copyright (c) 2016, PI:NAME:<NAME>END_PI -- -- 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. pragma Profile (No_Implementation_Extensions); with Counters_Spec; package Protected_Counters is protected type Counter is entry Lock; procedure Unlock; procedure Initialize_New_Counter; function Use_Count return Natural; entry Check_Increment_Use_Count; entry Decrement_Use_Count; function Weak_Ptr_Count return Natural; entry Increment_Weak_Ptr_Count; entry Decrement_Weak_Ptr_Count; private Locked : Boolean := True; SP_Count : Natural := 1; WP_Count : Natural := 0; end Counter; type Counter_Ptr is access Counter; function Make_New_Counter return Counter_Ptr; procedure Deallocate_If_Unused (C : in out Counter_Ptr) with Inline; function Use_Count (C : in Counter) return Natural is (C.Use_Count) with Inline; procedure Check_Increment_Use_Count (C : in out Counter) with Inline; procedure Decrement_Use_Count (C : in out Counter) with Inline; function Weak_Ptr_Count (C : in Counter) return Natural is (C.Weak_Ptr_Count) with Inline; procedure Increment_Weak_Ptr_Count (C : in out Counter) with Inline; procedure Decrement_Weak_Ptr_Count (C : in out Counter) with Inline; package Protected_Counters_Spec is new Counters_Spec(Counter => Counter, Counter_Ptr => Counter_Ptr); end Protected_Counters;
[ { "context": " --\r\n-- Copyright (C) John English 2000. Contact address: [email protected] --\r\n-", "end": 831, "score": 0.9993429183959961, "start": 819, "tag": "NAME", "value": "John English" }, { "context": " Copyright (C) John English 2000. Contact address: [email protected] --\r\n-- This software is released under the t", "end": 872, "score": 0.9999311566352844, "start": 855, "tag": "EMAIL", "value": "[email protected]" }, { "context": "es to GNAT\r\n-- GPL 2006 compiler (thanks to John McCormick for this)\r\n-- * Added delay in message loop to av", "end": 1640, "score": 0.8720947504043579, "start": 1631, "tag": "NAME", "value": "McCormick" }, { "context": "ard output\r\n-- instead of to the file (thanks to Jeff Carter for pointing this out).\r\n-- * Panels fixed so tha", "end": 4127, "score": 0.9998811483383179, "start": 4116, "tag": "NAME", "value": "Jeff Carter" }, { "context": "tion corrected and updated following comments from Moti Ben-Ari\r\n-- and Don Overheu.\r\n--\r\n-- Revision 1.2 2000", "end": 4469, "score": 0.9999038577079773, "start": 4457, "tag": "NAME", "value": "Moti Ben-Ari" }, { "context": "ted following comments from Moti Ben-Ari\r\n-- and Don Overheu.\r\n--\r\n-- Revision 1.2 2000/04/18 20:00:00 je\r\n-", "end": 4491, "score": 0.9999021291732788, "start": 4480, "tag": "NAME", "value": "Don Overheu" } ]
src/JEWL/jewl-win32_interface.adb
leomlr/sudoku_ada-jewl
0
------------------------------------------------------------------------------ -- -- -- J E W L . W I N 3 2 _ I N T E R F A C E -- -- -- -- This is the body of a private package containing implementation -- -- details for JEWL.Windows. It contains type conversions where a -- -- bit-for-bit conversion is inadequate. It also contains some -- -- functions which provide a more tasteful Ada wrapping for a few -- -- common sequences of Win32 magic spells. -- -- -- -- 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-win32_interface.adb 1.7 2007/01/08 17:00:00 JE Exp $ ------------------------------------------------------------------------------ -- -- $Log: jewl-win32_interface.adb $ -- 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 -- ------------------------------------------------------------------------------ with Interfaces.C; package body JEWL.Win32_Interface is pragma Linker_Options ("-luser32"); pragma Linker_Options ("-lgdi32"); pragma Linker_Options ("-lcomdlg32"); pragma Linker_Options ("-lwinmm"); use type Win32_DWORD, Win32_INT, Win32_UINT, Win32_LONG, Win32_BYTE; use type System.Address; ---------------------------------------------------------------------------- -- -- T Y P E C O N V E R S I O N S -- ---------------------------------------------------------------------------- function To_LPSTR (S : Win32_String) return Win32_LPSTR is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPSTR); begin return UC(S(S'First)'Address); end To_LPSTR; function To_LPCSTR (S : Win32_String) return Win32_LPCSTR is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPCSTR); begin return UC(S(S'First)'Address); end To_LPCSTR; function To_LPARAM (S : Win32_String) return Win32_LPARAM is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPARAM); begin return UC(S(S'First)'Address); end To_LPARAM; function To_String (S : Win32_String) return String is begin return Interfaces.C.To_Ada(S); end To_String; function To_Array (S : String) return Win32_String is begin return Interfaces.C.To_C(S); end To_Array; function RGB (Colour : Colour_Type) return Win32_COLORREF is use type Win32_BYTE; begin return Win32_COLORREF(Colour.Red + Colour.Green*2**8 + Colour.Blue*2**16); end RGB; function MakePoint (Value: Win32_LPARAM) return Win32_POINTS is use type Interfaces.Unsigned_32; function UC is new Ada.Unchecked_Conversion (Win32_LPARAM,Interfaces.Unsigned_32); function UC is new Ada.Unchecked_Conversion (Win32_WORD,Win32_SHORT); P : Win32_POINTS; V : Interfaces.Unsigned_32 := UC(Value); begin P.X := UC(Win32_WORD(V and 16#FFFF#)); P.Y := UC(Win32_WORD(Interfaces.Shift_Right(V,16) and 16#FFFF#)); return P; end MakePoint; ---------------------------------------------------------------------------- -- -- U T I L I T Y F U N C T I O N S -- ---------------------------------------------------------------------------- -- -- Message_Box: an Ada wrapper for the Win32 MessageBox function. -- function Message_Box (Message : String; Title : String; Flags : Win32_UINT) return Integer is M : Win32_String := To_Array(Message); T : Win32_String := To_Array(Title); begin return Integer(MessageBox(System.Null_Address, To_LPCSTR(M), To_LPCSTR(T), Flags or MB_TASKMODAL or MB_SETFOREGROUND)); end Message_Box; ---------------------------------------------------------------------------- -- -- Create_Font: an Ada wrapper for the Win32 CreateFont function. -- function Create_Font (Font : Font_Type) return Win32_HFONT is F : Win32_HFONT; L : aliased Win32_LOGFONT := Set_Font(Font); begin F := CreateFontIndirect (L'Unchecked_Access); return F; end Create_Font; ---------------------------------------------------------------------------- -- -- Set_Font: convert a Font_Type object to a Win32 font. -- function Set_Font (Font : Font_Type) return Win32_LOGFONT is F : Win32_LOGFONT; H : Win32_HDC; I : Win32_INT; begin H := GetDC(System.Null_Address); F.lfHeight := -Win32_LONG(GetDeviceCaps(H,LOGPIXELSY) * Win32_INT(Font.Size) / 72); I := ReleaseDC(System.Null_Address,H); if Font.Bold then F.lfWeight := 700; else F.lfWeight := 400; end if; F.lfItalic := Boolean'Pos(Font.Italic); if Font.Name'Length < F.lfFaceName'Length then F.lfFaceName(0..Font.Name'Length) := To_Array(Font.Name); else F.lfFaceName := To_Array(Font.Name(1..F.lfFaceName'Length-1)); end if; return F; end Set_Font; ---------------------------------------------------------------------------- -- -- Get_Font: convert a Win32 font to a Font_Type object. -- function Get_Font (Font : Win32_LOGFONT) return Font_Type is H : Win32_HDC; I : Win32_INT; S : Float; begin H := GetDC(System.Null_Address); S := 72.0 / Float(GetDeviceCaps(H,LOGPIXELSY)); I := ReleaseDC (System.Null_Address, H); return JEWL.Font(To_String(Font.lfFaceName), abs Integer(Float(Font.lfHeight)*S), Font.lfWeight > 500, Font.lfItalic /= 0); end Get_Font; end JEWL.Win32_Interface;
14969
------------------------------------------------------------------------------ -- -- -- J E W L . W I N 3 2 _ I N T E R F A C E -- -- -- -- This is the body of a private package containing implementation -- -- details for JEWL.Windows. It contains type conversions where a -- -- bit-for-bit conversion is inadequate. It also contains some -- -- functions which provide a more tasteful Ada wrapping for a few -- -- common sequences of Win32 magic spells. -- -- -- -- Copyright (C) <NAME> 2000. Contact address: <EMAIL> -- -- 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-win32_interface.adb 1.7 2007/01/08 17:00:00 JE Exp $ ------------------------------------------------------------------------------ -- -- $Log: jewl-win32_interface.adb $ -- 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 <NAME> 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 <NAME> 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 <NAME> -- and <NAME>. -- -- 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 -- ------------------------------------------------------------------------------ with Interfaces.C; package body JEWL.Win32_Interface is pragma Linker_Options ("-luser32"); pragma Linker_Options ("-lgdi32"); pragma Linker_Options ("-lcomdlg32"); pragma Linker_Options ("-lwinmm"); use type Win32_DWORD, Win32_INT, Win32_UINT, Win32_LONG, Win32_BYTE; use type System.Address; ---------------------------------------------------------------------------- -- -- T Y P E C O N V E R S I O N S -- ---------------------------------------------------------------------------- function To_LPSTR (S : Win32_String) return Win32_LPSTR is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPSTR); begin return UC(S(S'First)'Address); end To_LPSTR; function To_LPCSTR (S : Win32_String) return Win32_LPCSTR is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPCSTR); begin return UC(S(S'First)'Address); end To_LPCSTR; function To_LPARAM (S : Win32_String) return Win32_LPARAM is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPARAM); begin return UC(S(S'First)'Address); end To_LPARAM; function To_String (S : Win32_String) return String is begin return Interfaces.C.To_Ada(S); end To_String; function To_Array (S : String) return Win32_String is begin return Interfaces.C.To_C(S); end To_Array; function RGB (Colour : Colour_Type) return Win32_COLORREF is use type Win32_BYTE; begin return Win32_COLORREF(Colour.Red + Colour.Green*2**8 + Colour.Blue*2**16); end RGB; function MakePoint (Value: Win32_LPARAM) return Win32_POINTS is use type Interfaces.Unsigned_32; function UC is new Ada.Unchecked_Conversion (Win32_LPARAM,Interfaces.Unsigned_32); function UC is new Ada.Unchecked_Conversion (Win32_WORD,Win32_SHORT); P : Win32_POINTS; V : Interfaces.Unsigned_32 := UC(Value); begin P.X := UC(Win32_WORD(V and 16#FFFF#)); P.Y := UC(Win32_WORD(Interfaces.Shift_Right(V,16) and 16#FFFF#)); return P; end MakePoint; ---------------------------------------------------------------------------- -- -- U T I L I T Y F U N C T I O N S -- ---------------------------------------------------------------------------- -- -- Message_Box: an Ada wrapper for the Win32 MessageBox function. -- function Message_Box (Message : String; Title : String; Flags : Win32_UINT) return Integer is M : Win32_String := To_Array(Message); T : Win32_String := To_Array(Title); begin return Integer(MessageBox(System.Null_Address, To_LPCSTR(M), To_LPCSTR(T), Flags or MB_TASKMODAL or MB_SETFOREGROUND)); end Message_Box; ---------------------------------------------------------------------------- -- -- Create_Font: an Ada wrapper for the Win32 CreateFont function. -- function Create_Font (Font : Font_Type) return Win32_HFONT is F : Win32_HFONT; L : aliased Win32_LOGFONT := Set_Font(Font); begin F := CreateFontIndirect (L'Unchecked_Access); return F; end Create_Font; ---------------------------------------------------------------------------- -- -- Set_Font: convert a Font_Type object to a Win32 font. -- function Set_Font (Font : Font_Type) return Win32_LOGFONT is F : Win32_LOGFONT; H : Win32_HDC; I : Win32_INT; begin H := GetDC(System.Null_Address); F.lfHeight := -Win32_LONG(GetDeviceCaps(H,LOGPIXELSY) * Win32_INT(Font.Size) / 72); I := ReleaseDC(System.Null_Address,H); if Font.Bold then F.lfWeight := 700; else F.lfWeight := 400; end if; F.lfItalic := Boolean'Pos(Font.Italic); if Font.Name'Length < F.lfFaceName'Length then F.lfFaceName(0..Font.Name'Length) := To_Array(Font.Name); else F.lfFaceName := To_Array(Font.Name(1..F.lfFaceName'Length-1)); end if; return F; end Set_Font; ---------------------------------------------------------------------------- -- -- Get_Font: convert a Win32 font to a Font_Type object. -- function Get_Font (Font : Win32_LOGFONT) return Font_Type is H : Win32_HDC; I : Win32_INT; S : Float; begin H := GetDC(System.Null_Address); S := 72.0 / Float(GetDeviceCaps(H,LOGPIXELSY)); I := ReleaseDC (System.Null_Address, H); return JEWL.Font(To_String(Font.lfFaceName), abs Integer(Float(Font.lfHeight)*S), Font.lfWeight > 500, Font.lfItalic /= 0); end Get_Font; end JEWL.Win32_Interface;
true
------------------------------------------------------------------------------ -- -- -- J E W L . W I N 3 2 _ I N T E R F A C E -- -- -- -- This is the body of a private package containing implementation -- -- details for JEWL.Windows. It contains type conversions where a -- -- bit-for-bit conversion is inadequate. It also contains some -- -- functions which provide a more tasteful Ada wrapping for a few -- -- common sequences of Win32 magic spells. -- -- -- -- Copyright (C) PI:NAME:<NAME>END_PI 2000. Contact address: PI:EMAIL:<EMAIL>END_PI -- -- 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-win32_interface.adb 1.7 2007/01/08 17:00:00 JE Exp $ ------------------------------------------------------------------------------ -- -- $Log: jewl-win32_interface.adb $ -- 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 PI:NAME:<NAME>END_PI 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 PI:NAME:<NAME>END_PI 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 PI:NAME:<NAME>END_PI -- and PI:NAME:<NAME>END_PI. -- -- 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 -- ------------------------------------------------------------------------------ with Interfaces.C; package body JEWL.Win32_Interface is pragma Linker_Options ("-luser32"); pragma Linker_Options ("-lgdi32"); pragma Linker_Options ("-lcomdlg32"); pragma Linker_Options ("-lwinmm"); use type Win32_DWORD, Win32_INT, Win32_UINT, Win32_LONG, Win32_BYTE; use type System.Address; ---------------------------------------------------------------------------- -- -- T Y P E C O N V E R S I O N S -- ---------------------------------------------------------------------------- function To_LPSTR (S : Win32_String) return Win32_LPSTR is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPSTR); begin return UC(S(S'First)'Address); end To_LPSTR; function To_LPCSTR (S : Win32_String) return Win32_LPCSTR is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPCSTR); begin return UC(S(S'First)'Address); end To_LPCSTR; function To_LPARAM (S : Win32_String) return Win32_LPARAM is function UC is new Ada.Unchecked_Conversion (System.Address, Win32_LPARAM); begin return UC(S(S'First)'Address); end To_LPARAM; function To_String (S : Win32_String) return String is begin return Interfaces.C.To_Ada(S); end To_String; function To_Array (S : String) return Win32_String is begin return Interfaces.C.To_C(S); end To_Array; function RGB (Colour : Colour_Type) return Win32_COLORREF is use type Win32_BYTE; begin return Win32_COLORREF(Colour.Red + Colour.Green*2**8 + Colour.Blue*2**16); end RGB; function MakePoint (Value: Win32_LPARAM) return Win32_POINTS is use type Interfaces.Unsigned_32; function UC is new Ada.Unchecked_Conversion (Win32_LPARAM,Interfaces.Unsigned_32); function UC is new Ada.Unchecked_Conversion (Win32_WORD,Win32_SHORT); P : Win32_POINTS; V : Interfaces.Unsigned_32 := UC(Value); begin P.X := UC(Win32_WORD(V and 16#FFFF#)); P.Y := UC(Win32_WORD(Interfaces.Shift_Right(V,16) and 16#FFFF#)); return P; end MakePoint; ---------------------------------------------------------------------------- -- -- U T I L I T Y F U N C T I O N S -- ---------------------------------------------------------------------------- -- -- Message_Box: an Ada wrapper for the Win32 MessageBox function. -- function Message_Box (Message : String; Title : String; Flags : Win32_UINT) return Integer is M : Win32_String := To_Array(Message); T : Win32_String := To_Array(Title); begin return Integer(MessageBox(System.Null_Address, To_LPCSTR(M), To_LPCSTR(T), Flags or MB_TASKMODAL or MB_SETFOREGROUND)); end Message_Box; ---------------------------------------------------------------------------- -- -- Create_Font: an Ada wrapper for the Win32 CreateFont function. -- function Create_Font (Font : Font_Type) return Win32_HFONT is F : Win32_HFONT; L : aliased Win32_LOGFONT := Set_Font(Font); begin F := CreateFontIndirect (L'Unchecked_Access); return F; end Create_Font; ---------------------------------------------------------------------------- -- -- Set_Font: convert a Font_Type object to a Win32 font. -- function Set_Font (Font : Font_Type) return Win32_LOGFONT is F : Win32_LOGFONT; H : Win32_HDC; I : Win32_INT; begin H := GetDC(System.Null_Address); F.lfHeight := -Win32_LONG(GetDeviceCaps(H,LOGPIXELSY) * Win32_INT(Font.Size) / 72); I := ReleaseDC(System.Null_Address,H); if Font.Bold then F.lfWeight := 700; else F.lfWeight := 400; end if; F.lfItalic := Boolean'Pos(Font.Italic); if Font.Name'Length < F.lfFaceName'Length then F.lfFaceName(0..Font.Name'Length) := To_Array(Font.Name); else F.lfFaceName := To_Array(Font.Name(1..F.lfFaceName'Length-1)); end if; return F; end Set_Font; ---------------------------------------------------------------------------- -- -- Get_Font: convert a Win32 font to a Font_Type object. -- function Get_Font (Font : Win32_LOGFONT) return Font_Type is H : Win32_HDC; I : Win32_INT; S : Float; begin H := GetDC(System.Null_Address); S := 72.0 / Float(GetDeviceCaps(H,LOGPIXELSY)); I := ReleaseDC (System.Null_Address, H); return JEWL.Font(To_String(Font.lfFaceName), abs Integer(Float(Font.lfHeight)*S), Font.lfWeight > 500, Font.lfItalic /= 0); end Get_Font; end JEWL.Win32_Interface;