content
stringlengths
23
1.05M
-- Test program. Read a valid toml-test compatible JSON description on the -- standard input and emit a corresponding TOML document on the standard -- output. with Ada.Containers.Generic_Array_Sort; with Ada.Strings.Unbounded; with Ada.Text_IO; with GNATCOLL.JSON; with TOML; with TOML.Generic_Dump; procedure Ada_TOML_Encode is use type Ada.Strings.Unbounded.Unbounded_String; use all type GNATCOLL.JSON.JSON_Value_Type; package US renames Ada.Strings.Unbounded; package IO renames Ada.Text_IO; package J renames GNATCOLL.JSON; type Stdout_Stream is null record; procedure Put (Stream : in out Stdout_Stream; Bytes : String); -- Callback for TOML.Generic_Dump function Interpret (Desc : J.JSON_Value) return TOML.TOML_Value; -- Interpret the given toml-test compatible JSON description (Value) and -- return the corresponding TOML value. type String_Array is array (Positive range <>) of US.Unbounded_String; procedure Sort_Strings is new Ada.Containers.Generic_Array_Sort (Index_Type => Positive, Element_Type => US.Unbounded_String, Array_Type => String_Array, "<" => US."<"); function Sorted_Keys (Desc : J.JSON_Value) return String_Array with Pre => Desc.Kind = JSON_Object_Type; -- Return a sorted array for all keys in the Desc object --------- -- Put -- --------- procedure Put (Stream : in out Stdout_Stream; Bytes : String) is pragma Unreferenced (Stream); begin IO.Put (Bytes); end Put; ----------------- -- Sorted_Keys -- ----------------- function Sorted_Keys (Desc : J.JSON_Value) return String_Array is Count : Natural := 0; procedure Count_CB (Dummy_Name : J.UTF8_String; Dummy_Value : J.JSON_Value); -------------- -- Count_CB -- -------------- procedure Count_CB (Dummy_Name : J.UTF8_String; Dummy_Value : J.JSON_Value) is begin Count := Count + 1; end Count_CB; begin Desc.Map_JSON_Object (Count_CB'Access); return Result : String_Array (1 .. Count) do declare I : Positive := Result'First; procedure Read_Entry (Name : J.UTF8_String; Dummy_Value : J.JSON_Value); ---------------- -- Read_Entry -- ---------------- procedure Read_Entry (Name : J.UTF8_String; Dummy_Value : J.JSON_Value) is begin Result (I) := US.To_Unbounded_String (Name); I := I + 1; end Read_Entry; begin Desc.Map_JSON_Object (Read_Entry'Access); Sort_Strings (Result); end; end return; end Sorted_Keys; --------------- -- Interpret -- --------------- function Interpret (Desc : J.JSON_Value) return TOML.TOML_Value is Time_Base_Length : constant := 8; Time_Milli_Length : constant := 4; Date_Length : constant := 10; Local_Datetime_Base_Length : constant := Date_Length + 1 + Time_Base_Length; Offset_Datetime_Base_Length : constant := Local_Datetime_Base_Length + 1; Offset_Full_Length : constant := 6; function Decode_Offset_Datetime (S : String) return TOML.Any_Offset_Datetime; function Decode_Local_Datetime (S : String) return TOML.Any_Local_Datetime; function Decode_Date (S : String) return TOML.Any_Local_Date; function Decode_Time (S : String) return TOML.Any_Local_Time; ---------------------------- -- Decode_Offset_Datetime -- ---------------------------- function Decode_Offset_Datetime (S : String) return TOML.Any_Offset_Datetime is use type TOML.Any_Local_Offset; pragma Assert (S'Length >= Offset_Datetime_Base_Length); Offset : TOML.Any_Local_Offset; Unknown_Offset : Boolean; I : constant Positive := S'First; Last : Positive := S'Last; begin if S (Last) = 'Z' then Last := Last - 1; Offset := 0; Unknown_Offset := False; else declare pragma Assert (S (Last - 2) = ':'); Offset_Sign : Character renames S (Last - 5); Hour_Offset : String renames S (Last - 4 .. Last - 3); Minute_Offset : String renames S (Last - 1 .. Last); begin Offset := 60 * TOML.Any_Local_Offset'Value (Hour_Offset) + TOML.Any_Local_Offset'Value (Minute_Offset); case Offset_Sign is when '-' => Offset := -Offset; when '+' => null; when others => raise Program_Error; end case; Unknown_Offset := Offset = 0 and then Offset_Sign = '-'; Last := Last - Offset_Full_Length; end; end if; declare Local_Datetime : constant TOML.Any_Local_Datetime := Decode_Local_Datetime (S (I .. Last)); begin return (Local_Datetime, Offset, Unknown_Offset); end; end Decode_Offset_Datetime; --------------------------- -- Decode_Local_Datetime -- --------------------------- function Decode_Local_Datetime (S : String) return TOML.Any_Local_Datetime is I : constant Positive := S'First; pragma Assert (S'Length >= Local_Datetime_Base_Length); pragma Assert (S (I + Date_Length) = 'T'); Date : constant TOML.Any_Local_Date := Decode_Date (S (I .. I + Date_Length - 1)); Time : constant TOML.Any_Local_Time := Decode_Time (S (I + Date_Length + 1 .. S'Last)); begin return (Date, Time); end Decode_Local_Datetime; ----------------- -- Decode_Date -- ----------------- function Decode_Date (S : String) return TOML.Any_Local_Date is I : constant Positive := S'First; pragma Assert (S'Length = Date_Length); pragma Assert (S (I + 4) = '-'); pragma Assert (S (I + 7) = '-'); Year : String renames S (I + 0 .. I + 3); Month : String renames S (I + 5 .. I + 6); Day : String renames S (I + 8 .. I + 9); begin return (TOML.Any_Year'Value (Year), TOML.Any_Month'Value (Month), TOML.Any_Day'Value (Day)); end Decode_Date; ----------------- -- Decode_Time -- ----------------- function Decode_Time (S : String) return TOML.Any_Local_Time is I : constant Positive := S'First; pragma Assert (S'Length in Time_Base_Length | Time_Base_Length + Time_Milli_Length); pragma Assert (S (I + 2) = ':'); pragma Assert (S (I + 5) = ':'); Hour : String renames S (I + 0 .. I + 1); Minute : String renames S (I + 3 .. I + 4); Second : String renames S (I + 6 .. I + 7); Millisecond : TOML.Any_Millisecond := 0; begin if S'Length /= Time_Base_Length then pragma Assert (S (I + Time_Base_Length) = '.'); Millisecond := TOML.Any_Millisecond'Value (S (I + Time_Base_Length + 1 .. S'Last)); end if; return (TOML.Any_Hour'Value (Hour), TOML.Any_Minute'Value (Minute), TOML.Any_Second'Value (Second), Millisecond); end Decode_Time; Result : TOML.TOML_Value; begin case Desc.Kind is when JSON_Object_Type => declare Keys : constant String_Array := Sorted_Keys (Desc); begin if Keys'Length = 2 and then Keys (1) = US.To_Unbounded_String ("type") and then Keys (2) = US.To_Unbounded_String ("value") then declare T : constant String := Desc.Get ("type"); V : constant J.JSON_Value := Desc.Get ("value"); begin if T = "string" then declare S : constant String := V.Get; begin Result := TOML.Create_String (S); end; elsif T = "float" then declare S : constant String := V.Get; I : Positive := S'First; Positive : Boolean := True; Value : TOML.Any_Float; begin if S (I) = '+' then I := I + 1; elsif S (I) = '-' then Positive := False; I := I + 1; end if; if S (I .. S'Last) = "nan" then Value := (Kind => TOML.NaN, Positive => Positive); elsif S (I .. S'Last) = "inf" then Value := (Kind => TOML.Infinity, Positive => Positive); else declare use type TOML.Valid_Float; VF : TOML.Valid_Float := TOML.Valid_Float'Value (S (I .. S'Last)); begin if not Positive then VF := -VF; end if; Value := (Kind => TOML.Regular, Value => VF); end; end if; Result := TOML.Create_Float (Value); end; elsif T = "integer" then declare S : constant String := V.Get; begin Result := TOML.Create_Integer (TOML.Any_Integer'Value (S)); end; elsif T = "bool" then declare S : constant String := V.Get; begin Result := TOML.Create_Boolean (Boolean'Value (S)); end; elsif T = "datetime" then Result := TOML.Create_Offset_Datetime (Decode_Offset_Datetime (V.Get)); elsif T = "datetime-local" then Result := TOML.Create_Local_Datetime (Decode_Local_Datetime (V.Get)); elsif T = "date-local" then Result := TOML.Create_Local_Date (Decode_Date (V.Get)); elsif T = "time-local" then Result := TOML.Create_Local_Time (Decode_Time (V.Get)); elsif T = "array" then Result := Interpret (V); else raise Program_Error with "unhandled value type: " & T; end if; end; else Result := TOML.Create_Table; for K of Keys loop declare Item : constant TOML.TOML_Value := Interpret (Desc.Get (US.To_String (K))); begin Result.Set (K, Item); end; end loop; end if; end; when JSON_Array_Type => declare Elements : constant J.JSON_Array := Desc.Get; begin Result := TOML.Create_Array; for I in 1 .. J.Length (Elements) loop Result.Append (Interpret (J.Get (Elements, I))); end loop; end; when others => raise Program_Error; end case; return Result; end Interpret; procedure Dump is new TOML.Generic_Dump (Stdout_Stream, Put); Input : US.Unbounded_String; Description : J.JSON_Value; Result : TOML.TOML_Value; Stdout : Stdout_Stream := (null record); begin -- Read the stdin until end of file and store its content in Input loop begin declare Line : constant String := IO.Get_Line; begin US.Append (Input, Line); end; exception when IO.End_Error => exit; end; end loop; -- Decode this input as JSON Description := J.Read (US.To_String (Input)); -- Build the TOML document from the JSON description and output it on the -- standard output. Result := Interpret (Description); Dump (Stdout, Result); end Ada_TOML_Encode;
-- Copyright 2016 Steven Stewart-Gallus -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT 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 System; with Interfaces.C; use Interfaces.C; limited with Pulse.Mainloop.API; package Pulse.Mainloop.Signal with Spark_Mode => Off is -- skipped empty struct pa_signal_event type pa_signal_cb_t is access procedure (arg1 : access Pulse.Mainloop.API.pa_mainloop_api; arg2 : System.Address; arg3 : int; arg4 : System.Address); pragma Convention (C, pa_signal_cb_t); -- /usr/include/pulse/mainloop-signal.h:44 type pa_signal_destroy_cb_t is access procedure (arg1 : access Pulse.Mainloop.API.pa_mainloop_api; arg2 : System.Address; arg3 : System.Address); pragma Convention (C, pa_signal_destroy_cb_t); -- /usr/include/pulse/mainloop-signal.h:47 function pa_signal_init (api : access Pulse.Mainloop.API.pa_mainloop_api) return int; -- /usr/include/pulse/mainloop-signal.h:50 pragma Import (C, pa_signal_init, "pa_signal_init"); procedure pa_signal_done; -- /usr/include/pulse/mainloop-signal.h:53 pragma Import (C, pa_signal_done, "pa_signal_done"); function pa_signal_new (sig : int; callback : pa_signal_cb_t; userdata : System.Address) return System.Address; -- /usr/include/pulse/mainloop-signal.h:56 pragma Import (C, pa_signal_new, "pa_signal_new"); procedure pa_signal_free (e : System.Address); -- /usr/include/pulse/mainloop-signal.h:59 pragma Import (C, pa_signal_free, "pa_signal_free"); procedure pa_signal_set_destroy (e : System.Address; callback : pa_signal_destroy_cb_t); -- /usr/include/pulse/mainloop-signal.h:62 pragma Import (C, pa_signal_set_destroy, "pa_signal_set_destroy"); end Pulse.Mainloop.Signal;
with Ada.Numerics.Generic_Elementary_Functions; package body Apollonius is package Math is new Ada.Numerics.Generic_Elementary_Functions (Long_Float); function Solve_CCC (Circle_1, Circle_2, Circle_3 : Circle; T1, T2, T3 : Tangentiality := External) return Circle is S1 : Long_Float := 1.0; S2 : Long_Float := 1.0; S3 : Long_Float := 1.0; X1 : Long_Float renames Circle_1.Center.X; Y1 : Long_Float renames Circle_1.Center.Y; R1 : Long_Float renames Circle_1.Radius; X2 : Long_Float renames Circle_2.Center.X; Y2 : Long_Float renames Circle_2.Center.Y; R2 : Long_Float renames Circle_2.Radius; X3 : Long_Float renames Circle_3.Center.X; Y3 : Long_Float renames Circle_3.Center.Y; R3 : Long_Float renames Circle_3.Radius; begin if T1 = Internal then S1 := -S1; end if; if T2 = Internal then S2 := -S2; end if; if T3 = Internal then S3 := -S3; end if; declare V11 : constant Long_Float := 2.0 * X2 - 2.0 * X1; V12 : constant Long_Float := 2.0 * Y2 - 2.0 * Y1; V13 : constant Long_Float := X1 * X1 - X2 * X2 + Y1 * Y1 - Y2 * Y2 - R1 * R1 + R2 * R2; V14 : constant Long_Float := 2.0 * S2 * R2 - 2.0 * S1 * R1; V21 : constant Long_Float := 2.0 * X3 - 2.0 * X2; V22 : constant Long_Float := 2.0 * Y3 - 2.0 * Y2; V23 : constant Long_Float := X2 * X2 - X3 * X3 + Y2 * Y2 - Y3 * Y3 - R2 * R2 + R3 * R3; V24 : constant Long_Float := 2.0 * S3 * R3 - 2.0 * S2 * R2; W12 : constant Long_Float := V12 / V11; W13 : constant Long_Float := V13 / V11; W14 : constant Long_Float := V14 / V11; W22 : constant Long_Float := V22 / V21 - W12; W23 : constant Long_Float := V23 / V21 - W13; W24 : constant Long_Float := V24 / V21 - W14; P : constant Long_Float := -W23 / W22; Q : constant Long_Float := W24 / W22; M : constant Long_Float := -W12 * P - W13; N : constant Long_Float := W14 - W12 * Q; A : constant Long_Float := N * N + Q * Q - 1.0; B : constant Long_Float := 2.0 * M * N - 2.0 * N * X1 + 2.0 * P * Q - 2.0 * Q * Y1 + 2.0 * S1 * R1; C : constant Long_Float := X1 * X1 + M * M - 2.0 * M * X1 + P * P + Y1 * Y1 - 2.0 * P * Y1 - R1 * R1; D : constant Long_Float := B * B - 4.0 * A * C; RS : constant Long_Float := (-B - Math.Sqrt (D)) / (2.0 * A); begin return (Center => (X => M + N * RS, Y => P + Q * RS), Radius => RS); end; end Solve_CCC; end Apollonius;
package body impact.d2.Math is procedure dummy is begin null; end dummy; function b2IsValid (x : in float32) return Boolean is begin if x /= x then return False; -- NaN. end if; return -float32'Last < x and then x < float32'Last; end b2IsValid; function b2InvSqrt (x : in float32) return float32 is use Interfaces; type Kind_type is (float, int); type convert_union (Kind : Kind_type := float) is record case Kind is when float => x : float32; when int => i : interfaces.Unsigned_32; end case; end record; pragma Unchecked_Union (convert_union); convert : convert_union; Result : float32 := x; xhalf : constant float32 := 0.5 * x; begin convert.x := x; convert.i := 16#5f3759df# - shift_Right (convert.i, 1); -- tbd: check this for 64 bit builds. Result := convert.x; Result := Result * (1.5 - xhalf * Result * Result); return Result; end b2InvSqrt; -- A 2D column vector. -- procedure setZero (Self : in out b2Vec2) is begin Self := (0.0, 0.0); end setZero; function "-" (Self : in b2Vec2) return b2Vec2 is begin return (-Self.x, -Self.y); end; function Element (Self : in b2Vec2; i : in int32) return float32 is begin case i is when 0 => return Self.x; when 1 => return Self.y; when others => raise Constraint_Error with "Illegal index" & int32'Image (i) & " for b2Vec2"; end case; end Element; procedure set_Element (Self : in out b2Vec2; i : in int32; To : in float32) is begin case i is when 0 => Self.x := To; when 1 => Self.y := To; when others => raise Constraint_Error with "Illegal index" & int32'Image (i) & " for b2Vec2"; end case; end set_Element; function "+" (Left, Right : b2Vec2) return b2Vec2 is begin return (x => Left.x + Right.x, y => Left.y + Right.y); end; function "-" (Left, Right : b2Vec2) return b2Vec2 is begin return (x => Left.x - Right.x, y => Left.y - Right.y); end; function "*" (Left : b2Vec2; Right : in float32) return b2Vec2 is begin return (x => Left.x * Right, y => Left.y * Right); end; function Length (Self : in b2Vec2) return float32 is use float_math.Functions; begin return SqRt (Self.x * Self.x + Self.y * Self.y); end Length; function LengthSquared (Self : in b2Vec2) return float32 is begin return Self.x * Self.x + Self.y * Self.y; end LengthSquared; function Normalize (Self : access b2Vec2) return float32 is the_length : constant float32 := Length (Self.all); invlength : float32; begin if the_length < b2_epsilon then return 0.0; end if; invLength := 1.0 / the_length; Self.x := Self.x * invLength; Self.y := Self.y * invLength; return the_length; end Normalize; procedure Normalize (Self : in out b2Vec2) is the_length : constant float32 := Length (Self); invlength : float32; begin if the_length < b2_epsilon then return; end if; invLength := 1.0 / the_length; Self.x := Self.x * invLength; Self.y := Self.y * invLength; end Normalize; function Normalize (Self : in b2Vec2) return b2Vec2 is Result : b2Vec2 := Self; begin normalize (Result); return Result; end Normalize; function isValid (Self : in b2Vec2) return Boolean is begin return b2IsValid (Self.x) and then b2IsValid (Self.y); end isValid; -- A 2D column vector with 3 elements. -- procedure setZero (Self : in out b2Vec3) is begin Self := (0.0, 0.0, 0.0); end setZero; function "-" (Self : in b2Vec3) return b2Vec3 is begin return (-Self.x, -Self.y, -Self.z); end; function "+" (Left, Right : b2Vec3) return b2Vec3 is begin return (x => Left.x + Right.x, y => Left.y + Right.y, z => Left.z + Right.z); end; function "-" (Left, Right : b2Vec3) return b2Vec3 is begin return (x => Left.x - Right.x, y => Left.y - Right.y, z => Left.z - Right.z); end; function "*" (Left : in float32; Right : in b2Vec3) return b2Vec3 is begin return (x => Left * Right.x, y => Left * Right.y, z => Left * Right.z); end; function "*" (Left : b2Vec3; Right : in float32) return b2Vec3 is begin return (x => Left.x * Right, y => Left.y * Right, z => Left.z * Right); end; --- A 2-by-2 matrix. Stored in column-major order. -- function to_b2Mat22 (col1, col2 : in b2Vec2) return b2Mat22 is begin return (col1, col2); end to_b2Mat22; function to_b2Mat22 (a11, a12, a21, a22 : in float32) return b2Mat22 is begin return (col1 => (x => a11, y => a21), col2 => (x => a12, y => a22)); end to_b2Mat22; function to_b2Mat22 (angle : in float32) return b2Mat22 is use float_math.Functions; c : constant float32 := cos (angle); s : constant float32 := sin (angle); begin return (col1 => (x => c, y => s), col2 => (x => -s, y => c)); end to_b2Mat22; procedure set (Self : in out b2Mat22; angle : in float32) is begin Self := to_b2Mat22 (angle); end set; procedure setIdentity (Self : in out b2Mat22) is begin Self := (col1 => (x => 1.0, y => 0.0), col2 => (x => 0.0, y => 1.0)); end setIdentity; procedure setZero (Self : in out b2Mat22) is begin Self := ((0.0, 0.0), (0.0, 0.0)); end setZero; function getAngle (Self : in b2Mat22) return float32 is use float_math.Functions; begin return arcTan (self.col1.y, self.col1.x); end getAngle; function getInverse (Self : in b2Mat22) return b2Mat22 is a : constant float32 := Self.col1.x; b : constant float32 := Self.col2.x; c : constant float32 := Self.col1.y; d : constant float32 := Self.col2.y; det : float32 := a * d - b * c; Result : b2Mat22; begin if det /= 0.0 then det := 1.0 / det; end if; Result.col1.x := det * d; Result.col2.x := -det * b; Result.col1.y := -det * c; Result.col2.y := det * a; return Result; end getInverse; function solve (Self : in b2Mat22; b : in b2Vec2) return b2Vec2 is a11 : constant float32 := Self.col1.x; a12 : constant float32 := Self.col2.x; a21 : constant float32 := Self.col1.y; a22 : constant float32 := Self.col2.y; det : float32 := a11 * a22 - a12 * a21; X : b2Vec2; begin if det /= 0.0 then det := 1.0 / det; end if; X.x := det * (a22 * b.x - a12 * b.y); X.y := det * (a11 * b.y - a21 * b.x); return X; end solve; -- A 3-by-3 matrix. Stored in column-major order. -- function to_b2Mat33 (col1, col2, col3 : in b2Vec3) return b2Mat33 is begin return (col1, col2, col3); end to_b2Mat33; procedure setZero (Self : in out b2Mat33) is begin Self := (others => (others => 0.0)); end setZero; function solve (Self : in b2Mat33; b : in b2Vec3) return b2Vec3 is det : float32 := b2Dot (Self.col1, b2Cross (Self.col2, Self.col3)); X : b2Vec3; begin if det /= 0.0 then det := 1.0 / det; end if; X.x := det * b2Dot (b, b2Cross (Self.col2, Self.col3)); X.y := det * b2Dot (Self.col1, b2Cross (b, Self.col3)); X.z := det * b2Dot (Self.col1, b2Cross (Self.col2, b )); return X; end solve; function solve (Self : in b2Mat33; b : in b2Vec2) return b2Vec2 is a11 : constant float32 := Self.col1.x; a12 : constant float32 := Self.col2.x; a21 : constant float32 := Self.col1.y; a22 : constant float32 := Self.col2.y; det : float32 := a11 * a22 - a12 * a21; X : b2Vec2; begin if det /= 0.0 then det := 1.0 / det; end if; X.x := det * (a22 * b.x - a12 * b.y); X.y := det * (a11 * b.y - a21 * b.x); return X; end solve; --- b2Transform -- function to_btTransform (position : in b2Vec2; R : in b2Mat22) return b2Transform is begin return (position, R); end to_btTransform; procedure setIdentity (Self : in out b2Transform) is begin self.position := (0.0, 0.0); setIdentity (self.R); end setIdentity; procedure set (Self : in out b2Transform; p : in b2Vec2; angle : in float32) is begin Self.position := p; set (Self.R, angle); end set; function getAngle (Self : in b2Transform) return float32 is use float_math.Functions; begin return arcTan (Self.R.col1.y, Self.R.col1.x); end getAngle; --- b2Sweep -- procedure getTransform (Self : in b2Sweep; xf : access b2Transform; alpha : in float32) is angle : constant float32 := (1.0 - alpha) * Self.a0 + alpha * Self.a; begin xf.position := (1.0 - alpha) * Self.c0 + alpha * Self.c; set (xf.R, angle); xf.position := xf.position - b2Mul (xf.R, Self.localCenter); -- Shift to origin end getTransform; procedure advance (Self : in out b2Sweep; t : in float32) is begin Self.c0 := (1.0 - t) * Self.c0 + t * Self.c; Self.a0 := (1.0 - t) * Self.a0 + t * Self.a; end advance; procedure normalize (Self : in out b2Sweep) is twoPi : constant float32 := 2.0 * b2_pi; d : constant float32 := twoPi * float32'Floor (Self.a0 / twoPi); begin Self.a0 := Self.a0 - d; Self.a := Self.a - d; end normalize; function b2Dot (a, b : in b2Vec2) return float32 is begin return a.x * b.x + a.y * b.y; end b2Dot; function b2Cross (a : in b2Vec2; b : in b2Vec2) return float32 is begin return a.x * b.y - a.y * b.x; end b2Cross; function b2Cross (a : in b2Vec2; s : in float32) return b2Vec2 is begin return (s * a.y, -s * a.x); end b2Cross; function b2Cross (s : in float32; a : in b2Vec2) return b2Vec2 is begin return (-s * a.y, s * a.x); end b2Cross; function b2Mul (A : in b2Mat22; v : in b2Vec2) return b2Vec2 is begin return (A.col1.x * v.x + A.col2.x * v.y, A.col1.y * v.x + A.col2.y * v.y); end b2Mul; function b2MulT (A : in b2Mat22; v : in b2Vec2) return b2Vec2 is begin return (b2Dot (v, A.col1), b2Dot (v, A.col2)); end b2MulT; function "*" (Left : in float32; Right : in b2Vec2) return b2Vec2 is begin return (Left * Right.x, Left * Right.y); end; function b2Distance (a, b : in b2Vec2) return float32 is c : constant b2Vec2 := a - b; begin return Length (c); end b2Distance; function b2DistanceSquared (a, b : in b2Vec2) return float32 is c : constant b2Vec2 := a - b; begin return b2Dot (c, c); end b2DistanceSquared; function b2Dot (a, b : in b2Vec3) return float32 is begin return a.x * b.x + a.y * b.y + a.z * b.z; end b2Dot; function b2Cross (a, b : in b2Vec3) return b2Vec3 is begin return (a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); end b2Cross; function "+" (Left, Right : in b2Mat22) return b2Mat22 is begin return (Left.col1 + Right.col1, Left.col2 + Right.col2); end; function b2Mul (A, B : in b2Mat22) return b2Mat22 is begin return (b2Mul (A, B.col1), b2Mul (A, B.col2)); end b2Mul; function b2MulT (A, B : in b2Mat22) return b2Mat22 is c1 : constant b2Vec2 := (b2Dot (A.col1, B.col1), b2Dot (A.col2, B.col1)); c2 : constant b2Vec2 := (b2Dot (A.col1, B.col2), b2Dot (A.col2, B.col2)); begin return (c1, c2); end b2MulT; function b2Mul (A : in b2Mat33; v : in b2Vec3) return b2Vec3 is begin return v.x * A.col1 + v.y * A.col2 + v.z * A.col3; end b2Mul; function b2Mul (T : in b2Transform; v : in b2Vec2) return b2Vec2 is x : constant float32 := T.position.x + T.R.col1.x * v.x + T.R.col2.x * v.y; y : constant float32 := T.position.y + T.R.col1.y * v.x + T.R.col2.y * v.y; begin return (x, y); end b2Mul; function b2MulT (T : in b2Transform; v : in b2Vec2) return b2Vec2 is begin return b2MulT (T.R, v - T.position); end b2MulT; function b2Abs (Self : in b2Vec2) return b2Vec2 is begin return (abs (Self.x), abs (Self.y)); end b2Abs; function b2Abs (Self : in b2Mat22) return b2Mat22 is begin return (b2Abs (Self.col1), b2Abs (Self.col2)); end b2Abs; function b2Min (a, b : in b2Vec2) return b2Vec2 is begin return (float32'Min (a.x, b.x), float32'Min (a.y, b.y)); end b2Min; function b2Max (a, b : in b2Vec2) return b2Vec2 is begin return (float32'Max (a.x, b.x), float32'Max (a.y, b.y)); end b2Max; function b2Clamp (a : in float32; low, high : in float32) return float32 is begin return float32'Max (low, float32'Min (a, high)); end b2Clamp; function b2Clamp (a : in b2Vec2; low, high : in b2Vec2) return b2Vec2 is begin return b2Max (low, b2Min (a, high)); end b2Clamp; -- "Next Largest Power of 2 -- Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm -- that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with -- the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next -- largest power of 2. For a 32-bit value:" -- function b2NextPowerOfTwo (x : in uint32) return uint32 is use Interfaces; Pad : uint32 := x; begin Pad := Pad or shift_Right (Pad, 1); Pad := Pad or shift_Right (Pad, 2); Pad := Pad or shift_Right (Pad, 4); Pad := Pad or shift_Right (Pad, 8); Pad := Pad or shift_Right (Pad, 16); return Pad + 1; end b2NextPowerOfTwo; function b2IsPowerOfTwo (x : in uint32) return Boolean is use type uint32; begin return x > 0 and then (x and (x - 1)) = 0; end b2IsPowerOfTwo; end impact.d2.Math;
with Ada.Containers.Indefinite_Ordered_Maps; with Ada.Tags.Generic_Dispatching_Constructor; with Ada.Containers.Vectors; package body Plugins.Tables is use type Ada.Tags.Tag; package Plugin_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => Plugin_ID, Element_Type => Ada.Tags.Tag); Plugin_Map : Plugin_Maps.Map; procedure Find_Plugin (ID : in Plugin_ID; Success : out Boolean); -------------- -- Register -- -------------- procedure Register (ID : Plugin_ID; Tag : Ada.Tags.Tag) is OK : Boolean; Pos : Plugin_Maps.Cursor; begin Plugin_Map.Insert (Key => ID, New_Item => Tag, Position => Pos, Inserted => OK); end Register; --------- -- Get -- --------- function Get (ID : Plugin_ID; Params : not null access Plugin_Parameters; Search_If_Missing : Boolean := False) return Root_Plugin_Type'Class is OK : Boolean; Tag : Ada.Tags.Tag; function New_Plugin is new Ada.Tags.Generic_Dispatching_Constructor (T => Root_Plugin_Type, Parameters => Plugin_Parameters, Constructor => Constructor); begin if not Plugin_Map.Contains (ID) then if Search_If_Missing then Find_Plugin (ID => ID, Success => OK); else OK := False; end if; if not OK then raise Unknown_Plugin_ID; end if; if not Plugin_Map.Contains (ID) then raise Program_Error; end if; end if; Tag := Plugin_Map.Element (ID); return New_Plugin (Tag, Params); end Get; function Exists (ID : Plugin_ID; Search_If_Missing : Boolean := False) return Boolean is OK : Boolean; begin if Plugin_Map.Contains (ID) then return True; elsif Search_If_Missing then Find_Plugin (ID => ID, Success => OK); return OK; else return False; end if; end Exists; procedure For_All_Plugins (Callback : not null access procedure (ID : Plugin_ID)) is begin for I in Plugin_Map.Iterate loop Callback (Plugin_Maps.Key (I)); end loop; end For_All_Plugins; subtype Valid_Finder_ID is Finder_ID range 1 .. Finder_ID'Last; package Finder_Vectors is new Ada.Containers.Vectors (Index_Type => Valid_Finder_ID, Element_Type => Finder_Access); protected Finder_Table is procedure Add (Finder : in Finder_Access; ID : out Finder_ID); procedure Remove (ID : Finder_ID); procedure Find (ID : in Plugin_ID; Success : out Boolean); private Finder_Array : Finder_Vectors.Vector; end Finder_Table; protected body Finder_Table is procedure Add (Finder : in Finder_Access; ID : out Finder_ID) is begin Finder_Array.Append (Finder); ID := Finder_Array.Last_Index; end Add; procedure Remove (ID : Finder_ID) is begin if ID > Finder_Array.Last_Index then raise Constraint_Error; else declare procedure Delete (Item : in out Finder_Access) is begin Item := null; end Delete; begin Finder_Array.Update_Element (ID, Delete'Access); end; end if; end Remove; procedure Find (ID : in Plugin_ID; Success : out Boolean) is use Finder_Vectors; Found : Boolean; begin for Idx in Finder_Array.Iterate loop if Finder_Array.Element (To_Index (Idx)) /= null then Finder_Array.Element (To_Index (Idx)).Search_Plugin (ID, Found); if Found then Success := True; return; end if; end if; end loop; Success := False; end Find; end Finder_Table; function Add_Finder (Finder : Finder_Access) return Finder_ID is ID : Finder_ID; begin Finder_Table.Add (Finder, ID); return ID; end Add_Finder; procedure Remove_Finder (ID : Finder_ID) is begin Finder_Table.Remove (ID); end Remove_Finder; ---------- -- Find -- ---------- procedure Find_Plugin (ID : in Plugin_ID; Success : out Boolean) is begin Finder_Table.Find (ID, Success); end Find_Plugin; end Plugins.Tables;
-- Project: StratoX -- System: Stratosphere Balloon Flight Controller -- Author: Martin Becker (becker@rcs.ei.tum.de) with FAT_Filesystem.Directories.Files; with Interfaces; use Interfaces; -- @summary top-level package for reading/writing logfiles to SD card package SDLog with SPARK_Mode, Abstract_State => State, Initializes => State is subtype SDLog_Data is FAT_Filesystem.Directories.Files.File_Data; procedure Init with Post => Is_Open = False; -- initialize the SD log procedure Close with Post => Is_Open = False; -- closes the SD log procedure Start_Logfile (dirname : String; filename : String; ret : out Boolean); -- @summary create new logfile procedure Write_Log (Data : SDLog_Data; n_written : out Integer) with Pre => Is_Open; -- @summary write bytes to logfile procedure Write_Log (S : String; n_written : out Integer) with Pre => Is_Open; -- convenience function for Write_Log (File_Data) procedure Flush_Log; -- @summary force writing logfile to disk. -- Not recommended when time is critical! function Logsize return Unsigned_32; -- return log size in bytes function Is_Open return Boolean; -- return true if logfile is opened function To_File_Data (S : String) return SDLog_Data; private log_open : Boolean := False with Part_Of => State; SD_Initialized : Boolean := False with Part_Of => State; Error_State : Boolean := False with Part_Of => State; end SDLog;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; use Interfaces.C.Strings; with System; limited with glext; package gl is -- unsupported macro: GLAPI __attribute__((visibility("default"))) -- unsupported macro: APIENTRY GLAPIENTRY -- unsupported macro: APIENTRYP APIENTRY * -- unsupported macro: GLAPIENTRYP GLAPIENTRY * GL_VERSION_1_1 : constant := 1; -- gl.h:107 GL_VERSION_1_2 : constant := 1; -- gl.h:108 GL_VERSION_1_3 : constant := 1; -- gl.h:109 GL_ARB_imaging : constant := 1; -- gl.h:110 GL_FALSE : constant := 0; -- gl.h:139 GL_TRUE : constant := 1; -- gl.h:140 GL_BYTE : constant := 16#1400#; -- gl.h:143 GL_UNSIGNED_BYTE : constant := 16#1401#; -- gl.h:144 GL_SHORT : constant := 16#1402#; -- gl.h:145 GL_UNSIGNED_SHORT : constant := 16#1403#; -- gl.h:146 GL_INT : constant := 16#1404#; -- gl.h:147 GL_UNSIGNED_INT : constant := 16#1405#; -- gl.h:148 GL_FLOAT : constant := 16#1406#; -- gl.h:149 GL_2_BYTES : constant := 16#1407#; -- gl.h:150 GL_3_BYTES : constant := 16#1408#; -- gl.h:151 GL_4_BYTES : constant := 16#1409#; -- gl.h:152 GL_DOUBLE : constant := 16#140A#; -- gl.h:153 GL_POINTS : constant := 16#0000#; -- gl.h:156 GL_LINES : constant := 16#0001#; -- gl.h:157 GL_LINE_LOOP : constant := 16#0002#; -- gl.h:158 GL_LINE_STRIP : constant := 16#0003#; -- gl.h:159 GL_TRIANGLES : constant := 16#0004#; -- gl.h:160 GL_TRIANGLE_STRIP : constant := 16#0005#; -- gl.h:161 GL_TRIANGLE_FAN : constant := 16#0006#; -- gl.h:162 GL_QUADS : constant := 16#0007#; -- gl.h:163 GL_QUAD_STRIP : constant := 16#0008#; -- gl.h:164 GL_POLYGON : constant := 16#0009#; -- gl.h:165 GL_VERTEX_ARRAY : constant := 16#8074#; -- gl.h:168 GL_NORMAL_ARRAY : constant := 16#8075#; -- gl.h:169 GL_COLOR_ARRAY : constant := 16#8076#; -- gl.h:170 GL_INDEX_ARRAY : constant := 16#8077#; -- gl.h:171 GL_TEXTURE_COORD_ARRAY : constant := 16#8078#; -- gl.h:172 GL_EDGE_FLAG_ARRAY : constant := 16#8079#; -- gl.h:173 GL_VERTEX_ARRAY_SIZE : constant := 16#807A#; -- gl.h:174 GL_VERTEX_ARRAY_TYPE : constant := 16#807B#; -- gl.h:175 GL_VERTEX_ARRAY_STRIDE : constant := 16#807C#; -- gl.h:176 GL_NORMAL_ARRAY_TYPE : constant := 16#807E#; -- gl.h:177 GL_NORMAL_ARRAY_STRIDE : constant := 16#807F#; -- gl.h:178 GL_COLOR_ARRAY_SIZE : constant := 16#8081#; -- gl.h:179 GL_COLOR_ARRAY_TYPE : constant := 16#8082#; -- gl.h:180 GL_COLOR_ARRAY_STRIDE : constant := 16#8083#; -- gl.h:181 GL_INDEX_ARRAY_TYPE : constant := 16#8085#; -- gl.h:182 GL_INDEX_ARRAY_STRIDE : constant := 16#8086#; -- gl.h:183 GL_TEXTURE_COORD_ARRAY_SIZE : constant := 16#8088#; -- gl.h:184 GL_TEXTURE_COORD_ARRAY_TYPE : constant := 16#8089#; -- gl.h:185 GL_TEXTURE_COORD_ARRAY_STRIDE : constant := 16#808A#; -- gl.h:186 GL_EDGE_FLAG_ARRAY_STRIDE : constant := 16#808C#; -- gl.h:187 GL_VERTEX_ARRAY_POINTER : constant := 16#808E#; -- gl.h:188 GL_NORMAL_ARRAY_POINTER : constant := 16#808F#; -- gl.h:189 GL_COLOR_ARRAY_POINTER : constant := 16#8090#; -- gl.h:190 GL_INDEX_ARRAY_POINTER : constant := 16#8091#; -- gl.h:191 GL_TEXTURE_COORD_ARRAY_POINTER : constant := 16#8092#; -- gl.h:192 GL_EDGE_FLAG_ARRAY_POINTER : constant := 16#8093#; -- gl.h:193 GL_V2F : constant := 16#2A20#; -- gl.h:194 GL_V3F : constant := 16#2A21#; -- gl.h:195 GL_C4UB_V2F : constant := 16#2A22#; -- gl.h:196 GL_C4UB_V3F : constant := 16#2A23#; -- gl.h:197 GL_C3F_V3F : constant := 16#2A24#; -- gl.h:198 GL_N3F_V3F : constant := 16#2A25#; -- gl.h:199 GL_C4F_N3F_V3F : constant := 16#2A26#; -- gl.h:200 GL_T2F_V3F : constant := 16#2A27#; -- gl.h:201 GL_T4F_V4F : constant := 16#2A28#; -- gl.h:202 GL_T2F_C4UB_V3F : constant := 16#2A29#; -- gl.h:203 GL_T2F_C3F_V3F : constant := 16#2A2A#; -- gl.h:204 GL_T2F_N3F_V3F : constant := 16#2A2B#; -- gl.h:205 GL_T2F_C4F_N3F_V3F : constant := 16#2A2C#; -- gl.h:206 GL_T4F_C4F_N3F_V4F : constant := 16#2A2D#; -- gl.h:207 GL_MATRIX_MODE : constant := 16#0BA0#; -- gl.h:210 GL_MODELVIEW : constant := 16#1700#; -- gl.h:211 GL_PROJECTION : constant := 16#1701#; -- gl.h:212 GL_TEXTURE : constant := 16#1702#; -- gl.h:213 GL_POINT_SMOOTH : constant := 16#0B10#; -- gl.h:216 GL_POINT_SIZE : constant := 16#0B11#; -- gl.h:217 GL_POINT_SIZE_GRANULARITY : constant := 16#0B13#; -- gl.h:218 GL_POINT_SIZE_RANGE : constant := 16#0B12#; -- gl.h:219 GL_LINE_SMOOTH : constant := 16#0B20#; -- gl.h:222 GL_LINE_STIPPLE : constant := 16#0B24#; -- gl.h:223 GL_LINE_STIPPLE_PATTERN : constant := 16#0B25#; -- gl.h:224 GL_LINE_STIPPLE_REPEAT : constant := 16#0B26#; -- gl.h:225 GL_LINE_WIDTH : constant := 16#0B21#; -- gl.h:226 GL_LINE_WIDTH_GRANULARITY : constant := 16#0B23#; -- gl.h:227 GL_LINE_WIDTH_RANGE : constant := 16#0B22#; -- gl.h:228 GL_POINT : constant := 16#1B00#; -- gl.h:231 GL_LINE : constant := 16#1B01#; -- gl.h:232 GL_FILL : constant := 16#1B02#; -- gl.h:233 GL_CW : constant := 16#0900#; -- gl.h:234 GL_CCW : constant := 16#0901#; -- gl.h:235 GL_FRONT : constant := 16#0404#; -- gl.h:236 GL_BACK : constant := 16#0405#; -- gl.h:237 GL_POLYGON_MODE : constant := 16#0B40#; -- gl.h:238 GL_POLYGON_SMOOTH : constant := 16#0B41#; -- gl.h:239 GL_POLYGON_STIPPLE : constant := 16#0B42#; -- gl.h:240 GL_EDGE_FLAG : constant := 16#0B43#; -- gl.h:241 GL_CULL_FACE : constant := 16#0B44#; -- gl.h:242 GL_CULL_FACE_MODE : constant := 16#0B45#; -- gl.h:243 GL_FRONT_FACE : constant := 16#0B46#; -- gl.h:244 GL_POLYGON_OFFSET_FACTOR : constant := 16#8038#; -- gl.h:245 GL_POLYGON_OFFSET_UNITS : constant := 16#2A00#; -- gl.h:246 GL_POLYGON_OFFSET_POINT : constant := 16#2A01#; -- gl.h:247 GL_POLYGON_OFFSET_LINE : constant := 16#2A02#; -- gl.h:248 GL_POLYGON_OFFSET_FILL : constant := 16#8037#; -- gl.h:249 GL_COMPILE : constant := 16#1300#; -- gl.h:252 GL_COMPILE_AND_EXECUTE : constant := 16#1301#; -- gl.h:253 GL_LIST_BASE : constant := 16#0B32#; -- gl.h:254 GL_LIST_INDEX : constant := 16#0B33#; -- gl.h:255 GL_LIST_MODE : constant := 16#0B30#; -- gl.h:256 GL_NEVER : constant := 16#0200#; -- gl.h:259 GL_LESS : constant := 16#0201#; -- gl.h:260 GL_EQUAL : constant := 16#0202#; -- gl.h:261 GL_LEQUAL : constant := 16#0203#; -- gl.h:262 GL_GREATER : constant := 16#0204#; -- gl.h:263 GL_NOTEQUAL : constant := 16#0205#; -- gl.h:264 GL_GEQUAL : constant := 16#0206#; -- gl.h:265 GL_ALWAYS : constant := 16#0207#; -- gl.h:266 GL_DEPTH_TEST : constant := 16#0B71#; -- gl.h:267 GL_DEPTH_BITS : constant := 16#0D56#; -- gl.h:268 GL_DEPTH_CLEAR_VALUE : constant := 16#0B73#; -- gl.h:269 GL_DEPTH_FUNC : constant := 16#0B74#; -- gl.h:270 GL_DEPTH_RANGE : constant := 16#0B70#; -- gl.h:271 GL_DEPTH_WRITEMASK : constant := 16#0B72#; -- gl.h:272 GL_DEPTH_COMPONENT : constant := 16#1902#; -- gl.h:273 GL_LIGHTING : constant := 16#0B50#; -- gl.h:276 GL_LIGHT0 : constant := 16#4000#; -- gl.h:277 GL_LIGHT1 : constant := 16#4001#; -- gl.h:278 GL_LIGHT2 : constant := 16#4002#; -- gl.h:279 GL_LIGHT3 : constant := 16#4003#; -- gl.h:280 GL_LIGHT4 : constant := 16#4004#; -- gl.h:281 GL_LIGHT5 : constant := 16#4005#; -- gl.h:282 GL_LIGHT6 : constant := 16#4006#; -- gl.h:283 GL_LIGHT7 : constant := 16#4007#; -- gl.h:284 GL_SPOT_EXPONENT : constant := 16#1205#; -- gl.h:285 GL_SPOT_CUTOFF : constant := 16#1206#; -- gl.h:286 GL_CONSTANT_ATTENUATION : constant := 16#1207#; -- gl.h:287 GL_LINEAR_ATTENUATION : constant := 16#1208#; -- gl.h:288 GL_QUADRATIC_ATTENUATION : constant := 16#1209#; -- gl.h:289 GL_AMBIENT : constant := 16#1200#; -- gl.h:290 GL_DIFFUSE : constant := 16#1201#; -- gl.h:291 GL_SPECULAR : constant := 16#1202#; -- gl.h:292 GL_SHININESS : constant := 16#1601#; -- gl.h:293 GL_EMISSION : constant := 16#1600#; -- gl.h:294 GL_POSITION : constant := 16#1203#; -- gl.h:295 GL_SPOT_DIRECTION : constant := 16#1204#; -- gl.h:296 GL_AMBIENT_AND_DIFFUSE : constant := 16#1602#; -- gl.h:297 GL_COLOR_INDEXES : constant := 16#1603#; -- gl.h:298 GL_LIGHT_MODEL_TWO_SIDE : constant := 16#0B52#; -- gl.h:299 GL_LIGHT_MODEL_LOCAL_VIEWER : constant := 16#0B51#; -- gl.h:300 GL_LIGHT_MODEL_AMBIENT : constant := 16#0B53#; -- gl.h:301 GL_FRONT_AND_BACK : constant := 16#0408#; -- gl.h:302 GL_SHADE_MODEL : constant := 16#0B54#; -- gl.h:303 GL_FLAT : constant := 16#1D00#; -- gl.h:304 GL_SMOOTH : constant := 16#1D01#; -- gl.h:305 GL_COLOR_MATERIAL : constant := 16#0B57#; -- gl.h:306 GL_COLOR_MATERIAL_FACE : constant := 16#0B55#; -- gl.h:307 GL_COLOR_MATERIAL_PARAMETER : constant := 16#0B56#; -- gl.h:308 GL_NORMALIZE : constant := 16#0BA1#; -- gl.h:309 GL_CLIP_PLANE0 : constant := 16#3000#; -- gl.h:312 GL_CLIP_PLANE1 : constant := 16#3001#; -- gl.h:313 GL_CLIP_PLANE2 : constant := 16#3002#; -- gl.h:314 GL_CLIP_PLANE3 : constant := 16#3003#; -- gl.h:315 GL_CLIP_PLANE4 : constant := 16#3004#; -- gl.h:316 GL_CLIP_PLANE5 : constant := 16#3005#; -- gl.h:317 GL_ACCUM_RED_BITS : constant := 16#0D58#; -- gl.h:320 GL_ACCUM_GREEN_BITS : constant := 16#0D59#; -- gl.h:321 GL_ACCUM_BLUE_BITS : constant := 16#0D5A#; -- gl.h:322 GL_ACCUM_ALPHA_BITS : constant := 16#0D5B#; -- gl.h:323 GL_ACCUM_CLEAR_VALUE : constant := 16#0B80#; -- gl.h:324 GL_ACCUM : constant := 16#0100#; -- gl.h:325 GL_ADD : constant := 16#0104#; -- gl.h:326 GL_LOAD : constant := 16#0101#; -- gl.h:327 GL_MULT : constant := 16#0103#; -- gl.h:328 GL_RETURN : constant := 16#0102#; -- gl.h:329 GL_ALPHA_TEST : constant := 16#0BC0#; -- gl.h:332 GL_ALPHA_TEST_REF : constant := 16#0BC2#; -- gl.h:333 GL_ALPHA_TEST_FUNC : constant := 16#0BC1#; -- gl.h:334 GL_BLEND : constant := 16#0BE2#; -- gl.h:337 GL_BLEND_SRC : constant := 16#0BE1#; -- gl.h:338 GL_BLEND_DST : constant := 16#0BE0#; -- gl.h:339 GL_ZERO : constant := 0; -- gl.h:340 GL_ONE : constant := 1; -- gl.h:341 GL_SRC_COLOR : constant := 16#0300#; -- gl.h:342 GL_ONE_MINUS_SRC_COLOR : constant := 16#0301#; -- gl.h:343 GL_SRC_ALPHA : constant := 16#0302#; -- gl.h:344 GL_ONE_MINUS_SRC_ALPHA : constant := 16#0303#; -- gl.h:345 GL_DST_ALPHA : constant := 16#0304#; -- gl.h:346 GL_ONE_MINUS_DST_ALPHA : constant := 16#0305#; -- gl.h:347 GL_DST_COLOR : constant := 16#0306#; -- gl.h:348 GL_ONE_MINUS_DST_COLOR : constant := 16#0307#; -- gl.h:349 GL_SRC_ALPHA_SATURATE : constant := 16#0308#; -- gl.h:350 GL_FEEDBACK : constant := 16#1C01#; -- gl.h:353 GL_RENDER : constant := 16#1C00#; -- gl.h:354 GL_SELECT : constant := 16#1C02#; -- gl.h:355 GL_2D : constant := 16#0600#; -- gl.h:358 GL_3D : constant := 16#0601#; -- gl.h:359 GL_3D_COLOR : constant := 16#0602#; -- gl.h:360 GL_3D_COLOR_TEXTURE : constant := 16#0603#; -- gl.h:361 GL_4D_COLOR_TEXTURE : constant := 16#0604#; -- gl.h:362 GL_POINT_TOKEN : constant := 16#0701#; -- gl.h:363 GL_LINE_TOKEN : constant := 16#0702#; -- gl.h:364 GL_LINE_RESET_TOKEN : constant := 16#0707#; -- gl.h:365 GL_POLYGON_TOKEN : constant := 16#0703#; -- gl.h:366 GL_BITMAP_TOKEN : constant := 16#0704#; -- gl.h:367 GL_DRAW_PIXEL_TOKEN : constant := 16#0705#; -- gl.h:368 GL_COPY_PIXEL_TOKEN : constant := 16#0706#; -- gl.h:369 GL_PASS_THROUGH_TOKEN : constant := 16#0700#; -- gl.h:370 GL_FEEDBACK_BUFFER_POINTER : constant := 16#0DF0#; -- gl.h:371 GL_FEEDBACK_BUFFER_SIZE : constant := 16#0DF1#; -- gl.h:372 GL_FEEDBACK_BUFFER_TYPE : constant := 16#0DF2#; -- gl.h:373 GL_SELECTION_BUFFER_POINTER : constant := 16#0DF3#; -- gl.h:376 GL_SELECTION_BUFFER_SIZE : constant := 16#0DF4#; -- gl.h:377 GL_FOG : constant := 16#0B60#; -- gl.h:380 GL_FOG_MODE : constant := 16#0B65#; -- gl.h:381 GL_FOG_DENSITY : constant := 16#0B62#; -- gl.h:382 GL_FOG_COLOR : constant := 16#0B66#; -- gl.h:383 GL_FOG_INDEX : constant := 16#0B61#; -- gl.h:384 GL_FOG_START : constant := 16#0B63#; -- gl.h:385 GL_FOG_END : constant := 16#0B64#; -- gl.h:386 GL_LINEAR : constant := 16#2601#; -- gl.h:387 GL_EXP : constant := 16#0800#; -- gl.h:388 GL_EXP2 : constant := 16#0801#; -- gl.h:389 GL_LOGIC_OP : constant := 16#0BF1#; -- gl.h:392 GL_INDEX_LOGIC_OP : constant := 16#0BF1#; -- gl.h:393 GL_COLOR_LOGIC_OP : constant := 16#0BF2#; -- gl.h:394 GL_LOGIC_OP_MODE : constant := 16#0BF0#; -- gl.h:395 GL_CLEAR : constant := 16#1500#; -- gl.h:396 GL_SET : constant := 16#150F#; -- gl.h:397 GL_COPY : constant := 16#1503#; -- gl.h:398 GL_COPY_INVERTED : constant := 16#150C#; -- gl.h:399 GL_NOOP : constant := 16#1505#; -- gl.h:400 GL_INVERT : constant := 16#150A#; -- gl.h:401 GL_AND : constant := 16#1501#; -- gl.h:402 GL_NAND : constant := 16#150E#; -- gl.h:403 GL_OR : constant := 16#1507#; -- gl.h:404 GL_NOR : constant := 16#1508#; -- gl.h:405 GL_XOR : constant := 16#1506#; -- gl.h:406 GL_EQUIV : constant := 16#1509#; -- gl.h:407 GL_AND_REVERSE : constant := 16#1502#; -- gl.h:408 GL_AND_INVERTED : constant := 16#1504#; -- gl.h:409 GL_OR_REVERSE : constant := 16#150B#; -- gl.h:410 GL_OR_INVERTED : constant := 16#150D#; -- gl.h:411 GL_STENCIL_BITS : constant := 16#0D57#; -- gl.h:414 GL_STENCIL_TEST : constant := 16#0B90#; -- gl.h:415 GL_STENCIL_CLEAR_VALUE : constant := 16#0B91#; -- gl.h:416 GL_STENCIL_FUNC : constant := 16#0B92#; -- gl.h:417 GL_STENCIL_VALUE_MASK : constant := 16#0B93#; -- gl.h:418 GL_STENCIL_FAIL : constant := 16#0B94#; -- gl.h:419 GL_STENCIL_PASS_DEPTH_FAIL : constant := 16#0B95#; -- gl.h:420 GL_STENCIL_PASS_DEPTH_PASS : constant := 16#0B96#; -- gl.h:421 GL_STENCIL_REF : constant := 16#0B97#; -- gl.h:422 GL_STENCIL_WRITEMASK : constant := 16#0B98#; -- gl.h:423 GL_STENCIL_INDEX : constant := 16#1901#; -- gl.h:424 GL_KEEP : constant := 16#1E00#; -- gl.h:425 GL_REPLACE : constant := 16#1E01#; -- gl.h:426 GL_INCR : constant := 16#1E02#; -- gl.h:427 GL_DECR : constant := 16#1E03#; -- gl.h:428 GL_NONE : constant := 0; -- gl.h:431 GL_LEFT : constant := 16#0406#; -- gl.h:432 GL_RIGHT : constant := 16#0407#; -- gl.h:433 GL_FRONT_LEFT : constant := 16#0400#; -- gl.h:437 GL_FRONT_RIGHT : constant := 16#0401#; -- gl.h:438 GL_BACK_LEFT : constant := 16#0402#; -- gl.h:439 GL_BACK_RIGHT : constant := 16#0403#; -- gl.h:440 GL_AUX0 : constant := 16#0409#; -- gl.h:441 GL_AUX1 : constant := 16#040A#; -- gl.h:442 GL_AUX2 : constant := 16#040B#; -- gl.h:443 GL_AUX3 : constant := 16#040C#; -- gl.h:444 GL_COLOR_INDEX : constant := 16#1900#; -- gl.h:445 GL_RED : constant := 16#1903#; -- gl.h:446 GL_GREEN : constant := 16#1904#; -- gl.h:447 GL_BLUE : constant := 16#1905#; -- gl.h:448 GL_ALPHA : constant := 16#1906#; -- gl.h:449 GL_LUMINANCE : constant := 16#1909#; -- gl.h:450 GL_LUMINANCE_ALPHA : constant := 16#190A#; -- gl.h:451 GL_ALPHA_BITS : constant := 16#0D55#; -- gl.h:452 GL_RED_BITS : constant := 16#0D52#; -- gl.h:453 GL_GREEN_BITS : constant := 16#0D53#; -- gl.h:454 GL_BLUE_BITS : constant := 16#0D54#; -- gl.h:455 GL_INDEX_BITS : constant := 16#0D51#; -- gl.h:456 GL_SUBPIXEL_BITS : constant := 16#0D50#; -- gl.h:457 GL_AUX_BUFFERS : constant := 16#0C00#; -- gl.h:458 GL_READ_BUFFER : constant := 16#0C02#; -- gl.h:459 GL_DRAW_BUFFER : constant := 16#0C01#; -- gl.h:460 GL_DOUBLEBUFFER : constant := 16#0C32#; -- gl.h:461 GL_STEREO : constant := 16#0C33#; -- gl.h:462 GL_BITMAP : constant := 16#1A00#; -- gl.h:463 GL_COLOR : constant := 16#1800#; -- gl.h:464 GL_DEPTH : constant := 16#1801#; -- gl.h:465 GL_STENCIL : constant := 16#1802#; -- gl.h:466 GL_DITHER : constant := 16#0BD0#; -- gl.h:467 GL_RGB : constant := 16#1907#; -- gl.h:468 GL_RGBA : constant := 16#1908#; -- gl.h:469 GL_MAX_LIST_NESTING : constant := 16#0B31#; -- gl.h:472 GL_MAX_EVAL_ORDER : constant := 16#0D30#; -- gl.h:473 GL_MAX_LIGHTS : constant := 16#0D31#; -- gl.h:474 GL_MAX_CLIP_PLANES : constant := 16#0D32#; -- gl.h:475 GL_MAX_TEXTURE_SIZE : constant := 16#0D33#; -- gl.h:476 GL_MAX_PIXEL_MAP_TABLE : constant := 16#0D34#; -- gl.h:477 GL_MAX_ATTRIB_STACK_DEPTH : constant := 16#0D35#; -- gl.h:478 GL_MAX_MODELVIEW_STACK_DEPTH : constant := 16#0D36#; -- gl.h:479 GL_MAX_NAME_STACK_DEPTH : constant := 16#0D37#; -- gl.h:480 GL_MAX_PROJECTION_STACK_DEPTH : constant := 16#0D38#; -- gl.h:481 GL_MAX_TEXTURE_STACK_DEPTH : constant := 16#0D39#; -- gl.h:482 GL_MAX_VIEWPORT_DIMS : constant := 16#0D3A#; -- gl.h:483 GL_MAX_CLIENT_ATTRIB_STACK_DEPTH : constant := 16#0D3B#; -- gl.h:484 GL_ATTRIB_STACK_DEPTH : constant := 16#0BB0#; -- gl.h:487 GL_CLIENT_ATTRIB_STACK_DEPTH : constant := 16#0BB1#; -- gl.h:488 GL_COLOR_CLEAR_VALUE : constant := 16#0C22#; -- gl.h:489 GL_COLOR_WRITEMASK : constant := 16#0C23#; -- gl.h:490 GL_CURRENT_INDEX : constant := 16#0B01#; -- gl.h:491 GL_CURRENT_COLOR : constant := 16#0B00#; -- gl.h:492 GL_CURRENT_NORMAL : constant := 16#0B02#; -- gl.h:493 GL_CURRENT_RASTER_COLOR : constant := 16#0B04#; -- gl.h:494 GL_CURRENT_RASTER_DISTANCE : constant := 16#0B09#; -- gl.h:495 GL_CURRENT_RASTER_INDEX : constant := 16#0B05#; -- gl.h:496 GL_CURRENT_RASTER_POSITION : constant := 16#0B07#; -- gl.h:497 GL_CURRENT_RASTER_TEXTURE_COORDS : constant := 16#0B06#; -- gl.h:498 GL_CURRENT_RASTER_POSITION_VALID : constant := 16#0B08#; -- gl.h:499 GL_CURRENT_TEXTURE_COORDS : constant := 16#0B03#; -- gl.h:500 GL_INDEX_CLEAR_VALUE : constant := 16#0C20#; -- gl.h:501 GL_INDEX_MODE : constant := 16#0C30#; -- gl.h:502 GL_INDEX_WRITEMASK : constant := 16#0C21#; -- gl.h:503 GL_MODELVIEW_MATRIX : constant := 16#0BA6#; -- gl.h:504 GL_MODELVIEW_STACK_DEPTH : constant := 16#0BA3#; -- gl.h:505 GL_NAME_STACK_DEPTH : constant := 16#0D70#; -- gl.h:506 GL_PROJECTION_MATRIX : constant := 16#0BA7#; -- gl.h:507 GL_PROJECTION_STACK_DEPTH : constant := 16#0BA4#; -- gl.h:508 GL_RENDER_MODE : constant := 16#0C40#; -- gl.h:509 GL_RGBA_MODE : constant := 16#0C31#; -- gl.h:510 GL_TEXTURE_MATRIX : constant := 16#0BA8#; -- gl.h:511 GL_TEXTURE_STACK_DEPTH : constant := 16#0BA5#; -- gl.h:512 GL_VIEWPORT : constant := 16#0BA2#; -- gl.h:513 GL_AUTO_NORMAL : constant := 16#0D80#; -- gl.h:516 GL_MAP1_COLOR_4 : constant := 16#0D90#; -- gl.h:517 GL_MAP1_INDEX : constant := 16#0D91#; -- gl.h:518 GL_MAP1_NORMAL : constant := 16#0D92#; -- gl.h:519 GL_MAP1_TEXTURE_COORD_1 : constant := 16#0D93#; -- gl.h:520 GL_MAP1_TEXTURE_COORD_2 : constant := 16#0D94#; -- gl.h:521 GL_MAP1_TEXTURE_COORD_3 : constant := 16#0D95#; -- gl.h:522 GL_MAP1_TEXTURE_COORD_4 : constant := 16#0D96#; -- gl.h:523 GL_MAP1_VERTEX_3 : constant := 16#0D97#; -- gl.h:524 GL_MAP1_VERTEX_4 : constant := 16#0D98#; -- gl.h:525 GL_MAP2_COLOR_4 : constant := 16#0DB0#; -- gl.h:526 GL_MAP2_INDEX : constant := 16#0DB1#; -- gl.h:527 GL_MAP2_NORMAL : constant := 16#0DB2#; -- gl.h:528 GL_MAP2_TEXTURE_COORD_1 : constant := 16#0DB3#; -- gl.h:529 GL_MAP2_TEXTURE_COORD_2 : constant := 16#0DB4#; -- gl.h:530 GL_MAP2_TEXTURE_COORD_3 : constant := 16#0DB5#; -- gl.h:531 GL_MAP2_TEXTURE_COORD_4 : constant := 16#0DB6#; -- gl.h:532 GL_MAP2_VERTEX_3 : constant := 16#0DB7#; -- gl.h:533 GL_MAP2_VERTEX_4 : constant := 16#0DB8#; -- gl.h:534 GL_MAP1_GRID_DOMAIN : constant := 16#0DD0#; -- gl.h:535 GL_MAP1_GRID_SEGMENTS : constant := 16#0DD1#; -- gl.h:536 GL_MAP2_GRID_DOMAIN : constant := 16#0DD2#; -- gl.h:537 GL_MAP2_GRID_SEGMENTS : constant := 16#0DD3#; -- gl.h:538 GL_COEFF : constant := 16#0A00#; -- gl.h:539 GL_ORDER : constant := 16#0A01#; -- gl.h:540 GL_DOMAIN : constant := 16#0A02#; -- gl.h:541 GL_PERSPECTIVE_CORRECTION_HINT : constant := 16#0C50#; -- gl.h:544 GL_POINT_SMOOTH_HINT : constant := 16#0C51#; -- gl.h:545 GL_LINE_SMOOTH_HINT : constant := 16#0C52#; -- gl.h:546 GL_POLYGON_SMOOTH_HINT : constant := 16#0C53#; -- gl.h:547 GL_FOG_HINT : constant := 16#0C54#; -- gl.h:548 GL_DONT_CARE : constant := 16#1100#; -- gl.h:549 GL_FASTEST : constant := 16#1101#; -- gl.h:550 GL_NICEST : constant := 16#1102#; -- gl.h:551 GL_SCISSOR_BOX : constant := 16#0C10#; -- gl.h:554 GL_SCISSOR_TEST : constant := 16#0C11#; -- gl.h:555 GL_MAP_COLOR : constant := 16#0D10#; -- gl.h:558 GL_MAP_STENCIL : constant := 16#0D11#; -- gl.h:559 GL_INDEX_SHIFT : constant := 16#0D12#; -- gl.h:560 GL_INDEX_OFFSET : constant := 16#0D13#; -- gl.h:561 GL_RED_SCALE : constant := 16#0D14#; -- gl.h:562 GL_RED_BIAS : constant := 16#0D15#; -- gl.h:563 GL_GREEN_SCALE : constant := 16#0D18#; -- gl.h:564 GL_GREEN_BIAS : constant := 16#0D19#; -- gl.h:565 GL_BLUE_SCALE : constant := 16#0D1A#; -- gl.h:566 GL_BLUE_BIAS : constant := 16#0D1B#; -- gl.h:567 GL_ALPHA_SCALE : constant := 16#0D1C#; -- gl.h:568 GL_ALPHA_BIAS : constant := 16#0D1D#; -- gl.h:569 GL_DEPTH_SCALE : constant := 16#0D1E#; -- gl.h:570 GL_DEPTH_BIAS : constant := 16#0D1F#; -- gl.h:571 GL_PIXEL_MAP_S_TO_S_SIZE : constant := 16#0CB1#; -- gl.h:572 GL_PIXEL_MAP_I_TO_I_SIZE : constant := 16#0CB0#; -- gl.h:573 GL_PIXEL_MAP_I_TO_R_SIZE : constant := 16#0CB2#; -- gl.h:574 GL_PIXEL_MAP_I_TO_G_SIZE : constant := 16#0CB3#; -- gl.h:575 GL_PIXEL_MAP_I_TO_B_SIZE : constant := 16#0CB4#; -- gl.h:576 GL_PIXEL_MAP_I_TO_A_SIZE : constant := 16#0CB5#; -- gl.h:577 GL_PIXEL_MAP_R_TO_R_SIZE : constant := 16#0CB6#; -- gl.h:578 GL_PIXEL_MAP_G_TO_G_SIZE : constant := 16#0CB7#; -- gl.h:579 GL_PIXEL_MAP_B_TO_B_SIZE : constant := 16#0CB8#; -- gl.h:580 GL_PIXEL_MAP_A_TO_A_SIZE : constant := 16#0CB9#; -- gl.h:581 GL_PIXEL_MAP_S_TO_S : constant := 16#0C71#; -- gl.h:582 GL_PIXEL_MAP_I_TO_I : constant := 16#0C70#; -- gl.h:583 GL_PIXEL_MAP_I_TO_R : constant := 16#0C72#; -- gl.h:584 GL_PIXEL_MAP_I_TO_G : constant := 16#0C73#; -- gl.h:585 GL_PIXEL_MAP_I_TO_B : constant := 16#0C74#; -- gl.h:586 GL_PIXEL_MAP_I_TO_A : constant := 16#0C75#; -- gl.h:587 GL_PIXEL_MAP_R_TO_R : constant := 16#0C76#; -- gl.h:588 GL_PIXEL_MAP_G_TO_G : constant := 16#0C77#; -- gl.h:589 GL_PIXEL_MAP_B_TO_B : constant := 16#0C78#; -- gl.h:590 GL_PIXEL_MAP_A_TO_A : constant := 16#0C79#; -- gl.h:591 GL_PACK_ALIGNMENT : constant := 16#0D05#; -- gl.h:592 GL_PACK_LSB_FIRST : constant := 16#0D01#; -- gl.h:593 GL_PACK_ROW_LENGTH : constant := 16#0D02#; -- gl.h:594 GL_PACK_SKIP_PIXELS : constant := 16#0D04#; -- gl.h:595 GL_PACK_SKIP_ROWS : constant := 16#0D03#; -- gl.h:596 GL_PACK_SWAP_BYTES : constant := 16#0D00#; -- gl.h:597 GL_UNPACK_ALIGNMENT : constant := 16#0CF5#; -- gl.h:598 GL_UNPACK_LSB_FIRST : constant := 16#0CF1#; -- gl.h:599 GL_UNPACK_ROW_LENGTH : constant := 16#0CF2#; -- gl.h:600 GL_UNPACK_SKIP_PIXELS : constant := 16#0CF4#; -- gl.h:601 GL_UNPACK_SKIP_ROWS : constant := 16#0CF3#; -- gl.h:602 GL_UNPACK_SWAP_BYTES : constant := 16#0CF0#; -- gl.h:603 GL_ZOOM_X : constant := 16#0D16#; -- gl.h:604 GL_ZOOM_Y : constant := 16#0D17#; -- gl.h:605 GL_TEXTURE_ENV : constant := 16#2300#; -- gl.h:608 GL_TEXTURE_ENV_MODE : constant := 16#2200#; -- gl.h:609 GL_TEXTURE_1D : constant := 16#0DE0#; -- gl.h:610 GL_TEXTURE_2D : constant := 16#0DE1#; -- gl.h:611 GL_TEXTURE_WRAP_S : constant := 16#2802#; -- gl.h:612 GL_TEXTURE_WRAP_T : constant := 16#2803#; -- gl.h:613 GL_TEXTURE_MAG_FILTER : constant := 16#2800#; -- gl.h:614 GL_TEXTURE_MIN_FILTER : constant := 16#2801#; -- gl.h:615 GL_TEXTURE_ENV_COLOR : constant := 16#2201#; -- gl.h:616 GL_TEXTURE_GEN_S : constant := 16#0C60#; -- gl.h:617 GL_TEXTURE_GEN_T : constant := 16#0C61#; -- gl.h:618 GL_TEXTURE_GEN_R : constant := 16#0C62#; -- gl.h:619 GL_TEXTURE_GEN_Q : constant := 16#0C63#; -- gl.h:620 GL_TEXTURE_GEN_MODE : constant := 16#2500#; -- gl.h:621 GL_TEXTURE_BORDER_COLOR : constant := 16#1004#; -- gl.h:622 GL_TEXTURE_WIDTH : constant := 16#1000#; -- gl.h:623 GL_TEXTURE_HEIGHT : constant := 16#1001#; -- gl.h:624 GL_TEXTURE_BORDER : constant := 16#1005#; -- gl.h:625 GL_TEXTURE_COMPONENTS : constant := 16#1003#; -- gl.h:626 GL_TEXTURE_RED_SIZE : constant := 16#805C#; -- gl.h:627 GL_TEXTURE_GREEN_SIZE : constant := 16#805D#; -- gl.h:628 GL_TEXTURE_BLUE_SIZE : constant := 16#805E#; -- gl.h:629 GL_TEXTURE_ALPHA_SIZE : constant := 16#805F#; -- gl.h:630 GL_TEXTURE_LUMINANCE_SIZE : constant := 16#8060#; -- gl.h:631 GL_TEXTURE_INTENSITY_SIZE : constant := 16#8061#; -- gl.h:632 GL_NEAREST_MIPMAP_NEAREST : constant := 16#2700#; -- gl.h:633 GL_NEAREST_MIPMAP_LINEAR : constant := 16#2702#; -- gl.h:634 GL_LINEAR_MIPMAP_NEAREST : constant := 16#2701#; -- gl.h:635 GL_LINEAR_MIPMAP_LINEAR : constant := 16#2703#; -- gl.h:636 GL_OBJECT_LINEAR : constant := 16#2401#; -- gl.h:637 GL_OBJECT_PLANE : constant := 16#2501#; -- gl.h:638 GL_EYE_LINEAR : constant := 16#2400#; -- gl.h:639 GL_EYE_PLANE : constant := 16#2502#; -- gl.h:640 GL_SPHERE_MAP : constant := 16#2402#; -- gl.h:641 GL_DECAL : constant := 16#2101#; -- gl.h:642 GL_MODULATE : constant := 16#2100#; -- gl.h:643 GL_NEAREST : constant := 16#2600#; -- gl.h:644 GL_REPEAT : constant := 16#2901#; -- gl.h:645 GL_CLAMP : constant := 16#2900#; -- gl.h:646 GL_S : constant := 16#2000#; -- gl.h:647 GL_T : constant := 16#2001#; -- gl.h:648 GL_R : constant := 16#2002#; -- gl.h:649 GL_Q : constant := 16#2003#; -- gl.h:650 GL_VENDOR : constant := 16#1F00#; -- gl.h:653 GL_RENDERER : constant := 16#1F01#; -- gl.h:654 GL_VERSION : constant := 16#1F02#; -- gl.h:655 GL_EXTENSIONS : constant := 16#1F03#; -- gl.h:656 GL_NO_ERROR : constant := 0; -- gl.h:659 GL_INVALID_ENUM : constant := 16#0500#; -- gl.h:660 GL_INVALID_VALUE : constant := 16#0501#; -- gl.h:661 GL_INVALID_OPERATION : constant := 16#0502#; -- gl.h:662 GL_STACK_OVERFLOW : constant := 16#0503#; -- gl.h:663 GL_STACK_UNDERFLOW : constant := 16#0504#; -- gl.h:664 GL_OUT_OF_MEMORY : constant := 16#0505#; -- gl.h:665 GL_CURRENT_BIT : constant := 16#00000001#; -- gl.h:668 GL_POINT_BIT : constant := 16#00000002#; -- gl.h:669 GL_LINE_BIT : constant := 16#00000004#; -- gl.h:670 GL_POLYGON_BIT : constant := 16#00000008#; -- gl.h:671 GL_POLYGON_STIPPLE_BIT : constant := 16#00000010#; -- gl.h:672 GL_PIXEL_MODE_BIT : constant := 16#00000020#; -- gl.h:673 GL_LIGHTING_BIT : constant := 16#00000040#; -- gl.h:674 GL_FOG_BIT : constant := 16#00000080#; -- gl.h:675 GL_DEPTH_BUFFER_BIT : constant := 16#00000100#; -- gl.h:676 GL_ACCUM_BUFFER_BIT : constant := 16#00000200#; -- gl.h:677 GL_STENCIL_BUFFER_BIT : constant := 16#00000400#; -- gl.h:678 GL_VIEWPORT_BIT : constant := 16#00000800#; -- gl.h:679 GL_TRANSFORM_BIT : constant := 16#00001000#; -- gl.h:680 GL_ENABLE_BIT : constant := 16#00002000#; -- gl.h:681 GL_COLOR_BUFFER_BIT : constant := 16#00004000#; -- gl.h:682 GL_HINT_BIT : constant := 16#00008000#; -- gl.h:683 GL_EVAL_BIT : constant := 16#00010000#; -- gl.h:684 GL_LIST_BIT : constant := 16#00020000#; -- gl.h:685 GL_TEXTURE_BIT : constant := 16#00040000#; -- gl.h:686 GL_SCISSOR_BIT : constant := 16#00080000#; -- gl.h:687 GL_ALL_ATTRIB_BITS : constant := 16#FFFFFFFF#; -- gl.h:688 GL_PROXY_TEXTURE_1D : constant := 16#8063#; -- gl.h:692 GL_PROXY_TEXTURE_2D : constant := 16#8064#; -- gl.h:693 GL_TEXTURE_PRIORITY : constant := 16#8066#; -- gl.h:694 GL_TEXTURE_RESIDENT : constant := 16#8067#; -- gl.h:695 GL_TEXTURE_BINDING_1D : constant := 16#8068#; -- gl.h:696 GL_TEXTURE_BINDING_2D : constant := 16#8069#; -- gl.h:697 GL_TEXTURE_INTERNAL_FORMAT : constant := 16#1003#; -- gl.h:698 GL_ALPHA4 : constant := 16#803B#; -- gl.h:699 GL_ALPHA8 : constant := 16#803C#; -- gl.h:700 GL_ALPHA12 : constant := 16#803D#; -- gl.h:701 GL_ALPHA16 : constant := 16#803E#; -- gl.h:702 GL_LUMINANCE4 : constant := 16#803F#; -- gl.h:703 GL_LUMINANCE8 : constant := 16#8040#; -- gl.h:704 GL_LUMINANCE12 : constant := 16#8041#; -- gl.h:705 GL_LUMINANCE16 : constant := 16#8042#; -- gl.h:706 GL_LUMINANCE4_ALPHA4 : constant := 16#8043#; -- gl.h:707 GL_LUMINANCE6_ALPHA2 : constant := 16#8044#; -- gl.h:708 GL_LUMINANCE8_ALPHA8 : constant := 16#8045#; -- gl.h:709 GL_LUMINANCE12_ALPHA4 : constant := 16#8046#; -- gl.h:710 GL_LUMINANCE12_ALPHA12 : constant := 16#8047#; -- gl.h:711 GL_LUMINANCE16_ALPHA16 : constant := 16#8048#; -- gl.h:712 GL_INTENSITY : constant := 16#8049#; -- gl.h:713 GL_INTENSITY4 : constant := 16#804A#; -- gl.h:714 GL_INTENSITY8 : constant := 16#804B#; -- gl.h:715 GL_INTENSITY12 : constant := 16#804C#; -- gl.h:716 GL_INTENSITY16 : constant := 16#804D#; -- gl.h:717 GL_R3_G3_B2 : constant := 16#2A10#; -- gl.h:718 GL_RGB4 : constant := 16#804F#; -- gl.h:719 GL_RGB5 : constant := 16#8050#; -- gl.h:720 GL_RGB8 : constant := 16#8051#; -- gl.h:721 GL_RGB10 : constant := 16#8052#; -- gl.h:722 GL_RGB12 : constant := 16#8053#; -- gl.h:723 GL_RGB16 : constant := 16#8054#; -- gl.h:724 GL_RGBA2 : constant := 16#8055#; -- gl.h:725 GL_RGBA4 : constant := 16#8056#; -- gl.h:726 GL_RGB5_A1 : constant := 16#8057#; -- gl.h:727 GL_RGBA8 : constant := 16#8058#; -- gl.h:728 GL_RGB10_A2 : constant := 16#8059#; -- gl.h:729 GL_RGBA12 : constant := 16#805A#; -- gl.h:730 GL_RGBA16 : constant := 16#805B#; -- gl.h:731 GL_CLIENT_PIXEL_STORE_BIT : constant := 16#00000001#; -- gl.h:732 GL_CLIENT_VERTEX_ARRAY_BIT : constant := 16#00000002#; -- gl.h:733 GL_ALL_CLIENT_ATTRIB_BITS : constant := 16#FFFFFFFF#; -- gl.h:734 GL_CLIENT_ALL_ATTRIB_BITS : constant := 16#FFFFFFFF#; -- gl.h:735 GL_RESCALE_NORMAL : constant := 16#803A#; -- gl.h:1446 GL_CLAMP_TO_EDGE : constant := 16#812F#; -- gl.h:1447 GL_MAX_ELEMENTS_VERTICES : constant := 16#80E8#; -- gl.h:1448 GL_MAX_ELEMENTS_INDICES : constant := 16#80E9#; -- gl.h:1449 GL_BGR : constant := 16#80E0#; -- gl.h:1450 GL_BGRA : constant := 16#80E1#; -- gl.h:1451 GL_UNSIGNED_BYTE_3_3_2 : constant := 16#8032#; -- gl.h:1452 GL_UNSIGNED_BYTE_2_3_3_REV : constant := 16#8362#; -- gl.h:1453 GL_UNSIGNED_SHORT_5_6_5 : constant := 16#8363#; -- gl.h:1454 GL_UNSIGNED_SHORT_5_6_5_REV : constant := 16#8364#; -- gl.h:1455 GL_UNSIGNED_SHORT_4_4_4_4 : constant := 16#8033#; -- gl.h:1456 GL_UNSIGNED_SHORT_4_4_4_4_REV : constant := 16#8365#; -- gl.h:1457 GL_UNSIGNED_SHORT_5_5_5_1 : constant := 16#8034#; -- gl.h:1458 GL_UNSIGNED_SHORT_1_5_5_5_REV : constant := 16#8366#; -- gl.h:1459 GL_UNSIGNED_INT_8_8_8_8 : constant := 16#8035#; -- gl.h:1460 GL_UNSIGNED_INT_8_8_8_8_REV : constant := 16#8367#; -- gl.h:1461 GL_UNSIGNED_INT_10_10_10_2 : constant := 16#8036#; -- gl.h:1462 GL_UNSIGNED_INT_2_10_10_10_REV : constant := 16#8368#; -- gl.h:1463 GL_LIGHT_MODEL_COLOR_CONTROL : constant := 16#81F8#; -- gl.h:1464 GL_SINGLE_COLOR : constant := 16#81F9#; -- gl.h:1465 GL_SEPARATE_SPECULAR_COLOR : constant := 16#81FA#; -- gl.h:1466 GL_TEXTURE_MIN_LOD : constant := 16#813A#; -- gl.h:1467 GL_TEXTURE_MAX_LOD : constant := 16#813B#; -- gl.h:1468 GL_TEXTURE_BASE_LEVEL : constant := 16#813C#; -- gl.h:1469 GL_TEXTURE_MAX_LEVEL : constant := 16#813D#; -- gl.h:1470 GL_SMOOTH_POINT_SIZE_RANGE : constant := 16#0B12#; -- gl.h:1471 GL_SMOOTH_POINT_SIZE_GRANULARITY : constant := 16#0B13#; -- gl.h:1472 GL_SMOOTH_LINE_WIDTH_RANGE : constant := 16#0B22#; -- gl.h:1473 GL_SMOOTH_LINE_WIDTH_GRANULARITY : constant := 16#0B23#; -- gl.h:1474 GL_ALIASED_POINT_SIZE_RANGE : constant := 16#846D#; -- gl.h:1475 GL_ALIASED_LINE_WIDTH_RANGE : constant := 16#846E#; -- gl.h:1476 GL_PACK_SKIP_IMAGES : constant := 16#806B#; -- gl.h:1477 GL_PACK_IMAGE_HEIGHT : constant := 16#806C#; -- gl.h:1478 GL_UNPACK_SKIP_IMAGES : constant := 16#806D#; -- gl.h:1479 GL_UNPACK_IMAGE_HEIGHT : constant := 16#806E#; -- gl.h:1480 GL_TEXTURE_3D : constant := 16#806F#; -- gl.h:1481 GL_PROXY_TEXTURE_3D : constant := 16#8070#; -- gl.h:1482 GL_TEXTURE_DEPTH : constant := 16#8071#; -- gl.h:1483 GL_TEXTURE_WRAP_R : constant := 16#8072#; -- gl.h:1484 GL_MAX_3D_TEXTURE_SIZE : constant := 16#8073#; -- gl.h:1485 GL_TEXTURE_BINDING_3D : constant := 16#806A#; -- gl.h:1486 GL_COLOR_TABLE : constant := 16#80D0#; -- gl.h:1525 GL_POST_CONVOLUTION_COLOR_TABLE : constant := 16#80D1#; -- gl.h:1526 GL_POST_COLOR_MATRIX_COLOR_TABLE : constant := 16#80D2#; -- gl.h:1527 GL_PROXY_COLOR_TABLE : constant := 16#80D3#; -- gl.h:1528 GL_PROXY_POST_CONVOLUTION_COLOR_TABLE : constant := 16#80D4#; -- gl.h:1529 GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE : constant := 16#80D5#; -- gl.h:1530 GL_COLOR_TABLE_SCALE : constant := 16#80D6#; -- gl.h:1531 GL_COLOR_TABLE_BIAS : constant := 16#80D7#; -- gl.h:1532 GL_COLOR_TABLE_FORMAT : constant := 16#80D8#; -- gl.h:1533 GL_COLOR_TABLE_WIDTH : constant := 16#80D9#; -- gl.h:1534 GL_COLOR_TABLE_RED_SIZE : constant := 16#80DA#; -- gl.h:1535 GL_COLOR_TABLE_GREEN_SIZE : constant := 16#80DB#; -- gl.h:1536 GL_COLOR_TABLE_BLUE_SIZE : constant := 16#80DC#; -- gl.h:1537 GL_COLOR_TABLE_ALPHA_SIZE : constant := 16#80DD#; -- gl.h:1538 GL_COLOR_TABLE_LUMINANCE_SIZE : constant := 16#80DE#; -- gl.h:1539 GL_COLOR_TABLE_INTENSITY_SIZE : constant := 16#80DF#; -- gl.h:1540 GL_CONVOLUTION_1D : constant := 16#8010#; -- gl.h:1541 GL_CONVOLUTION_2D : constant := 16#8011#; -- gl.h:1542 GL_SEPARABLE_2D : constant := 16#8012#; -- gl.h:1543 GL_CONVOLUTION_BORDER_MODE : constant := 16#8013#; -- gl.h:1544 GL_CONVOLUTION_FILTER_SCALE : constant := 16#8014#; -- gl.h:1545 GL_CONVOLUTION_FILTER_BIAS : constant := 16#8015#; -- gl.h:1546 GL_REDUCE : constant := 16#8016#; -- gl.h:1547 GL_CONVOLUTION_FORMAT : constant := 16#8017#; -- gl.h:1548 GL_CONVOLUTION_WIDTH : constant := 16#8018#; -- gl.h:1549 GL_CONVOLUTION_HEIGHT : constant := 16#8019#; -- gl.h:1550 GL_MAX_CONVOLUTION_WIDTH : constant := 16#801A#; -- gl.h:1551 GL_MAX_CONVOLUTION_HEIGHT : constant := 16#801B#; -- gl.h:1552 GL_POST_CONVOLUTION_RED_SCALE : constant := 16#801C#; -- gl.h:1553 GL_POST_CONVOLUTION_GREEN_SCALE : constant := 16#801D#; -- gl.h:1554 GL_POST_CONVOLUTION_BLUE_SCALE : constant := 16#801E#; -- gl.h:1555 GL_POST_CONVOLUTION_ALPHA_SCALE : constant := 16#801F#; -- gl.h:1556 GL_POST_CONVOLUTION_RED_BIAS : constant := 16#8020#; -- gl.h:1557 GL_POST_CONVOLUTION_GREEN_BIAS : constant := 16#8021#; -- gl.h:1558 GL_POST_CONVOLUTION_BLUE_BIAS : constant := 16#8022#; -- gl.h:1559 GL_POST_CONVOLUTION_ALPHA_BIAS : constant := 16#8023#; -- gl.h:1560 GL_CONSTANT_BORDER : constant := 16#8151#; -- gl.h:1561 GL_REPLICATE_BORDER : constant := 16#8153#; -- gl.h:1562 GL_CONVOLUTION_BORDER_COLOR : constant := 16#8154#; -- gl.h:1563 GL_COLOR_MATRIX : constant := 16#80B1#; -- gl.h:1564 GL_COLOR_MATRIX_STACK_DEPTH : constant := 16#80B2#; -- gl.h:1565 GL_MAX_COLOR_MATRIX_STACK_DEPTH : constant := 16#80B3#; -- gl.h:1566 GL_POST_COLOR_MATRIX_RED_SCALE : constant := 16#80B4#; -- gl.h:1567 GL_POST_COLOR_MATRIX_GREEN_SCALE : constant := 16#80B5#; -- gl.h:1568 GL_POST_COLOR_MATRIX_BLUE_SCALE : constant := 16#80B6#; -- gl.h:1569 GL_POST_COLOR_MATRIX_ALPHA_SCALE : constant := 16#80B7#; -- gl.h:1570 GL_POST_COLOR_MATRIX_RED_BIAS : constant := 16#80B8#; -- gl.h:1571 GL_POST_COLOR_MATRIX_GREEN_BIAS : constant := 16#80B9#; -- gl.h:1572 GL_POST_COLOR_MATRIX_BLUE_BIAS : constant := 16#80BA#; -- gl.h:1573 GL_POST_COLOR_MATRIX_ALPHA_BIAS : constant := 16#80BB#; -- gl.h:1574 GL_HISTOGRAM : constant := 16#8024#; -- gl.h:1575 GL_PROXY_HISTOGRAM : constant := 16#8025#; -- gl.h:1576 GL_HISTOGRAM_WIDTH : constant := 16#8026#; -- gl.h:1577 GL_HISTOGRAM_FORMAT : constant := 16#8027#; -- gl.h:1578 GL_HISTOGRAM_RED_SIZE : constant := 16#8028#; -- gl.h:1579 GL_HISTOGRAM_GREEN_SIZE : constant := 16#8029#; -- gl.h:1580 GL_HISTOGRAM_BLUE_SIZE : constant := 16#802A#; -- gl.h:1581 GL_HISTOGRAM_ALPHA_SIZE : constant := 16#802B#; -- gl.h:1582 GL_HISTOGRAM_LUMINANCE_SIZE : constant := 16#802C#; -- gl.h:1583 GL_HISTOGRAM_SINK : constant := 16#802D#; -- gl.h:1584 GL_MINMAX : constant := 16#802E#; -- gl.h:1585 GL_MINMAX_FORMAT : constant := 16#802F#; -- gl.h:1586 GL_MINMAX_SINK : constant := 16#8030#; -- gl.h:1587 GL_TABLE_TOO_LARGE : constant := 16#8031#; -- gl.h:1588 GL_TEXTURE0 : constant := 16#84C0#; -- gl.h:1714 GL_TEXTURE1 : constant := 16#84C1#; -- gl.h:1715 GL_TEXTURE2 : constant := 16#84C2#; -- gl.h:1716 GL_TEXTURE3 : constant := 16#84C3#; -- gl.h:1717 GL_TEXTURE4 : constant := 16#84C4#; -- gl.h:1718 GL_TEXTURE5 : constant := 16#84C5#; -- gl.h:1719 GL_TEXTURE6 : constant := 16#84C6#; -- gl.h:1720 GL_TEXTURE7 : constant := 16#84C7#; -- gl.h:1721 GL_TEXTURE8 : constant := 16#84C8#; -- gl.h:1722 GL_TEXTURE9 : constant := 16#84C9#; -- gl.h:1723 GL_TEXTURE10 : constant := 16#84CA#; -- gl.h:1724 GL_TEXTURE11 : constant := 16#84CB#; -- gl.h:1725 GL_TEXTURE12 : constant := 16#84CC#; -- gl.h:1726 GL_TEXTURE13 : constant := 16#84CD#; -- gl.h:1727 GL_TEXTURE14 : constant := 16#84CE#; -- gl.h:1728 GL_TEXTURE15 : constant := 16#84CF#; -- gl.h:1729 GL_TEXTURE16 : constant := 16#84D0#; -- gl.h:1730 GL_TEXTURE17 : constant := 16#84D1#; -- gl.h:1731 GL_TEXTURE18 : constant := 16#84D2#; -- gl.h:1732 GL_TEXTURE19 : constant := 16#84D3#; -- gl.h:1733 GL_TEXTURE20 : constant := 16#84D4#; -- gl.h:1734 GL_TEXTURE21 : constant := 16#84D5#; -- gl.h:1735 GL_TEXTURE22 : constant := 16#84D6#; -- gl.h:1736 GL_TEXTURE23 : constant := 16#84D7#; -- gl.h:1737 GL_TEXTURE24 : constant := 16#84D8#; -- gl.h:1738 GL_TEXTURE25 : constant := 16#84D9#; -- gl.h:1739 GL_TEXTURE26 : constant := 16#84DA#; -- gl.h:1740 GL_TEXTURE27 : constant := 16#84DB#; -- gl.h:1741 GL_TEXTURE28 : constant := 16#84DC#; -- gl.h:1742 GL_TEXTURE29 : constant := 16#84DD#; -- gl.h:1743 GL_TEXTURE30 : constant := 16#84DE#; -- gl.h:1744 GL_TEXTURE31 : constant := 16#84DF#; -- gl.h:1745 GL_ACTIVE_TEXTURE : constant := 16#84E0#; -- gl.h:1746 GL_CLIENT_ACTIVE_TEXTURE : constant := 16#84E1#; -- gl.h:1747 GL_MAX_TEXTURE_UNITS : constant := 16#84E2#; -- gl.h:1748 GL_NORMAL_MAP : constant := 16#8511#; -- gl.h:1750 GL_REFLECTION_MAP : constant := 16#8512#; -- gl.h:1751 GL_TEXTURE_CUBE_MAP : constant := 16#8513#; -- gl.h:1752 GL_TEXTURE_BINDING_CUBE_MAP : constant := 16#8514#; -- gl.h:1753 GL_TEXTURE_CUBE_MAP_POSITIVE_X : constant := 16#8515#; -- gl.h:1754 GL_TEXTURE_CUBE_MAP_NEGATIVE_X : constant := 16#8516#; -- gl.h:1755 GL_TEXTURE_CUBE_MAP_POSITIVE_Y : constant := 16#8517#; -- gl.h:1756 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y : constant := 16#8518#; -- gl.h:1757 GL_TEXTURE_CUBE_MAP_POSITIVE_Z : constant := 16#8519#; -- gl.h:1758 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z : constant := 16#851A#; -- gl.h:1759 GL_PROXY_TEXTURE_CUBE_MAP : constant := 16#851B#; -- gl.h:1760 GL_MAX_CUBE_MAP_TEXTURE_SIZE : constant := 16#851C#; -- gl.h:1761 GL_COMPRESSED_ALPHA : constant := 16#84E9#; -- gl.h:1763 GL_COMPRESSED_LUMINANCE : constant := 16#84EA#; -- gl.h:1764 GL_COMPRESSED_LUMINANCE_ALPHA : constant := 16#84EB#; -- gl.h:1765 GL_COMPRESSED_INTENSITY : constant := 16#84EC#; -- gl.h:1766 GL_COMPRESSED_RGB : constant := 16#84ED#; -- gl.h:1767 GL_COMPRESSED_RGBA : constant := 16#84EE#; -- gl.h:1768 GL_TEXTURE_COMPRESSION_HINT : constant := 16#84EF#; -- gl.h:1769 GL_TEXTURE_COMPRESSED_IMAGE_SIZE : constant := 16#86A0#; -- gl.h:1770 GL_TEXTURE_COMPRESSED : constant := 16#86A1#; -- gl.h:1771 GL_NUM_COMPRESSED_TEXTURE_FORMATS : constant := 16#86A2#; -- gl.h:1772 GL_COMPRESSED_TEXTURE_FORMATS : constant := 16#86A3#; -- gl.h:1773 GL_MULTISAMPLE : constant := 16#809D#; -- gl.h:1775 GL_SAMPLE_ALPHA_TO_COVERAGE : constant := 16#809E#; -- gl.h:1776 GL_SAMPLE_ALPHA_TO_ONE : constant := 16#809F#; -- gl.h:1777 GL_SAMPLE_COVERAGE : constant := 16#80A0#; -- gl.h:1778 GL_SAMPLE_BUFFERS : constant := 16#80A8#; -- gl.h:1779 GL_SAMPLES : constant := 16#80A9#; -- gl.h:1780 GL_SAMPLE_COVERAGE_VALUE : constant := 16#80AA#; -- gl.h:1781 GL_SAMPLE_COVERAGE_INVERT : constant := 16#80AB#; -- gl.h:1782 GL_MULTISAMPLE_BIT : constant := 16#20000000#; -- gl.h:1783 GL_TRANSPOSE_MODELVIEW_MATRIX : constant := 16#84E3#; -- gl.h:1785 GL_TRANSPOSE_PROJECTION_MATRIX : constant := 16#84E4#; -- gl.h:1786 GL_TRANSPOSE_TEXTURE_MATRIX : constant := 16#84E5#; -- gl.h:1787 GL_TRANSPOSE_COLOR_MATRIX : constant := 16#84E6#; -- gl.h:1788 GL_COMBINE : constant := 16#8570#; -- gl.h:1790 GL_COMBINE_RGB : constant := 16#8571#; -- gl.h:1791 GL_COMBINE_ALPHA : constant := 16#8572#; -- gl.h:1792 GL_SOURCE0_RGB : constant := 16#8580#; -- gl.h:1793 GL_SOURCE1_RGB : constant := 16#8581#; -- gl.h:1794 GL_SOURCE2_RGB : constant := 16#8582#; -- gl.h:1795 GL_SOURCE0_ALPHA : constant := 16#8588#; -- gl.h:1796 GL_SOURCE1_ALPHA : constant := 16#8589#; -- gl.h:1797 GL_SOURCE2_ALPHA : constant := 16#858A#; -- gl.h:1798 GL_OPERAND0_RGB : constant := 16#8590#; -- gl.h:1799 GL_OPERAND1_RGB : constant := 16#8591#; -- gl.h:1800 GL_OPERAND2_RGB : constant := 16#8592#; -- gl.h:1801 GL_OPERAND0_ALPHA : constant := 16#8598#; -- gl.h:1802 GL_OPERAND1_ALPHA : constant := 16#8599#; -- gl.h:1803 GL_OPERAND2_ALPHA : constant := 16#859A#; -- gl.h:1804 GL_RGB_SCALE : constant := 16#8573#; -- gl.h:1805 GL_ADD_SIGNED : constant := 16#8574#; -- gl.h:1806 GL_INTERPOLATE : constant := 16#8575#; -- gl.h:1807 GL_SUBTRACT : constant := 16#84E7#; -- gl.h:1808 GL_CONSTANT : constant := 16#8576#; -- gl.h:1809 GL_PRIMARY_COLOR : constant := 16#8577#; -- gl.h:1810 GL_PREVIOUS : constant := 16#8578#; -- gl.h:1811 GL_DOT3_RGB : constant := 16#86AE#; -- gl.h:1813 GL_DOT3_RGBA : constant := 16#86AF#; -- gl.h:1814 GL_CLAMP_TO_BORDER : constant := 16#812D#; -- gl.h:1816 GL_ARB_multitexture : constant := 1; -- gl.h:1928 GL_TEXTURE0_ARB : constant := 16#84C0#; -- gl.h:1930 GL_TEXTURE1_ARB : constant := 16#84C1#; -- gl.h:1931 GL_TEXTURE2_ARB : constant := 16#84C2#; -- gl.h:1932 GL_TEXTURE3_ARB : constant := 16#84C3#; -- gl.h:1933 GL_TEXTURE4_ARB : constant := 16#84C4#; -- gl.h:1934 GL_TEXTURE5_ARB : constant := 16#84C5#; -- gl.h:1935 GL_TEXTURE6_ARB : constant := 16#84C6#; -- gl.h:1936 GL_TEXTURE7_ARB : constant := 16#84C7#; -- gl.h:1937 GL_TEXTURE8_ARB : constant := 16#84C8#; -- gl.h:1938 GL_TEXTURE9_ARB : constant := 16#84C9#; -- gl.h:1939 GL_TEXTURE10_ARB : constant := 16#84CA#; -- gl.h:1940 GL_TEXTURE11_ARB : constant := 16#84CB#; -- gl.h:1941 GL_TEXTURE12_ARB : constant := 16#84CC#; -- gl.h:1942 GL_TEXTURE13_ARB : constant := 16#84CD#; -- gl.h:1943 GL_TEXTURE14_ARB : constant := 16#84CE#; -- gl.h:1944 GL_TEXTURE15_ARB : constant := 16#84CF#; -- gl.h:1945 GL_TEXTURE16_ARB : constant := 16#84D0#; -- gl.h:1946 GL_TEXTURE17_ARB : constant := 16#84D1#; -- gl.h:1947 GL_TEXTURE18_ARB : constant := 16#84D2#; -- gl.h:1948 GL_TEXTURE19_ARB : constant := 16#84D3#; -- gl.h:1949 GL_TEXTURE20_ARB : constant := 16#84D4#; -- gl.h:1950 GL_TEXTURE21_ARB : constant := 16#84D5#; -- gl.h:1951 GL_TEXTURE22_ARB : constant := 16#84D6#; -- gl.h:1952 GL_TEXTURE23_ARB : constant := 16#84D7#; -- gl.h:1953 GL_TEXTURE24_ARB : constant := 16#84D8#; -- gl.h:1954 GL_TEXTURE25_ARB : constant := 16#84D9#; -- gl.h:1955 GL_TEXTURE26_ARB : constant := 16#84DA#; -- gl.h:1956 GL_TEXTURE27_ARB : constant := 16#84DB#; -- gl.h:1957 GL_TEXTURE28_ARB : constant := 16#84DC#; -- gl.h:1958 GL_TEXTURE29_ARB : constant := 16#84DD#; -- gl.h:1959 GL_TEXTURE30_ARB : constant := 16#84DE#; -- gl.h:1960 GL_TEXTURE31_ARB : constant := 16#84DF#; -- gl.h:1961 GL_ACTIVE_TEXTURE_ARB : constant := 16#84E0#; -- gl.h:1962 GL_CLIENT_ACTIVE_TEXTURE_ARB : constant := 16#84E1#; -- gl.h:1963 GL_MAX_TEXTURE_UNITS_ARB : constant := 16#84E2#; -- gl.h:1964 GL_MESA_packed_depth_stencil : constant := 1; -- gl.h:2061 GL_DEPTH_STENCIL_MESA : constant := 16#8750#; -- gl.h:2063 GL_UNSIGNED_INT_24_8_MESA : constant := 16#8751#; -- gl.h:2064 GL_UNSIGNED_INT_8_24_REV_MESA : constant := 16#8752#; -- gl.h:2065 GL_UNSIGNED_SHORT_15_1_MESA : constant := 16#8753#; -- gl.h:2066 GL_UNSIGNED_SHORT_1_15_REV_MESA : constant := 16#8754#; -- gl.h:2067 GL_ATI_blend_equation_separate : constant := 1; -- gl.h:2073 GL_ALPHA_BLEND_EQUATION_ATI : constant := 16#883D#; -- gl.h:2075 GL_OES_EGL_image : constant := 1; -- gl.h:2089 -- * Mesa 3-D graphics library -- * -- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. -- * Copyright (C) 2009 VMware, Inc. All Rights Reserved. -- * -- * 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. -- --********************************************************************* -- * Begin system-specific stuff. -- -- * WINDOWS: Include windows.h here to define APIENTRY. -- * It is also useful when applications include this file by -- * including only glut.h, since glut.h depends on windows.h. -- * Applications needing to include windows.h with parms other -- * than "WIN32_LEAN_AND_MEAN" may include windows.h before -- * glut.h or gl.h. -- -- "P" suffix to be used for a pointer to a function -- * End system-specific stuff. -- ********************************************************************* -- * Datatypes -- subtype GLenum is unsigned; -- gl.h:116 subtype GLboolean is unsigned_char; -- gl.h:117 subtype GLbitfield is unsigned; -- gl.h:118 subtype GLvoid is System.Address; -- gl.h:119 -- 1-byte signed subtype GLbyte is signed_char; -- gl.h:120 -- 2-byte signed subtype GLshort is short; -- gl.h:121 -- 4-byte signed subtype GLint is int; -- gl.h:122 -- 1-byte unsigned subtype GLubyte is unsigned_char; -- gl.h:123 -- 2-byte unsigned subtype GLushort is unsigned_short; -- gl.h:124 -- 4-byte unsigned subtype GLuint is unsigned; -- gl.h:125 -- 4-byte signed subtype GLsizei is int; -- gl.h:126 -- single precision float subtype GLfloat is float; -- gl.h:127 -- single precision float in [0,1] subtype GLclampf is float; -- gl.h:128 -- double precision float subtype GLdouble is double; -- gl.h:129 -- double precision float in [0,1] subtype GLclampd is double; -- gl.h:130 -- * Constants -- -- Boolean values -- Data types -- Primitives -- Vertex Arrays -- Matrix Mode -- Points -- Lines -- Polygons -- Display Lists -- Depth buffer -- Lighting -- User clipping planes -- Accumulation buffer -- Alpha testing -- Blending -- Render Mode -- Feedback -- Selection -- Fog -- Logic Ops -- Stencil -- Buffers, Pixel Drawing/Reading --GL_FRONT 0x0404 --GL_BACK 0x0405 --GL_FRONT_AND_BACK 0x0408 -- Implementation limits -- Gets -- Evaluators -- Hints -- Scissor box -- Pixel Mode / Transfer -- Texture mapping -- Utility -- Errors -- glPush/PopAttrib bits -- OpenGL 1.1 -- * Miscellaneous -- procedure glClearIndex (c : GLfloat) -- gl.h:743 with Import => True, Convention => C, External_Name => "glClearIndex"; procedure glClearColor (red : GLclampf; green : GLclampf; blue : GLclampf; alpha : GLclampf) -- gl.h:745 with Import => True, Convention => C, External_Name => "glClearColor"; procedure glClear (mask : GLbitfield) -- gl.h:747 with Import => True, Convention => C, External_Name => "glClear"; procedure glIndexMask (mask : GLuint) -- gl.h:749 with Import => True, Convention => C, External_Name => "glIndexMask"; procedure glColorMask (red : GLboolean; green : GLboolean; blue : GLboolean; alpha : GLboolean) -- gl.h:751 with Import => True, Convention => C, External_Name => "glColorMask"; procedure glAlphaFunc (func : GLenum; ref : GLclampf) -- gl.h:753 with Import => True, Convention => C, External_Name => "glAlphaFunc"; procedure glBlendFunc (sfactor : GLenum; dfactor : GLenum) -- gl.h:755 with Import => True, Convention => C, External_Name => "glBlendFunc"; procedure glLogicOp (opcode : GLenum) -- gl.h:757 with Import => True, Convention => C, External_Name => "glLogicOp"; procedure glCullFace (mode : GLenum) -- gl.h:759 with Import => True, Convention => C, External_Name => "glCullFace"; procedure glFrontFace (mode : GLenum) -- gl.h:761 with Import => True, Convention => C, External_Name => "glFrontFace"; procedure glPointSize (size : GLfloat) -- gl.h:763 with Import => True, Convention => C, External_Name => "glPointSize"; procedure glLineWidth (width : GLfloat) -- gl.h:765 with Import => True, Convention => C, External_Name => "glLineWidth"; procedure glLineStipple (factor : GLint; pattern : GLushort) -- gl.h:767 with Import => True, Convention => C, External_Name => "glLineStipple"; procedure glPolygonMode (face : GLenum; mode : GLenum) -- gl.h:769 with Import => True, Convention => C, External_Name => "glPolygonMode"; procedure glPolygonOffset (factor : GLfloat; units : GLfloat) -- gl.h:771 with Import => True, Convention => C, External_Name => "glPolygonOffset"; procedure glPolygonStipple (mask : access GLubyte) -- gl.h:773 with Import => True, Convention => C, External_Name => "glPolygonStipple"; procedure glGetPolygonStipple (mask : access GLubyte) -- gl.h:775 with Import => True, Convention => C, External_Name => "glGetPolygonStipple"; procedure glEdgeFlag (flag : GLboolean) -- gl.h:777 with Import => True, Convention => C, External_Name => "glEdgeFlag"; procedure glEdgeFlagv (flag : access GLboolean) -- gl.h:779 with Import => True, Convention => C, External_Name => "glEdgeFlagv"; procedure glScissor (x : GLint; y : GLint; width : GLsizei; height : GLsizei) -- gl.h:781 with Import => True, Convention => C, External_Name => "glScissor"; procedure glClipPlane (plane : GLenum; equation : access GLdouble) -- gl.h:783 with Import => True, Convention => C, External_Name => "glClipPlane"; procedure glGetClipPlane (plane : GLenum; equation : access GLdouble) -- gl.h:785 with Import => True, Convention => C, External_Name => "glGetClipPlane"; procedure glDrawBuffer (mode : GLenum) -- gl.h:787 with Import => True, Convention => C, External_Name => "glDrawBuffer"; procedure glReadBuffer (mode : GLenum) -- gl.h:789 with Import => True, Convention => C, External_Name => "glReadBuffer"; procedure glEnable (cap : GLenum) -- gl.h:791 with Import => True, Convention => C, External_Name => "glEnable"; procedure glDisable (cap : GLenum) -- gl.h:793 with Import => True, Convention => C, External_Name => "glDisable"; function glIsEnabled (cap : GLenum) return GLboolean -- gl.h:795 with Import => True, Convention => C, External_Name => "glIsEnabled"; -- 1.1 procedure glEnableClientState (cap : GLenum) -- gl.h:798 with Import => True, Convention => C, External_Name => "glEnableClientState"; -- 1.1 procedure glDisableClientState (cap : GLenum) -- gl.h:800 with Import => True, Convention => C, External_Name => "glDisableClientState"; procedure glGetBooleanv (pname : GLenum; params : access GLboolean) -- gl.h:803 with Import => True, Convention => C, External_Name => "glGetBooleanv"; procedure glGetDoublev (pname : GLenum; params : access GLdouble) -- gl.h:805 with Import => True, Convention => C, External_Name => "glGetDoublev"; procedure glGetFloatv (pname : GLenum; params : access GLfloat) -- gl.h:807 with Import => True, Convention => C, External_Name => "glGetFloatv"; procedure glGetIntegerv (pname : GLenum; params : access GLint) -- gl.h:809 with Import => True, Convention => C, External_Name => "glGetIntegerv"; procedure glPushAttrib (mask : GLbitfield) -- gl.h:812 with Import => True, Convention => C, External_Name => "glPushAttrib"; procedure glPopAttrib -- gl.h:814 with Import => True, Convention => C, External_Name => "glPopAttrib"; -- 1.1 procedure glPushClientAttrib (mask : GLbitfield) -- gl.h:817 with Import => True, Convention => C, External_Name => "glPushClientAttrib"; -- 1.1 procedure glPopClientAttrib -- gl.h:819 with Import => True, Convention => C, External_Name => "glPopClientAttrib"; function glRenderMode (mode : GLenum) return GLint -- gl.h:822 with Import => True, Convention => C, External_Name => "glRenderMode"; function glGetError return GLenum -- gl.h:824 with Import => True, Convention => C, External_Name => "glGetError"; -- Troodon: changed return type from access GLubyte function glGetString (name : GLenum) return Interfaces.C.Strings.chars_ptr -- gl.h:826 with Import => True, Convention => C, External_Name => "glGetString"; procedure glFinish -- gl.h:828 with Import => True, Convention => C, External_Name => "glFinish"; procedure glFlush -- gl.h:830 with Import => True, Convention => C, External_Name => "glFlush"; procedure glHint (target : GLenum; mode : GLenum) -- gl.h:832 with Import => True, Convention => C, External_Name => "glHint"; -- * Depth Buffer -- procedure glClearDepth (depth : GLclampd) -- gl.h:839 with Import => True, Convention => C, External_Name => "glClearDepth"; procedure glDepthFunc (func : GLenum) -- gl.h:841 with Import => True, Convention => C, External_Name => "glDepthFunc"; procedure glDepthMask (flag : GLboolean) -- gl.h:843 with Import => True, Convention => C, External_Name => "glDepthMask"; procedure glDepthRange (near_val : GLclampd; far_val : GLclampd) -- gl.h:845 with Import => True, Convention => C, External_Name => "glDepthRange"; -- * Accumulation Buffer -- procedure glClearAccum (red : GLfloat; green : GLfloat; blue : GLfloat; alpha : GLfloat) -- gl.h:852 with Import => True, Convention => C, External_Name => "glClearAccum"; procedure glAccum (op : GLenum; value : GLfloat) -- gl.h:854 with Import => True, Convention => C, External_Name => "glAccum"; -- * Transformation -- procedure glMatrixMode (mode : GLenum) -- gl.h:861 with Import => True, Convention => C, External_Name => "glMatrixMode"; procedure glOrtho (left : GLdouble; right : GLdouble; bottom : GLdouble; top : GLdouble; near_val : GLdouble; far_val : GLdouble) -- gl.h:863 with Import => True, Convention => C, External_Name => "glOrtho"; procedure glFrustum (left : GLdouble; right : GLdouble; bottom : GLdouble; top : GLdouble; near_val : GLdouble; far_val : GLdouble) -- gl.h:867 with Import => True, Convention => C, External_Name => "glFrustum"; procedure glViewport (x : GLint; y : GLint; width : GLsizei; height : GLsizei) -- gl.h:871 with Import => True, Convention => C, External_Name => "glViewport"; procedure glPushMatrix -- gl.h:874 with Import => True, Convention => C, External_Name => "glPushMatrix"; procedure glPopMatrix -- gl.h:876 with Import => True, Convention => C, External_Name => "glPopMatrix"; procedure glLoadIdentity -- gl.h:878 with Import => True, Convention => C, External_Name => "glLoadIdentity"; procedure glLoadMatrixd (m : access GLdouble) -- gl.h:880 with Import => True, Convention => C, External_Name => "glLoadMatrixd"; procedure glLoadMatrixf (m : access GLfloat) -- gl.h:881 with Import => True, Convention => C, External_Name => "glLoadMatrixf"; procedure glMultMatrixd (m : access GLdouble) -- gl.h:883 with Import => True, Convention => C, External_Name => "glMultMatrixd"; procedure glMultMatrixf (m : access GLfloat) -- gl.h:884 with Import => True, Convention => C, External_Name => "glMultMatrixf"; procedure glRotated (angle : GLdouble; x : GLdouble; y : GLdouble; z : GLdouble) -- gl.h:886 with Import => True, Convention => C, External_Name => "glRotated"; procedure glRotatef (angle : GLfloat; x : GLfloat; y : GLfloat; z : GLfloat) -- gl.h:888 with Import => True, Convention => C, External_Name => "glRotatef"; procedure glScaled (x : GLdouble; y : GLdouble; z : GLdouble) -- gl.h:891 with Import => True, Convention => C, External_Name => "glScaled"; procedure glScalef (x : GLfloat; y : GLfloat; z : GLfloat) -- gl.h:892 with Import => True, Convention => C, External_Name => "glScalef"; procedure glTranslated (x : GLdouble; y : GLdouble; z : GLdouble) -- gl.h:894 with Import => True, Convention => C, External_Name => "glTranslated"; procedure glTranslatef (x : GLfloat; y : GLfloat; z : GLfloat) -- gl.h:895 with Import => True, Convention => C, External_Name => "glTranslatef"; -- * Display Lists -- function glIsList (list : GLuint) return GLboolean -- gl.h:902 with Import => True, Convention => C, External_Name => "glIsList"; procedure glDeleteLists (list : GLuint; c_range : GLsizei) -- gl.h:904 with Import => True, Convention => C, External_Name => "glDeleteLists"; function glGenLists (c_range : GLsizei) return GLuint -- gl.h:906 with Import => True, Convention => C, External_Name => "glGenLists"; procedure glNewList (list : GLuint; mode : GLenum) -- gl.h:908 with Import => True, Convention => C, External_Name => "glNewList"; procedure glEndList -- gl.h:910 with Import => True, Convention => C, External_Name => "glEndList"; procedure glCallList (list : GLuint) -- gl.h:912 with Import => True, Convention => C, External_Name => "glCallList"; procedure glCallLists (n : GLsizei; c_type : GLenum; lists : System.Address) -- gl.h:914 with Import => True, Convention => C, External_Name => "glCallLists"; procedure glListBase (base : GLuint) -- gl.h:917 with Import => True, Convention => C, External_Name => "glListBase"; -- * Drawing Functions -- procedure glBegin (mode : GLenum) -- gl.h:924 with Import => True, Convention => C, External_Name => "glBegin"; procedure glEnd -- gl.h:926 with Import => True, Convention => C, External_Name => "glEnd"; procedure glVertex2d (x : GLdouble; y : GLdouble) -- gl.h:929 with Import => True, Convention => C, External_Name => "glVertex2d"; procedure glVertex2f (x : GLfloat; y : GLfloat) -- gl.h:930 with Import => True, Convention => C, External_Name => "glVertex2f"; procedure glVertex2i (x : GLint; y : GLint) -- gl.h:931 with Import => True, Convention => C, External_Name => "glVertex2i"; procedure glVertex2s (x : GLshort; y : GLshort) -- gl.h:932 with Import => True, Convention => C, External_Name => "glVertex2s"; procedure glVertex3d (x : GLdouble; y : GLdouble; z : GLdouble) -- gl.h:934 with Import => True, Convention => C, External_Name => "glVertex3d"; procedure glVertex3f (x : GLfloat; y : GLfloat; z : GLfloat) -- gl.h:935 with Import => True, Convention => C, External_Name => "glVertex3f"; procedure glVertex3i (x : GLint; y : GLint; z : GLint) -- gl.h:936 with Import => True, Convention => C, External_Name => "glVertex3i"; procedure glVertex3s (x : GLshort; y : GLshort; z : GLshort) -- gl.h:937 with Import => True, Convention => C, External_Name => "glVertex3s"; procedure glVertex4d (x : GLdouble; y : GLdouble; z : GLdouble; w : GLdouble) -- gl.h:939 with Import => True, Convention => C, External_Name => "glVertex4d"; procedure glVertex4f (x : GLfloat; y : GLfloat; z : GLfloat; w : GLfloat) -- gl.h:940 with Import => True, Convention => C, External_Name => "glVertex4f"; procedure glVertex4i (x : GLint; y : GLint; z : GLint; w : GLint) -- gl.h:941 with Import => True, Convention => C, External_Name => "glVertex4i"; procedure glVertex4s (x : GLshort; y : GLshort; z : GLshort; w : GLshort) -- gl.h:942 with Import => True, Convention => C, External_Name => "glVertex4s"; procedure glVertex2dv (v : access GLdouble) -- gl.h:944 with Import => True, Convention => C, External_Name => "glVertex2dv"; procedure glVertex2fv (v : access GLfloat) -- gl.h:945 with Import => True, Convention => C, External_Name => "glVertex2fv"; procedure glVertex2iv (v : access GLint) -- gl.h:946 with Import => True, Convention => C, External_Name => "glVertex2iv"; procedure glVertex2sv (v : access GLshort) -- gl.h:947 with Import => True, Convention => C, External_Name => "glVertex2sv"; procedure glVertex3dv (v : access GLdouble) -- gl.h:949 with Import => True, Convention => C, External_Name => "glVertex3dv"; procedure glVertex3fv (v : access GLfloat) -- gl.h:950 with Import => True, Convention => C, External_Name => "glVertex3fv"; procedure glVertex3iv (v : access GLint) -- gl.h:951 with Import => True, Convention => C, External_Name => "glVertex3iv"; procedure glVertex3sv (v : access GLshort) -- gl.h:952 with Import => True, Convention => C, External_Name => "glVertex3sv"; procedure glVertex4dv (v : access GLdouble) -- gl.h:954 with Import => True, Convention => C, External_Name => "glVertex4dv"; procedure glVertex4fv (v : access GLfloat) -- gl.h:955 with Import => True, Convention => C, External_Name => "glVertex4fv"; procedure glVertex4iv (v : access GLint) -- gl.h:956 with Import => True, Convention => C, External_Name => "glVertex4iv"; procedure glVertex4sv (v : access GLshort) -- gl.h:957 with Import => True, Convention => C, External_Name => "glVertex4sv"; procedure glNormal3b (nx : GLbyte; ny : GLbyte; nz : GLbyte) -- gl.h:960 with Import => True, Convention => C, External_Name => "glNormal3b"; procedure glNormal3d (nx : GLdouble; ny : GLdouble; nz : GLdouble) -- gl.h:961 with Import => True, Convention => C, External_Name => "glNormal3d"; procedure glNormal3f (nx : GLfloat; ny : GLfloat; nz : GLfloat) -- gl.h:962 with Import => True, Convention => C, External_Name => "glNormal3f"; procedure glNormal3i (nx : GLint; ny : GLint; nz : GLint) -- gl.h:963 with Import => True, Convention => C, External_Name => "glNormal3i"; procedure glNormal3s (nx : GLshort; ny : GLshort; nz : GLshort) -- gl.h:964 with Import => True, Convention => C, External_Name => "glNormal3s"; procedure glNormal3bv (v : access GLbyte) -- gl.h:966 with Import => True, Convention => C, External_Name => "glNormal3bv"; procedure glNormal3dv (v : access GLdouble) -- gl.h:967 with Import => True, Convention => C, External_Name => "glNormal3dv"; procedure glNormal3fv (v : access GLfloat) -- gl.h:968 with Import => True, Convention => C, External_Name => "glNormal3fv"; procedure glNormal3iv (v : access GLint) -- gl.h:969 with Import => True, Convention => C, External_Name => "glNormal3iv"; procedure glNormal3sv (v : access GLshort) -- gl.h:970 with Import => True, Convention => C, External_Name => "glNormal3sv"; procedure glIndexd (c : GLdouble) -- gl.h:973 with Import => True, Convention => C, External_Name => "glIndexd"; procedure glIndexf (c : GLfloat) -- gl.h:974 with Import => True, Convention => C, External_Name => "glIndexf"; procedure glIndexi (c : GLint) -- gl.h:975 with Import => True, Convention => C, External_Name => "glIndexi"; procedure glIndexs (c : GLshort) -- gl.h:976 with Import => True, Convention => C, External_Name => "glIndexs"; -- 1.1 procedure glIndexub (c : GLubyte) -- gl.h:977 with Import => True, Convention => C, External_Name => "glIndexub"; procedure glIndexdv (c : access GLdouble) -- gl.h:979 with Import => True, Convention => C, External_Name => "glIndexdv"; procedure glIndexfv (c : access GLfloat) -- gl.h:980 with Import => True, Convention => C, External_Name => "glIndexfv"; procedure glIndexiv (c : access GLint) -- gl.h:981 with Import => True, Convention => C, External_Name => "glIndexiv"; procedure glIndexsv (c : access GLshort) -- gl.h:982 with Import => True, Convention => C, External_Name => "glIndexsv"; -- 1.1 procedure glIndexubv (c : access GLubyte) -- gl.h:983 with Import => True, Convention => C, External_Name => "glIndexubv"; procedure glColor3b (red : GLbyte; green : GLbyte; blue : GLbyte) -- gl.h:985 with Import => True, Convention => C, External_Name => "glColor3b"; procedure glColor3d (red : GLdouble; green : GLdouble; blue : GLdouble) -- gl.h:986 with Import => True, Convention => C, External_Name => "glColor3d"; procedure glColor3f (red : GLfloat; green : GLfloat; blue : GLfloat) -- gl.h:987 with Import => True, Convention => C, External_Name => "glColor3f"; procedure glColor3i (red : GLint; green : GLint; blue : GLint) -- gl.h:988 with Import => True, Convention => C, External_Name => "glColor3i"; procedure glColor3s (red : GLshort; green : GLshort; blue : GLshort) -- gl.h:989 with Import => True, Convention => C, External_Name => "glColor3s"; procedure glColor3ub (red : GLubyte; green : GLubyte; blue : GLubyte) -- gl.h:990 with Import => True, Convention => C, External_Name => "glColor3ub"; procedure glColor3ui (red : GLuint; green : GLuint; blue : GLuint) -- gl.h:991 with Import => True, Convention => C, External_Name => "glColor3ui"; procedure glColor3us (red : GLushort; green : GLushort; blue : GLushort) -- gl.h:992 with Import => True, Convention => C, External_Name => "glColor3us"; procedure glColor4b (red : GLbyte; green : GLbyte; blue : GLbyte; alpha : GLbyte) -- gl.h:994 with Import => True, Convention => C, External_Name => "glColor4b"; procedure glColor4d (red : GLdouble; green : GLdouble; blue : GLdouble; alpha : GLdouble) -- gl.h:996 with Import => True, Convention => C, External_Name => "glColor4d"; procedure glColor4f (red : GLfloat; green : GLfloat; blue : GLfloat; alpha : GLfloat) -- gl.h:998 with Import => True, Convention => C, External_Name => "glColor4f"; procedure glColor4i (red : GLint; green : GLint; blue : GLint; alpha : GLint) -- gl.h:1000 with Import => True, Convention => C, External_Name => "glColor4i"; procedure glColor4s (red : GLshort; green : GLshort; blue : GLshort; alpha : GLshort) -- gl.h:1002 with Import => True, Convention => C, External_Name => "glColor4s"; procedure glColor4ub (red : GLubyte; green : GLubyte; blue : GLubyte; alpha : GLubyte) -- gl.h:1004 with Import => True, Convention => C, External_Name => "glColor4ub"; procedure glColor4ui (red : GLuint; green : GLuint; blue : GLuint; alpha : GLuint) -- gl.h:1006 with Import => True, Convention => C, External_Name => "glColor4ui"; procedure glColor4us (red : GLushort; green : GLushort; blue : GLushort; alpha : GLushort) -- gl.h:1008 with Import => True, Convention => C, External_Name => "glColor4us"; procedure glColor3bv (v : access GLbyte) -- gl.h:1012 with Import => True, Convention => C, External_Name => "glColor3bv"; procedure glColor3dv (v : access GLdouble) -- gl.h:1013 with Import => True, Convention => C, External_Name => "glColor3dv"; procedure glColor3fv (v : access GLfloat) -- gl.h:1014 with Import => True, Convention => C, External_Name => "glColor3fv"; procedure glColor3iv (v : access GLint) -- gl.h:1015 with Import => True, Convention => C, External_Name => "glColor3iv"; procedure glColor3sv (v : access GLshort) -- gl.h:1016 with Import => True, Convention => C, External_Name => "glColor3sv"; procedure glColor3ubv (v : access GLubyte) -- gl.h:1017 with Import => True, Convention => C, External_Name => "glColor3ubv"; procedure glColor3uiv (v : access GLuint) -- gl.h:1018 with Import => True, Convention => C, External_Name => "glColor3uiv"; procedure glColor3usv (v : access GLushort) -- gl.h:1019 with Import => True, Convention => C, External_Name => "glColor3usv"; procedure glColor4bv (v : access GLbyte) -- gl.h:1021 with Import => True, Convention => C, External_Name => "glColor4bv"; procedure glColor4dv (v : access GLdouble) -- gl.h:1022 with Import => True, Convention => C, External_Name => "glColor4dv"; procedure glColor4fv (v : access GLfloat) -- gl.h:1023 with Import => True, Convention => C, External_Name => "glColor4fv"; procedure glColor4iv (v : access GLint) -- gl.h:1024 with Import => True, Convention => C, External_Name => "glColor4iv"; procedure glColor4sv (v : access GLshort) -- gl.h:1025 with Import => True, Convention => C, External_Name => "glColor4sv"; procedure glColor4ubv (v : access GLubyte) -- gl.h:1026 with Import => True, Convention => C, External_Name => "glColor4ubv"; procedure glColor4uiv (v : access GLuint) -- gl.h:1027 with Import => True, Convention => C, External_Name => "glColor4uiv"; procedure glColor4usv (v : access GLushort) -- gl.h:1028 with Import => True, Convention => C, External_Name => "glColor4usv"; procedure glTexCoord1d (s : GLdouble) -- gl.h:1031 with Import => True, Convention => C, External_Name => "glTexCoord1d"; procedure glTexCoord1f (s : GLfloat) -- gl.h:1032 with Import => True, Convention => C, External_Name => "glTexCoord1f"; procedure glTexCoord1i (s : GLint) -- gl.h:1033 with Import => True, Convention => C, External_Name => "glTexCoord1i"; procedure glTexCoord1s (s : GLshort) -- gl.h:1034 with Import => True, Convention => C, External_Name => "glTexCoord1s"; procedure glTexCoord2d (s : GLdouble; t : GLdouble) -- gl.h:1036 with Import => True, Convention => C, External_Name => "glTexCoord2d"; procedure glTexCoord2f (s : GLfloat; t : GLfloat) -- gl.h:1037 with Import => True, Convention => C, External_Name => "glTexCoord2f"; procedure glTexCoord2i (s : GLint; t : GLint) -- gl.h:1038 with Import => True, Convention => C, External_Name => "glTexCoord2i"; procedure glTexCoord2s (s : GLshort; t : GLshort) -- gl.h:1039 with Import => True, Convention => C, External_Name => "glTexCoord2s"; procedure glTexCoord3d (s : GLdouble; t : GLdouble; r : GLdouble) -- gl.h:1041 with Import => True, Convention => C, External_Name => "glTexCoord3d"; procedure glTexCoord3f (s : GLfloat; t : GLfloat; r : GLfloat) -- gl.h:1042 with Import => True, Convention => C, External_Name => "glTexCoord3f"; procedure glTexCoord3i (s : GLint; t : GLint; r : GLint) -- gl.h:1043 with Import => True, Convention => C, External_Name => "glTexCoord3i"; procedure glTexCoord3s (s : GLshort; t : GLshort; r : GLshort) -- gl.h:1044 with Import => True, Convention => C, External_Name => "glTexCoord3s"; procedure glTexCoord4d (s : GLdouble; t : GLdouble; r : GLdouble; q : GLdouble) -- gl.h:1046 with Import => True, Convention => C, External_Name => "glTexCoord4d"; procedure glTexCoord4f (s : GLfloat; t : GLfloat; r : GLfloat; q : GLfloat) -- gl.h:1047 with Import => True, Convention => C, External_Name => "glTexCoord4f"; procedure glTexCoord4i (s : GLint; t : GLint; r : GLint; q : GLint) -- gl.h:1048 with Import => True, Convention => C, External_Name => "glTexCoord4i"; procedure glTexCoord4s (s : GLshort; t : GLshort; r : GLshort; q : GLshort) -- gl.h:1049 with Import => True, Convention => C, External_Name => "glTexCoord4s"; procedure glTexCoord1dv (v : access GLdouble) -- gl.h:1051 with Import => True, Convention => C, External_Name => "glTexCoord1dv"; procedure glTexCoord1fv (v : access GLfloat) -- gl.h:1052 with Import => True, Convention => C, External_Name => "glTexCoord1fv"; procedure glTexCoord1iv (v : access GLint) -- gl.h:1053 with Import => True, Convention => C, External_Name => "glTexCoord1iv"; procedure glTexCoord1sv (v : access GLshort) -- gl.h:1054 with Import => True, Convention => C, External_Name => "glTexCoord1sv"; procedure glTexCoord2dv (v : access GLdouble) -- gl.h:1056 with Import => True, Convention => C, External_Name => "glTexCoord2dv"; procedure glTexCoord2fv (v : access GLfloat) -- gl.h:1057 with Import => True, Convention => C, External_Name => "glTexCoord2fv"; procedure glTexCoord2iv (v : access GLint) -- gl.h:1058 with Import => True, Convention => C, External_Name => "glTexCoord2iv"; procedure glTexCoord2sv (v : access GLshort) -- gl.h:1059 with Import => True, Convention => C, External_Name => "glTexCoord2sv"; procedure glTexCoord3dv (v : access GLdouble) -- gl.h:1061 with Import => True, Convention => C, External_Name => "glTexCoord3dv"; procedure glTexCoord3fv (v : access GLfloat) -- gl.h:1062 with Import => True, Convention => C, External_Name => "glTexCoord3fv"; procedure glTexCoord3iv (v : access GLint) -- gl.h:1063 with Import => True, Convention => C, External_Name => "glTexCoord3iv"; procedure glTexCoord3sv (v : access GLshort) -- gl.h:1064 with Import => True, Convention => C, External_Name => "glTexCoord3sv"; procedure glTexCoord4dv (v : access GLdouble) -- gl.h:1066 with Import => True, Convention => C, External_Name => "glTexCoord4dv"; procedure glTexCoord4fv (v : access GLfloat) -- gl.h:1067 with Import => True, Convention => C, External_Name => "glTexCoord4fv"; procedure glTexCoord4iv (v : access GLint) -- gl.h:1068 with Import => True, Convention => C, External_Name => "glTexCoord4iv"; procedure glTexCoord4sv (v : access GLshort) -- gl.h:1069 with Import => True, Convention => C, External_Name => "glTexCoord4sv"; procedure glRasterPos2d (x : GLdouble; y : GLdouble) -- gl.h:1072 with Import => True, Convention => C, External_Name => "glRasterPos2d"; procedure glRasterPos2f (x : GLfloat; y : GLfloat) -- gl.h:1073 with Import => True, Convention => C, External_Name => "glRasterPos2f"; procedure glRasterPos2i (x : GLint; y : GLint) -- gl.h:1074 with Import => True, Convention => C, External_Name => "glRasterPos2i"; procedure glRasterPos2s (x : GLshort; y : GLshort) -- gl.h:1075 with Import => True, Convention => C, External_Name => "glRasterPos2s"; procedure glRasterPos3d (x : GLdouble; y : GLdouble; z : GLdouble) -- gl.h:1077 with Import => True, Convention => C, External_Name => "glRasterPos3d"; procedure glRasterPos3f (x : GLfloat; y : GLfloat; z : GLfloat) -- gl.h:1078 with Import => True, Convention => C, External_Name => "glRasterPos3f"; procedure glRasterPos3i (x : GLint; y : GLint; z : GLint) -- gl.h:1079 with Import => True, Convention => C, External_Name => "glRasterPos3i"; procedure glRasterPos3s (x : GLshort; y : GLshort; z : GLshort) -- gl.h:1080 with Import => True, Convention => C, External_Name => "glRasterPos3s"; procedure glRasterPos4d (x : GLdouble; y : GLdouble; z : GLdouble; w : GLdouble) -- gl.h:1082 with Import => True, Convention => C, External_Name => "glRasterPos4d"; procedure glRasterPos4f (x : GLfloat; y : GLfloat; z : GLfloat; w : GLfloat) -- gl.h:1083 with Import => True, Convention => C, External_Name => "glRasterPos4f"; procedure glRasterPos4i (x : GLint; y : GLint; z : GLint; w : GLint) -- gl.h:1084 with Import => True, Convention => C, External_Name => "glRasterPos4i"; procedure glRasterPos4s (x : GLshort; y : GLshort; z : GLshort; w : GLshort) -- gl.h:1085 with Import => True, Convention => C, External_Name => "glRasterPos4s"; procedure glRasterPos2dv (v : access GLdouble) -- gl.h:1087 with Import => True, Convention => C, External_Name => "glRasterPos2dv"; procedure glRasterPos2fv (v : access GLfloat) -- gl.h:1088 with Import => True, Convention => C, External_Name => "glRasterPos2fv"; procedure glRasterPos2iv (v : access GLint) -- gl.h:1089 with Import => True, Convention => C, External_Name => "glRasterPos2iv"; procedure glRasterPos2sv (v : access GLshort) -- gl.h:1090 with Import => True, Convention => C, External_Name => "glRasterPos2sv"; procedure glRasterPos3dv (v : access GLdouble) -- gl.h:1092 with Import => True, Convention => C, External_Name => "glRasterPos3dv"; procedure glRasterPos3fv (v : access GLfloat) -- gl.h:1093 with Import => True, Convention => C, External_Name => "glRasterPos3fv"; procedure glRasterPos3iv (v : access GLint) -- gl.h:1094 with Import => True, Convention => C, External_Name => "glRasterPos3iv"; procedure glRasterPos3sv (v : access GLshort) -- gl.h:1095 with Import => True, Convention => C, External_Name => "glRasterPos3sv"; procedure glRasterPos4dv (v : access GLdouble) -- gl.h:1097 with Import => True, Convention => C, External_Name => "glRasterPos4dv"; procedure glRasterPos4fv (v : access GLfloat) -- gl.h:1098 with Import => True, Convention => C, External_Name => "glRasterPos4fv"; procedure glRasterPos4iv (v : access GLint) -- gl.h:1099 with Import => True, Convention => C, External_Name => "glRasterPos4iv"; procedure glRasterPos4sv (v : access GLshort) -- gl.h:1100 with Import => True, Convention => C, External_Name => "glRasterPos4sv"; procedure glRectd (x1 : GLdouble; y1 : GLdouble; x2 : GLdouble; y2 : GLdouble) -- gl.h:1103 with Import => True, Convention => C, External_Name => "glRectd"; procedure glRectf (x1 : GLfloat; y1 : GLfloat; x2 : GLfloat; y2 : GLfloat) -- gl.h:1104 with Import => True, Convention => C, External_Name => "glRectf"; procedure glRecti (x1 : GLint; y1 : GLint; x2 : GLint; y2 : GLint) -- gl.h:1105 with Import => True, Convention => C, External_Name => "glRecti"; procedure glRects (x1 : GLshort; y1 : GLshort; x2 : GLshort; y2 : GLshort) -- gl.h:1106 with Import => True, Convention => C, External_Name => "glRects"; procedure glRectdv (v1 : access GLdouble; v2 : access GLdouble) -- gl.h:1109 with Import => True, Convention => C, External_Name => "glRectdv"; procedure glRectfv (v1 : access GLfloat; v2 : access GLfloat) -- gl.h:1110 with Import => True, Convention => C, External_Name => "glRectfv"; procedure glRectiv (v1 : access GLint; v2 : access GLint) -- gl.h:1111 with Import => True, Convention => C, External_Name => "glRectiv"; procedure glRectsv (v1 : access GLshort; v2 : access GLshort) -- gl.h:1112 with Import => True, Convention => C, External_Name => "glRectsv"; -- * Vertex Arrays (1.1) -- procedure glVertexPointer (size : GLint; c_type : GLenum; stride : GLsizei; ptr : System.Address) -- gl.h:1119 with Import => True, Convention => C, External_Name => "glVertexPointer"; procedure glNormalPointer (c_type : GLenum; stride : GLsizei; ptr : System.Address) -- gl.h:1122 with Import => True, Convention => C, External_Name => "glNormalPointer"; procedure glColorPointer (size : GLint; c_type : GLenum; stride : GLsizei; ptr : System.Address) -- gl.h:1125 with Import => True, Convention => C, External_Name => "glColorPointer"; procedure glIndexPointer (c_type : GLenum; stride : GLsizei; ptr : System.Address) -- gl.h:1128 with Import => True, Convention => C, External_Name => "glIndexPointer"; procedure glTexCoordPointer (size : GLint; c_type : GLenum; stride : GLsizei; ptr : System.Address) -- gl.h:1131 with Import => True, Convention => C, External_Name => "glTexCoordPointer"; procedure glEdgeFlagPointer (stride : GLsizei; ptr : System.Address) -- gl.h:1134 with Import => True, Convention => C, External_Name => "glEdgeFlagPointer"; procedure glGetPointerv (pname : GLenum; params : System.Address) -- gl.h:1136 with Import => True, Convention => C, External_Name => "glGetPointerv"; procedure glArrayElement (i : GLint) -- gl.h:1138 with Import => True, Convention => C, External_Name => "glArrayElement"; procedure glDrawArrays (mode : GLenum; first : GLint; count : GLsizei) -- gl.h:1140 with Import => True, Convention => C, External_Name => "glDrawArrays"; procedure glDrawElements (mode : GLenum; count : GLsizei; c_type : GLenum; indices : System.Address) -- gl.h:1142 with Import => True, Convention => C, External_Name => "glDrawElements"; procedure glInterleavedArrays (format : GLenum; stride : GLsizei; pointer : System.Address) -- gl.h:1145 with Import => True, Convention => C, External_Name => "glInterleavedArrays"; -- * Lighting -- procedure glShadeModel (mode : GLenum) -- gl.h:1152 with Import => True, Convention => C, External_Name => "glShadeModel"; procedure glLightf (light : GLenum; pname : GLenum; param : GLfloat) -- gl.h:1154 with Import => True, Convention => C, External_Name => "glLightf"; procedure glLighti (light : GLenum; pname : GLenum; param : GLint) -- gl.h:1155 with Import => True, Convention => C, External_Name => "glLighti"; procedure glLightfv (light : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1156 with Import => True, Convention => C, External_Name => "glLightfv"; procedure glLightiv (light : GLenum; pname : GLenum; params : access GLint) -- gl.h:1158 with Import => True, Convention => C, External_Name => "glLightiv"; procedure glGetLightfv (light : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1161 with Import => True, Convention => C, External_Name => "glGetLightfv"; procedure glGetLightiv (light : GLenum; pname : GLenum; params : access GLint) -- gl.h:1163 with Import => True, Convention => C, External_Name => "glGetLightiv"; procedure glLightModelf (pname : GLenum; param : GLfloat) -- gl.h:1166 with Import => True, Convention => C, External_Name => "glLightModelf"; procedure glLightModeli (pname : GLenum; param : GLint) -- gl.h:1167 with Import => True, Convention => C, External_Name => "glLightModeli"; procedure glLightModelfv (pname : GLenum; params : access GLfloat) -- gl.h:1168 with Import => True, Convention => C, External_Name => "glLightModelfv"; procedure glLightModeliv (pname : GLenum; params : access GLint) -- gl.h:1169 with Import => True, Convention => C, External_Name => "glLightModeliv"; procedure glMaterialf (face : GLenum; pname : GLenum; param : GLfloat) -- gl.h:1171 with Import => True, Convention => C, External_Name => "glMaterialf"; procedure glMateriali (face : GLenum; pname : GLenum; param : GLint) -- gl.h:1172 with Import => True, Convention => C, External_Name => "glMateriali"; procedure glMaterialfv (face : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1173 with Import => True, Convention => C, External_Name => "glMaterialfv"; procedure glMaterialiv (face : GLenum; pname : GLenum; params : access GLint) -- gl.h:1174 with Import => True, Convention => C, External_Name => "glMaterialiv"; procedure glGetMaterialfv (face : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1176 with Import => True, Convention => C, External_Name => "glGetMaterialfv"; procedure glGetMaterialiv (face : GLenum; pname : GLenum; params : access GLint) -- gl.h:1177 with Import => True, Convention => C, External_Name => "glGetMaterialiv"; procedure glColorMaterial (face : GLenum; mode : GLenum) -- gl.h:1179 with Import => True, Convention => C, External_Name => "glColorMaterial"; -- * Raster functions -- procedure glPixelZoom (xfactor : GLfloat; yfactor : GLfloat) -- gl.h:1186 with Import => True, Convention => C, External_Name => "glPixelZoom"; procedure glPixelStoref (pname : GLenum; param : GLfloat) -- gl.h:1188 with Import => True, Convention => C, External_Name => "glPixelStoref"; procedure glPixelStorei (pname : GLenum; param : GLint) -- gl.h:1189 with Import => True, Convention => C, External_Name => "glPixelStorei"; procedure glPixelTransferf (pname : GLenum; param : GLfloat) -- gl.h:1191 with Import => True, Convention => C, External_Name => "glPixelTransferf"; procedure glPixelTransferi (pname : GLenum; param : GLint) -- gl.h:1192 with Import => True, Convention => C, External_Name => "glPixelTransferi"; procedure glPixelMapfv (map : GLenum; mapsize : GLsizei; values : access GLfloat) -- gl.h:1194 with Import => True, Convention => C, External_Name => "glPixelMapfv"; procedure glPixelMapuiv (map : GLenum; mapsize : GLsizei; values : access GLuint) -- gl.h:1196 with Import => True, Convention => C, External_Name => "glPixelMapuiv"; procedure glPixelMapusv (map : GLenum; mapsize : GLsizei; values : access GLushort) -- gl.h:1198 with Import => True, Convention => C, External_Name => "glPixelMapusv"; procedure glGetPixelMapfv (map : GLenum; values : access GLfloat) -- gl.h:1201 with Import => True, Convention => C, External_Name => "glGetPixelMapfv"; procedure glGetPixelMapuiv (map : GLenum; values : access GLuint) -- gl.h:1202 with Import => True, Convention => C, External_Name => "glGetPixelMapuiv"; procedure glGetPixelMapusv (map : GLenum; values : access GLushort) -- gl.h:1203 with Import => True, Convention => C, External_Name => "glGetPixelMapusv"; procedure glBitmap (width : GLsizei; height : GLsizei; xorig : GLfloat; yorig : GLfloat; xmove : GLfloat; ymove : GLfloat; bitmap : access GLubyte) -- gl.h:1205 with Import => True, Convention => C, External_Name => "glBitmap"; procedure glReadPixels (x : GLint; y : GLint; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1210 with Import => True, Convention => C, External_Name => "glReadPixels"; procedure glDrawPixels (width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1215 with Import => True, Convention => C, External_Name => "glDrawPixels"; procedure glCopyPixels (x : GLint; y : GLint; width : GLsizei; height : GLsizei; c_type : GLenum) -- gl.h:1219 with Import => True, Convention => C, External_Name => "glCopyPixels"; -- * Stenciling -- procedure glStencilFunc (func : GLenum; ref : GLint; mask : GLuint) -- gl.h:1227 with Import => True, Convention => C, External_Name => "glStencilFunc"; procedure glStencilMask (mask : GLuint) -- gl.h:1229 with Import => True, Convention => C, External_Name => "glStencilMask"; procedure glStencilOp (fail : GLenum; zfail : GLenum; zpass : GLenum) -- gl.h:1231 with Import => True, Convention => C, External_Name => "glStencilOp"; procedure glClearStencil (s : GLint) -- gl.h:1233 with Import => True, Convention => C, External_Name => "glClearStencil"; -- * Texture mapping -- procedure glTexGend (coord : GLenum; pname : GLenum; param : GLdouble) -- gl.h:1241 with Import => True, Convention => C, External_Name => "glTexGend"; procedure glTexGenf (coord : GLenum; pname : GLenum; param : GLfloat) -- gl.h:1242 with Import => True, Convention => C, External_Name => "glTexGenf"; procedure glTexGeni (coord : GLenum; pname : GLenum; param : GLint) -- gl.h:1243 with Import => True, Convention => C, External_Name => "glTexGeni"; procedure glTexGendv (coord : GLenum; pname : GLenum; params : access GLdouble) -- gl.h:1245 with Import => True, Convention => C, External_Name => "glTexGendv"; procedure glTexGenfv (coord : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1246 with Import => True, Convention => C, External_Name => "glTexGenfv"; procedure glTexGeniv (coord : GLenum; pname : GLenum; params : access GLint) -- gl.h:1247 with Import => True, Convention => C, External_Name => "glTexGeniv"; procedure glGetTexGendv (coord : GLenum; pname : GLenum; params : access GLdouble) -- gl.h:1249 with Import => True, Convention => C, External_Name => "glGetTexGendv"; procedure glGetTexGenfv (coord : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1250 with Import => True, Convention => C, External_Name => "glGetTexGenfv"; procedure glGetTexGeniv (coord : GLenum; pname : GLenum; params : access GLint) -- gl.h:1251 with Import => True, Convention => C, External_Name => "glGetTexGeniv"; procedure glTexEnvf (target : GLenum; pname : GLenum; param : GLfloat) -- gl.h:1254 with Import => True, Convention => C, External_Name => "glTexEnvf"; procedure glTexEnvi (target : GLenum; pname : GLenum; param : GLint) -- gl.h:1255 with Import => True, Convention => C, External_Name => "glTexEnvi"; procedure glTexEnvfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1257 with Import => True, Convention => C, External_Name => "glTexEnvfv"; procedure glTexEnviv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1258 with Import => True, Convention => C, External_Name => "glTexEnviv"; procedure glGetTexEnvfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1260 with Import => True, Convention => C, External_Name => "glGetTexEnvfv"; procedure glGetTexEnviv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1261 with Import => True, Convention => C, External_Name => "glGetTexEnviv"; procedure glTexParameterf (target : GLenum; pname : GLenum; param : GLfloat) -- gl.h:1264 with Import => True, Convention => C, External_Name => "glTexParameterf"; procedure glTexParameteri (target : GLenum; pname : GLenum; param : GLint) -- gl.h:1265 with Import => True, Convention => C, External_Name => "glTexParameteri"; procedure glTexParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1267 with Import => True, Convention => C, External_Name => "glTexParameterfv"; procedure glTexParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1269 with Import => True, Convention => C, External_Name => "glTexParameteriv"; procedure glGetTexParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1272 with Import => True, Convention => C, External_Name => "glGetTexParameterfv"; procedure glGetTexParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1274 with Import => True, Convention => C, External_Name => "glGetTexParameteriv"; procedure glGetTexLevelParameterfv (target : GLenum; level : GLint; pname : GLenum; params : access GLfloat) -- gl.h:1277 with Import => True, Convention => C, External_Name => "glGetTexLevelParameterfv"; procedure glGetTexLevelParameteriv (target : GLenum; level : GLint; pname : GLenum; params : access GLint) -- gl.h:1279 with Import => True, Convention => C, External_Name => "glGetTexLevelParameteriv"; procedure glTexImage1D (target : GLenum; level : GLint; internalFormat : GLint; width : GLsizei; border : GLint; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1283 with Import => True, Convention => C, External_Name => "glTexImage1D"; procedure glTexImage2D (target : GLenum; level : GLint; internalFormat : GLint; width : GLsizei; height : GLsizei; border : GLint; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1289 with Import => True, Convention => C, External_Name => "glTexImage2D"; procedure glGetTexImage (target : GLenum; level : GLint; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1295 with Import => True, Convention => C, External_Name => "glGetTexImage"; -- 1.1 functions procedure glGenTextures (n : GLsizei; textures : access GLuint) -- gl.h:1302 with Import => True, Convention => C, External_Name => "glGenTextures"; procedure glDeleteTextures (n : GLsizei; textures : access GLuint) -- gl.h:1304 with Import => True, Convention => C, External_Name => "glDeleteTextures"; procedure glBindTexture (target : GLenum; texture : GLuint) -- gl.h:1306 with Import => True, Convention => C, External_Name => "glBindTexture"; procedure glPrioritizeTextures (n : GLsizei; textures : access GLuint; priorities : access GLclampf) -- gl.h:1308 with Import => True, Convention => C, External_Name => "glPrioritizeTextures"; function glAreTexturesResident (n : GLsizei; textures : access GLuint; residences : access GLboolean) return GLboolean -- gl.h:1312 with Import => True, Convention => C, External_Name => "glAreTexturesResident"; function glIsTexture (texture : GLuint) return GLboolean -- gl.h:1316 with Import => True, Convention => C, External_Name => "glIsTexture"; procedure glTexSubImage1D (target : GLenum; level : GLint; xoffset : GLint; width : GLsizei; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1319 with Import => True, Convention => C, External_Name => "glTexSubImage1D"; procedure glTexSubImage2D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1325 with Import => True, Convention => C, External_Name => "glTexSubImage2D"; procedure glCopyTexImage1D (target : GLenum; level : GLint; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei; border : GLint) -- gl.h:1332 with Import => True, Convention => C, External_Name => "glCopyTexImage1D"; procedure glCopyTexImage2D (target : GLenum; level : GLint; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei; height : GLsizei; border : GLint) -- gl.h:1338 with Import => True, Convention => C, External_Name => "glCopyTexImage2D"; procedure glCopyTexSubImage1D (target : GLenum; level : GLint; xoffset : GLint; x : GLint; y : GLint; width : GLsizei) -- gl.h:1345 with Import => True, Convention => C, External_Name => "glCopyTexSubImage1D"; procedure glCopyTexSubImage2D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; x : GLint; y : GLint; width : GLsizei; height : GLsizei) -- gl.h:1350 with Import => True, Convention => C, External_Name => "glCopyTexSubImage2D"; -- * Evaluators -- procedure glMap1d (target : GLenum; u1 : GLdouble; u2 : GLdouble; stride : GLint; order : GLint; points : access GLdouble) -- gl.h:1360 with Import => True, Convention => C, External_Name => "glMap1d"; procedure glMap1f (target : GLenum; u1 : GLfloat; u2 : GLfloat; stride : GLint; order : GLint; points : access GLfloat) -- gl.h:1363 with Import => True, Convention => C, External_Name => "glMap1f"; procedure glMap2d (target : GLenum; u1 : GLdouble; u2 : GLdouble; ustride : GLint; uorder : GLint; v1 : GLdouble; v2 : GLdouble; vstride : GLint; vorder : GLint; points : access GLdouble) -- gl.h:1367 with Import => True, Convention => C, External_Name => "glMap2d"; procedure glMap2f (target : GLenum; u1 : GLfloat; u2 : GLfloat; ustride : GLint; uorder : GLint; v1 : GLfloat; v2 : GLfloat; vstride : GLint; vorder : GLint; points : access GLfloat) -- gl.h:1371 with Import => True, Convention => C, External_Name => "glMap2f"; procedure glGetMapdv (target : GLenum; query : GLenum; v : access GLdouble) -- gl.h:1376 with Import => True, Convention => C, External_Name => "glGetMapdv"; procedure glGetMapfv (target : GLenum; query : GLenum; v : access GLfloat) -- gl.h:1377 with Import => True, Convention => C, External_Name => "glGetMapfv"; procedure glGetMapiv (target : GLenum; query : GLenum; v : access GLint) -- gl.h:1378 with Import => True, Convention => C, External_Name => "glGetMapiv"; procedure glEvalCoord1d (u : GLdouble) -- gl.h:1380 with Import => True, Convention => C, External_Name => "glEvalCoord1d"; procedure glEvalCoord1f (u : GLfloat) -- gl.h:1381 with Import => True, Convention => C, External_Name => "glEvalCoord1f"; procedure glEvalCoord1dv (u : access GLdouble) -- gl.h:1383 with Import => True, Convention => C, External_Name => "glEvalCoord1dv"; procedure glEvalCoord1fv (u : access GLfloat) -- gl.h:1384 with Import => True, Convention => C, External_Name => "glEvalCoord1fv"; procedure glEvalCoord2d (u : GLdouble; v : GLdouble) -- gl.h:1386 with Import => True, Convention => C, External_Name => "glEvalCoord2d"; procedure glEvalCoord2f (u : GLfloat; v : GLfloat) -- gl.h:1387 with Import => True, Convention => C, External_Name => "glEvalCoord2f"; procedure glEvalCoord2dv (u : access GLdouble) -- gl.h:1389 with Import => True, Convention => C, External_Name => "glEvalCoord2dv"; procedure glEvalCoord2fv (u : access GLfloat) -- gl.h:1390 with Import => True, Convention => C, External_Name => "glEvalCoord2fv"; procedure glMapGrid1d (un : GLint; u1 : GLdouble; u2 : GLdouble) -- gl.h:1392 with Import => True, Convention => C, External_Name => "glMapGrid1d"; procedure glMapGrid1f (un : GLint; u1 : GLfloat; u2 : GLfloat) -- gl.h:1393 with Import => True, Convention => C, External_Name => "glMapGrid1f"; procedure glMapGrid2d (un : GLint; u1 : GLdouble; u2 : GLdouble; vn : GLint; v1 : GLdouble; v2 : GLdouble) -- gl.h:1395 with Import => True, Convention => C, External_Name => "glMapGrid2d"; procedure glMapGrid2f (un : GLint; u1 : GLfloat; u2 : GLfloat; vn : GLint; v1 : GLfloat; v2 : GLfloat) -- gl.h:1397 with Import => True, Convention => C, External_Name => "glMapGrid2f"; procedure glEvalPoint1 (i : GLint) -- gl.h:1400 with Import => True, Convention => C, External_Name => "glEvalPoint1"; procedure glEvalPoint2 (i : GLint; j : GLint) -- gl.h:1402 with Import => True, Convention => C, External_Name => "glEvalPoint2"; procedure glEvalMesh1 (mode : GLenum; i1 : GLint; i2 : GLint) -- gl.h:1404 with Import => True, Convention => C, External_Name => "glEvalMesh1"; procedure glEvalMesh2 (mode : GLenum; i1 : GLint; i2 : GLint; j1 : GLint; j2 : GLint) -- gl.h:1406 with Import => True, Convention => C, External_Name => "glEvalMesh2"; -- * Fog -- procedure glFogf (pname : GLenum; param : GLfloat) -- gl.h:1413 with Import => True, Convention => C, External_Name => "glFogf"; procedure glFogi (pname : GLenum; param : GLint) -- gl.h:1415 with Import => True, Convention => C, External_Name => "glFogi"; procedure glFogfv (pname : GLenum; params : access GLfloat) -- gl.h:1417 with Import => True, Convention => C, External_Name => "glFogfv"; procedure glFogiv (pname : GLenum; params : access GLint) -- gl.h:1419 with Import => True, Convention => C, External_Name => "glFogiv"; -- * Selection and Feedback -- procedure glFeedbackBuffer (size : GLsizei; c_type : GLenum; buffer : access GLfloat) -- gl.h:1426 with Import => True, Convention => C, External_Name => "glFeedbackBuffer"; procedure glPassThrough (token : GLfloat) -- gl.h:1428 with Import => True, Convention => C, External_Name => "glPassThrough"; procedure glSelectBuffer (size : GLsizei; buffer : access GLuint) -- gl.h:1430 with Import => True, Convention => C, External_Name => "glSelectBuffer"; procedure glInitNames -- gl.h:1432 with Import => True, Convention => C, External_Name => "glInitNames"; procedure glLoadName (name : GLuint) -- gl.h:1434 with Import => True, Convention => C, External_Name => "glLoadName"; procedure glPushName (name : GLuint) -- gl.h:1436 with Import => True, Convention => C, External_Name => "glPushName"; procedure glPopName -- gl.h:1438 with Import => True, Convention => C, External_Name => "glPopName"; -- * OpenGL 1.2 -- procedure glDrawRangeElements (mode : GLenum; start : GLuint; c_end : GLuint; count : GLsizei; c_type : GLenum; indices : System.Address) -- gl.h:1488 with Import => True, Convention => C, External_Name => "glDrawRangeElements"; procedure glTexImage3D (target : GLenum; level : GLint; internalFormat : GLint; width : GLsizei; height : GLsizei; depth : GLsizei; border : GLint; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1491 with Import => True, Convention => C, External_Name => "glTexImage3D"; procedure glTexSubImage3D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; zoffset : GLint; width : GLsizei; height : GLsizei; depth : GLsizei; format : GLenum; c_type : GLenum; pixels : System.Address) -- gl.h:1498 with Import => True, Convention => C, External_Name => "glTexSubImage3D"; procedure glCopyTexSubImage3D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; zoffset : GLint; x : GLint; y : GLint; width : GLsizei; height : GLsizei) -- gl.h:1505 with Import => True, Convention => C, External_Name => "glCopyTexSubImage3D"; type PFNGLDRAWRANGEELEMENTSPROC is access procedure (arg1 : GLenum; arg2 : GLuint; arg3 : GLuint; arg4 : GLsizei; arg5 : GLenum; arg6 : System.Address) with Convention => C; -- gl.h:1511 type PFNGLTEXIMAGE3DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLsizei; arg5 : GLsizei; arg6 : GLsizei; arg7 : GLint; arg8 : GLenum; arg9 : GLenum; arg10 : System.Address) with Convention => C; -- gl.h:1512 type PFNGLTEXSUBIMAGE3DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLint; arg5 : GLint; arg6 : GLsizei; arg7 : GLsizei; arg8 : GLsizei; arg9 : GLenum; arg10 : GLenum; arg11 : System.Address) with Convention => C; -- gl.h:1513 type PFNGLCOPYTEXSUBIMAGE3DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLint; arg5 : GLint; arg6 : GLint; arg7 : GLint; arg8 : GLsizei; arg9 : GLsizei) with Convention => C; -- gl.h:1514 -- * GL_ARB_imaging -- procedure glColorTable (target : GLenum; internalformat : GLenum; width : GLsizei; format : GLenum; c_type : GLenum; table : System.Address) -- gl.h:1598 with Import => True, Convention => C, External_Name => "glColorTable"; procedure glColorSubTable (target : GLenum; start : GLsizei; count : GLsizei; format : GLenum; c_type : GLenum; data : System.Address) -- gl.h:1602 with Import => True, Convention => C, External_Name => "glColorSubTable"; procedure glColorTableParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1607 with Import => True, Convention => C, External_Name => "glColorTableParameteriv"; procedure glColorTableParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1610 with Import => True, Convention => C, External_Name => "glColorTableParameterfv"; procedure glCopyColorSubTable (target : GLenum; start : GLsizei; x : GLint; y : GLint; width : GLsizei) -- gl.h:1613 with Import => True, Convention => C, External_Name => "glCopyColorSubTable"; procedure glCopyColorTable (target : GLenum; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei) -- gl.h:1616 with Import => True, Convention => C, External_Name => "glCopyColorTable"; procedure glGetColorTable (target : GLenum; format : GLenum; c_type : GLenum; table : System.Address) -- gl.h:1619 with Import => True, Convention => C, External_Name => "glGetColorTable"; procedure glGetColorTableParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1622 with Import => True, Convention => C, External_Name => "glGetColorTableParameterfv"; procedure glGetColorTableParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1625 with Import => True, Convention => C, External_Name => "glGetColorTableParameteriv"; procedure glBlendEquation (mode : GLenum) -- gl.h:1628 with Import => True, Convention => C, External_Name => "glBlendEquation"; procedure glBlendColor (red : GLclampf; green : GLclampf; blue : GLclampf; alpha : GLclampf) -- gl.h:1630 with Import => True, Convention => C, External_Name => "glBlendColor"; procedure glHistogram (target : GLenum; width : GLsizei; internalformat : GLenum; sink : GLboolean) -- gl.h:1633 with Import => True, Convention => C, External_Name => "glHistogram"; procedure glResetHistogram (target : GLenum) -- gl.h:1636 with Import => True, Convention => C, External_Name => "glResetHistogram"; procedure glGetHistogram (target : GLenum; reset : GLboolean; format : GLenum; c_type : GLenum; values : System.Address) -- gl.h:1638 with Import => True, Convention => C, External_Name => "glGetHistogram"; procedure glGetHistogramParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1642 with Import => True, Convention => C, External_Name => "glGetHistogramParameterfv"; procedure glGetHistogramParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1645 with Import => True, Convention => C, External_Name => "glGetHistogramParameteriv"; procedure glMinmax (target : GLenum; internalformat : GLenum; sink : GLboolean) -- gl.h:1648 with Import => True, Convention => C, External_Name => "glMinmax"; procedure glResetMinmax (target : GLenum) -- gl.h:1651 with Import => True, Convention => C, External_Name => "glResetMinmax"; procedure glGetMinmax (target : GLenum; reset : GLboolean; format : GLenum; types : GLenum; values : System.Address) -- gl.h:1653 with Import => True, Convention => C, External_Name => "glGetMinmax"; procedure glGetMinmaxParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1657 with Import => True, Convention => C, External_Name => "glGetMinmaxParameterfv"; procedure glGetMinmaxParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1660 with Import => True, Convention => C, External_Name => "glGetMinmaxParameteriv"; procedure glConvolutionFilter1D (target : GLenum; internalformat : GLenum; width : GLsizei; format : GLenum; c_type : GLenum; image : System.Address) -- gl.h:1663 with Import => True, Convention => C, External_Name => "glConvolutionFilter1D"; procedure glConvolutionFilter2D (target : GLenum; internalformat : GLenum; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; image : System.Address) -- gl.h:1667 with Import => True, Convention => C, External_Name => "glConvolutionFilter2D"; procedure glConvolutionParameterf (target : GLenum; pname : GLenum; params : GLfloat) -- gl.h:1671 with Import => True, Convention => C, External_Name => "glConvolutionParameterf"; procedure glConvolutionParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1674 with Import => True, Convention => C, External_Name => "glConvolutionParameterfv"; procedure glConvolutionParameteri (target : GLenum; pname : GLenum; params : GLint) -- gl.h:1677 with Import => True, Convention => C, External_Name => "glConvolutionParameteri"; procedure glConvolutionParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1680 with Import => True, Convention => C, External_Name => "glConvolutionParameteriv"; procedure glCopyConvolutionFilter1D (target : GLenum; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei) -- gl.h:1683 with Import => True, Convention => C, External_Name => "glCopyConvolutionFilter1D"; procedure glCopyConvolutionFilter2D (target : GLenum; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei; height : GLsizei) -- gl.h:1686 with Import => True, Convention => C, External_Name => "glCopyConvolutionFilter2D"; procedure glGetConvolutionFilter (target : GLenum; format : GLenum; c_type : GLenum; image : System.Address) -- gl.h:1690 with Import => True, Convention => C, External_Name => "glGetConvolutionFilter"; procedure glGetConvolutionParameterfv (target : GLenum; pname : GLenum; params : access GLfloat) -- gl.h:1693 with Import => True, Convention => C, External_Name => "glGetConvolutionParameterfv"; procedure glGetConvolutionParameteriv (target : GLenum; pname : GLenum; params : access GLint) -- gl.h:1696 with Import => True, Convention => C, External_Name => "glGetConvolutionParameteriv"; procedure glSeparableFilter2D (target : GLenum; internalformat : GLenum; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; row : System.Address; column : System.Address) -- gl.h:1699 with Import => True, Convention => C, External_Name => "glSeparableFilter2D"; procedure glGetSeparableFilter (target : GLenum; format : GLenum; c_type : GLenum; row : System.Address; column : System.Address; span : System.Address) -- gl.h:1703 with Import => True, Convention => C, External_Name => "glGetSeparableFilter"; -- * OpenGL 1.3 -- -- multitexture -- texture_cube_map -- texture_compression -- multisample -- transpose_matrix -- texture_env_combine -- texture_env_dot3 -- texture_border_clamp procedure glActiveTexture (texture : GLenum) -- gl.h:1818 with Import => True, Convention => C, External_Name => "glActiveTexture"; procedure glClientActiveTexture (texture : GLenum) -- gl.h:1820 with Import => True, Convention => C, External_Name => "glClientActiveTexture"; procedure glCompressedTexImage1D (target : GLenum; level : GLint; internalformat : GLenum; width : GLsizei; border : GLint; imageSize : GLsizei; data : System.Address) -- gl.h:1822 with Import => True, Convention => C, External_Name => "glCompressedTexImage1D"; procedure glCompressedTexImage2D (target : GLenum; level : GLint; internalformat : GLenum; width : GLsizei; height : GLsizei; border : GLint; imageSize : GLsizei; data : System.Address) -- gl.h:1824 with Import => True, Convention => C, External_Name => "glCompressedTexImage2D"; procedure glCompressedTexImage3D (target : GLenum; level : GLint; internalformat : GLenum; width : GLsizei; height : GLsizei; depth : GLsizei; border : GLint; imageSize : GLsizei; data : System.Address) -- gl.h:1826 with Import => True, Convention => C, External_Name => "glCompressedTexImage3D"; procedure glCompressedTexSubImage1D (target : GLenum; level : GLint; xoffset : GLint; width : GLsizei; format : GLenum; imageSize : GLsizei; data : System.Address) -- gl.h:1828 with Import => True, Convention => C, External_Name => "glCompressedTexSubImage1D"; procedure glCompressedTexSubImage2D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; width : GLsizei; height : GLsizei; format : GLenum; imageSize : GLsizei; data : System.Address) -- gl.h:1830 with Import => True, Convention => C, External_Name => "glCompressedTexSubImage2D"; procedure glCompressedTexSubImage3D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; zoffset : GLint; width : GLsizei; height : GLsizei; depth : GLsizei; format : GLenum; imageSize : GLsizei; data : System.Address) -- gl.h:1832 with Import => True, Convention => C, External_Name => "glCompressedTexSubImage3D"; procedure glGetCompressedTexImage (target : GLenum; lod : GLint; img : System.Address) -- gl.h:1834 with Import => True, Convention => C, External_Name => "glGetCompressedTexImage"; procedure glMultiTexCoord1d (target : GLenum; s : GLdouble) -- gl.h:1836 with Import => True, Convention => C, External_Name => "glMultiTexCoord1d"; procedure glMultiTexCoord1dv (target : GLenum; v : access GLdouble) -- gl.h:1838 with Import => True, Convention => C, External_Name => "glMultiTexCoord1dv"; procedure glMultiTexCoord1f (target : GLenum; s : GLfloat) -- gl.h:1840 with Import => True, Convention => C, External_Name => "glMultiTexCoord1f"; procedure glMultiTexCoord1fv (target : GLenum; v : access GLfloat) -- gl.h:1842 with Import => True, Convention => C, External_Name => "glMultiTexCoord1fv"; procedure glMultiTexCoord1i (target : GLenum; s : GLint) -- gl.h:1844 with Import => True, Convention => C, External_Name => "glMultiTexCoord1i"; procedure glMultiTexCoord1iv (target : GLenum; v : access GLint) -- gl.h:1846 with Import => True, Convention => C, External_Name => "glMultiTexCoord1iv"; procedure glMultiTexCoord1s (target : GLenum; s : GLshort) -- gl.h:1848 with Import => True, Convention => C, External_Name => "glMultiTexCoord1s"; procedure glMultiTexCoord1sv (target : GLenum; v : access GLshort) -- gl.h:1850 with Import => True, Convention => C, External_Name => "glMultiTexCoord1sv"; procedure glMultiTexCoord2d (target : GLenum; s : GLdouble; t : GLdouble) -- gl.h:1852 with Import => True, Convention => C, External_Name => "glMultiTexCoord2d"; procedure glMultiTexCoord2dv (target : GLenum; v : access GLdouble) -- gl.h:1854 with Import => True, Convention => C, External_Name => "glMultiTexCoord2dv"; procedure glMultiTexCoord2f (target : GLenum; s : GLfloat; t : GLfloat) -- gl.h:1856 with Import => True, Convention => C, External_Name => "glMultiTexCoord2f"; procedure glMultiTexCoord2fv (target : GLenum; v : access GLfloat) -- gl.h:1858 with Import => True, Convention => C, External_Name => "glMultiTexCoord2fv"; procedure glMultiTexCoord2i (target : GLenum; s : GLint; t : GLint) -- gl.h:1860 with Import => True, Convention => C, External_Name => "glMultiTexCoord2i"; procedure glMultiTexCoord2iv (target : GLenum; v : access GLint) -- gl.h:1862 with Import => True, Convention => C, External_Name => "glMultiTexCoord2iv"; procedure glMultiTexCoord2s (target : GLenum; s : GLshort; t : GLshort) -- gl.h:1864 with Import => True, Convention => C, External_Name => "glMultiTexCoord2s"; procedure glMultiTexCoord2sv (target : GLenum; v : access GLshort) -- gl.h:1866 with Import => True, Convention => C, External_Name => "glMultiTexCoord2sv"; procedure glMultiTexCoord3d (target : GLenum; s : GLdouble; t : GLdouble; r : GLdouble) -- gl.h:1868 with Import => True, Convention => C, External_Name => "glMultiTexCoord3d"; procedure glMultiTexCoord3dv (target : GLenum; v : access GLdouble) -- gl.h:1870 with Import => True, Convention => C, External_Name => "glMultiTexCoord3dv"; procedure glMultiTexCoord3f (target : GLenum; s : GLfloat; t : GLfloat; r : GLfloat) -- gl.h:1872 with Import => True, Convention => C, External_Name => "glMultiTexCoord3f"; procedure glMultiTexCoord3fv (target : GLenum; v : access GLfloat) -- gl.h:1874 with Import => True, Convention => C, External_Name => "glMultiTexCoord3fv"; procedure glMultiTexCoord3i (target : GLenum; s : GLint; t : GLint; r : GLint) -- gl.h:1876 with Import => True, Convention => C, External_Name => "glMultiTexCoord3i"; procedure glMultiTexCoord3iv (target : GLenum; v : access GLint) -- gl.h:1878 with Import => True, Convention => C, External_Name => "glMultiTexCoord3iv"; procedure glMultiTexCoord3s (target : GLenum; s : GLshort; t : GLshort; r : GLshort) -- gl.h:1880 with Import => True, Convention => C, External_Name => "glMultiTexCoord3s"; procedure glMultiTexCoord3sv (target : GLenum; v : access GLshort) -- gl.h:1882 with Import => True, Convention => C, External_Name => "glMultiTexCoord3sv"; procedure glMultiTexCoord4d (target : GLenum; s : GLdouble; t : GLdouble; r : GLdouble; q : GLdouble) -- gl.h:1884 with Import => True, Convention => C, External_Name => "glMultiTexCoord4d"; procedure glMultiTexCoord4dv (target : GLenum; v : access GLdouble) -- gl.h:1886 with Import => True, Convention => C, External_Name => "glMultiTexCoord4dv"; procedure glMultiTexCoord4f (target : GLenum; s : GLfloat; t : GLfloat; r : GLfloat; q : GLfloat) -- gl.h:1888 with Import => True, Convention => C, External_Name => "glMultiTexCoord4f"; procedure glMultiTexCoord4fv (target : GLenum; v : access GLfloat) -- gl.h:1890 with Import => True, Convention => C, External_Name => "glMultiTexCoord4fv"; procedure glMultiTexCoord4i (target : GLenum; s : GLint; t : GLint; r : GLint; q : GLint) -- gl.h:1892 with Import => True, Convention => C, External_Name => "glMultiTexCoord4i"; procedure glMultiTexCoord4iv (target : GLenum; v : access GLint) -- gl.h:1894 with Import => True, Convention => C, External_Name => "glMultiTexCoord4iv"; procedure glMultiTexCoord4s (target : GLenum; s : GLshort; t : GLshort; r : GLshort; q : GLshort) -- gl.h:1896 with Import => True, Convention => C, External_Name => "glMultiTexCoord4s"; procedure glMultiTexCoord4sv (target : GLenum; v : access GLshort) -- gl.h:1898 with Import => True, Convention => C, External_Name => "glMultiTexCoord4sv"; procedure glLoadTransposeMatrixd (m : access GLdouble) -- gl.h:1901 with Import => True, Convention => C, External_Name => "glLoadTransposeMatrixd"; procedure glLoadTransposeMatrixf (m : access GLfloat) -- gl.h:1903 with Import => True, Convention => C, External_Name => "glLoadTransposeMatrixf"; procedure glMultTransposeMatrixd (m : access GLdouble) -- gl.h:1905 with Import => True, Convention => C, External_Name => "glMultTransposeMatrixd"; procedure glMultTransposeMatrixf (m : access GLfloat) -- gl.h:1907 with Import => True, Convention => C, External_Name => "glMultTransposeMatrixf"; procedure glSampleCoverage (value : GLclampf; invert : GLboolean) -- gl.h:1909 with Import => True, Convention => C, External_Name => "glSampleCoverage"; type PFNGLACTIVETEXTUREPROC is access procedure (arg1 : GLenum) with Convention => C; -- gl.h:1912 type PFNGLSAMPLECOVERAGEPROC is access procedure (arg1 : GLclampf; arg2 : GLboolean) with Convention => C; -- gl.h:1913 type PFNGLCOMPRESSEDTEXIMAGE3DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLenum; arg4 : GLsizei; arg5 : GLsizei; arg6 : GLsizei; arg7 : GLint; arg8 : GLsizei; arg9 : System.Address) with Convention => C; -- gl.h:1914 type PFNGLCOMPRESSEDTEXIMAGE2DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLenum; arg4 : GLsizei; arg5 : GLsizei; arg6 : GLint; arg7 : GLsizei; arg8 : System.Address) with Convention => C; -- gl.h:1915 type PFNGLCOMPRESSEDTEXIMAGE1DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLenum; arg4 : GLsizei; arg5 : GLint; arg6 : GLsizei; arg7 : System.Address) with Convention => C; -- gl.h:1916 type PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLint; arg5 : GLint; arg6 : GLsizei; arg7 : GLsizei; arg8 : GLsizei; arg9 : GLenum; arg10 : GLsizei; arg11 : System.Address) with Convention => C; -- gl.h:1917 type PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLint; arg5 : GLsizei; arg6 : GLsizei; arg7 : GLenum; arg8 : GLsizei; arg9 : System.Address) with Convention => C; -- gl.h:1918 type PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLsizei; arg5 : GLenum; arg6 : GLsizei; arg7 : System.Address) with Convention => C; -- gl.h:1919 type PFNGLGETCOMPRESSEDTEXIMAGEPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : System.Address) with Convention => C; -- gl.h:1920 -- * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) -- procedure glActiveTextureARB (texture : GLenum) -- gl.h:1966 with Import => True, Convention => C, External_Name => "glActiveTextureARB"; procedure glClientActiveTextureARB (texture : GLenum) -- gl.h:1967 with Import => True, Convention => C, External_Name => "glClientActiveTextureARB"; procedure glMultiTexCoord1dARB (target : GLenum; s : GLdouble) -- gl.h:1968 with Import => True, Convention => C, External_Name => "glMultiTexCoord1dARB"; procedure glMultiTexCoord1dvARB (target : GLenum; v : access GLdouble) -- gl.h:1969 with Import => True, Convention => C, External_Name => "glMultiTexCoord1dvARB"; procedure glMultiTexCoord1fARB (target : GLenum; s : GLfloat) -- gl.h:1970 with Import => True, Convention => C, External_Name => "glMultiTexCoord1fARB"; procedure glMultiTexCoord1fvARB (target : GLenum; v : access GLfloat) -- gl.h:1971 with Import => True, Convention => C, External_Name => "glMultiTexCoord1fvARB"; procedure glMultiTexCoord1iARB (target : GLenum; s : GLint) -- gl.h:1972 with Import => True, Convention => C, External_Name => "glMultiTexCoord1iARB"; procedure glMultiTexCoord1ivARB (target : GLenum; v : access GLint) -- gl.h:1973 with Import => True, Convention => C, External_Name => "glMultiTexCoord1ivARB"; procedure glMultiTexCoord1sARB (target : GLenum; s : GLshort) -- gl.h:1974 with Import => True, Convention => C, External_Name => "glMultiTexCoord1sARB"; procedure glMultiTexCoord1svARB (target : GLenum; v : access GLshort) -- gl.h:1975 with Import => True, Convention => C, External_Name => "glMultiTexCoord1svARB"; procedure glMultiTexCoord2dARB (target : GLenum; s : GLdouble; t : GLdouble) -- gl.h:1976 with Import => True, Convention => C, External_Name => "glMultiTexCoord2dARB"; procedure glMultiTexCoord2dvARB (target : GLenum; v : access GLdouble) -- gl.h:1977 with Import => True, Convention => C, External_Name => "glMultiTexCoord2dvARB"; procedure glMultiTexCoord2fARB (target : GLenum; s : GLfloat; t : GLfloat) -- gl.h:1978 with Import => True, Convention => C, External_Name => "glMultiTexCoord2fARB"; procedure glMultiTexCoord2fvARB (target : GLenum; v : access GLfloat) -- gl.h:1979 with Import => True, Convention => C, External_Name => "glMultiTexCoord2fvARB"; procedure glMultiTexCoord2iARB (target : GLenum; s : GLint; t : GLint) -- gl.h:1980 with Import => True, Convention => C, External_Name => "glMultiTexCoord2iARB"; procedure glMultiTexCoord2ivARB (target : GLenum; v : access GLint) -- gl.h:1981 with Import => True, Convention => C, External_Name => "glMultiTexCoord2ivARB"; procedure glMultiTexCoord2sARB (target : GLenum; s : GLshort; t : GLshort) -- gl.h:1982 with Import => True, Convention => C, External_Name => "glMultiTexCoord2sARB"; procedure glMultiTexCoord2svARB (target : GLenum; v : access GLshort) -- gl.h:1983 with Import => True, Convention => C, External_Name => "glMultiTexCoord2svARB"; procedure glMultiTexCoord3dARB (target : GLenum; s : GLdouble; t : GLdouble; r : GLdouble) -- gl.h:1984 with Import => True, Convention => C, External_Name => "glMultiTexCoord3dARB"; procedure glMultiTexCoord3dvARB (target : GLenum; v : access GLdouble) -- gl.h:1985 with Import => True, Convention => C, External_Name => "glMultiTexCoord3dvARB"; procedure glMultiTexCoord3fARB (target : GLenum; s : GLfloat; t : GLfloat; r : GLfloat) -- gl.h:1986 with Import => True, Convention => C, External_Name => "glMultiTexCoord3fARB"; procedure glMultiTexCoord3fvARB (target : GLenum; v : access GLfloat) -- gl.h:1987 with Import => True, Convention => C, External_Name => "glMultiTexCoord3fvARB"; procedure glMultiTexCoord3iARB (target : GLenum; s : GLint; t : GLint; r : GLint) -- gl.h:1988 with Import => True, Convention => C, External_Name => "glMultiTexCoord3iARB"; procedure glMultiTexCoord3ivARB (target : GLenum; v : access GLint) -- gl.h:1989 with Import => True, Convention => C, External_Name => "glMultiTexCoord3ivARB"; procedure glMultiTexCoord3sARB (target : GLenum; s : GLshort; t : GLshort; r : GLshort) -- gl.h:1990 with Import => True, Convention => C, External_Name => "glMultiTexCoord3sARB"; procedure glMultiTexCoord3svARB (target : GLenum; v : access GLshort) -- gl.h:1991 with Import => True, Convention => C, External_Name => "glMultiTexCoord3svARB"; procedure glMultiTexCoord4dARB (target : GLenum; s : GLdouble; t : GLdouble; r : GLdouble; q : GLdouble) -- gl.h:1992 with Import => True, Convention => C, External_Name => "glMultiTexCoord4dARB"; procedure glMultiTexCoord4dvARB (target : GLenum; v : access GLdouble) -- gl.h:1993 with Import => True, Convention => C, External_Name => "glMultiTexCoord4dvARB"; procedure glMultiTexCoord4fARB (target : GLenum; s : GLfloat; t : GLfloat; r : GLfloat; q : GLfloat) -- gl.h:1994 with Import => True, Convention => C, External_Name => "glMultiTexCoord4fARB"; procedure glMultiTexCoord4fvARB (target : GLenum; v : access GLfloat) -- gl.h:1995 with Import => True, Convention => C, External_Name => "glMultiTexCoord4fvARB"; procedure glMultiTexCoord4iARB (target : GLenum; s : GLint; t : GLint; r : GLint; q : GLint) -- gl.h:1996 with Import => True, Convention => C, External_Name => "glMultiTexCoord4iARB"; procedure glMultiTexCoord4ivARB (target : GLenum; v : access GLint) -- gl.h:1997 with Import => True, Convention => C, External_Name => "glMultiTexCoord4ivARB"; procedure glMultiTexCoord4sARB (target : GLenum; s : GLshort; t : GLshort; r : GLshort; q : GLshort) -- gl.h:1998 with Import => True, Convention => C, External_Name => "glMultiTexCoord4sARB"; procedure glMultiTexCoord4svARB (target : GLenum; v : access GLshort) -- gl.h:1999 with Import => True, Convention => C, External_Name => "glMultiTexCoord4svARB"; type PFNGLACTIVETEXTUREARBPROC is access procedure (arg1 : GLenum) with Convention => C; -- gl.h:2001 type PFNGLCLIENTACTIVETEXTUREARBPROC is access procedure (arg1 : GLenum) with Convention => C; -- gl.h:2002 type PFNGLMULTITEXCOORD1DARBPROC is access procedure (arg1 : GLenum; arg2 : GLdouble) with Convention => C; -- gl.h:2003 type PFNGLMULTITEXCOORD1DVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLdouble) with Convention => C; -- gl.h:2004 type PFNGLMULTITEXCOORD1FARBPROC is access procedure (arg1 : GLenum; arg2 : GLfloat) with Convention => C; -- gl.h:2005 type PFNGLMULTITEXCOORD1FVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLfloat) with Convention => C; -- gl.h:2006 type PFNGLMULTITEXCOORD1IARBPROC is access procedure (arg1 : GLenum; arg2 : GLint) with Convention => C; -- gl.h:2007 type PFNGLMULTITEXCOORD1IVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLint) with Convention => C; -- gl.h:2008 type PFNGLMULTITEXCOORD1SARBPROC is access procedure (arg1 : GLenum; arg2 : GLshort) with Convention => C; -- gl.h:2009 type PFNGLMULTITEXCOORD1SVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLshort) with Convention => C; -- gl.h:2010 type PFNGLMULTITEXCOORD2DARBPROC is access procedure (arg1 : GLenum; arg2 : GLdouble; arg3 : GLdouble) with Convention => C; -- gl.h:2011 type PFNGLMULTITEXCOORD2DVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLdouble) with Convention => C; -- gl.h:2012 type PFNGLMULTITEXCOORD2FARBPROC is access procedure (arg1 : GLenum; arg2 : GLfloat; arg3 : GLfloat) with Convention => C; -- gl.h:2013 type PFNGLMULTITEXCOORD2FVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLfloat) with Convention => C; -- gl.h:2014 type PFNGLMULTITEXCOORD2IARBPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint) with Convention => C; -- gl.h:2015 type PFNGLMULTITEXCOORD2IVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLint) with Convention => C; -- gl.h:2016 type PFNGLMULTITEXCOORD2SARBPROC is access procedure (arg1 : GLenum; arg2 : GLshort; arg3 : GLshort) with Convention => C; -- gl.h:2017 type PFNGLMULTITEXCOORD2SVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLshort) with Convention => C; -- gl.h:2018 type PFNGLMULTITEXCOORD3DARBPROC is access procedure (arg1 : GLenum; arg2 : GLdouble; arg3 : GLdouble; arg4 : GLdouble) with Convention => C; -- gl.h:2019 type PFNGLMULTITEXCOORD3DVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLdouble) with Convention => C; -- gl.h:2020 type PFNGLMULTITEXCOORD3FARBPROC is access procedure (arg1 : GLenum; arg2 : GLfloat; arg3 : GLfloat; arg4 : GLfloat) with Convention => C; -- gl.h:2021 type PFNGLMULTITEXCOORD3FVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLfloat) with Convention => C; -- gl.h:2022 type PFNGLMULTITEXCOORD3IARBPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLint) with Convention => C; -- gl.h:2023 type PFNGLMULTITEXCOORD3IVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLint) with Convention => C; -- gl.h:2024 type PFNGLMULTITEXCOORD3SARBPROC is access procedure (arg1 : GLenum; arg2 : GLshort; arg3 : GLshort; arg4 : GLshort) with Convention => C; -- gl.h:2025 type PFNGLMULTITEXCOORD3SVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLshort) with Convention => C; -- gl.h:2026 type PFNGLMULTITEXCOORD4DARBPROC is access procedure (arg1 : GLenum; arg2 : GLdouble; arg3 : GLdouble; arg4 : GLdouble; arg5 : GLdouble) with Convention => C; -- gl.h:2027 type PFNGLMULTITEXCOORD4DVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLdouble) with Convention => C; -- gl.h:2028 type PFNGLMULTITEXCOORD4FARBPROC is access procedure (arg1 : GLenum; arg2 : GLfloat; arg3 : GLfloat; arg4 : GLfloat; arg5 : GLfloat) with Convention => C; -- gl.h:2029 type PFNGLMULTITEXCOORD4FVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLfloat) with Convention => C; -- gl.h:2030 type PFNGLMULTITEXCOORD4IARBPROC is access procedure (arg1 : GLenum; arg2 : GLint; arg3 : GLint; arg4 : GLint; arg5 : GLint) with Convention => C; -- gl.h:2031 type PFNGLMULTITEXCOORD4IVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLint) with Convention => C; -- gl.h:2032 type PFNGLMULTITEXCOORD4SARBPROC is access procedure (arg1 : GLenum; arg2 : GLshort; arg3 : GLshort; arg4 : GLshort; arg5 : GLshort) with Convention => C; -- gl.h:2033 type PFNGLMULTITEXCOORD4SVARBPROC is access procedure (arg1 : GLenum; arg2 : access GLshort) with Convention => C; -- gl.h:2034 -- * Define this token if you want "old-style" header file behaviour (extensions -- * defined in gl.h). Otherwise, extensions will be included from glext.h. -- -- All extensions that used to be here are now found in glext.h -- * ???. GL_MESA_packed_depth_stencil -- * XXX obsolete -- procedure glBlendEquationSeparateATI (modeRGB : GLenum; modeA : GLenum) -- gl.h:2077 with Import => True, Convention => C, External_Name => "glBlendEquationSeparateATI"; type PFNGLBLENDEQUATIONSEPARATEATIPROC is access procedure (arg1 : GLenum; arg2 : GLenum) with Convention => C; -- gl.h:2078 -- GL_OES_EGL_image type PFNGLEGLIMAGETARGETTEXTURE2DOESPROC is access procedure (arg1 : GLenum; arg2 : glext.GLeglImageOES) with Convention => C; -- gl.h:2094 type PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC is access procedure (arg1 : GLenum; arg2 : glext.GLeglImageOES) with Convention => C; -- gl.h:2095 end gl;
----------------------------------------------------------------------- -- Util.Serialize.Mappers.Vector_Mapper -- Mapper for vector types -- Copyright (C) 2010, 2011, 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; package body Util.Serialize.Mappers.Vector_Mapper is use Vectors; use Util.Log; -- The logger Log : constant Loggers.Logger := Loggers.Create ("Util.Serialize.Mappers.Vector_Mapper", Util.Log.WARN_LEVEL); Key : Util.Serialize.Contexts.Data_Key; -- ----------------------- -- Data context -- ----------------------- -- Data context to get access to the target element. -- ----------------------- -- Get the vector object. -- ----------------------- function Get_Vector (Data : in Vector_Data) return Vector_Type_Access is begin return Data.Vector; end Get_Vector; -- ----------------------- -- Set the vector object. -- ----------------------- procedure Set_Vector (Data : in out Vector_Data; Vector : in Vector_Type_Access) is begin Data.Vector := Vector; end Set_Vector; -- ----------------------- -- Record mapper -- ----------------------- -- ----------------------- -- Set the <b>Data</b> vector in the context. -- ----------------------- procedure Set_Context (Ctx : in out Util.Serialize.Contexts.Context'Class; Data : in Vector_Type_Access) is Data_Context : constant Vector_Data_Access := new Vector_Data; begin Data_Context.Vector := Data; Data_Context.Position := Index_Type'First; Ctx.Set_Data (Key => Key, Content => Data_Context.all'Unchecked_Access); end Set_Context; -- ----------------------- -- Execute the mapping operation on the object associated with the current context. -- The object is extracted from the context and the <b>Execute</b> operation is called. -- ----------------------- procedure Execute (Handler : in Mapper; Map : in Mapping'Class; Ctx : in out Util.Serialize.Contexts.Context'Class; Value : in Util.Beans.Objects.Object) is pragma Unreferenced (Handler); procedure Process (Element : in out Element_Type); procedure Process (Element : in out Element_Type) is begin Element_Mapper.Set_Member (Map, Element, Value); end Process; D : constant Contexts.Data_Access := Ctx.Get_Data (Key); begin Log.Debug ("Updating vector element"); if not (D.all in Vector_Data'Class) then raise Util.Serialize.Contexts.No_Data; end if; declare DE : constant Vector_Data_Access := Vector_Data'Class (D.all)'Access; begin if DE.Vector = null then raise Util.Serialize.Contexts.No_Data; end if; -- Update the element through the generic procedure Update_Element (DE.Vector.all, DE.Position - 1, Process'Access); end; end Execute; procedure Set_Mapping (Into : in out Mapper; Inner : in Element_Mapper.Mapper_Access) is begin Into.Mapper := Inner.all'Unchecked_Access; Into.Map.Bind (Inner); end Set_Mapping; -- ----------------------- -- Find the mapper associated with the given name. -- Returns null if there is no mapper. -- ----------------------- function Find_Mapper (Controller : in Mapper; Name : in String) return Util.Serialize.Mappers.Mapper_Access is begin return Controller.Mapper.Find_Mapper (Name); end Find_Mapper; overriding procedure Initialize (Controller : in out Mapper) is begin Controller.Mapper := Controller.Map'Unchecked_Access; end Initialize; procedure Start_Object (Handler : in Mapper; Context : in out Util.Serialize.Contexts.Context'Class; Name : in String) is pragma Unreferenced (Handler); procedure Set_Context (Item : in out Element_Type); D : constant Contexts.Data_Access := Context.Get_Data (Key); procedure Set_Context (Item : in out Element_Type) is begin Element_Mapper.Set_Context (Ctx => Context, Element => Item'Unrestricted_Access); end Set_Context; begin Log.Debug ("Creating vector element {0}", Name); if not (D.all in Vector_Data'Class) then raise Util.Serialize.Contexts.No_Data; end if; declare DE : constant Vector_Data_Access := Vector_Data'Class (D.all)'Access; begin if DE.Vector = null then raise Util.Serialize.Contexts.No_Data; end if; Insert_Space (DE.Vector.all, DE.Position); DE.Vector.Update_Element (Index => DE.Position, Process => Set_Context'Access); DE.Position := DE.Position + 1; end; end Start_Object; procedure Finish_Object (Handler : in Mapper; Context : in out Util.Serialize.Contexts.Context'Class; Name : in String) is begin null; end Finish_Object; -- ----------------------- -- Write the element on the stream using the mapper description. -- ----------------------- procedure Write (Handler : in Mapper; Stream : in out Util.Serialize.IO.Output_Stream'Class; Element : in Vectors.Vector) is Pos : Vectors.Cursor := Element.First; begin Stream.Start_Array (Element.Length); while Vectors.Has_Element (Pos) loop Element_Mapper.Write (Handler.Mapper.all, Handler.Map.Get_Getter, Stream, Vectors.Element (Pos)); Vectors.Next (Pos); end loop; Stream.End_Array; end Write; begin -- Allocate the unique data key. Util.Serialize.Contexts.Allocate (Key); end Util.Serialize.Mappers.Vector_Mapper;
-- Generated by gperfhash with Util.Strings.Transforms; with Interfaces; use Interfaces; package body PQ.Perfect_Hash is P : constant array (0 .. 11) of Natural := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13); T1 : constant array (0 .. 11) of Unsigned_16 := (458, 26, 756, 54, 156, 452, 817, 805, 671, 438, 702, 309); T2 : constant array (0 .. 11) of Unsigned_16 := (535, 198, 250, 162, 35, 640, 58, 730, 487, 363, 193, 648); G : constant array (0 .. 832) of Unsigned_16 := (366, 0, 96, 0, 0, 0, 0, 0, 0, 108, 0, 248, 367, 192, 0, 119, 0, 3, 259, 0, 31, 230, 0, 0, 0, 0, 0, 202, 0, 0, 243, 0, 0, 0, 0, 7, 104, 0, 0, 0, 0, 0, 322, 0, 0, 279, 0, 0, 301, 0, 290, 169, 0, 211, 44, 0, 0, 134, 0, 0, 358, 200, 309, 0, 69, 410, 0, 0, 0, 0, 0, 8, 305, 0, 0, 0, 228, 0, 0, 0, 46, 302, 0, 0, 0, 0, 288, 0, 0, 0, 0, 0, 74, 339, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 0, 0, 0, 0, 0, 103, 0, 0, 267, 68, 0, 0, 83, 0, 0, 0, 0, 0, 381, 71, 0, 261, 249, 204, 96, 278, 0, 0, 0, 0, 0, 117, 41, 0, 156, 339, 0, 0, 0, 0, 13, 0, 0, 0, 98, 0, 0, 0, 0, 2, 73, 0, 30, 69, 272, 0, 26, 0, 0, 220, 0, 20, 0, 127, 0, 0, 0, 0, 0, 199, 0, 148, 37, 340, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 136, 0, 65, 146, 301, 16, 0, 200, 0, 0, 0, 0, 0, 223, 111, 0, 0, 0, 0, 0, 0, 275, 319, 6, 0, 200, 0, 0, 0, 28, 225, 0, 0, 152, 13, 325, 256, 92, 0, 33, 235, 0, 307, 276, 187, 0, 37, 0, 0, 163, 324, 94, 0, 406, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 53, 0, 0, 313, 239, 105, 365, 0, 0, 0, 0, 120, 0, 0, 373, 403, 100, 227, 0, 0, 100, 376, 0, 0, 0, 0, 90, 0, 0, 150, 0, 41, 0, 0, 0, 88, 242, 0, 94, 0, 0, 0, 0, 0, 299, 101, 256, 0, 217, 0, 0, 0, 54, 261, 0, 0, 135, 24, 145, 236, 371, 67, 0, 0, 69, 0, 166, 0, 0, 0, 61, 91, 0, 80, 413, 269, 0, 0, 0, 0, 268, 228, 30, 111, 229, 243, 267, 236, 0, 0, 40, 414, 42, 0, 401, 305, 0, 33, 0, 171, 342, 287, 130, 0, 348, 0, 338, 320, 290, 139, 0, 0, 205, 248, 0, 0, 243, 56, 0, 214, 0, 0, 0, 0, 0, 249, 0, 0, 48, 117, 381, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 358, 0, 270, 0, 401, 109, 94, 0, 0, 0, 0, 0, 7, 0, 5, 173, 0, 0, 343, 116, 0, 284, 0, 0, 51, 381, 79, 312, 146, 154, 217, 0, 0, 0, 0, 32, 23, 120, 0, 156, 0, 21, 0, 217, 237, 0, 151, 365, 0, 0, 0, 258, 378, 0, 387, 0, 34, 116, 0, 13, 212, 115, 0, 0, 406, 0, 0, 333, 0, 1, 0, 256, 0, 0, 0, 0, 23, 283, 218, 407, 27, 0, 4, 0, 0, 260, 0, 82, 115, 18, 363, 0, 226, 112, 237, 132, 62, 0, 0, 0, 0, 143, 296, 43, 285, 131, 16, 386, 0, 129, 0, 96, 0, 0, 79, 388, 30, 390, 0, 404, 0, 0, 100, 130, 0, 0, 381, 1, 341, 0, 52, 0, 173, 0, 0, 103, 352, 0, 0, 145, 363, 0, 0, 0, 49, 251, 201, 0, 182, 375, 382, 0, 97, 284, 121, 0, 3, 0, 0, 267, 0, 1, 336, 0, 0, 405, 243, 127, 68, 0, 0, 299, 0, 0, 0, 0, 25, 0, 169, 0, 103, 0, 277, 24, 0, 102, 0, 337, 253, 0, 0, 0, 0, 281, 36, 0, 308, 337, 88, 0, 0, 0, 0, 107, 359, 310, 0, 0, 0, 104, 0, 0, 35, 114, 0, 0, 37, 175, 232, 0, 336, 158, 288, 0, 0, 269, 0, 0, 90, 134, 0, 0, 367, 0, 281, 0, 346, 252, 62, 0, 358, 0, 317, 389, 0, 254, 0, 67, 165, 398, 0, 0, 0, 167, 0, 0, 94, 0, 45, 389, 0, 0, 307, 0, 344, 0, 0, 144, 174, 0, 75, 0, 0, 381, 0, 4, 74, 303, 188, 0, 21, 379, 0, 0, 0, 0, 0, 258, 270, 310, 353, 0, 185, 91, 353, 108, 0, 295, 56, 365, 341, 108, 19, 0, 0, 0, 0, 96, 266, 0, 0, 285, 211, 0, 104, 0, 0, 298, 0, 74, 71, 0, 108, 0, 0, 48, 47, 294, 349, 0, 160, 130, 0, 320, 277, 0, 0, 0, 386, 233, 268, 413, 153, 12, 26, 0, 222, 293, 45, 0, 267, 249, 47, 0, 0, 265, 257, 0, 0, 0, 377, 0, 0, 150, 0, 279, 192, 0, 287, 0, 169, 273, 276, 38, 79, 90, 218, 0, 378, 0, 0, 0, 386, 367, 0, 149, 0, 278, 0, 295, 106, 321, 334, 107, 165, 31, 0, 366, 316, 0, 0, 0, 296, 0, 191, 71, 36, 0, 0, 0, 0, 0, 376, 0, 243, 84, 349, 349, 0, 0, 0, 0, 0, 413, 0, 69, 374, 215, 0, 265, 274, 47, 245, 63, 110, 379); function Hash (S : String) return Natural is F : constant Natural := S'First - 1; L : constant Natural := S'Length; F1, F2 : Natural := 0; J : Natural; begin for K in P'Range loop exit when L < P (K); J := Character'Pos (S (P (K) + F)); F1 := (F1 + Natural (T1 (K)) * J) mod 833; F2 := (F2 + Natural (T2 (K)) * J) mod 833; end loop; return (Natural (G (F1)) + Natural (G (F2))) mod 416; end Hash; -- Returns true if the string <b>S</b> is a keyword. function Is_Keyword (S : in String) return Boolean is K : constant String := Util.Strings.Transforms.To_Upper_Case (S); H : constant Natural := Hash (K); begin return Keywords (H).all = K; end Is_Keyword; end PQ.Perfect_Hash;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Real_Time; use Ada.Real_Time; procedure Main is begin loop Put_Line ("Hello"); delay until Clock + Milliseconds (10); end loop; end Main;
package openGL.Model.capsule -- -- Provides an abstract base class for capsule models. -- is type Item is abstract new openGL.Model.item with null record; end openGL.Model.capsule;
package body STM32GD.Clock.Timer is procedure Init is begin null; end Init; procedure Delay_us (us : Natural) is begin null; end Delay_us; procedure Delay_ms (ms : Natural) is begin null; end Delay_ms; procedure Delay_s (s : Natural) is begin null; end Delay_s; end STM32GD.Clock.Timer;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2020, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of 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 HAL; with SAM.Device; with SAM.Port; with SAM.SERCOM.I2C; with SAM.SERCOM.SPI; package Minisamd51 is procedure Turn_On_LED; -- Turn on the red spaceship LED procedure Turn_Off_LED; -- Turn off the red spaceship LED function Button_Pressed return Boolean; -- Return True if the button the left leg of MiniSAM is pressed procedure Set_RGB (Brightness : HAL.UInt5; R, G, B : HAL.UInt8); -- Control the "dotstar" RGB LED -- IOs -- I2C_Port : SAM.SERCOM.I2C.I2C_Device renames SAM.Device.I2C2; SPI_Port : SAM.SERCOM.SPI.SPI_Device renames SAM.Device.SPI1; D0 : SAM.Port.GPIO_Point renames SAM.Device.PA16; D1 : SAM.Port.GPIO_Point renames SAM.Device.PA17; D2 : SAM.Port.GPIO_Point renames SAM.Device.PA07; D3 : SAM.Port.GPIO_Point renames SAM.Device.PA19; D4 : SAM.Port.GPIO_Point renames SAM.Device.PA20; D5 : SAM.Port.GPIO_Point renames SAM.Device.PA21; D9 : SAM.Port.GPIO_Point renames SAM.Device.PA02; D10 : SAM.Port.GPIO_Point renames SAM.Device.PB08; D11 : SAM.Port.GPIO_Point renames SAM.Device.PB09; D12 : SAM.Port.GPIO_Point renames SAM.Device.PA04; D13 : SAM.Port.GPIO_Point renames SAM.Device.PA05; D14 : SAM.Port.GPIO_Point renames SAM.Device.PA06; AREF : SAM.Port.GPIO_Point renames SAM.Device.PA03; A0 : SAM.Port.GPIO_Point renames D9; A1 : SAM.Port.GPIO_Point renames D10; A2 : SAM.Port.GPIO_Point renames D11; A3 : SAM.Port.GPIO_Point renames D12; A4 : SAM.Port.GPIO_Point renames D13; A5 : SAM.Port.GPIO_Point renames D14; A6 : SAM.Port.GPIO_Point renames D2; DAC1 : SAM.Port.GPIO_Point renames D9; DAC0 : SAM.Port.GPIO_Point renames D13; LED : SAM.Port.GPIO_Point renames SAM.Device.PA15; Button : SAM.Port.GPIO_Point renames SAM.Device.PA00; RX : SAM.Port.GPIO_Point renames D0; TX : SAM.Port.GPIO_Point renames D1; private SWDIO : SAM.Port.GPIO_Point renames SAM.Device.PA30; SWCLK : SAM.Port.GPIO_Point renames SAM.Device.PA31; -- I2C -- SCL : SAM.Port.GPIO_Point renames SAM.Device.PA13; SDA : SAM.Port.GPIO_Point renames SAM.Device.PA12; -- SPI -- MOSI : SAM.Port.GPIO_Point renames SAM.Device.PB22; MISO : SAM.Port.GPIO_Point renames SAM.Device.PB23; SCK : SAM.Port.GPIO_Point renames SAM.Device.PA01; QSPI_SCK : SAM.Port.GPIO_Point renames SAM.Device.PB10; QSPI_CS : SAM.Port.GPIO_Point renames SAM.Device.PB11; QSPI_D0 : SAM.Port.GPIO_Point renames SAM.Device.PA08; QSPI_D1 : SAM.Port.GPIO_Point renames SAM.Device.PA09; QSPI_D2 : SAM.Port.GPIO_Point renames SAM.Device.PA10; QSPI_D3 : SAM.Port.GPIO_Point renames SAM.Device.PA11; DOTSTAR_CLK : SAM.Port.GPIO_Point renames SAM.Device.PB02; DOTSTAR_DATA : SAM.Port.GPIO_Point renames SAM.Device.PB03; end Minisamd51;
------------------------------------------------------------------------------ -- -- -- THIS IS AN AUTOMATICALLY GENERATED FILE! DO NOT EDIT! -- -- -- -- WAVEFILES -- -- -- -- Test application -- -- -- -- The MIT License (MIT) -- -- -- -- Copyright (c) 2015 -- 2020 Gustavo A. Hoffmann -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining -- -- a copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, sublicense, and / or sell copies of the Software, and to -- -- permit persons to whom the Software is furnished to do so, subject to -- -- the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be -- -- included in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- -- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -- -- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -- -- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -- -- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Text_IO; use Ada.Text_IO; with Audio.Wavefiles; with Audio.Wavefiles.Report; use Audio.Wavefiles.Report; with Audio.Wavefiles.Generic_Fixed_PCM_IO; with Generic_Fixed_PCM_Buffer_Ops; package body Generic_Fixed_Wave_Test is package Wav renames Audio.Wavefiles; package PCM_IO is new Audio.Wavefiles.Generic_Fixed_PCM_IO (PCM_Sample => PCM_Sample, Channel_Range => Positive, PCM_MC_Sample => PCM_MC_Sample); use PCM_IO; package Fixed_PCM_Buffer_Ops is new Generic_Fixed_PCM_Buffer_Ops (PCM_Sample => PCM_Sample, PCM_MC_Sample => PCM_MC_Sample); use Fixed_PCM_Buffer_Ops; Verbose : constant Boolean := False; ----------------------- -- Display_Info_File -- ----------------------- procedure Display_Info_File (File_In : String) is WF_In : Audio.Wavefiles.Wavefile; begin WF_In.Open (Wav.In_File, File_In); Display_Info (WF_In); WF_In.Close; end Display_Info_File; --------------- -- Copy_File -- --------------- procedure Copy_File (File_In : String; File_Out : String) is WF_In : Audio.Wavefiles.Wavefile; WF_Out : Audio.Wavefiles.Wavefile; EOF : Boolean; Samples : Integer := 0; procedure Copy_PCM_MC_Sample; procedure Copy_PCM_MC_Sample is PCM_Buf : constant PCM_MC_Sample := Get (WF_In); begin EOF := WF_In.End_Of_File; Put (WF_Out, PCM_Buf); end Copy_PCM_MC_Sample; begin WF_In.Open (Wav.In_File, File_In); WF_Out.Set_Format_Of_Wavefile (WF_In.Format_Of_Wavefile); WF_Out.Create (Wav.Out_File, File_Out); if Verbose then Put_Line ("Input File:"); Display_Info (WF_In); Put_Line ("Output File:"); Display_Info (WF_Out); end if; loop Samples := Samples + 1; if Verbose then Put ("[" & Integer'Image (Samples) & "]"); end if; Copy_PCM_MC_Sample; exit when EOF; end loop; WF_In.Close; WF_Out.Close; end Copy_File; ------------------- -- Compare_Files -- ------------------- procedure Compare_Files (File_Ref : String; File_DUT : String) is WF_Ref : Audio.Wavefiles.Wavefile; WF_DUT : Audio.Wavefiles.Wavefile; EOF_Ref, EOF_DUT : Boolean; Diff_Sample : Natural := 0; Samples : Integer := 0; procedure Compare_PCM_MC_Sample; procedure Report_Comparison; procedure Compare_PCM_MC_Sample is PCM_Ref : constant PCM_MC_Sample := Get (WF_Ref); PCM_DUT : constant PCM_MC_Sample := Get (WF_DUT); begin EOF_Ref := WF_Ref.End_Of_File; EOF_DUT := WF_DUT.End_Of_File; if PCM_Ref /= PCM_DUT then Diff_Sample := Diff_Sample + 1; end if; end Compare_PCM_MC_Sample; procedure Report_Comparison is begin Put_Line ("Compared " & Samples'Image & " samples"); if Diff_Sample > 0 then Put_Line ("Differences have been found in " & Natural'Image (Diff_Sample) & " samples"); else Put_Line ("No differences have been found"); end if; end Report_Comparison; begin WF_Ref.Open (Wav.In_File, File_Ref); WF_DUT.Open (Wav.In_File, File_DUT); loop Samples := Samples + 1; Compare_PCM_MC_Sample; exit when EOF_Ref or EOF_DUT; end loop; WF_Ref.Close; WF_DUT.Close; Report_Comparison; end Compare_Files; ---------------- -- Diff_Files -- ---------------- procedure Diff_Files (File_Ref : String; File_DUT : String; File_Diff : String) is WF_Ref : Audio.Wavefiles.Wavefile; WF_DUT : Audio.Wavefiles.Wavefile; WF_Diff : Audio.Wavefiles.Wavefile; EOF_Ref, EOF_DUT : Boolean; procedure Diff_PCM_MC_Sample; procedure Diff_PCM_MC_Sample is PCM_Ref : constant PCM_MC_Sample := Get (WF_Ref); PCM_DUT : constant PCM_MC_Sample := Get (WF_DUT); PCM_Diff : constant PCM_MC_Sample := PCM_Ref - PCM_DUT; begin EOF_Ref := WF_Ref.End_Of_File; EOF_DUT := WF_DUT.End_Of_File; Put (WF_Diff, PCM_Diff); end Diff_PCM_MC_Sample; begin WF_Ref.Open (Wav.In_File, File_Ref); WF_DUT.Open (Wav.In_File, File_DUT); WF_Diff.Set_Format_Of_Wavefile (WF_Ref.Format_Of_Wavefile); WF_Diff.Create (Wav.Out_File, File_Diff); loop Diff_PCM_MC_Sample; exit when EOF_Ref or EOF_DUT; end loop; WF_Ref.Close; WF_DUT.Close; WF_Diff.Close; end Diff_Files; --------------- -- Mix_Files -- --------------- procedure Mix_Files (File_Ref : String; File_DUT : String; File_Mix : String) is WF_Ref : Audio.Wavefiles.Wavefile; WF_DUT : Audio.Wavefiles.Wavefile; WF_Mix : Audio.Wavefiles.Wavefile; EOF_Ref, EOF_DUT : Boolean; procedure Mix_PCM_MC_Sample; procedure Mix_PCM_MC_Sample is PCM_Ref : constant PCM_MC_Sample := Get (WF_Ref); PCM_DUT : constant PCM_MC_Sample := Get (WF_DUT); PCM_Mix : constant PCM_MC_Sample := PCM_Ref + PCM_DUT; begin EOF_Ref := WF_Ref.End_Of_File; EOF_DUT := WF_DUT.End_Of_File; Put (WF_Mix, PCM_Mix); end Mix_PCM_MC_Sample; begin WF_Ref.Open (Wav.In_File, File_Ref); WF_DUT.Open (Wav.In_File, File_DUT); WF_Mix.Set_Format_Of_Wavefile (WF_Ref.Format_Of_Wavefile); WF_Mix.Create (Wav.Out_File, File_Mix); loop Mix_PCM_MC_Sample; exit when EOF_Ref or EOF_DUT; end loop; WF_Ref.Close; WF_DUT.Close; WF_Mix.Close; end Mix_Files; end Generic_Fixed_Wave_Test;
with Fakedsp.Card; package Notch_Example.filters is type Normalized_Frequency is digits 16 range 0.0 .. 1.0; type Notch_Filter is new Fakedsp.Card.Callback_Handler with private; type Filter_Access is access Notch_Filter; function New_Filter (F0 : Normalized_Frequency; R : Float; Gain : Float := 1.0) return Filter_Access; -- Create a notch filter removing the specified normalized frequency -- and with the compensation poles placed at radius R. A global gain -- can be specified. procedure Sample_Ready (X : in out Notch_Filter); -- Callback function required by the Callback_Handler interface private type Memory_Type is array (1 .. 2) of Float; type Notch_Filter is new Fakedsp.Card.Callback_Handler with record Num0, Num1, Num2 : Float; -- Numerator coefficients Den1, Den2 : Float; -- Denominator coefficients Status : Memory_Type; -- Past samples Gain : Float; -- end record; end Notch_Example.Filters;
-- -- -- package Copyright (c) Dmitry A. Kazakov -- -- Strings_Edit.Streams Luebeck -- -- Implementation Spring, 2009 -- -- -- -- Last revision : 13:11 14 Sep 2019 -- -- -- -- 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. -- --____________________________________________________________________-- -- with Ada.IO_Exceptions; use Ada.IO_Exceptions; package body Strings_Edit.Streams is procedure Increment ( Left : in out Integer; Right : Stream_Element_Offset ) is pragma Inline (Increment); begin Left := Left + Integer (Right) * Char_Count; end Increment; function Get (Stream : String_Stream) return String is begin return Stream.Data (1..Stream.Position - 1); end Get; function Get_Size (Stream : String_Stream) return Stream_Element_Count is begin return ( Stream_Element_Offset (Stream.Data'Last - Stream.Position + 1) / Char_Count ); end Get_Size; procedure Read ( Stream : in out String_Stream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset ) is begin if Stream.Position > Stream.Length then raise End_Error; end if; declare subtype Space is Stream_Element_Array (1..Get_Size (Stream)); Data : Space; pragma Import (Ada, Data); for Data'Address use Stream.Data (Stream.Position)'Address; begin if Space'Length >= Item'Length then Last := Item'Last; Item := Data (1..Item'Length); Increment (Stream.Position, Item'Length); else Last := Item'First + Data'Length - 1; Item (Item'First..Last) := Data; Stream.Position := Stream.Data'Last + 1; end if; end; end Read; procedure Rewind (Stream : in out String_Stream) is begin Stream.Position := 1; end Rewind; procedure Set (Stream : in out String_Stream; Content : String) is begin if Content'Length > Stream.Length then raise Constraint_Error; end if; Stream.Position := Stream.Length - Content'Length + 1; Stream.Data (Stream.Position..Stream.Length) := Content; end Set; procedure Write ( Stream : in out String_Stream; Item : Stream_Element_Array ) is begin if Stream.Position > Stream.Length then raise End_Error; end if; declare subtype Space is Stream_Element_Array (1..Get_Size (Stream)); Data : Space; pragma Import (Ada, Data); for Data'Address use Stream.Data (Stream.Position)'Address; begin if Item'Length > Space'Length then raise End_Error; end if; Data (1..Item'Length) := Item; Increment (Stream.Position, Item'Length); end; end Write; end Strings_Edit.Streams;
-- Abstract : -- -- A generic doubly linked list with indefinite elements, allowing -- permanent references to elements. -- -- Copyright (C) 2018 - 2019 Free Software Foundation, Inc. -- -- 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 COPYING. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- MA 02111-1307, USA. -- -- 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. pragma License (Modified_GPL); with Ada.Finalization; with Ada.Unchecked_Deallocation; generic type Element_Type (<>) is private; package SAL.Gen_Indefinite_Doubly_Linked_Lists is type List is new Ada.Finalization.Controlled with private; Empty_List : constant List; overriding procedure Adjust (Container : in out List); -- Deep copy. overriding procedure Finalize (Container : in out List); -- Free all items in List. function Length (Container : in List) return Base_Peek_Type; procedure Append (Container : in out List; Element : in Element_Type); procedure Prepend (Container : in out List; Element : in Element_Type); type Cursor is private; No_Element : constant Cursor; function Has_Element (Position : in Cursor) return Boolean; function First (Container : in List) return Cursor; procedure Next (Position : in out Cursor); function Next (Position : in Cursor) return Cursor; function Element (Position : in Cursor) return Element_Type with Pre => Has_Element (Position); procedure Delete (Container : in out List; Position : in out Cursor) with Pre => Has_Element (Position); function Persistent_Ref (Position : in Cursor) return access Element_Type with Pre => Has_Element (Position); type Constant_Reference_Type (Element : not null access constant Element_Type) is null record with Implicit_Dereference => Element; function Constant_Reference (Position : in Cursor) return Constant_Reference_Type with Pre => Has_Element (Position); pragma Inline (Constant_Reference); function Constant_Ref (Container : in List'Class; Position : in Peek_Type) return Constant_Reference_Type with Pre => Position <= Container.Length; pragma Inline (Constant_Ref); type Reference_Type (Element : not null access Element_Type) is null record with Implicit_Dereference => Element; function Reference (Position : in Cursor) return Reference_Type with Pre => Has_Element (Position); pragma Inline (Reference); private type Node_Type; type Node_Access is access Node_Type; type Element_Access is access Element_Type; type Node_Type is record Element : Element_Access; Prev : Node_Access; Next : Node_Access; end record; procedure Free is new Ada.Unchecked_Deallocation (Node_Type, Node_Access); procedure Free is new Ada.Unchecked_Deallocation (Element_Type, Element_Access); type List is new Ada.Finalization.Controlled with record Head : Node_Access := null; Tail : Node_Access := null; Count : SAL.Base_Peek_Type := 0; end record; type Cursor is record Container : access List; Ptr : Node_Access; end record; Empty_List : constant List := (Ada.Finalization.Controlled with null, null, 0); No_Element : constant Cursor := (null, null); end SAL.Gen_Indefinite_Doubly_Linked_Lists;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Element_Vectors; with Program.Elements.Paths; with Program.Lexical_Elements; with Program.Elements.Expressions; package Program.Elements.Case_Expression_Paths is pragma Pure (Program.Elements.Case_Expression_Paths); type Case_Expression_Path is limited interface and Program.Elements.Paths.Path; type Case_Expression_Path_Access is access all Case_Expression_Path'Class with Storage_Size => 0; not overriding function Choices (Self : Case_Expression_Path) return not null Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function Expression (Self : Case_Expression_Path) return not null Program.Elements.Expressions.Expression_Access is abstract; type Case_Expression_Path_Text is limited interface; type Case_Expression_Path_Text_Access is access all Case_Expression_Path_Text'Class with Storage_Size => 0; not overriding function To_Case_Expression_Path_Text (Self : in out Case_Expression_Path) return Case_Expression_Path_Text_Access is abstract; not overriding function When_Token (Self : Case_Expression_Path_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Arrow_Token (Self : Case_Expression_Path_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; type Case_Expression_Path_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Case_Expression_Path_Vector_Access is access all Case_Expression_Path_Vector'Class with Storage_Size => 0; overriding function Element (Self : Case_Expression_Path_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Case_Expression_Path; function To_Case_Expression_Path (Self : Case_Expression_Path_Vector'Class; Index : Positive) return not null Case_Expression_Path_Access is (Self.Element (Index).To_Case_Expression_Path); end Program.Elements.Case_Expression_Paths;
-- -- Raytracer implementation in Ada -- by John Perry (github: johnperry-math) -- 2021 -- -- specification for 3d Vectors, which describe positions, directions, etc. -- -- local packages with RayTracing_Constants; use RayTracing_Constants; -- @summary 3d Vectors, which describe positions, directions, etc. package Vectors is type Vector is record X, Y, Z: Float15; end record; -- 3-dimensional vectors function Create_Vector(X, Y, Z: Float15) return Vector; -- sets the Vector in the way you'd think pragma Inline_Always(Create_Vector); function Cross_Product(First, Second: Vector) return Vector; -- returns the cross product of First and Second pragma Inline_Always(Cross_Product); function Length(V: Vector) return Float15; -- Euclidean length of V pragma Inline_Always(Length); function Scale(V: Vector; K: Float15) return Vector; -- scales V by a factor of K pragma Inline_Always(Scale); function "*"(V: Vector; K: Float15) return Vector renames Scale; -- scales V by a factor of K procedure Self_Scale(V: in out Vector; K: Float15); -- scales V by a factor of K and stores result in V pragma Inline_Always(Self_Scale); function Normal(V: Vector) return Vector; -- returns a normalized V pragma Inline_Always(Normal); function "abs"(V: Vector) return Vector renames Normal; procedure Self_Norm(V: in out Vector); -- normalizes V pragma Inline_Always(Self_Norm); function Dot_Product(First, Second: Vector) return Float15; -- returns the dot product of First and Second pragma Inline_Always(Dot_Product); function "*"(First, Second: Vector) return Float15 renames Dot_Product; function "+"(First, Second: Vector) return Vector; -- returns the sum of First and Second pragma Inline_Always("+"); function "-"(First, Second: Vector) return Vector; -- returns the difference of First and Second pragma Inline_Always("-"); end Vectors;
----------------------------------------------------------------------- -- asf-navigations -- Navigations -- Copyright (C) 2010, 2011, 2012, 2013, 2018, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Components.Root; with Util.Strings; with Util.Beans.Objects; with Util.Log.Loggers; with Ada.Unchecked_Deallocation; with ASF.Navigations.Render; package body ASF.Navigations is -- ------------------------------ -- Navigation Case -- ------------------------------ -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ASF.Navigations"); -- ------------------------------ -- Check if the navigator specific condition matches the current execution context. -- ------------------------------ function Matches (Navigator : in Navigation_Case; Action : in String; Outcome : in String; Context : in ASF.Contexts.Faces.Faces_Context'Class) return Boolean is begin -- outcome must match if Navigator.Outcome /= null and then Navigator.Outcome.all /= Outcome then return False; end if; -- action must match if Navigator.Action /= null and then Navigator.Action.all /= Action then return False; end if; -- condition must be true if not Navigator.Condition.Is_Constant then declare Value : constant Util.Beans.Objects.Object := Navigator.Condition.Get_Value (Context.Get_ELContext.all); begin if not Util.Beans.Objects.To_Boolean (Value) then return False; end if; end; end if; return True; end Matches; -- ------------------------------ -- Navigation Rule -- ------------------------------ -- ------------------------------ -- Search for the navigator that matches the current action, outcome and context. -- Returns the navigator or null if there was no match. -- ------------------------------ function Find_Navigation (Controller : in Rule; Action : in String; Outcome : in String; Context : in Contexts.Faces.Faces_Context'Class) return Navigation_Access is Iter : Navigator_Vector.Cursor := Controller.Navigators.First; Navigator : Navigation_Access; begin while Navigator_Vector.Has_Element (Iter) loop Navigator := Navigator_Vector.Element (Iter); -- Check if this navigator matches the action/outcome. if Navigator.Matches (Action, Outcome, Context) then return Navigator; end if; Navigator_Vector.Next (Iter); end loop; return null; end Find_Navigation; -- ------------------------------ -- Clear the navigation rules. -- ------------------------------ procedure Clear (Controller : in out Rule) is procedure Free is new Ada.Unchecked_Deallocation (Navigation_Case'Class, Navigation_Access); begin while not Controller.Navigators.Is_Empty loop declare Iter : Navigator_Vector.Cursor := Controller.Navigators.Last; Navigator : Navigation_Access := Navigator_Vector.Element (Iter); begin Free (Navigator.Outcome); Free (Navigator.Action); Free (Navigator); Controller.Navigators.Delete (Iter); end; end loop; end Clear; -- ------------------------------ -- Clear the navigation rules. -- ------------------------------ procedure Clear (Controller : in out Navigation_Rules) is procedure Free is new Ada.Unchecked_Deallocation (Rule'Class, Rule_Access); begin while not Controller.Rules.Is_Empty loop declare Iter : Rule_Map.Cursor := Controller.Rules.First; Rule : Rule_Access := Rule_Map.Element (Iter); begin Rule.Clear; Free (Rule); Controller.Rules.Delete (Iter); end; end loop; end Clear; -- ------------------------------ -- Navigation Handler -- ------------------------------ -- ------------------------------ -- Provide a default navigation rules for the view and the outcome when no application -- navigation was found. The default looks for an XHTML file in the same directory as -- the view and which has the base name defined by <b>Outcome</b>. -- ------------------------------ procedure Handle_Default_Navigation (Handler : in Navigation_Handler; View : in String; Outcome : in String; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is Pos : constant Natural := Util.Strings.Rindex (View, '/'); Root : Components.Root.UIViewRoot; begin if Pos > 0 then declare Name : constant String := View (View'First .. Pos) & Outcome; begin Log.Debug ("Using default navigation from view {0} to {1}", View, Name); Handler.View_Handler.Create_View (Name, Context, Root, Ignore => True); end; else Log.Debug ("Using default navigation from view {0} to {1}", View, View); Handler.View_Handler.Create_View (Outcome, Context, Root, Ignore => True); end if; -- If the 'outcome' refers to a real view, use it. Otherwise keep the current view. if Components.Root.Get_Root (Root) /= null then Context.Set_View_Root (Root); end if; exception when others => Log.Debug ("No suitable navigation rule to navigate from view {0}: {1}", View, Outcome); raise; end Handle_Default_Navigation; -- ------------------------------ -- After executing an action and getting the action outcome, proceed to the navigation -- to the next page. -- ------------------------------ procedure Handle_Navigation (Handler : in Navigation_Handler; Action : in String; Outcome : in String; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is Nav_Rules : constant Navigation_Rules_Access := Handler.Rules; View : constant Components.Root.UIViewRoot := Context.Get_View_Root; Name : constant String := Components.Root.Get_View_Id (View); function Find_Navigation (View : in String) return Navigation_Access; function Find_Navigation (View : in String) return Navigation_Access is Pos : constant Rule_Map.Cursor := Nav_Rules.Rules.Find (To_Unbounded_String (View)); begin if not Rule_Map.Has_Element (Pos) then return null; end if; return Rule_Map.Element (Pos).Find_Navigation (Action, Outcome, Context); end Find_Navigation; Navigator : Navigation_Access; begin Log.Info ("Navigate from view {0} and action {1} with outcome {2}", Name, Action, Outcome); -- Find an exact match Navigator := Find_Navigation (Name); -- Find a wildcard match if Navigator = null then declare Last : Natural := Name'Last; N : Natural; begin loop N := Util.Strings.Rindex (Name, '/', Last); exit when N = 0; Navigator := Find_Navigation (Name (Name'First .. N) & "*"); exit when Navigator /= null or N = Name'First; Last := N - 1; end loop; end; end if; -- Execute the navigation action. if Navigator /= null then Navigator.Navigate (Context); else Log.Debug ("No navigation rule found for view {0}, action {1} and outcome {2}", Name, Action, Outcome); Navigation_Handler'Class (Handler).Handle_Default_Navigation (Name, Outcome, Context); end if; end Handle_Navigation; -- ------------------------------ -- Initialize the the lifecycle handler. -- ------------------------------ procedure Initialize (Handler : in out Navigation_Handler; Views : ASF.Applications.Views.View_Handler_Access) is begin Handler.Rules := new Navigation_Rules; Handler.View_Handler := Views; end Initialize; -- ------------------------------ -- Free the storage used by the navigation handler. -- ------------------------------ overriding procedure Finalize (Handler : in out Navigation_Handler) is procedure Free is new Ada.Unchecked_Deallocation (Navigation_Rules, Navigation_Rules_Access); begin if Handler.Rules /= null then Clear (Handler.Rules.all); Free (Handler.Rules); end if; end Finalize; -- ------------------------------ -- Add a navigation case to navigate from the view identifier by <b>From</b> -- to the result view identified by <b>To</b>. Some optional conditions are evaluated -- The <b>Outcome</b> must match unless it is empty. -- The <b>Action</b> must match unless it is empty. -- The <b>Condition</b> expression must evaluate to True. -- ------------------------------ procedure Add_Navigation_Case (Handler : in out Navigation_Handler; From : in String; To : in String; Outcome : in String := ""; Action : in String := ""; Condition : in String := ""; Context : in EL.Contexts.ELContext'Class) is C : constant Navigation_Access := Render.Create_Render_Navigator (To, 0); begin Handler.Add_Navigation_Case (C, From, Outcome, Action, Condition, Context); end Add_Navigation_Case; -- ------------------------------ -- Add a navigation case to navigate from the view identifier by <b>From</b> -- by using the navigation rule defined by <b>Navigator</b>. -- Some optional conditions are evaluated: -- The <b>Outcome</b> must match unless it is empty. -- The <b>Action</b> must match unless it is empty. -- The <b>Condition</b> expression must evaluate to True. -- ------------------------------ procedure Add_Navigation_Case (Handler : in out Navigation_Handler'Class; Navigator : in Navigation_Access; From : in String; Outcome : in String := ""; Action : in String := ""; Condition : in String := ""; Context : in EL.Contexts.ELContext'Class) is begin Log.Info ("Add navigation from {0} with outcome {1}", From, Outcome); if Outcome'Length > 0 then Navigator.Outcome := new String '(Outcome); end if; if Action'Length > 0 then Navigator.Action := new String '(Action); end if; -- if Handler.View_Handler = null then -- Handler.View_Handler := Handler.Application.Get_View_Handler; -- end if; if Condition'Length > 0 then Navigator.Condition := EL.Expressions.Create_Expression (Condition, Context); end if; Navigator.View_Handler := Handler.View_Handler; declare View : constant Unbounded_String := To_Unbounded_String (From); Pos : constant Rule_Map.Cursor := Handler.Rules.Rules.Find (View); R : Rule_Access; begin if not Rule_Map.Has_Element (Pos) then R := new Rule; Handler.Rules.Rules.Include (Key => View, New_Item => R); else R := Rule_Map.Element (Pos); end if; R.Navigators.Append (Navigator); end; end Add_Navigation_Case; end ASF.Navigations;
-- { dg-do run } with Ada.Text_IO; use Ada.Text_IO; procedure Test_Enum_IO is type Enum is (Literal); package Enum_IO is new Enumeration_IO (Enum); use Enum_IO; File : File_Type; Value: Enum; Rest : String (1 ..30); Last : Natural; begin Create (File, Mode => Out_File); Put_Line (File, "Literax0000000l note the 'l' at the end"); Reset (File, Mode => In_File); Get (File, Value); Get_Line (File, Rest, Last); Close (File); Put_Line (Enum'Image (Value) & Rest (1 .. Last)); raise Program_Error; exception when Data_Error => null; end Test_Enum_IO;
with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Core; with SPARKNaCl.Secretbox; use SPARKNaCl.Secretbox; with SPARKNaCl.Stream; with Random; with Ada.Text_IO; use Ada.Text_IO; with Interfaces; use Interfaces; procedure Secretbox7 is RK : Bytes_32; K : Core.Salsa20_Key; N : Stream.HSalsa20_Nonce; S, S2 : Boolean; begin for MLen in N32 range 0 .. 999 loop Random.Random_Bytes (RK); Core.Construct (K, RK); Random.Random_Bytes (Bytes_24 (N)); Put ("Secretbox7 - iteration" & MLen'Img); declare subtype Text is Byte_Seq (0 .. Secretbox_Zero_Bytes + MLen - 1); M, C, M2 : Text := (others => 0); begin Random.Random_Bytes (M (Secretbox_Zero_Bytes .. M'Last)); Create (C, S, M, N, K); if S then Open (M2, S2, C, N, K); if S2 then if not Equal (M, M2) then Put_Line ("bad decryption"); exit; else Put_Line (" OK"); end if; else Put_Line ("ciphertext fails verification"); exit; end if; else Put_Line ("bad encryption"); exit; end if; end; end loop; end Secretbox7;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Declarations; with Program.Lexical_Elements; with Program.Elements.Defining_Names; with Program.Elements.Expressions; with Program.Elements.Parameter_Associations; with Program.Elements.Aspect_Specifications; package Program.Elements.Package_Instantiations is pragma Pure (Program.Elements.Package_Instantiations); type Package_Instantiation is limited interface and Program.Elements.Declarations.Declaration; type Package_Instantiation_Access is access all Package_Instantiation'Class with Storage_Size => 0; not overriding function Name (Self : Package_Instantiation) return not null Program.Elements.Defining_Names.Defining_Name_Access is abstract; not overriding function Generic_Package_Name (Self : Package_Instantiation) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Parameters (Self : Package_Instantiation) return Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access is abstract; not overriding function Aspects (Self : Package_Instantiation) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is abstract; type Package_Instantiation_Text is limited interface; type Package_Instantiation_Text_Access is access all Package_Instantiation_Text'Class with Storage_Size => 0; not overriding function To_Package_Instantiation_Text (Self : in out Package_Instantiation) return Package_Instantiation_Text_Access is abstract; not overriding function Package_Token (Self : Package_Instantiation_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Is_Token (Self : Package_Instantiation_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function New_Token (Self : Package_Instantiation_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Left_Bracket_Token (Self : Package_Instantiation_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Package_Instantiation_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function With_Token (Self : Package_Instantiation_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Package_Instantiation_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Package_Instantiations;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . F O R M A L _ O R D E R E D _ M A P S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2010-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- ------------------------------------------------------------------------------ with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations); with Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys; pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys); with System; use type System.Address; package body Ada.Containers.Formal_Ordered_Maps with SPARK_Mode => Off is ----------------------------- -- Node Access Subprograms -- ----------------------------- -- These subprograms provide a functional interface to access fields -- of a node, and a procedural interface for modifying these values. function Color (Node : Node_Type) return Ada.Containers.Red_Black_Trees.Color_Type; pragma Inline (Color); function Left_Son (Node : Node_Type) return Count_Type; pragma Inline (Left_Son); function Parent (Node : Node_Type) return Count_Type; pragma Inline (Parent); function Right_Son (Node : Node_Type) return Count_Type; pragma Inline (Right_Son); procedure Set_Color (Node : in out Node_Type; Color : Ada.Containers.Red_Black_Trees.Color_Type); pragma Inline (Set_Color); procedure Set_Left (Node : in out Node_Type; Left : Count_Type); pragma Inline (Set_Left); procedure Set_Right (Node : in out Node_Type; Right : Count_Type); pragma Inline (Set_Right); procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type); pragma Inline (Set_Parent); ----------------------- -- Local Subprograms -- ----------------------- -- All need comments ??? generic with procedure Set_Element (Node : in out Node_Type); procedure Generic_Allocate (Tree : in out Tree_Types.Tree_Type'Class; Node : out Count_Type); procedure Free (Tree : in out Map; X : Count_Type); function Is_Greater_Key_Node (Left : Key_Type; Right : Node_Type) return Boolean; pragma Inline (Is_Greater_Key_Node); function Is_Less_Key_Node (Left : Key_Type; Right : Node_Type) return Boolean; pragma Inline (Is_Less_Key_Node); -------------------------- -- Local Instantiations -- -------------------------- package Tree_Operations is new Red_Black_Trees.Generic_Bounded_Operations (Tree_Types => Tree_Types, Left => Left_Son, Right => Right_Son); use Tree_Operations; package Key_Ops is new Red_Black_Trees.Generic_Bounded_Keys (Tree_Operations => Tree_Operations, Key_Type => Key_Type, Is_Less_Key_Node => Is_Less_Key_Node, Is_Greater_Key_Node => Is_Greater_Key_Node); --------- -- "=" -- --------- function "=" (Left, Right : Map) return Boolean is Lst : Count_Type; Node : Count_Type; ENode : Count_Type; begin if Length (Left) /= Length (Right) then return False; end if; if Is_Empty (Left) then return True; end if; Lst := Next (Left, Last (Left).Node); Node := First (Left).Node; while Node /= Lst loop ENode := Find (Right, Left.Nodes (Node).Key).Node; if ENode = 0 or else Left.Nodes (Node).Element /= Right.Nodes (ENode).Element then return False; end if; Node := Next (Left, Node); end loop; return True; end "="; ------------ -- Assign -- ------------ procedure Assign (Target : in out Map; Source : Map) is procedure Append_Element (Source_Node : Count_Type); procedure Append_Elements is new Tree_Operations.Generic_Iteration (Append_Element); -------------------- -- Append_Element -- -------------------- procedure Append_Element (Source_Node : Count_Type) is SN : Node_Type renames Source.Nodes (Source_Node); procedure Set_Element (Node : in out Node_Type); pragma Inline (Set_Element); function New_Node return Count_Type; pragma Inline (New_Node); procedure Insert_Post is new Key_Ops.Generic_Insert_Post (New_Node); procedure Unconditional_Insert_Sans_Hint is new Key_Ops.Generic_Unconditional_Insert (Insert_Post); procedure Unconditional_Insert_Avec_Hint is new Key_Ops.Generic_Unconditional_Insert_With_Hint (Insert_Post, Unconditional_Insert_Sans_Hint); procedure Allocate is new Generic_Allocate (Set_Element); -------------- -- New_Node -- -------------- function New_Node return Count_Type is Result : Count_Type; begin Allocate (Target, Result); return Result; end New_Node; ----------------- -- Set_Element -- ----------------- procedure Set_Element (Node : in out Node_Type) is begin Node.Key := SN.Key; Node.Element := SN.Element; end Set_Element; Target_Node : Count_Type; -- Start of processing for Append_Element begin Unconditional_Insert_Avec_Hint (Tree => Target, Hint => 0, Key => SN.Key, Node => Target_Node); end Append_Element; -- Start of processing for Assign begin if Target'Address = Source'Address then return; end if; if Target.Capacity < Length (Source) then raise Storage_Error with "not enough capacity"; -- SE or CE? ??? end if; Tree_Operations.Clear_Tree (Target); Append_Elements (Source); end Assign; ------------- -- Ceiling -- ------------- function Ceiling (Container : Map; Key : Key_Type) return Cursor is Node : constant Count_Type := Key_Ops.Ceiling (Container, Key); begin if Node = 0 then return No_Element; end if; return (Node => Node); end Ceiling; ----------- -- Clear -- ----------- procedure Clear (Container : in out Map) is begin Tree_Operations.Clear_Tree (Container); end Clear; ----------- -- Color -- ----------- function Color (Node : Node_Type) return Color_Type is begin return Node.Color; end Color; -------------- -- Contains -- -------------- function Contains (Container : Map; Key : Key_Type) return Boolean is begin return Find (Container, Key) /= No_Element; end Contains; ---------- -- Copy -- ---------- function Copy (Source : Map; Capacity : Count_Type := 0) return Map is Node : Count_Type := 1; N : Count_Type; begin if 0 < Capacity and then Capacity < Source.Capacity then raise Capacity_Error; end if; return Target : Map (Count_Type'Max (Source.Capacity, Capacity)) do if Length (Source) > 0 then Target.Length := Source.Length; Target.Root := Source.Root; Target.First := Source.First; Target.Last := Source.Last; Target.Free := Source.Free; while Node <= Source.Capacity loop Target.Nodes (Node).Element := Source.Nodes (Node).Element; Target.Nodes (Node).Key := Source.Nodes (Node).Key; Target.Nodes (Node).Parent := Source.Nodes (Node).Parent; Target.Nodes (Node).Left := Source.Nodes (Node).Left; Target.Nodes (Node).Right := Source.Nodes (Node).Right; Target.Nodes (Node).Color := Source.Nodes (Node).Color; Target.Nodes (Node).Has_Element := Source.Nodes (Node).Has_Element; Node := Node + 1; end loop; while Node <= Target.Capacity loop N := Node; Formal_Ordered_Maps.Free (Tree => Target, X => N); Node := Node + 1; end loop; end if; end return; end Copy; --------------------- -- Current_To_Last -- --------------------- function Current_To_Last (Container : Map; Current : Cursor) return Map is Curs : Cursor := First (Container); C : Map (Container.Capacity) := Copy (Container, Container.Capacity); Node : Count_Type; begin if Curs = No_Element then Clear (C); return C; elsif Current /= No_Element and not Has_Element (Container, Current) then raise Constraint_Error; else while Curs.Node /= Current.Node loop Node := Curs.Node; Delete (C, Curs); Curs := Next (Container, (Node => Node)); end loop; return C; end if; end Current_To_Last; ------------ -- Delete -- ------------ procedure Delete (Container : in out Map; Position : in out Cursor) is begin if not Has_Element (Container, Position) then raise Constraint_Error with "Position cursor of Delete has no element"; end if; pragma Assert (Vet (Container, Position.Node), "Position cursor of Delete is bad"); Tree_Operations.Delete_Node_Sans_Free (Container, Position.Node); Formal_Ordered_Maps.Free (Container, Position.Node); end Delete; procedure Delete (Container : in out Map; Key : Key_Type) is X : constant Node_Access := Key_Ops.Find (Container, Key); begin if X = 0 then raise Constraint_Error with "key not in map"; end if; Tree_Operations.Delete_Node_Sans_Free (Container, X); Formal_Ordered_Maps.Free (Container, X); end Delete; ------------------ -- Delete_First -- ------------------ procedure Delete_First (Container : in out Map) is X : constant Node_Access := First (Container).Node; begin if X /= 0 then Tree_Operations.Delete_Node_Sans_Free (Container, X); Formal_Ordered_Maps.Free (Container, X); end if; end Delete_First; ----------------- -- Delete_Last -- ----------------- procedure Delete_Last (Container : in out Map) is X : constant Node_Access := Last (Container).Node; begin if X /= 0 then Tree_Operations.Delete_Node_Sans_Free (Container, X); Formal_Ordered_Maps.Free (Container, X); end if; end Delete_Last; ------------- -- Element -- ------------- function Element (Container : Map; Position : Cursor) return Element_Type is begin if not Has_Element (Container, Position) then raise Constraint_Error with "Position cursor of function Element has no element"; end if; pragma Assert (Vet (Container, Position.Node), "Position cursor of function Element is bad"); return Container.Nodes (Position.Node).Element; end Element; function Element (Container : Map; Key : Key_Type) return Element_Type is Node : constant Node_Access := Find (Container, Key).Node; begin if Node = 0 then raise Constraint_Error with "key not in map"; end if; return Container.Nodes (Node).Element; end Element; --------------------- -- Equivalent_Keys -- --------------------- function Equivalent_Keys (Left, Right : Key_Type) return Boolean is begin if Left < Right or else Right < Left then return False; else return True; end if; end Equivalent_Keys; ------------- -- Exclude -- ------------- procedure Exclude (Container : in out Map; Key : Key_Type) is X : constant Node_Access := Key_Ops.Find (Container, Key); begin if X /= 0 then Tree_Operations.Delete_Node_Sans_Free (Container, X); Formal_Ordered_Maps.Free (Container, X); end if; end Exclude; ---------- -- Find -- ---------- function Find (Container : Map; Key : Key_Type) return Cursor is Node : constant Count_Type := Key_Ops.Find (Container, Key); begin if Node = 0 then return No_Element; end if; return (Node => Node); end Find; ----------- -- First -- ----------- function First (Container : Map) return Cursor is begin if Length (Container) = 0 then return No_Element; end if; return (Node => Container.First); end First; ------------------- -- First_Element -- ------------------- function First_Element (Container : Map) return Element_Type is begin if Is_Empty (Container) then raise Constraint_Error with "map is empty"; end if; return Container.Nodes (First (Container).Node).Element; end First_Element; --------------- -- First_Key -- --------------- function First_Key (Container : Map) return Key_Type is begin if Is_Empty (Container) then raise Constraint_Error with "map is empty"; end if; return Container.Nodes (First (Container).Node).Key; end First_Key; ----------------------- -- First_To_Previous -- ----------------------- function First_To_Previous (Container : Map; Current : Cursor) return Map is Curs : Cursor := Current; C : Map (Container.Capacity) := Copy (Container, Container.Capacity); Node : Count_Type; begin if Curs = No_Element then return C; elsif not Has_Element (Container, Curs) then raise Constraint_Error; else while Curs.Node /= 0 loop Node := Curs.Node; Delete (C, Curs); Curs := Next (Container, (Node => Node)); end loop; return C; end if; end First_To_Previous; ----------- -- Floor -- ----------- function Floor (Container : Map; Key : Key_Type) return Cursor is Node : constant Count_Type := Key_Ops.Floor (Container, Key); begin if Node = 0 then return No_Element; end if; return (Node => Node); end Floor; ---------- -- Free -- ---------- procedure Free (Tree : in out Map; X : Count_Type) is begin Tree.Nodes (X).Has_Element := False; Tree_Operations.Free (Tree, X); end Free; ---------------------- -- Generic_Allocate -- ---------------------- procedure Generic_Allocate (Tree : in out Tree_Types.Tree_Type'Class; Node : out Count_Type) is procedure Allocate is new Tree_Operations.Generic_Allocate (Set_Element); begin Allocate (Tree, Node); Tree.Nodes (Node).Has_Element := True; end Generic_Allocate; ----------------- -- Has_Element -- ----------------- function Has_Element (Container : Map; Position : Cursor) return Boolean is begin if Position.Node = 0 then return False; end if; return Container.Nodes (Position.Node).Has_Element; end Has_Element; ------------- -- Include -- ------------- procedure Include (Container : in out Map; Key : Key_Type; New_Item : Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, Key, New_Item, Position, Inserted); if not Inserted then declare N : Node_Type renames Container.Nodes (Position.Node); begin N.Key := Key; N.Element := New_Item; end; end if; end Include; procedure Insert (Container : in out Map; Key : Key_Type; New_Item : Element_Type; Position : out Cursor; Inserted : out Boolean) is function New_Node return Node_Access; -- Comment ??? procedure Insert_Post is new Key_Ops.Generic_Insert_Post (New_Node); procedure Insert_Sans_Hint is new Key_Ops.Generic_Conditional_Insert (Insert_Post); -------------- -- New_Node -- -------------- function New_Node return Node_Access is procedure Initialize (Node : in out Node_Type); procedure Allocate_Node is new Generic_Allocate (Initialize); procedure Initialize (Node : in out Node_Type) is begin Node.Key := Key; Node.Element := New_Item; end Initialize; X : Node_Access; begin Allocate_Node (Container, X); return X; end New_Node; -- Start of processing for Insert begin Insert_Sans_Hint (Container, Key, Position.Node, Inserted); end Insert; procedure Insert (Container : in out Map; Key : Key_Type; New_Item : Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, Key, New_Item, Position, Inserted); if not Inserted then raise Constraint_Error with "key already in map"; end if; end Insert; -------------- -- Is_Empty -- -------------- function Is_Empty (Container : Map) return Boolean is begin return Length (Container) = 0; end Is_Empty; ------------------------- -- Is_Greater_Key_Node -- ------------------------- function Is_Greater_Key_Node (Left : Key_Type; Right : Node_Type) return Boolean is begin -- k > node same as node < k return Right.Key < Left; end Is_Greater_Key_Node; ---------------------- -- Is_Less_Key_Node -- ---------------------- function Is_Less_Key_Node (Left : Key_Type; Right : Node_Type) return Boolean is begin return Left < Right.Key; end Is_Less_Key_Node; --------- -- Key -- --------- function Key (Container : Map; Position : Cursor) return Key_Type is begin if not Has_Element (Container, Position) then raise Constraint_Error with "Position cursor of function Key has no element"; end if; pragma Assert (Vet (Container, Position.Node), "Position cursor of function Key is bad"); return Container.Nodes (Position.Node).Key; end Key; ---------- -- Last -- ---------- function Last (Container : Map) return Cursor is begin if Length (Container) = 0 then return No_Element; end if; return (Node => Container.Last); end Last; ------------------ -- Last_Element -- ------------------ function Last_Element (Container : Map) return Element_Type is begin if Is_Empty (Container) then raise Constraint_Error with "map is empty"; end if; return Container.Nodes (Last (Container).Node).Element; end Last_Element; -------------- -- Last_Key -- -------------- function Last_Key (Container : Map) return Key_Type is begin if Is_Empty (Container) then raise Constraint_Error with "map is empty"; end if; return Container.Nodes (Last (Container).Node).Key; end Last_Key; -------------- -- Left_Son -- -------------- function Left_Son (Node : Node_Type) return Count_Type is begin return Node.Left; end Left_Son; ------------ -- Length -- ------------ function Length (Container : Map) return Count_Type is begin return Container.Length; end Length; ---------- -- Move -- ---------- procedure Move (Target : in out Map; Source : in out Map) is NN : Tree_Types.Nodes_Type renames Source.Nodes; X : Node_Access; begin if Target'Address = Source'Address then return; end if; if Target.Capacity < Length (Source) then raise Constraint_Error with -- ??? "Source length exceeds Target capacity"; end if; Clear (Target); loop X := First (Source).Node; exit when X = 0; -- Here we insert a copy of the source element into the target, and -- then delete the element from the source. Another possibility is -- that delete it first (and hang onto its index), then insert it. -- ??? Insert (Target, NN (X).Key, NN (X).Element); -- optimize??? Tree_Operations.Delete_Node_Sans_Free (Source, X); Formal_Ordered_Maps.Free (Source, X); end loop; end Move; ---------- -- Next -- ---------- procedure Next (Container : Map; Position : in out Cursor) is begin Position := Next (Container, Position); end Next; function Next (Container : Map; Position : Cursor) return Cursor is begin if Position = No_Element then return No_Element; end if; if not Has_Element (Container, Position) then raise Constraint_Error; end if; pragma Assert (Vet (Container, Position.Node), "bad cursor in Next"); return (Node => Tree_Operations.Next (Container, Position.Node)); end Next; ------------- -- Overlap -- ------------- function Overlap (Left, Right : Map) return Boolean is begin if Length (Left) = 0 or Length (Right) = 0 then return False; end if; declare L_Node : Count_Type := First (Left).Node; R_Node : Count_Type := First (Right).Node; L_Last : constant Count_Type := Next (Left, Last (Left).Node); R_Last : constant Count_Type := Next (Right, Last (Right).Node); begin if Left'Address = Right'Address then return True; end if; loop if L_Node = L_Last or else R_Node = R_Last then return False; end if; if Left.Nodes (L_Node).Key < Right.Nodes (R_Node).Key then L_Node := Next (Left, L_Node); elsif Right.Nodes (R_Node).Key < Left.Nodes (L_Node).Key then R_Node := Next (Right, R_Node); else return True; end if; end loop; end; end Overlap; ------------ -- Parent -- ------------ function Parent (Node : Node_Type) return Count_Type is begin return Node.Parent; end Parent; -------------- -- Previous -- -------------- procedure Previous (Container : Map; Position : in out Cursor) is begin Position := Previous (Container, Position); end Previous; function Previous (Container : Map; Position : Cursor) return Cursor is begin if Position = No_Element then return No_Element; end if; if not Has_Element (Container, Position) then raise Constraint_Error; end if; pragma Assert (Vet (Container, Position.Node), "bad cursor in Previous"); declare Node : constant Count_Type := Tree_Operations.Previous (Container, Position.Node); begin if Node = 0 then return No_Element; end if; return (Node => Node); end; end Previous; ------------- -- Replace -- ------------- procedure Replace (Container : in out Map; Key : Key_Type; New_Item : Element_Type) is begin declare Node : constant Node_Access := Key_Ops.Find (Container, Key); begin if Node = 0 then raise Constraint_Error with "key not in map"; end if; declare N : Node_Type renames Container.Nodes (Node); begin N.Key := Key; N.Element := New_Item; end; end; end Replace; --------------------- -- Replace_Element -- --------------------- procedure Replace_Element (Container : in out Map; Position : Cursor; New_Item : Element_Type) is begin if not Has_Element (Container, Position) then raise Constraint_Error with "Position cursor of Replace_Element has no element"; end if; pragma Assert (Vet (Container, Position.Node), "Position cursor of Replace_Element is bad"); Container.Nodes (Position.Node).Element := New_Item; end Replace_Element; --------------- -- Right_Son -- --------------- function Right_Son (Node : Node_Type) return Count_Type is begin return Node.Right; end Right_Son; --------------- -- Set_Color -- --------------- procedure Set_Color (Node : in out Node_Type; Color : Color_Type) is begin Node.Color := Color; end Set_Color; -------------- -- Set_Left -- -------------- procedure Set_Left (Node : in out Node_Type; Left : Count_Type) is begin Node.Left := Left; end Set_Left; ---------------- -- Set_Parent -- ---------------- procedure Set_Parent (Node : in out Node_Type; Parent : Count_Type) is begin Node.Parent := Parent; end Set_Parent; --------------- -- Set_Right -- --------------- procedure Set_Right (Node : in out Node_Type; Right : Count_Type) is begin Node.Right := Right; end Set_Right; ------------------ -- Strict_Equal -- ------------------ function Strict_Equal (Left, Right : Map) return Boolean is LNode : Count_Type := First (Left).Node; RNode : Count_Type := First (Right).Node; begin if Length (Left) /= Length (Right) then return False; end if; while LNode = RNode loop if LNode = 0 then return True; end if; if Left.Nodes (LNode).Element /= Right.Nodes (RNode).Element or else Left.Nodes (LNode).Key /= Right.Nodes (RNode).Key then exit; end if; LNode := Next (Left, LNode); RNode := Next (Right, RNode); end loop; return False; end Strict_Equal; end Ada.Containers.Formal_Ordered_Maps;
-- Lumen.Binary.Endian -- Parent package for big- vs. little-endian -- byte-ordering services -- -- -- 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. package Lumen.Binary.Endian is pragma Elaborate_Body; --------------------------------------------------------------------------- type Byte_Order is (High_Order_First, Low_Order_First); --------------------------------------------------------------------------- -- This is the order defined as "network byte order" by the widely-used BSD -- networking routines, and by common practice on the Internet. Network_Byte_Order : constant Byte_Order := High_Order_First; --------------------------------------------------------------------------- -- Returns the current system's byte ordering configuration. function System_Byte_Order return Byte_Order; pragma Inline (System_Byte_Order); --------------------------------------------------------------------------- private -- This type is needed by the byte-order test in the Endian package body -- init code; otherwise, it could just go in the package body for -- Endian.Two_Byte type Two_Bytes is record B0 : Byte; B1 : Byte; end record; for Two_Bytes'Size use Short_Bits; for Two_Bytes use record B0 at 0 range 0 .. 7; B1 at 1 range 0 .. 7; end record; end Lumen.Binary.Endian;
------------------------------------------------------------------------------ -- A d a r u n - t i m e s p e c i f i c a t i o n -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of ada.ads file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Numerics.Generic_Real_Arrays; with Ada.Numerics.Generic_Complex_Types; generic with package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (<>); with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real_Arrays.Real); package Ada.Numerics.Generic_Complex_Arrays is pragma Pure (Generic_Complex_Arrays); -- Types type Complex_Vector is array (Integer range <>) of Complex_Types.Complex; type Complex_Matrix is array (Integer range <>, Integer range <>) of Complex_Types.Complex; -- Subprograms for Complex_Vector types -- Complex_Vector selection, conversion and composition operations function Re (X : in Complex_Vector) return Real_Arrays.Real_Vector; function Im (X : in Complex_Vector) return Real_Arrays.Real_Vector; procedure Set_Re (X : in out Complex_Vector; Re : in Real_Arrays.Real_Vector); procedure Set_Im (X : in out Complex_Vector; Im : in Real_Arrays.Real_Vector); function Compose_From_Cartesian (Re : in Real_Arrays.Real_Vector) return Complex_Vector; function Compose_From_Cartesian (Re : in Real_Arrays.Real_Vector; Im : in Real_Arrays.Real_Vector) return Complex_Vector; function Modulus (X : in Complex_Vector) return Real_Arrays.Real_Vector; function "abs" (Right : in Complex_Vector) return Real_Arrays.Real_Vector renames Modulus; function Argument (X : in Complex_Vector) return Real_Arrays.Real_Vector; function Argument (X : in Complex_Vector; Cycle : in Real_Arrays.Real'Base) return Real_Arrays.Real_Vector; function Compose_From_Polar (Modulus : in Real_Arrays.Real_Vector; Argument : in Real_Arrays.Real_Vector) return Complex_Vector; function Compose_From_Polar (Modulus : in Real_Arrays.Real_Vector; Argument : in Real_Arrays.Real_Vector; Cycle : in Real_Arrays.Real'Base) return Complex_Vector; -- Complex_Vector arithmetic operations function "+" (Right : in Complex_Vector) return Complex_Vector; function "-" (Right : in Complex_Vector) return Complex_Vector; function Conjugate (X : in Complex_Vector) return Complex_Vector; function "+" (Left : in Complex_Vector; Right : in Complex_Vector) return Complex_Vector; function "-" (Left : in Complex_Vector; Right : in Complex_Vector) return Complex_Vector; function "*" (Left : in Complex_Vector; Right : Complex_Vector) return Complex_Types.Complex; function "abs" (Right : in Complex_Vector) return Complex_Types.Complex; -- Mixed Real_Arrays.Real_Vector and Complex_Vector arithmetic operations function "+" (Left : in Real_Arrays.Real_Vector; Right : in Complex_Vector) return Complex_Vector; function "+" (Left : in Complex_Vector; Right : in Real_Arrays.Real_Vector) return Complex_Vector; function "-" (Left : in Real_Arrays.Real_Vector; Right : in Complex_Vector) return Complex_Vector; function "-" (Left : in Complex_Vector; Right : in Real_Arrays.Real_Vector) return Complex_Vector; function "*" (Left : in Real_Arrays.Real_Vector; Right : in Complex_Vector) return Complex_Types.Complex; function "*" (Left : in Complex_Vector; Right : in Real_Arrays.Real_Vector) return Complex_Types.Complex; -- Complex_Vector scaling operations function "*" (Left : in Complex_Types.Complex; Right : in Complex_Vector) return Complex_Vector; function "*" (Left : in Complex_Vector; Right : in Complex_Types.Complex) return Complex_Vector; function "/" (Left : in Complex_Vector; Right : in Complex_Types.Complex) return Complex_Vector; function "*" (Left : in Real_Arrays.Real'Base; Right : in Complex_Vector) return Complex_Vector; function "*" (Left : in Complex_Vector; Right : in Real_Arrays.Real'Base) return Complex_Vector; function "/" (Left : in Complex_Vector; Right : in Real_Arrays.Real'Base) return Complex_Vector; -- Other Complex_Vector operations function Unit_Vector (Index : in Integer; Order : in Positive; First : in Integer := 1) return Complex_Vector; -- Subprograms for Complex_Matrix types -- Complex_Matrix selection, conversion and composition operations function Re (X : in Complex_Matrix) return Real_Arrays.Real_Matrix; function Im (X : in Complex_Matrix) return Real_Arrays.Real_Matrix; procedure Set_Re (X : in out Complex_Matrix; Re : in Real_Arrays.Real_Matrix); procedure Set_Im (X : in out Complex_Matrix; Im : in Real_Arrays.Real_Matrix); function Compose_From_Cartesian (Re : in Real_Arrays.Real_Matrix) return Complex_Matrix; function Compose_From_Cartesian (Re : in Real_Arrays.Real_Matrix; Im : in Real_Arrays.Real_Matrix) return Complex_Matrix; function Modulus (X : in Complex_Matrix) return Real_Arrays.Real_Matrix; function "abs" (Right : in Complex_Matrix) return Real_Arrays.Real_Matrix renames Modulus; function Argument (X : in Complex_Matrix) return Real_Arrays.Real_Matrix; function Argument (X : in Complex_Matrix; Cycle : in Real_Arrays.Real'Base) return Real_Arrays.Real_Matrix; function Compose_From_Polar (Modulus : in Real_Arrays.Real_Matrix; Argument : in Real_Arrays.Real_Matrix) return Complex_Matrix; function Compose_From_Polar (Modulus : in Real_Arrays.Real_Matrix; Argument : in Real_Arrays.Real_Matrix; Cycle : in Real_Arrays.Real'Base) return Complex_Matrix; -- Complex_Matrix arithmetic operations function "+" (Right : in Complex_Matrix) return Complex_Matrix; function "-" (Right : in Complex_Matrix) return Complex_Matrix; function Conjugate (X : in Complex_Matrix) return Complex_Matrix; function Transpose (X : in Complex_Matrix) return Complex_Matrix; function "+" (Left : in Complex_Matrix; Right : in Complex_Matrix) return Complex_Matrix; function "-" (Left : in Complex_Matrix; Right : in Complex_Matrix) return Complex_Matrix; function "*" (Left : in Complex_Matrix; Right : in Complex_Matrix) return Complex_Matrix; function "*" (Left : in Complex_Vector; Right : in Complex_Vector) return Complex_Matrix; function "*" (Left : in Complex_Vector; Right : in Complex_Matrix) return Complex_Vector; function "*" (Left : in Complex_Matrix; Right : in Complex_Vector) return Complex_Vector; -- Mixed Real_Arrays.Real_Matrix and Complex_Matrix arithmetic operations function "+" (Left : in Real_Arrays.Real_Matrix; Right : in Complex_Matrix) return Complex_Matrix; function "+" (Left : in Complex_Matrix; Right : in Real_Arrays.Real_Matrix) return Complex_Matrix; function "-" (Left : in Real_Arrays.Real_Matrix; Right : in Complex_Matrix) return Complex_Matrix; function "-" (Left : in Complex_Matrix; Right : in Real_Arrays.Real_Matrix) return Complex_Matrix; function "*" (Left : in Real_Arrays.Real_Matrix; Right : in Complex_Matrix) return Complex_Matrix; function "*" (Left : in Complex_Matrix; Right : in Real_Arrays.Real_Matrix) return Complex_Matrix; function "*" (Left : in Real_Arrays.Real_Vector; Right : in Complex_Vector) return Complex_Matrix; function "*" (Left : in Complex_Vector; Right : in Real_Arrays.Real_Vector) return Complex_Matrix; function "*" (Left : in Real_Arrays.Real_Vector; Right : in Complex_Matrix) return Complex_Vector; function "*" (Left : in Complex_Vector; Right : in Real_Arrays.Real_Matrix) return Complex_Vector; function "*" (Left : in Real_Arrays.Real_Matrix; Right : in Complex_Vector) return Complex_Vector; function "*" (Left : in Complex_Matrix; Right : in Real_Arrays.Real_Vector) return Complex_Vector; -- Complex_Matrix scaling operations function "*" (Left : in Complex_Types.Complex; Right : in Complex_Matrix) return Complex_Matrix; function "*" (Left : in Complex_Matrix; Right : in Complex_Types.Complex) return Complex_Matrix; function "/" (Left : in Complex_Matrix; Right : in Complex_Types.Complex) return Complex_Matrix; function "*" (Left : in Real_Arrays.Real'Base; Right : in Complex_Matrix) return Complex_Matrix; function "*" (Left : in Complex_Matrix; Right : in Real_Arrays.Real'Base) return Complex_Matrix; function "/" (Left : in Complex_Matrix; Right : in Real_Arrays.Real'Base) return Complex_Matrix; -- Complex_Matrix inversion and related operations function Solve (A : in Complex_Matrix; X : in Complex_Vector) return Complex_Vector; function Solve (A : in Complex_Matrix; X : in Complex_Matrix) return Complex_Matrix; function Inverse (A : in Complex_Matrix) return Complex_Matrix; function Determinant (A : in Complex_Matrix) return Complex_Types.Complex; -- Eigenvalues and vectors of a Hermitian matrix function Eigenvalues (A : in Complex_Matrix) return Real_Arrays.Real_Vector; procedure Eigensystem (A : in Complex_Matrix; Values : out Real_Arrays.Real_Vector; Vectors : out Complex_Matrix); -- Other Complex_Matrix operations function Unit_Matrix (Order : in Positive; First_1 : in Integer := 1; First_2 : in Integer := 1) return Complex_Matrix; end Ada.Numerics.Generic_Complex_Arrays;
package mycalendar is type daynum is range 1 .. 31; type monthnum is range 1 .. 12; type monthname is (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); type weekday is (Mon, Tue, Wed, Thu, Fri, Sat, Sun); procedure makecal(w: in weekday; d: in daynum; m:in monthnum); end mycalendar;
with bits_stdint_uintn_h; with GLX; with Xlib; with xcb; with xcb_damage; with xcb_ewmh; with xproto; package Setup is -- Thrown if there's a fatal error during the initialization process. SetupException : exception; type connectionPtr is access xcb.xcb_connection_t; -- Contains atom values for EWMH properties if EWMH is available. ewmh : access xcb_ewmh.xcb_ewmh_connection_t := null; -- Base event # from the Damage extension. DAMAGE_EVENT : bits_stdint_uintn_h.uint8_t; -- ID used to refer to damage damage : xcb_damage.xcb_damage_damage_t; -- Keep visual ID's with desired color depths that we can use to create -- windows. -- visual24 : xproto.xcb_visualid_t; -- visual32 : xproto.xcb_visualid_t; --------------------------------------------------------------------------- -- initExtensions -- Make sure all X protocol extensions needed by Troodon are present. -- Raise SetupException is anything required is missing. --------------------------------------------------------------------------- procedure initExtensions (c : access xcb.xcb_connection_t); function initXlib return access Xlib.Display; function initXcb (display : not null access Xlib.Display) return access xcb.xcb_connection_t; procedure initDamage (connection : access xcb.xcb_connection_t); procedure initEwmh (connection : access xcb.xcb_connection_t); function getScreen (connection : access xcb.xcb_connection_t) return access xproto.xcb_screen_t; function getRootWindow (connection : access xcb.xcb_connection_t) return xproto.xcb_window_t; end Setup;
-- Package body Milesian_calendar ---------------------------------------------------------------------------- -- Copyright Miletus 2016-2019 -- 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: -- 1. The above copyright notice and this permission notice shall be included -- in all copies or substantial portions of the Software. -- 2. Changes with respect to any former version shall be documented. -- -- The software is provided "as is", without warranty of any kind, -- express of implied, including but not limited to the warranties of -- merchantability, fitness for a particular purpose and noninfringement. -- In no event shall the authors of 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. -- Inquiries: www.calendriermilesien.org ------------------------------------------------------------------------------- -- Version 3 (M2019-01-16): back to pure Gregorian intercalation rule -- as it was in 2016 version. with Cycle_Computations; package body Milesian_calendar is package Julian_Day_cycle is new Cycle_computations.Integer_cycle_computations (Num => Julian_Day'Base); use Julian_Day_cycle; subtype computation_month is integer range 0..12; function is_long_Milesian_year -- Milesian long year just before bissextile (y : Historical_year_number) return boolean is y1 : Historical_year_number'Base := y+1; begin return y1 mod 4 = 0 and then (y1 mod 100 /= 0 or else (y1 mod 400 = 0)); end is_long_Milesian_year; function valid (date : milesian_date) return boolean is -- whether the given date is an existing one -- on elaboration, the basic range checks on record fields have been done begin return date.day <= 30 or else (date.month mod 2 = 0 and (date.month /= 12 or else is_long_Milesian_year(date.year))); end valid; function JD_to_Milesian (jd : Julian_Day) return Milesian_Date is cc : Cycle_coordinates := Decompose_cycle (jd-1721050, 146097); -- intialise current day for the computations to 1/1m/000 yc : Historical_year_number'Base := cc.Cycle*400; -- year component for computations initialised to base 0 mc : computation_month; -- bimester and monthe rank for computations -- cc.Phase holds is rank of day within quadricentury begin cc := Decompose_cycle_ceiled (cc.Phase, 36524, 4); -- cc.Cycle is rank of century in quadricentury, -- cc.Phase is rank of day within century. -- rank of century is 0 to 3, Phase can be 36524 if rank is 3. yc := yc + (cc.Cycle) * 100; -- base century cc := Decompose_cycle (cc.Phase, 1461); -- quadriannum yc := yc + cc.Cycle * 4; cc := Decompose_cycle_ceiled (cc.Phase, 365, 4); -- year in quadriannum yc := yc + cc.Cycle; -- here we get the year cc := Decompose_cycle (cc.Phase, 61); -- cycle is rank of bimester in year; phase is rank of day in bimester mc := cc.Cycle * 2; -- 0 to 10 cc := Decompose_cycle_ceiled (cc.Phase, 30, 2); -- whether firt (0) or second (1) month in bimester, -- and rank of day, 0 .. 30 if last month. return (year => yc, month => mc + cc.Cycle + 1, day => integer(cc.Phase) + 1); -- final month number and day number computed in return command. end JD_to_Milesian; function Milesian_to_JD (md : milesian_date) return julian_day is yc : Julian_Day'Base := md.year + 4800; -- year starting at -4800 in order to be positive; -- as a variant: we could start at -4000, forbidding years before -4000. mc : computation_month := md.month - 1; begin if not valid (md) then raise Time_Error; end if; return Julian_Day'Base (yc*365) -32115 + Julian_Day'Base (yc/4 -yc/100 +yc/400 +mc*30 +mc/2 +md.day); -- integer divisions yield integer quotients. end Milesian_to_JD; end Milesian_calendar;
with RP.Device; with BB_Pico_Bsp.LVGL_Backend; with BB_Pico_Bsp.LCD; with Lv.Tasks; with Lv.Hal.Tick; with lvgl_ada_Config; use lvgl_ada_Config; with Lv; use Lv; with Lv.Area; with Lv.Group; with Lv.Objx; use Lv.Objx; with Lv.Objx.Cont; with Lv.Objx.Tabview; with Lv.Objx.Page; with Lv.Objx.Slider; with Lv.Objx.Textarea; with Lv.Objx.Roller; with Lv.Objx.Chart; with Lv.Objx.Gauge; with Lv.Objx.Preload; with Lv.Objx.Calendar; with Lv.Color; with Lv.Theme; with Lv.Font; with Lv.Indev; with Lv.Strings; use Lv.Strings; package body LVGL_Demo is use type Int16_T; Theme_Roller : Roller.Instance; GP : Lv.Group.Instance; procedure Create_Theme_Tab (Parent : Page.Instance); procedure Create_Editor_Tab (Parent : Page.Instance); procedure Create_Status_Tab (Parent : Page.Instance); procedure Create_Cal_Tab (Parent : Page.Instance); procedure Init_Themes (Hue : Lv.Theme.Hue_T); function Roller_Action (Arg1 : Obj_T) return Res_T with Convention => C; function Slider_Action (Arg1 : Obj_T) return Res_T with Convention => C; ----------------- -- Init_Themes -- ----------------- procedure Init_Themes (Hue : Lv.Theme.Hue_T) is Unused : Lv.Theme.Theme; begin Unused := Lv.Theme.Default_Init (Hue, Lv.Font.No_Font); Unused := Lv.Theme.Material_Init (Hue, Lv.Font.No_Font); Unused := Lv.Theme.Mono_Init (Hue, Lv.Font.No_Font); Unused := Lv.Theme.Alien_Init (Hue, Lv.Font.No_Font); Unused := Lv.Theme.Nemo_Init (Hue, Lv.Font.No_Font); Unused := Lv.Theme.Night_Init (Hue, Lv.Font.No_Font); Unused := Lv.Theme.Zen_Init (Hue, Lv.Font.No_Font); end Init_Themes; ------------------- -- Roller_Action -- ------------------- function Roller_Action (Arg1 : Obj_T) return Res_T is begin case Roller.Selected (Arg1) is when 0 => Lv.Theme.Set_Current (Lv.Theme.Get_Default); when 1 => Lv.Theme.Set_Current (Lv.Theme.Get_Material); when 2 => Lv.Theme.Set_Current (Lv.Theme.Get_Mono); when 3 => Lv.Theme.Set_Current (Lv.Theme.Get_Alien); when 4 => Lv.Theme.Set_Current (Lv.Theme.Get_Night); when 5 => Lv.Theme.Set_Current (Lv.Theme.Get_Zen); when others => Lv.Theme.Set_Current (Lv.Theme.Get_Nemo); end case; return Res_Ok; end Roller_Action; ------------------- -- Slider_Action -- ------------------- function Slider_Action (Arg1 : Obj_T) return Res_T is begin Init_Themes (Uint16_T (Slider.Value (Arg1))); return Roller_Action (Theme_Roller); end Slider_Action; ---------------------- -- Create_Theme_Tab -- ---------------------- procedure Create_Theme_Tab (Parent : Page.Instance) is TH : constant Theme.Theme := Theme.Get_Current; pragma Unreferenced (TH); Slide : Slider.Instance; begin Page.Set_Scrl_Layout (Parent, Cont.Layout_Pretty); Theme_Roller := Roller.Create (Parent, No_Obj); Roller.Set_Options (Theme_Roller, New_String ("Default" & ASCII.LF & "Material" & ASCII.LF & "Mono" & ASCII.LF & "Alien" & ASCII.LF & "Night" & ASCII.LF & "Zen" & ASCII.LF & "Nemo")); Roller.Set_Selected (Theme_Roller, 4, 0); Roller.Set_Visible_Row_Count (Theme_Roller, 3); Roller.Set_Action (Theme_Roller, Roller_Action'Access); Slide := Slider.Create (Parent, No_Obj); Slider.Set_Action (Slide, Slider_Action'Access); Slider.Set_Range (Slide, 0, 360); Slider.Set_Value (Slide, 70); end Create_Theme_Tab; ----------------------- -- Create_Editor_Tab -- ----------------------- procedure Create_Editor_Tab (Parent : Page.Instance) is W : constant Lv.Area.Coord_T := Page.Scrl_Width (Parent); TA : Textarea.Instance; begin TA := Textarea.Create (Parent, No_Obj); Set_Size (TA, W, BB_Pico_Bsp.LCD.Height - 50); Align (TA, No_Obj, Align_In_Top_Right, 0, 0); Textarea.Set_Cursor_Type (TA, Textarea.Cursor_Block); Textarea.Set_Text (TA, New_String ("with Ada.Text_IO;" & ASCII.LF & "procedure Hello is" & ASCII.LF & "begin" & ASCII.LF & " Ada.Text_IO.Put_Line (""Hello world!"");" & ASCII.LF & "end Hello;" & ASCII.LF)); Lv.Group.Add_Obj (GP, TA); Lv.Group.Focus_Obj (TA); end Create_Editor_Tab; ----------------------- -- Create_Status_Tab -- ----------------------- procedure Create_Status_Tab (Parent : Page.Instance) is W : constant Lv.Area.Coord_T := Page.Scrl_Width (Parent); Ch : Chart.Instance; S1 : Chart.Series; G : Gauge.Instance; LD : Preload.Instance; begin Ch := Chart.Create (Parent, No_Obj); Set_Size (Ch, W / 3, Vertical_Resolution / 3); Set_Pos (Ch, Density_Per_Inch / 10, Density_Per_Inch / 10); S1 := Chart.Add_Series (Ch, Lv.Color.Color_Red); Chart.Set_Next (Ch, S1, 30); Chart.Set_Next (Ch, S1, 20); Chart.Set_Next (Ch, S1, 10); Chart.Set_Next (Ch, S1, 12); Chart.Set_Next (Ch, S1, 20); Chart.Set_Next (Ch, S1, 27); Chart.Set_Next (Ch, S1, 35); Chart.Set_Next (Ch, S1, 55); Chart.Set_Next (Ch, S1, 70); Chart.Set_Next (Ch, S1, 75); LD := Preload.Create (Parent, No_Obj); Align (LD, Ch, Align_Out_Right_Mid, 15, 0); G := Gauge.Create (Parent, No_Obj); Gauge.Set_Value (G, 0, 40); Set_Size (G, W / 4, W / 4); Align (G, LD, Align_Out_Right_Mid, 15, 0); end Create_Status_Tab; -------------------- -- Create_Cal_Tab -- -------------------- procedure Create_Cal_Tab (Parent : Page.Instance) is W : constant Lv.Area.Coord_T := Page.Scrl_Width (Parent); Cal : Calendar.Instance; Highlighted_days : aliased Calendar.Date_Array := ((2022, 2, 23), (2022, 2, 15)); begin -- Create a Calendar Cal := Calendar.Create (Parent, No_Obj); Set_Size (Cal, W, BB_Pico_Bsp.LCD.Height - 50); Set_Top (Cal, 1); Calendar.Set_Highlighted_Dates (Cal, Highlighted_days'Access, 2); Calendar.Set_Today_Date (Cal, Highlighted_days (0)'Access); Calendar.Set_Showed_Date (Cal, Highlighted_days (0)'Access); end Create_Cal_Tab; ---------------- -- Initialize -- ---------------- procedure Run is Scr : Cont.Instance; TV : Tabview.Instance; Theme_Tab : Page.Instance; Tab1 : Page.Instance; Tab2 : Page.Instance; Tab3 : Page.Instance; begin Lv.Init; BB_Pico_Bsp.LVGL_Backend.Initialize; Init_Themes (220); Lv.Theme.Set_Current (Lv.Theme.Get_Night); Scr := Cont.Create (No_Obj, No_Obj); Scr_Load (Scr); GP := Lv.Group.Create; Lv.Indev.Set_Group (BB_Pico_Bsp.LVGL_Backend.Keypad_Indev, GP); TV := Tabview.Create (Scr, No_Obj); Set_Size (TV, Horizontal_Resolution, Vertical_Resolution); Tabview.Set_Anim_Time (TV, 0); Tab1 := Tabview.Add_Tab (TV, New_String ("Editor")); Tab2 := Tabview.Add_Tab (TV, New_String ("Calendar")); Tab3 := Tabview.Add_Tab (TV, New_String ("Status")); Theme_Tab := Tabview.Add_Tab (TV, New_String ("Theme")); Tabview.Set_Tab_Act (TV, 0, 0); Create_Theme_Tab (Theme_Tab); Create_Editor_Tab (Tab1); Create_Cal_Tab (Tab2); Create_Status_Tab (Tab3); loop Lv.Tasks.Handler; RP.Device.Timer.Delay_Milliseconds (1); Lv.Hal.Tick.Inc (1); end loop; end Run; end LVGL_Demo;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P A R . P R A G -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Generally the parser checks the basic syntax of pragmas, but does not -- do specialized syntax checks for individual pragmas, these are deferred -- to semantic analysis time (see unit Sem_Prag). There are some pragmas -- which require recognition and either partial or complete processing -- during parsing, and this unit performs this required processing. with Fname.UF; use Fname.UF; with Osint; use Osint; with Rident; use Rident; with Restrict; use Restrict; with Stringt; use Stringt; with Stylesw; use Stylesw; with Uintp; use Uintp; with Uname; use Uname; with System.WCh_Con; use System.WCh_Con; separate (Par) function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is Prag_Name : constant Name_Id := Pragma_Name_Unmapped (Pragma_Node); Prag_Id : constant Pragma_Id := Get_Pragma_Id (Prag_Name); Pragma_Sloc : constant Source_Ptr := Sloc (Pragma_Node); Arg_Count : Nat; Arg_Node : Node_Id; ----------------------- -- Local Subprograms -- ----------------------- procedure Add_List_Pragma_Entry (PT : List_Pragma_Type; Loc : Source_Ptr); -- Make a new entry in the List_Pragmas table if this entry is not already -- in the table (it will always be the last one if there is a duplication -- resulting from the use of Save/Restore_Scan_State). function Arg1 return Node_Id; function Arg2 return Node_Id; function Arg3 return Node_Id; -- Obtain specified Pragma_Argument_Association. It is allowable to call -- the routine for the argument one past the last present argument, but -- that is the only case in which a non-present argument can be referenced. procedure Check_Arg_Count (Required : Int); -- Check argument count for pragma = Required. If not give error and raise -- Error_Resync. procedure Check_Arg_Is_String_Literal (Arg : Node_Id); -- Check the expression of the specified argument to make sure that it -- is a string literal. If not give error and raise Error_Resync. procedure Check_Arg_Is_On_Or_Off (Arg : Node_Id); -- Check the expression of the specified argument to make sure that it -- is an identifier which is either ON or OFF, and if not, then issue -- an error message and raise Error_Resync. procedure Check_No_Identifier (Arg : Node_Id); -- Checks that the given argument does not have an identifier. If -- an identifier is present, then an error message is issued, and -- Error_Resync is raised. procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id); -- Checks if the given argument has an identifier, and if so, requires -- it to match the given identifier name. If there is a non-matching -- identifier, then an error message is given and Error_Resync raised. procedure Check_Required_Identifier (Arg : Node_Id; Id : Name_Id); -- Same as Check_Optional_Identifier, except that the name is required -- to be present and to match the given Id value. procedure Process_Restrictions_Or_Restriction_Warnings; -- Common processing for Restrictions and Restriction_Warnings pragmas. -- For the most part, restrictions need not be processed at parse time, -- since they only affect semantic processing. This routine handles the -- exceptions as follows -- -- No_Obsolescent_Features must be processed at parse time, since there -- are some obsolescent features (e.g. character replacements) which are -- handled at parse time. -- -- SPARK must be processed at parse time, since this restriction controls -- whether the scanner recognizes a spark HIDE directive formatted as an -- Ada comment (and generates a Tok_SPARK_Hide token for the directive). -- -- No_Dependence must be processed at parse time, since otherwise it gets -- handled too late. -- -- Note that we don't need to do full error checking for badly formed cases -- of restrictions, since these will be caught during semantic analysis. --------------------------- -- Add_List_Pragma_Entry -- --------------------------- procedure Add_List_Pragma_Entry (PT : List_Pragma_Type; Loc : Source_Ptr) is begin if List_Pragmas.Last < List_Pragmas.First or else (List_Pragmas.Table (List_Pragmas.Last)) /= ((PT, Loc)) then List_Pragmas.Append ((PT, Loc)); end if; end Add_List_Pragma_Entry; ---------- -- Arg1 -- ---------- function Arg1 return Node_Id is begin return First (Pragma_Argument_Associations (Pragma_Node)); end Arg1; ---------- -- Arg2 -- ---------- function Arg2 return Node_Id is begin return Next (Arg1); end Arg2; ---------- -- Arg3 -- ---------- function Arg3 return Node_Id is begin return Next (Arg2); end Arg3; --------------------- -- Check_Arg_Count -- --------------------- procedure Check_Arg_Count (Required : Int) is begin if Arg_Count /= Required then Error_Msg ("wrong number of arguments for pragma%", Pragma_Sloc); raise Error_Resync; end if; end Check_Arg_Count; ---------------------------- -- Check_Arg_Is_On_Or_Off -- ---------------------------- procedure Check_Arg_Is_On_Or_Off (Arg : Node_Id) is Argx : constant Node_Id := Expression (Arg); begin if Nkind (Expression (Arg)) /= N_Identifier or else not Nam_In (Chars (Argx), Name_On, Name_Off) then Error_Msg_Name_2 := Name_On; Error_Msg_Name_3 := Name_Off; Error_Msg ("argument for pragma% must be% or%", Sloc (Argx)); raise Error_Resync; end if; end Check_Arg_Is_On_Or_Off; --------------------------------- -- Check_Arg_Is_String_Literal -- --------------------------------- procedure Check_Arg_Is_String_Literal (Arg : Node_Id) is begin if Nkind (Expression (Arg)) /= N_String_Literal then Error_Msg ("argument for pragma% must be string literal", Sloc (Expression (Arg))); raise Error_Resync; end if; end Check_Arg_Is_String_Literal; ------------------------- -- Check_No_Identifier -- ------------------------- procedure Check_No_Identifier (Arg : Node_Id) is begin if Chars (Arg) /= No_Name then Error_Msg_N ("pragma% does not permit named arguments", Arg); raise Error_Resync; end if; end Check_No_Identifier; ------------------------------- -- Check_Optional_Identifier -- ------------------------------- procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id) is begin if Present (Arg) and then Chars (Arg) /= No_Name then if Chars (Arg) /= Id then Error_Msg_Name_2 := Id; Error_Msg_N ("pragma% argument expects identifier%", Arg); end if; end if; end Check_Optional_Identifier; ------------------------------- -- Check_Required_Identifier -- ------------------------------- procedure Check_Required_Identifier (Arg : Node_Id; Id : Name_Id) is begin if Chars (Arg) /= Id then Error_Msg_Name_2 := Id; Error_Msg_N ("pragma% argument must have identifier%", Arg); end if; end Check_Required_Identifier; -------------------------------------------------- -- Process_Restrictions_Or_Restriction_Warnings -- -------------------------------------------------- procedure Process_Restrictions_Or_Restriction_Warnings is Arg : Node_Id; Id : Name_Id; Expr : Node_Id; begin Arg := Arg1; while Present (Arg) loop Id := Chars (Arg); Expr := Expression (Arg); if Id = No_Name and then Nkind (Expr) = N_Identifier then case Chars (Expr) is when Name_No_Obsolescent_Features => Set_Restriction (No_Obsolescent_Features, Pragma_Node); Restriction_Warnings (No_Obsolescent_Features) := Prag_Id = Pragma_Restriction_Warnings; when Name_SPARK | Name_SPARK_05 => Set_Restriction (SPARK_05, Pragma_Node); Restriction_Warnings (SPARK_05) := Prag_Id = Pragma_Restriction_Warnings; when others => null; end case; elsif Id = Name_No_Dependence then Set_Restriction_No_Dependence (Unit => Expr, Warn => Prag_Id = Pragma_Restriction_Warnings or else Treat_Restrictions_As_Warnings); end if; Next (Arg); end loop; end Process_Restrictions_Or_Restriction_Warnings; -- Start of processing for Prag begin Error_Msg_Name_1 := Prag_Name; -- Ignore unrecognized pragma. We let Sem post the warning for this, since -- it is a semantic error, not a syntactic one (we have already checked -- the syntax for the unrecognized pragma as required by (RM 2.8(11)). if Prag_Id = Unknown_Pragma then return Pragma_Node; end if; -- Ignore pragma previously flagged by Ignore_Pragma if Get_Name_Table_Boolean3 (Prag_Name) then return Pragma_Node; end if; -- Count number of arguments. This loop also checks if any of the arguments -- are Error, indicating a syntax error as they were parsed. If so, we -- simply return, because we get into trouble with cascaded errors if we -- try to perform our error checks on junk arguments. Arg_Count := 0; if Present (Pragma_Argument_Associations (Pragma_Node)) then Arg_Node := Arg1; while Arg_Node /= Empty loop Arg_Count := Arg_Count + 1; if Expression (Arg_Node) = Error then return Error; end if; Next (Arg_Node); end loop; end if; -- Remaining processing is pragma dependent case Prag_Id is ------------ -- Ada_83 -- ------------ -- This pragma must be processed at parse time, since we want to set -- the Ada version properly at parse time to recognize the appropriate -- Ada version syntax. when Pragma_Ada_83 => if not Latest_Ada_Only then Ada_Version := Ada_83; Ada_Version_Explicit := Ada_83; Ada_Version_Pragma := Pragma_Node; end if; ------------ -- Ada_95 -- ------------ -- This pragma must be processed at parse time, since we want to set -- the Ada version properly at parse time to recognize the appropriate -- Ada version syntax. when Pragma_Ada_95 => if not Latest_Ada_Only then Ada_Version := Ada_95; Ada_Version_Explicit := Ada_95; Ada_Version_Pragma := Pragma_Node; end if; --------------------- -- Ada_05/Ada_2005 -- --------------------- -- These pragmas must be processed at parse time, since we want to set -- the Ada version properly at parse time to recognize the appropriate -- Ada version syntax. However, it is only the zero argument form that -- must be processed at parse time. when Pragma_Ada_05 | Pragma_Ada_2005 => if Arg_Count = 0 and not Latest_Ada_Only then Ada_Version := Ada_2005; Ada_Version_Explicit := Ada_2005; Ada_Version_Pragma := Pragma_Node; end if; --------------------- -- Ada_12/Ada_2012 -- --------------------- -- These pragmas must be processed at parse time, since we want to set -- the Ada version properly at parse time to recognize the appropriate -- Ada version syntax. However, it is only the zero argument form that -- must be processed at parse time. when Pragma_Ada_12 | Pragma_Ada_2012 => if Arg_Count = 0 then Ada_Version := Ada_2012; Ada_Version_Explicit := Ada_2012; Ada_Version_Pragma := Pragma_Node; end if; --------------------------- -- Compiler_Unit_Warning -- --------------------------- -- This pragma must be processed at parse time, since the resulting -- status may be tested during the parsing of the program. when Pragma_Compiler_Unit | Pragma_Compiler_Unit_Warning => Check_Arg_Count (0); -- Only recognized in main unit if Current_Source_Unit = Main_Unit then Compiler_Unit := True; end if; ----------- -- Debug -- ----------- -- pragma Debug ([boolean_EXPRESSION,] PROCEDURE_CALL_STATEMENT); when Pragma_Debug => Check_No_Identifier (Arg1); if Arg_Count = 2 then Check_No_Identifier (Arg2); else Check_Arg_Count (1); end if; ------------------------------- -- Extensions_Allowed (GNAT) -- ------------------------------- -- pragma Extensions_Allowed (Off | On) -- The processing for pragma Extensions_Allowed must be done at -- parse time, since extensions mode may affect what is accepted. when Pragma_Extensions_Allowed => Check_Arg_Count (1); Check_No_Identifier (Arg1); Check_Arg_Is_On_Or_Off (Arg1); if Chars (Expression (Arg1)) = Name_On then Extensions_Allowed := True; Ada_Version := Ada_2012; else Extensions_Allowed := False; Ada_Version := Ada_Version_Explicit; end if; ------------------- -- Ignore_Pragma -- ------------------- -- Processing for this pragma must be done at parse time, since we want -- be able to ignore pragmas that are otherwise processed at parse time. when Pragma_Ignore_Pragma => Ignore_Pragma : declare A : Node_Id; begin Check_Arg_Count (1); Check_No_Identifier (Arg1); A := Expression (Arg1); if Nkind (A) /= N_Identifier then Error_Msg ("incorrect argument for pragma %", Sloc (A)); else Set_Name_Table_Boolean3 (Chars (A), True); end if; end Ignore_Pragma; ---------------- -- List (2.8) -- ---------------- -- pragma List (Off | On) -- The processing for pragma List must be done at parse time, since a -- listing can be generated in parse only mode. when Pragma_List => Check_Arg_Count (1); Check_No_Identifier (Arg1); Check_Arg_Is_On_Or_Off (Arg1); -- We unconditionally make a List_On entry for the pragma, so that -- in the List (Off) case, the pragma will print even in a region -- of code with listing turned off (this is required). Add_List_Pragma_Entry (List_On, Sloc (Pragma_Node)); -- Now generate the list off entry for pragma List (Off) if Chars (Expression (Arg1)) = Name_Off then Add_List_Pragma_Entry (List_Off, Semi); end if; ---------------- -- Page (2.8) -- ---------------- -- pragma Page; -- Processing for this pragma must be done at parse time, since a -- listing can be generated in parse only mode with semantics off. when Pragma_Page => Check_Arg_Count (0); Add_List_Pragma_Entry (Page, Semi); ------------------ -- Restrictions -- ------------------ -- pragma Restrictions (RESTRICTION {, RESTRICTION}); -- RESTRICTION ::= -- restriction_IDENTIFIER -- | restriction_parameter_IDENTIFIER => EXPRESSION -- We process the case of No_Obsolescent_Features, since this has -- a syntactic effect that we need to detect at parse time (the use -- of replacement characters such as colon for pound sign). when Pragma_Restrictions => Process_Restrictions_Or_Restriction_Warnings; -------------------------- -- Restriction_Warnings -- -------------------------- -- pragma Restriction_Warnings (RESTRICTION {, RESTRICTION}); -- RESTRICTION ::= -- restriction_IDENTIFIER -- | restriction_parameter_IDENTIFIER => EXPRESSION -- See above comment for pragma Restrictions when Pragma_Restriction_Warnings => Process_Restrictions_Or_Restriction_Warnings; ---------------------------------------------------------- -- Source_File_Name and Source_File_Name_Project (GNAT) -- ---------------------------------------------------------- -- These two pragmas have the same syntax and semantics. -- There are five forms of these pragmas: -- pragma Source_File_Name[_Project] ( -- [UNIT_NAME =>] unit_NAME, -- BODY_FILE_NAME => STRING_LITERAL -- [, [INDEX =>] INTEGER_LITERAL]); -- pragma Source_File_Name[_Project] ( -- [UNIT_NAME =>] unit_NAME, -- SPEC_FILE_NAME => STRING_LITERAL -- [, [INDEX =>] INTEGER_LITERAL]); -- pragma Source_File_Name[_Project] ( -- BODY_FILE_NAME => STRING_LITERAL -- [, DOT_REPLACEMENT => STRING_LITERAL] -- [, CASING => CASING_SPEC]); -- pragma Source_File_Name[_Project] ( -- SPEC_FILE_NAME => STRING_LITERAL -- [, DOT_REPLACEMENT => STRING_LITERAL] -- [, CASING => CASING_SPEC]); -- pragma Source_File_Name[_Project] ( -- SUBUNIT_FILE_NAME => STRING_LITERAL -- [, DOT_REPLACEMENT => STRING_LITERAL] -- [, CASING => CASING_SPEC]); -- CASING_SPEC ::= Uppercase | Lowercase | Mixedcase -- Pragma Source_File_Name_Project (SFNP) is equivalent to pragma -- Source_File_Name (SFN), however their usage is exclusive: -- SFN can only be used when no project file is used, while -- SFNP can only be used when a project file is used. -- The Project Manager produces a configuration pragmas file that -- is communicated to the compiler with -gnatec switch. This file -- contains only SFNP pragmas (at least two for the default naming -- scheme. As this configuration pragmas file is always the first -- processed by the compiler, it prevents the use of pragmas SFN in -- other config files when a project file is in use. -- Note: we process this during parsing, since we need to have the -- source file names set well before the semantic analysis starts, -- since we load the spec and with'ed packages before analysis. when Pragma_Source_File_Name | Pragma_Source_File_Name_Project => Source_File_Name : declare Unam : Unit_Name_Type; Expr1 : Node_Id; Pat : String_Ptr; Typ : Character; Dot : String_Ptr; Cas : Casing_Type; Nast : Nat; Expr : Node_Id; Index : Nat; function Get_Fname (Arg : Node_Id) return File_Name_Type; -- Process file name from unit name form of pragma function Get_String_Argument (Arg : Node_Id) return String_Ptr; -- Process string literal value from argument procedure Process_Casing (Arg : Node_Id); -- Process Casing argument of pattern form of pragma procedure Process_Dot_Replacement (Arg : Node_Id); -- Process Dot_Replacement argument of pattern form of pragma --------------- -- Get_Fname -- --------------- function Get_Fname (Arg : Node_Id) return File_Name_Type is begin String_To_Name_Buffer (Strval (Expression (Arg))); for J in 1 .. Name_Len loop if Is_Directory_Separator (Name_Buffer (J)) then Error_Msg ("directory separator character not allowed", Sloc (Expression (Arg)) + Source_Ptr (J)); end if; end loop; return Name_Find; end Get_Fname; ------------------------- -- Get_String_Argument -- ------------------------- function Get_String_Argument (Arg : Node_Id) return String_Ptr is Str : String_Id; begin if Nkind (Expression (Arg)) /= N_String_Literal and then Nkind (Expression (Arg)) /= N_Operator_Symbol then Error_Msg_N ("argument for pragma% must be string literal", Arg); raise Error_Resync; end if; Str := Strval (Expression (Arg)); -- Check string has no wide chars for J in 1 .. String_Length (Str) loop if Get_String_Char (Str, J) > 255 then Error_Msg ("wide character not allowed in pattern for pragma%", Sloc (Expression (Arg2)) + Text_Ptr (J) - 1); end if; end loop; -- Acquire string String_To_Name_Buffer (Str); return new String'(Name_Buffer (1 .. Name_Len)); end Get_String_Argument; -------------------- -- Process_Casing -- -------------------- procedure Process_Casing (Arg : Node_Id) is Expr : constant Node_Id := Expression (Arg); begin Check_Required_Identifier (Arg, Name_Casing); if Nkind (Expr) = N_Identifier then if Chars (Expr) = Name_Lowercase then Cas := All_Lower_Case; return; elsif Chars (Expr) = Name_Uppercase then Cas := All_Upper_Case; return; elsif Chars (Expr) = Name_Mixedcase then Cas := Mixed_Case; return; end if; end if; Error_Msg_N ("Casing argument for pragma% must be " & "one of Mixedcase, Lowercase, Uppercase", Arg); end Process_Casing; ----------------------------- -- Process_Dot_Replacement -- ----------------------------- procedure Process_Dot_Replacement (Arg : Node_Id) is begin Check_Required_Identifier (Arg, Name_Dot_Replacement); Dot := Get_String_Argument (Arg); end Process_Dot_Replacement; -- Start of processing for Source_File_Name and -- Source_File_Name_Project pragmas. begin if Prag_Id = Pragma_Source_File_Name then if Project_File_In_Use = In_Use then Error_Msg ("pragma Source_File_Name cannot be used " & "with a project file", Pragma_Sloc); else Project_File_In_Use := Not_In_Use; end if; else if Project_File_In_Use = Not_In_Use then Error_Msg ("pragma Source_File_Name_Project should only be used " & "with a project file", Pragma_Sloc); else Project_File_In_Use := In_Use; end if; end if; -- We permit from 1 to 3 arguments if Arg_Count not in 1 .. 3 then Check_Arg_Count (1); end if; Expr1 := Expression (Arg1); -- If first argument is identifier or selected component, then -- we have the specific file case of the Source_File_Name pragma, -- and the first argument is a unit name. if Nkind (Expr1) = N_Identifier or else (Nkind (Expr1) = N_Selected_Component and then Nkind (Selector_Name (Expr1)) = N_Identifier) then if Nkind (Expr1) = N_Identifier and then Chars (Expr1) = Name_System then Error_Msg_N ("pragma Source_File_Name may not be used for System", Arg1); return Error; end if; -- Process index argument if present if Arg_Count = 3 then Expr := Expression (Arg3); if Nkind (Expr) /= N_Integer_Literal or else not UI_Is_In_Int_Range (Intval (Expr)) or else Intval (Expr) > 999 or else Intval (Expr) <= 0 then Error_Msg ("pragma% index must be integer literal" & " in range 1 .. 999", Sloc (Expr)); raise Error_Resync; else Index := UI_To_Int (Intval (Expr)); end if; -- No index argument present else Check_Arg_Count (2); Index := 0; end if; Check_Optional_Identifier (Arg1, Name_Unit_Name); Unam := Get_Unit_Name (Expr1); Check_Arg_Is_String_Literal (Arg2); if Chars (Arg2) = Name_Spec_File_Name then Set_File_Name (Get_Spec_Name (Unam), Get_Fname (Arg2), Index); elsif Chars (Arg2) = Name_Body_File_Name then Set_File_Name (Unam, Get_Fname (Arg2), Index); else Error_Msg_N ("pragma% argument has incorrect identifier", Arg2); return Pragma_Node; end if; -- If the first argument is not an identifier, then we must have -- the pattern form of the pragma, and the first argument must be -- the pattern string with an appropriate name. else if Chars (Arg1) = Name_Spec_File_Name then Typ := 's'; elsif Chars (Arg1) = Name_Body_File_Name then Typ := 'b'; elsif Chars (Arg1) = Name_Subunit_File_Name then Typ := 'u'; elsif Chars (Arg1) = Name_Unit_Name then Error_Msg_N ("Unit_Name parameter for pragma% must be an identifier", Arg1); raise Error_Resync; else Error_Msg_N ("pragma% argument has incorrect identifier", Arg1); raise Error_Resync; end if; Pat := Get_String_Argument (Arg1); -- Check pattern has exactly one asterisk Nast := 0; for J in Pat'Range loop if Pat (J) = '*' then Nast := Nast + 1; end if; end loop; if Nast /= 1 then Error_Msg_N ("file name pattern must have exactly one * character", Arg1); return Pragma_Node; end if; -- Set defaults for Casing and Dot_Separator parameters Cas := All_Lower_Case; Dot := new String'("."); -- Process second and third arguments if present if Arg_Count > 1 then if Chars (Arg2) = Name_Casing then Process_Casing (Arg2); if Arg_Count = 3 then Process_Dot_Replacement (Arg3); end if; else Process_Dot_Replacement (Arg2); if Arg_Count = 3 then Process_Casing (Arg3); end if; end if; end if; Set_File_Name_Pattern (Pat, Typ, Dot, Cas); end if; end Source_File_Name; ----------------------------- -- Source_Reference (GNAT) -- ----------------------------- -- pragma Source_Reference -- (INTEGER_LITERAL [, STRING_LITERAL] ); -- Processing for this pragma must be done at parse time, since error -- messages needing the proper line numbers can be generated in parse -- only mode with semantic checking turned off, and indeed we usually -- turn off semantic checking anyway if any parse errors are found. when Pragma_Source_Reference => Source_Reference : declare Fname : File_Name_Type; begin if Arg_Count /= 1 then Check_Arg_Count (2); Check_No_Identifier (Arg2); end if; -- Check that this is first line of file. We skip this test if -- we are in syntax check only mode, since we may be dealing with -- multiple compilation units. if Get_Physical_Line_Number (Pragma_Sloc) /= 1 and then Num_SRef_Pragmas (Current_Source_File) = 0 and then Operating_Mode /= Check_Syntax then Error_Msg -- CODEFIX ("first % pragma must be first line of file", Pragma_Sloc); raise Error_Resync; end if; Check_No_Identifier (Arg1); if Arg_Count = 1 then if Num_SRef_Pragmas (Current_Source_File) = 0 then Error_Msg ("file name required for first % pragma in file", Pragma_Sloc); raise Error_Resync; else Fname := No_File; end if; -- File name present else Check_Arg_Is_String_Literal (Arg2); String_To_Name_Buffer (Strval (Expression (Arg2))); Fname := Name_Find; if Num_SRef_Pragmas (Current_Source_File) > 0 then if Fname /= Full_Ref_Name (Current_Source_File) then Error_Msg ("file name must be same in all % pragmas", Pragma_Sloc); raise Error_Resync; end if; end if; end if; if Nkind (Expression (Arg1)) /= N_Integer_Literal then Error_Msg ("argument for pragma% must be integer literal", Sloc (Expression (Arg1))); raise Error_Resync; -- OK, this source reference pragma is effective, however, we -- ignore it if it is not in the first unit in the multiple unit -- case. This is because the only purpose in this case is to -- provide source pragmas for subsequent use by gnatchop. else if Num_Library_Units = 1 then Register_Source_Ref_Pragma (Fname, Strip_Directory (Fname), UI_To_Int (Intval (Expression (Arg1))), Get_Physical_Line_Number (Pragma_Sloc) + 1); end if; end if; end Source_Reference; ------------------------- -- Style_Checks (GNAT) -- ------------------------- -- pragma Style_Checks (On | Off | ALL_CHECKS | STRING_LITERAL); -- This is processed by the parser since some of the style -- checks take place during source scanning and parsing. when Pragma_Style_Checks => Style_Checks : declare A : Node_Id; S : String_Id; C : Char_Code; OK : Boolean := True; begin -- Two argument case is only for semantics if Arg_Count = 2 then null; else Check_Arg_Count (1); Check_No_Identifier (Arg1); A := Expression (Arg1); if Nkind (A) = N_String_Literal then S := Strval (A); declare Slen : constant Natural := Natural (String_Length (S)); Options : String (1 .. Slen); J : Positive; Ptr : Positive; begin J := 1; loop C := Get_String_Char (S, Pos (J)); if not In_Character_Range (C) then OK := False; Ptr := J; exit; else Options (J) := Get_Character (C); end if; if J = Slen then if not Ignore_Style_Checks_Pragmas then Set_Style_Check_Options (Options, OK, Ptr); end if; exit; else J := J + 1; end if; end loop; if not OK then Error_Msg (Style_Msg_Buf (1 .. Style_Msg_Len), Sloc (Expression (Arg1)) + Source_Ptr (Ptr)); raise Error_Resync; end if; end; elsif Nkind (A) /= N_Identifier then OK := False; elsif Chars (A) = Name_All_Checks then if not Ignore_Style_Checks_Pragmas then if GNAT_Mode then Stylesw.Set_GNAT_Style_Check_Options; else Stylesw.Set_Default_Style_Check_Options; end if; end if; elsif Chars (A) = Name_On then if not Ignore_Style_Checks_Pragmas then Style_Check := True; end if; elsif Chars (A) = Name_Off then if not Ignore_Style_Checks_Pragmas then Style_Check := False; end if; else OK := False; end if; if not OK then Error_Msg ("incorrect argument for pragma%", Sloc (A)); raise Error_Resync; end if; end if; end Style_Checks; ------------------------- -- Suppress_All (GNAT) -- ------------------------- -- pragma Suppress_All -- This is a rather odd pragma, because other compilers allow it in -- strange places. DEC allows it at the end of units, and Rational -- allows it as a program unit pragma, when it would be more natural -- if it were a configuration pragma. -- Since the reason we provide this pragma is for compatibility with -- these other compilers, we want to accommodate these strange placement -- rules, and the easiest thing is simply to allow it anywhere in a -- unit. If this pragma appears anywhere within a unit, then the effect -- is as though a pragma Suppress (All_Checks) had appeared as the first -- line of the current file, i.e. as the first configuration pragma in -- the current unit. -- To get this effect, we set the flag Has_Pragma_Suppress_All in the -- compilation unit node for the current source file then in the last -- stage of parsing a file, if this flag is set, we materialize the -- Suppress (All_Checks) pragma, marked as not coming from Source. when Pragma_Suppress_All => Set_Has_Pragma_Suppress_All (Cunit (Current_Source_Unit)); --------------------- -- Warnings (GNAT) -- --------------------- -- pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]); -- DETAILS ::= On | Off -- DETAILS ::= On | Off, local_NAME -- DETAILS ::= static_string_EXPRESSION -- DETAILS ::= On | Off, static_string_EXPRESSION -- TOOL_NAME ::= GNAT | GNATProve -- REASON ::= Reason => STRING_LITERAL {& STRING_LITERAL} -- Note: If the first argument matches an allowed tool name, it is -- always considered to be a tool name, even if there is a string -- variable of that name. -- The one argument ON/OFF case is processed by the parser, since it may -- control parser warnings as well as semantic warnings, and in any case -- we want to be absolutely sure that the range in the warnings table is -- set well before any semantic analysis is performed. Note that we -- ignore this pragma if debug flag -gnatd.i is set. -- Also note that the "one argument" case may have two or three -- arguments if the first one is a tool name, and/or the last one is a -- reason argument. when Pragma_Warnings => Warnings : declare function First_Arg_Is_Matching_Tool_Name return Boolean; -- Returns True if the first argument is a tool name matching the -- current tool being run. function Last_Arg return Node_Id; -- Returns the last argument function Last_Arg_Is_Reason return Boolean; -- Returns True if the last argument is a reason argument function Get_Reason return String_Id; -- Analyzes Reason argument and returns corresponding String_Id -- value, or null if there is no Reason argument, or if the -- argument is not of the required form. ------------------------------------- -- First_Arg_Is_Matching_Tool_Name -- ------------------------------------- function First_Arg_Is_Matching_Tool_Name return Boolean is begin return Nkind (Arg1) = N_Identifier -- Return True if the tool name is GNAT, and we're not in -- GNATprove or CodePeer or ASIS mode... and then ((Chars (Arg1) = Name_Gnat and then not (CodePeer_Mode or GNATprove_Mode or ASIS_Mode)) -- or if the tool name is GNATprove, and we're in GNATprove -- mode. or else (Chars (Arg1) = Name_Gnatprove and then GNATprove_Mode)); end First_Arg_Is_Matching_Tool_Name; ---------------- -- Get_Reason -- ---------------- function Get_Reason return String_Id is Arg : constant Node_Id := Last_Arg; begin if Last_Arg_Is_Reason then Start_String; Get_Reason_String (Expression (Arg)); return End_String; else return Null_String_Id; end if; end Get_Reason; -------------- -- Last_Arg -- -------------- function Last_Arg return Node_Id is Last_Arg : Node_Id; begin if Arg_Count = 1 then Last_Arg := Arg1; elsif Arg_Count = 2 then Last_Arg := Arg2; elsif Arg_Count = 3 then Last_Arg := Arg3; elsif Arg_Count = 4 then Last_Arg := Next (Arg3); -- Illegal case, error issued in semantic analysis else Last_Arg := Empty; end if; return Last_Arg; end Last_Arg; ------------------------ -- Last_Arg_Is_Reason -- ------------------------ function Last_Arg_Is_Reason return Boolean is Arg : constant Node_Id := Last_Arg; begin return Nkind (Arg) in N_Has_Chars and then Chars (Arg) = Name_Reason; end Last_Arg_Is_Reason; The_Arg : Node_Id; -- On/Off argument Argx : Node_Id; -- Start of processing for Warnings begin if not Debug_Flag_Dot_I and then (Arg_Count = 1 or else (Arg_Count = 2 and then (First_Arg_Is_Matching_Tool_Name or else Last_Arg_Is_Reason)) or else (Arg_Count = 3 and then First_Arg_Is_Matching_Tool_Name and then Last_Arg_Is_Reason)) then if First_Arg_Is_Matching_Tool_Name then The_Arg := Arg2; else The_Arg := Arg1; end if; Check_No_Identifier (The_Arg); Argx := Expression (The_Arg); if Nkind (Argx) = N_Identifier then if Chars (Argx) = Name_On then Set_Warnings_Mode_On (Pragma_Sloc); elsif Chars (Argx) = Name_Off then Set_Warnings_Mode_Off (Pragma_Sloc, Get_Reason); end if; end if; end if; end Warnings; ----------------------------- -- Wide_Character_Encoding -- ----------------------------- -- pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL); -- This is processed by the parser, since the scanner is affected when Pragma_Wide_Character_Encoding => Wide_Character_Encoding : declare A : Node_Id; begin Check_Arg_Count (1); Check_No_Identifier (Arg1); A := Expression (Arg1); if Nkind (A) = N_Identifier then Get_Name_String (Chars (A)); Wide_Character_Encoding_Method := Get_WC_Encoding_Method (Name_Buffer (1 .. Name_Len)); elsif Nkind (A) = N_Character_Literal then declare R : constant Char_Code := Char_Code (UI_To_Int (Char_Literal_Value (A))); begin if In_Character_Range (R) then Wide_Character_Encoding_Method := Get_WC_Encoding_Method (Get_Character (R)); else raise Constraint_Error; end if; end; else raise Constraint_Error; end if; Upper_Half_Encoding := Wide_Character_Encoding_Method in WC_Upper_Half_Encoding_Method; exception when Constraint_Error => Error_Msg_N ("invalid argument for pragma%", Arg1); end Wide_Character_Encoding; ----------------------- -- All Other Pragmas -- ----------------------- -- For all other pragmas, checking and processing is handled -- entirely in Sem_Prag, and no further checking is done by Par. when Pragma_Abort_Defer | Pragma_Abstract_State | Pragma_Async_Readers | Pragma_Async_Writers | Pragma_Assertion_Policy | Pragma_Assume | Pragma_Assume_No_Invalid_Values | Pragma_All_Calls_Remote | Pragma_Allow_Integer_Address | Pragma_Annotate | Pragma_Assert | Pragma_Assert_And_Cut | Pragma_Asynchronous | Pragma_Atomic | Pragma_Atomic_Components | Pragma_Attach_Handler | Pragma_Attribute_Definition | Pragma_Check | Pragma_Check_Float_Overflow | Pragma_Check_Name | Pragma_Check_Policy | Pragma_Compile_Time_Error | Pragma_Compile_Time_Warning | Pragma_Constant_After_Elaboration | Pragma_Contract_Cases | Pragma_Convention_Identifier | Pragma_CPP_Class | Pragma_CPP_Constructor | Pragma_CPP_Virtual | Pragma_CPP_Vtable | Pragma_CPU | Pragma_C_Pass_By_Copy | Pragma_Comment | Pragma_Common_Object | Pragma_Complete_Representation | Pragma_Complex_Representation | Pragma_Component_Alignment | Pragma_Controlled | Pragma_Convention | Pragma_Debug_Policy | Pragma_Depends | Pragma_Detect_Blocking | Pragma_Default_Initial_Condition | Pragma_Default_Scalar_Storage_Order | Pragma_Default_Storage_Pool | Pragma_Disable_Atomic_Synchronization | Pragma_Discard_Names | Pragma_Dispatching_Domain | Pragma_Effective_Reads | Pragma_Effective_Writes | Pragma_Eliminate | Pragma_Elaborate | Pragma_Elaborate_All | Pragma_Elaborate_Body | Pragma_Elaboration_Checks | Pragma_Enable_Atomic_Synchronization | Pragma_Export | Pragma_Export_Function | Pragma_Export_Object | Pragma_Export_Procedure | Pragma_Export_Value | Pragma_Export_Valued_Procedure | Pragma_Extend_System | Pragma_Extensions_Visible | Pragma_External | Pragma_External_Name_Casing | Pragma_Favor_Top_Level | Pragma_Fast_Math | Pragma_Finalize_Storage_Only | Pragma_Ghost | Pragma_Global | Pragma_Ident | Pragma_Implementation_Defined | Pragma_Implemented | Pragma_Implicit_Packing | Pragma_Import | Pragma_Import_Function | Pragma_Import_Object | Pragma_Import_Procedure | Pragma_Import_Valued_Procedure | Pragma_Independent | Pragma_Independent_Components | Pragma_Initial_Condition | Pragma_Initialize_Scalars | Pragma_Initializes | Pragma_Inline | Pragma_Inline_Always | Pragma_Inline_Generic | Pragma_Inspection_Point | Pragma_Interface | Pragma_Interface_Name | Pragma_Interrupt_Handler | Pragma_Interrupt_State | Pragma_Interrupt_Priority | Pragma_Invariant | Pragma_Keep_Names | Pragma_License | Pragma_Link_With | Pragma_Linker_Alias | Pragma_Linker_Constructor | Pragma_Linker_Destructor | Pragma_Linker_Options | Pragma_Linker_Section | Pragma_Lock_Free | Pragma_Locking_Policy | Pragma_Loop_Invariant | Pragma_Loop_Optimize | Pragma_Loop_Variant | Pragma_Machine_Attribute | Pragma_Main | Pragma_Main_Storage | Pragma_Max_Queue_Length | Pragma_Memory_Size | Pragma_No_Body | Pragma_No_Elaboration_Code_All | Pragma_No_Inline | Pragma_No_Return | Pragma_No_Run_Time | Pragma_No_Strict_Aliasing | Pragma_No_Tagged_Streams | Pragma_Normalize_Scalars | Pragma_Obsolescent | Pragma_Ordered | Pragma_Optimize | Pragma_Optimize_Alignment | Pragma_Overflow_Mode | Pragma_Overriding_Renamings | Pragma_Pack | Pragma_Part_Of | Pragma_Partition_Elaboration_Policy | Pragma_Passive | Pragma_Preelaborable_Initialization | Pragma_Polling | Pragma_Prefix_Exception_Messages | Pragma_Persistent_BSS | Pragma_Post | Pragma_Postcondition | Pragma_Post_Class | Pragma_Pre | Pragma_Precondition | Pragma_Predicate | Pragma_Predicate_Failure | Pragma_Preelaborate | Pragma_Pre_Class | Pragma_Priority | Pragma_Priority_Specific_Dispatching | Pragma_Profile | Pragma_Profile_Warnings | Pragma_Propagate_Exceptions | Pragma_Provide_Shift_Operators | Pragma_Psect_Object | Pragma_Pure | Pragma_Pure_Function | Pragma_Queuing_Policy | Pragma_Refined_Depends | Pragma_Refined_Global | Pragma_Refined_Post | Pragma_Refined_State | Pragma_Relative_Deadline | Pragma_Remote_Access_Type | Pragma_Remote_Call_Interface | Pragma_Remote_Types | Pragma_Restricted_Run_Time | Pragma_Rational | Pragma_Ravenscar | Pragma_Rename_Pragma | Pragma_Reviewable | Pragma_Secondary_Stack_Size | Pragma_Share_Generic | Pragma_Shared | Pragma_Shared_Passive | Pragma_Short_Circuit_And_Or | Pragma_Short_Descriptors | Pragma_Simple_Storage_Pool_Type | Pragma_SPARK_Mode | Pragma_Storage_Size | Pragma_Storage_Unit | Pragma_Static_Elaboration_Desired | Pragma_Stream_Convert | Pragma_Subtitle | Pragma_Suppress | Pragma_Suppress_Debug_Info | Pragma_Suppress_Exception_Locations | Pragma_Suppress_Initialization | Pragma_System_Name | Pragma_Task_Dispatching_Policy | Pragma_Task_Info | Pragma_Task_Name | Pragma_Task_Storage | Pragma_Test_Case | Pragma_Thread_Local_Storage | Pragma_Time_Slice | Pragma_Title | Pragma_Type_Invariant | Pragma_Type_Invariant_Class | Pragma_Unchecked_Union | Pragma_Unevaluated_Use_Of_Old | Pragma_Unimplemented_Unit | Pragma_Universal_Aliasing | Pragma_Universal_Data | Pragma_Unmodified | Pragma_Unreferenced | Pragma_Unreferenced_Objects | Pragma_Unreserve_All_Interrupts | Pragma_Unsuppress | Pragma_Unused | Pragma_Use_VADS_Size | Pragma_Volatile | Pragma_Volatile_Components | Pragma_Volatile_Full_Access | Pragma_Volatile_Function | Pragma_Warning_As_Error | Pragma_Weak_External | Pragma_Validity_Checks => null; -------------------- -- Unknown_Pragma -- -------------------- -- Should be impossible, since we excluded this case earlier on when Unknown_Pragma => raise Program_Error; end case; return Pragma_Node; -------------------- -- Error Handling -- -------------------- exception when Error_Resync => return Error; end Prag;
with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; procedure Quadratic_Equation (A, B, C : Float; -- By default it is "in". R1, R2 : out Float; Valid : out Boolean) is Z : Float; begin Z := B**2 - 4.0 * A * C; if Z < 0.0 or A = 0.0 then Valid := False; -- Being out parameter, it should be modified at least once. R1 := 0.0; R2 := 0.0; else Valid := True; R1 := (-B + Sqrt (Z)) / (2.0 * A); R2 := (-B - Sqrt (Z)) / (2.0 * A); end if; end Quadratic_Equation;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Directories; procedure EmptyDir is function Empty (path : String) return String is use Ada.Directories; result : String := "Is empty."; procedure check (ent : Directory_Entry_Type) is begin if Simple_Name (ent) /= "." and Simple_Name (ent) /= ".." then Empty.result := "Not empty"; end if; end check; begin if not Exists (path) then return "Does not exist."; elsif Kind (path) /= Directory then return "Not a Directory."; end if; Search (path, "", Process => check'Access); return result; end Empty; begin Put_Line (Empty (".")); Put_Line (Empty ("./empty")); Put_Line (Empty ("./emptydir.adb")); Put_Line (Empty ("./foobar")); end EmptyDir;
with Ada.Float_Text_IO; with Ada.Numerics; procedure Pi (Value : in Value_Type); Prod : Float := 1.0; Szamlalo : Float := 0.0; Diff: constant Float := 0.0001; Pi : Value_Type := Ada.Numerics.Pi; procedure Pi (Value : in Value_Type) is begin loop Szamlalo := Szamlalo + 2.0; Prod := Prod * (Szamlalo / (Szamlalo - 1.0)) * (Szamlalo / (Szamlalo + 1.0)); exit when abs (Pi / 2.00 - Prod ) < Diff; end loop; Ada.Float_Text_IO.Put( 2.0 * Prod ); end Pi;
-- { dg-do compile } with Ada.Finalization; with Pack6_Pkg; package Pack6 is package Eight_Bits is new Pack6_Pkg (8); type Some_Data is record Byte_1 : Eight_Bits.Object; Byte_2 : Eight_Bits.Object; end record; for Some_Data use record Byte_1 at 0 range 0 .. 7; Byte_2 at 1 range 0 .. 7; end record; type Top_Object is new Ada.Finalization.Controlled with record Data : Some_Data; end record; end Pack6;
with Sodium.Functions; use Sodium.Functions; with Ada.Text_IO; use Ada.Text_IO; procedure Demo_Ada is message : constant String := "For your eyes only! XoXo"; cipherlen : constant Positive := Sealed_Cipher_Length (message); begin if not initialize_sodium_library then Put_Line ("Initialization failed"); return; end if; declare bob_public_key : Public_Box_Key; bob_secret_key : Secret_Box_Key; dan_public_key : Public_Box_Key; dan_secret_key : Secret_Box_Key; cipher_text : Sealed_Data (1 .. cipherlen); clear_text : String (1 .. message'Length); begin Generate_Box_Keys (bob_public_key, bob_secret_key); Generate_Box_Keys (dan_public_key, dan_secret_key); Put_Line ("Bob Public Key: " & As_Hexidecimal (bob_public_key)); Put_Line ("Bob Secret Key: " & As_Hexidecimal (bob_secret_key)); Put_Line ("Dan Public Key: " & As_Hexidecimal (dan_public_key)); cipher_text := Seal_Message (plain_text_message => message, recipient_public_key => bob_public_key); Put_Line ("CipherText (Anonymous): " & As_Hexidecimal (cipher_text)); clear_text := Unseal_Message (ciphertext => cipher_text, recipient_public_key => bob_public_key, recipient_secret_key => bob_secret_key); Put_Line ("Back again: " & clear_text); Put_Line ("Let Dan try to open it ..."); clear_text := Unseal_Message (ciphertext => cipher_text, recipient_public_key => dan_public_key, recipient_secret_key => dan_secret_key); end; end Demo_Ada;
-- This spec has been automatically generated from STM32L5x2.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.Flash is pragma Preelaborate; --------------- -- Registers -- --------------- subtype ACR_LATENCY_Field is HAL.UInt4; -- Access control register type ACR_Register is record -- Latency LATENCY : ACR_LATENCY_Field := 16#0#; -- unspecified Reserved_4_12 : HAL.UInt9 := 16#0#; -- Flash Power-down mode during Low-power run mode RUN_PD : Boolean := False; -- Flash Power-down mode during Low-power sleep mode SLEEP_PD : Boolean := False; -- LVEN LVEN : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ACR_Register use record LATENCY at 0 range 0 .. 3; Reserved_4_12 at 0 range 4 .. 12; RUN_PD at 0 range 13 .. 13; SLEEP_PD at 0 range 14 .. 14; LVEN at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- Flash status register type NSSR_Register is record -- NSEOP NSEOP : Boolean := False; -- NSOPERR NSOPERR : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- NSPROGERR NSPROGERR : Boolean := False; -- NSWRPERR NSWRPERR : Boolean := False; -- NSPGAERR NSPGAERR : Boolean := False; -- NSSIZERR NSSIZERR : Boolean := False; -- NSPGSERR NSPGSERR : Boolean := False; -- unspecified Reserved_8_12 : HAL.UInt5 := 16#0#; -- OPTWERR OPTWERR : Boolean := False; -- unspecified Reserved_14_14 : HAL.Bit := 16#0#; -- OPTVERR OPTVERR : Boolean := False; -- Read-only. NSBusy NSBSY : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for NSSR_Register use record NSEOP at 0 range 0 .. 0; NSOPERR at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; NSPROGERR at 0 range 3 .. 3; NSWRPERR at 0 range 4 .. 4; NSPGAERR at 0 range 5 .. 5; NSSIZERR at 0 range 6 .. 6; NSPGSERR at 0 range 7 .. 7; Reserved_8_12 at 0 range 8 .. 12; OPTWERR at 0 range 13 .. 13; Reserved_14_14 at 0 range 14 .. 14; OPTVERR at 0 range 15 .. 15; NSBSY at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- Flash status register type SECSR_Register is record -- SECEOP SECEOP : Boolean := False; -- SECOPERR SECOPERR : Boolean := False; -- unspecified Reserved_2_2 : HAL.Bit := 16#0#; -- SECPROGERR SECPROGERR : Boolean := False; -- SECWRPERR SECWRPERR : Boolean := False; -- SECPGAERR SECPGAERR : Boolean := False; -- SECSIZERR SECSIZERR : Boolean := False; -- SECPGSERR SECPGSERR : Boolean := False; -- unspecified Reserved_8_13 : HAL.UInt6 := 16#0#; -- Secure read protection error SECRDERR : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- Read-only. SECBusy SECBSY : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECSR_Register use record SECEOP at 0 range 0 .. 0; SECOPERR at 0 range 1 .. 1; Reserved_2_2 at 0 range 2 .. 2; SECPROGERR at 0 range 3 .. 3; SECWRPERR at 0 range 4 .. 4; SECPGAERR at 0 range 5 .. 5; SECSIZERR at 0 range 6 .. 6; SECPGSERR at 0 range 7 .. 7; Reserved_8_13 at 0 range 8 .. 13; SECRDERR at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; SECBSY at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; subtype NSCR_NSPNB_Field is HAL.UInt7; -- Flash non-secure control register type NSCR_Register is record -- NSPG NSPG : Boolean := False; -- NSPER NSPER : Boolean := False; -- NSMER1 NSMER1 : Boolean := False; -- NSPNB NSPNB : NSCR_NSPNB_Field := 16#0#; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- NSBKER NSBKER : Boolean := False; -- unspecified Reserved_12_14 : HAL.UInt3 := 16#0#; -- NSMER2 NSMER2 : Boolean := False; -- Options modification start NSSTRT : Boolean := False; -- Options modification start OPTSTRT : Boolean := False; -- unspecified Reserved_18_23 : HAL.UInt6 := 16#0#; -- NSEOPIE NSEOPIE : Boolean := False; -- NSERRIE NSERRIE : Boolean := False; -- unspecified Reserved_26_26 : HAL.Bit := 16#0#; -- Force the option byte loading OBL_LAUNCH : Boolean := False; -- unspecified Reserved_28_29 : HAL.UInt2 := 16#0#; -- Options Lock OPTLOCK : Boolean := True; -- NSLOCK NSLOCK : Boolean := True; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for NSCR_Register use record NSPG at 0 range 0 .. 0; NSPER at 0 range 1 .. 1; NSMER1 at 0 range 2 .. 2; NSPNB at 0 range 3 .. 9; Reserved_10_10 at 0 range 10 .. 10; NSBKER at 0 range 11 .. 11; Reserved_12_14 at 0 range 12 .. 14; NSMER2 at 0 range 15 .. 15; NSSTRT at 0 range 16 .. 16; OPTSTRT at 0 range 17 .. 17; Reserved_18_23 at 0 range 18 .. 23; NSEOPIE at 0 range 24 .. 24; NSERRIE at 0 range 25 .. 25; Reserved_26_26 at 0 range 26 .. 26; OBL_LAUNCH at 0 range 27 .. 27; Reserved_28_29 at 0 range 28 .. 29; OPTLOCK at 0 range 30 .. 30; NSLOCK at 0 range 31 .. 31; end record; subtype SECCR_SECPNB_Field is HAL.UInt7; -- Flash secure control register type SECCR_Register is record -- SECPG SECPG : Boolean := False; -- SECPER SECPER : Boolean := False; -- SECMER1 SECMER1 : Boolean := False; -- SECPNB SECPNB : SECCR_SECPNB_Field := 16#0#; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; -- SECBKER SECBKER : Boolean := False; -- unspecified Reserved_12_14 : HAL.UInt3 := 16#0#; -- SECMER2 SECMER2 : Boolean := False; -- SECSTRT SECSTRT : Boolean := False; -- unspecified Reserved_17_23 : HAL.UInt7 := 16#0#; -- SECEOPIE SECEOPIE : Boolean := False; -- SECERRIE SECERRIE : Boolean := False; -- SECRDERRIE SECRDERRIE : Boolean := False; -- unspecified Reserved_27_28 : HAL.UInt2 := 16#0#; -- SECINV SECINV : Boolean := False; -- unspecified Reserved_30_30 : HAL.Bit := 16#0#; -- SECLOCK SECLOCK : Boolean := True; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECCR_Register use record SECPG at 0 range 0 .. 0; SECPER at 0 range 1 .. 1; SECMER1 at 0 range 2 .. 2; SECPNB at 0 range 3 .. 9; Reserved_10_10 at 0 range 10 .. 10; SECBKER at 0 range 11 .. 11; Reserved_12_14 at 0 range 12 .. 14; SECMER2 at 0 range 15 .. 15; SECSTRT at 0 range 16 .. 16; Reserved_17_23 at 0 range 17 .. 23; SECEOPIE at 0 range 24 .. 24; SECERRIE at 0 range 25 .. 25; SECRDERRIE at 0 range 26 .. 26; Reserved_27_28 at 0 range 27 .. 28; SECINV at 0 range 29 .. 29; Reserved_30_30 at 0 range 30 .. 30; SECLOCK at 0 range 31 .. 31; end record; subtype ECCR_ADDR_ECC_Field is HAL.UInt19; -- Flash ECC register type ECCR_Register is record -- Read-only. ECC fail address ADDR_ECC : ECCR_ADDR_ECC_Field := 16#0#; -- unspecified Reserved_19_20 : HAL.UInt2 := 16#0#; -- Read-only. BK_ECC BK_ECC : Boolean := False; -- Read-only. SYSF_ECC SYSF_ECC : Boolean := False; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- ECC correction interrupt enable ECCIE : Boolean := False; -- unspecified Reserved_25_27 : HAL.UInt3 := 16#0#; -- ECCC2 ECCC2 : Boolean := False; -- ECCD2 ECCD2 : Boolean := False; -- ECC correction ECCC : Boolean := False; -- ECC detection ECCD : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ECCR_Register use record ADDR_ECC at 0 range 0 .. 18; Reserved_19_20 at 0 range 19 .. 20; BK_ECC at 0 range 21 .. 21; SYSF_ECC at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; ECCIE at 0 range 24 .. 24; Reserved_25_27 at 0 range 25 .. 27; ECCC2 at 0 range 28 .. 28; ECCD2 at 0 range 29 .. 29; ECCC at 0 range 30 .. 30; ECCD at 0 range 31 .. 31; end record; subtype OPTR_RDP_Field is HAL.UInt8; subtype OPTR_BOR_LEV_Field is HAL.UInt3; -- Flash option register type OPTR_Register is record -- Read protection level RDP : OPTR_RDP_Field := 16#0#; -- BOR reset Level BOR_LEV : OPTR_BOR_LEV_Field := 16#0#; -- unspecified Reserved_11_11 : HAL.Bit := 16#0#; -- nRST_STOP nRST_STOP : Boolean := False; -- nRST_STDBY nRST_STDBY : Boolean := False; -- nRST_SHDW nRST_SHDW : Boolean := False; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; -- Independent watchdog selection IWDG_SW : Boolean := False; -- Independent watchdog counter freeze in Stop mode IWDG_STOP : Boolean := False; -- Independent watchdog counter freeze in Standby mode IWDG_STDBY : Boolean := False; -- Window watchdog selection WWDG_SW : Boolean := False; -- SWAP_BANK SWAP_BANK : Boolean := False; -- DB256K DB256K : Boolean := False; -- DBANK DBANK : Boolean := False; -- unspecified Reserved_23_23 : HAL.Bit := 16#0#; -- SRAM2 parity check enable SRAM2_PE : Boolean := False; -- SRAM2 Erase when system reset SRAM2_RST : Boolean := False; -- nSWBOOT0 nSWBOOT0 : Boolean := False; -- nBOOT0 nBOOT0 : Boolean := False; -- PA15_PUPEN PA15_PUPEN : Boolean := False; -- unspecified Reserved_29_30 : HAL.UInt2 := 16#0#; -- TZEN TZEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OPTR_Register use record RDP at 0 range 0 .. 7; BOR_LEV at 0 range 8 .. 10; Reserved_11_11 at 0 range 11 .. 11; nRST_STOP at 0 range 12 .. 12; nRST_STDBY at 0 range 13 .. 13; nRST_SHDW at 0 range 14 .. 14; Reserved_15_15 at 0 range 15 .. 15; IWDG_SW at 0 range 16 .. 16; IWDG_STOP at 0 range 17 .. 17; IWDG_STDBY at 0 range 18 .. 18; WWDG_SW at 0 range 19 .. 19; SWAP_BANK at 0 range 20 .. 20; DB256K at 0 range 21 .. 21; DBANK at 0 range 22 .. 22; Reserved_23_23 at 0 range 23 .. 23; SRAM2_PE at 0 range 24 .. 24; SRAM2_RST at 0 range 25 .. 25; nSWBOOT0 at 0 range 26 .. 26; nBOOT0 at 0 range 27 .. 27; PA15_PUPEN at 0 range 28 .. 28; Reserved_29_30 at 0 range 29 .. 30; TZEN at 0 range 31 .. 31; end record; subtype NSBOOTADD0R_NSBOOTADD0_Field is HAL.UInt25; -- Flash non-secure boot address 0 register type NSBOOTADD0R_Register is record -- unspecified Reserved_0_6 : HAL.UInt7 := 16#F#; -- Write-only. NSBOOTADD0 NSBOOTADD0 : NSBOOTADD0R_NSBOOTADD0_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for NSBOOTADD0R_Register use record Reserved_0_6 at 0 range 0 .. 6; NSBOOTADD0 at 0 range 7 .. 31; end record; subtype NSBOOTADD1R_NSBOOTADD1_Field is HAL.UInt25; -- Flash non-secure boot address 1 register type NSBOOTADD1R_Register is record -- unspecified Reserved_0_6 : HAL.UInt7 := 16#F#; -- Write-only. NSBOOTADD1 NSBOOTADD1 : NSBOOTADD1R_NSBOOTADD1_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for NSBOOTADD1R_Register use record Reserved_0_6 at 0 range 0 .. 6; NSBOOTADD1 at 0 range 7 .. 31; end record; subtype SECBOOTADD0R_SECBOOTADD0_Field is HAL.UInt25; -- FFlash secure boot address 0 register type SECBOOTADD0R_Register is record -- BOOT_LOCK BOOT_LOCK : Boolean := False; -- unspecified Reserved_1_6 : HAL.UInt6 := 16#0#; -- Write-only. SECBOOTADD0 SECBOOTADD0 : SECBOOTADD0R_SECBOOTADD0_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECBOOTADD0R_Register use record BOOT_LOCK at 0 range 0 .. 0; Reserved_1_6 at 0 range 1 .. 6; SECBOOTADD0 at 0 range 7 .. 31; end record; subtype SECWM1R1_SECWM1_PSTRT_Field is HAL.UInt7; subtype SECWM1R1_SECWM1_PEND_Field is HAL.UInt7; -- Flash bank 1 secure watermak1 register type SECWM1R1_Register is record -- SECWM1_PSTRT SECWM1_PSTRT : SECWM1R1_SECWM1_PSTRT_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#1FE#; -- SECWM1_PEND SECWM1_PEND : SECWM1R1_SECWM1_PEND_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#1FE#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECWM1R1_Register use record SECWM1_PSTRT at 0 range 0 .. 6; Reserved_7_15 at 0 range 7 .. 15; SECWM1_PEND at 0 range 16 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype SECWM1R2_PCROP1_PSTRT_Field is HAL.UInt7; subtype SECWM1R2_HDP1_PEND_Field is HAL.UInt7; -- Flash secure watermak1 register 2 type SECWM1R2_Register is record -- PCROP1_PSTRT PCROP1_PSTRT : SECWM1R2_PCROP1_PSTRT_Field := 16#0#; -- unspecified Reserved_7_14 : HAL.UInt8 := 16#1E#; -- PCROP1EN PCROP1EN : Boolean := False; -- HDP1_PEND HDP1_PEND : SECWM1R2_HDP1_PEND_Field := 16#0#; -- unspecified Reserved_23_30 : HAL.UInt8 := 16#1E#; -- HDP1EN HDP1EN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECWM1R2_Register use record PCROP1_PSTRT at 0 range 0 .. 6; Reserved_7_14 at 0 range 7 .. 14; PCROP1EN at 0 range 15 .. 15; HDP1_PEND at 0 range 16 .. 22; Reserved_23_30 at 0 range 23 .. 30; HDP1EN at 0 range 31 .. 31; end record; subtype WRP1AR_WRP1A_PSTRT_Field is HAL.UInt7; subtype WRP1AR_WRP1A_PEND_Field is HAL.UInt7; -- Flash Bank 1 WRP area A address register type WRP1AR_Register is record -- WRP1A_PSTRT WRP1A_PSTRT : WRP1AR_WRP1A_PSTRT_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#1FE#; -- WRP1A_PEND WRP1A_PEND : WRP1AR_WRP1A_PEND_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#1FE#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for WRP1AR_Register use record WRP1A_PSTRT at 0 range 0 .. 6; Reserved_7_15 at 0 range 7 .. 15; WRP1A_PEND at 0 range 16 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype WRP1BR_WRP1B_PSTRT_Field is HAL.UInt7; subtype WRP1BR_WRP1B_PEND_Field is HAL.UInt7; -- Flash Bank 1 WRP area B address register type WRP1BR_Register is record -- WRP1B_PSTRT WRP1B_PSTRT : WRP1BR_WRP1B_PSTRT_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#1FE#; -- WRP1B_PEND WRP1B_PEND : WRP1BR_WRP1B_PEND_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#1FE#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for WRP1BR_Register use record WRP1B_PSTRT at 0 range 0 .. 6; Reserved_7_15 at 0 range 7 .. 15; WRP1B_PEND at 0 range 16 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype SECWM2R1_SECWM2_PSTRT_Field is HAL.UInt7; subtype SECWM2R1_SECWM2_PEND_Field is HAL.UInt7; -- Flash secure watermak2 register type SECWM2R1_Register is record -- SECWM2_PSTRT SECWM2_PSTRT : SECWM2R1_SECWM2_PSTRT_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#1FE#; -- SECWM2_PEND SECWM2_PEND : SECWM2R1_SECWM2_PEND_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#1FE#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECWM2R1_Register use record SECWM2_PSTRT at 0 range 0 .. 6; Reserved_7_15 at 0 range 7 .. 15; SECWM2_PEND at 0 range 16 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype SECWM2R2_PCROP2_PSTRT_Field is HAL.UInt7; subtype SECWM2R2_HDP2_PEND_Field is HAL.UInt7; -- Flash secure watermak2 register2 type SECWM2R2_Register is record -- PCROP2_PSTRT PCROP2_PSTRT : SECWM2R2_PCROP2_PSTRT_Field := 16#0#; -- unspecified Reserved_7_14 : HAL.UInt8 := 16#1E#; -- PCROP2EN PCROP2EN : Boolean := False; -- HDP2_PEND HDP2_PEND : SECWM2R2_HDP2_PEND_Field := 16#0#; -- unspecified Reserved_23_30 : HAL.UInt8 := 16#1E#; -- HDP2EN HDP2EN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECWM2R2_Register use record PCROP2_PSTRT at 0 range 0 .. 6; Reserved_7_14 at 0 range 7 .. 14; PCROP2EN at 0 range 15 .. 15; HDP2_PEND at 0 range 16 .. 22; Reserved_23_30 at 0 range 23 .. 30; HDP2EN at 0 range 31 .. 31; end record; subtype WRP2AR_WRP2A_PSTRT_Field is HAL.UInt7; subtype WRP2AR_WRP2A_PEND_Field is HAL.UInt7; -- Flash WPR2 area A address register type WRP2AR_Register is record -- WRP2A_PSTRT WRP2A_PSTRT : WRP2AR_WRP2A_PSTRT_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#1FE#; -- WRP2A_PEND WRP2A_PEND : WRP2AR_WRP2A_PEND_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#1FE#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for WRP2AR_Register use record WRP2A_PSTRT at 0 range 0 .. 6; Reserved_7_15 at 0 range 7 .. 15; WRP2A_PEND at 0 range 16 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; subtype WRP2BR_WRP2B_PSTRT_Field is HAL.UInt7; subtype WRP2BR_WRP2B_PEND_Field is HAL.UInt7; -- Flash WPR2 area B address register type WRP2BR_Register is record -- WRP2B_PSTRT WRP2B_PSTRT : WRP2BR_WRP2B_PSTRT_Field := 16#0#; -- unspecified Reserved_7_15 : HAL.UInt9 := 16#1FE#; -- WRP2B_PEND WRP2B_PEND : WRP2BR_WRP2B_PEND_Field := 16#0#; -- unspecified Reserved_23_31 : HAL.UInt9 := 16#1FE#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for WRP2BR_Register use record WRP2B_PSTRT at 0 range 0 .. 6; Reserved_7_15 at 0 range 7 .. 15; WRP2B_PEND at 0 range 16 .. 22; Reserved_23_31 at 0 range 23 .. 31; end record; -- FLASH secure HDP control register type SECHDPCR_Register is record -- HDP1_ACCDIS HDP1_ACCDIS : Boolean := False; -- HDP2_ACCDIS HDP2_ACCDIS : Boolean := False; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SECHDPCR_Register use record HDP1_ACCDIS at 0 range 0 .. 0; HDP2_ACCDIS at 0 range 1 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; -- Power privilege configuration register type PRIVCFGR_Register is record -- PRIV PRIV : Boolean := False; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PRIVCFGR_Register use record PRIV at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Flash type Flash_Peripheral is record -- Access control register ACR : aliased ACR_Register; -- Power down key register PDKEYR : aliased HAL.UInt32; -- Flash non-secure key register NSKEYR : aliased HAL.UInt32; -- Flash secure key register SECKEYR : aliased HAL.UInt32; -- Flash option key register OPTKEYR : aliased HAL.UInt32; -- Flash low voltage key register LVEKEYR : aliased HAL.UInt32; -- Flash status register NSSR : aliased NSSR_Register; -- Flash status register SECSR : aliased SECSR_Register; -- Flash non-secure control register NSCR : aliased NSCR_Register; -- Flash secure control register SECCR : aliased SECCR_Register; -- Flash ECC register ECCR : aliased ECCR_Register; -- Flash option register OPTR : aliased OPTR_Register; -- Flash non-secure boot address 0 register NSBOOTADD0R : aliased NSBOOTADD0R_Register; -- Flash non-secure boot address 1 register NSBOOTADD1R : aliased NSBOOTADD1R_Register; -- FFlash secure boot address 0 register SECBOOTADD0R : aliased SECBOOTADD0R_Register; -- Flash bank 1 secure watermak1 register SECWM1R1 : aliased SECWM1R1_Register; -- Flash secure watermak1 register 2 SECWM1R2 : aliased SECWM1R2_Register; -- Flash Bank 1 WRP area A address register WRP1AR : aliased WRP1AR_Register; -- Flash Bank 1 WRP area B address register WRP1BR : aliased WRP1BR_Register; -- Flash secure watermak2 register SECWM2R1 : aliased SECWM2R1_Register; -- Flash secure watermak2 register2 SECWM2R2 : aliased SECWM2R2_Register; -- Flash WPR2 area A address register WRP2AR : aliased WRP2AR_Register; -- Flash WPR2 area B address register WRP2BR : aliased WRP2BR_Register; -- FLASH secure block based bank 1 register SECBB1R1 : aliased HAL.UInt32; -- FLASH secure block based bank 1 register SECBB1R2 : aliased HAL.UInt32; -- FLASH secure block based bank 1 register SECBB1R3 : aliased HAL.UInt32; -- FLASH secure block based bank 1 register SECBB1R4 : aliased HAL.UInt32; -- FLASH secure block based bank 2 register SECBB2R1 : aliased HAL.UInt32; -- FLASH secure block based bank 2 register SECBB2R2 : aliased HAL.UInt32; -- FLASH secure block based bank 2 register SECBB2R3 : aliased HAL.UInt32; -- FLASH secure block based bank 2 register SECBB2R4 : aliased HAL.UInt32; -- FLASH secure HDP control register SECHDPCR : aliased SECHDPCR_Register; -- Power privilege configuration register PRIVCFGR : aliased PRIVCFGR_Register; end record with Volatile; for Flash_Peripheral use record ACR at 16#0# range 0 .. 31; PDKEYR at 16#4# range 0 .. 31; NSKEYR at 16#8# range 0 .. 31; SECKEYR at 16#C# range 0 .. 31; OPTKEYR at 16#10# range 0 .. 31; LVEKEYR at 16#14# range 0 .. 31; NSSR at 16#20# range 0 .. 31; SECSR at 16#24# range 0 .. 31; NSCR at 16#28# range 0 .. 31; SECCR at 16#2C# range 0 .. 31; ECCR at 16#30# range 0 .. 31; OPTR at 16#40# range 0 .. 31; NSBOOTADD0R at 16#44# range 0 .. 31; NSBOOTADD1R at 16#48# range 0 .. 31; SECBOOTADD0R at 16#4C# range 0 .. 31; SECWM1R1 at 16#50# range 0 .. 31; SECWM1R2 at 16#54# range 0 .. 31; WRP1AR at 16#58# range 0 .. 31; WRP1BR at 16#5C# range 0 .. 31; SECWM2R1 at 16#60# range 0 .. 31; SECWM2R2 at 16#64# range 0 .. 31; WRP2AR at 16#68# range 0 .. 31; WRP2BR at 16#6C# range 0 .. 31; SECBB1R1 at 16#80# range 0 .. 31; SECBB1R2 at 16#84# range 0 .. 31; SECBB1R3 at 16#88# range 0 .. 31; SECBB1R4 at 16#8C# range 0 .. 31; SECBB2R1 at 16#A0# range 0 .. 31; SECBB2R2 at 16#A4# range 0 .. 31; SECBB2R3 at 16#A8# range 0 .. 31; SECBB2R4 at 16#AC# range 0 .. 31; SECHDPCR at 16#C0# range 0 .. 31; PRIVCFGR at 16#C4# range 0 .. 31; end record; -- Flash FLASH_Periph : aliased Flash_Peripheral with Import, Address => System'To_Address (16#40022000#); -- Flash SEC_FLASH_Periph : aliased Flash_Peripheral with Import, Address => System'To_Address (16#50022000#); end STM32_SVD.Flash;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.Types; private with GL.Low_Level; package GL.Pixels is pragma Preelaborate; use GL.Types; type Internal_Format is (Depth_Component, Red, Alpha, RGB, RGBA, Luminance, Luminance_Alpha, R3_G3_B2, Alpha4, Alpha8, Alpha12, Alpha16, Luminance4, Luminance8, Luminance12, Luminance16, Luminance4_Alpha4, Luminance6_Alpha2, Luminance8_Alpha8, Luminance12_Alpha4, Luminance12_Alpha12, Luminance16_Alpha16, Intensity, Intensity4, Intensity8, Intensity12, Intensity16, RGB4, RGB5, RGB8, RGB10, RGB12, RGB16, RGBA2, RGBA4, RGB5_A1, RGBA8, RGB10_A2, RGBA12, RGBA16, Depth_Component16, Depth_Component24, Depth_Component32, Compressed_Red, Compressed_RG, RG, R8, R16, RG8, RG16, R16F, R32F, RG16F, RG32F, R8I, R8UI, R16I, R16UI, R32I, R32UI, RG8I, RG8UI, RG16I, RG16UI, RG32I, RG32UI, Compressed_RGB_S3TC_DXT1, Compressed_RGBA_S3TC_DXT1, Compressed_RGBA_S3TC_DXT3, Compressed_RGBA_S3TC_DXT5, Compressed_Alpha, Compressed_Luminance, Compressed_Luminance_Alpha, Compressed_Intensity, Compressed_RGB, Compressed_RGBA, RGBA32F, RGB32F, RGBA16F, RGB16F, Depth24_Stencil8, R11F_G11F_B10F, RGB9_E5, SRGB, SRGB8, SRGB_Alpha, SRGB8_Alpha8, SLuminance_Alpha, SLuminance8_Alpha8, SLuminance, SLuminance8, Compressed_SRGB, Compressed_SRGB_Alpha, Compressed_SRGB_S3TC_DXT1, Compressed_SRGB_Alpha_S3TC_DXT1, Compressed_SRGB_Alpha_S3TC_DXT3, Compressed_SRGB_Alpha_S3TC_DXT5, RGBA32UI, RGB32UI, RGBA16UI, RGB16UI, RGBA8UI, RGB8UI, RGBA32I, RGB32I, RGBA16I, RGB16I, RGBA8I, RGB8I, Compressed_Red_RGTC1, Compressed_Signed_Red_RGTC1, Compressed_RG_RGTC2, Compressed_Signed_RG_RGTC2, Compressed_RGBA_BPTC_Unorm, Compressed_SRGB_Alpha_BPTC_UNorm, Compressed_RGB_BPTC_Signed_Float, Compressed_RGB_BPTC_Unsigned_Float, R8_SNorm, RG8_SNorm, RGB8_SNorm, RGBA8_SNorm, R16_SNorm, RG16_SNorm, RGB16_SNorm, RGBA16_SNorm, RGB10_A2UI, Compressed_RGBA_ASTC_4x4, Compressed_RGBA_ASTC_5x4, Compressed_RGBA_ASTC_5x5, Compressed_RGBA_ASTC_6x5, Compressed_RGBA_ASTC_6x6, Compressed_RGBA_ASTC_8x5, Compressed_RGBA_ASTC_8x6, Compressed_RGBA_ASTC_8x8, Compressed_RGBA_ASTC_10x5, Compressed_RGBA_ASTC_10x6, Compressed_RGBA_ASTC_10x8, Compressed_RGBA_ASTC_10x10, Compressed_RGBA_ASTC_12x10, Compressed_RGBA_ASTC_12x12, Compressed_SRGB8_Alpha8_ASTC_4x4, Compressed_SRGB8_Alpha8_ASTC_5x4, Compressed_SRGB8_Alpha8_ASTC_5x5, Compressed_SRGB8_Alpha8_ASTC_6x5, Compressed_SRGB8_Alpha8_ASTC_6x6, Compressed_SRGB8_Alpha8_ASTC_8x5, Compressed_SRGB8_Alpha8_ASTC_8x6, Compressed_SRGB8_Alpha8_ASTC_8x8, Compressed_SRGB8_Alpha8_ASTC_10x5, Compressed_SRGB8_Alpha8_ASTC_10x6, Compressed_SRGB8_Alpha8_ASTC_10x8, Compressed_SRGB8_Alpha8_ASTC_10x10, Compressed_SRGB8_Alpha8_ASTC_12x10, Compressed_SRGB8_Alpha8_ASTC_12x12); type Framebuffer_Format is (Color_Index, Red, Green, Blue, Alpha, RGB, RGBA, Luminance, Luminance_Alpha, BGR, BGRA); type Data_Format is (Stencil_Index, Depth_Component, Red, RGB, RGBA, BGR, BGRA, RG, RG_Integer, Depth_Stencil, Red_Integer, RGB_Integer, RGBA_Integer, BGR_Integer, BGRA_Integer); type Data_Type is (Byte, Unsigned_Byte, Short, Unsigned_Short, Int, Unsigned_Int, Float, Bitmap, Unsigned_Byte_3_3_2, Unsigned_Short_4_4_4_4, Unsigned_Short_5_5_5_1, Unsigned_Int_8_8_8_8, Unsigned_Int_10_10_10_2, Unsigned_Byte_2_3_3_Rev, Unsigned_Short_5_6_5, Unsinged_Short_5_6_5_Rev, Unsigned_Short_4_4_4_4_Rev, Unsigned_Short_1_5_5_5_Rev, Unsigned_Int_8_8_8_8_Rev, Unsigned_Int_2_10_10_10_Rev); type Channel_Data_Type is (None, Int_Type, Unsigned_Int_Type, Float_Type, Unsigned_Normalized, Signed_Normalized); type Alignment is (Bytes, Even_Bytes, Words, Double_Words); procedure Set_Pack_Swap_Bytes (Value : Boolean); procedure Set_Pack_LSB_First (Value : Boolean); procedure Set_Pack_Row_Length (Value : Size); procedure Set_Pack_Image_Height (Value : Size); procedure Set_Pack_Skip_Pixels (Value : Size); procedure Set_Pack_Skip_Rows (Value : Size); procedure Set_Pack_Skip_Images (Value : Size); procedure Set_Pack_Alignment (Value : Alignment); function Pack_Swap_Bytes return Boolean; function Pack_LSB_First return Boolean; function Pack_Row_Length return Size; function Pack_Image_Height return Size; function Pack_Skip_Pixels return Size; function Pack_Skip_Rows return Size; function Pack_Skip_Images return Size; function Pack_Alignment return Alignment; procedure Set_Unpack_Swap_Bytes (Value : Boolean); procedure Set_Unpack_LSB_First (Value : Boolean); procedure Set_Unpack_Row_Length (Value : Size); procedure Set_Unpack_Image_Height (Value : Size); procedure Set_Unpack_Skip_Pixels (Value : Size); procedure Set_Unpack_Skip_Rows (Value : Size); procedure Set_Unpack_Skip_Images (Value : Size); procedure Set_Unpack_Alignment (Value : Alignment); function Unpack_Swap_Bytes return Boolean; function Unpack_LSB_First return Boolean; function Unpack_Row_Length return Size; function Unpack_Image_Height return Size; function Unpack_Skip_Pixels return Size; function Unpack_Skip_Rows return Size; function Unpack_Skip_Images return Size; function Unpack_Alignment return Alignment; private for Internal_Format use (Depth_Component => 16#1902#, Red => 16#1903#, Alpha => 16#1906#, RGB => 16#1907#, RGBA => 16#1908#, Luminance => 16#1909#, Luminance_Alpha => 16#190A#, R3_G3_B2 => 16#2A10#, Alpha4 => 16#803B#, Alpha8 => 16#803C#, Alpha12 => 16#803D#, Alpha16 => 16#803E#, Luminance4 => 16#803F#, Luminance8 => 16#8040#, Luminance12 => 16#8041#, Luminance16 => 16#8042#, Luminance4_Alpha4 => 16#8043#, Luminance6_Alpha2 => 16#8044#, Luminance8_Alpha8 => 16#8045#, Luminance12_Alpha4 => 16#8046#, Luminance12_Alpha12 => 16#8047#, Luminance16_Alpha16 => 16#8048#, Intensity => 16#8049#, Intensity4 => 16#804A#, Intensity8 => 16#804B#, Intensity12 => 16#804C#, Intensity16 => 16#804D#, RGB4 => 16#804F#, RGB5 => 16#8050#, RGB8 => 16#8051#, RGB10 => 16#8052#, RGB12 => 16#8053#, RGB16 => 16#8054#, RGBA2 => 16#8055#, RGBA4 => 16#8056#, RGB5_A1 => 16#8057#, RGBA8 => 16#8058#, RGB10_A2 => 16#8059#, RGBA12 => 16#805A#, RGBA16 => 16#805B#, Depth_Component16 => 16#81A5#, Depth_Component24 => 16#81A6#, Depth_Component32 => 16#81A7#, Compressed_Red => 16#8225#, Compressed_RG => 16#8226#, RG => 16#8227#, R8 => 16#8229#, R16 => 16#822A#, RG8 => 16#822B#, RG16 => 16#822C#, R16F => 16#822D#, R32F => 16#822E#, RG16F => 16#822F#, RG32F => 16#8230#, R8I => 16#8231#, R8UI => 16#8232#, R16I => 16#8233#, R16UI => 16#8234#, R32I => 16#8235#, R32UI => 16#8236#, RG8I => 16#8237#, RG8UI => 16#8238#, RG16I => 16#8239#, RG16UI => 16#823A#, RG32I => 16#823B#, RG32UI => 16#823C#, Compressed_RGB_S3TC_DXT1 => 16#83F0#, Compressed_RGBA_S3TC_DXT1 => 16#83F1#, Compressed_RGBA_S3TC_DXT3 => 16#83F2#, Compressed_RGBA_S3TC_DXT5 => 16#83F3#, Compressed_Alpha => 16#84E9#, Compressed_Luminance => 16#84EA#, Compressed_Luminance_Alpha => 16#84EB#, Compressed_Intensity => 16#84EC#, Compressed_RGB => 16#84ED#, Compressed_RGBA => 16#84EE#, RGBA32F => 16#8814#, RGB32F => 16#8815#, RGBA16F => 16#881A#, RGB16F => 16#881B#, Depth24_Stencil8 => 16#88F0#, R11F_G11F_B10F => 16#8C3A#, RGB9_E5 => 16#8C3D#, SRGB => 16#8C40#, SRGB8 => 16#8C41#, SRGB_Alpha => 16#8C42#, SRGB8_Alpha8 => 16#8C43#, SLuminance_Alpha => 16#8C44#, SLuminance8_Alpha8 => 16#8C45#, SLuminance => 16#8C46#, SLuminance8 => 16#8C47#, Compressed_SRGB => 16#8C48#, Compressed_SRGB_Alpha => 16#8C49#, Compressed_SRGB_S3TC_DXT1 => 16#8C4C#, Compressed_SRGB_Alpha_S3TC_DXT1 => 16#8C4D#, Compressed_SRGB_Alpha_S3TC_DXT3 => 16#8C4E#, Compressed_SRGB_Alpha_S3TC_DXT5 => 16#8C4F#, RGBA32UI => 16#8D70#, RGB32UI => 16#8D71#, RGBA16UI => 16#8D76#, RGB16UI => 16#8D77#, RGBA8UI => 16#8D7C#, RGB8UI => 16#8D7D#, RGBA32I => 16#8D82#, RGB32I => 16#8D83#, RGBA16I => 16#8D88#, RGB16I => 16#8D89#, RGBA8I => 16#8D8E#, RGB8I => 16#8D8F#, Compressed_Red_RGTC1 => 16#8DBB#, Compressed_Signed_Red_RGTC1 => 16#8DBC#, Compressed_RG_RGTC2 => 16#8DBD#, Compressed_Signed_RG_RGTC2 => 16#8DBE#, Compressed_RGBA_BPTC_Unorm => 16#8E8C#, Compressed_SRGB_Alpha_BPTC_UNorm => 16#8E8D#, Compressed_RGB_BPTC_Signed_Float => 16#8E8E#, Compressed_RGB_BPTC_Unsigned_Float => 16#8E8F#, R8_SNorm => 16#8F94#, RG8_SNorm => 16#8F95#, RGB8_SNorm => 16#8F96#, RGBA8_SNorm => 16#8F97#, R16_SNorm => 16#8F98#, RG16_SNorm => 16#8F99#, RGB16_SNorm => 16#8F9A#, RGBA16_SNorm => 16#8F9B#, RGB10_A2UI => 16#906F#, Compressed_RGBA_ASTC_4x4 => 16#93B0#, Compressed_RGBA_ASTC_5x4 => 16#93B1#, Compressed_RGBA_ASTC_5x5 => 16#93B2#, Compressed_RGBA_ASTC_6x5 => 16#93B3#, Compressed_RGBA_ASTC_6x6 => 16#93B4#, Compressed_RGBA_ASTC_8x5 => 16#93B5#, Compressed_RGBA_ASTC_8x6 => 16#93B6#, Compressed_RGBA_ASTC_8x8 => 16#93B7#, Compressed_RGBA_ASTC_10x5 => 16#93B8#, Compressed_RGBA_ASTC_10x6 => 16#93B9#, Compressed_RGBA_ASTC_10x8 => 16#93BA#, Compressed_RGBA_ASTC_10x10 => 16#93BB#, Compressed_RGBA_ASTC_12x10 => 16#93BC#, Compressed_RGBA_ASTC_12x12 => 16#93BD#, Compressed_SRGB8_Alpha8_ASTC_4x4 => 16#93D0#, Compressed_SRGB8_Alpha8_ASTC_5x4 => 16#93D1#, Compressed_SRGB8_Alpha8_ASTC_5x5 => 16#93D2#, Compressed_SRGB8_Alpha8_ASTC_6x5 => 16#93D3#, Compressed_SRGB8_Alpha8_ASTC_6x6 => 16#93D4#, Compressed_SRGB8_Alpha8_ASTC_8x5 => 16#93D5#, Compressed_SRGB8_Alpha8_ASTC_8x6 => 16#93D6#, Compressed_SRGB8_Alpha8_ASTC_8x8 => 16#93D7#, Compressed_SRGB8_Alpha8_ASTC_10x5 => 16#93D8#, Compressed_SRGB8_Alpha8_ASTC_10x6 => 16#93D9#, Compressed_SRGB8_Alpha8_ASTC_10x8 => 16#93DA#, Compressed_SRGB8_Alpha8_ASTC_10x10 => 16#93DB#, Compressed_SRGB8_Alpha8_ASTC_12x10 => 16#93DC#, Compressed_SRGB8_Alpha8_ASTC_12x12 => 16#93DD#); for Internal_Format'Size use GL.Types.Int'Size; for Framebuffer_Format use (Color_Index => 16#1900#, Red => 16#1903#, Green => 16#1904#, Blue => 16#1905#, Alpha => 16#1906#, RGB => 16#1907#, RGBA => 16#1908#, Luminance => 16#1909#, Luminance_Alpha => 16#190A#, BGR => 16#80E0#, BGRA => 16#80E1#); for Framebuffer_Format'Size use Low_Level.Enum'Size; for Data_Format use (Stencil_Index => 16#1901#, Depth_Component => 16#1902#, Red => 16#1903#, RGB => 16#1907#, RGBA => 16#1908#, BGR => 16#80E0#, BGRA => 16#80E1#, RG => 16#8227#, RG_Integer => 16#8228#, Depth_Stencil => 16#84F9#, Red_Integer => 16#8D94#, RGB_Integer => 16#8D98#, RGBA_Integer => 16#8D99#, BGR_Integer => 16#8D9A#, BGRA_Integer => 16#8D9B#); for Data_Format'Size use Low_Level.Enum'Size; for Data_Type use (Byte => 16#1400#, Unsigned_Byte => 16#1401#, Short => 16#1402#, Unsigned_Short => 16#1403#, Int => 16#1404#, Unsigned_Int => 16#1405#, Float => 16#1406#, Bitmap => 16#1A00#, Unsigned_Byte_3_3_2 => 16#8032#, Unsigned_Short_4_4_4_4 => 16#8033#, Unsigned_Short_5_5_5_1 => 16#8034#, Unsigned_Int_8_8_8_8 => 16#8035#, Unsigned_Int_10_10_10_2 => 16#8036#, Unsigned_Byte_2_3_3_Rev => 16#8362#, Unsigned_Short_5_6_5 => 16#8363#, Unsinged_Short_5_6_5_Rev => 16#8364#, Unsigned_Short_4_4_4_4_Rev => 16#8365#, Unsigned_Short_1_5_5_5_Rev => 16#8366#, Unsigned_Int_8_8_8_8_Rev => 16#8367#, Unsigned_Int_2_10_10_10_Rev => 16#8368#); for Data_Type'Size use Low_Level.Enum'Size; for Channel_Data_Type use (None => 0, Int_Type => 16#1404#, Unsigned_Int_Type => 16#1405#, Float_Type => 16#1406#, Unsigned_Normalized => 16#8C17#, Signed_Normalized => 16#8F9C#); for Channel_Data_Type'Size use Low_Level.Enum'Size; for Alignment use (Bytes => 1, Even_Bytes => 2, Words => 4, Double_Words => 8); for Alignment'Size use Types.Int'Size; end GL.Pixels;
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../../License.txt with CommonText; with AdaBase.Connection.Base; with AdaBase.Logger.Facility; with AdaBase.Interfaces.Driver; package AdaBase.Driver.Base is package CT renames CommonText; package ACB renames AdaBase.Connection.Base; package ALF renames AdaBase.Logger.Facility; package AID renames AdaBase.Interfaces.Driver; type Base_Driver is abstract new Base_Pure and AID.iDriver with private; overriding procedure command_standard_logger (driver : Base_Driver; device : ALF.TLogger; action : ALF.TAction); overriding procedure set_logger_filename (driver : Base_Driver; filename : String); overriding procedure detach_custom_logger (driver : Base_Driver); overriding procedure attach_custom_logger (driver : Base_Driver; logger_access : ALF.AL.BaseClass_Logger_access); overriding procedure disconnect (driver : out Base_Driver); overriding procedure rollback (driver : Base_Driver); overriding procedure commit (driver : Base_Driver); overriding function last_insert_id (driver : Base_Driver) return Trax_ID; overriding function last_sql_state (driver : Base_Driver) return SQL_State; overriding function last_driver_code (driver : Base_Driver) return Driver_Codes; overriding function last_driver_message (driver : Base_Driver) return String; overriding procedure basic_connect (driver : out Base_Driver; database : String; username : String := blankstring; password : String := blankstring; socket : String := blankstring); overriding procedure basic_connect (driver : out Base_Driver; database : String; username : String := blankstring; password : String := blankstring; hostname : String := blankstring; port : Posix_Port); overriding function trait_autocommit (driver : Base_Driver) return Boolean; overriding function trait_column_case (driver : Base_Driver) return Case_Modes; overriding function trait_error_mode (driver : Base_Driver) return Error_Modes; overriding function trait_connected (driver : Base_Driver) return Boolean; overriding function trait_driver (driver : Base_Driver) return String; overriding function trait_client_info (driver : Base_Driver) return String; overriding function trait_client_version (driver : Base_Driver) return String; overriding function trait_server_info (driver : Base_Driver) return String; overriding function trait_server_version (driver : Base_Driver) return String; overriding function trait_max_blob_size (driver : Base_Driver) return BLOB_Maximum; overriding function trait_multiquery_enabled (driver : Base_Driver) return Boolean; overriding function trait_character_set (driver : Base_Driver) return String; overriding procedure set_trait_multiquery_enabled (driver : Base_Driver; trait : Boolean); overriding procedure set_trait_autocommit (driver : Base_Driver; trait : Boolean); overriding procedure set_trait_column_case (driver : Base_Driver; trait : Case_Modes); overriding procedure set_trait_error_mode (driver : Base_Driver; trait : Error_Modes); overriding procedure set_trait_max_blob_size (driver : Base_Driver; trait : BLOB_Maximum); overriding procedure set_trait_character_set (driver : Base_Driver; trait : String); overriding procedure query_clear_table (driver : Base_Driver; table : String); overriding procedure query_drop_table (driver : Base_Driver; tables : String; when_exists : Boolean := False; cascade : Boolean := False); private logger : aliased ALF.LogFacility; type Base_Driver is abstract new Base_Pure and AID.iDriver with record connection : ACB.Base_Connection_Access; connection_active : Boolean := False; dialect : Driver_Type := foundation; database : CT.Text := CT.blank; end record; procedure log_nominal (driver : Base_Driver; category : Log_Category; message : CT.Text); procedure log_problem (driver : Base_Driver; category : Log_Category; message : CT.Text; pull_codes : Boolean := False; break : Boolean := False); overriding procedure initialize (Object : in out Base_Driver) is null; function assembly_common_select (distinct : Boolean; tables : String; columns : String; conditions : String; groupby : String; having : String; order : String) return String; procedure private_connect (driver : out Base_Driver; database : String; username : String; password : String; hostname : String := blankstring; socket : String := blankstring; port : Posix_Port := portless) is null; end AdaBase.Driver.Base;
with direccion,estado_casillero; use direccion,estado_casillero; package aspiradora is -- IMPORTANTE 1: En Ada deben definirse la clase del objeto y los metodos en el mismo alcance -- IMPORTANTE 2: En Ada debe pasarse el objeto como paramtero en cada metodo. Es un this explicito type t_aspiradora is tagged record direccion : t_direccion; end record; procedure moverse(a : in out t_aspiradora); function limpiar(a : in out t_aspiradora) return t_estado_casillero; procedure no_hacer_nada(a : in out t_aspiradora); procedure set_direccion(a : in out t_aspiradora; d: in t_direccion); function get_direccion (a : in t_aspiradora) return t_direccion ; end aspiradora;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.Enums.Getter; with GL.API; package body GL.Fixed.Lighting is use type Toggles.Toggle_State; Light_Model_Enabled : aliased constant Int := 1; Light_Model_Disabled : aliased constant Int := 0; function Light (Index : Light_Index) return Light_Object is begin return Light_Object'(Identifier => Toggles.Toggle'Val ( Toggles.Toggle'Pos (Toggles.Light0) + Index)); end Light; procedure Enable_Lighting is begin Toggles.Enable (Toggles.Lighting); end Enable_Lighting; procedure Disable_Lighting is begin Toggles.Disable (Toggles.Lighting); end Disable_Lighting; function Lighting_Enabled return Boolean is begin return Toggles.State (Toggles.Lighting) = Toggles.Enabled; end Lighting_Enabled; procedure Enable_Local_Viewer is begin API.Light_Model_Toggles (Enums.Local_Viewer, Light_Model_Enabled'Access); Raise_Exception_On_OpenGL_Error; end Enable_Local_Viewer; procedure Disable_Local_Viewer is begin API.Light_Model_Toggles (Enums.Local_Viewer, Light_Model_Disabled'Access); Raise_Exception_On_OpenGL_Error; end Disable_Local_Viewer; function Local_Viewer_Enabled return Boolean is Value : aliased Low_Level.Bool; begin API.Get_Boolean (Enums.Getter.Light_Model_Local_Viewer, Value'Access); Raise_Exception_On_OpenGL_Error; return Boolean (Value); end Local_Viewer_Enabled; procedure Enable_Two_Side is begin API.Light_Model_Toggles (Enums.Two_Side, Light_Model_Enabled'Access); Raise_Exception_On_OpenGL_Error; end Enable_Two_Side; procedure Disable_Two_Side is begin API.Light_Model_Toggles (Enums.Two_Side, Light_Model_Disabled'Access); Raise_Exception_On_OpenGL_Error; end Disable_Two_Side; function Two_Side_Enabled return Boolean is Value : aliased Low_Level.Bool; begin API.Get_Boolean (Enums.Getter.Light_Model_Two_Side, Value'Access); Raise_Exception_On_OpenGL_Error; return Boolean (Value); end Two_Side_Enabled; procedure Set_Global_Ambient_Light (Value : Colors.Color) is begin API.Light_Model_Color (Enums.Ambient, Value); Raise_Exception_On_OpenGL_Error; end Set_Global_Ambient_Light; function Global_Ambient_Light return Colors.Color is Value : Colors.Color; begin API.Get_Color (Enums.Getter.Light_Model_Ambient, Value); Raise_Exception_On_OpenGL_Error; return Value; end Global_Ambient_Light; procedure Set_Color_Control (Value : Color_Control) is Aliased_Value : aliased constant Color_Control := Value; begin API.Light_Model_Color_Control (Enums.Color_Control, Aliased_Value'Access); Raise_Exception_On_OpenGL_Error; end Set_Color_Control; function Current_Color_Control return Color_Control is Value : aliased Color_Control; begin API.Get_Color_Control (Enums.Getter.Light_Model_Color_Control, Value'Access); Raise_Exception_On_OpenGL_Error; return Value; end Current_Color_Control; procedure Set_Shade_Model (Value : Shade_Model) is begin API.Shade_Model (Value); Raise_Exception_On_OpenGL_Error; end Set_Shade_Model; function Current_Shade_Model return Shade_Model is Value : aliased Shade_Model; begin API.Get_Shade_Model (Enums.Getter.Shade_Model, Value'Access); Raise_Exception_On_OpenGL_Error; return Value; end Current_Shade_Model; procedure Enable (Source : Light_Object) is begin Toggles.Enable (Source.Identifier); end Enable; procedure Disable (Source : Light_Object) is begin Toggles.Disable (Source.Identifier); end Disable; function Enabled (Source : Light_Object) return Boolean is begin return Toggles.State (Source.Identifier) = Toggles.Enabled; end Enabled; procedure Set_Ambient (Source : Light_Object; Color : Colors.Color) is begin API.Light_Color (Source.Identifier, Enums.Ambient, Color); Raise_Exception_On_OpenGL_Error; end Set_Ambient; function Ambient (Source : Light_Object) return Colors.Color is Value : Colors.Color; begin API.Get_Light_Color (Source.Identifier, Enums.Ambient, Value); Raise_Exception_On_OpenGL_Error; return Value; end Ambient; procedure Set_Diffuse (Source : Light_Object; Color : Colors.Color) is begin API.Light_Color (Source.Identifier, Enums.Diffuse, Color); Raise_Exception_On_OpenGL_Error; end Set_Diffuse; function Diffuse (Source : Light_Object) return Colors.Color is Value : Colors.Color; begin API.Get_Light_Color (Source.Identifier, Enums.Diffuse, Value); Raise_Exception_On_OpenGL_Error; return Value; end Diffuse; procedure Set_Specular (Source : Light_Object; Color : Colors.Color) is begin API.Light_Color (Source.Identifier, Enums.Specular, Color); Raise_Exception_On_OpenGL_Error; end Set_Specular; function Specular (Source : Light_Object) return Colors.Color is Value : Colors.Color; begin API.Get_Light_Color (Source.Identifier, Enums.Specular, Value); Raise_Exception_On_OpenGL_Error; return Value; end Specular; procedure Set_Position (Source : Light_Object; Position : Types.Singles.Vector4) is begin API.Light_Position (Source.Identifier, Enums.Position, Position); Raise_Exception_On_OpenGL_Error; end Set_Position; function Position (Source : Light_Object) return Types.Singles.Vector4 is Value : Types.Singles.Vector4; begin API.Get_Light_Position (Source.Identifier, Enums.Position, Value); Raise_Exception_On_OpenGL_Error; return Value; end Position; procedure Set_Spot_Direction (Source : Light_Object; Direction : Types.Singles.Vector3) is begin API.Light_Direction (Source.Identifier, Enums.Spot_Direction, Direction); Raise_Exception_On_OpenGL_Error; end Set_Spot_Direction; function Spot_Direction (Source : Light_Object) return Types.Singles.Vector3 is Value : Singles.Vector3; begin API.Get_Light_Direction (Source.Identifier, Enums.Spot_Direction, Value); Raise_Exception_On_OpenGL_Error; return Value; end Spot_Direction; end GL.Fixed.Lighting;
----------------------------------------------------------------------- -- Util.Concurrent -- Concurrent Counters -- Copyright (C) 2009, 2010 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- This implementation of atomic counters is the portable Ada05 implementation. -- It uses a protected type to implement the increment/decrement operations, -- thus providing the thread-safe capability. package body Util.Concurrent.Counters is function ONE return Counter is begin return C : Counter do C.Value.Increment; end return; end ONE; -- ------------------------------ -- Increment the counter atomically. -- ------------------------------ procedure Increment (C : in out Counter) is begin C.Value.Increment; end Increment; -- ------------------------------ -- Increment the counter atomically and return the value before increment. -- ------------------------------ procedure Increment (C : in out Counter; Value : out Integer) is begin C.Value.Increment (Value); end Increment; -- ------------------------------ -- Decrement the counter atomically. -- ------------------------------ procedure Decrement (C : in out Counter) is Is_Zero : Boolean; begin C.Value.Decrement (Is_Zero); end Decrement; -- ------------------------------ -- Decrement the counter atomically and return a status. -- ------------------------------ procedure Decrement (C : in out Counter; Is_Zero : out Boolean) is begin C.Value.Decrement (Is_Zero); end Decrement; -- ------------------------------ -- Get the counter value -- ------------------------------ function Value (C : in Counter) return Integer is begin return C.Value.Get; end Value; protected body Cnt is procedure Increment is begin N := N + 1; end Increment; procedure Increment (Value : out Integer) is begin Value := N; N := N + 1; end Increment; procedure Decrement (Is_Zero : out Boolean) is begin N := N - 1; Is_Zero := N = 0; end Decrement; function Get return Natural is begin return N; end Get; end Cnt; end Util.Concurrent.Counters;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2010, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- ------------------------------------------------------------------------------ with System.Machine_Code; with Interfaces; use Interfaces; package body Gdbstub.CPU is type Gpr_Context is array (0 .. 31) of Unsigned_32; type Fpr_Context is array (0 .. 31) of IEEE_Float_64; type Cpu_Context is record Gpr : Gpr_Context; Fpr : Fpr_Context; PC : Unsigned_32; MSR : Unsigned_32; CR : Unsigned_32; LR : Unsigned_32; CTR : Unsigned_32; XER : Unsigned_32; FPSCR : Unsigned_32; end record; type Cpu_Context_Acc is access all Cpu_Context; Regs : Cpu_Context_Acc; MSR_SE : constant Unsigned_32 := 2 ** (31 - 21); SIGTRAP : constant Integer := 5; procedure Exception_Handler (Val : Integer; Context : Cpu_Context_Acc); procedure Exception_Handler (Val : Integer; Context : Cpu_Context_Acc) is pragma Unreferenced (Val); begin Regs := Context; Gdbstub.Registers_Area := Context.all'Address; Gdbstub.Registers_Size := Cpu_Context'Size / 8; Gdbstub.Handle_Exception (SIGTRAP); end Exception_Handler; procedure Get_Register_Area (Reg : Natural; Area : out Address; Size : out Storage_Count) is begin case Reg is when 0 .. 31 => Area := Regs.Gpr (Reg)'Address; Size := 4; when 32 .. 63 => Area := Regs.Fpr (Reg - 32)'Address; Size := 8; when 64 => Area := Regs.PC'Address; Size := 4; when 65 => Area := Regs.MSR'Address; Size := 4; when 66 => Area := Regs.CR'Address; Size := 4; when 67 => Area := Regs.LR'Address; Size := 4; when 68 => Area := Regs.CTR'Address; Size := 4; when 69 => Area := Regs.XER'Address; Size := 4; when 70 => Area := Regs.FPSCR'Address; Size := 4; when others => Area := Null_Address; Size := 0; end case; end Get_Register_Area; type Vector_Id is range 0 .. 16#2fff#; System_Reset_Excp : constant Vector_Id := 16#100#; Machine_Check_Excp : constant Vector_Id := 16#200#; DSI_Excp : constant Vector_Id := 16#300#; ISI_Excp : constant Vector_Id := 16#400#; External_Interrupt_Excp : constant Vector_Id := 16#500#; Alignment_Excp : constant Vector_Id := 16#600#; Program_Excp : constant Vector_Id := 16#700#; FP_Unavailable_Excp : constant Vector_Id := 16#800#; Decrementer_Excp : constant Vector_Id := 16#900#; System_Call_Excp : constant Vector_Id := 16#C00#; Trace_Excp : constant Vector_Id := 16#D00#; FP_Assist_Excp : constant Vector_Id := 16#E00#; pragma Unreferenced (Alignment_Excp); pragma Unreferenced (System_Reset_Excp); pragma Unreferenced (Machine_Check_Excp); pragma Unreferenced (DSI_Excp); pragma Unreferenced (ISI_Excp); pragma Unreferenced (External_Interrupt_Excp); pragma Unreferenced (FP_Assist_Excp); pragma Unreferenced (FP_Unavailable_Excp); pragma Unreferenced (System_Call_Excp); pragma Unreferenced (Decrementer_Excp); procedure Copy_Debug_Handler (Handler : Address; Vector : Vector_Id; Param : Integer); pragma Import (C, Copy_Debug_Handler); procedure Setup_Handlers is begin Copy_Debug_Handler (Exception_Handler'Address, Program_Excp, 0); Copy_Debug_Handler (Exception_Handler'Address, Trace_Excp, 1); end Setup_Handlers; procedure Breakpoint is procedure Debug_Trap; pragma Import (C, Debug_Trap); begin if True then Debug_Trap; else System.Machine_Code.Asm ("trap", Volatile => True); end if; end Breakpoint; procedure Invalidate_Icache (Start : Address; Len : Storage_Offset) is begin for I in 0 .. Len - 1 loop System.Machine_Code.Asm ("icbi 0,%0", Inputs => Address'Asm_Input ("r", Start + I), Volatile => True); end loop; end Invalidate_Icache; procedure Set_Trace_Flag (Trace : Boolean) is begin if Trace then Regs.MSR := Regs.MSR or MSR_SE; else Regs.MSR := Regs.MSR and not MSR_SE; end if; end Set_Trace_Flag; end Gdbstub.CPU;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2014, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- Abstract interface of XML reader. ------------------------------------------------------------------------------ with League.Strings; with XML.SAX.Content_Handlers; with XML.SAX.Declaration_Handlers; with XML.SAX.DTD_Handlers; with XML.SAX.Entity_Resolvers; with XML.SAX.Error_Handlers; with XML.SAX.Lexical_Handlers; package XML.SAX.Readers is pragma Preelaborate; type SAX_Content_Handler_Access is access all XML.SAX.Content_Handlers.SAX_Content_Handler'Class; type SAX_Declaration_Handler_Access is access all XML.SAX.Declaration_Handlers.SAX_Declaration_Handler'Class; type SAX_DTD_Handler_Access is access all XML.SAX.DTD_Handlers.SAX_DTD_Handler'Class; type SAX_Error_Handler_Access is access all XML.SAX.Error_Handlers.SAX_Error_Handler'Class; type SAX_Lexical_Handler_Access is access all XML.SAX.Lexical_Handlers.SAX_Lexical_Handler'Class; type SAX_Entity_Resolver_Access is access all XML.SAX.Entity_Resolvers.SAX_Entity_Resolver'Class; type SAX_Reader is limited interface; not overriding function Content_Handler (Self : SAX_Reader) return SAX_Content_Handler_Access is abstract; -- Returns the current content handler, or null if none has been -- registered. not overriding function Declaration_Handler (Self : SAX_Reader) return SAX_Declaration_Handler_Access is abstract; -- Returns the current declaration handler, or null if has not been -- registered. not overriding function DTD_Handler (Self : SAX_Reader) return SAX_DTD_Handler_Access is abstract; -- Returns the current DTD handler, or null if none has been registered. not overriding function Entity_Resolver (Self : SAX_Reader) return SAX_Entity_Resolver_Access is abstract; -- Returns the current entity resolver, or null if none has been -- registered. not overriding function Error_Handler (Self : SAX_Reader) return SAX_Error_Handler_Access is abstract; -- Returns the current error handler, or null if none has been registered. not overriding function Feature (Self : SAX_Reader; Name : League.Strings.Universal_String) return Boolean is abstract; -- Look up the value of a feature flag. Returns value of the feature or -- false if feature is not recognized or not acceptable at this time. -- -- The feature name is any fully-qualified URI. It is possible for an -- XMLReader to recognize a feature name but temporarily be unable to -- return its value. Some feature values may be available only in specific -- contexts, such as before, during, or after a parse. Also, some feature -- values may not be programmatically accessible. -- -- All Readers are required to recognize the -- http://xml.org/sax/features/namespaces and the -- http://xml.org/sax/features/namespace-prefixes feature names. not overriding function Has_Feature (Self : SAX_Reader; Name : League.Strings.Universal_String) return Boolean is abstract; -- Returns True if the reader has the feature called Name; otherwise -- returns False. not overriding function Lexical_Handler (Self : SAX_Reader) return SAX_Lexical_Handler_Access is abstract; -- Returns the current lexical handler, or null if none has been -- registered. not overriding procedure Set_Content_Handler (Self : in out SAX_Reader; Handler : SAX_Content_Handler_Access) is abstract; not overriding procedure Set_Declaration_Handler (Self : in out SAX_Reader; Handler : SAX_Declaration_Handler_Access) is abstract; not overriding procedure Set_DTD_Handler (Self : in out SAX_Reader; Handler : SAX_DTD_Handler_Access) is abstract; not overriding procedure Set_Entity_Resolver (Self : in out SAX_Reader; Resolver : SAX_Entity_Resolver_Access) is abstract; not overriding procedure Set_Error_Handler (Self : in out SAX_Reader; Handler : SAX_Error_Handler_Access) is abstract; not overriding procedure Set_Feature (Self : in out SAX_Reader; Name : League.Strings.Universal_String; Value : Boolean) is abstract; -- Set the value of a feature flag. -- -- The feature name is any fully-qualified URI. It is possible for an -- XMLReader to expose a feature value but to be unable to change the -- current value. Some feature values may be immutable or mutable only in -- specific contexts, such as before, during, or after a parse. -- -- All XMLReaders are required to support setting -- http://xml.org/sax/features/namespaces to true and -- http://xml.org/sax/features/namespace-prefixes to false. not overriding procedure Set_Lexical_Handler (Self : in out SAX_Reader; Handler : SAX_Lexical_Handler_Access) is abstract; end XML.SAX.Readers;
with Ada.Text_IO; use Ada.Text_IO; procedure Test_Non_Continuous is type Sequence is array (Positive range <>) of Integer; procedure Put_NCS ( Tail : Sequence; -- To generate subsequences of Head : Sequence := (1..0 => 1); -- Already generated Contiguous : Boolean := True -- It is still continuous ) is begin if not Contiguous and then Head'Length > 1 then for I in Head'Range loop Put (Integer'Image (Head (I))); end loop; New_Line; end if; if Tail'Length /= 0 then declare New_Head : Sequence (Head'First..Head'Last + 1); begin New_Head (Head'Range) := Head; for I in Tail'Range loop New_Head (New_Head'Last) := Tail (I); Put_NCS ( Tail => Tail (I + 1..Tail'Last), Head => New_Head, Contiguous => Contiguous and then (I = Tail'First or else Head'Length = 0) ); end loop; end; end if; end Put_NCS; begin Put_NCS ((1,2,3)); New_Line; Put_NCS ((1,2,3,4)); New_Line; Put_NCS ((1,2,3,4,5)); New_Line; end Test_Non_Continuous;
with Kv.avm.vole_Tree; package Vole_Tokens is type YYSType is record Node : kv.avm.vole_tree.Node_Pointer; end record; YYLVal, YYVal : YYSType; type Token is (End_Of_Input, Error, Key_Import, Id_Token, Eos_Token, Block_Begin, Block_End, Key_Attribute, Key_Predicate, Key_Message, Key_Returns, Key_Actor, Key_Constructor, Key_Extends, Key_Assert, Key_Method, Key_Emit, Key_If, Key_Then, Key_Self, Key_Super, Key_Send, Key_Else, Key_Elseif, Key_Endif, Key_When, Key_While, Key_Loop, Key_For, Key_Case, Key_Local, Key_New, Op_And, Op_Not, Op_Or, Op_Xor, Op_Mod, Op_Eq, Op_Not_Eq, Op_Gt, Op_Gt_Eq, Op_Lt_Eq, Op_Lt, Key_Return, Key_Tuple, Float_Literal, Integer_Literal, String_Literal, True_Literal, False_Literal, Actor_Type, Boolean_Type, Tuple_Type, Unsigned_Type, Integer_Type, Float_Type, String_Type, Colon_Token, Dot_Token, Paren_Begin, Paren_End, Comma_Token, Tuple_Begin, Tuple_End, Op_Shift_Left, Op_Shift_Right, Op_Add, Op_Sub, Op_Mul, Op_Div, High_Right_Precedence, Op_Exp, Op_Assign ); Syntax_Error : exception; end Vole_Tokens;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S I N F O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package defines the structure of the abstract syntax tree. The Tree -- package provides a basic tree structure. Sinfo describes how this structure -- is used to represent the syntax of an Ada program. -- Note: the grammar used here is taken from Version 5.95 of the RM, dated -- November 1994. The grammar in the RM is followed very closely in the tree -- design, and is repeated as part of this source file. -- The tree contains not only the full syntactic representation of the -- program, but also the results of semantic analysis. In particular, the -- nodes for defining identifiers, defining character literals and defining -- operator symbols, collectively referred to as entities, represent what -- would normally be regarded as the symbol table information. In addition a -- number of the tree nodes contain semantic information. -- WARNING: There is a C version of this package. Any changes to this source -- file must be properly reflected in this C header file sinfo.h which is -- created automatically from sinfo.ads using xsinfo.adb. with Types; use Types; with Uintp; use Uintp; with Urealp; use Urealp; package Sinfo is --------------------------------- -- Making Changes to This File -- --------------------------------- -- If changes are made to this file, a number of related steps must be -- carried out to ensure consistency. First, if a field access function is -- added, it appears in seven places: -- The documentation associated with the node -- The spec of the access function in sinfo.ads -- The body of the access function in sinfo.adb -- The pragma Inline at the end of sinfo.ads for the access function -- The spec of the set procedure in sinfo.ads -- The body of the set procedure in sinfo.adb -- The pragma Inline at the end of sinfo.ads for the set procedure -- The field chosen must be consistent in all places, and, for a node that -- is a subexpression, must not overlap any of the standard expression -- fields. -- In addition, if any of the standard expression fields is changed, then -- the utiliy program which creates the Treeprs spec (in file treeprs.ads) -- must be updated appropriately, since it special cases expression fields. -- If a new tree node is added, then the following changes are made -- Add it to the documentation in the appropriate place -- Add its fields to this documentation section -- Define it in the appropriate classification in Node_Kind -- In the body (sinfo), add entries to the access functions for all -- its fields (except standard expression fields) to include the new -- node in the checks. -- Add an appropriate section to the case statement in sprint.adb -- Add an appropriate section to the case statement in sem.adb -- Add an appropriate section to the case statement in exp_util.adb -- (Insert_Actions procedure) -- For a subexpression, add an appropriate section to the case -- statement in sem_eval.adb -- For a subexpression, add an appropriate section to the case -- statement in sem_res.adb -- Finally, four utility programs must be run: -- Run CSinfo to check that you have made the changes consistently. It -- checks most of the rules given above, with clear error messages. This -- utility reads sinfo.ads and sinfo.adb and generates a report to -- standard output. -- Run XSinfo to create a-sinfo.h, the corresponding C header. This -- utility reads sinfo.ads and generates a-sinfo.h. Note that it does -- not need to read sinfo.adb, since the contents of the body are -- algorithmically determinable from the spec. -- Run XTreeprs to create treeprs.ads, an updated version of the module -- that is used to drive the tree print routine. This utility reads (but -- does not modify) treeprs.adt, the template that provides the basic -- structure of the file, and then fills in the data from the comments -- in sinfo.ads. -- Run XNmake to create nmake.ads and nmake.adb, the package body and -- spec of the Nmake package which contains functions for constructing -- nodes. -- Note: sometime we could write a utility that actually generated the body -- of sinfo from the spec instead of simply checking it, since, as noted -- above, the contents of the body can be determined from the spec. -------------------------------- -- Implicit Nodes in the Tree -- -------------------------------- -- Generally the structure of the tree very closely follows the grammar as -- defined in the RM. However, certain nodes are omitted to save space and -- simplify semantic processing. Two general classes of such omitted nodes -- are as follows: -- If the only possibilities for a non-terminal are one or more other -- non-terminals (i.e. the rule is a "skinny" rule), then usually the -- corresponding node is omitted from the tree, and the target construct -- appears directly. For example, a real type definition is either -- floating point definition or a fixed point definition. No explicit node -- appears for real type definition. Instead either the floating point -- definition or fixed point definition appears directly. -- If a non-terminal corresponds to a list of some other non-terminal -- (possibly with separating punctuation), then usually it is omitted from -- the tree, and a list of components appears instead. For example, -- sequence of statements does not appear explicitly in the tree. Instead -- a list of statements appears directly. -- Some additional cases of omitted nodes occur and are documented -- individually. In particular, many nodes are omitted in the tree -- generated for an expression. ------------------------------------------- -- Handling of Defining Identifier Lists -- ------------------------------------------- -- In several declarative forms in the syntax, lists of defining -- identifiers appear (object declarations, component declarations, number -- declarations etc.) -- The semantics of such statements are equivalent to a series of identical -- declarations of single defining identifiers (except that conformance -- checks require the same grouping of identifiers in the parameter case). -- To simplify semantic processing, the parser breaks down such multiple -- declaration cases into sequences of single declarations, duplicating -- type and initialization information as required. The flags More_Ids and -- Prev_Ids are used to record the original form of the source in the case -- where the original source used a list of names, More_Ids being set on -- all but the last name and Prev_Ids being set on all but the first name. -- These flags are used to reconstruct the original source (e.g. in the -- Sprint package), and also are included in the conformance checks, but -- otherwise have no semantic significance. -- Note: the reason that we use More_Ids and Prev_Ids rather than -- First_Name and Last_Name flags is so that the flags are off in the -- normal one identifier case, which minimizes tree print output. ----------------------- -- Use of Node Lists -- ----------------------- -- With a few exceptions, if a construction of the form {non-terminal} -- appears in the tree, lists are used in the corresponding tree node (see -- package Nlists for handling of node lists). In this case a field of the -- parent node points to a list of nodes for the non-terminal. The field -- name for such fields has a plural name which always ends in "s". For -- example, a case statement has a field Alternatives pointing to list of -- case statement alternative nodes. -- Only fields pointing to lists have names ending in "s", so generally the -- structure is strongly typed, fields not ending in s point to single -- nodes, and fields ending in s point to lists. -- The following example shows how a traversal of a list is written. We -- suppose here that Stmt points to a N_Case_Statement node which has a -- list field called Alternatives: -- Alt := First (Alternatives (Stmt)); -- while Present (Alt) loop -- .. -- -- processing for case statement alternative Alt -- .. -- Alt := Next (Alt); -- end loop; -- The Present function tests for Empty, which in this case signals the end -- of the list. First returns Empty immediately if the list is empty. -- Present is defined in Atree, First and Next are defined in Nlists. -- The exceptions to this rule occur with {DEFINING_IDENTIFIERS} in all -- contexts, which is handled as described in the previous section, and -- with {,library_unit_NAME} in the N_With_Clause mode, which is handled -- using the First_Name and Last_Name flags, as further detailed in the -- description of the N_With_Clause node. ------------- -- Pragmas -- ------------- -- Pragmas can appear in many different context, but are not included in -- the grammar. Still they must appear in the tree, so they can be properly -- processed. -- Two approaches are used. In some cases, an extra field is defined in an -- appropriate node that contains a list of pragmas appearing in the -- expected context. For example pragmas can appear before an -- Accept_Alternative in a Selective_Accept_Statement, and these pragmas -- appear in the Pragmas_Before field of the N_Accept_Alternative node. -- The other approach is to simply allow pragmas to appear in syntactic -- lists where the grammar (of course) does not include the possibility. -- For example, the Variants field of an N_Variant_Part node points to a -- list that can contain both N_Pragma and N_Variant nodes. -- To make processing easier in the latter case, the Nlists package -- provides a set of routines (First_Non_Pragma, Last_Non_Pragma, -- Next_Non_Pragma, Prev_Non_Pragma) that allow such lists to be handled -- ignoring all pragmas. -- In the case of the variants list, we can either write: -- Variant := First (Variants (N)); -- while Present (Variant) loop -- ... -- Variant := Next (Variant); -- end loop; -- or -- Variant := First_Non_Pragma (Variants (N)); -- while Present (Variant) loop -- ... -- Variant := Next_Non_Pragma (Variant); -- end loop; -- In the first form of the loop, Variant can either be an N_Pragma or an -- N_Variant node. In the second form, Variant can only be N_Variant since -- all pragmas are skipped. --------------------- -- Optional Fields -- --------------------- -- Fields which correspond to a section of the syntax enclosed in square -- brackets are generally omitted (and the corresponding field set to Empty -- for a node, or No_List for a list). The documentation of such fields -- notes these cases. One exception to this rule occurs in the case of -- possibly empty statement sequences (such as the sequence of statements -- in an entry call alternative). Such cases appear in the syntax rules as -- [SEQUENCE_OF_STATEMENTS] and the fields corresponding to such optional -- statement sequences always contain an empty list (not No_List) if no -- statements are present. -- Note: the utility program that constructs the body and spec of the Nmake -- package relies on the format of the comments to determine if a field -- should have a default value in the corresponding make routine. The rule -- is that if the first line of the description of the field contains the -- string "(set to xxx if", then a default value of xxx is provided for -- this field in the corresponding Make_yyy routine. ----------------------------------- -- Note on Body/Spec Terminology -- ----------------------------------- -- In informal discussions about Ada, it is customary to refer to package -- and subprogram specs and bodies. However, this is not technically -- correct, what is normally referred to as a spec or specification is in -- fact a package declaration or subprogram declaration. We are careful in -- GNAT to use the correct terminology and in particular, the full word -- specification is never used as an incorrect substitute for declaration. -- The structure and terminology used in the tree also reflects the grammar -- and thus uses declaration and specification in the technically correct -- manner. -- However, there are contexts in which the informal terminology is useful. -- We have the word "body" to refer to the Interp_Etype declared by the -- declaration of a unit body, and in some contexts we need similar term to -- refer to the entity declared by the package or subprogram declaration, -- and simply using declaration can be confusing since the body also has a -- declaration. -- An example of such a context is the link between the package body and -- its declaration. With_Declaration is confusing, since the package body -- itself is a declaration. -- To deal with this problem, we reserve the informal term Spec, i.e. the -- popular abbreviation used in this context, to refer to the entity -- declared by the package or subprogram declaration. So in the above -- example case, the field in the body is called With_Spec. -- Another important context for the use of the word Spec is in error -- messages, where a hyper-correct use of declaration would be confusing to -- a typical Ada programmer, and even for an expert programmer can cause -- confusion since the body has a declaration as well. -- So, to summarize: -- Declaration always refers to the syntactic entity that is called -- a declaration. In particular, subprogram declaration -- and package declaration are used to describe the -- syntactic entity that includes the semicolon. -- Specification always refers to the syntactic entity that is called -- a specification. In particular, the terms procedure -- specification, function specification, package -- specification, subprogram specification always refer -- to the syntactic entity that has no semicolon. -- Spec is an informal term, used to refer to the entity -- that is declared by a task declaration, protected -- declaration, generic declaration, subprogram -- declaration or package declaration. -- This convention is followed throughout the GNAT documentation -- both internal and external, and in all error message text. ------------------------ -- Internal Use Nodes -- ------------------------ -- These are Node_Kind settings used in the internal implementation which -- are not logically part of the specification. -- N_Unused_At_Start -- Completely unused entry at the start of the enumeration type. This -- is inserted so that no legitimate value is zero, which helps to get -- better debugging behavior, since zero is a likely uninitialized value). -- N_Unused_At_End -- Completely unused entry at the end of the enumeration type. This is -- handy so that arrays with Node_Kind as the index type have an extra -- entry at the end (see for example the use of the Pchar_Pos_Array in -- Treepr, where the extra entry provides the limit value when dealing with -- the last used entry in the array). ----------------------------------------- -- Note on the settings of Sloc fields -- ----------------------------------------- -- The Sloc field of nodes that come from the source is set by the parser. -- For internal nodes, and nodes generated during expansion the Sloc is -- usually set in the call to the constructor for the node. In general the -- Sloc value chosen for an internal node is the Sloc of the source node -- whose processing is responsible for the expansion. For example, the Sloc -- of an inherited primitive operation is the Sloc of the corresponding -- derived type declaration. -- For the nodes of a generic instantiation, the Sloc value is encoded to -- represent both the original Sloc in the generic unit, and the Sloc of -- the instantiation itself. See Sinput.ads for details. -- Subprogram instances create two callable entities: one is the visible -- subprogram instance, and the other is an anonymous subprogram nested -- within a wrapper package that contains the renamings for the actuals. -- Both of these entities have the Sloc of the defining entity in the -- instantiation node. This simplifies some ASIS queries. ----------------------- -- Field Definitions -- ----------------------- -- In the following node definitions, all fields, both syntactic and -- semantic, are documented. The one exception is in the case of entities -- (defining indentifiers, character literals and operator symbols), where -- the usage of the fields depends on the entity kind. Entity fields are -- fully documented in the separate package Einfo. -- In the node definitions, three common sets of fields are abbreviated to -- save both space in the documentation, and also space in the string -- (defined in Tree_Print_Strings) used to print trees. The following -- abbreviations are used: -- Note: the utility program that creates the Treeprs spec (in the file -- xtreeprs.adb) knows about the special fields here, so it must be -- modified if any change is made to these fields. -- "plus fields for binary operator" -- Chars (Name1) Name_Id for the operator -- Left_Opnd (Node2) left operand expression -- Right_Opnd (Node3) right operand expression -- Entity (Node4-Sem) defining entity for operator -- Associated_Node (Node4-Sem) for generic processing -- Do_Overflow_Check (Flag17-Sem) set if overflow check needed -- Has_Private_View (Flag11-Sem) set in generic units. -- "plus fields for unary operator" -- Chars (Name1) Name_Id for the operator -- Right_Opnd (Node3) right operand expression -- Entity (Node4-Sem) defining entity for operator -- Associated_Node (Node4-Sem) for generic processing -- Do_Overflow_Check (Flag17-Sem) set if overflow check needed -- Has_Private_View (Flag11-Sem) set in generic units. -- "plus fields for expression" -- Paren_Count number of parentheses levels -- Etype (Node5-Sem) type of the expression -- Is_Overloaded (Flag5-Sem) >1 type interpretation exists -- Is_Static_Expression (Flag6-Sem) set for static expression -- Raises_Constraint_Error (Flag7-Sem) evaluation raises CE -- Must_Not_Freeze (Flag8-Sem) set if must not freeze -- Do_Range_Check (Flag9-Sem) set if a range check needed -- Assignment_OK (Flag15-Sem) set if modification is OK -- Is_Controlling_Actual (Flag16-Sem) set for controlling argument -- Note: see under (EXPRESSION) for further details on the use of -- the Paren_Count field to record the number of parentheses levels. -- Node_Kind is the type used in the Nkind field to indicate the node kind. -- The actual definition of this type is given later (the reason for this -- is that we want the descriptions ordered by logical chapter in the RM, -- but the type definition is reordered to facilitate the definition of -- some subtype ranges. The individual descriptions of the nodes show how -- the various fields are used in each node kind, as well as providing -- logical names for the fields. Functions and procedures are provided for -- accessing and setting these fields using these logical names. ----------------------- -- Gigi Restrictions -- ----------------------- -- The tree passed to Gigi is more restricted than the general tree form. -- For example, as a result of expansion, most of the tasking nodes can -- never appear. For each node to which either a complete or partial -- restriction applies, a note entitled "Gigi restriction" appears which -- documents the restriction. -- Note that most of these restrictions apply only to trees generated when -- code is being generated, since they involved expander actions that -- destroy the tree. ------------------------ -- Common Flag Fields -- ------------------------ -- The following flag fields appear in all nodes -- Analyzed (Flag1) -- This flag is used to indicate that a node (and all its children have -- been analyzed. It is used to avoid reanalysis of a node that has -- already been analyzed, both for efficiency and functional correctness -- reasons. -- Comes_From_Source (Flag2) -- This flag is on for any nodes built by the scanner or parser from the -- source program, and off for any nodes built by the analyzer or -- expander. It indicates that a node comes from the original source. -- This flag is defined in Atree. -- Error_Posted (Flag3) -- This flag is used to avoid multiple error messages being posted on or -- referring to the same node. This flag is set if an error message -- refers to a node or is posted on its source location, and has the -- effect of inhibiting further messages involving this same node. -- Has_Dynamic_Length_Check (Flag10-Sem) -- This flag is present on all nodes. It is set to indicate that one of -- the routines in unit Checks has generated a length check action which -- has been inserted at the flagged node. This is used to avoid the -- generation of duplicate checks. -- Has_Dynamic_Range_Check (Flag12-Sem) -- This flag is present on all nodes. It is set to indicate that one of -- the routines in unit Checks has generated a range check action which -- has been inserted at the flagged node. This is used to avoid the -- generation of duplicate checks. ------------------------------------ -- Description of Semantic Fields -- ------------------------------------ -- The meaning of the syntactic fields is generally clear from their names -- without any further description, since the names are chosen to -- correspond very closely to the syntax in the reference manual. This -- section describes the usage of the semantic fields, which are used to -- contain additional information determined during semantic analysis. -- ABE_Is_Certain (Flag18-Sem) -- This flag is set in an instantiation node or a call node is determined -- to be sure to raise an ABE. This is used to trigger special handling -- of such cases, particularly in the instantiation case where we avoid -- instantiating the body if this flag is set. This flag is also present -- in an N_Formal_Package_Declaration_Node since formal package -- declarations are treated like instantiations, but it is always set to -- False in this context. -- Accept_Handler_Records (List5-Sem) -- This field is present only in an N_Accept_Alternative node. It is used -- to temporarily hold the exception handler records from an accept -- statement in a selective accept. These exception handlers will -- eventually be placed in the Handler_Records list of the procedure -- built for this accept (see Expand_N_Selective_Accept procedure in -- Exp_Ch9 for further details). -- Access_Types_To_Process (Elist2-Sem) -- Present in N_Freeze_Entity nodes for Incomplete or private types. -- Contains the list of access types which may require specific treatment -- when the nature of the type completion is completely known. An example -- of such treatement is the generation of the associated_final_chain. -- Actions (List1-Sem) -- This field contains a sequence of actions that are associated with the -- node holding the field. See the individual node types for details of -- how this field is used, as well as the description of the specific use -- for a particular node type. -- Activation_Chain_Entity (Node3-Sem) -- This is used in tree nodes representing task activators (blocks, -- subprogram bodies, package declarations, and task bodies). It is -- initially Empty, and then gets set to point to the entity for the -- declared Activation_Chain variable when the first task is declared. -- When tasks are declared in the corresponding declarative region this -- entity is located by name (its name is always _Chain) and the declared -- tasks are added to the chain. -- Acts_As_Spec (Flag4-Sem) -- A flag set in the N_Subprogram_Body node for a subprogram body which -- is acting as its own spec. This flag also appears in the compilation -- unit node at the library level for such a subprogram (see further -- description in spec of Lib package). -- Actual_Designated_Subtype (Node2-Sem) -- Present in N_Free_Statement and N_Explicit_Dereference nodes. If gigi -- needs to known the dynamic constrained subtype of the designated -- object, this attribute is set to that type. This is done for -- N_Free_Statements for access-to-classwide types and access to -- unconstrained packed array types, and for N_Explicit_Dereference when -- the designated type is an unconstrained packed array and the -- dereference is the prefix of a 'Size attribute reference. -- Aggregate_Bounds (Node3-Sem) -- Present in array N_Aggregate nodes. If the aggregate contains -- component associations this field points to an N_Range node whose -- bounds give the lowest and highest discrete choice values. If the -- named aggregate contains a dynamic or null choice this field is empty. -- If the aggregate contains positional elements this field points to an -- N_Integer_Literal node giving the number of positional elements. Note -- that if the aggregate contains positional elements and an other choice -- the N_Integer_Literal only accounts for the number of positional -- elements. -- All_Others (Flag11-Sem) -- Present in an N_Others_Choice node. This flag is set in the case of an -- others exception where all exceptions are to be caught, even those -- that are not normally handled (in particular the tasking abort -- signal). This is used for translation of the at end handler into a -- normal exception handler. -- Assignment_OK (Flag15-Sem) -- This flag is set in a subexpression node for an object, indicating -- that the associated object can be modified, even if this would not -- normally be permissible (either by direct assignment, or by being -- passed as an out or in-out parameter). This is used by the expander -- for a number of purposes, including initialzation of constants and -- limited type objects (such as tasks), setting discriminant fields, -- setting tag values, etc. N_Object_Declaration nodes also have this -- flag defined. Here it is used to indicate that an initialization -- expression is valid, even where it would normally not be allowed (e.g. -- where the type involved is limited). -- Associated_Node (Node4-Sem) -- Present in nodes that can denote an entity: identifiers, character -- literals, operator symbols, expanded names, operator nodes, and -- attribute reference nodes (all these nodes have an Entity field). This -- field is also present in N_Aggregate, N_Selected_Component, and -- N_Extension_Aggregate nodes. This field is used in generic processing -- to create links between the generic template and the generic copy. See -- Sem_Ch12.Get_Associated_Node for full details. Note that this field -- overlaps Entity, which is fine, since, as explained in Sem_Ch12, the -- normal function of Entity is not required at the point where the -- Associated_Node is set. Note also, that in generic templates, this -- means that the Entity field does not necessarily point to an Entity. -- Since the back end is expected to ignore generic templates, this is -- harmless. -- At_End_Proc (Node1) -- This field is present in an N_Handled_Sequence_Of_Statements node. It -- contains an identifier reference for the cleanup procedure to be -- called. See description of this node for further details. -- Backwards_OK (Flag6-Sem) -- A flag present in the N_Assignment_Statement node. It is used only if -- the type being assigned is an array type, and is set if analysis -- determines that it is definitely safe to do the copy backwards, i.e. -- starting at the highest addressed element. Note that if neither of the -- flags Forwards_OK or Backwards_OK is set, it means that the front end -- could not determine that either direction is definitely safe, and a -- runtime check is required. -- Body_To_Inline (Node3-Sem) -- present in subprogram declarations. Denotes analyzed but unexpanded -- body of subprogram, to be used when inlining calls. Present when the -- subprogram has an Inline pragma and inlining is enabled. If the -- declaration is completed by a renaming_as_body, and the renamed en- -- tity is a subprogram, the Body_To_Inline is the name of that entity, -- which is used directly in later calls to the original subprogram. -- Body_Required (Flag13-Sem) -- A flag that appears in the N_Compilation_Unit node indicating that the -- corresponding unit requires a body. For the package case, this -- indicates that a completion is required. In Ada 95, if the flag is not -- set for the package case, then a body may not be present. In Ada 83, -- if the flag is not set for the package case, then body is optional. -- For a subprogram declaration, the flag is set except in the case where -- a pragma Import or Interface applies, in which case no body is -- permitted (in Ada 83 or Ada 95). -- By_Ref (Flag5-Sem) -- A flag present in the N_Return_Statement_Node. It is set when the -- returned expression is already allocated on the secondary stack and -- thus the result is passed by reference rather than copied another -- time. -- Check_Address_Alignment (Flag11-Sem) -- A flag present in N_Attribute_Definition clause for a 'Address -- attribute definition. This flag is set if a dynamic check should be -- generated at the freeze point for the entity to which this address -- clause applies. The reason that we need this flag is that we want to -- check for range checks being suppressed at the point where the -- attribute definition clause is given, rather than testing this at the -- freeze point. -- Compile_Time_Known_Aggregate (Flag18-Sem) -- Present in N_Aggregate nodes. Set for aggregates which can be fully -- evaluated at compile time without raising constraint error. Such -- aggregates can be passed as is to Gigi without any expansion. See -- Sem_Aggr for the specific conditions under which an aggregate has this -- flag set. See also the flag Static_Processing_OK. -- Condition_Actions (List3-Sem) -- This field appears in else-if nodes and in the iteration scheme node -- for while loops. This field is only used during semantic processing to -- temporarily hold actions inserted into the tree. In the tree passed to -- gigi, the condition actions field is always set to No_List. For -- details on how this field is used, see the routine Insert_Actions in -- package Exp_Util, and also the expansion routines for the relevant -- nodes. -- Controlling_Argument (Node1-Sem) -- This field is set in procedure and function call nodes if the call is -- a dispatching call (it is Empty for a non-dispatching call). It -- indicates the source of the call's controlling tag. For procedure -- calls, the Controlling_Argument is one of the actuals. For function -- that has a dispatching result, it is an entity in the context of the -- call that can provide a tag, or else it is the tag of the root type of -- the class. It can also specify a tag directly rather than being a -- tagged object. The latter is needed by the implementations of AI-239 -- and AI-260. -- Conversion_OK (Flag14-Sem) -- A flag set on type conversion nodes to indicate that the conversion is -- to be considered as being valid, even though it is the case that the -- conversion is not valid Ada. This is used for Enum_Rep, Fixed_Value -- and Integer_Value attributes, for internal conversions done for -- fixed-point operations, and for certain conversions for calls to -- initialization procedures. If Conversion_OK is set, then Etype must be -- set (the analyzer assumes that Etype has been set). For the case of -- fixed-point operands, it also indicates that the conversion is to be -- direct conversion of the underlying integer result, with no regard to -- the small operand. -- Corresponding_Body (Node5-Sem) -- This field is set in subprogram declarations, package declarations, -- entry declarations of protected types, and in generic units. It -- points to the defining entity for the corresponding body (NOT the -- node for the body itself). -- Corresponding_Formal_Spec (Node3-Sem) -- This field is set in subprogram renaming declarations, where it points -- to the defining entity for a formal subprogram in the case where the -- renaming corresponds to a generic formal subprogram association in an -- instantiation. The field is Empty if the renaming does not correspond -- to such a formal association. -- Corresponding_Generic_Association (Node5-Sem) -- This field is defined for object declarations and object renaming -- declarations. It is set for the declarations within an instance that -- map generic formals to their actuals. If set, the field points to -- a generic_association which is the original parent of the expression -- or name appearing in the declaration. This simplifies ASIS queries. -- Corresponding_Integer_Value (Uint4-Sem) -- This field is set in real literals of fixed-point types (it is not -- used for floating-point types). It contains the integer value used -- to represent the fixed-point value. It is also set on the universal -- real literals used to represent bounds of fixed-point base types -- and their first named subtypes. -- Corresponding_Spec (Node5-Sem) -- This field is set in subprogram, package, task, and protected body -- nodes, where it points to the defining entity in the corresponding -- spec. The attribute is also set in N_With_Clause nodes, where it -- points to the defining entity for the with'ed spec, and in a -- subprogram renaming declaration when it is a Renaming_As_Body. The -- field is Empty if there is no corresponding spec, as in the case of a -- subprogram body that serves as its own spec. -- Corresponding_Stub (Node3-Sem) -- This field is present in an N_Subunit node. It holds the node in -- the parent unit that is the stub declaration for the subunit. it is -- set when analysis of the stub forces loading of the proper body. If -- expansion of the proper body creates new declarative nodes, they are -- inserted at the point of the corresponding_stub. -- Dcheck_Function (Node5-Sem) -- This field is present in an N_Variant node, It references the entity -- for the discriminant checking function for the variant. -- Debug_Statement (Node3) -- This field is present in an N_Pragma node. It is used only for a Debug -- pragma. The parameter is of the form of an expression, as required by -- the pragma syntax, but is actually a procedure call. To simplify -- semantic processing, the parser creates a copy of the argument -- rearranged into a procedure call statement and places it in the -- Debug_Statement field. Note that this field is considered syntactic -- field, since it is created by the parser. -- Default_Expression (Node5-Sem) -- This field is Empty if there is no default expression. If there is a -- simple default expression (one with no side effects), then this field -- simply contains a copy of the Expression field (both point to the tree -- for the default expression). Default_Expression is used for -- conformance checking. -- Delay_Finalize_Attach (Flag14-Sem) -- This flag is present in an N_Object_Declaration node. If it is set, -- then in the case of a controlled type being declared and initialized, -- the normal code for attaching the result to the appropriate local -- finalization list is suppressed. This is used for functions that -- return controlled types without using the secondary stack, where it is -- the caller who must do the attachment. -- Discr_Check_Funcs_Built (Flag11-Sem) -- This flag is present in N_Full_Type_Declaration nodes. It is set when -- discriminant checking functions are constructed. The purpose is to -- avoid attempting to set these functions more than once. -- Do_Accessibility_Check (Flag13-Sem) -- This flag is set on N_Parameter_Specification nodes to indicate -- that an accessibility check is required for the parameter. It is -- not yet decided who takes care of this check (TBD ???). -- Do_Discriminant_Check (Flag13-Sem) -- This flag is set on N_Selected_Component nodes to indicate that a -- discriminant check is required using the discriminant check routine -- associated with the selector. The actual check is generated by the -- expander when processing selected components. -- Do_Division_Check (Flag13-Sem) -- This flag is set on a division operator (/ mod rem) to indicate -- that a zero divide check is required. The actual check is dealt -- with by the backend (all the front end does is to set the flag). -- Do_Length_Check (Flag4-Sem) -- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or, -- N_Op_Xor, or N_Type_Conversion node to indicate that a length check -- is required. It is not determined who deals with this flag (???). -- Do_Overflow_Check (Flag17-Sem) -- This flag is set on an operator where an overflow check is required on -- the operation. The actual check is dealt with by the backend (all the -- front end does is to set the flag). The other cases where this flag is -- used is on a Type_Conversion node and for attribute reference nodes. -- For a type conversion, it means that the conversion is from one base -- type to another, and the value may not fit in the target base type. -- See also the description of Do_Range_Check for this case. The only -- attribute references which use this flag are Pred and Succ, where it -- means that the result should be checked for going outside the base -- range. -- Do_Range_Check (Flag9-Sem) -- This flag is set on an expression which appears in a context where -- a range check is required. The target type is clear from the -- context. The contexts in which this flag can appear are limited to -- the following. -- Right side of an assignment. In this case the target type is -- taken from the left side of the assignment, which is referenced -- by the Name of the N_Assignment_Statement node. -- Subscript expressions in an indexed component. In this case the -- target type is determined from the type of the array, which is -- referenced by the Prefix of the N_Indexed_Component node. -- Argument expression for a parameter, appearing either directly in -- the Parameter_Associations list of a call or as the Expression of an -- N_Parameter_Association node that appears in this list. In either -- case, the check is against the type of the formal. Note that the -- flag is relevant only in IN and IN OUT parameters, and will be -- ignored for OUT parameters, where no check is required in the call, -- and if a check is required on the return, it is generated explicitly -- with a type conversion. -- Initialization expression for the initial value in an object -- declaration. In this case the Do_Range_Check flag is set on -- the initialization expression, and the check is against the -- range of the type of the object being declared. -- The expression of a type conversion. In this case the range check is -- against the target type of the conversion. See also the use of -- Do_Overflow_Check on a type conversion. The distinction is that the -- overflow check protects against a value that is outside the range of -- the target base type, whereas a range check checks that the -- resulting value (which is a value of the base type of the target -- type), satisfies the range constraint of the target type. -- Note: when a range check is required in contexts other than those -- listed above (e.g. in a return statement), an additional type -- conversion node is introduced to represent the required check. -- Do_Storage_Check (Flag17-Sem) -- This flag is set in an N_Allocator node to indicate that a storage -- check is required for the allocation, or in an N_Subprogram_Body node -- to indicate that a stack check is required in the subprogram prolog. -- The N_Allocator case is handled by the routine that expands the call -- to the runtime routine. The N_Subprogram_Body case is handled by the -- backend, and all the semantics does is set the flag. -- Do_Tag_Check (Flag13-Sem) -- This flag is set on an N_Assignment_Statement, N_Function_Call, -- N_Procedure_Call_Statement, N_Type_Conversion or N_Return_Statememt -- node to indicate that the tag check can be suppressed. It is not -- yet decided how this flag is used (TBD ???). -- Elaborate_Present (Flag4-Sem) -- This flag is set in the N_With_Clause node to indicate that pragma -- Elaborate pragma appears for the with'ed units. -- Elaborate_All_Desirable (Flag9-Sem) -- This flag is set in the N_With_Clause mode to indicate that the static -- elaboration processing has determined that an Elaborate_All pragma is -- desirable for correct elaboration for this unit. -- Elaborate_All_Present (Flag14-Sem) -- This flag is set in the N_With_Clause node to indicate that a -- pragma Elaborate_All pragma appears for the with'ed units. -- Elaborate_Desirable (Flag11-Sem) -- This flag is set in the N_With_Clause mode to indicate that the static -- elaboration processing has determined that an Elaborate pragma is -- desirable for correct elaboration for this unit. -- Elaboration_Boolean (Node2-Sem) -- This field is present in function and procedure specification -- nodes. If set, it points to the entity for a Boolean flag that -- must be tested for certain calls to check for access before -- elaboration. See body of Sem_Elab for further details. This -- field is Empty if no elaboration boolean is required. -- Else_Actions (List3-Sem) -- This field is present in conditional expression nodes. During code -- expansion we use the Insert_Actions procedure (in Exp_Util) to insert -- actions at an appropriate place in the tree to get elaborated at the -- right time. For conditional expressions, we have to be sure that the -- actions for the Else branch are only elaborated if the condition is -- False. The Else_Actions field is used as a temporary parking place for -- these actions. The final tree is always rewritten to eliminate the -- need for this field, so in the tree passed to Gigi, this field is -- always set to No_List. -- Enclosing_Variant (Node2-Sem) -- This field is present in the N_Variant node and identifies the -- Node_Id corresponding to the immediately enclosing variant when -- the variant is nested, and N_Empty otherwise. Set during semantic -- processing of the variant part of a record type. -- Entity (Node4-Sem) -- Appears in all direct names (identifier, character literal, operator -- symbol), as well as expanded names, and attributes that denote -- entities, such as 'Class. Points to the entity for the corresponding -- defining occurrence. Set after name resolution. In the case of -- identifiers in a WITH list, the corresponding defining occurrence is -- in a separately compiled file, and this pointer must be set using the -- library Load procedure. Note that during name resolution, the value in -- Entity may be temporarily incorrect (e.g. during overload resolution, -- Entity is initially set to the first possible correct interpretation, -- and then later modified if necessary to contain the correct value -- after resolution). Note that this field overlaps Associated_Node, -- which is used during generic processing (see Sem_Ch12 for details). -- Note also that in generic templates, this means that the Entity field -- does not always point to an Entity. Since the back end is expected to -- ignore generic templates, this is harmless. -- Entity_Or_Associated_Node (Node4-Sem) -- A synonym for both Entity and Associated_Node. Used by convention in -- the code when referencing this field in cases where it is not known -- whether the field contains an Entity or an Associated_Node. -- Etype (Node5-Sem) -- Appears in all expression nodes, all direct names, and all entities. -- Points to the entity for the related type. Set after type resolution. -- Normally this is the actual subtype of the expression. However, in -- certain contexts such as the right side of an assignment, subscripts, -- arguments to calls, returned value in a function, initial value etc. -- it is the desired target type. In the event that this is different -- from the actual type, the Do_Range_Check flag will be set if a range -- check is required. Note: if the Is_Overloaded flag is set, then Etype -- points to an essentially arbitrary choice from the possible set of -- types. -- Exception_Junk (Flag7-Sem) -- This flag is set in a various nodes appearing in a statement sequence -- to indicate that the corresponding node is an artifact of the -- generated code for exception handling, and should be ignored when -- analyzing the control flow of the relevant sequence of statements -- (e.g. to check that it does not end with a bad return statement). -- Expansion_Delayed (Flag11-Sem) -- Set on aggregates and extension aggregates that need a top-down rather -- than bottom up expansion. Typically aggregate expansion happens bottom -- up. For nested aggregates the expansion is delayed until the enclosing -- aggregate itself is expanded, e.g. in the context of a declaration. To -- delay it we set this flag. This is done to avoid creating a temporary -- for each level of a nested aggregates, and also to prevent the -- premature generation of constraint checks. This is also a requirement -- if we want to generate the proper attachment to the internal -- finalization lists (for record with controlled components). Top down -- expansion of aggregates is also used for in-place array aggregate -- assignment or initialization. When the full context is known, the -- target of the assignment or initialization is used to generate the -- left-hand side of individual assignment to each sub-component. -- First_Inlined_Subprogram (Node3-Sem) -- Present in the N_Compilation_Unit node for the main program. Points to -- a chain of entities for subprograms that are to be inlined. The -- Next_Inlined_Subprogram field of these entities is used as a link -- pointer with Empty marking the end of the list. This field is Empty if -- there are no inlined subprograms or inlining is not active. -- First_Named_Actual (Node4-Sem) -- Present in procedure call statement and function call nodes, and also -- in Intrinsic nodes. Set during semantic analysis to point to the first -- named parameter where parameters are ordered by declaration order (as -- opposed to the actual order in the call which may be different due to -- named associations). Note: this field points to the explicit actual -- parameter itself, not the N_Parameter_Association node (its parent). -- First_Real_Statement (Node2-Sem) -- Present in N_Handled_Sequence_Of_Statements node. Normally set to -- Empty. Used only when declarations are moved into the statement part -- of a construct as a result of wrapping an AT END handler that is -- required to cover the declarations. In this case, this field is used -- to remember the location in the statements list of the first real -- statement, i.e. the statement that used to be first in the statement -- list before the declarations were prepended. -- First_Subtype_Link (Node5-Sem) -- Present in N_Freeze_Entity node for an anonymous base type that is -- implicitly created by the declaration of a first subtype. It points to -- the entity for the first subtype. -- Float_Truncate (Flag11-Sem) -- A flag present in type conversion nodes. This is used for float to -- integer conversions where truncation is required rather than rounding. -- Note that Gigi does not handle type conversions from real to integer -- with rounding (see Expand_N_Type_Conversion). -- Forwards_OK (Flag5-Sem) -- A flag present in the N_Assignment_Statement node. It is used only if -- the type being assigned is an array type, and is set if analysis -- determines that it is definitely safe to do the copy forwards, i.e. -- starting at the lowest addressed element. Note that if neither of the -- flags Forwards_OK or Backwards_OK is set, it means that the front end -- could not determine that either direction is definitely safe, and a -- runtime check is required. -- From_At_Mod (Flag4-Sem) -- This flag is set on the attribute definition clause node that is -- generated by a transformation of an at mod phrase in a record -- representation clause. This is used to give slightly different (Ada 83 -- compatible) semantics to such a clause, namely it is used to specify a -- minimum acceptable alignment for the base type and all subtypes. In -- Ada 95 terms, the actual alignment of the base type and all subtypes -- must be a multiple of the given value, and the representation clause -- is considered to be type specific instead of subtype specific. -- From_Default (Flag6-Sem) -- This flag is set on the subprogram renaming declaration created in an -- instance for a formal subprogram, when the formal is declared with a -- box, and there is no explicit actual. If the flag is present, the -- declaration is treated as an implicit reference to the formal in the -- ali file. -- Generic_Parent (Node5-Sem) -- Generic_parent is defined on declaration nodes that are instances. The -- value of Generic_Parent is the generic entity from which the instance -- is obtained. Generic_Parent is also defined for the renaming -- declarations and object declarations created for the actuals in an -- instantiation. The generic parent of such a declaration is the -- corresponding generic association in the Instantiation node. -- Generic_Parent_Type (Node4-Sem) -- Generic_Parent_Type is defined on Subtype_Declaration nodes for the -- actuals of formal private and derived types. Within the instance, the -- operations on the actual are those inherited from the parent. For a -- formal private type, the parent type is the generic type itself. The -- Generic_Parent_Type is also used in an instance to determine whether a -- private operation overrides an inherited one. -- Handler_List_Entry (Node2-Sem) -- This field is present in N_Object_Declaration nodes. It is set only -- for the Handler_Record entry generated for an exception in zero cost -- exception handling mode. It references the corresponding item in the -- handler list, and is used to delete this entry if the corresponding -- handler is deleted during optimization. For further details on why -- this is required, see Exp_Ch11.Remove_Handler_Entries. -- Has_No_Elaboration_Code (Flag17-Sem) -- A flag that appears in the N_Compilation_Unit node to indicate whether -- or not elaboration code is present for this unit. It is initially set -- true for subprogram specs and bodies and for all generic units and -- false for non-generic package specs and bodies. Gigi may set the flag -- in the non-generic package case if it determines that no elaboration -- code is generated. Note that this flag is not related to the -- Is_Preelaborated status, there can be preelaborated packages that -- generate elaboration code, and non- preelaborated packages which do -- not generate elaboration code. -- Has_Priority_Pragma (Flag6-Sem) -- A flag present in N_Subprogram_Body, N_Task_Definition and -- N_Protected_Definition nodes to flag the presence of either a Priority -- or Interrupt_Priority pragma in the declaration sequence (public or -- private in the task and protected cases) -- Has_Private_View (Flag11-Sem) -- A flag present in generic nodes that have an entity, to indicate that -- the node has a private type. Used to exchange private and full -- declarations if the visibility at instantiation is different from the -- visibility at generic definition. -- Has_Storage_Size_Pragma (Flag5-Sem) -- A flag present in an N_Task_Definition node to flag the presence of a -- Storage_Size pragma. -- Has_Task_Info_Pragma (Flag7-Sem) -- A flag present in an N_Task_Definition node to flag the presence of a -- Task_Info pragma. Used to detect duplicate pragmas. -- Has_Task_Name_Pragma (Flag8-Sem) -- A flag present in N_Task_Definition nodes to flag the presence of a -- Task_Name pragma in the declaration sequence for the task. -- Has_Wide_Character (Flag11-Sem) -- Present in string literals, set if any wide character (i.e. character -- code outside the Character range) appears in the string. -- Hidden_By_Use_Clause (Elist4-Sem) -- An entity list present in use clauses that appear within -- instantiations. For the resolution of local entities, entities -- introduced by these use clauses have priority over global ones, and -- outer entities must be explicitly hidden/restored on exit. -- Implicit_With (Flag16-Sem) -- This flag is set in the N_With_Clause node that is implicitly -- generated for runtime units that are loaded by the expander, and also -- for package System, if it is loaded implicitly by a use of the -- 'Address or 'Tag attribute. -- Includes_Infinities (Flag11-Sem) -- This flag is present in N_Range nodes. It is set for the range of -- unconstrained float types defined in Standard, which include not only -- the given range of values, but also legtitimately can include infinite -- values. This flag is false for any float type for which an explicit -- range is given by the programmer, even if that range is identical to -- the range for Float. -- Instance_Spec (Node5-Sem) -- This field is present in generic instantiation nodes, and also in -- formal package declaration nodes (formal package declarations are -- treated in a manner very similar to package instantiations). It points -- to the node for the spec of the instance, inserted as part of the -- semantic processing for instantiations in Sem_Ch12. -- Is_Asynchronous_Call_Block (Flag7-Sem) -- A flag set in a Block_Statement node to indicate that it is the -- expansion of an asynchronous entry call. Such a block needs cleanup -- handler to assure that the call is cancelled. -- Is_Component_Left_Opnd (Flag13-Sem) -- Is_Component_Right_Opnd (Flag14-Sem) -- Present in concatenation nodes, to indicate that the corresponding -- operand is of the component type of the result. Used in resolving -- concatenation nodes in instances. -- Is_Controlling_Actual (Flag16-Sem) -- This flag is set on in an expression that is a controlling argument in -- a dispatching call. It is off in all other cases. See Sem_Disp for -- details of its use. -- Is_In_Discriminant_Check (Flag11-Sem) -- This flag is present in a selected component, and is used to indicate -- that the reference occurs within a discriminant check. The -- significance is that optimizations based on assuming that the -- discriminant check has a correct value cannot be performed in this -- case (or the disriminant check may be optimized away!) -- Is_Machine_Number (Flag11-Sem) -- This flag is set in an N_Real_Literal node to indicate that the value -- is a machine number. This avoids some unnecessary cases of converting -- real literals to machine numbers. -- Is_Null_Loop (Flag16-Sem) -- This flag is set in an N_Loop_Statement node if the corresponding loop -- can be determined to be null at compile time. This is used to suppress -- any warnings that would otherwise be issued inside the loop since they -- are probably not useful. -- Is_Overloaded (Flag5-Sem) -- A flag present in all expression nodes. Used temporarily during -- overloading determination. The setting of this flag is not relevant -- once overloading analysis is complete. -- Is_Power_Of_2_For_Shift (Flag13-Sem) -- A flag present only in N_Op_Expon nodes. It is set when the -- exponentiation is of the forma 2 ** N, where the type of N is an -- unsigned integral subtype whose size does not exceed the size of -- Standard_Integer (i.e. a type that can be safely converted to -- Natural), and the exponentiation appears as the right operand of an -- integer multiplication or an integer division where the dividend is -- unsigned. It is also required that overflow checking is off for both -- the exponentiation and the multiply/divide node. If this set of -- conditions holds, and the flag is set, then the division or -- multiplication can be (and is) converted to a shift. -- Is_Overloaded (Flag5-Sem) -- A flag present in all expression nodes. Used temporarily during -- overloading determination. The setting of this flag is not relevant -- once overloading analysis is complete. -- Is_Protected_Subprogram_Body (Flag7-Sem) -- A flag set in a Subprogram_Body block to indicate that it is the -- implementation of a protected subprogram. Such a body needs cleanup -- handler to make sure that the associated protected object is unlocked -- when the subprogram completes. -- Is_Static_Expression (Flag6-Sem) -- Indicates that an expression is a static expression (RM 4.9). See spec -- of package Sem_Eval for full details on the use of this flag. -- Is_Subprogram_Descriptor (Flag16-Sem) -- Present in N_Object_Declaration, and set only for the object -- declaration generated for a subprogram descriptor in fast exception -- mode. See Exp_Ch11 for details of use. -- Is_Task_Allocation_Block (Flag6-Sem) -- A flag set in a Block_Statement node to indicate that it is the -- expansion of a task allocator, or the allocator of an object -- containing tasks. Such a block requires a cleanup handler to call -- Expunge_Unactivted_Tasks to complete any tasks that have been -- allocated but not activated when the allocator completes abnormally. -- Is_Task_Master (Flag5-Sem) -- A flag set in a Subprogram_Body, Block_Statement or Task_Body node to -- indicate that the construct is a task master (i.e. has declared tasks -- or declares an access to a task type). -- Itype (Node1-Sem) -- Used in N_Itype_Reference node to reference an itype for which it is -- important to ensure that it is defined. See description of this node -- for further details. -- Kill_Range_Check (Flag11-Sem) -- Used in an N_Unchecked_Type_Conversion node to indicate that the -- result should not be subjected to range checks. This is used for the -- implementation of Normalize_Scalars. -- Label_Construct (Node2-Sem) -- Used in an N_Implicit_Label_Declaration node. Refers to an N_Label, -- N_Block_Statement or N_Loop_Statement node to which the label -- declaration applies. This is not currently used in the compiler -- itself, but it is useful in the implementation of ASIS queries. -- Library_Unit (Node4-Sem) -- In a stub node, Library_Unit points to the compilation unit node of -- the corresponding subunit. -- -- In a with clause node, Library_Unit points to the spec of the with'ed -- unit. -- -- In a compilation unit node, the usage depends on the unit type: -- -- For a subprogram body, Library_Unit points to the compilation unit -- node of the corresponding spec, unless Acts_As_Spec is set, in which -- case it points to itself. -- -- For a package body, Library_Unit points to the compilation unit of -- the corresponding package spec. -- -- For a subprogram spec to which pragma Inline applies, Library_Unit -- points to the compilation unit node of the corresponding body, if -- inlining is active. -- -- For a generic declaration, Library_Unit points to the compilation -- unit node of the corresponding generic body. -- -- For a subunit, Library_Unit points to the compilation unit node of -- the parent body. -- -- Note that this field is not used to hold the parent pointer for child -- unit (which might in any case need to use it for some other purpose as -- described above). Instead for a child unit, implicit with's are -- generated for all parents. -- Loop_Actions (List2-Sem) -- A list present in Component_Association nodes in array aggregates. -- Used to collect actions that must be executed within the loop because -- they may need to be evaluated anew each time through. -- Limited_View_Installed (Flag18-Sem) -- Present in With_Clauses and in package specifications. If set on -- with_clause, it indicates that this clause has created the current -- limited view of the designated package. On a package specification, it -- indicates that the limited view has already been created because the -- package is mentioned in a limited_with_clause in the closure of the -- unit being compiled. -- Must_Be_Byte_Aligned (Flag14-Sem) -- This flag is present in N_Attribute_Reference nodes. It can be set -- only for the Address and Unrestricted_Access attributes. If set it -- means that the object for which the address/access is given must be on -- a byte (more accurately a storage unit) boundary. If necessary, a copy -- of the object is to be made before taking the address (this copy is in -- the current scope on the stack frame). This is used for certain cases -- of code generated by the expander that passes parameters by address. -- -- The reason the copy is not made by the front end is that the back end -- has more information about type layout and may be able to (but is not -- guaranteed to) prevent making unnecessary copies. -- Must_Not_Freeze (Flag8-Sem) -- A flag present in all expression nodes. Normally expressions cause -- freezing as described in the RM. If this flag is set, then this is -- inhibited. This is used by the analyzer and expander to label nodes -- that are created by semantic analysis or expansion and which must not -- cause freezing even though they normally would. This flag is also -- present in an N_Subtype_Indication node, since we also use these in -- calls to Freeze_Expression. -- Next_Entity (Node2-Sem) -- Present in defining identifiers, defining character literals and -- defining operator symbols (i.e. in all entities). The entities of a -- scope are chained, and this field is used as the forward pointer for -- this list. See Einfo for further details. -- Next_Named_Actual (Node4-Sem) -- Present in parameter association node. Set during semantic analysis to -- point to the next named parameter, where parameters are ordered by -- declaration order (as opposed to the actual order in the call, which -- may be different due to named associations). Not that this field -- points to the explicit actual parameter itself, not to the -- N_Parameter_Association node (its parent). -- Next_Rep_Item (Node4-Sem) -- Present in pragma nodes and attribute definition nodes. Used to link -- representation items that apply to an entity. See description of -- First_Rep_Item field in Einfo for full details. -- Next_Use_Clause (Node3-Sem) -- While use clauses are active during semantic processing, they are -- chained from the scope stack entry, using Next_Use_Clause as a link -- pointer, with Empty marking the end of the list. The head pointer is -- in the scope stack entry (First_Use_Clause). At the end of semantic -- processing (i.e. when Gigi sees the tree, the contents of this field -- is undefined and should not be read). -- No_Ctrl_Actions (Flag7-Sem) -- Present in N_Assignment_Statement to indicate that no finalize nor nor -- adjust should take place on this assignment eventhough the rhs is -- controlled. This is used in init procs and aggregate expansions where -- the generated assignments are more initialisations than real -- assignments. -- No_Elaboration_Check (Flag14-Sem) -- Present in N_Function_Call and N_Procedure_Call_Statement. Indicates -- that no elaboration check is needed on the call, because it appears in -- the context of a local Suppress pragma. This is used on calls within -- task bodies, where the actual elaboration checks are applied after -- analysis, when the local scope stack is not present. -- No_Entities_Ref_In_Spec (Flag8-Sem) -- Present in N_With_Clause nodes. Set if the with clause is on the -- package or subprogram spec where the main unit is the corresponding -- body, and no entities of the with'ed unit are referenced by the spec -- (an entity may still be referenced in the body, so this flag is used -- to generate the proper message (see Sem_Util.Check_Unused_Withs for -- full details) -- No_Initialization (Flag13-Sem) -- Present in N_Object_Declaration & N_Allocator to indicate that the -- object must not be initialized (by Initialize or call to an init -- proc). This is needed for controlled aggregates. When the Object -- declaration has an expression, this flag means that this expression -- should not be taken into account (needed for in place initialization -- with aggregates) -- No_Truncation (Flag17-Sem) -- Present in N_Unchecked_Type_Conversion node. This flag has an effect -- only if the RM_Size of the source is greater than the RM_Size of the -- target for scalar operands. Normally in such a case we truncate some -- higher order bits of the source, and then sign/zero extend the result -- to form the output value. But if this flag is set, then we do not do -- any truncation, so for example, if an 8 bit input is converted to 5 -- bit result which is in fact stored in 8 bits, then the high order -- three bits of the target result will be copied from the source. This -- is used for properly setting out of range values for use by pragmas -- Initialize_Scalars and Normalize_Scalars. -- Original_Discriminant (Node2-Sem) -- Present in identifiers. Used in references to discriminants that -- appear in generic units. Because the names of the discriminants may be -- different in an instance, we use this field to recover the position of -- the discriminant in the original type, and replace it with the -- discriminant at the same position in the instantiated type. -- Original_Entity (Node2-Sem) -- Present in numeric literals. Used to denote the named number that has -- been constant-folded into the given literal. If literal is from -- source, or the result of some other constant-folding operation, then -- Original_Entity is empty. This field is needed to handle properly -- named numbers in generic units, where the Associated_Node field -- interferes with the Entity field, making it impossible to preserve the -- original entity at the point of instantiation (ASIS problem). -- Others_Discrete_Choices (List1-Sem) -- When a case statement or variant is analyzed, the semantic checks -- determine the actual list of choices that correspond to an others -- choice. This list is materialized for later use by the expander and -- the Others_Discrete_Choices field of an N_Others_Choice node points to -- this materialized list of choices, which is in standard format for a -- list of discrete choices, except that of course it cannot contain an -- N_Others_Choice entry. -- Parameter_List_Truncated (Flag17-Sem) -- Present in N_Function_Call and N_Procedure_Call_Statement nodes. Set -- (for OpenVMS ports of GNAT only) if the parameter list is truncated as -- a result of a First_Optional_Parameter specification in an -- Import_Function, Import_Procedure, or Import_Valued_Procedure pragma. -- The truncation is done by the expander by removing trailing parameters -- from the argument list, in accordance with the set of rules allowing -- such parameter removal. In particular, parameters can be removed -- working from the end of the parameter list backwards up to and -- including the entry designated by First_Optional_Parameter in the -- Import pragma. Parameters can be removed if they are implicit and the -- default value is a known-at-compile-time value, including the use of -- the Null_Parameter attribute, or if explicit parameter values are -- present that match the corresponding defaults. -- Parent_Spec (Node4-Sem) -- For a library unit that is a child unit spec (package or subprogram -- declaration, generic declaration or instantiation, or library level -- rename, this field points to the compilation unit node for the parent -- package specification. This field is Empty for library bodies (the -- parent spec in this case can be found from the corresponding spec). -- Present_Expr (Uint3-Sem) -- Present in an N_Variant node. This has a meaningful value only after -- Gigi has back annotated the tree with representation information. At -- this point, it contains a reference to a gcc expression that depends -- on the values of one or more discriminants. Give a set of discriminant -- values, this expression evaluates to False (zero) if variant is not -- present, and True (non-zero) if it is present. See unit Repinfo for -- further details on gigi back annotation. This field is used during -- ASIS processing (data decomposition annex) to determine if a field is -- present or not. -- Print_In_Hex (Flag13-Sem) -- Set on an N_Integer_Literal node to indicate that the value should be -- printed in hexadecimal in the sprint listing. Has no effect on -- legality or semantics of program, only on the displayed output. This -- is used to clarify output from the packed array cases. -- Procedure_To_Call (Node4-Sem) -- Present in N_Allocator, N_Free_Statement, and N_Return_Statement -- nodes. References the entity for the declaration of the procedure to -- be called to accomplish the required operation (i.e. for the Allocate -- procedure in the case of N_Allocator and N_Return_Statement (for -- allocating the return value), and for the Deallocate procedure in the -- case of N_Free_Statement. -- Raises_Constraint_Error (Flag7-Sem) -- Set on an expression whose evaluation will definitely fail constraint -- error check. In the case of static expressions, this flag must be set -- accurately (and if it is set, the expression is typically illegal -- unless it appears as a non-elaborated branch of a short-circuit form). -- For a non-static expression, this flag may be set whenever an -- expression (e.g. an aggregate) is known to raise constraint error. If -- set, the expression definitely will raise CE if elaborated at runtime. -- If not set, the expression may or may not raise CE. In other words, on -- static expressions, the flag is set accurately, on non-static -- expressions it is set conservatively. -- Redundant_Use (Flag13-Sem) -- Present in nodes that can appear as an operand in a use clause or use -- type clause (identifiers, expanded names, attribute references). Set -- to indicate that a use is redundant (and therefore need not be undone -- on scope exit). -- Return_Type (Node2-Sem) -- Present in N_Return_Statement node. For a procedure, this is set to -- Standard_Void_Type. For a function it references the entity for the -- returned type. -- Rounded_Result (Flag18-Sem) -- Present in N_Type_Conversion, N_Op_Divide and N_Op_Multiply nodes. -- Used in the fixed-point cases to indicate that the result must be -- rounded as a result of the use of the 'Round attribute. Also used for -- integer N_Op_Divide nodes to indicate that the result should be -- rounded to the nearest integer (breaking ties away from zero), rather -- than truncated towards zero as usual. These rounded integer operations -- are the result of expansion of rounded fixed-point divide, conversion -- and multiplication operations. -- Scope (Node3-Sem) -- Present in defining identifiers, defining character literals and -- defining operator symbols (i.e. in all entities). The entities of a -- scope all use this field to reference the corresponding scope entity. -- See Einfo for further details. -- Shift_Count_OK (Flag4-Sem) -- A flag present in shift nodes to indicate that the shift count is -- known to be in range, i.e. is in the range from zero to word length -- minus one. If this flag is not set, then the shift count may be -- outside this range, i.e. larger than the word length, and the code -- must ensure that such shift counts give the appropriate result. -- Source_Type (Node1-Sem) -- Used in an N_Validate_Unchecked_Conversion node to point to the -- source type entity for the unchecked conversion instantiation -- which gigi must do size validation for. -- Static_Processing_OK (Flag4-Sem) -- Present in N_Aggregate nodes. When the Compile_Time_Known_Aggregate -- flag is set, the full value of the aggregate can be determined at -- compile time and the aggregate can be passed as is to the back-end. In -- this event it is irrelevant whether this flag is set or not. However, -- if the Compile_Time_Known_Aggregate flag is not set but -- Static_Processing_OK is set, the aggregate can (but need not) be -- converted into a compile time known aggregate by the expander. See -- Sem_Aggr for the specific conditions under which an aggregate has its -- Static_Processing_OK flag set. -- Storage_Pool (Node1-Sem) -- Present in N_Allocator, N_Free_Statement and N_Return_Statement nodes. -- References the entity for the storage pool to be used for the allocate -- or free call or for the allocation of the returned value from a -- function. Empty indicates that the global default default pool is to -- be used. Note that in the case of a return statement, this field is -- set only if the function returns value of a type whose size is not -- known at compile time on the secondary stack. It is never set on -- targets for which the parameter Functions_Return_By_DSP_On_Target in -- Targparm is True. -- Target_Type (Node2-Sem) -- Used in an N_Validate_Unchecked_Conversion node to point to the target -- type entity for the unchecked conversion instantiation which gigi must -- do size validation for. -- Then_Actions (List3-Sem) -- This field is present in conditional expression nodes. During code -- expansion we use the Insert_Actions procedure (in Exp_Util) to insert -- actions at an appropriate place in the tree to get elaborated at the -- right time. For conditional expressions, we have to be sure that the -- actions for the Then branch are only elaborated if the condition is -- True. The Then_Actions field is used as a temporary parking place for -- these actions. The final tree is always rewritten to eliminate the -- need for this field, so in the tree passed to Gigi, this field is -- always set to No_List. -- Treat_Fixed_As_Integer (Flag14-Sem) -- This flag appears in operator nodes for divide, multiply, mod and rem -- on fixed-point operands. It indicates that the operands are to be -- treated as integer values, ignoring small values. This flag is only -- set as a result of expansion of fixed-point operations. Typically a -- fixed-point multplication in the source generates subsidiary -- multiplication and division operations that work with the underlying -- integer values and have this flag set. Note that this flag is not -- needed on other arithmetic operations (add, neg, subtract etc) since -- in these cases it is always the case that fixed is treated as integer. -- The Etype field MUST be set if this flag is set. The analyzer knows to -- leave such nodes alone, and whoever makes them must set the correct -- Etype value. -- TSS_Elist (Elist3-Sem) -- Present in N_Freeze_Entity nodes. Holds an element list containing -- entries for each TSS (type support subprogram) associated with the -- frozen type. The elements of the list are the entities for the -- subprograms (see package Exp_TSS for further details). Set to No_Elist -- if there are no type support subprograms for the type or if the freeze -- node is not for a type. -- Unreferenced_In_Spec (Flag7-Sem) -- Present in N_With_Clause nodes. Set if the with clause is on the -- package or subprogram spec where the main unit is the corresponding -- body, and is not referenced by the spec (it may still be referenced by -- the body, so this flag is used to generate the proper message (see -- Sem_Util.Check_Unused_Withs for details) -- Was_Originally_Stub (Flag13-Sem) -- This flag is set in the node for a proper body that replaces stub. -- During the analysis procedure, stubs in some situations get rewritten -- by the corresponding bodies, and we set this flag to remember that -- this happened. Note that it is not good enough to rely on the use of -- Original_Node here because of the case of nested instantiations where -- the substituted node can be copied. -- Zero_Cost_Handling (Flag5-Sem) -- This flag is set in all handled sequence of statement and exception -- handler nodes if eceptions are to be handled using the zero-cost -- mechanism (see Ada.Exceptions and System.Exceptions in files -- a-except.ads/adb and s-except.ads for full details). What gigi needs -- to do for such a handler is simply to put the code in the handler -- somewhere. The front end has generated all necessary labels. -------------------------------------------------- -- Note on Use of End_Label and End_Span Fields -- -------------------------------------------------- -- Several constructs have end lines: -- Loop Statement end loop [loop_IDENTIFIER]; -- Package Specification end [[PARENT_UNIT_NAME .] IDENTIFIER] -- Task Definition end [task_IDENTIFIER] -- Protected Definition end [protected_IDENTIFIER] -- Protected Body end [protected_IDENTIFIER] -- Block Statement end [block_IDENTIFIER]; -- Subprogram Body end [DESIGNATOR]; -- Package Body end [[PARENT_UNIT_NAME .] IDENTIFIER]; -- Task Body end [task_IDENTIFIER]; -- Accept Statement end [entry_IDENTIFIER]]; -- Entry Body end [entry_IDENTIFIER]; -- If Statement end if; -- Case Statement end case; -- Record Definition end record; -- Enumeration Definition ); -- The End_Label and End_Span fields are used to mark the locations of -- these lines, and also keep track of the label in the case where a label -- is present. -- For the first group above, the End_Label field of the corresponding node -- is used to point to the label identifier. In the case where there is no -- label in the source, the parser supplies a dummy identifier (with -- Comes_From_Source set to False), and the Sloc of this dummy identifier -- marks the location of the token following the END token. -- For the second group, the use of End_Label is similar, but the End_Label -- is found in the N_Handled_Sequence_Of_Statements node. This is done -- simply because in some cases there is no room in the parent node. -- For the third group, there is never any label, and instead of using -- End_Label, we use the End_Span field which gives the location of the -- token following END, relative to the starting Sloc of the construct, -- i.e. add Sloc (Node) + End_Span (Node) to get the Sloc of the IF or CASE -- following the End_Label. -- The record definition case is handled specially, we treat it as though -- it required an optional label which is never present, and so the parser -- always builds a dummy identifier with Comes From Source set False. The -- reason we do this, rather than using End_Span in this case, is that we -- want to generate a cross-ref entry for the end of a record, since it -- represents a scope for name declaration purposes. -- The enumeration definition case is handled in an exactly similar manner, -- building a dummy identifier to get a cross-reference. -- Note: the reason we store the difference as a Uint, instead of storing -- the Source_Ptr value directly, is that Source_Ptr values cannot be -- distinguished from other types of values, and we count on all general -- use fields being self describing. To make things easier for clients, -- note that we provide function End_Location, and procedure -- Set_End_Location to allow access to the logical value (which is the -- Source_Ptr value for the end token). --------------------- -- Syntactic Nodes -- --------------------- --------------------- -- 2.3 Identifier -- --------------------- -- IDENTIFIER ::= IDENTIFIER_LETTER {[UNDERLINE] LETTER_OR_DIGIT} -- LETTER_OR_DIGIT ::= IDENTIFIER_LETTER | DIGIT -- An IDENTIFIER shall not be a reserved word -- In the Ada grammar identifiers are the bottom level tokens which have -- very few semantics. Actual program identifiers are direct names. If -- we were being 100% honest with the grammar, then we would have a node -- called N_Direct_Name which would point to an identifier. However, -- that's too many extra nodes, so we just use the N_Identifier node -- directly as a direct name, and it contains the expression fields and -- Entity field that correspond to its use as a direct name. In those -- few cases where identifiers appear in contexts where they are not -- direct names (pragmas, pragma argument associations, attribute -- references and attribute definition clauses), the Chars field of the -- node contains the Name_Id for the identifier name. -- Note: in GNAT, a reserved word can be treated as an identifier in two -- cases. First, an incorrect use of a reserved word as an identifier is -- diagnosed and then treated as a normal identifier. Second, an -- attribute designator of the form of a reserved word (access, delta, -- digits, range) is treated as an identifier. -- Note: The set of letters that is permitted in an identifier depends -- on the character set in use. See package Csets for full details. -- N_Identifier -- Sloc points to identifier -- Chars (Name1) contains the Name_Id for the identifier -- Entity (Node4-Sem) -- Associated_Node (Node4-Sem) -- Original_Discriminant (Node2-Sem) -- Redundant_Use (Flag13-Sem) -- Has_Private_View (Flag11-Sem) (set in generic units) -- plus fields for expression -------------------------- -- 2.4 Numeric Literal -- -------------------------- -- NUMERIC_LITERAL ::= DECIMAL_LITERAL | BASED_LITERAL ---------------------------- -- 2.4.1 Decimal Literal -- ---------------------------- -- DECIMAL_LITERAL ::= NUMERAL [.NUMERAL] [EXPONENT] -- NUMERAL ::= DIGIT {[UNDERLINE] DIGIT} -- EXPONENT ::= E [+] NUMERAL | E - NUMERAL -- Decimal literals appear in the tree as either integer literal nodes -- or real literal nodes, depending on whether a period is present. -- Note: literal nodes appear as a result of direct use of literals -- in the source program, and also as the result of evaluating -- expressions at compile time. In the latter case, it is possible -- to construct real literals that have no syntactic representation -- using the standard literal format. Such literals are listed by -- Sprint using the notation [numerator / denominator]. -- Note: the value of an integer literal node created by the front end -- is never outside the range of values of the base type. However, it -- can be the case that the value is outside the range of the -- particular subtype. This happens in the case of integer overflows -- with checks suppressed. -- N_Integer_Literal -- Sloc points to literal -- Original_Entity (Node2-Sem) If not Empty, holds Named_Number that -- has been constant-folded into its literal value. -- Intval (Uint3) contains integer value of literal -- plus fields for expression -- Print_In_Hex (Flag13-Sem) -- N_Real_Literal -- Sloc points to literal -- Original_Entity (Node2-Sem) If not Empty, holds Named_Number that -- has been constant-folded into its literal value. -- Realval (Ureal3) contains real value of literal -- Corresponding_Integer_Value (Uint4-Sem) -- Is_Machine_Number (Flag11-Sem) -- plus fields for expression -------------------------- -- 2.4.2 Based Literal -- -------------------------- -- BASED_LITERAL ::= -- BASE # BASED_NUMERAL [.BASED_NUMERAL] # [EXPONENT] -- BASE ::= NUMERAL -- BASED_NUMERAL ::= -- EXTENDED_DIGIT {[UNDERLINE] EXTENDED_DIGIT} -- EXTENDED_DIGIT ::= DIGIT | A | B | C | D | E | F -- Based literals appear in the tree as either integer literal nodes -- or real literal nodes, depending on whether a period is present. ---------------------------- -- 2.5 Character Literal -- ---------------------------- -- CHARACTER_LITERAL ::= ' GRAPHIC_CHARACTER ' -- N_Character_Literal -- Sloc points to literal -- Chars (Name1) contains the Name_Id for the identifier -- Char_Literal_Value (Uint2) contains the literal value -- Entity (Node4-Sem) -- Associated_Node (Node4-Sem) -- Has_Private_View (Flag11-Sem) set in generic units. -- plus fields for expression -- Note: the Entity field will be missing (set to Empty) for character -- literals whose type is Standard.Wide_Character or Standard.Character -- or a type derived from one of these two. In this case the character -- literal stands for its own coding. The reason we take this irregular -- short cut is to avoid the need to build lots of junk defining -- character literal nodes. ------------------------- -- 2.6 String Literal -- ------------------------- -- STRING LITERAL ::= "{STRING_ELEMENT}" -- A STRING_ELEMENT is either a pair of quotation marks ("), or a -- single GRAPHIC_CHARACTER other than a quotation mark. -- N_String_Literal -- Sloc points to literal -- Strval (Str3) contains Id of string value -- Has_Wide_Character (Flag11-Sem) -- plus fields for expression ------------------ -- 2.7 Comment -- ------------------ -- A COMMENT starts with two adjacent hyphens and extends up to the -- end of the line. A COMMENT may appear on any line of a program. -- Comments are skipped by the scanner and do not appear in the tree. -- It is possible to reconstruct the position of comments with respect -- to the elements of the tree by using the source position (Sloc) -- pointers that appear in every tree node. ----------------- -- 2.8 Pragma -- ----------------- -- PRAGMA ::= pragma IDENTIFIER -- [(PRAGMA_ARGUMENT_ASSOCIATION {, PRAGMA_ARGUMENT_ASSOCIATION})]; -- Note that a pragma may appear in the tree anywhere a declaration -- or a statement may appear, as well as in some other situations -- which are explicitly documented. -- N_Pragma -- Sloc points to PRAGMA -- Chars (Name1) identifier name from pragma identifier -- Pragma_Argument_Associations (List2) (set to No_List if none) -- Debug_Statement (Node3) (set to Empty if not Debug, Assert) -- Next_Rep_Item (Node4-Sem) -- Note: we should have a section on what pragmas are passed on to -- the back end to be processed. This section should note that pragma -- Psect_Object is always converted to Common_Object, but there are -- undoubtedly many other similar notes required ??? -------------------------------------- -- 2.8 Pragma Argument Association -- -------------------------------------- -- PRAGMA_ARGUMENT_ASSOCIATION ::= -- [pragma_argument_IDENTIFIER =>] NAME -- | [pragma_argument_IDENTIFIER =>] EXPRESSION -- N_Pragma_Argument_Association -- Sloc points to first token in association -- Chars (Name1) (set to No_Name if no pragma argument identifier) -- Expression (Node3) ------------------------ -- 2.9 Reserved Word -- ------------------------ -- Reserved words are parsed by the scanner, and returned as the -- corresponding token types (e.g. PACKAGE is returned as Tok_Package) ---------------------------- -- 3.1 Basic Declaration -- ---------------------------- -- BASIC_DECLARATION ::= -- TYPE_DECLARATION | SUBTYPE_DECLARATION -- | OBJECT_DECLARATION | NUMBER_DECLARATION -- | SUBPROGRAM_DECLARATION | ABSTRACT_SUBPROGRAM_DECLARATION -- | PACKAGE_DECLARATION | RENAMING_DECLARATION -- | EXCEPTION_DECLARATION | GENERIC_DECLARATION -- | GENERIC_INSTANTIATION -- Basic declaration also includes IMPLICIT_LABEL_DECLARATION -- see further description in section on semantic nodes. -- Also, in the tree that is constructed, a pragma may appear -- anywhere that a declaration may appear. ------------------------------ -- 3.1 Defining Identifier -- ------------------------------ -- DEFINING_IDENTIFIER ::= IDENTIFIER -- A defining identifier is an entity, which has additional fields -- depending on the setting of the Ekind field. These additional -- fields are defined (and access subprograms declared) in package -- Einfo. -- Note: N_Defining_Identifier is an extended node whose fields are -- deliberate layed out to match the layout of fields in an ordinary -- N_Identifier node allowing for easy alteration of an identifier -- node into a defining identifier node. For details, see procedure -- Sinfo.CN.Change_Identifier_To_Defining_Identifier. -- N_Defining_Identifier -- Sloc points to identifier -- Chars (Name1) contains the Name_Id for the identifier -- Next_Entity (Node2-Sem) -- Scope (Node3-Sem) -- Etype (Node5-Sem) ----------------------------- -- 3.2.1 Type Declaration -- ----------------------------- -- TYPE_DECLARATION ::= -- FULL_TYPE_DECLARATION -- | INCOMPLETE_TYPE_DECLARATION -- | PRIVATE_TYPE_DECLARATION -- | PRIVATE_EXTENSION_DECLARATION ---------------------------------- -- 3.2.1 Full Type Declaration -- ---------------------------------- -- FULL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] -- is TYPE_DEFINITION; -- | TASK_TYPE_DECLARATION -- | PROTECTED_TYPE_DECLARATION -- The full type declaration node is used only for the first case. The -- second case (concurrent type declaration), is represented directly -- by a task type declaration or a protected type declaration. -- N_Full_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier (Node1) -- Discriminant_Specifications (List4) (set to No_List if none) -- Type_Definition (Node3) -- Discr_Check_Funcs_Built (Flag11-Sem) ---------------------------- -- 3.2.1 Type Definition -- ---------------------------- -- TYPE_DEFINITION ::= -- ENUMERATION_TYPE_DEFINITION | INTEGER_TYPE_DEFINITION -- | REAL_TYPE_DEFINITION | ARRAY_TYPE_DEFINITION -- | RECORD_TYPE_DEFINITION | ACCESS_TYPE_DEFINITION -- | DERIVED_TYPE_DEFINITION | INTERFACE_TYPE_DEFINITION -------------------------------- -- 3.2.2 Subtype Declaration -- -------------------------------- -- SUBTYPE_DECLARATION ::= -- subtype DEFINING_IDENTIFIER is [NULL_EXCLUSION] SUBTYPE_INDICATION; -- The subtype indication field is set to Empty for subtypes -- declared in package Standard (Positive, Natural). -- N_Subtype_Declaration -- Sloc points to SUBTYPE -- Defining_Identifier (Node1) -- Null_Exclusion_Present (Flag11) -- Subtype_Indication (Node5) -- Generic_Parent_Type (Node4-Sem) (set for an actual derived type). -- Exception_Junk (Flag7-Sem) ------------------------------- -- 3.2.2 Subtype Indication -- ------------------------------- -- SUBTYPE_INDICATION ::= SUBTYPE_MARK [CONSTRAINT] -- Note: if no constraint is present, the subtype indication appears -- directly in the tree as a subtype mark. The N_Subtype_Indication -- node is used only if a constraint is present. -- Note: [For Ada 2005 (AI-231)]: Because Ada 2005 extends this rule -- with the null-exclusion part (see AI-231), we had to introduce a new -- attribute in all the parents of subtype_indication nodes to indicate -- if the null-exclusion is present. -- Note: the reason that this node has expression fields is that a -- subtype indication can appear as an operand of a membership test. -- N_Subtype_Indication -- Sloc points to first token of subtype mark -- Subtype_Mark (Node4) -- Constraint (Node3) -- Etype (Node5-Sem) -- Must_Not_Freeze (Flag8-Sem) -- Note: Etype is a copy of the Etype field of the Subtype_Mark. The -- reason for this redundancy is so that in a list of array index types, -- the Etype can be uniformly accessed to determine the subscript type. -- This means that no Itype is constructed for the actual subtype that -- is created by the subtype indication. If such an Itype is required, -- it is constructed in the context in which the indication appears. ------------------------- -- 3.2.2 Subtype Mark -- ------------------------- -- SUBTYPE_MARK ::= subtype_NAME ----------------------- -- 3.2.2 Constraint -- ----------------------- -- CONSTRAINT ::= SCALAR_CONSTRAINT | COMPOSITE_CONSTRAINT ------------------------------ -- 3.2.2 Scalar Constraint -- ------------------------------ -- SCALAR_CONSTRAINT ::= -- RANGE_CONSTRAINT | DIGITS_CONSTRAINT | DELTA_CONSTRAINT --------------------------------- -- 3.2.2 Composite Constraint -- --------------------------------- -- COMPOSITE_CONSTRAINT ::= -- INDEX_CONSTRAINT | DISCRIMINANT_CONSTRAINT ------------------------------- -- 3.3.1 Object Declaration -- ------------------------------- -- OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : [aliased] [constant] -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] -- ACCESS_DEFINITION [:= EXPRESSION]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] -- ARRAY_TYPE_DEFINITION [:= EXPRESSION]; -- | SINGLE_TASK_DECLARATION -- | SINGLE_PROTECTED_DECLARATION -- Note: aliased is not permitted in Ada 83 mode -- The N_Object_Declaration node is only for the first two cases. -- Single task declaration is handled by P_Task (9.1) -- Single protected declaration is handled by P_protected (9.5) -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single declarations, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- Note: if a range check is required for the initialization -- expression then the Do_Range_Check flag is set in the Expression, -- with the check being done against the type given by the object -- definition, which is also the Etype of the defining identifier. -- Note: the contents of the Expression field must be ignored (i.e. -- treated as though it were Empty) if No_Initialization is set True. -- Note: the back end places some restrictions on the form of the -- Expression field. If the object being declared is Atomic, then -- the Expression may not have the form of an aggregate (since this -- might cause the back end to generate separate assignments). It -- also cannot be a reference to an object marked as a true constant -- (Is_True_Constant flag set), where the object is itself initalized -- with an aggregate. If necessary the front end must generate an -- extra temporary (with Is_True_Constant set False), and initialize -- this temporary as required (the temporary itself is not atomic). -- Note: there is not node kind for object definition. Instead, the -- corresponding field holds a subtype indication, an array type -- definition, or (Ada 2005, AI-406) an access definition. -- N_Object_Declaration -- Sloc points to first identifier -- Defining_Identifier (Node1) -- Aliased_Present (Flag4) set if ALIASED appears -- Constant_Present (Flag17) set if CONSTANT appears -- Null_Exclusion_Present (Flag11) -- Object_Definition (Node4) subtype indic./array type def./ access def. -- Expression (Node3) (set to Empty if not present) -- Handler_List_Entry (Node2-Sem) -- Corresponding_Generic_Association (Node5-Sem) -- More_Ids (Flag5) (set to False if no more identifiers in list) -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) -- No_Initialization (Flag13-Sem) -- Assignment_OK (Flag15-Sem) -- Exception_Junk (Flag7-Sem) -- Delay_Finalize_Attach (Flag14-Sem) -- Is_Subprogram_Descriptor (Flag16-Sem) ------------------------------------- -- 3.3.1 Defining Identifier List -- ------------------------------------- -- DEFINING_IDENTIFIER_LIST ::= -- DEFINING_IDENTIFIER {, DEFINING_IDENTIFIER} ------------------------------- -- 3.3.2 Number Declaration -- ------------------------------- -- NUMBER_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : constant := static_EXPRESSION; -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with -- identical expressions. To simplify semantic processing, the parser -- represents a multiple declaration case as a sequence of single -- declarations, using the More_Ids and Prev_Ids flags to preserve -- the original source form as described in the section on "Handling -- of Defining Identifier Lists". -- N_Number_Declaration -- Sloc points to first identifier -- Defining_Identifier (Node1) -- Expression (Node3) -- More_Ids (Flag5) (set to False if no more identifiers in list) -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) ---------------------------------- -- 3.4 Derived Type Definition -- ---------------------------------- -- DERIVED_TYPE_DEFINITION ::= -- [abstract] [limited] new [NULL_EXCLUSION] parent_SUBTYPE_INDICATION -- [[and INTERFACE_LIST] RECORD_EXTENSION_PART] -- Note: ABSTRACT, LIMITED and record extension part are not permitted -- in Ada 83 mode -- Note: a record extension part is required if ABSTRACT is present -- N_Derived_Type_Definition -- Sloc points to NEW -- Abstract_Present (Flag4) -- Null_Exclusion_Present (Flag11) (set to False if not present) -- Subtype_Indication (Node5) -- Record_Extension_Part (Node3) (set to Empty if not present) -- Limited_Present (Flag17) -- Task_Present (Flag5) set in task interfaces -- Protected_Present (Flag6) set in protected interfaces -- Synchronized_Present (Flag7) set in interfaces -- Interface_List (List2) (set to No_List if none) -- Interface_Present (Flag16) set in abstract interfaces -- Note: Task_Present, Protected_Present, Synchronized_Present, -- Interface_List, and Interface_Present are used for abstract -- interfaces (see comments for INTERFACE_TYPE_DEFINITION). --------------------------- -- 3.5 Range Constraint -- --------------------------- -- RANGE_CONSTRAINT ::= range RANGE -- N_Range_Constraint -- Sloc points to RANGE -- Range_Expression (Node4) ---------------- -- 3.5 Range -- ---------------- -- RANGE ::= -- RANGE_ATTRIBUTE_REFERENCE -- | SIMPLE_EXPRESSION .. SIMPLE_EXPRESSION -- Note: the case of a range given as a range attribute reference -- appears directly in the tree as an attribute reference. -- Note: the field name for a reference to a range is Range_Expression -- rather than Range, because range is a reserved keyword in Ada! -- Note: the reason that this node has expression fields is that a -- range can appear as an operand of a membership test. The Etype -- field is the type of the range (we do NOT construct an implicit -- subtype to represent the range exactly). -- N_Range -- Sloc points to .. -- Low_Bound (Node1) -- High_Bound (Node2) -- Includes_Infinities (Flag11) -- plus fields for expression -- Note: if the range appears in a context, such as a subtype -- declaration, where range checks are required on one or both of -- the expression fields, then type conversion nodes are inserted -- to represent the required checks. ---------------------------------------- -- 3.5.1 Enumeration Type Definition -- ---------------------------------------- -- ENUMERATION_TYPE_DEFINITION ::= -- (ENUMERATION_LITERAL_SPECIFICATION -- {, ENUMERATION_LITERAL_SPECIFICATION}) -- Note: the Literals field in the node described below is null for -- the case of the standard types CHARACTER and WIDE_CHARACTER, for -- which special processing handles these types as special cases. -- N_Enumeration_Type_Definition -- Sloc points to left parenthesis -- Literals (List1) (Empty for CHARACTER or WIDE_CHARACTER) -- End_Label (Node4) (set to Empty if internally generated record) ---------------------------------------------- -- 3.5.1 Enumeration Literal Specification -- ---------------------------------------------- -- ENUMERATION_LITERAL_SPECIFICATION ::= -- DEFINING_IDENTIFIER | DEFINING_CHARACTER_LITERAL --------------------------------------- -- 3.5.1 Defining Character Literal -- --------------------------------------- -- DEFINING_CHARACTER_LITERAL ::= CHARACTER_LITERAL -- A defining character literal is an entity, which has additional -- fields depending on the setting of the Ekind field. These -- additional fields are defined (and access subprograms declared) -- in package Einfo. -- Note: N_Defining_Character_Literal is an extended node whose fields -- are deliberate layed out to match the layout of fields in an ordinary -- N_Character_Literal node allowing for easy alteration of a character -- literal node into a defining character literal node. For details, see -- Sinfo.CN.Change_Character_Literal_To_Defining_Character_Literal. -- N_Defining_Character_Literal -- Sloc points to literal -- Chars (Name1) contains the Name_Id for the identifier -- Next_Entity (Node2-Sem) -- Scope (Node3-Sem) -- Etype (Node5-Sem) ------------------------------------ -- 3.5.4 Integer Type Definition -- ------------------------------------ -- Note: there is an error in this rule in the latest version of the -- grammar, so we have retained the old rule pending clarification. -- INTEGER_TYPE_DEFINITION ::= -- SIGNED_INTEGER_TYPE_DEFINITION -- | MODULAR_TYPE_DEFINITION ------------------------------------------- -- 3.5.4 Signed Integer Type Definition -- ------------------------------------------- -- SIGNED_INTEGER_TYPE_DEFINITION ::= -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION -- Note: the Low_Bound and High_Bound fields are set to Empty -- for integer types defined in package Standard. -- N_Signed_Integer_Type_Definition -- Sloc points to RANGE -- Low_Bound (Node1) -- High_Bound (Node2) ------------------------------------ -- 3.5.4 Modular Type Definition -- ------------------------------------ -- MODULAR_TYPE_DEFINITION ::= mod static_EXPRESSION -- N_Modular_Type_Definition -- Sloc points to MOD -- Expression (Node3) --------------------------------- -- 3.5.6 Real Type Definition -- --------------------------------- -- REAL_TYPE_DEFINITION ::= -- FLOATING_POINT_DEFINITION | FIXED_POINT_DEFINITION -------------------------------------- -- 3.5.7 Floating Point Definition -- -------------------------------------- -- FLOATING_POINT_DEFINITION ::= -- digits static_SIMPLE_EXPRESSION [REAL_RANGE_SPECIFICATION] -- Note: The Digits_Expression and Real_Range_Specifications fields -- are set to Empty for floating-point types declared in Standard. -- N_Floating_Point_Definition -- Sloc points to DIGITS -- Digits_Expression (Node2) -- Real_Range_Specification (Node4) (set to Empty if not present) ------------------------------------- -- 3.5.7 Real Range Specification -- ------------------------------------- -- REAL_RANGE_SPECIFICATION ::= -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION -- N_Real_Range_Specification -- Sloc points to RANGE -- Low_Bound (Node1) -- High_Bound (Node2) ----------------------------------- -- 3.5.9 Fixed Point Definition -- ----------------------------------- -- FIXED_POINT_DEFINITION ::= -- ORDINARY_FIXED_POINT_DEFINITION | DECIMAL_FIXED_POINT_DEFINITION -------------------------------------------- -- 3.5.9 Ordinary Fixed Point Definition -- -------------------------------------------- -- ORDINARY_FIXED_POINT_DEFINITION ::= -- delta static_EXPRESSION REAL_RANGE_SPECIFICATION -- Note: In Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION -- N_Ordinary_Fixed_Point_Definition -- Sloc points to DELTA -- Delta_Expression (Node3) -- Real_Range_Specification (Node4) ------------------------------------------- -- 3.5.9 Decimal Fixed Point Definition -- ------------------------------------------- -- DECIMAL_FIXED_POINT_DEFINITION ::= -- delta static_EXPRESSION -- digits static_EXPRESSION [REAL_RANGE_SPECIFICATION] -- Note: decimal types are not permitted in Ada 83 mode -- N_Decimal_Fixed_Point_Definition -- Sloc points to DELTA -- Delta_Expression (Node3) -- Digits_Expression (Node2) -- Real_Range_Specification (Node4) (set to Empty if not present) ------------------------------ -- 3.5.9 Digits Constraint -- ------------------------------ -- DIGITS_CONSTRAINT ::= -- digits static_EXPRESSION [RANGE_CONSTRAINT] -- Note: in Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION -- Note: in Ada 95, reduced accuracy subtypes are obsolescent -- N_Digits_Constraint -- Sloc points to DIGITS -- Digits_Expression (Node2) -- Range_Constraint (Node4) (set to Empty if not present) -------------------------------- -- 3.6 Array Type Definition -- -------------------------------- -- ARRAY_TYPE_DEFINITION ::= -- UNCONSTRAINED_ARRAY_DEFINITION | CONSTRAINED_ARRAY_DEFINITION ----------------------------------------- -- 3.6 Unconstrained Array Definition -- ----------------------------------------- -- UNCONSTRAINED_ARRAY_DEFINITION ::= -- array (INDEX_SUBTYPE_DEFINITION {, INDEX_SUBTYPE_DEFINITION}) of -- COMPONENT_DEFINITION -- Note: dimensionality of array is indicated by number of entries in -- the Subtype_Marks list, which has one entry for each dimension. -- N_Unconstrained_Array_Definition -- Sloc points to ARRAY -- Subtype_Marks (List2) -- Component_Definition (Node4) ----------------------------------- -- 3.6 Index Subtype Definition -- ----------------------------------- -- INDEX_SUBTYPE_DEFINITION ::= SUBTYPE_MARK range <> -- There is no explicit node in the tree for an index subtype -- definition since the N_Unconstrained_Array_Definition node -- incorporates the type marks which appear in this context. --------------------------------------- -- 3.6 Constrained Array Definition -- --------------------------------------- -- CONSTRAINED_ARRAY_DEFINITION ::= -- array (DISCRETE_SUBTYPE_DEFINITION -- {, DISCRETE_SUBTYPE_DEFINITION}) -- of COMPONENT_DEFINITION -- Note: dimensionality of array is indicated by number of entries -- in the Discrete_Subtype_Definitions list, which has one entry -- for each dimension. -- N_Constrained_Array_Definition -- Sloc points to ARRAY -- Discrete_Subtype_Definitions (List2) -- Component_Definition (Node4) -------------------------------------- -- 3.6 Discrete Subtype Definition -- -------------------------------------- -- DISCRETE_SUBTYPE_DEFINITION ::= -- discrete_SUBTYPE_INDICATION | RANGE ------------------------------- -- 3.6 Component Definition -- ------------------------------- -- COMPONENT_DEFINITION ::= -- [aliased] [NULL_EXCLUSION] SUBTYPE_INDICATION | ACCESS_DEFINITION -- Note: although the syntax does not permit a component definition to -- be an anonymous array (and the parser will diagnose such an attempt -- with an appropriate message), it is possible for anonymous arrays -- to appear as component definitions. The semantics and back end handle -- this case properly, and the expander in fact generates such cases. -- Access_Definition is an optional field that gives support to -- Ada 2005 (AI-230). The parser generates nodes that have either the -- Subtype_Indication field or else the Access_Definition field. -- N_Component_Definition -- Sloc points to ALIASED, ACCESS or to first token of subtype mark -- Aliased_Present (Flag4) -- Null_Exclusion_Present (Flag11) -- Subtype_Indication (Node5) (set to Empty if not present) -- Access_Definition (Node3) (set to Empty if not present) ----------------------------- -- 3.6.1 Index Constraint -- ----------------------------- -- INDEX_CONSTRAINT ::= (DISCRETE_RANGE {, DISCRETE_RANGE}) -- It is not in general possible to distinguish between discriminant -- constraints and index constraints at parse time, since a simple -- name could be either the subtype mark of a discrete range, or an -- expression in a discriminant association with no name. Either -- entry appears simply as the name, and the semantic parse must -- distinguish between the two cases. Thus we use a common tree -- node format for both of these constraint types. -- See Discriminant_Constraint for format of node --------------------------- -- 3.6.1 Discrete Range -- --------------------------- -- DISCRETE_RANGE ::= discrete_SUBTYPE_INDICATION | RANGE ---------------------------- -- 3.7 Discriminant Part -- ---------------------------- -- DISCRIMINANT_PART ::= -- UNKNOWN_DISCRIMINANT_PART | KNOWN_DISCRIMINANT_PART ------------------------------------ -- 3.7 Unknown Discriminant Part -- ------------------------------------ -- UNKNOWN_DISCRIMINANT_PART ::= (<>) -- Note: unknown discriminant parts are not permitted in Ada 83 mode -- There is no explicit node in the tree for an unknown discriminant -- part. Instead the Unknown_Discriminants_Present flag is set in the -- parent node. ---------------------------------- -- 3.7 Known Discriminant Part -- ---------------------------------- -- KNOWN_DISCRIMINANT_PART ::= -- (DISCRIMINANT_SPECIFICATION {; DISCRIMINANT_SPECIFICATION}) ------------------------------------- -- 3.7 Discriminant Specification -- ------------------------------------- -- DISCRIMINANT_SPECIFICATION ::= -- DEFINING_IDENTIFIER_LIST : [NULL_EXCLUSION] SUBTYPE_MARK -- [:= DEFAULT_EXPRESSION] -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION -- [:= DEFAULT_EXPRESSION] -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive specifications were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single specifications, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- N_Discriminant_Specification -- Sloc points to first identifier -- Defining_Identifier (Node1) -- Null_Exclusion_Present (Flag11) -- Discriminant_Type (Node5) subtype mark or access parameter definition -- Expression (Node3) (set to Empty if no default expression) -- More_Ids (Flag5) (set to False if no more identifiers in list) -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) ----------------------------- -- 3.7 Default Expression -- ----------------------------- -- DEFAULT_EXPRESSION ::= EXPRESSION ------------------------------------ -- 3.7.1 Discriminant Constraint -- ------------------------------------ -- DISCRIMINANT_CONSTRAINT ::= -- (DISCRIMINANT_ASSOCIATION {, DISCRIMINANT_ASSOCIATION}) -- It is not in general possible to distinguish between discriminant -- constraints and index constraints at parse time, since a simple -- name could be either the subtype mark of a discrete range, or an -- expression in a discriminant association with no name. Either -- entry appears simply as the name, and the semantic parse must -- distinguish between the two cases. Thus we use a common tree -- node format for both of these constraint types. -- N_Index_Or_Discriminant_Constraint -- Sloc points to left paren -- Constraints (List1) points to list of discrete ranges or -- discriminant associations ------------------------------------- -- 3.7.1 Discriminant Association -- ------------------------------------- -- DISCRIMINANT_ASSOCIATION ::= -- [discriminant_SELECTOR_NAME -- {| discriminant_SELECTOR_NAME} =>] EXPRESSION -- Note: a discriminant association that has no selector name list -- appears directly as an expression in the tree. -- N_Discriminant_Association -- Sloc points to first token of discriminant association -- Selector_Names (List1) (always non-empty, since if no selector -- names are present, this node is not used, see comment above) -- Expression (Node3) --------------------------------- -- 3.8 Record Type Definition -- --------------------------------- -- RECORD_TYPE_DEFINITION ::= -- [[abstract] tagged] [limited] RECORD_DEFINITION -- Note: ABSTRACT, TAGGED, LIMITED are not permitted in Ada 83 mode -- There is no explicit node in the tree for a record type definition. -- Instead the flags for Tagged_Present and Limited_Present appear in -- the N_Record_Definition node for a record definition appearing in -- the context of a record type definition. ---------------------------- -- 3.8 Record Definition -- ---------------------------- -- RECORD_DEFINITION ::= -- record -- COMPONENT_LIST -- end record -- | null record -- Note: the Abstract_Present, Tagged_Present and Limited_Present -- flags appear only for a record definition appearing in a record -- type definition. -- Note: the NULL RECORD case is not permitted in Ada 83 -- N_Record_Definition -- Sloc points to RECORD or NULL -- End_Label (Node4) (set to Empty if internally generated record) -- Abstract_Present (Flag4) -- Tagged_Present (Flag15) -- Limited_Present (Flag17) -- Component_List (Node1) empty in null record case -- Null_Present (Flag13) set in null record case -- Task_Present (Flag5) set in task interfaces -- Protected_Present (Flag6) set in protected interfaces -- Synchronized_Present (Flag7) set in interfaces -- Interface_Present (Flag16) set in abstract interfaces -- Interface_List (List2) (set to No_List if none) -- Note: Task_Present, Protected_Present, Synchronized _Present, -- Interface_List and Interface_Present are used for abstract -- interfaces (see comments for INTERFACE_TYPE_DEFINITION). ------------------------- -- 3.8 Component List -- ------------------------- -- COMPONENT_LIST ::= -- COMPONENT_ITEM {COMPONENT_ITEM} -- | {COMPONENT_ITEM} VARIANT_PART -- | null; -- N_Component_List -- Sloc points to first token of component list -- Component_Items (List3) -- Variant_Part (Node4) (set to Empty if no variant part) -- Null_Present (Flag13) ------------------------- -- 3.8 Component Item -- ------------------------- -- COMPONENT_ITEM ::= COMPONENT_DECLARATION | REPRESENTATION_CLAUSE -- Note: A component item can also be a pragma, and in the tree -- that is obtained after semantic processing, a component item -- can be an N_Null node resulting from a non-recognized pragma. -------------------------------- -- 3.8 Component Declaration -- -------------------------------- -- COMPONENT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION -- [:= DEFAULT_EXPRESSION] -- Note: although the syntax does not permit a component definition to -- be an anonymous array (and the parser will diagnose such an attempt -- with an appropriate message), it is possible for anonymous arrays -- to appear as component definitions. The semantics and back end handle -- this case properly, and the expander in fact generates such cases. -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with the -- same component definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single declarations, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- N_Component_Declaration -- Sloc points to first identifier -- Defining_Identifier (Node1) -- Component_Definition (Node4) -- Expression (Node3) (set to Empty if no default expression) -- More_Ids (Flag5) (set to False if no more identifiers in list) -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) ------------------------- -- 3.8.1 Variant Part -- ------------------------- -- VARIANT_PART ::= -- case discriminant_DIRECT_NAME is -- VARIANT -- {VARIANT} -- end case; -- Note: the variants list can contain pragmas as well as variants. -- In a properly formed program there is at least one variant. -- N_Variant_Part -- Sloc points to CASE -- Name (Node2) -- Variants (List1) -------------------- -- 3.8.1 Variant -- -------------------- -- VARIANT ::= -- when DISCRETE_CHOICE_LIST => -- COMPONENT_LIST -- N_Variant -- Sloc points to WHEN -- Discrete_Choices (List4) -- Component_List (Node1) -- Enclosing_Variant (Node2-Sem) -- Present_Expr (Uint3-Sem) -- Dcheck_Function (Node5-Sem) --------------------------------- -- 3.8.1 Discrete Choice List -- --------------------------------- -- DISCRETE_CHOICE_LIST ::= DISCRETE_CHOICE {| DISCRETE_CHOICE} ---------------------------- -- 3.8.1 Discrete Choice -- ---------------------------- -- DISCRETE_CHOICE ::= EXPRESSION | DISCRETE_RANGE | others -- Note: in Ada 83 mode, the expression must be a simple expression -- The only choice that appears explicitly is the OTHERS choice, as -- defined here. Other cases of discrete choice (expression and -- discrete range) appear directly. This production is also used -- for the OTHERS possibility of an exception choice. -- Note: in accordance with the syntax, the parser does not check that -- OTHERS appears at the end on its own in a choice list context. This -- is a semantic check. -- N_Others_Choice -- Sloc points to OTHERS -- Others_Discrete_Choices (List1-Sem) -- All_Others (Flag11-Sem) ---------------------------------- -- 3.9.1 Record Extension Part -- ---------------------------------- -- RECORD_EXTENSION_PART ::= with RECORD_DEFINITION -- Note: record extension parts are not permitted in Ada 83 mode -------------------------------------- -- 3.9.4 Interface Type Definition -- -------------------------------------- -- INTERFACE_TYPE_DEFINITION ::= -- [limited | task | protected | synchronized] -- interface [interface_list] -- Note: Interfaces are implemented with N_Record_Definition and -- N_Derived_Type_Definition nodes because most of the support -- for the analysis of abstract types has been reused to -- analyze abstract interfaces. ---------------------------------- -- 3.10 Access Type Definition -- ---------------------------------- -- ACCESS_TYPE_DEFINITION ::= -- ACCESS_TO_OBJECT_DEFINITION -- | ACCESS_TO_SUBPROGRAM_DEFINITION -------------------------- -- 3.10 Null Exclusion -- -------------------------- -- NULL_EXCLUSION ::= not null --------------------------------------- -- 3.10 Access To Object Definition -- --------------------------------------- -- ACCESS_TO_OBJECT_DEFINITION ::= -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] -- SUBTYPE_INDICATION -- N_Access_To_Object_Definition -- Sloc points to ACCESS -- All_Present (Flag15) -- Null_Exclusion_Present (Flag11) -- Subtype_Indication (Node5) -- Constant_Present (Flag17) ----------------------------------- -- 3.10 General Access Modifier -- ----------------------------------- -- GENERAL_ACCESS_MODIFIER ::= all | constant -- Note: general access modifiers are not permitted in Ada 83 mode -- There is no explicit node in the tree for general access modifier. -- Instead the All_Present or Constant_Present flags are set in the -- parent node. ------------------------------------------- -- 3.10 Access To Subprogram Definition -- ------------------------------------------- -- ACCESS_TO_SUBPROGRAM_DEFINITION -- [NULL_EXCLUSION] access [protected] procedure PARAMETER_PROFILE -- | [NULL_EXCLUSION] access [protected] function -- PARAMETER_AND_RESULT_PROFILE -- Note: access to subprograms are not permitted in Ada 83 mode -- N_Access_Function_Definition -- Sloc points to ACCESS -- Null_Exclusion_Present (Flag11) -- Protected_Present (Flag6) -- Parameter_Specifications (List3) (set to No_List if no formal part) -- Result_Definition (Node4) result subtype (subtype mark or access def) -- N_Access_Procedure_Definition -- Sloc points to ACCESS -- Null_Exclusion_Present (Flag11) -- Protected_Present (Flag6) -- Parameter_Specifications (List3) (set to No_List if no formal part) ----------------------------- -- 3.10 Access Definition -- ----------------------------- -- ACCESS_DEFINITION ::= -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] SUBTYPE_MARK -- | ACCESS_TO_SUBPROGRAM_DEFINITION -- Note: access to subprograms are an Ada 2005 (AI-254) extension -- N_Access_Definition -- Sloc points to ACCESS -- Null_Exclusion_Present (Flag11) -- All_Present (Flag15) -- Constant_Present (Flag17) -- Subtype_Mark (Node4) -- Access_To_Subprogram_Definition (Node3) (set to Empty if not present) ----------------------------------------- -- 3.10.1 Incomplete Type Declaration -- ----------------------------------------- -- INCOMPLETE_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] [IS TAGGED]; -- N_Incomplete_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier (Node1) -- Discriminant_Specifications (List4) (set to No_List if no -- discriminant part, or if the discriminant part is an -- unknown discriminant part) -- Unknown_Discriminants_Present (Flag13) set if (<>) discriminant -- Tagged_Present (Flag15) ---------------------------- -- 3.11 Declarative Part -- ---------------------------- -- DECLARATIVE_PART ::= {DECLARATIVE_ITEM} -- Note: although the parser enforces the syntactic requirement that -- a declarative part can contain only declarations, the semantic -- processing may add statements to the list of actions in a -- declarative part, so the code generator should be prepared -- to accept a statement in this position. ---------------------------- -- 3.11 Declarative Item -- ---------------------------- -- DECLARATIVE_ITEM ::= BASIC_DECLARATIVE_ITEM | BODY ---------------------------------- -- 3.11 Basic Declarative Item -- ---------------------------------- -- BASIC_DECLARATIVE_ITEM ::= -- BASIC_DECLARATION | REPRESENTATION_CLAUSE | USE_CLAUSE ---------------- -- 3.11 Body -- ---------------- -- BODY ::= PROPER_BODY | BODY_STUB ----------------------- -- 3.11 Proper Body -- ----------------------- -- PROPER_BODY ::= -- SUBPROGRAM_BODY | PACKAGE_BODY | TASK_BODY | PROTECTED_BODY --------------- -- 4.1 Name -- --------------- -- NAME ::= -- DIRECT_NAME | EXPLICIT_DEREFERENCE -- | INDEXED_COMPONENT | SLICE -- | SELECTED_COMPONENT | ATTRIBUTE_REFERENCE -- | TYPE_CONVERSION | FUNCTION_CALL -- | CHARACTER_LITERAL ---------------------- -- 4.1 Direct Name -- ---------------------- -- DIRECT_NAME ::= IDENTIFIER | OPERATOR_SYMBOL ----------------- -- 4.1 Prefix -- ----------------- -- PREFIX ::= NAME | IMPLICIT_DEREFERENCE ------------------------------- -- 4.1 Explicit Dereference -- ------------------------------- -- EXPLICIT_DEREFERENCE ::= NAME . all -- N_Explicit_Dereference -- Sloc points to ALL -- Prefix (Node3) -- Actual_Designated_Subtype (Node2-Sem) -- plus fields for expression ------------------------------- -- 4.1 Implicit Dereference -- ------------------------------- -- IMPLICIT_DEREFERENCE ::= NAME ------------------------------ -- 4.1.1 Indexed Component -- ------------------------------ -- INDEXED_COMPONENT ::= PREFIX (EXPRESSION {, EXPRESSION}) -- Note: the parser may generate this node in some situations where it -- should be a function call. The semantic pass must correct this -- misidentification (which is inevitable at the parser level). -- N_Indexed_Component -- Sloc contains a copy of the Sloc value of the Prefix -- Prefix (Node3) -- Expressions (List1) -- plus fields for expression -- Note: if any of the subscripts requires a range check, then the -- Do_Range_Check flag is set on the corresponding expression, with -- the index type being determined from the type of the Prefix, which -- references the array being indexed. -- Note: in a fully analyzed and expanded indexed component node, and -- hence in any such node that gigi sees, if the prefix is an access -- type, then an explicit dereference operation has been inserted. ------------------ -- 4.1.2 Slice -- ------------------ -- SLICE ::= PREFIX (DISCRETE_RANGE) -- Note: an implicit subtype is created to describe the resulting -- type, so that the bounds of this type are the bounds of the slice. -- N_Slice -- Sloc points to first token of prefix -- Prefix (Node3) -- Discrete_Range (Node4) -- plus fields for expression ------------------------------- -- 4.1.3 Selected Component -- ------------------------------- -- SELECTED_COMPONENT ::= PREFIX . SELECTOR_NAME -- Note: selected components that are semantically expanded names get -- changed during semantic processing into the separate N_Expanded_Name -- node. See description of this node in the section on semantic nodes. -- N_Selected_Component -- Sloc points to period -- Prefix (Node3) -- Selector_Name (Node2) -- Associated_Node (Node4-Sem) -- Do_Discriminant_Check (Flag13-Sem) -- Is_In_Discriminant_Check (Flag11-Sem) -- plus fields for expression -------------------------- -- 4.1.3 Selector Name -- -------------------------- -- SELECTOR_NAME ::= IDENTIFIER | CHARACTER_LITERAL | OPERATOR_SYMBOL -------------------------------- -- 4.1.4 Attribute Reference -- -------------------------------- -- ATTRIBUTE_REFERENCE ::= PREFIX ' ATTRIBUTE_DESIGNATOR -- Note: the syntax is quite ambiguous at this point. Consider: -- A'Length (X) X is part of the attribute designator -- A'Pos (X) X is an explicit actual parameter of function A'Pos -- A'Class (X) X is the expression of a type conversion -- It would be possible for the parser to distinguish these cases -- by looking at the attribute identifier. However, that would mean -- more work in introducing new implementation defined attributes, -- and also it would mean that special processing for attributes -- would be scattered around, instead of being centralized in the -- semantic routine that handles an N_Attribute_Reference node. -- Consequently, the parser in all the above cases stores the -- expression (X in these examples) as a single element list in -- in the Expressions field of the N_Attribute_Reference node. -- Similarly, for attributes like Max which take two arguments, -- we store the two arguments as a two element list in the -- Expressions field. Of course it is clear at parse time that -- this case is really a function call with an attribute as the -- prefix, but it turns out to be convenient to handle the two -- argument case in a similar manner to the one argument case, -- and indeed in general the parser will accept any number of -- expressions in this position and store them as a list in the -- attribute reference node. This allows for future addition of -- attributes that take more than two arguments. -- Note: named associates are not permitted in function calls where -- the function is an attribute (see RM 6.4(3)) so it is legitimate -- to skip the normal subprogram argument processing. -- Note: for the attributes whose designators are technically keywords, -- i.e. digits, access, delta, range, the Attribute_Name field contains -- the corresponding name, even though no identifier is involved. -- Note: the generated code may contain stream attributes applied to -- limited types for which no stream routines exist officially. In such -- case, the result is to use the stream attribute for the underlying -- full type, or in the case of a protected type, the components -- (including any disriminants) are merely streamed in order. -- See Exp_Attr for a complete description of which attributes are -- passed onto Gigi, and which are handled entirely by the front end. -- Gigi restriction: For the Pos attribute, the prefix cannot be -- a non-standard enumeration type or a nonzero/zero semantics -- boolean type, so the value is simply the stored representation. -- Gigi requirement: For the Mechanism_Code attribute, if the prefix -- references a subprogram that is a renaming, then the front end must -- rewrite the attribute to refer directly to the renamed entity. -- Note: In generated code, the Address and Unrestricted_Access -- attributes can be applied to any expression, and the meaning is -- to create an object containing the value (the object is in the -- current stack frame), and pass the address of this value. If the -- Must_Be_Byte_Aligned flag is set, then the object whose address -- is taken must be on a byte (storage unit) boundary, and if it is -- not (or may not be), then the generated code must create a copy -- that is byte aligned, and pass the address of this copy. -- N_Attribute_Reference -- Sloc points to apostrophe -- Prefix (Node3) -- Attribute_Name (Name2) identifier name from attribute designator -- Expressions (List1) (set to No_List if no associated expressions) -- Entity (Node4-Sem) used if the attribute yields a type -- Associated_Node (Node4-Sem) -- Do_Overflow_Check (Flag17-Sem) -- Redundant_Use (Flag13-Sem) -- Must_Be_Byte_Aligned (Flag14) -- plus fields for expression --------------------------------- -- 4.1.4 Attribute Designator -- --------------------------------- -- ATTRIBUTE_DESIGNATOR ::= -- IDENTIFIER [(static_EXPRESSION)] -- | access | delta | digits -- There is no explicit node in the tree for an attribute designator. -- Instead the Attribute_Name and Expressions fields of the parent -- node (N_Attribute_Reference node) hold the information. -- Note: if ACCESS, DELTA or DIGITS appears in an attribute -- designator, then they are treated as identifiers internally -- rather than the keywords of the same name. -------------------------------------- -- 4.1.4 Range Attribute Reference -- -------------------------------------- -- RANGE_ATTRIBUTE_REFERENCE ::= PREFIX ' RANGE_ATTRIBUTE_DESIGNATOR -- A range attribute reference is represented in the tree using the -- normal N_Attribute_Reference node. --------------------------------------- -- 4.1.4 Range Attribute Designator -- --------------------------------------- -- RANGE_ATTRIBUTE_DESIGNATOR ::= Range [(static_EXPRESSION)] -- A range attribute designator is represented in the tree using the -- normal N_Attribute_Reference node. -------------------- -- 4.3 Aggregate -- -------------------- -- AGGREGATE ::= -- RECORD_AGGREGATE | EXTENSION_AGGREGATE | ARRAY_AGGREGATE ----------------------------- -- 4.3.1 Record Aggregate -- ----------------------------- -- RECORD_AGGREGATE ::= (RECORD_COMPONENT_ASSOCIATION_LIST) -- N_Aggregate -- Sloc points to left parenthesis -- Expressions (List1) (set to No_List if none or null record case) -- Component_Associations (List2) (set to No_List if none) -- Null_Record_Present (Flag17) -- Aggregate_Bounds (Node3-Sem) -- Associated_Node (Node4-Sem) -- Static_Processing_OK (Flag4-Sem) -- Compile_Time_Known_Aggregate (Flag18-Sem) -- Expansion_Delayed (Flag11-Sem) -- plus fields for expression -- Note: this structure is used for both record and array aggregates -- since the two cases are not separable by the parser. The parser -- makes no attempt to enforce consistency here, so it is up to the -- semantic phase to make sure that the aggregate is consistent (i.e. -- that it is not a "half-and-half" case that mixes record and array -- syntax. In particular, for a record aggregate, the expressions -- field will be set if there are positional associations. -- Note: gigi/gcc can handle array aggregates correctly providing that -- they are entirely positional, and the array subtype involved has a -- known at compile time length and is not bit packed, or a convention -- Fortran array with more than one dimension. If these conditions -- are not met, then the front end must translate the aggregate into -- an appropriate set of assignments into a temporary. -- Note: for the record aggregate case, gigi/gcc can handle all cases -- of record aggregates, including those for packed, and rep-claused -- records, and also variant records, providing that there are no -- variable length fields whose size is not known at runtime, and -- providing that the aggregate is presented in fully named form. ---------------------------------------------- -- 4.3.1 Record Component Association List -- ---------------------------------------------- -- RECORD_COMPONENT_ASSOCIATION_LIST ::= -- RECORD_COMPONENT_ASSOCIATION {, RECORD_COMPONENT_ASSOCIATION} -- | null record -- There is no explicit node in the tree for a record component -- association list. Instead the Null_Record_Present flag is set in -- the parent node for the NULL RECORD case. ------------------------------------------------------ -- 4.3.1 Record Component Association (also 4.3.3) -- ------------------------------------------------------ -- RECORD_COMPONENT_ASSOCIATION ::= -- [COMPONENT_CHOICE_LIST =>] EXPRESSION -- N_Component_Association -- Sloc points to first selector name -- Choices (List1) -- Loop_Actions (List2-Sem) -- Expression (Node3) -- Box_Present (Flag15) -- Note: this structure is used for both record component associations -- and array component associations, since the two cases aren't always -- separable by the parser. The choices list may represent either a -- list of selector names in the record aggregate case, or a list of -- discrete choices in the array aggregate case or an N_Others_Choice -- node (which appears as a singleton list). Box_Present gives support -- to Ada 2005 (AI-287). ----------------------------------- -- 4.3.1 Commponent Choice List -- ----------------------------------- -- COMPONENT_CHOICE_LIST ::= -- component_SELECTOR_NAME {| component_SELECTOR_NAME} -- | others -- The entries of a component choice list appear in the Choices list -- of the associated N_Component_Association, as either selector -- names, or as an N_Others_Choice node. -------------------------------- -- 4.3.2 Extension Aggregate -- -------------------------------- -- EXTENSION_AGGREGATE ::= -- (ANCESTOR_PART with RECORD_COMPONENT_ASSOCIATION_LIST) -- Note: extension aggregates are not permitted in Ada 83 mode -- N_Extension_Aggregate -- Sloc points to left parenthesis -- Ancestor_Part (Node3) -- Associated_Node (Node4-Sem) -- Expressions (List1) (set to No_List if none or null record case) -- Component_Associations (List2) (set to No_List if none) -- Null_Record_Present (Flag17) -- Expansion_Delayed (Flag11-Sem) -- plus fields for expression -------------------------- -- 4.3.2 Ancestor Part -- -------------------------- -- ANCESTOR_PART ::= EXPRESSION | SUBTYPE_MARK ---------------------------- -- 4.3.3 Array Aggregate -- ---------------------------- -- ARRAY_AGGREGATE ::= -- POSITIONAL_ARRAY_AGGREGATE | NAMED_ARRAY_AGGREGATE --------------------------------------- -- 4.3.3 Positional Array Aggregate -- --------------------------------------- -- POSITIONAL_ARRAY_AGGREGATE ::= -- (EXPRESSION, EXPRESSION {, EXPRESSION}) -- | (EXPRESSION {, EXPRESSION}, others => EXPRESSION) -- See Record_Aggregate (4.3.1) for node structure ---------------------------------- -- 4.3.3 Named Array Aggregate -- ---------------------------------- -- NAMED_ARRAY_AGGREGATE ::= -- | (ARRAY_COMPONENT_ASSOCIATION {, ARRAY_COMPONENT_ASSOCIATION}) -- See Record_Aggregate (4.3.1) for node structure ---------------------------------------- -- 4.3.3 Array Component Association -- ---------------------------------------- -- ARRAY_COMPONENT_ASSOCIATION ::= -- DISCRETE_CHOICE_LIST => EXPRESSION -- See Record_Component_Association (4.3.1) for node structure -------------------------------------------------- -- 4.4 Expression/Relation/Term/Factor/Primary -- -------------------------------------------------- -- EXPRESSION ::= -- RELATION {and RELATION} | RELATION {and then RELATION} -- | RELATION {or RELATION} | RELATION {or else RELATION} -- | RELATION {xor RELATION} -- RELATION ::= -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION] -- | SIMPLE_EXPRESSION [not] in RANGE -- | SIMPLE_EXPRESSION [not] in SUBTYPE_MARK -- SIMPLE_EXPRESSION ::= -- [UNARY_ADDING_OPERATOR] TERM {BINARY_ADDING_OPERATOR TERM} -- TERM ::= FACTOR {MULTIPLYING_OPERATOR FACTOR} -- FACTOR ::= PRIMARY [** PRIMARY] | abs PRIMARY | not PRIMARY -- No nodes are generated for any of these constructs. Instead, the -- node for the operator appears directly. When we refer to an -- expression in this description, we mean any of the possible -- consistuent components of an expression (e.g. identifier is -- an example of an expression). ------------------ -- 4.4 Primary -- ------------------ -- PRIMARY ::= -- NUMERIC_LITERAL | null -- | STRING_LITERAL | AGGREGATE -- | NAME | QUALIFIED_EXPRESSION -- | ALLOCATOR | (EXPRESSION) -- Usually there is no explicit node in the tree for primary. Instead -- the constituent (e.g. AGGREGATE) appears directly. There are two -- exceptions. First, there is an explicit node for a null primary. -- N_Null -- Sloc points to NULL -- plus fields for expression -- Second, the case of (EXPRESSION) is handled specially. Ada requires -- that the parser keep track of which subexpressions are enclosed -- in parentheses, and how many levels of parentheses are used. This -- information is required for optimization purposes, and also for -- some semantic checks (e.g. (((1))) in a procedure spec does not -- conform with ((((1)))) in the body). -- The parentheses are recorded by keeping a Paren_Count field in every -- subexpression node (it is actually present in all nodes, but only -- used in subexpression nodes). This count records the number of -- levels of parentheses. If the number of levels in the source exceeds -- the maximum accomodated by this count, then the count is simply left -- at the maximum value. This means that there are some pathalogical -- cases of failure to detect conformance failures (e.g. an expression -- with 500 levels of parens will conform with one with 501 levels), -- but we do not need to lose sleep over this. -- Historical note: in versions of GNAT prior to 1.75, there was a node -- type N_Parenthesized_Expression used to accurately record unlimited -- numbers of levels of parentheses. However, it turned out to be a -- real nuisance to have to take into account the possible presence of -- this node during semantic analysis, since basically parentheses have -- zero relevance to semantic analysis. -- Note: the level of parentheses always present in things like -- aggregates does not count, only the parentheses in the primary -- (EXPRESSION) affect the setting of the Paren_Count field. -- 2nd Note: the contents of the Expression field must be ignored (i.e. -- treated as though it were Empty) if No_Initialization is set True. -------------------------------------- -- 4.5 Short Circuit Control Forms -- -------------------------------------- -- EXPRESSION ::= -- RELATION {and then RELATION} | RELATION {or else RELATION} -- Gigi restriction: For both these control forms, the operand and -- result types are always Standard.Boolean. The expander inserts the -- required conversion operations where needed to ensure this is the -- case. -- N_And_Then -- Sloc points to AND of AND THEN -- Left_Opnd (Node2) -- Right_Opnd (Node3) -- Actions (List1-Sem) -- plus fields for expression -- N_Or_Else -- Sloc points to OR of OR ELSE -- Left_Opnd (Node2) -- Right_Opnd (Node3) -- Actions (List1-Sem) -- plus fields for expression -- Note: The Actions field is used to hold actions associated with -- the right hand operand. These have to be treated specially since -- they are not unconditionally executed. See Insert_Actions for a -- more detailed description of how these actions are handled. --------------------------- -- 4.5 Membership Tests -- --------------------------- -- RELATION ::= -- SIMPLE_EXPRESSION [not] in RANGE -- | SIMPLE_EXPRESSION [not] in SUBTYPE_MARK -- Note: although the grammar above allows only a range or a -- subtype mark, the parser in fact will accept any simple -- expression in place of a subtype mark. This means that the -- semantic analyzer must be prepared to deal with, and diagnose -- a simple expression other than a name for the right operand. -- This simplifies error recovery in the parser. -- N_In -- Sloc points to IN -- Left_Opnd (Node2) -- Right_Opnd (Node3) -- plus fields for expression -- N_Not_In -- Sloc points to NOT of NOT IN -- Left_Opnd (Node2) -- Right_Opnd (Node3) -- plus fields for expression -------------------- -- 4.5 Operators -- -------------------- -- LOGICAL_OPERATOR ::= and | or | xor -- RELATIONAL_OPERATOR ::= = | /= | < | <= | > | >= -- BINARY_ADDING_OPERATOR ::= + | - | & -- UNARY_ADDING_OPERATOR ::= + | - -- MULTIPLYING_OPERATOR ::= * | / | mod | rem -- HIGHEST_PRECEDENCE_OPERATOR ::= ** | abs | not -- Sprint syntax if Treat_Fixed_As_Integer is set: -- x #* y -- x #/ y -- x #mod y -- x #rem y -- Gigi restriction: For * / mod rem with fixed-point operands, Gigi -- will only be given nodes with the Treat_Fixed_As_Integer flag set. -- All handling of smalls for multiplication and division is handled -- by the front end (mod and rem result only from expansion). Gigi -- thus never needs to worry about small values (for other operators -- operating on fixed-point, e.g. addition, the small value does not -- have any semantic effect anyway, these are always integer operations. -- Gigi restriction: For all operators taking Boolean operands, the -- type is always Standard.Boolean. The expander inserts the required -- conversion operations where needed to ensure this is the case. -- N_Op_And -- Sloc points to AND -- Do_Length_Check (Flag4-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Or -- Sloc points to OR -- Do_Length_Check (Flag4-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Xor -- Sloc points to XOR -- Do_Length_Check (Flag4-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Eq -- Sloc points to = -- plus fields for binary operator -- plus fields for expression -- N_Op_Ne -- Sloc points to /= -- plus fields for binary operator -- plus fields for expression -- N_Op_Lt -- Sloc points to < -- plus fields for binary operator -- plus fields for expression -- N_Op_Le -- Sloc points to <= -- plus fields for binary operator -- plus fields for expression -- N_Op_Gt -- Sloc points to > -- plus fields for binary operator -- plus fields for expression -- N_Op_Ge -- Sloc points to >= -- plus fields for binary operator -- plus fields for expression -- N_Op_Add -- Sloc points to + (binary) -- plus fields for binary operator -- plus fields for expression -- N_Op_Subtract -- Sloc points to - (binary) -- plus fields for binary operator -- plus fields for expression -- N_Op_Concat -- Sloc points to & -- Is_Component_Left_Opnd (Flag13-Sem) -- Is_Component_Right_Opnd (Flag14-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Multiply -- Sloc points to * -- Treat_Fixed_As_Integer (Flag14-Sem) -- Rounded_Result (Flag18-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Divide -- Sloc points to / -- Treat_Fixed_As_Integer (Flag14-Sem) -- Do_Division_Check (Flag13-Sem) -- Rounded_Result (Flag18-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Mod -- Sloc points to MOD -- Treat_Fixed_As_Integer (Flag14-Sem) -- Do_Division_Check (Flag13-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Rem -- Sloc points to REM -- Treat_Fixed_As_Integer (Flag14-Sem) -- Do_Division_Check (Flag13-Sem) -- plus fields for binary operator -- plus fields for expression -- N_Op_Expon -- Is_Power_Of_2_For_Shift (Flag13-Sem) -- Sloc points to ** -- plus fields for binary operator -- plus fields for expression -- N_Op_Plus -- Sloc points to + (unary) -- plus fields for unary operator -- plus fields for expression -- N_Op_Minus -- Sloc points to - (unary) -- plus fields for unary operator -- plus fields for expression -- N_Op_Abs -- Sloc points to ABS -- plus fields for unary operator -- plus fields for expression -- N_Op_Not -- Sloc points to NOT -- plus fields for unary operator -- plus fields for expression -- See also shift operators in section B.2 -- Note on fixed-point operations passed to Gigi: For adding operators, -- the semantics is to treat these simply as integer operations, with -- the small values being ignored (the bounds are already stored in -- units of small, so that constraint checking works as usual). For the -- case of multiply/divide/rem/mod operations, Gigi will only see fixed -- point operands if the Treat_Fixed_As_Integer flag is set and will -- thus treat these nodes in identical manner, ignoring small values. -------------------------- -- 4.6 Type Conversion -- -------------------------- -- TYPE_CONVERSION ::= -- SUBTYPE_MARK (EXPRESSION) | SUBTYPE_MARK (NAME) -- In the (NAME) case, the name is stored as the expression -- Note: the parser never generates a type conversion node, since it -- looks like an indexed component which is generated by preference. -- The semantic pass must correct this misidentification. -- Gigi handles conversions that involve no change in the root type, -- and also all conversions from integer to floating-point types. -- Conversions from floating-point to integer are only handled in -- the case where Float_Truncate flag set. Other conversions from -- floating-point to integer (involving rounding) and all conversions -- involving fixed-point types are handled by the expander. -- Sprint syntax if Float_Truncate set: X^(Y) -- Sprint syntax if Conversion_OK set X?(Y) -- Sprint syntax if both flags set X?^(Y) -- Note: If either the operand or result type is fixed-point, Gigi will -- only see a type conversion node with Conversion_OK set. The front end -- takes care of all handling of small's for fixed-point conversions. -- N_Type_Conversion -- Sloc points to first token of subtype mark -- Subtype_Mark (Node4) -- Expression (Node3) -- Do_Tag_Check (Flag13-Sem) -- Do_Length_Check (Flag4-Sem) -- Do_Overflow_Check (Flag17-Sem) -- Float_Truncate (Flag11-Sem) -- Rounded_Result (Flag18-Sem) -- Conversion_OK (Flag14-Sem) -- plus fields for expression -- Note: if a range check is required, then the Do_Range_Check flag -- is set in the Expression with the check being done against the -- target type range (after the base type conversion, if any). ------------------------------- -- 4.7 Qualified Expression -- ------------------------------- -- QUALIFIED_EXPRESSION ::= -- SUBTYPE_MARK ' (EXPRESSION) | SUBTYPE_MARK ' AGGREGATE -- Note: the parentheses in the (EXPRESSION) case are deemed to enclose -- the expression, so the Expression field of this node always points -- to a parenthesized expression in this case (i.e. Paren_Count will -- always be non-zero for the referenced expression if it is not an -- aggregate). -- N_Qualified_Expression -- Sloc points to apostrophe -- Subtype_Mark (Node4) -- Expression (Node3) expression or aggregate -- plus fields for expression -------------------- -- 4.8 Allocator -- -------------------- -- ALLOCATOR ::= -- new [NULL_EXCLUSION] SUBTYPE_INDICATION | new QUALIFIED_EXPRESSION -- Sprint syntax (when storage pool present) -- new xxx (storage_pool = pool) -- N_Allocator -- Sloc points to NEW -- Expression (Node3) subtype indication or qualified expression -- Null_Exclusion_Present (Flag11) -- Storage_Pool (Node1-Sem) -- Procedure_To_Call (Node4-Sem) -- No_Initialization (Flag13-Sem) -- Do_Storage_Check (Flag17-Sem) -- plus fields for expression --------------------------------- -- 5.1 Sequence Of Statements -- --------------------------------- -- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT} -- Note: Although the parser will not accept a declaration as a -- statement, the semantic analyzer may insert declarations (e.g. -- declarations of implicit types needed for execution of other -- statements) into a sequence of statements, so the code genmerator -- should be prepared to accept a declaration where a statement is -- expected. Note also that pragmas can appear as statements. -------------------- -- 5.1 Statement -- -------------------- -- STATEMENT ::= -- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT -- There is no explicit node in the tree for a statement. Instead, the -- individual statement appears directly. Labels are treated as a -- kind of statement, i.e. they are linked into a statement list at -- the point they appear, so the labeled statement appears following -- the label or labels in the statement list. --------------------------- -- 5.1 Simple Statement -- --------------------------- -- SIMPLE_STATEMENT ::= NULL_STATEMENT -- | ASSIGNMENT_STATEMENT | EXIT_STATEMENT -- | GOTO_STATEMENT | PROCEDURE_CALL_STATEMENT -- | RETURN_STATEMENT | ENTRY_CALL_STATEMENT -- | REQUEUE_STATEMENT | DELAY_STATEMENT -- | ABORT_STATEMENT | RAISE_STATEMENT -- | CODE_STATEMENT ----------------------------- -- 5.1 Compound Statement -- ----------------------------- -- COMPOUND_STATEMENT ::= -- IF_STATEMENT | CASE_STATEMENT -- | LOOP_STATEMENT | BLOCK_STATEMENT -- | ACCEPT_STATEMENT | SELECT_STATEMENT ------------------------- -- 5.1 Null Statement -- ------------------------- -- NULL_STATEMENT ::= null; -- N_Null_Statement -- Sloc points to NULL ---------------- -- 5.1 Label -- ---------------- -- LABEL ::= <<label_STATEMENT_IDENTIFIER>> -- Note that the occurrence of a label is not a defining identifier, -- but rather a referencing occurrence. The defining occurrence is -- in the implicit label declaration which occurs in the innermost -- enclosing block. -- N_Label -- Sloc points to << -- Identifier (Node1) direct name of statement identifier -- Exception_Junk (Flag7-Sem) ------------------------------- -- 5.1 Statement Identifier -- ------------------------------- -- STATEMENT_INDENTIFIER ::= DIRECT_NAME -- The IDENTIFIER of a STATEMENT_IDENTIFIER shall be an identifier -- (not an OPERATOR_SYMBOL) ------------------------------- -- 5.2 Assignment Statement -- ------------------------------- -- ASSIGNMENT_STATEMENT ::= -- variable_NAME := EXPRESSION; -- N_Assignment_Statement -- Sloc points to := -- Name (Node2) -- Expression (Node3) -- Do_Tag_Check (Flag13-Sem) -- Do_Length_Check (Flag4-Sem) -- Forwards_OK (Flag5-Sem) -- Backwards_OK (Flag6-Sem) -- No_Ctrl_Actions (Flag7-Sem) -- Note: if a range check is required, then the Do_Range_Check flag -- is set in the Expression (right hand side), with the check being -- done against the type of the Name (left hand side). -- Note: the back end places some restrictions on the form of the -- Expression field. If the object being assigned to is Atomic, then -- the Expression may not have the form of an aggregate (since this -- might cause the back end to generate separate assignments). It -- also cannot be a reference to an object marked as a true constant -- (Is_True_Constant flag set), where the object is itself initalized -- with an aggregate. If necessary the front end must generate an -- extra temporary (with Is_True_Constant set False), and initialize -- this temporary as required (the temporary itself is not atomic). ----------------------- -- 5.3 If Statement -- ----------------------- -- IF_STATEMENT ::= -- if CONDITION then -- SEQUENCE_OF_STATEMENTS -- {elsif CONDITION then -- SEQUENCE_OF_STATEMENTS} -- [else -- SEQUENCE_OF_STATEMENTS] -- end if; -- Gigi restriction: This expander ensures that the type of the -- Condition fields is always Standard.Boolean, even if the type -- in the source is some non-standard boolean type. -- N_If_Statement -- Sloc points to IF -- Condition (Node1) -- Then_Statements (List2) -- Elsif_Parts (List3) (set to No_List if none present) -- Else_Statements (List4) (set to No_List if no else part present) -- End_Span (Uint5) (set to No_Uint if expander generated) -- N_Elsif_Part -- Sloc points to ELSIF -- Condition (Node1) -- Then_Statements (List2) -- Condition_Actions (List3-Sem) -------------------- -- 5.3 Condition -- -------------------- -- CONDITION ::= boolean_EXPRESSION ------------------------- -- 5.4 Case Statement -- ------------------------- -- CASE_STATEMENT ::= -- case EXPRESSION is -- CASE_STATEMENT_ALTERNATIVE -- {CASE_STATEMENT_ALTERNATIVE} -- end case; -- Note: the Alternatives can contain pragmas. These only occur at -- the start of the list, since any pragmas occurring after the first -- alternative are absorbed into the corresponding statement sequence. -- N_Case_Statement -- Sloc points to CASE -- Expression (Node3) -- Alternatives (List4) -- End_Span (Uint5) (set to No_Uint if expander generated) ------------------------------------- -- 5.4 Case Statement Alternative -- ------------------------------------- -- CASE_STATEMENT_ALTERNATIVE ::= -- when DISCRETE_CHOICE_LIST => -- SEQUENCE_OF_STATEMENTS -- N_Case_Statement_Alternative -- Sloc points to WHEN -- Discrete_Choices (List4) -- Statements (List3) ------------------------- -- 5.5 Loop Statement -- ------------------------- -- LOOP_STATEMENT ::= -- [loop_STATEMENT_IDENTIFIER :] -- [ITERATION_SCHEME] loop -- SEQUENCE_OF_STATEMENTS -- end loop [loop_IDENTIFIER]; -- Note: The occurrence of a loop label is not a defining identifier -- but rather a referencing occurrence. The defining occurrence is in -- the implicit label declaration which occurs in the innermost -- enclosing block. -- Note: there is always a loop statement identifier present in -- the tree, even if none was given in the source. In the case where -- no loop identifier is given in the source, the parser creates -- a name of the form _Loop_n, where n is a decimal integer (the -- two underlines ensure that the loop names created in this manner -- do not conflict with any user defined identifiers), and the flag -- Has_Created_Identifier is set to True. The only exception to the -- rule that all loop statement nodes have identifiers occurs for -- loops constructed by the expander, and the semantic analyzer will -- create and supply dummy loop identifiers in these cases. -- N_Loop_Statement -- Sloc points to LOOP -- Identifier (Node1) loop identifier (set to Empty if no identifier) -- Iteration_Scheme (Node2) (set to Empty if no iteration scheme) -- Statements (List3) -- End_Label (Node4) -- Has_Created_Identifier (Flag15) -- Is_Null_Loop (Flag16) -------------------------- -- 5.5 Iteration Scheme -- -------------------------- -- ITERATION_SCHEME ::= -- while CONDITION | for LOOP_PARAMETER_SPECIFICATION -- Gigi restriction: This expander ensures that the type of the -- Condition field is always Standard.Boolean, even if the type -- in the source is some non-standard boolean type. -- N_Iteration_Scheme -- Sloc points to WHILE or FOR -- Condition (Node1) (set to Empty if FOR case) -- Condition_Actions (List3-Sem) -- Loop_Parameter_Specification (Node4) (set to Empty if WHILE case) --------------------------------------- -- 5.5 Loop parameter specification -- --------------------------------------- -- LOOP_PARAMETER_SPECIFICATION ::= -- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION -- N_Loop_Parameter_Specification -- Sloc points to first identifier -- Defining_Identifier (Node1) -- Reverse_Present (Flag15) -- Discrete_Subtype_Definition (Node4) -------------------------- -- 5.6 Block Statement -- -------------------------- -- BLOCK_STATEMENT ::= -- [block_STATEMENT_IDENTIFIER:] -- [declare -- DECLARATIVE_PART] -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [block_IDENTIFIER]; -- Note that the occurrence of a block identifier is not a defining -- identifier, but rather a referencing occurrence. The defining -- occurrence is in the implicit label declaration which occurs in -- the innermost enclosing block. -- Note: there is always a block statement identifier present in -- the tree, even if none was given in the source. In the case where -- no block identifier is given in the source, the parser creates -- a name of the form _Block_n, where n is a decimal integer (the -- two underlines ensure that the block names created in this manner -- do not conflict with any user defined identifiers), and the flag -- Has_Created_Identifier is set to True. The only exception to the -- rule that all loop statement nodes have identifiers occurs for -- blocks constructed by the expander, and the semantic analyzer -- creates and supplies dummy names for the blocks). -- N_Block_Statement -- Sloc points to DECLARE or BEGIN -- Identifier (Node1) block direct name (set to Empty if not present) -- Declarations (List2) (set to No_List if no DECLARE part) -- Handled_Statement_Sequence (Node4) -- Is_Task_Master (Flag5-Sem) -- Activation_Chain_Entity (Node3-Sem) -- Has_Created_Identifier (Flag15) -- Is_Task_Allocation_Block (Flag6) -- Is_Asynchronous_Call_Block (Flag7) ------------------------- -- 5.7 Exit Statement -- ------------------------- -- EXIT_STATEMENT ::= exit [loop_NAME] [when CONDITION]; -- Gigi restriction: This expander ensures that the type of the -- Condition field is always Standard.Boolean, even if the type -- in the source is some non-standard boolean type. -- N_Exit_Statement -- Sloc points to EXIT -- Name (Node2) (set to Empty if no loop name present) -- Condition (Node1) (set to Empty if no when part present) ------------------------- -- 5.9 Goto Statement -- ------------------------- -- GOTO_STATEMENT ::= goto label_NAME; -- N_Goto_Statement -- Sloc points to GOTO -- Name (Node2) -- Exception_Junk (Flag7-Sem) --------------------------------- -- 6.1 Subprogram Declaration -- --------------------------------- -- SUBPROGRAM_DECLARATION ::= SUBPROGRAM_SPECIFICATION; -- N_Subprogram_Declaration -- Sloc points to FUNCTION or PROCEDURE -- Specification (Node1) -- Body_To_Inline (Node3-Sem) -- Corresponding_Body (Node5-Sem) -- Parent_Spec (Node4-Sem) ------------------------------------------ -- 6.1 Abstract Subprogram Declaration -- ------------------------------------------ -- ABSTRACT_SUBPROGRAM_DECLARATION ::= -- SUBPROGRAM_SPECIFICATION is abstract; -- N_Abstract_Subprogram_Declaration -- Sloc points to ABSTRACT -- Specification (Node1) ----------------------------------- -- 6.1 Subprogram Specification -- ----------------------------------- -- SUBPROGRAM_SPECIFICATION ::= -- [[not] overriding] -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE -- | [[not] overriding] -- function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE -- Note: there are no separate nodes for the profiles, instead the -- information appears directly in the following nodes. -- N_Function_Specification -- Sloc points to FUNCTION -- Defining_Unit_Name (Node1) (the designator) -- Elaboration_Boolean (Node2-Sem) -- Parameter_Specifications (List3) (set to No_List if no formal part) -- Null_Exclusion_Present (Flag11) -- Result_Definition (Node4) for result subtype -- Generic_Parent (Node5-Sem) -- Must_Override (Flag14) set if overriding indicator present -- Must_Not_Override (Flag15) set if not_overriding indicator present -- N_Procedure_Specification -- Sloc points to PROCEDURE -- Defining_Unit_Name (Node1) -- Elaboration_Boolean (Node2-Sem) -- Parameter_Specifications (List3) (set to No_List if no formal part) -- Generic_Parent (Node5-Sem) -- Null_Present (Flag13) set for null procedure case (Ada 2005 feature) -- Must_Override (Flag14) set if overriding indicator present -- Must_Not_Override (Flag15) set if not_overriding indicator present -- Note: overriding indicator is an Ada 2005 feature --------------------- -- 6.1 Designator -- --------------------- -- DESIGNATOR ::= -- [PARENT_UNIT_NAME .] IDENTIFIER | OPERATOR_SYMBOL -- Designators that are simply identifiers or operator symbols appear -- directly in the tree in this form. The following node is used only -- in the case where the designator has a parent unit name component. -- N_Designator -- Sloc points to period -- Name (Node2) holds the parent unit name. Note that this is always -- non-Empty, since this node is only used for the case where a -- parent library unit package name is present. -- Identifier (Node1) -- Note that the identifier can also be an operator symbol here ------------------------------ -- 6.1 Defining Designator -- ------------------------------ -- DEFINING_DESIGNATOR ::= -- DEFINING_PROGRAM_UNIT_NAME | DEFINING_OPERATOR_SYMBOL ------------------------------------- -- 6.1 Defining Program Unit Name -- ------------------------------------- -- DEFINING_PROGRAM_UNIT_NAME ::= -- [PARENT_UNIT_NAME .] DEFINING_IDENTIFIER -- The parent unit name is present only in the case of a child unit -- name (permissible only for Ada 95 for a library level unit, i.e. -- a unit at scope level one). If no such name is present, the defining -- program unit name is represented simply as the defining identifier. -- In the child unit case, the following node is used to represent the -- child unit name. -- N_Defining_Program_Unit_Name -- Sloc points to period -- Name (Node2) holds the parent unit name. Note that this is always -- non-Empty, since this node is only used for the case where a -- parent unit name is present. -- Defining_Identifier (Node1) -------------------------- -- 6.1 Operator Symbol -- -------------------------- -- OPERATOR_SYMBOL ::= STRING_LITERAL -- Note: the fields of the N_Operator_Symbol node are laid out to -- match the corresponding fields of an N_Character_Literal node. This -- allows easy conversion of the operator symbol node into a character -- literal node in the case where a string constant of the form of an -- operator symbol is scanned out as such, but turns out semantically -- to be a string literal that is not an operator. For details see -- Sinfo.CN.Change_Operator_Symbol_To_String_Literal. -- N_Operator_Symbol -- Sloc points to literal -- Chars (Name1) contains the Name_Id for the operator symbol -- Strval (Str3) Id of string value. This is used if the operator -- symbol turns out to be a normal string after all. -- Entity (Node4-Sem) -- Associated_Node (Node4-Sem) -- Has_Private_View (Flag11-Sem) set in generic units. -- Etype (Node5-Sem) -- Note: the Strval field may be set to No_String for generated -- operator symbols that are known not to be string literals -- semantically. ----------------------------------- -- 6.1 Defining Operator Symbol -- ----------------------------------- -- DEFINING_OPERATOR_SYMBOL ::= OPERATOR_SYMBOL -- A defining operator symbol is an entity, which has additional -- fields depending on the setting of the Ekind field. These -- additional fields are defined (and access subprograms declared) -- in package Einfo. -- Note: N_Defining_Operator_Symbol is an extended node whose fields -- are deliberately layed out to match the layout of fields in an -- ordinary N_Operator_Symbol node allowing for easy alteration of -- an operator symbol node into a defining operator symbol node. -- See Sinfo.CN.Change_Operator_Symbol_To_Defining_Operator_Symbol -- for further details. -- N_Defining_Operator_Symbol -- Sloc points to literal -- Chars (Name1) contains the Name_Id for the operator symbol -- Next_Entity (Node2-Sem) -- Scope (Node3-Sem) -- Etype (Node5-Sem) ---------------------------- -- 6.1 Parameter Profile -- ---------------------------- -- PARAMETER_PROFILE ::= [FORMAL_PART] --------------------------------------- -- 6.1 Parameter and Result Profile -- --------------------------------------- -- PARAMETER_AND_RESULT_PROFILE ::= -- [FORMAL_PART] return [NULL_EXCLUSION] SUBTYPE_MARK -- | [FORMAL_PART] return ACCESS_DEFINITION -- There is no explicit node in the tree for a parameter and result -- profile. Instead the information appears directly in the parent. ---------------------- -- 6.1 Formal part -- ---------------------- -- FORMAL_PART ::= -- (PARAMETER_SPECIFICATION {; PARAMETER_SPECIFICATION}) ---------------------------------- -- 6.1 Parameter specification -- ---------------------------------- -- PARAMETER_SPECIFICATION ::= -- DEFINING_IDENTIFIER_LIST : MODE [NULL_EXCLUSION] SUBTYPE_MARK -- [:= DEFAULT_EXPRESSION] -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION -- [:= DEFAULT_EXPRESSION] -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive specifications were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single Specifications, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- N_Parameter_Specification -- Sloc points to first identifier -- Defining_Identifier (Node1) -- In_Present (Flag15) -- Out_Present (Flag17) -- Null_Exclusion_Present (Flag11) -- Parameter_Type (Node2) subtype mark or access definition -- Expression (Node3) (set to Empty if no default expression present) -- Do_Accessibility_Check (Flag13-Sem) -- More_Ids (Flag5) (set to False if no more identifiers in list) -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) -- Default_Expression (Node5-Sem) --------------- -- 6.1 Mode -- --------------- -- MODE ::= [in] | in out | out -- There is no explicit node in the tree for the Mode. Instead the -- In_Present and Out_Present flags are set in the parent node to -- record the presence of keywords specifying the mode. -------------------------- -- 6.3 Subprogram Body -- -------------------------- -- SUBPROGRAM_BODY ::= -- SUBPROGRAM_SPECIFICATION is -- DECLARATIVE_PART -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [DESIGNATOR]; -- N_Subprogram_Body -- Sloc points to FUNCTION or PROCEDURE -- Specification (Node1) -- Declarations (List2) -- Handled_Statement_Sequence (Node4) -- Activation_Chain_Entity (Node3-Sem) -- Corresponding_Spec (Node5-Sem) -- Acts_As_Spec (Flag4-Sem) -- Bad_Is_Detected (Flag15) used only by parser -- Do_Storage_Check (Flag17-Sem) -- Has_Priority_Pragma (Flag6-Sem) -- Is_Protected_Subprogram_Body (Flag7-Sem) -- Is_Task_Master (Flag5-Sem) -- Was_Originally_Stub (Flag13-Sem) ----------------------------------- -- 6.4 Procedure Call Statement -- ----------------------------------- -- PROCEDURE_CALL_STATEMENT ::= -- procedure_NAME; | procedure_PREFIX ACTUAL_PARAMETER_PART; -- Note: the reason that a procedure call has expression fields is -- that it semantically resembles an expression, e.g. overloading is -- allowed and a type is concocted for semantic processing purposes. -- Certain of these fields, such as Parens are not relevant, but it -- is easier to just supply all of them together! -- N_Procedure_Call_Statement -- Sloc points to first token of name or prefix -- Name (Node2) stores name or prefix -- Parameter_Associations (List3) (set to No_List if no -- actual parameter part) -- First_Named_Actual (Node4-Sem) -- Controlling_Argument (Node1-Sem) (set to Empty if not dispatching) -- Do_Tag_Check (Flag13-Sem) -- No_Elaboration_Check (Flag14-Sem) -- Parameter_List_Truncated (Flag17-Sem) -- ABE_Is_Certain (Flag18-Sem) -- plus fields for expression -- If any IN parameter requires a range check, then the corresponding -- argument expression has the Do_Range_Check flag set, and the range -- check is done against the formal type. Note that this argument -- expression may appear directly in the Parameter_Associations list, -- or may be a descendent of an N_Parameter_Association node that -- appears in this list. ------------------------ -- 6.4 Function Call -- ------------------------ -- FUNCTION_CALL ::= -- function_NAME | function_PREFIX ACTUAL_PARAMETER_PART -- Note: the parser may generate an indexed component node or simply -- a name node instead of a function call node. The semantic pass must -- correct this misidentification. -- N_Function_Call -- Sloc points to first token of name or prefix -- Name (Node2) stores name or prefix -- Parameter_Associations (List3) (set to No_List if no -- actual parameter part) -- First_Named_Actual (Node4-Sem) -- Controlling_Argument (Node1-Sem) (set to Empty if not dispatching) -- Do_Tag_Check (Flag13-Sem) -- No_Elaboration_Check (Flag14-Sem) -- Parameter_List_Truncated (Flag17-Sem) -- ABE_Is_Certain (Flag18-Sem) -- plus fields for expression -------------------------------- -- 6.4 Actual Parameter Part -- -------------------------------- -- ACTUAL_PARAMETER_PART ::= -- (PARAMETER_ASSOCIATION {,PARAMETER_ASSOCIATION}) -------------------------------- -- 6.4 Parameter Association -- -------------------------------- -- PARAMETER_ASSOCIATION ::= -- [formal_parameter_SELECTOR_NAME =>] EXPLICIT_ACTUAL_PARAMETER -- Note: the N_Parameter_Association node is built only if a formal -- parameter selector name is present, otherwise the parameter -- association appears in the tree simply as the node for the -- explicit actual parameter. -- N_Parameter_Association -- Sloc points to formal parameter -- Selector_Name (Node2) (always non-Empty, since this node is -- only used if a formal parameter selector name is present) -- Explicit_Actual_Parameter (Node3) -- Next_Named_Actual (Node4-Sem) --------------------------- -- 6.4 Actual Parameter -- --------------------------- -- EXPLICIT_ACTUAL_PARAMETER ::= EXPRESSION | variable_NAME --------------------------- -- 6.5 Return Statement -- --------------------------- -- RETURN_STATEMENT ::= return [EXPRESSION]; -- N_Return_Statement -- Sloc points to RETURN -- Expression (Node3) (set to Empty if no expression present) -- Storage_Pool (Node1-Sem) -- Procedure_To_Call (Node4-Sem) -- Do_Tag_Check (Flag13-Sem) -- Return_Type (Node2-Sem) -- By_Ref (Flag5-Sem) -- Note: if a range check is required, then Do_Range_Check is set -- on the Expression. The range check is against Return_Type. ------------------------------ -- 7.1 Package Declaration -- ------------------------------ -- PACKAGE_DECLARATION ::= PACKAGE_SPECIFICATION; -- Note: the activation chain entity for a package spec is used for -- all tasks declared in the package spec, or in the package body. -- N_Package_Declaration -- Sloc points to PACKAGE -- Specification (Node1) -- Corresponding_Body (Node5-Sem) -- Parent_Spec (Node4-Sem) -- Activation_Chain_Entity (Node3-Sem) -------------------------------- -- 7.1 Package Specification -- -------------------------------- -- PACKAGE_SPECIFICATION ::= -- package DEFINING_PROGRAM_UNIT_NAME is -- {BASIC_DECLARATIVE_ITEM} -- [private -- {BASIC_DECLARATIVE_ITEM}] -- end [[PARENT_UNIT_NAME .] IDENTIFIER] -- N_Package_Specification -- Sloc points to PACKAGE -- Defining_Unit_Name (Node1) -- Visible_Declarations (List2) -- Private_Declarations (List3) (set to No_List if no private -- part present) -- End_Label (Node4) -- Generic_Parent (Node5-Sem) -- Limited_View_Installed (Flag18-Sem) ----------------------- -- 7.1 Package Body -- ----------------------- -- PACKAGE_BODY ::= -- package body DEFINING_PROGRAM_UNIT_NAME is -- DECLARATIVE_PART -- [begin -- HANDLED_SEQUENCE_OF_STATEMENTS] -- end [[PARENT_UNIT_NAME .] IDENTIFIER]; -- N_Package_Body -- Sloc points to PACKAGE -- Defining_Unit_Name (Node1) -- Declarations (List2) -- Handled_Statement_Sequence (Node4) (set to Empty if no HSS present) -- Corresponding_Spec (Node5-Sem) -- Was_Originally_Stub (Flag13-Sem) -- Note: if a source level package does not contain a handled sequence -- of statements, then the parser supplies a dummy one with a null -- sequence of statements. Comes_From_Source will be False in this -- constructed sequence. The reason we need this is for the End_Label -- field in the HSS. ----------------------------------- -- 7.4 Private Type Declaration -- ----------------------------------- -- PRIVATE_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] -- is [[abstract] tagged] [limited] private; -- Note: TAGGED is not permitted in Ada 83 mode -- N_Private_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier (Node1) -- Discriminant_Specifications (List4) (set to No_List if no -- discriminant part) -- Unknown_Discriminants_Present (Flag13) set if (<>) discriminant -- Abstract_Present (Flag4) -- Tagged_Present (Flag15) -- Limited_Present (Flag17) ---------------------------------------- -- 7.4 Private Extension Declaration -- ---------------------------------------- -- PRIVATE_EXTENSION_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] is -- [abstract] [limited] new ancestor_SUBTYPE_INDICATION -- [and INTERFACE_LIST] with private; -- Note: LIMITED, and private extension declarations are not allowed -- in Ada 83 mode. -- N_Private_Extension_Declaration -- Sloc points to TYPE -- Defining_Identifier (Node1) -- Discriminant_Specifications (List4) (set to No_List if no -- discriminant part) -- Unknown_Discriminants_Present (Flag13) set if (<>) discriminant -- Abstract_Present (Flag4) -- Limited_Present (Flag17) -- Subtype_Indication (Node5) -- Interface_List (List2) (set to No_List if none) --------------------- -- 8.4 Use Clause -- --------------------- -- USE_CLAUSE ::= USE_PACKAGE_CLAUSE | USE_TYPE_CLAUSE ----------------------------- -- 8.4 Use Package Clause -- ----------------------------- -- USE_PACKAGE_CLAUSE ::= use package_NAME {, package_NAME}; -- N_Use_Package_Clause -- Sloc points to USE -- Names (List2) -- Next_Use_Clause (Node3-Sem) -- Hidden_By_Use_Clause (Elist4-Sem) -------------------------- -- 8.4 Use Type Clause -- -------------------------- -- USE_TYPE_CLAUSE ::= use type SUBTYPE_MARK {, SUBTYPE_MARK}; -- Note: use type clause is not permitted in Ada 83 mode -- N_Use_Type_Clause -- Sloc points to USE -- Subtype_Marks (List2) -- Next_Use_Clause (Node3-Sem) -- Hidden_By_Use_Clause (Elist4-Sem) ------------------------------- -- 8.5 Renaming Declaration -- ------------------------------- -- RENAMING_DECLARATION ::= -- OBJECT_RENAMING_DECLARATION -- | EXCEPTION_RENAMING_DECLARATION -- | PACKAGE_RENAMING_DECLARATION -- | SUBPROGRAM_RENAMING_DECLARATION -- | GENERIC_RENAMING_DECLARATION -------------------------------------- -- 8.5 Object Renaming Declaration -- -------------------------------------- -- OBJECT_RENAMING_DECLARATION ::= -- DEFINING_IDENTIFIER : SUBTYPE_MARK renames object_NAME; -- | DEFINING_IDENTIFIER : ACCESS_DEFINITION renames object_NAME; -- Note: Access_Definition is an optional field that gives support to -- Ada 2005 (AI-230). The parser generates nodes that have either the -- Subtype_Indication field or else the Access_Definition field. -- N_Object_Renaming_Declaration -- Sloc points to first identifier -- Defining_Identifier (Node1) -- Subtype_Mark (Node4) (set to Empty if not present) -- Access_Definition (Node3) (set to Empty if not present) -- Name (Node2) -- Corresponding_Generic_Association (Node5-Sem) ----------------------------------------- -- 8.5 Exception Renaming Declaration -- ----------------------------------------- -- EXCEPTION_RENAMING_DECLARATION ::= -- DEFINING_IDENTIFIER : exception renames exception_NAME; -- N_Exception_Renaming_Declaration -- Sloc points to first identifier -- Defining_Identifier (Node1) -- Name (Node2) --------------------------------------- -- 8.5 Package Renaming Declaration -- --------------------------------------- -- PACKAGE_RENAMING_DECLARATION ::= -- package DEFINING_PROGRAM_UNIT_NAME renames package_NAME; -- N_Package_Renaming_Declaration -- Sloc points to PACKAGE -- Defining_Unit_Name (Node1) -- Name (Node2) -- Parent_Spec (Node4-Sem) ------------------------------------------ -- 8.5 Subprogram Renaming Declaration -- ------------------------------------------ -- SUBPROGRAM_RENAMING_DECLARATION ::= -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME; -- N_Subprogram_Renaming_Declaration -- Sloc points to RENAMES -- Specification (Node1) -- Name (Node2) -- Parent_Spec (Node4-Sem) -- Corresponding_Spec (Node5-Sem) -- Corresponding_Formal_Spec (Node3-Sem) -- From_Default (Flag6-Sem) ----------------------------------------- -- 8.5.5 Generic Renaming Declaration -- ----------------------------------------- -- GENERIC_RENAMING_DECLARATION ::= -- generic package DEFINING_PROGRAM_UNIT_NAME -- renames generic_package_NAME -- | generic procedure DEFINING_PROGRAM_UNIT_NAME -- renames generic_procedure_NAME -- | generic function DEFINING_PROGRAM_UNIT_NAME -- renames generic_function_NAME -- N_Generic_Package_Renaming_Declaration -- Sloc points to GENERIC -- Defining_Unit_Name (Node1) -- Name (Node2) -- Parent_Spec (Node4-Sem) -- N_Generic_Procedure_Renaming_Declaration -- Sloc points to GENERIC -- Defining_Unit_Name (Node1) -- Name (Node2) -- Parent_Spec (Node4-Sem) -- N_Generic_Function_Renaming_Declaration -- Sloc points to GENERIC -- Defining_Unit_Name (Node1) -- Name (Node2) -- Parent_Spec (Node4-Sem) -------------------------------- -- 9.1 Task Type Declaration -- -------------------------------- -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] -- [is [new INTERFACE_LIST with] TASK_DEFINITITION]; -- N_Task_Type_Declaration -- Sloc points to TASK -- Defining_Identifier (Node1) -- Discriminant_Specifications (List4) (set to No_List if no -- discriminant part) -- Interface_List (List2) (set to No_List if none) -- Task_Definition (Node3) (set to Empty if not present) -- Corresponding_Body (Node5-Sem) ---------------------------------- -- 9.1 Single Task Declaration -- ---------------------------------- -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER -- [is [new INTERFACE_LIST with] TASK_DEFINITITION]; -- N_Single_Task_Declaration -- Sloc points to TASK -- Defining_Identifier (Node1) -- Interface_List (List2) (set to No_List if none) -- Task_Definition (Node3) (set to Empty if not present) -------------------------- -- 9.1 Task Definition -- -------------------------- -- TASK_DEFINITION ::= -- {TASK_ITEM} -- [private -- {TASK_ITEM}] -- end [task_IDENTIFIER] -- Note: as a result of semantic analysis, the list of task items can -- include implicit type declarations resulting from entry families. -- N_Task_Definition -- Sloc points to first token of task definition -- Visible_Declarations (List2) -- Private_Declarations (List3) (set to No_List if no private part) -- End_Label (Node4) -- Has_Priority_Pragma (Flag6-Sem) -- Has_Storage_Size_Pragma (Flag5-Sem) -- Has_Task_Info_Pragma (Flag7-Sem) -- Has_Task_Name_Pragma (Flag8-Sem) -------------------- -- 9.1 Task Item -- -------------------- -- TASK_ITEM ::= ENTRY_DECLARATION | REPRESENTATION_CLAUSE -------------------- -- 9.1 Task Body -- -------------------- -- TASK_BODY ::= -- task body task_DEFINING_IDENTIFIER is -- DECLARATIVE_PART -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [task_IDENTIFIER]; -- Gigi restriction: This node never appears -- N_Task_Body -- Sloc points to TASK -- Defining_Identifier (Node1) -- Declarations (List2) -- Handled_Statement_Sequence (Node4) -- Is_Task_Master (Flag5-Sem) -- Activation_Chain_Entity (Node3-Sem) -- Corresponding_Spec (Node5-Sem) -- Was_Originally_Stub (Flag13-Sem) ------------------------------------- -- 9.4 Protected Type Declaration -- ------------------------------------- -- PROTECTED_TYPE_DECLARATION ::= -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- Note: protected type declarations are not permitted in Ada 83 mode -- N_Protected_Type_Declaration -- Sloc points to PROTECTED -- Defining_Identifier (Node1) -- Discriminant_Specifications (List4) (set to No_List if no -- discriminant part) -- Interface_List (List2) (set to No_List if none) -- Protected_Definition (Node3) -- Corresponding_Body (Node5-Sem) --------------------------------------- -- 9.4 Single Protected Declaration -- --------------------------------------- -- SINGLE_PROTECTED_DECLARATION ::= -- protected DEFINING_IDENTIFIER -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- Note: single protected declarations are not allowed in Ada 83 mode -- N_Single_Protected_Declaration -- Sloc points to PROTECTED -- Defining_Identifier (Node1) -- Interface_List (List2) (set to No_List if none) -- Protected_Definition (Node3) ------------------------------- -- 9.4 Protected Definition -- ------------------------------- -- PROTECTED_DEFINITION ::= -- {PROTECTED_OPERATION_DECLARATION} -- [private -- {PROTECTED_ELEMENT_DECLARATION}] -- end [protected_IDENTIFIER] -- N_Protected_Definition -- Sloc points to first token of protected definition -- Visible_Declarations (List2) -- Private_Declarations (List3) (set to No_List if no private part) -- End_Label (Node4) -- Has_Priority_Pragma (Flag6-Sem) ------------------------------------------ -- 9.4 Protected Operation Declaration -- ------------------------------------------ -- PROTECTED_OPERATION_DECLARATION ::= -- SUBPROGRAM_DECLARATION -- | ENTRY_DECLARATION -- | REPRESENTATION_CLAUSE ---------------------------------------- -- 9.4 Protected Element Declaration -- ---------------------------------------- -- PROTECTED_ELEMENT_DECLARATION ::= -- PROTECTED_OPERATION_DECLARATION | COMPONENT_DECLARATION ------------------------- -- 9.4 Protected Body -- ------------------------- -- PROTECTED_BODY ::= -- protected body DEFINING_IDENTIFIER is -- {PROTECTED_OPERATION_ITEM} -- end [protected_IDENTIFIER]; -- Note: protected bodies are not allowed in Ada 83 mode -- Gigi restriction: This node never appears -- N_Protected_Body -- Sloc points to PROTECTED -- Defining_Identifier (Node1) -- Declarations (List2) protected operation items (and pragmas) -- End_Label (Node4) -- Corresponding_Spec (Node5-Sem) -- Was_Originally_Stub (Flag13-Sem) ----------------------------------- -- 9.4 Protected Operation Item -- ----------------------------------- -- PROTECTED_OPERATION_ITEM ::= -- SUBPROGRAM_DECLARATION -- | SUBPROGRAM_BODY -- | ENTRY_BODY -- | REPRESENTATION_CLAUSE ------------------------------ -- 9.5.2 Entry Declaration -- ------------------------------ -- ENTRY_DECLARATION ::= -- [[not] overriding] -- entry DEFINING_IDENTIFIER -- [(DISCRETE_SUBTYPE_DEFINITION)] PARAMETER_PROFILE; -- N_Entry_Declaration -- Sloc points to ENTRY -- Defining_Identifier (Node1) -- Discrete_Subtype_Definition (Node4) (set to Empty if not present) -- Parameter_Specifications (List3) (set to No_List if no formal part) -- Corresponding_Body (Node5-Sem) -- Must_Override (Flag14) set if overriding indicator present -- Must_Not_Override (Flag15) set if not_overriding indicator present -- Note: overriding indicator is an Ada 2005 feature ----------------------------- -- 9.5.2 Accept statement -- ----------------------------- -- ACCEPT_STATEMENT ::= -- accept entry_DIRECT_NAME -- [(ENTRY_INDEX)] PARAMETER_PROFILE [do -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [entry_IDENTIFIER]]; -- Gigi restriction: This node never appears -- Note: there are no explicit declarations allowed in an accept -- statement. However, the implicit declarations for any statement -- identifiers (labels and block/loop identifiers) are declarations -- that belong logically to the accept statement, and that is why -- there is a Declarations field in this node. -- N_Accept_Statement -- Sloc points to ACCEPT -- Entry_Direct_Name (Node1) -- Entry_Index (Node5) (set to Empty if not present) -- Parameter_Specifications (List3) (set to No_List if no formal part) -- Handled_Statement_Sequence (Node4) -- Declarations (List2) (set to No_List if no declarations) ------------------------ -- 9.5.2 Entry Index -- ------------------------ -- ENTRY_INDEX ::= EXPRESSION ----------------------- -- 9.5.2 Entry Body -- ----------------------- -- ENTRY_BODY ::= -- entry DEFINING_IDENTIFIER ENTRY_BODY_FORMAL_PART ENTRY_BARRIER is -- DECLARATIVE_PART -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [entry_IDENTIFIER]; -- ENTRY_BARRIER ::= when CONDITION -- Note: we store the CONDITION of the ENTRY_BARRIER in the node for -- the ENTRY_BODY_FORMAL_PART to avoid the N_Entry_Body node getting -- too full (it would otherwise have too many fields) -- Gigi restriction: This node never appears -- N_Entry_Body -- Sloc points to ENTRY -- Defining_Identifier (Node1) -- Entry_Body_Formal_Part (Node5) -- Declarations (List2) -- Handled_Statement_Sequence (Node4) -- Activation_Chain_Entity (Node3-Sem) ----------------------------------- -- 9.5.2 Entry Body Formal Part -- ----------------------------------- -- ENTRY_BODY_FORMAL_PART ::= -- [(ENTRY_INDEX_SPECIFICATION)] PARAMETER_PROFILE -- Note that an entry body formal part node is present even if it is -- empty. This reflects the grammar, in which it is the components of -- the entry body formal part that are optional, not the entry body -- formal part itself. Also this means that the barrier condition -- always has somewhere to be stored. -- Gigi restriction: This node never appears -- N_Entry_Body_Formal_Part -- Sloc points to first token -- Entry_Index_Specification (Node4) (set to Empty if not present) -- Parameter_Specifications (List3) (set to No_List if no formal part) -- Condition (Node1) from entry barrier of entry body -------------------------- -- 9.5.2 Entry Barrier -- -------------------------- -- ENTRY_BARRIER ::= when CONDITION -------------------------------------- -- 9.5.2 Entry Index Specification -- -------------------------------------- -- ENTRY_INDEX_SPECIFICATION ::= -- for DEFINING_IDENTIFIER in DISCRETE_SUBTYPE_DEFINITION -- Gigi restriction: This node never appears -- N_Entry_Index_Specification -- Sloc points to FOR -- Defining_Identifier (Node1) -- Discrete_Subtype_Definition (Node4) --------------------------------- -- 9.5.3 Entry Call Statement -- --------------------------------- -- ENTRY_CALL_STATEMENT ::= entry_NAME [ACTUAL_PARAMETER_PART]; -- The parser may generate a procedure call for this construct. The -- semantic pass must correct this misidentification where needed. -- Gigi restriction: This node never appears -- N_Entry_Call_Statement -- Sloc points to first token of name -- Name (Node2) -- Parameter_Associations (List3) (set to No_List if no -- actual parameter part) -- First_Named_Actual (Node4-Sem) ------------------------------ -- 9.5.4 Requeue Statement -- ------------------------------ -- REQUEUE_STATEMENT ::= requeue entry_NAME [with abort]; -- Note: requeue statements are not permitted in Ada 83 mode -- Gigi restriction: This node never appears -- N_Requeue_Statement -- Sloc points to REQUEUE -- Name (Node2) -- Abort_Present (Flag15) -------------------------- -- 9.6 Delay Statement -- -------------------------- -- DELAY_STATEMENT ::= -- DELAY_UNTIL_STATEMENT -- | DELAY_RELATIVE_STATEMENT -------------------------------- -- 9.6 Delay Until Statement -- -------------------------------- -- DELAY_UNTIL_STATEMENT ::= delay until delay_EXPRESSION; -- Note: delay until statements are not permitted in Ada 83 mode -- Gigi restriction: This node never appears -- N_Delay_Until_Statement -- Sloc points to DELAY -- Expression (Node3) ----------------------------------- -- 9.6 Delay Relative Statement -- ----------------------------------- -- DELAY_RELATIVE_STATEMENT ::= delay delay_EXPRESSION; -- Gigi restriction: This node never appears -- N_Delay_Relative_Statement -- Sloc points to DELAY -- Expression (Node3) --------------------------- -- 9.7 Select Statement -- --------------------------- -- SELECT_STATEMENT ::= -- SELECTIVE_ACCEPT -- | TIMED_ENTRY_CALL -- | CONDITIONAL_ENTRY_CALL -- | ASYNCHRONOUS_SELECT ----------------------------- -- 9.7.1 Selective Accept -- ----------------------------- -- SELECTIVE_ACCEPT ::= -- select -- [GUARD] -- SELECT_ALTERNATIVE -- {or -- [GUARD] -- SELECT_ALTERNATIVE} -- [else -- SEQUENCE_OF_STATEMENTS] -- end select; -- Gigi restriction: This node never appears -- Note: the guard expression, if present, appears in the node for -- the select alternative. -- N_Selective_Accept -- Sloc points to SELECT -- Select_Alternatives (List1) -- Else_Statements (List4) (set to No_List if no else part) ------------------ -- 9.7.1 Guard -- ------------------ -- GUARD ::= when CONDITION => -- As noted above, the CONDITION that is part of a GUARD is included -- in the node for the select alernative for convenience. ------------------------------- -- 9.7.1 Select Alternative -- ------------------------------- -- SELECT_ALTERNATIVE ::= -- ACCEPT_ALTERNATIVE -- | DELAY_ALTERNATIVE -- | TERMINATE_ALTERNATIVE ------------------------------- -- 9.7.1 Accept Alternative -- ------------------------------- -- ACCEPT_ALTERNATIVE ::= -- ACCEPT_STATEMENT [SEQUENCE_OF_STATEMENTS] -- Gigi restriction: This node never appears -- N_Accept_Alternative -- Sloc points to ACCEPT -- Accept_Statement (Node2) -- Condition (Node1) from the guard (set to Empty if no guard present) -- Statements (List3) (set to Empty_List if no statements) -- Pragmas_Before (List4) pragmas before alt (set to No_List if none) -- Accept_Handler_Records (List5-Sem) ------------------------------ -- 9.7.1 Delay Alternative -- ------------------------------ -- DELAY_ALTERNATIVE ::= -- DELAY_STATEMENT [SEQUENCE_OF_STATEMENTS] -- Gigi restriction: This node never appears -- N_Delay_Alternative -- Sloc points to DELAY -- Delay_Statement (Node2) -- Condition (Node1) from the guard (set to Empty if no guard present) -- Statements (List3) (set to Empty_List if no statements) -- Pragmas_Before (List4) pragmas before alt (set to No_List if none) ---------------------------------- -- 9.7.1 Terminate Alternative -- ---------------------------------- -- TERMINATE_ALTERNATIVE ::= terminate; -- Gigi restriction: This node never appears -- N_Terminate_Alternative -- Sloc points to TERMINATE -- Condition (Node1) from the guard (set to Empty if no guard present) -- Pragmas_Before (List4) pragmas before alt (set to No_List if none) -- Pragmas_After (List5) pragmas after alt (set to No_List if none) ----------------------------- -- 9.7.2 Timed Entry Call -- ----------------------------- -- TIMED_ENTRY_CALL ::= -- select -- ENTRY_CALL_ALTERNATIVE -- or -- DELAY_ALTERNATIVE -- end select; -- Gigi restriction: This node never appears -- N_Timed_Entry_Call -- Sloc points to SELECT -- Entry_Call_Alternative (Node1) -- Delay_Alternative (Node4) ----------------------------------- -- 9.7.2 Entry Call Alternative -- ----------------------------------- -- ENTRY_CALL_ALTERNATIVE ::= -- PROCEDURE_OR_ENTRY_CALL [SEQUENCE_OF_STATEMENTS] -- PROCEDURE_OR_ENTRY_CALL ::= -- PROCEDURE_CALL_STATEMENT | ENTRY_CALL_STATEMENT -- Gigi restriction: This node never appears -- N_Entry_Call_Alternative -- Sloc points to first token of entry call statement -- Entry_Call_Statement (Node1) -- Statements (List3) (set to Empty_List if no statements) -- Pragmas_Before (List4) pragmas before alt (set to No_List if none) ----------------------------------- -- 9.7.3 Conditional Entry Call -- ----------------------------------- -- CONDITIONAL_ENTRY_CALL ::= -- select -- ENTRY_CALL_ALTERNATIVE -- else -- SEQUENCE_OF_STATEMENTS -- end select; -- Gigi restriction: This node never appears -- N_Conditional_Entry_Call -- Sloc points to SELECT -- Entry_Call_Alternative (Node1) -- Else_Statements (List4) -------------------------------- -- 9.7.4 Asynchronous Select -- -------------------------------- -- ASYNCHRONOUS_SELECT ::= -- select -- TRIGGERING_ALTERNATIVE -- then abort -- ABORTABLE_PART -- end select; -- Note: asynchronous select is not permitted in Ada 83 mode -- Gigi restriction: This node never appears -- N_Asynchronous_Select -- Sloc points to SELECT -- Triggering_Alternative (Node1) -- Abortable_Part (Node2) ----------------------------------- -- 9.7.4 Triggering Alternative -- ----------------------------------- -- TRIGGERING_ALTERNATIVE ::= -- TRIGGERING_STATEMENT [SEQUENCE_OF_STATEMENTS] -- Gigi restriction: This node never appears -- N_Triggering_Alternative -- Sloc points to first token of triggering statement -- Triggering_Statement (Node1) -- Statements (List3) (set to Empty_List if no statements) -- Pragmas_Before (List4) pragmas before alt (set to No_List if none) --------------------------------- -- 9.7.4 Triggering Statement -- --------------------------------- -- TRIGGERING_STATEMENT ::= PROCEDURE_OR_ENTRY_CALL | DELAY_STATEMENT --------------------------- -- 9.7.4 Abortable Part -- --------------------------- -- ABORTABLE_PART ::= SEQUENCE_OF_STATEMENTS -- Gigi restriction: This node never appears -- N_Abortable_Part -- Sloc points to ABORT -- Statements (List3) -------------------------- -- 9.8 Abort Statement -- -------------------------- -- ABORT_STATEMENT ::= abort task_NAME {, task_NAME}; -- Gigi restriction: This node never appears -- N_Abort_Statement -- Sloc points to ABORT -- Names (List2) ------------------------- -- 10.1.1 Compilation -- ------------------------- -- COMPILATION ::= {COMPILATION_UNIT} -- There is no explicit node in the tree for a compilation, since in -- general the compiler is processing only a single compilation unit -- at a time. It is possible to parse multiple units in syntax check -- only mode, but they the trees are discarded in any case. ------------------------------ -- 10.1.1 Compilation Unit -- ------------------------------ -- COMPILATION_UNIT ::= -- CONTEXT_CLAUSE LIBRARY_ITEM -- | CONTEXT_CLAUSE SUBUNIT -- The N_Compilation_Unit node itself respresents the above syntax. -- However, there are two additional items not reflected in the above -- syntax. First we have the global declarations that are added by the -- code generator. These are outer level declarations (so they cannot -- be represented as being inside the units). An example is the wrapper -- subprograms that are created to do ABE checking. As always a list of -- declarations can contain actions as well (i.e. statements), and such -- statements are executed as part of the elaboration of the unit. Note -- that all such declarations are elaborated before the library unit. -- Similarly, certain actions need to be elaborated at the completion -- of elaboration of the library unit (notably the statement that sets -- the Boolean flag indicating that elaboration is complete). -- The third item not reflected in the syntax is pragmas that appear -- after the compilation unit. As always pragmas are a problem since -- they are not part of the formal syntax, but can be stuck into the -- source following a set of ad hoc rules, and we have to find an ad -- hoc way of sticking them into the tree. For pragmas that appear -- before the library unit, we just consider them to be part of the -- context clause, and pragmas can appear in the Context_Items list -- of the compilation unit. However, pragmas can also appear after -- the library item. -- To deal with all these problems, we create an auxiliary node for -- a compilation unit, referenced from the N_Compilation_Unit node -- that contains these three items. -- N_Compilation_Unit -- Sloc points to first token of defining unit name -- Library_Unit (Node4-Sem) corresponding/parent spec/body -- Context_Items (List1) context items and pragmas preceding unit -- Private_Present (Flag15) set if library unit has private keyword -- Unit (Node2) library item or subunit -- Aux_Decls_Node (Node5) points to the N_Compilation_Unit_Aux node -- Has_No_Elaboration_Code (Flag17-Sem) -- Body_Required (Flag13-Sem) set for spec if body is required -- Acts_As_Spec (Flag4-Sem) flag for subprogram body with no spec -- First_Inlined_Subprogram (Node3-Sem) -- N_Compilation_Unit_Aux -- Sloc is a copy of the Sloc from the N_Compilation_Unit node -- Declarations (List2) (set to No_List if no global declarations) -- Actions (List1) (set to No_List if no actions) -- Pragmas_After (List5) pragmas after unit (set to No_List if none) -- Config_Pragmas (List4) config pragmas (set to Empty_List if none) -------------------------- -- 10.1.1 Library Item -- -------------------------- -- LIBRARY_ITEM ::= -- [private] LIBRARY_UNIT_DECLARATION -- | LIBRARY_UNIT_BODY -- | [private] LIBRARY_UNIT_RENAMING_DECLARATION -- Note: PRIVATE is not allowed in Ada 83 mode -- There is no explicit node in the tree for library item, instead -- the declaration or body, and the flag for private if present, -- appear in the N_Compilation_Unit clause. ---------------------------------------- -- 10.1.1 Library Unit Declararation -- ---------------------------------------- -- LIBRARY_UNIT_DECLARATION ::= -- SUBPROGRAM_DECLARATION | PACKAGE_DECLARATION -- | GENERIC_DECLARATION | GENERIC_INSTANTIATION ------------------------------------------------- -- 10.1.1 Library Unit Renaming Declararation -- ------------------------------------------------- -- LIBRARY_UNIT_RENAMING_DECLARATION ::= -- PACKAGE_RENAMING_DECLARATION -- | GENERIC_RENAMING_DECLARATION -- | SUBPROGRAM_RENAMING_DECLARATION ------------------------------- -- 10.1.1 Library unit body -- ------------------------------- -- LIBRARY_UNIT_BODY ::= SUBPROGRAM_BODY | PACKAGE_BODY ------------------------------ -- 10.1.1 Parent Unit Name -- ------------------------------ -- PARENT_UNIT_NAME ::= NAME ---------------------------- -- 10.1.2 Context clause -- ---------------------------- -- CONTEXT_CLAUSE ::= {CONTEXT_ITEM} -- The context clause can include pragmas, and any pragmas that appear -- before the context clause proper (i.e. all configuration pragmas, -- also appear at the front of this list). -------------------------- -- 10.1.2 Context_Item -- -------------------------- -- CONTEXT_ITEM ::= WITH_CLAUSE | USE_CLAUSE | WITH_TYPE_CLAUSE ------------------------- -- 10.1.2 With clause -- ------------------------- -- WITH_CLAUSE ::= -- with library_unit_NAME {,library_unit_NAME}; -- A separate With clause is built for each name, so that we have -- a Corresponding_Spec field for each with'ed spec. The flags -- First_Name and Last_Name are used to reconstruct the exact -- source form. When a list of names appears in one with clause, -- the first name in the list has First_Name set, and the last -- has Last_Name set. If the with clause has only one name, then -- both of the flags First_Name and Last_Name are set in this name. -- Note: in the case of implicit with's that are installed by the -- Rtsfind routine, Implicit_With is set, and the Sloc is typically -- set to Standard_Location, but it is incorrect to test the Sloc -- to find out if a with clause is implicit, test the flag instead. -- N_With_Clause -- Sloc points to first token of library unit name -- Name (Node2) -- Library_Unit (Node4-Sem) -- Corresponding_Spec (Node5-Sem) -- First_Name (Flag5) (set to True if first name or only one name) -- Last_Name (Flag6) (set to True if last name or only one name) -- Context_Installed (Flag13-Sem) -- Elaborate_Present (Flag4-Sem) -- Elaborate_All_Present (Flag14-Sem) -- Elaborate_All_Desirable (Flag9-Sem) -- Elaborate_Desirable (Flag11-Sem) -- Private_Present (Flag15) set if with_clause has private keyword -- Implicit_With (Flag16-Sem) -- Limited_Present (Flag17) set if LIMITED is present -- Limited_View_Installed (Flag18-Sem) -- Unreferenced_In_Spec (Flag7-Sem) -- No_Entities_Ref_In_Spec (Flag8-Sem) -- Note: Limited_Present and Limited_View_Installed give support to -- Ada 2005 (AI-50217). -- Similarly, Private_Present gives support to AI-50262. ---------------------- -- With_Type clause -- ---------------------- -- This is a GNAT extension, used to implement mutually recursive -- types declared in different packages. -- WITH_TYPE_CLAUSE ::= -- with type type_NAME is access | with type type_NAME is tagged -- N_With_Type_Clause -- Sloc points to first token of type name -- Name (Node2) -- Tagged_Present (Flag15) --------------------- -- 10.2 Body stub -- --------------------- -- BODY_STUB ::= -- SUBPROGRAM_BODY_STUB -- | PACKAGE_BODY_STUB -- | TASK_BODY_STUB -- | PROTECTED_BODY_STUB ---------------------------------- -- 10.1.3 Subprogram Body Stub -- ---------------------------------- -- SUBPROGRAM_BODY_STUB ::= -- SUBPROGRAM_SPECIFICATION is separate; -- N_Subprogram_Body_Stub -- Sloc points to FUNCTION or PROCEDURE -- Specification (Node1) -- Library_Unit (Node4-Sem) points to the subunit -- Corresponding_Body (Node5-Sem) ------------------------------- -- 10.1.3 Package Body Stub -- ------------------------------- -- PACKAGE_BODY_STUB ::= -- package body DEFINING_IDENTIFIER is separate; -- N_Package_Body_Stub -- Sloc points to PACKAGE -- Defining_Identifier (Node1) -- Library_Unit (Node4-Sem) points to the subunit -- Corresponding_Body (Node5-Sem) ---------------------------- -- 10.1.3 Task Body Stub -- ---------------------------- -- TASK_BODY_STUB ::= -- task body DEFINING_IDENTIFIER is separate; -- N_Task_Body_Stub -- Sloc points to TASK -- Defining_Identifier (Node1) -- Library_Unit (Node4-Sem) points to the subunit -- Corresponding_Body (Node5-Sem) --------------------------------- -- 10.1.3 Protected Body Stub -- --------------------------------- -- PROTECTED_BODY_STUB ::= -- protected body DEFINING_IDENTIFIER is separate; -- Note: protected body stubs are not allowed in Ada 83 mode -- N_Protected_Body_Stub -- Sloc points to PROTECTED -- Defining_Identifier (Node1) -- Library_Unit (Node4-Sem) points to the subunit -- Corresponding_Body (Node5-Sem) --------------------- -- 10.1.3 Subunit -- --------------------- -- SUBUNIT ::= separate (PARENT_UNIT_NAME) PROPER_BODY -- N_Subunit -- Sloc points to SEPARATE -- Name (Node2) is the name of the parent unit -- Proper_Body (Node1) is the subunit body -- Corresponding_Stub (Node3-Sem) is the stub declaration for the unit. --------------------------------- -- 11.1 Exception Declaration -- --------------------------------- -- EXCEPTION_DECLARATION ::= DEFINING_IDENTIFIER_LIST : exception; -- For consistency with object declarations etc, the parser converts -- the case of multiple identifiers being declared to a series of -- declarations in which the expression is copied, using the More_Ids -- and Prev_Ids flags to remember the souce form as described in the -- section on "Handling of Defining Identifier Lists". -- N_Exception_Declaration -- Sloc points to EXCEPTION -- Defining_Identifier (Node1) -- Expression (Node3-Sem) -- More_Ids (Flag5) (set to False if no more identifiers in list) -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) ------------------------------------------ -- 11.2 Handled Sequence Of Statements -- ------------------------------------------ -- HANDLED_SEQUENCE_OF_STATEMENTS ::= -- SEQUENCE_OF_STATEMENTS -- [exception -- EXCEPTION_HANDLER -- {EXCEPTION_HANDLER}] -- [at end -- cleanup_procedure_call (param, param, param, ...);] -- The AT END phrase is a GNAT extension to provide for cleanups. It is -- used only internally currently, but is considered to be syntactic. -- At the moment, the only cleanup action allowed is a single call to -- a parameterless procedure, and the Identifier field of the node is -- the procedure to be called. Also there is a current restriction -- that exception handles and a cleanup cannot be present in the same -- frame, so at least one of Exception_Handlers or the Identifier must -- be missing. -- Actually, more accurately, this restriction applies to the original -- source program. In the expanded tree, if the At_End_Proc field is -- present, then there will also be an exception handler of the form: -- when all others => -- cleanup; -- raise; -- where cleanup is the procedure to be generated. The reason we do -- this is so that the front end can handle the necessary entries in -- the exception tables, and other exception handler actions required -- as part of the normal handling for exception handlers. -- The AT END cleanup handler protects only the sequence of statements -- (not the associated declarations of the parent), just like exception -- handlers. The big difference is that the cleanup procedure is called -- on either a normal or an abnormal exit from the statement sequence. -- Note: the list of Exception_Handlers can contain pragmas as well -- as actual handlers. In practice these pragmas can only occur at -- the start of the list, since any pragmas occurring later on will -- be included in the statement list of the corresponding handler. -- Note: although in the Ada syntax, the sequence of statements in -- a handled sequence of statements can only contain statements, we -- allow free mixing of declarations and statements in the resulting -- expanded tree. This is for example used to deal with the case of -- a cleanup procedure that must handle declarations as well as the -- statements of a block. -- N_Handled_Sequence_Of_Statements -- Sloc points to first token of first statement -- Statements (List3) -- End_Label (Node4) (set to Empty if expander generated) -- Exception_Handlers (List5) (set to No_List if none present) -- At_End_Proc (Node1) (set to Empty if no clean up procedure) -- First_Real_Statement (Node2-Sem) -- Zero_Cost_Handling (Flag5-Sem) -- Note: the parent always contains a Declarations field which contains -- declarations associated with the handled sequence of statements. This -- is true even in the case of an accept statement (see description of -- the N_Accept_Statement node). -- End_Label refers to the containing construct ----------------------------- -- 11.2 Exception Handler -- ----------------------------- -- EXCEPTION_HANDLER ::= -- when [CHOICE_PARAMETER_SPECIFICATION :] -- EXCEPTION_CHOICE {| EXCEPTION_CHOICE} => -- SEQUENCE_OF_STATEMENTS -- Note: choice parameter specification is not allowed in Ada 83 mode -- N_Exception_Handler -- Sloc points to WHEN -- Choice_Parameter (Node2) (set to Empty if not present) -- Exception_Choices (List4) -- Statements (List3) -- Zero_Cost_Handling (Flag5-Sem) ------------------------------------------ -- 11.2 Choice parameter specification -- ------------------------------------------ -- CHOICE_PARAMETER_SPECIFICATION ::= DEFINING_IDENTIFIER ---------------------------- -- 11.2 Exception Choice -- ---------------------------- -- EXCEPTION_CHOICE ::= exception_NAME | others -- Except in the case of OTHERS, no explicit node appears in the tree -- for exception choice. Instead the exception name appears directly. -- An OTHERS choice is represented by a N_Others_Choice node (see -- section 3.8.1. -- Note: for the exception choice created for an at end handler, the -- exception choice is an N_Others_Choice node with All_Others set. --------------------------- -- 11.3 Raise Statement -- --------------------------- -- RAISE_STATEMENT ::= raise [exception_NAME]; -- In Ada 2005, we have -- RAISE_STATEMENT ::= raise; | raise exception_NAME [with EXPRESSION]; -- N_Raise_Statement -- Sloc points to RAISE -- Name (Node2) (set to Empty if no exception name present) -- Expression (Node3) (set to Empty if no expression present) ------------------------------- -- 12.1 Generic Declaration -- ------------------------------- -- GENERIC_DECLARATION ::= -- GENERIC_SUBPROGRAM_DECLARATION | GENERIC_PACKAGE_DECLARATION ------------------------------------------ -- 12.1 Generic Subprogram Declaration -- ------------------------------------------ -- GENERIC_SUBPROGRAM_DECLARATION ::= -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION; -- Note: Generic_Formal_Declarations can include pragmas -- N_Generic_Subprogram_Declaration -- Sloc points to GENERIC -- Specification (Node1) subprogram specification -- Corresponding_Body (Node5-Sem) -- Generic_Formal_Declarations (List2) from generic formal part -- Parent_Spec (Node4-Sem) --------------------------------------- -- 12.1 Generic Package Declaration -- --------------------------------------- -- GENERIC_PACKAGE_DECLARATION ::= -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION; -- Note: when we do generics right, the Activation_Chain_Entity entry -- for this node can be removed (since the expander won't see generic -- units any more)???. -- Note: Generic_Formal_Declarations can include pragmas -- N_Generic_Package_Declaration -- Sloc points to GENERIC -- Specification (Node1) package specification -- Corresponding_Body (Node5-Sem) -- Generic_Formal_Declarations (List2) from generic formal part -- Parent_Spec (Node4-Sem) -- Activation_Chain_Entity (Node3-Sem) ------------------------------- -- 12.1 Generic Formal Part -- ------------------------------- -- GENERIC_FORMAL_PART ::= -- generic {GENERIC_FORMAL_PARAMETER_DECLARATION | USE_CLAUSE} ------------------------------------------------ -- 12.1 Generic Formal Parameter Declaration -- ------------------------------------------------ -- GENERIC_FORMAL_PARAMETER_DECLARATION ::= -- FORMAL_OBJECT_DECLARATION -- | FORMAL_TYPE_DECLARATION -- | FORMAL_SUBPROGRAM_DECLARATION -- | FORMAL_PACKAGE_DECLARATION --------------------------------- -- 12.3 Generic Instantiation -- --------------------------------- -- GENERIC_INSTANTIATION ::= -- package DEFINING_PROGRAM_UNIT_NAME is -- new generic_package_NAME [GENERIC_ACTUAL_PART]; -- | [[not] overriding] -- procedure DEFINING_PROGRAM_UNIT_NAME is -- new generic_procedure_NAME [GENERIC_ACTUAL_PART]; -- | [[not] overriding] -- function DEFINING_DESIGNATOR is -- new generic_function_NAME [GENERIC_ACTUAL_PART]; -- N_Package_Instantiation -- Sloc points to PACKAGE -- Defining_Unit_Name (Node1) -- Name (Node2) -- Generic_Associations (List3) (set to No_List if no -- generic actual part) -- Parent_Spec (Node4-Sem) -- Instance_Spec (Node5-Sem) -- ABE_Is_Certain (Flag18-Sem) -- N_Procedure_Instantiation -- Sloc points to PROCEDURE -- Defining_Unit_Name (Node1) -- Name (Node2) -- Parent_Spec (Node4-Sem) -- Generic_Associations (List3) (set to No_List if no -- generic actual part) -- Instance_Spec (Node5-Sem) -- Must_Override (Flag14) set if overriding indicator present -- Must_Not_Override (Flag15) set if not_overriding indicator present -- ABE_Is_Certain (Flag18-Sem) -- N_Function_Instantiation -- Sloc points to FUNCTION -- Defining_Unit_Name (Node1) -- Name (Node2) -- Generic_Associations (List3) (set to No_List if no -- generic actual part) -- Parent_Spec (Node4-Sem) -- Instance_Spec (Node5-Sem) -- Must_Override (Flag14) set if overriding indicator present -- Must_Not_Override (Flag15) set if not_overriding indicator present -- ABE_Is_Certain (Flag18-Sem) -- Note: overriding indicator is an Ada 2005 feature ------------------------------ -- 12.3 Generic Actual Part -- ------------------------------ -- GENERIC_ACTUAL_PART ::= -- (GENERIC_ASSOCIATION {, GENERIC_ASSOCIATION}) ------------------------------- -- 12.3 Generic Association -- ------------------------------- -- GENERIC_ASSOCIATION ::= -- [generic_formal_parameter_SELECTOR_NAME =>] -- EXPLICIT_GENERIC_ACTUAL_PARAMETER -- Note: unlike the procedure call case, a generic association node -- is generated for every association, even if no formal is present. -- In this case the parser will leave the Selector_Name field set -- to Empty, to be filled in later by the semantic pass. -- N_Generic_Association -- Sloc points to first token of generic association -- Selector_Name (Node2) (set to Empty if no formal -- parameter selector name) -- Explicit_Generic_Actual_Parameter (Node1) --------------------------------------------- -- 12.3 Explicit Generic Actual Parameter -- --------------------------------------------- -- EXPLICIT_GENERIC_ACTUAL_PARAMETER ::= -- EXPRESSION | variable_NAME | subprogram_NAME -- | entry_NAME | SUBTYPE_MARK | package_instance_NAME ------------------------------------- -- 12.4 Formal Object Declaration -- ------------------------------------- -- FORMAL_OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : -- MODE SUBTYPE_MARK [:= DEFAULT_EXPRESSION]; -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single declarations, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- N_Formal_Object_Declaration -- Sloc points to first identifier -- Defining_Identifier (Node1) -- In_Present (Flag15) -- Out_Present (Flag17) -- Subtype_Mark (Node4) -- Expression (Node3) (set to Empty if no default expression) -- More_Ids (Flag5) (set to False if no more identifiers in list) -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) ----------------------------------- -- 12.5 Formal Type Declaration -- ----------------------------------- -- FORMAL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] -- is FORMAL_TYPE_DEFINITION; -- N_Formal_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier (Node1) -- Formal_Type_Definition (Node3) -- Discriminant_Specifications (List4) (set to No_List if no -- discriminant part) -- Unknown_Discriminants_Present (Flag13) set if (<>) discriminant ---------------------------------- -- 12.5 Formal type definition -- ---------------------------------- -- FORMAL_TYPE_DEFINITION ::= -- FORMAL_PRIVATE_TYPE_DEFINITION -- | FORMAL_DERIVED_TYPE_DEFINITION -- | FORMAL_DISCRETE_TYPE_DEFINITION -- | FORMAL_SIGNED_INTEGER_TYPE_DEFINITION -- | FORMAL_MODULAR_TYPE_DEFINITION -- | FORMAL_FLOATING_POINT_DEFINITION -- | FORMAL_ORDINARY_FIXED_POINT_DEFINITION -- | FORMAL_DECIMAL_FIXED_POINT_DEFINITION -- | FORMAL_ARRAY_TYPE_DEFINITION -- | FORMAL_ACCESS_TYPE_DEFINITION -- | FORMAL_INTERFACE_TYPE_DEFINITION --------------------------------------------- -- 12.5.1 Formal Private Type Definition -- --------------------------------------------- -- FORMAL_PRIVATE_TYPE_DEFINITION ::= -- [[abstract] tagged] [limited] private -- Note: TAGGED is not allowed in Ada 83 mode -- N_Formal_Private_Type_Definition -- Sloc points to PRIVATE -- Abstract_Present (Flag4) -- Tagged_Present (Flag15) -- Limited_Present (Flag17) -------------------------------------------- -- 12.5.1 Formal Derived Type Definition -- -------------------------------------------- -- FORMAL_DERIVED_TYPE_DEFINITION ::= -- [abstract] [limited] -- new SUBTYPE_MARK [[and INTERFACE_LIST] with private] -- Note: this construct is not allowed in Ada 83 mode -- N_Formal_Derived_Type_Definition -- Sloc points to NEW -- Subtype_Mark (Node4) -- Private_Present (Flag15) -- Abstract_Present (Flag4) -- Limited_Present (Flag17) -- Interface_List (List2) (set to No_List if none) --------------------------------------------- -- 12.5.2 Formal Discrete Type Definition -- --------------------------------------------- -- FORMAL_DISCRETE_TYPE_DEFINITION ::= (<>) -- N_Formal_Discrete_Type_Definition -- Sloc points to ( --------------------------------------------------- -- 12.5.2 Formal Signed Integer Type Definition -- --------------------------------------------------- -- FORMAL_SIGNED_INTEGER_TYPE_DEFINITION ::= range <> -- N_Formal_Signed_Integer_Type_Definition -- Sloc points to RANGE -------------------------------------------- -- 12.5.2 Formal Modular Type Definition -- -------------------------------------------- -- FORMAL_MODULAR_TYPE_DEFINITION ::= mod <> -- N_Formal_Modular_Type_Definition -- Sloc points to MOD ---------------------------------------------- -- 12.5.2 Formal Floating Point Definition -- ---------------------------------------------- -- FORMAL_FLOATING_POINT_DEFINITION ::= digits <> -- N_Formal_Floating_Point_Definition -- Sloc points to DIGITS ---------------------------------------------------- -- 12.5.2 Formal Ordinary Fixed Point Definition -- ---------------------------------------------------- -- FORMAL_ORDINARY_FIXED_POINT_DEFINITION ::= delta <> -- N_Formal_Ordinary_Fixed_Point_Definition -- Sloc points to DELTA --------------------------------------------------- -- 12.5.2 Formal Decimal Fixed Point Definition -- --------------------------------------------------- -- FORMAL_DECIMAL_FIXED_POINT_DEFINITION ::= delta <> digits <> -- Note: formal decimal fixed point definition not allowed in Ada 83 -- N_Formal_Decimal_Fixed_Point_Definition -- Sloc points to DELTA ------------------------------------------ -- 12.5.3 Formal Array Type Definition -- ------------------------------------------ -- FORMAL_ARRAY_TYPE_DEFINITION ::= ARRAY_TYPE_DEFINITION ------------------------------------------- -- 12.5.4 Formal Access Type Definition -- ------------------------------------------- -- FORMAL_ACCESS_TYPE_DEFINITION ::= ACCESS_TYPE_DEFINITION ---------------------------------------------- -- 12.5.5 Formal Interface Type Definition -- ---------------------------------------------- -- FORMAL_INTERFACE_TYPE_DEFINITION ::= INTERFACE_TYPE_DEFINITION ----------------------------------------- -- 12.6 Formal Subprogram Declaration -- ----------------------------------------- -- FORMAL_SUBPROGRAM_DECLARATION ::= -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION -- | FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION -------------------------------------------------- -- 12.6 Formal Concrete Subprogram Declaration -- -------------------------------------------------- -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::= -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT]; -- N_Formal_Concrete_Subprogram_Declaration -- Sloc points to WITH -- Specification (Node1) -- Default_Name (Node2) (set to Empty if no subprogram default) -- Box_Present (Flag15) -- Note: if no subprogram default is present, then Name is set -- to Empty, and Box_Present is False. -------------------------------------------------- -- 12.6 Formal Abstract Subprogram Declaration -- -------------------------------------------------- -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::= -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT]; -- N_Formal_Abstract_Subprogram_Declaration -- Sloc points to WITH -- Specification (Node1) -- Default_Name (Node2) (set to Empty if no subprogram default) -- Box_Present (Flag15) -- Note: if no subprogram default is present, then Name is set -- to Empty, and Box_Present is False. ------------------------------ -- 12.6 Subprogram Default -- ------------------------------ -- SUBPROGRAM_DEFAULT ::= DEFAULT_NAME | <> -- There is no separate node in the tree for a subprogram default. -- Instead the parent (N_Formal_Concrete_Subprogram_Declaration -- or N_Formal_Abstract_Subprogram_Declaration) node contains the -- default name or box indication, as needed. ------------------------ -- 12.6 Default Name -- ------------------------ -- DEFAULT_NAME ::= NAME -------------------------------------- -- 12.7 Formal Package Declaration -- -------------------------------------- -- FORMAL_PACKAGE_DECLARATION ::= -- with package DEFINING_IDENTIFIER -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART; -- Note: formal package declarations not allowed in Ada 83 mode -- N_Formal_Package_Declaration -- Sloc points to WITH -- Defining_Identifier (Node1) -- Name (Node2) -- Generic_Associations (List3) (set to No_List if (<>) case or -- empty generic actual part) -- Box_Present (Flag15) -- Instance_Spec (Node5-Sem) -- ABE_Is_Certain (Flag18-Sem) -------------------------------------- -- 12.7 Formal Package Actual Part -- -------------------------------------- -- FORMAL_PACKAGE_ACTUAL_PART ::= -- (<>) | [GENERIC_ACTUAL_PART] -- There is no explicit node in the tree for a formal package -- actual part. Instead the information appears in the parent node -- (i.e. the formal package declaration node itself). --------------------------------- -- 13.1 Representation clause -- --------------------------------- -- REPRESENTATION_CLAUSE ::= -- ATTRIBUTE_DEFINITION_CLAUSE -- | ENUMERATION_REPRESENTATION_CLAUSE -- | RECORD_REPRESENTATION_CLAUSE -- | AT_CLAUSE ---------------------- -- 13.1 Local Name -- ---------------------- -- LOCAL_NAME := -- DIRECT_NAME -- | DIRECT_NAME'ATTRIBUTE_DESIGNATOR -- | library_unit_NAME -- The construct DIRECT_NAME'ATTRIBUTE_DESIGNATOR appears in the tree -- as an attribute reference, which has essentially the same form. --------------------------------------- -- 13.3 Attribute definition clause -- --------------------------------------- -- ATTRIBUTE_DEFINITION_CLAUSE ::= -- for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use EXPRESSION; -- | for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use NAME; -- In Ada 83, the expression must be a simple expression and the -- local name must be a direct name. -- Note: the only attribute definition clause that is processed by -- gigi is an address clause. For all other cases, the information -- is extracted by the front end and either results in setting entity -- information, e.g. Esize for the Size clause, or in appropriate -- expansion actions (e.g. in the case of Storage_Size). -- For an address clause, Gigi constructs the appropriate addressing -- code. It also ensures that no aliasing optimizations are made -- for the object for which the address clause appears. -- Note: for an address clause used to achieve an overlay: -- A : Integer; -- B : Integer; -- for B'Address use A'Address; -- the above rule means that Gigi will ensure that no optimizations -- will be made for B that would violate the implementation advice -- of RM 13.3(19). However, this advice applies only to B and not -- to A, which seems unfortunate. The GNAT front end will mark the -- object A as volatile to also prevent unwanted optimization -- assumptions based on no aliasing being made for B. -- N_Attribute_Definition_Clause -- Sloc points to FOR -- Name (Node2) the local name -- Chars (Name1) the identifier name from the attribute designator -- Expression (Node3) the expression or name -- Next_Rep_Item (Node4-Sem) -- From_At_Mod (Flag4-Sem) -- Check_Address_Alignment (Flag11-Sem) --------------------------------------------- -- 13.4 Enumeration representation clause -- --------------------------------------------- -- ENUMERATION_REPRESENTATION_CLAUSE ::= -- for first_subtype_LOCAL_NAME use ENUMERATION_AGGREGATE; -- In Ada 83, the name must be a direct name -- N_Enumeration_Representation_Clause -- Sloc points to FOR -- Identifier (Node1) direct name -- Array_Aggregate (Node3) -- Next_Rep_Item (Node4-Sem) --------------------------------- -- 13.4 Enumeration aggregate -- --------------------------------- -- ENUMERATION_AGGREGATE ::= ARRAY_AGGREGATE ------------------------------------------ -- 13.5.1 Record representation clause -- ------------------------------------------ -- RECORD_REPRESENTATION_CLAUSE ::= -- for first_subtype_LOCAL_NAME use -- record [MOD_CLAUSE] -- {COMPONENT_CLAUSE} -- end record; -- Gigi restriction: Mod_Clause is always Empty (if present it is -- replaced by a corresponding Alignment attribute definition clause). -- Note: Component_Clauses can include pragmas -- N_Record_Representation_Clause -- Sloc points to FOR -- Identifier (Node1) direct name -- Mod_Clause (Node2) (set to Empty if no mod clause present) -- Component_Clauses (List3) -- Next_Rep_Item (Node4-Sem) ------------------------------ -- 13.5.1 Component clause -- ------------------------------ -- COMPONENT_CLAUSE ::= -- component_LOCAL_NAME at POSITION -- range FIRST_BIT .. LAST_BIT; -- N_Component_Clause -- Sloc points to AT -- Component_Name (Node1) points to Name or Attribute_Reference -- Position (Node2) -- First_Bit (Node3) -- Last_Bit (Node4) ---------------------- -- 13.5.1 Position -- ---------------------- -- POSITION ::= static_EXPRESSION ----------------------- -- 13.5.1 First_Bit -- ----------------------- -- FIRST_BIT ::= static_SIMPLE_EXPRESSION ---------------------- -- 13.5.1 Last_Bit -- ---------------------- -- LAST_BIT ::= static_SIMPLE_EXPRESSION -------------------------- -- 13.8 Code statement -- -------------------------- -- CODE_STATEMENT ::= QUALIFIED_EXPRESSION; -- Note: in GNAT, the qualified expression has the form -- Asm_Insn'(Asm (...)); -- or -- Asm_Insn'(Asm_Volatile (...)) -- See package System.Machine_Code in file s-maccod.ads for details -- on the allowed parameters to Asm[_Volatile]. There are two ways -- this node can arise, as a code statement, in which case the -- expression is the qualified expression, or as a result of the -- expansion of an intrinsic call to the Asm or Asm_Input procedure. -- N_Code_Statement -- Sloc points to first token of the expression -- Expression (Node3) -- Note: package Exp_Code contains an abstract functional interface -- for use by Gigi in accessing the data from N_Code_Statement nodes. ------------------------ -- 13.12 Restriction -- ------------------------ -- RESTRICTION ::= -- restriction_IDENTIFIER -- | restriction_parameter_IDENTIFIER => EXPRESSION -- There is no explicit node for restrictions. Instead the restriction -- appears in normal pragma syntax as a pragma argument association, -- which has the same syntactic form. -------------------------- -- B.2 Shift Operators -- -------------------------- -- Calls to the intrinsic shift functions are converted to one of -- the following shift nodes, which have the form of normal binary -- operator names. Note that for a given shift operation, one node -- covers all possible types, as for normal operators. -- Note: it is perfectly permissible for the expander to generate -- shift operation nodes directly, in which case they will be analyzed -- and parsed in the usual manner. -- Sprint syntax: shift-function-name!(expr, count) -- Note: the Left_Opnd field holds the first argument (the value to -- be shifted). The Right_Opnd field holds the second argument (the -- shift count). The Chars field is the name of the intrinsic function. -- N_Op_Rotate_Left -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK (Flag4-Sem) -- N_Op_Rotate_Right -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK (Flag4-Sem) -- N_Op_Shift_Left -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK (Flag4-Sem) -- N_Op_Shift_Right_Arithmetic -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK (Flag4-Sem) -- N_Op_Shift_Right -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK (Flag4-Sem) -------------------------- -- Obsolescent Features -- -------------------------- -- The syntax descriptions and tree nodes for obsolescent features are -- grouped together, corresponding to their location in appendix I in -- the RM. However, parsing and semantic analysis for these constructs -- is located in an appropriate chapter (see individual notes). --------------------------- -- J.3 Delta Constraint -- --------------------------- -- Note: the parse routine for this construct is located in section -- 3.5.9 of Par-Ch3, and semantic analysis is in Sem_Ch3, which is -- where delta constraint logically belongs. -- DELTA_CONSTRAINT ::= DELTA static_EXPRESSION [RANGE_CONSTRAINT] -- N_Delta_Constraint -- Sloc points to DELTA -- Delta_Expression (Node3) -- Range_Constraint (Node4) (set to Empty if not present) -------------------- -- J.7 At Clause -- -------------------- -- AT_CLAUSE ::= for DIRECT_NAME use at EXPRESSION; -- Note: the parse routine for this construct is located in Par-Ch13, -- and the semantic analysis is in Sem_Ch13, where at clause logically -- belongs if it were not obsolescent. -- Note: in Ada 83 the expression must be a simple expression -- Gigi restriction: This node never appears, it is rewritten as an -- address attribute definition clause. -- N_At_Clause -- Sloc points to FOR -- Identifier (Node1) -- Expression (Node3) --------------------- -- J.8 Mod clause -- --------------------- -- MOD_CLAUSE ::= at mod static_EXPRESSION; -- Note: the parse routine for this construct is located in Par-Ch13, -- and the semantic analysis is in Sem_Ch13, where mod clause logically -- belongs if it were not obsolescent. -- Note: in Ada 83, the expression must be a simple expression -- Gigi restriction: this node never appears. It is replaced -- by a corresponding Alignment attribute definition clause. -- Note: pragmas can appear before and after the MOD_CLAUSE since -- its name has "clause" in it. This is rather strange, but is quite -- definitely specified. The pragmas before are collected in the -- Pragmas_Before field of the mod clause node itself, and pragmas -- after are simply swallowed up in the list of component clauses. -- N_Mod_Clause -- Sloc points to AT -- Expression (Node3) -- Pragmas_Before (List4) Pragmas before mod clause (No_List if none) -------------------- -- Semantic Nodes -- -------------------- -- These semantic nodes are used to hold additional semantic information. -- They are inserted into the tree as a result of semantic processing. -- Although there are no legitimate source syntax constructions that -- correspond directly to these nodes, we need a source syntax for the -- reconstructed tree printed by Sprint, and the node descriptions here -- show this syntax. ---------------------------- -- Conditional Expression -- ---------------------------- -- This node is used to represent an expression corresponding to the -- C construct (condition ? then-expression : else_expression), where -- Expressions is a three element list, whose first expression is the -- condition, and whose second and third expressions are the then and -- else expressions respectively. -- Note: the Then_Actions and Else_Actions fields are always set to -- No_List in the tree passed to Gigi. These fields are used only -- for temporary processing purposes in the expander. -- Sprint syntax: (if expr then expr else expr) -- N_Conditional_Expression -- Sloc points to related node -- Expressions (List1) -- Then_Actions (List2-Sem) -- Else_Actions (List3-Sem) -- plus fields for expression -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the IF keyword in the Sprint file output. ------------------- -- Expanded_Name -- ------------------- -- The N_Expanded_Name node is used to represent a selected component -- name that has been resolved to an expanded name. The semantic phase -- replaces N_Selected_Component nodes that represent names by the use -- of this node, leaving the N_Selected_Component node used only when -- the prefix is a record or protected type. -- The fields of the N_Expanded_Name node are layed out identically -- to those of the N_Selected_Component node, allowing conversion of -- an expanded name node to a selected component node to be done -- easily, see Sinfo.CN.Change_Selected_Component_To_Expanded_Name. -- There is no special sprint syntax for an expanded name -- N_Expanded_Name -- Sloc points to the period -- Chars (Name1) copy of Chars field of selector name -- Prefix (Node3) -- Selector_Name (Node2) -- Entity (Node4-Sem) -- Associated_Node (Node4-Sem) -- Redundant_Use (Flag13-Sem) -- Has_Private_View (Flag11-Sem) set in generic units. -- plus fields for expression -------------------- -- Free Statement -- -------------------- -- The N_Free_Statement node is generated as a result of a call to an -- instantiation of Unchecked_Deallocation. The instantiation of this -- generic is handled specially and generates this node directly. -- Sprint syntax: free expression -- N_Free_Statement -- Sloc is copied from the unchecked deallocation call -- Expression (Node3) argument to unchecked deallocation call -- Storage_Pool (Node1-Sem) -- Procedure_To_Call (Node4-Sem) -- Actual_Designated_Subtype (Node2-Sem) -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the FREE keyword in the Sprint file output. ------------------- -- Freeze Entity -- ------------------- -- This node marks the point in a declarative part at which an entity -- declared therein becomes frozen. The expander places initialization -- procedures for types at those points. Gigi uses the freezing point -- to elaborate entities that may depend on previous private types. -- See the section in Einfo "Delayed Freezing and Elaboration" for -- a full description of the use of this node. -- The Entity field points back to the entity for the type (whose -- Freeze_Node field points back to this freeze node). -- The Actions field contains a list of declarations and statements -- generated by the expander which are associated with the freeze -- node, and are elaborated as though the freeze node were replaced -- by this sequence of actions. -- Note: the Sloc field in the freeze node references a construct -- associated with the freezing point. This is used for posting -- messages in some error/warning situations, e.g. the case where -- a primitive operation of a tagged type is declared too late. -- Sprint syntax: freeze entity-name [ -- freeze actions -- ] -- N_Freeze_Entity -- Sloc points near freeze point (see above special note) -- Entity (Node4-Sem) -- Access_Types_To_Process (Elist2-Sem) (set to No_Elist if none) -- TSS_Elist (Elist3-Sem) (set to No_Elist if no associated TSS's) -- Actions (List1) (set to No_List if no freeze actions) -- First_Subtype_Link (Node5-Sem) (set to Empty if no link) -- The Actions field holds actions associated with the freeze. These -- actions are elaborated at the point where the type is frozen. -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the FREEZE keyword in the Sprint file output. -------------------------------- -- Implicit Label Declaration -- -------------------------------- -- An implicit label declaration is created for every occurrence of a -- label on a statement or a label on a block or loop. It is chained -- in the declarations of the innermost enclosing block as specified -- in RM section 5.1 (3). -- The Defining_Identifier is the actual identifier for the -- statement identifier. Note that the occurrence of the label -- is a reference, NOT the defining occurrence. The defining -- occurrence occurs at the head of the innermost enclosing -- block, and is represented by this node. -- Note: from the grammar, this might better be called an implicit -- statement identifier declaration, but the term we choose seems -- friendlier, since at least informally statement identifiers are -- called labels in both cases (i.e. when used in labels, and when -- used as the identifiers of blocks and loops). -- Note: although this is logically a semantic node, since it does -- not correspond directly to a source syntax construction, these -- nodes are actually created by the parser in a post pass done just -- after parsing is complete, before semantic analysis is started (see -- the Par.Labl subunit in file par-labl.adb). -- Sprint syntax: labelname : label; -- N_Implicit_Label_Declaration -- Sloc points to the << of the label -- Defining_Identifier (Node1) -- Label_Construct (Node2-Sem) -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the label name in the generated declaration. --------------------- -- Itype_Reference -- --------------------- -- This node is used to create a reference to an Itype. The only -- purpose is to make sure that the Itype is defined if this is the -- first reference. -- A typical use of this node is when an Itype is to be referenced in -- two branches of an if statement. In this case it is important that -- the first use of the Itype not be inside the conditional, since -- then it might not be defined if the wrong branch of the if is -- taken in the case where the definition generates elaboration code. -- The Itype field points to the referenced Itype -- sprint syntax: reference itype-name -- N_Itype_Reference -- Sloc points to the node generating the reference -- Itype (Node1-Sem) -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the REFERENCE keyword in the file output. --------------------- -- Raise_xxx_Error -- --------------------- -- One of these nodes is created during semantic analysis to replace -- a node for an expression that is determined to definitely raise -- the corresponding exception. -- The N_Raise_xxx_Error node may also stand alone in place -- of a declaration or statement, in which case it simply causes -- the exception to be raised (i.e. it is equivalent to a raise -- statement that raises the corresponding exception). This use -- is distinguished by the fact that the Etype in this case is -- Standard_Void_Type, In the subexprssion case, the Etype is the -- same as the type of the subexpression which it replaces. -- If Condition is empty, then the raise is unconditional. If the -- Condition field is non-empty, it is a boolean expression which -- is first evaluated, and the exception is raised only if the -- value of the expression is True. In the unconditional case, the -- creation of this node is usually accompanied by a warning message -- error. The creation of this node will usually be accompanied by a -- message (unless it appears within the right operand of a short -- circuit form whose left argument is static and decisively -- eliminates elaboration of the raise operation. -- The exception is generated with a message that contains the -- file name and line number, and then appended text. The Reason -- code shows the text to be added. The Reason code is an element -- of the type Types.RT_Exception_Code, and indicates both the -- message to be added, and the exception to be raised (which must -- match the node type). The value is stored by storing a Uint which -- is the Pos value of the enumeration element in this type. -- Gigi restriction: This expander ensures that the type of the -- Condition field is always Standard.Boolean, even if the type -- in the source is some non-standard boolean type. -- Sprint syntax: [xxx_error "msg"] -- or: [xxx_error when condition "msg"] -- N_Raise_Constraint_Error -- Sloc references related construct -- Condition (Node1) (set to Empty if no condition) -- Reason (Uint3) -- plus fields for expression -- N_Raise_Program_Error -- Sloc references related construct -- Condition (Node1) (set to Empty if no condition) -- Reason (Uint3) -- plus fields for expression -- N_Raise_Storage_Error -- Sloc references related construct -- Condition (Node1) (set to Empty if no condition) -- Reason (Uint3) -- plus fields for expression -- Note: Sloc is copied from the expression generating the exception. -- In the case where a debug source file is generated, the Sloc for -- this node points to the left bracket in the Sprint file output. --------------- -- Reference -- --------------- -- For a number of purposes, we need to construct references to objects. -- These references are subsequently treated as normal access values. -- An example is the construction of the parameter block passed to a -- task entry. The N_Reference node is provided for this purpose. It is -- similar in effect to the use of the Unrestricted_Access attribute, -- and like Unrestricted_Access can be applied to objects which would -- not be valid prefixes for the Unchecked_Access attribute (e.g. -- objects which are not aliased, and slices). In addition it can be -- applied to composite type values as well as objects, including string -- values and aggregates. -- Note: we use the Prefix field for this expression so that the -- resulting node can be treated using common code with the attribute -- nodes for the 'Access and related attributes. Logically it would make -- more sense to call it an Expression field, but then we would have to -- special case the treatment of the N_Reference node. -- Sprint syntax: prefix'reference -- N_Reference -- Sloc is copied from the expression -- Prefix (Node3) -- plus fields for expression -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the quote in the Sprint file output. --------------------- -- Subprogram_Info -- --------------------- -- This node generates the appropriate Subprogram_Info value for a -- given procedure. See Ada.Exceptions for further details -- Sprint syntax: subprog'subprogram_info -- N_Subprogram_Info -- Sloc points to the entity for the procedure -- Identifier (Node1) identifier referencing the procedure -- Etype (Node5-Sem) type (always set to Ada.Exceptions.Code_Loc -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the quote in the Sprint file output. -------------------------- -- Unchecked Expression -- -------------------------- -- An unchecked expression is one that must be analyzed and resolved -- with all checks off, regardless of the current setting of scope -- suppress flags. -- Sprint syntax: `(expression) -- Note: this node is always removed from the tree (and replaced by -- its constituent expression) on completion of analysis, so it only -- appears in intermediate trees, and will never be seen by Gigi. -- N_Unchecked_Expression -- Sloc is a copy of the Sloc of the expression -- Expression (Node3) -- plus fields for expression -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the back quote in the Sprint file output. ------------------------------- -- Unchecked Type Conversion -- ------------------------------- -- An unchecked type conversion node represents the semantic action -- corresponding to a call to an instantiation of Unchecked_Conversion. -- It is generated as a result of actual use of Unchecked_Conversion -- and also the expander generates unchecked type conversion nodes -- directly for expansion of complex semantic actions. -- Note: an unchecked type conversion is a variable as far as the -- semantics are concerned, which is convenient for the expander. -- This does not change what Ada source programs are legal, since -- clearly a function call to an instantiation of Unchecked_Conversion -- is not a variable in any case. -- Sprint syntax: subtype-mark!(expression) -- N_Unchecked_Type_Conversion -- Sloc points to related node in source -- Subtype_Mark (Node4) -- Expression (Node3) -- Kill_Range_Check (Flag11-Sem) -- No_Truncation (Flag17-Sem) -- plus fields for expression -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the exclamation in the Sprint file output. ----------------------------------- -- Validate_Unchecked_Conversion -- ----------------------------------- -- The front end does most of the validation of unchecked conversion, -- including checking sizes (this is done after the back end is called -- to take advantage of back-annotation of calculated sizes). -- The front end also deals with specific cases that are not allowed -- e.g. involving unconstrained array types. -- For the case of the standard gigi backend, this means that all -- checks are done in the front-end. -- However, in the case of specialized back-ends, notably the JVM -- backend for JGNAT, additional requirements and restrictions apply -- to unchecked conversion, and these are most conveniently performed -- in the specialized back-end. -- To accommodate this requirement, for such back ends, the following -- special node is generated recording an unchecked conversion that -- needs to be validated. The back end should post an appropriate -- error message if the unchecked conversion is invalid or warrants -- a special warning message. -- Source_Type and Target_Type point to the entities for the two -- types involved in the unchecked conversion instantiation that -- is to be validated. -- Sprint syntax: validate Unchecked_Conversion (source, target); -- N_Validate_Unchecked_Conversion -- Sloc points to instantiation (location for warning message) -- Source_Type (Node1-Sem) -- Target_Type (Node2-Sem) -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the VALIDATE keyword in the file output. ----------- -- Empty -- ----------- -- Used as the contents of the Nkind field of the dummy Empty node -- and in some other situations to indicate an uninitialized value. -- N_Empty -- Chars (Name1) is set to No_Name ----------- -- Error -- ----------- -- Used as the contents of the Nkind field of the dummy Error node. -- Has an Etype field, which gets set to Any_Type later on, to help -- error recovery (Error_Posted is also set in the Error node). -- N_Error -- Chars (Name1) is set to Error_Name -- Etype (Node5-Sem) -------------------------- -- Node Type Definition -- -------------------------- -- The following is the definition of the Node_Kind type. As previously -- discussed, this is separated off to allow rearrangement of the order -- to facilitiate definition of subtype ranges. The comments show the -- subtype classes which apply to each set of node kinds. The first -- entry in the comment characterizes the following list of nodes. type Node_Kind is ( N_Unused_At_Start, -- N_Representation_Clause N_At_Clause, N_Component_Clause, N_Enumeration_Representation_Clause, N_Mod_Clause, N_Record_Representation_Clause, -- N_Representation_Clause, N_Has_Chars N_Attribute_Definition_Clause, -- N_Has_Chars N_Empty, N_Pragma, N_Pragma_Argument_Association, -- N_Has_Etype N_Error, -- N_Entity, N_Has_Etype, N_Has_Chars N_Defining_Character_Literal, N_Defining_Identifier, N_Defining_Operator_Symbol, -- N_Subexpr, N_Has_Etype, N_Has_Chars, N_Has_Entity N_Expanded_Name, -- N_Direct_Name, N_Subexpr, N_Has_Etype, -- N_Has_Chars, N_Has_Entity N_Identifier, N_Operator_Symbol, -- N_Direct_Name, N_Subexpr, N_Has_Etype, -- N_Has_Chars, N_Has_Entity N_Character_Literal, -- N_Binary_Op, N_Op, N_Subexpr, -- N_Has_Etype, N_Has_Chars, N_Has_Entity N_Op_Add, N_Op_Concat, N_Op_Expon, N_Op_Subtract, -- N_Binary_Op, N_Op, N_Subexpr, N_Has_Treat_Fixed_As_Integer -- N_Has_Etype, N_Has_Chars, N_Has_Entity N_Op_Divide, N_Op_Mod, N_Op_Multiply, N_Op_Rem, -- N_Binary_Op, N_Op, N_Subexpr, N_Has_Etype -- N_Has_Entity, N_Has_Chars, N_Op_Boolean N_Op_And, -- N_Binary_Op, N_Op, N_Subexpr, N_Has_Etype -- N_Has_Entity, N_Has_Chars, N_Op_Boolean, N_Op_Compare N_Op_Eq, N_Op_Ge, N_Op_Gt, N_Op_Le, N_Op_Lt, N_Op_Ne, -- N_Binary_Op, N_Op, N_Subexpr, N_Has_Etype -- N_Has_Entity, N_Has_Chars, N_Op_Boolean N_Op_Or, N_Op_Xor, -- N_Binary_Op, N_Op, N_Subexpr, N_Has_Etype, -- N_Op_Shift, N_Has_Chars, N_Has_Entity N_Op_Rotate_Left, N_Op_Rotate_Right, N_Op_Shift_Left, N_Op_Shift_Right, N_Op_Shift_Right_Arithmetic, -- N_Unary_Op, N_Op, N_Subexpr, N_Has_Etype, -- N_Has_Chars, N_Has_Entity N_Op_Abs, N_Op_Minus, N_Op_Not, N_Op_Plus, -- N_Subexpr, N_Has_Etype, N_Has_Entity N_Attribute_Reference, -- N_Subexpr, N_Has_Etype N_And_Then, N_Conditional_Expression, N_Explicit_Dereference, N_Function_Call, N_In, N_Indexed_Component, N_Integer_Literal, N_Not_In, N_Null, N_Or_Else, N_Procedure_Call_Statement, N_Qualified_Expression, -- N_Raise_xxx_Error, N_Subexpr, N_Has_Etype N_Raise_Constraint_Error, N_Raise_Program_Error, N_Raise_Storage_Error, -- N_Subexpr, N_Has_Etype N_Aggregate, N_Allocator, N_Extension_Aggregate, N_Range, N_Real_Literal, N_Reference, N_Selected_Component, N_Slice, N_String_Literal, N_Subprogram_Info, N_Type_Conversion, N_Unchecked_Expression, N_Unchecked_Type_Conversion, -- N_Has_Etype N_Subtype_Indication, -- N_Declaration N_Component_Declaration, N_Entry_Declaration, N_Formal_Object_Declaration, N_Formal_Type_Declaration, N_Full_Type_Declaration, N_Incomplete_Type_Declaration, N_Loop_Parameter_Specification, N_Object_Declaration, N_Protected_Type_Declaration, N_Private_Extension_Declaration, N_Private_Type_Declaration, N_Subtype_Declaration, -- N_Subprogram_Specification, N_Declaration N_Function_Specification, N_Procedure_Specification, -- N_Access_To_Subprogram_Definition N_Access_Function_Definition, N_Access_Procedure_Definition, -- N_Later_Decl_Item N_Task_Type_Declaration, -- N_Body_Stub, N_Later_Decl_Item N_Package_Body_Stub, N_Protected_Body_Stub, N_Subprogram_Body_Stub, N_Task_Body_Stub, -- N_Generic_Instantiation, N_Later_Decl_Item -- N_Subprogram_Instantiation N_Function_Instantiation, N_Procedure_Instantiation, -- N_Generic_Instantiation, N_Later_Decl_Item N_Package_Instantiation, -- N_Unit_Body, N_Later_Decl_Item, N_Proper_Body N_Package_Body, N_Subprogram_Body, -- N_Later_Decl_Item, N_Proper_Body N_Protected_Body, N_Task_Body, -- N_Later_Decl_Item N_Implicit_Label_Declaration, N_Package_Declaration, N_Single_Task_Declaration, N_Subprogram_Declaration, N_Use_Package_Clause, -- N_Generic_Declaration, N_Later_Decl_Item N_Generic_Package_Declaration, N_Generic_Subprogram_Declaration, -- N_Array_Type_Definition N_Constrained_Array_Definition, N_Unconstrained_Array_Definition, -- N_Renaming_Declaration N_Exception_Renaming_Declaration, N_Object_Renaming_Declaration, N_Package_Renaming_Declaration, N_Subprogram_Renaming_Declaration, -- N_Generic_Renaming_Declaration, N_Renaming_Declaration N_Generic_Function_Renaming_Declaration, N_Generic_Package_Renaming_Declaration, N_Generic_Procedure_Renaming_Declaration, -- N_Statement_Other_Than_Procedure_Call N_Abort_Statement, N_Accept_Statement, N_Assignment_Statement, N_Asynchronous_Select, N_Block_Statement, N_Case_Statement, N_Code_Statement, N_Conditional_Entry_Call, -- N_Statement_Other_Than_Procedure_Call. N_Delay_Statement N_Delay_Relative_Statement, N_Delay_Until_Statement, -- N_Statement_Other_Than_Procedure_Call N_Entry_Call_Statement, N_Free_Statement, N_Goto_Statement, N_Loop_Statement, N_Null_Statement, N_Raise_Statement, N_Requeue_Statement, N_Return_Statement, N_Selective_Accept, N_Timed_Entry_Call, -- N_Statement_Other_Than_Procedure_Call, N_Has_Condition N_Exit_Statement, N_If_Statement, -- N_Has_Condition N_Accept_Alternative, N_Delay_Alternative, N_Elsif_Part, N_Entry_Body_Formal_Part, N_Iteration_Scheme, N_Terminate_Alternative, -- N_Formal_Subprogram_Declaration N_Formal_Abstract_Subprogram_Declaration, N_Formal_Concrete_Subprogram_Declaration, -- Other nodes (not part of any subtype class) N_Abortable_Part, N_Abstract_Subprogram_Declaration, N_Access_Definition, N_Access_To_Object_Definition, N_Case_Statement_Alternative, N_Compilation_Unit, N_Compilation_Unit_Aux, N_Component_Association, N_Component_Definition, N_Component_List, N_Derived_Type_Definition, N_Decimal_Fixed_Point_Definition, N_Defining_Program_Unit_Name, N_Delta_Constraint, N_Designator, N_Digits_Constraint, N_Discriminant_Association, N_Discriminant_Specification, N_Enumeration_Type_Definition, N_Entry_Body, N_Entry_Call_Alternative, N_Entry_Index_Specification, N_Exception_Declaration, N_Exception_Handler, N_Floating_Point_Definition, N_Formal_Decimal_Fixed_Point_Definition, N_Formal_Derived_Type_Definition, N_Formal_Discrete_Type_Definition, N_Formal_Floating_Point_Definition, N_Formal_Modular_Type_Definition, N_Formal_Ordinary_Fixed_Point_Definition, N_Formal_Package_Declaration, N_Formal_Private_Type_Definition, N_Formal_Signed_Integer_Type_Definition, N_Freeze_Entity, N_Generic_Association, N_Handled_Sequence_Of_Statements, N_Index_Or_Discriminant_Constraint, N_Itype_Reference, N_Label, N_Modular_Type_Definition, N_Number_Declaration, N_Ordinary_Fixed_Point_Definition, N_Others_Choice, N_Package_Specification, N_Parameter_Association, N_Parameter_Specification, N_Protected_Definition, N_Range_Constraint, N_Real_Range_Specification, N_Record_Definition, N_Signed_Integer_Type_Definition, N_Single_Protected_Declaration, N_Subunit, N_Task_Definition, N_Triggering_Alternative, N_Use_Type_Clause, N_Validate_Unchecked_Conversion, N_Variant, N_Variant_Part, N_With_Clause, N_With_Type_Clause, N_Unused_At_End); for Node_Kind'Size use 8; -- The data structures in Atree assume this! ---------------------------- -- Node Class Definitions -- ---------------------------- subtype N_Access_To_Subprogram_Definition is Node_Kind range N_Access_Function_Definition .. N_Access_Procedure_Definition; subtype N_Array_Type_Definition is Node_Kind range N_Constrained_Array_Definition .. N_Unconstrained_Array_Definition; subtype N_Binary_Op is Node_Kind range N_Op_Add .. N_Op_Shift_Right_Arithmetic; subtype N_Body_Stub is Node_Kind range N_Package_Body_Stub .. N_Task_Body_Stub; subtype N_Declaration is Node_Kind range N_Component_Declaration .. N_Procedure_Specification; -- Note: this includes all constructs normally thought of as declarations -- except those which are separately grouped as later declarations. subtype N_Delay_Statement is Node_Kind range N_Delay_Relative_Statement .. N_Delay_Until_Statement; subtype N_Direct_Name is Node_Kind range N_Identifier .. N_Character_Literal; subtype N_Entity is Node_Kind range N_Defining_Character_Literal .. N_Defining_Operator_Symbol; subtype N_Formal_Subprogram_Declaration is Node_Kind range N_Formal_Abstract_Subprogram_Declaration .. N_Formal_Concrete_Subprogram_Declaration; subtype N_Generic_Declaration is Node_Kind range N_Generic_Package_Declaration .. N_Generic_Subprogram_Declaration; subtype N_Generic_Instantiation is Node_Kind range N_Function_Instantiation .. N_Package_Instantiation; subtype N_Generic_Renaming_Declaration is Node_Kind range N_Generic_Function_Renaming_Declaration .. N_Generic_Procedure_Renaming_Declaration; subtype N_Has_Chars is Node_Kind range N_Attribute_Definition_Clause .. N_Op_Plus; subtype N_Has_Entity is Node_Kind range N_Expanded_Name .. N_Attribute_Reference; -- Nodes that have Entity fields -- Warning: DOES NOT INCLUDE N_Freeze_Entity! subtype N_Has_Etype is Node_Kind range N_Error .. N_Subtype_Indication; subtype N_Has_Treat_Fixed_As_Integer is Node_Kind range N_Op_Divide .. N_Op_Rem; subtype N_Later_Decl_Item is Node_Kind range N_Task_Type_Declaration .. N_Generic_Subprogram_Declaration; -- Note: this is Ada 83 relevant only (see Ada 83 RM 3.9 (2)) and -- includes only those items which can appear as later declarative -- items. This also includes N_Implicit_Label_Declaration which is -- not specifically in the grammar but may appear as a valid later -- declarative items. It does NOT include N_Pragma which can also -- appear among later declarative items. It does however include -- N_Protected_Body, which is a bit peculiar, but harmless since -- this cannot appear in Ada 83 mode anyway. subtype N_Op is Node_Kind range N_Op_Add .. N_Op_Plus; subtype N_Op_Boolean is Node_Kind range N_Op_And .. N_Op_Xor; -- Binary operators which take operands of a boolean type, and yield -- a result of a boolean type. subtype N_Op_Compare is Node_Kind range N_Op_Eq .. N_Op_Ne; subtype N_Op_Shift is Node_Kind range N_Op_Rotate_Left .. N_Op_Shift_Right_Arithmetic; subtype N_Proper_Body is Node_Kind range N_Package_Body .. N_Task_Body; subtype N_Raise_xxx_Error is Node_Kind range N_Raise_Constraint_Error .. N_Raise_Storage_Error; subtype N_Renaming_Declaration is Node_Kind range N_Exception_Renaming_Declaration .. N_Generic_Procedure_Renaming_Declaration; subtype N_Representation_Clause is Node_Kind range N_At_Clause .. N_Attribute_Definition_Clause; subtype N_Statement_Other_Than_Procedure_Call is Node_Kind range N_Abort_Statement .. N_If_Statement; -- Note that this includes all statement types except for the cases of the -- N_Procedure_Call_Statement which is considered to be a subexpression -- (since overloading is possible, so it needs to go through the normal -- overloading resolution for expressions). subtype N_Subprogram_Instantiation is Node_Kind range N_Function_Instantiation .. N_Procedure_Instantiation; subtype N_Has_Condition is Node_Kind range N_Exit_Statement .. N_Terminate_Alternative; -- Nodes with condition fields (does not include N_Raise_xxx_Error) subtype N_Subexpr is Node_Kind range N_Expanded_Name .. N_Unchecked_Type_Conversion; -- Nodes with expression fields subtype N_Subprogram_Specification is Node_Kind range N_Function_Specification .. N_Procedure_Specification; subtype N_Unary_Op is Node_Kind range N_Op_Abs .. N_Op_Plus; subtype N_Unit_Body is Node_Kind range N_Package_Body .. N_Subprogram_Body; --------------------------- -- Node Access Functions -- --------------------------- -- The following functions return the contents of the indicated field of -- the node referenced by the argument, which is a Node_Id. They provide -- logical access to fields in the node which could be accessed using the -- Atree.Unchecked_Access package, but the idea is always to use these -- higher level routines which preserve strong typing. In debug mode, -- these routines check that they are being applied to an appropriate -- node, as well as checking that the node is in range. function ABE_Is_Certain (N : Node_Id) return Boolean; -- Flag18 function Abort_Present (N : Node_Id) return Boolean; -- Flag15 function Abortable_Part (N : Node_Id) return Node_Id; -- Node2 function Abstract_Present (N : Node_Id) return Boolean; -- Flag4 function Accept_Handler_Records (N : Node_Id) return List_Id; -- List5 function Accept_Statement (N : Node_Id) return Node_Id; -- Node2 function Access_Definition (N : Node_Id) return Node_Id; -- Node3 function Access_To_Subprogram_Definition (N : Node_Id) return Node_Id; -- Node3 function Access_Types_To_Process (N : Node_Id) return Elist_Id; -- Elist2 function Actions (N : Node_Id) return List_Id; -- List1 function Activation_Chain_Entity (N : Node_Id) return Node_Id; -- Node3 function Acts_As_Spec (N : Node_Id) return Boolean; -- Flag4 function Actual_Designated_Subtype (N : Node_Id) return Node_Id; -- Node2 function Aggregate_Bounds (N : Node_Id) return Node_Id; -- Node3 function Aliased_Present (N : Node_Id) return Boolean; -- Flag4 function All_Others (N : Node_Id) return Boolean; -- Flag11 function All_Present (N : Node_Id) return Boolean; -- Flag15 function Alternatives (N : Node_Id) return List_Id; -- List4 function Ancestor_Part (N : Node_Id) return Node_Id; -- Node3 function Array_Aggregate (N : Node_Id) return Node_Id; -- Node3 function Assignment_OK (N : Node_Id) return Boolean; -- Flag15 function Associated_Node (N : Node_Id) return Node_Id; -- Node4 function At_End_Proc (N : Node_Id) return Node_Id; -- Node1 function Attribute_Name (N : Node_Id) return Name_Id; -- Name2 function Aux_Decls_Node (N : Node_Id) return Node_Id; -- Node5 function Backwards_OK (N : Node_Id) return Boolean; -- Flag6 function Bad_Is_Detected (N : Node_Id) return Boolean; -- Flag15 function By_Ref (N : Node_Id) return Boolean; -- Flag5 function Body_Required (N : Node_Id) return Boolean; -- Flag13 function Body_To_Inline (N : Node_Id) return Node_Id; -- Node3 function Box_Present (N : Node_Id) return Boolean; -- Flag15 function Char_Literal_Value (N : Node_Id) return Uint; -- Uint2 function Chars (N : Node_Id) return Name_Id; -- Name1 function Check_Address_Alignment (N : Node_Id) return Boolean; -- Flag11 function Choice_Parameter (N : Node_Id) return Node_Id; -- Node2 function Choices (N : Node_Id) return List_Id; -- List1 function Compile_Time_Known_Aggregate (N : Node_Id) return Boolean; -- Flag18 function Component_Associations (N : Node_Id) return List_Id; -- List2 function Component_Clauses (N : Node_Id) return List_Id; -- List3 function Component_Definition (N : Node_Id) return Node_Id; -- Node4 function Component_Items (N : Node_Id) return List_Id; -- List3 function Component_List (N : Node_Id) return Node_Id; -- Node1 function Component_Name (N : Node_Id) return Node_Id; -- Node1 function Condition (N : Node_Id) return Node_Id; -- Node1 function Condition_Actions (N : Node_Id) return List_Id; -- List3 function Config_Pragmas (N : Node_Id) return List_Id; -- List4 function Constant_Present (N : Node_Id) return Boolean; -- Flag17 function Constraint (N : Node_Id) return Node_Id; -- Node3 function Constraints (N : Node_Id) return List_Id; -- List1 function Context_Installed (N : Node_Id) return Boolean; -- Flag13 function Context_Items (N : Node_Id) return List_Id; -- List1 function Controlling_Argument (N : Node_Id) return Node_Id; -- Node1 function Conversion_OK (N : Node_Id) return Boolean; -- Flag14 function Corresponding_Body (N : Node_Id) return Node_Id; -- Node5 function Corresponding_Formal_Spec (N : Node_Id) return Node_Id; -- Node3 function Corresponding_Generic_Association (N : Node_Id) return Node_Id; -- Node5 function Corresponding_Integer_Value (N : Node_Id) return Uint; -- Uint4 function Corresponding_Spec (N : Node_Id) return Node_Id; -- Node5 function Corresponding_Stub (N : Node_Id) return Node_Id; -- Node3 function Dcheck_Function (N : Node_Id) return Entity_Id; -- Node5 function Debug_Statement (N : Node_Id) return Node_Id; -- Node3 function Declarations (N : Node_Id) return List_Id; -- List2 function Default_Expression (N : Node_Id) return Node_Id; -- Node5 function Default_Name (N : Node_Id) return Node_Id; -- Node2 function Defining_Identifier (N : Node_Id) return Entity_Id; -- Node1 function Defining_Unit_Name (N : Node_Id) return Node_Id; -- Node1 function Delay_Alternative (N : Node_Id) return Node_Id; -- Node4 function Delay_Finalize_Attach (N : Node_Id) return Boolean; -- Flag14 function Delay_Statement (N : Node_Id) return Node_Id; -- Node2 function Delta_Expression (N : Node_Id) return Node_Id; -- Node3 function Digits_Expression (N : Node_Id) return Node_Id; -- Node2 function Discr_Check_Funcs_Built (N : Node_Id) return Boolean; -- Flag11 function Discrete_Choices (N : Node_Id) return List_Id; -- List4 function Discrete_Range (N : Node_Id) return Node_Id; -- Node4 function Discrete_Subtype_Definition (N : Node_Id) return Node_Id; -- Node4 function Discrete_Subtype_Definitions (N : Node_Id) return List_Id; -- List2 function Discriminant_Specifications (N : Node_Id) return List_Id; -- List4 function Discriminant_Type (N : Node_Id) return Node_Id; -- Node5 function Do_Accessibility_Check (N : Node_Id) return Boolean; -- Flag13 function Do_Discriminant_Check (N : Node_Id) return Boolean; -- Flag13 function Do_Division_Check (N : Node_Id) return Boolean; -- Flag13 function Do_Length_Check (N : Node_Id) return Boolean; -- Flag4 function Do_Overflow_Check (N : Node_Id) return Boolean; -- Flag17 function Do_Range_Check (N : Node_Id) return Boolean; -- Flag9 function Do_Storage_Check (N : Node_Id) return Boolean; -- Flag17 function Do_Tag_Check (N : Node_Id) return Boolean; -- Flag13 function Elaborate_All_Desirable (N : Node_Id) return Boolean; -- Flag9 function Elaborate_All_Present (N : Node_Id) return Boolean; -- Flag14 function Elaborate_Desirable (N : Node_Id) return Boolean; -- Flag11 function Elaborate_Present (N : Node_Id) return Boolean; -- Flag4 function Elaboration_Boolean (N : Node_Id) return Node_Id; -- Node2 function Else_Actions (N : Node_Id) return List_Id; -- List3 function Else_Statements (N : Node_Id) return List_Id; -- List4 function Elsif_Parts (N : Node_Id) return List_Id; -- List3 function Enclosing_Variant (N : Node_Id) return Node_Id; -- Node2 function End_Label (N : Node_Id) return Node_Id; -- Node4 function End_Span (N : Node_Id) return Uint; -- Uint5 function Entity (N : Node_Id) return Node_Id; -- Node4 function Entity_Or_Associated_Node (N : Node_Id) return Node_Id; -- Node4 function Entry_Body_Formal_Part (N : Node_Id) return Node_Id; -- Node5 function Entry_Call_Alternative (N : Node_Id) return Node_Id; -- Node1 function Entry_Call_Statement (N : Node_Id) return Node_Id; -- Node1 function Entry_Direct_Name (N : Node_Id) return Node_Id; -- Node1 function Entry_Index (N : Node_Id) return Node_Id; -- Node5 function Entry_Index_Specification (N : Node_Id) return Node_Id; -- Node4 function Etype (N : Node_Id) return Node_Id; -- Node5 function Exception_Choices (N : Node_Id) return List_Id; -- List4 function Exception_Handlers (N : Node_Id) return List_Id; -- List5 function Exception_Junk (N : Node_Id) return Boolean; -- Flag7 function Explicit_Actual_Parameter (N : Node_Id) return Node_Id; -- Node3 function Expansion_Delayed (N : Node_Id) return Boolean; -- Flag11 function Explicit_Generic_Actual_Parameter (N : Node_Id) return Node_Id; -- Node1 function Expression (N : Node_Id) return Node_Id; -- Node3 function Expressions (N : Node_Id) return List_Id; -- List1 function First_Bit (N : Node_Id) return Node_Id; -- Node3 function First_Inlined_Subprogram (N : Node_Id) return Entity_Id; -- Node3 function First_Name (N : Node_Id) return Boolean; -- Flag5 function First_Named_Actual (N : Node_Id) return Node_Id; -- Node4 function First_Real_Statement (N : Node_Id) return Node_Id; -- Node2 function First_Subtype_Link (N : Node_Id) return Entity_Id; -- Node5 function Float_Truncate (N : Node_Id) return Boolean; -- Flag11 function Formal_Type_Definition (N : Node_Id) return Node_Id; -- Node3 function Forwards_OK (N : Node_Id) return Boolean; -- Flag5 function From_At_Mod (N : Node_Id) return Boolean; -- Flag4 function From_Default (N : Node_Id) return Boolean; -- Flag6 function Generic_Associations (N : Node_Id) return List_Id; -- List3 function Generic_Formal_Declarations (N : Node_Id) return List_Id; -- List2 function Generic_Parent (N : Node_Id) return Node_Id; -- Node5 function Generic_Parent_Type (N : Node_Id) return Node_Id; -- Node4 function Handled_Statement_Sequence (N : Node_Id) return Node_Id; -- Node4 function Handler_List_Entry (N : Node_Id) return Node_Id; -- Node2 function Has_Created_Identifier (N : Node_Id) return Boolean; -- Flag15 function Has_Dynamic_Length_Check (N : Node_Id) return Boolean; -- Flag10 function Has_Dynamic_Range_Check (N : Node_Id) return Boolean; -- Flag12 function Has_No_Elaboration_Code (N : Node_Id) return Boolean; -- Flag17 function Has_Priority_Pragma (N : Node_Id) return Boolean; -- Flag6 function Has_Private_View (N : Node_Id) return Boolean; -- Flag11 function Has_Storage_Size_Pragma (N : Node_Id) return Boolean; -- Flag5 function Has_Task_Info_Pragma (N : Node_Id) return Boolean; -- Flag7 function Has_Task_Name_Pragma (N : Node_Id) return Boolean; -- Flag8 function Has_Wide_Character (N : Node_Id) return Boolean; -- Flag11 function Hidden_By_Use_Clause (N : Node_Id) return Elist_Id; -- Elist4 function High_Bound (N : Node_Id) return Node_Id; -- Node2 function Identifier (N : Node_Id) return Node_Id; -- Node1 function Interface_List (N : Node_Id) return List_Id; -- List2 function Interface_Present (N : Node_Id) return Boolean; -- Flag16 function Implicit_With (N : Node_Id) return Boolean; -- Flag16 function In_Present (N : Node_Id) return Boolean; -- Flag15 function Includes_Infinities (N : Node_Id) return Boolean; -- Flag11 function Instance_Spec (N : Node_Id) return Node_Id; -- Node5 function Intval (N : Node_Id) return Uint; -- Uint3 function Is_Asynchronous_Call_Block (N : Node_Id) return Boolean; -- Flag7 function Is_Component_Left_Opnd (N : Node_Id) return Boolean; -- Flag13 function Is_Component_Right_Opnd (N : Node_Id) return Boolean; -- Flag14 function Is_Controlling_Actual (N : Node_Id) return Boolean; -- Flag16 function Is_In_Discriminant_Check (N : Node_Id) return Boolean; -- Flag11 function Is_Machine_Number (N : Node_Id) return Boolean; -- Flag11 function Is_Null_Loop (N : Node_Id) return Boolean; -- Flag16 function Is_Overloaded (N : Node_Id) return Boolean; -- Flag5 function Is_Power_Of_2_For_Shift (N : Node_Id) return Boolean; -- Flag13 function Is_Protected_Subprogram_Body (N : Node_Id) return Boolean; -- Flag7 function Is_Static_Expression (N : Node_Id) return Boolean; -- Flag6 function Is_Subprogram_Descriptor (N : Node_Id) return Boolean; -- Flag16 function Is_Task_Allocation_Block (N : Node_Id) return Boolean; -- Flag6 function Is_Task_Master (N : Node_Id) return Boolean; -- Flag5 function Iteration_Scheme (N : Node_Id) return Node_Id; -- Node2 function Itype (N : Node_Id) return Entity_Id; -- Node1 function Kill_Range_Check (N : Node_Id) return Boolean; -- Flag11 function Label_Construct (N : Node_Id) return Node_Id; -- Node2 function Left_Opnd (N : Node_Id) return Node_Id; -- Node2 function Last_Bit (N : Node_Id) return Node_Id; -- Node4 function Last_Name (N : Node_Id) return Boolean; -- Flag6 function Library_Unit (N : Node_Id) return Node_Id; -- Node4 function Limited_View_Installed (N : Node_Id) return Boolean; -- Flag18 function Limited_Present (N : Node_Id) return Boolean; -- Flag17 function Literals (N : Node_Id) return List_Id; -- List1 function Loop_Actions (N : Node_Id) return List_Id; -- List2 function Loop_Parameter_Specification (N : Node_Id) return Node_Id; -- Node4 function Low_Bound (N : Node_Id) return Node_Id; -- Node1 function Mod_Clause (N : Node_Id) return Node_Id; -- Node2 function More_Ids (N : Node_Id) return Boolean; -- Flag5 function Must_Be_Byte_Aligned (N : Node_Id) return Boolean; -- Flag14 function Must_Not_Freeze (N : Node_Id) return Boolean; -- Flag8 function Must_Not_Override (N : Node_Id) return Boolean; -- Flag15 function Must_Override (N : Node_Id) return Boolean; -- Flag14 function Name (N : Node_Id) return Node_Id; -- Node2 function Names (N : Node_Id) return List_Id; -- List2 function Next_Entity (N : Node_Id) return Node_Id; -- Node2 function Next_Named_Actual (N : Node_Id) return Node_Id; -- Node4 function Next_Rep_Item (N : Node_Id) return Node_Id; -- Node4 function Next_Use_Clause (N : Node_Id) return Node_Id; -- Node3 function No_Ctrl_Actions (N : Node_Id) return Boolean; -- Flag7 function No_Elaboration_Check (N : Node_Id) return Boolean; -- Flag14 function No_Entities_Ref_In_Spec (N : Node_Id) return Boolean; -- Flag8 function No_Initialization (N : Node_Id) return Boolean; -- Flag13 function No_Truncation (N : Node_Id) return Boolean; -- Flag17 function Null_Present (N : Node_Id) return Boolean; -- Flag13 function Null_Exclusion_Present (N : Node_Id) return Boolean; -- Flag11 function Null_Record_Present (N : Node_Id) return Boolean; -- Flag17 function Object_Definition (N : Node_Id) return Node_Id; -- Node4 function Original_Discriminant (N : Node_Id) return Node_Id; -- Node2 function Original_Entity (N : Node_Id) return Entity_Id; -- Node2 function Others_Discrete_Choices (N : Node_Id) return List_Id; -- List1 function Out_Present (N : Node_Id) return Boolean; -- Flag17 function Parameter_Associations (N : Node_Id) return List_Id; -- List3 function Parameter_List_Truncated (N : Node_Id) return Boolean; -- Flag17 function Parameter_Specifications (N : Node_Id) return List_Id; -- List3 function Parameter_Type (N : Node_Id) return Node_Id; -- Node2 function Parent_Spec (N : Node_Id) return Node_Id; -- Node4 function Position (N : Node_Id) return Node_Id; -- Node2 function Pragma_Argument_Associations (N : Node_Id) return List_Id; -- List2 function Pragmas_After (N : Node_Id) return List_Id; -- List5 function Pragmas_Before (N : Node_Id) return List_Id; -- List4 function Prefix (N : Node_Id) return Node_Id; -- Node3 function Present_Expr (N : Node_Id) return Uint; -- Uint3 function Prev_Ids (N : Node_Id) return Boolean; -- Flag6 function Print_In_Hex (N : Node_Id) return Boolean; -- Flag13 function Private_Declarations (N : Node_Id) return List_Id; -- List3 function Private_Present (N : Node_Id) return Boolean; -- Flag15 function Procedure_To_Call (N : Node_Id) return Node_Id; -- Node4 function Proper_Body (N : Node_Id) return Node_Id; -- Node1 function Protected_Definition (N : Node_Id) return Node_Id; -- Node3 function Protected_Present (N : Node_Id) return Boolean; -- Flag6 function Raises_Constraint_Error (N : Node_Id) return Boolean; -- Flag7 function Range_Constraint (N : Node_Id) return Node_Id; -- Node4 function Range_Expression (N : Node_Id) return Node_Id; -- Node4 function Real_Range_Specification (N : Node_Id) return Node_Id; -- Node4 function Realval (N : Node_Id) return Ureal; -- Ureal3 function Reason (N : Node_Id) return Uint; -- Uint3 function Record_Extension_Part (N : Node_Id) return Node_Id; -- Node3 function Redundant_Use (N : Node_Id) return Boolean; -- Flag13 function Result_Definition (N : Node_Id) return Node_Id; -- Node4 function Return_Type (N : Node_Id) return Node_Id; -- Node2 function Reverse_Present (N : Node_Id) return Boolean; -- Flag15 function Right_Opnd (N : Node_Id) return Node_Id; -- Node3 function Rounded_Result (N : Node_Id) return Boolean; -- Flag18 function Scope (N : Node_Id) return Node_Id; -- Node3 function Select_Alternatives (N : Node_Id) return List_Id; -- List1 function Selector_Name (N : Node_Id) return Node_Id; -- Node2 function Selector_Names (N : Node_Id) return List_Id; -- List1 function Shift_Count_OK (N : Node_Id) return Boolean; -- Flag4 function Source_Type (N : Node_Id) return Entity_Id; -- Node1 function Specification (N : Node_Id) return Node_Id; -- Node1 function Statements (N : Node_Id) return List_Id; -- List3 function Static_Processing_OK (N : Node_Id) return Boolean; -- Flag4 function Storage_Pool (N : Node_Id) return Node_Id; -- Node1 function Strval (N : Node_Id) return String_Id; -- Str3 function Subtype_Indication (N : Node_Id) return Node_Id; -- Node5 function Subtype_Mark (N : Node_Id) return Node_Id; -- Node4 function Subtype_Marks (N : Node_Id) return List_Id; -- List2 function Synchronized_Present (N : Node_Id) return Boolean; -- Flag7 function Tagged_Present (N : Node_Id) return Boolean; -- Flag15 function Target_Type (N : Node_Id) return Entity_Id; -- Node2 function Task_Definition (N : Node_Id) return Node_Id; -- Node3 function Task_Present (N : Node_Id) return Boolean; -- Flag5 function Then_Actions (N : Node_Id) return List_Id; -- List2 function Then_Statements (N : Node_Id) return List_Id; -- List2 function Treat_Fixed_As_Integer (N : Node_Id) return Boolean; -- Flag14 function Triggering_Alternative (N : Node_Id) return Node_Id; -- Node1 function Triggering_Statement (N : Node_Id) return Node_Id; -- Node1 function TSS_Elist (N : Node_Id) return Elist_Id; -- Elist3 function Type_Definition (N : Node_Id) return Node_Id; -- Node3 function Unit (N : Node_Id) return Node_Id; -- Node2 function Unknown_Discriminants_Present (N : Node_Id) return Boolean; -- Flag13 function Unreferenced_In_Spec (N : Node_Id) return Boolean; -- Flag7 function Variant_Part (N : Node_Id) return Node_Id; -- Node4 function Variants (N : Node_Id) return List_Id; -- List1 function Visible_Declarations (N : Node_Id) return List_Id; -- List2 function Was_Originally_Stub (N : Node_Id) return Boolean; -- Flag13 function Zero_Cost_Handling (N : Node_Id) return Boolean; -- Flag5 -- End functions (note used by xsinfo utility program to end processing) ---------------------------- -- Node Update Procedures -- ---------------------------- -- These are the corresponding node update routines, which again provide -- a high level logical access with type checking. In addition to setting -- the indicated field of the node N to the given Val, in the case of -- tree pointers (List1-4), the parent pointer of the Val node is set to -- point back to node N. This automates the setting of the parent pointer. procedure Set_ABE_Is_Certain (N : Node_Id; Val : Boolean := True); -- Flag18 procedure Set_Abort_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Abortable_Part (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Abstract_Present (N : Node_Id; Val : Boolean := True); -- Flag4 procedure Set_Accept_Handler_Records (N : Node_Id; Val : List_Id); -- List5 procedure Set_Accept_Statement (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Access_Definition (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Access_To_Subprogram_Definition (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Access_Types_To_Process (N : Node_Id; Val : Elist_Id); -- Elist2 procedure Set_Actions (N : Node_Id; Val : List_Id); -- List1 procedure Set_Activation_Chain_Entity (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Acts_As_Spec (N : Node_Id; Val : Boolean := True); -- Flag4 procedure Set_Actual_Designated_Subtype (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Aggregate_Bounds (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Aliased_Present (N : Node_Id; Val : Boolean := True); -- Flag4 procedure Set_All_Others (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_All_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Alternatives (N : Node_Id; Val : List_Id); -- List4 procedure Set_Ancestor_Part (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Array_Aggregate (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Assignment_OK (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Associated_Node (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Attribute_Name (N : Node_Id; Val : Name_Id); -- Name2 procedure Set_At_End_Proc (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Aux_Decls_Node (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Backwards_OK (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Bad_Is_Detected (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Body_Required (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Body_To_Inline (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Box_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_By_Ref (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_Char_Literal_Value (N : Node_Id; Val : Uint); -- Uint2 procedure Set_Chars (N : Node_Id; Val : Name_Id); -- Name1 procedure Set_Check_Address_Alignment (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Choice_Parameter (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Choices (N : Node_Id; Val : List_Id); -- List1 procedure Set_Compile_Time_Known_Aggregate (N : Node_Id; Val : Boolean := True); -- Flag18 procedure Set_Component_Associations (N : Node_Id; Val : List_Id); -- List2 procedure Set_Component_Clauses (N : Node_Id; Val : List_Id); -- List3 procedure Set_Component_Definition (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Component_Items (N : Node_Id; Val : List_Id); -- List3 procedure Set_Component_List (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Component_Name (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Condition (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Condition_Actions (N : Node_Id; Val : List_Id); -- List3 procedure Set_Config_Pragmas (N : Node_Id; Val : List_Id); -- List4 procedure Set_Constant_Present (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Constraint (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Constraints (N : Node_Id; Val : List_Id); -- List1 procedure Set_Context_Installed (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Context_Items (N : Node_Id; Val : List_Id); -- List1 procedure Set_Controlling_Argument (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Conversion_OK (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_Corresponding_Body (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Corresponding_Formal_Spec (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Corresponding_Generic_Association (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Corresponding_Integer_Value (N : Node_Id; Val : Uint); -- Uint4 procedure Set_Corresponding_Spec (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Corresponding_Stub (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Dcheck_Function (N : Node_Id; Val : Entity_Id); -- Node5 procedure Set_Debug_Statement (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Declarations (N : Node_Id; Val : List_Id); -- List2 procedure Set_Default_Expression (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Default_Name (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Defining_Identifier (N : Node_Id; Val : Entity_Id); -- Node1 procedure Set_Defining_Unit_Name (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Delay_Alternative (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Delay_Finalize_Attach (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_Delay_Statement (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Delta_Expression (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Digits_Expression (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Discr_Check_Funcs_Built (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Discrete_Choices (N : Node_Id; Val : List_Id); -- List4 procedure Set_Discrete_Range (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Discrete_Subtype_Definition (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Discrete_Subtype_Definitions (N : Node_Id; Val : List_Id); -- List2 procedure Set_Discriminant_Specifications (N : Node_Id; Val : List_Id); -- List4 procedure Set_Discriminant_Type (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Do_Accessibility_Check (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Do_Discriminant_Check (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Do_Division_Check (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Do_Length_Check (N : Node_Id; Val : Boolean := True); -- Flag4 procedure Set_Do_Overflow_Check (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Do_Range_Check (N : Node_Id; Val : Boolean := True); -- Flag9 procedure Set_Do_Storage_Check (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Do_Tag_Check (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Elaborate_All_Desirable (N : Node_Id; Val : Boolean := True); -- Flag9 procedure Set_Elaborate_All_Present (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_Elaborate_Desirable (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Elaborate_Present (N : Node_Id; Val : Boolean := True); -- Flag4 procedure Set_Elaboration_Boolean (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Else_Actions (N : Node_Id; Val : List_Id); -- List3 procedure Set_Else_Statements (N : Node_Id; Val : List_Id); -- List4 procedure Set_Elsif_Parts (N : Node_Id; Val : List_Id); -- List3 procedure Set_Enclosing_Variant (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_End_Label (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_End_Span (N : Node_Id; Val : Uint); -- Uint5 procedure Set_Entity (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Entry_Body_Formal_Part (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Entry_Call_Alternative (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Entry_Call_Statement (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Entry_Direct_Name (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Entry_Index (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Entry_Index_Specification (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Etype (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Exception_Choices (N : Node_Id; Val : List_Id); -- List4 procedure Set_Exception_Handlers (N : Node_Id; Val : List_Id); -- List5 procedure Set_Exception_Junk (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_Expansion_Delayed (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Explicit_Actual_Parameter (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Explicit_Generic_Actual_Parameter (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Expression (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Expressions (N : Node_Id; Val : List_Id); -- List1 procedure Set_First_Bit (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_First_Inlined_Subprogram (N : Node_Id; Val : Entity_Id); -- Node3 procedure Set_First_Name (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_First_Named_Actual (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_First_Real_Statement (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_First_Subtype_Link (N : Node_Id; Val : Entity_Id); -- Node5 procedure Set_Float_Truncate (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Formal_Type_Definition (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Forwards_OK (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_From_At_Mod (N : Node_Id; Val : Boolean := True); -- Flag4 procedure Set_From_Default (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Generic_Associations (N : Node_Id; Val : List_Id); -- List3 procedure Set_Generic_Formal_Declarations (N : Node_Id; Val : List_Id); -- List2 procedure Set_Generic_Parent (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Generic_Parent_Type (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Handled_Statement_Sequence (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Handler_List_Entry (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Has_Created_Identifier (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Has_Dynamic_Length_Check (N : Node_Id; Val : Boolean := True); -- Flag10 procedure Set_Has_Dynamic_Range_Check (N : Node_Id; Val : Boolean := True); -- Flag12 procedure Set_Has_No_Elaboration_Code (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Has_Priority_Pragma (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Has_Private_View (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Has_Storage_Size_Pragma (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_Has_Task_Info_Pragma (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_Has_Task_Name_Pragma (N : Node_Id; Val : Boolean := True); -- Flag8 procedure Set_Has_Wide_Character (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Hidden_By_Use_Clause (N : Node_Id; Val : Elist_Id); -- Elist4 procedure Set_High_Bound (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Identifier (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Interface_List (N : Node_Id; Val : List_Id); -- List2 procedure Set_Interface_Present (N : Node_Id; Val : Boolean := True); -- Flag16 procedure Set_Implicit_With (N : Node_Id; Val : Boolean := True); -- Flag16 procedure Set_In_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Includes_Infinities (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Instance_Spec (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Intval (N : Node_Id; Val : Uint); -- Uint3 procedure Set_Is_Asynchronous_Call_Block (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_Is_Component_Left_Opnd (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Is_Component_Right_Opnd (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_Is_Controlling_Actual (N : Node_Id; Val : Boolean := True); -- Flag16 procedure Set_Is_In_Discriminant_Check (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Is_Machine_Number (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Is_Null_Loop (N : Node_Id; Val : Boolean := True); -- Flag16 procedure Set_Is_Overloaded (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_Is_Power_Of_2_For_Shift (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Is_Protected_Subprogram_Body (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_Is_Static_Expression (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Is_Subprogram_Descriptor (N : Node_Id; Val : Boolean := True); -- Flag16 procedure Set_Is_Task_Allocation_Block (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Is_Task_Master (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_Iteration_Scheme (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Itype (N : Node_Id; Val : Entity_Id); -- Node1 procedure Set_Kill_Range_Check (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Last_Bit (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Last_Name (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Library_Unit (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Label_Construct (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Left_Opnd (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Limited_View_Installed (N : Node_Id; Val : Boolean := True); -- Flag18 procedure Set_Limited_Present (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Literals (N : Node_Id; Val : List_Id); -- List1 procedure Set_Loop_Actions (N : Node_Id; Val : List_Id); -- List2 procedure Set_Loop_Parameter_Specification (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Low_Bound (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Mod_Clause (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_More_Ids (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_Must_Be_Byte_Aligned (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_Must_Not_Freeze (N : Node_Id; Val : Boolean := True); -- Flag8 procedure Set_Must_Not_Override (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Must_Override (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_Name (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Names (N : Node_Id; Val : List_Id); -- List2 procedure Set_Next_Entity (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Next_Named_Actual (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Next_Rep_Item (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Next_Use_Clause (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_No_Ctrl_Actions (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_No_Elaboration_Check (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_No_Entities_Ref_In_Spec (N : Node_Id; Val : Boolean := True); -- Flag8 procedure Set_No_Initialization (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_No_Truncation (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Null_Present (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Null_Exclusion_Present (N : Node_Id; Val : Boolean := True); -- Flag11 procedure Set_Null_Record_Present (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Object_Definition (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Original_Discriminant (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Original_Entity (N : Node_Id; Val : Entity_Id); -- Node2 procedure Set_Others_Discrete_Choices (N : Node_Id; Val : List_Id); -- List1 procedure Set_Out_Present (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Parameter_Associations (N : Node_Id; Val : List_Id); -- List3 procedure Set_Parameter_List_Truncated (N : Node_Id; Val : Boolean := True); -- Flag17 procedure Set_Parameter_Specifications (N : Node_Id; Val : List_Id); -- List3 procedure Set_Parameter_Type (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Parent_Spec (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Position (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Pragma_Argument_Associations (N : Node_Id; Val : List_Id); -- List2 procedure Set_Pragmas_After (N : Node_Id; Val : List_Id); -- List5 procedure Set_Pragmas_Before (N : Node_Id; Val : List_Id); -- List4 procedure Set_Prefix (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Present_Expr (N : Node_Id; Val : Uint); -- Uint3 procedure Set_Prev_Ids (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Print_In_Hex (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Private_Declarations (N : Node_Id; Val : List_Id); -- List3 procedure Set_Private_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Procedure_To_Call (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Proper_Body (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Protected_Definition (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Protected_Present (N : Node_Id; Val : Boolean := True); -- Flag6 procedure Set_Raises_Constraint_Error (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_Range_Constraint (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Range_Expression (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Real_Range_Specification (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Realval (N : Node_Id; Val : Ureal); -- Ureal3 procedure Set_Reason (N : Node_Id; Val : Uint); -- Uint3 procedure Set_Record_Extension_Part (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Redundant_Use (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Result_Definition (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Return_Type (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Reverse_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Right_Opnd (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Rounded_Result (N : Node_Id; Val : Boolean := True); -- Flag18 procedure Set_Scope (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Select_Alternatives (N : Node_Id; Val : List_Id); -- List1 procedure Set_Selector_Name (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Selector_Names (N : Node_Id; Val : List_Id); -- List1 procedure Set_Shift_Count_OK (N : Node_Id; Val : Boolean := True); -- Flag4 procedure Set_Source_Type (N : Node_Id; Val : Entity_Id); -- Node1 procedure Set_Specification (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Statements (N : Node_Id; Val : List_Id); -- List3 procedure Set_Static_Processing_OK (N : Node_Id; Val : Boolean); -- Flag4 procedure Set_Storage_Pool (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Strval (N : Node_Id; Val : String_Id); -- Str3 procedure Set_Subtype_Indication (N : Node_Id; Val : Node_Id); -- Node5 procedure Set_Subtype_Mark (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Subtype_Marks (N : Node_Id; Val : List_Id); -- List2 procedure Set_Synchronized_Present (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_Tagged_Present (N : Node_Id; Val : Boolean := True); -- Flag15 procedure Set_Target_Type (N : Node_Id; Val : Entity_Id); -- Node2 procedure Set_Task_Definition (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Task_Present (N : Node_Id; Val : Boolean := True); -- Flag5 procedure Set_Then_Actions (N : Node_Id; Val : List_Id); -- List2 procedure Set_Then_Statements (N : Node_Id; Val : List_Id); -- List2 procedure Set_Treat_Fixed_As_Integer (N : Node_Id; Val : Boolean := True); -- Flag14 procedure Set_Triggering_Alternative (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_Triggering_Statement (N : Node_Id; Val : Node_Id); -- Node1 procedure Set_TSS_Elist (N : Node_Id; Val : Elist_Id); -- Elist3 procedure Set_Type_Definition (N : Node_Id; Val : Node_Id); -- Node3 procedure Set_Unit (N : Node_Id; Val : Node_Id); -- Node2 procedure Set_Unknown_Discriminants_Present (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Unreferenced_In_Spec (N : Node_Id; Val : Boolean := True); -- Flag7 procedure Set_Variant_Part (N : Node_Id; Val : Node_Id); -- Node4 procedure Set_Variants (N : Node_Id; Val : List_Id); -- List1 procedure Set_Visible_Declarations (N : Node_Id; Val : List_Id); -- List2 procedure Set_Was_Originally_Stub (N : Node_Id; Val : Boolean := True); -- Flag13 procedure Set_Zero_Cost_Handling (N : Node_Id; Val : Boolean := True); -- Flag5 ------------------------- -- Iterator Procedures -- ------------------------- -- The call to Next_xxx (N) is equivalent to N := Next_xxx (N) procedure Next_Entity (N : in out Node_Id); procedure Next_Named_Actual (N : in out Node_Id); procedure Next_Rep_Item (N : in out Node_Id); procedure Next_Use_Clause (N : in out Node_Id); -------------------------------------- -- Logical Access to End_Span Field -- -------------------------------------- function End_Location (N : Node_Id) return Source_Ptr; -- N is an N_If_Statement or N_Case_Statement node, and this -- function returns the location of the IF token in the END IF -- sequence by translating the value of the End_Span field. procedure Set_End_Location (N : Node_Id; S : Source_Ptr); -- N is an N_If_Statement or N_Case_Statement node. This procedure -- sets the End_Span field to correspond to the given value S. In -- other words, End_Span is set to the difference between S and -- Sloc (N), the starting location. -------------------- -- Inline Pragmas -- -------------------- pragma Inline (ABE_Is_Certain); pragma Inline (Abort_Present); pragma Inline (Abortable_Part); pragma Inline (Abstract_Present); pragma Inline (Accept_Handler_Records); pragma Inline (Accept_Statement); pragma Inline (Access_Definition); pragma Inline (Access_To_Subprogram_Definition); pragma Inline (Access_Types_To_Process); pragma Inline (Actions); pragma Inline (Activation_Chain_Entity); pragma Inline (Acts_As_Spec); pragma Inline (Actual_Designated_Subtype); pragma Inline (Aggregate_Bounds); pragma Inline (Aliased_Present); pragma Inline (All_Others); pragma Inline (All_Present); pragma Inline (Alternatives); pragma Inline (Ancestor_Part); pragma Inline (Array_Aggregate); pragma Inline (Assignment_OK); pragma Inline (Associated_Node); pragma Inline (At_End_Proc); pragma Inline (Attribute_Name); pragma Inline (Aux_Decls_Node); pragma Inline (Backwards_OK); pragma Inline (Bad_Is_Detected); pragma Inline (Body_To_Inline); pragma Inline (Body_Required); pragma Inline (By_Ref); pragma Inline (Box_Present); pragma Inline (Char_Literal_Value); pragma Inline (Chars); pragma Inline (Check_Address_Alignment); pragma Inline (Choice_Parameter); pragma Inline (Choices); pragma Inline (Compile_Time_Known_Aggregate); pragma Inline (Component_Associations); pragma Inline (Component_Clauses); pragma Inline (Component_Definition); pragma Inline (Component_Items); pragma Inline (Component_List); pragma Inline (Component_Name); pragma Inline (Condition); pragma Inline (Condition_Actions); pragma Inline (Config_Pragmas); pragma Inline (Constant_Present); pragma Inline (Constraint); pragma Inline (Constraints); pragma Inline (Context_Installed); pragma Inline (Context_Items); pragma Inline (Controlling_Argument); pragma Inline (Conversion_OK); pragma Inline (Corresponding_Body); pragma Inline (Corresponding_Formal_Spec); pragma Inline (Corresponding_Generic_Association); pragma Inline (Corresponding_Integer_Value); pragma Inline (Corresponding_Spec); pragma Inline (Corresponding_Stub); pragma Inline (Dcheck_Function); pragma Inline (Debug_Statement); pragma Inline (Declarations); pragma Inline (Default_Expression); pragma Inline (Default_Name); pragma Inline (Defining_Identifier); pragma Inline (Defining_Unit_Name); pragma Inline (Delay_Alternative); pragma Inline (Delay_Finalize_Attach); pragma Inline (Delay_Statement); pragma Inline (Delta_Expression); pragma Inline (Digits_Expression); pragma Inline (Discr_Check_Funcs_Built); pragma Inline (Discrete_Choices); pragma Inline (Discrete_Range); pragma Inline (Discrete_Subtype_Definition); pragma Inline (Discrete_Subtype_Definitions); pragma Inline (Discriminant_Specifications); pragma Inline (Discriminant_Type); pragma Inline (Do_Accessibility_Check); pragma Inline (Do_Discriminant_Check); pragma Inline (Do_Length_Check); pragma Inline (Do_Division_Check); pragma Inline (Do_Overflow_Check); pragma Inline (Do_Range_Check); pragma Inline (Do_Storage_Check); pragma Inline (Do_Tag_Check); pragma Inline (Elaborate_Present); pragma Inline (Elaborate_All_Desirable); pragma Inline (Elaborate_All_Present); pragma Inline (Elaborate_Desirable); pragma Inline (Elaboration_Boolean); pragma Inline (Else_Actions); pragma Inline (Else_Statements); pragma Inline (Elsif_Parts); pragma Inline (Enclosing_Variant); pragma Inline (End_Label); pragma Inline (End_Span); pragma Inline (Entity); pragma Inline (Entity_Or_Associated_Node); pragma Inline (Entry_Body_Formal_Part); pragma Inline (Entry_Call_Alternative); pragma Inline (Entry_Call_Statement); pragma Inline (Entry_Direct_Name); pragma Inline (Entry_Index); pragma Inline (Entry_Index_Specification); pragma Inline (Etype); pragma Inline (Exception_Choices); pragma Inline (Exception_Junk); pragma Inline (Exception_Handlers); pragma Inline (Expansion_Delayed); pragma Inline (Explicit_Actual_Parameter); pragma Inline (Explicit_Generic_Actual_Parameter); pragma Inline (Expression); pragma Inline (Expressions); pragma Inline (First_Bit); pragma Inline (First_Inlined_Subprogram); pragma Inline (First_Name); pragma Inline (First_Named_Actual); pragma Inline (First_Real_Statement); pragma Inline (First_Subtype_Link); pragma Inline (Float_Truncate); pragma Inline (Formal_Type_Definition); pragma Inline (Forwards_OK); pragma Inline (From_At_Mod); pragma Inline (From_Default); pragma Inline (Generic_Associations); pragma Inline (Generic_Formal_Declarations); pragma Inline (Generic_Parent); pragma Inline (Generic_Parent_Type); pragma Inline (Handled_Statement_Sequence); pragma Inline (Handler_List_Entry); pragma Inline (Has_Created_Identifier); pragma Inline (Has_Dynamic_Length_Check); pragma Inline (Has_Dynamic_Range_Check); pragma Inline (Has_No_Elaboration_Code); pragma Inline (Has_Priority_Pragma); pragma Inline (Has_Private_View); pragma Inline (Has_Storage_Size_Pragma); pragma Inline (Has_Task_Info_Pragma); pragma Inline (Has_Task_Name_Pragma); pragma Inline (Has_Wide_Character); pragma Inline (Hidden_By_Use_Clause); pragma Inline (High_Bound); pragma Inline (Identifier); pragma Inline (Implicit_With); pragma Inline (Interface_List); pragma Inline (Interface_Present); pragma Inline (Includes_Infinities); pragma Inline (In_Present); pragma Inline (Instance_Spec); pragma Inline (Intval); pragma Inline (Is_Asynchronous_Call_Block); pragma Inline (Is_Component_Left_Opnd); pragma Inline (Is_Component_Right_Opnd); pragma Inline (Is_Controlling_Actual); pragma Inline (Is_In_Discriminant_Check); pragma Inline (Is_Machine_Number); pragma Inline (Is_Null_Loop); pragma Inline (Is_Overloaded); pragma Inline (Is_Power_Of_2_For_Shift); pragma Inline (Is_Protected_Subprogram_Body); pragma Inline (Is_Static_Expression); pragma Inline (Is_Subprogram_Descriptor); pragma Inline (Is_Task_Allocation_Block); pragma Inline (Is_Task_Master); pragma Inline (Iteration_Scheme); pragma Inline (Itype); pragma Inline (Kill_Range_Check); pragma Inline (Last_Bit); pragma Inline (Last_Name); pragma Inline (Library_Unit); pragma Inline (Label_Construct); pragma Inline (Left_Opnd); pragma Inline (Limited_View_Installed); pragma Inline (Limited_Present); pragma Inline (Literals); pragma Inline (Loop_Actions); pragma Inline (Loop_Parameter_Specification); pragma Inline (Low_Bound); pragma Inline (Mod_Clause); pragma Inline (More_Ids); pragma Inline (Must_Be_Byte_Aligned); pragma Inline (Must_Not_Freeze); pragma Inline (Must_Not_Override); pragma Inline (Must_Override); pragma Inline (Name); pragma Inline (Names); pragma Inline (Next_Entity); pragma Inline (Next_Named_Actual); pragma Inline (Next_Rep_Item); pragma Inline (Next_Use_Clause); pragma Inline (No_Ctrl_Actions); pragma Inline (No_Elaboration_Check); pragma Inline (No_Entities_Ref_In_Spec); pragma Inline (No_Initialization); pragma Inline (No_Truncation); pragma Inline (Null_Present); pragma Inline (Null_Exclusion_Present); pragma Inline (Null_Record_Present); pragma Inline (Object_Definition); pragma Inline (Original_Discriminant); pragma Inline (Original_Entity); pragma Inline (Others_Discrete_Choices); pragma Inline (Out_Present); pragma Inline (Parameter_Associations); pragma Inline (Parameter_Specifications); pragma Inline (Parameter_List_Truncated); pragma Inline (Parameter_Type); pragma Inline (Parent_Spec); pragma Inline (Position); pragma Inline (Pragma_Argument_Associations); pragma Inline (Pragmas_After); pragma Inline (Pragmas_Before); pragma Inline (Prefix); pragma Inline (Present_Expr); pragma Inline (Prev_Ids); pragma Inline (Print_In_Hex); pragma Inline (Private_Declarations); pragma Inline (Private_Present); pragma Inline (Procedure_To_Call); pragma Inline (Proper_Body); pragma Inline (Protected_Definition); pragma Inline (Protected_Present); pragma Inline (Raises_Constraint_Error); pragma Inline (Range_Constraint); pragma Inline (Range_Expression); pragma Inline (Real_Range_Specification); pragma Inline (Realval); pragma Inline (Reason); pragma Inline (Record_Extension_Part); pragma Inline (Redundant_Use); pragma Inline (Result_Definition); pragma Inline (Return_Type); pragma Inline (Reverse_Present); pragma Inline (Right_Opnd); pragma Inline (Rounded_Result); pragma Inline (Scope); pragma Inline (Select_Alternatives); pragma Inline (Selector_Name); pragma Inline (Selector_Names); pragma Inline (Shift_Count_OK); pragma Inline (Source_Type); pragma Inline (Specification); pragma Inline (Statements); pragma Inline (Static_Processing_OK); pragma Inline (Storage_Pool); pragma Inline (Strval); pragma Inline (Subtype_Indication); pragma Inline (Subtype_Mark); pragma Inline (Subtype_Marks); pragma Inline (Synchronized_Present); pragma Inline (Tagged_Present); pragma Inline (Target_Type); pragma Inline (Task_Definition); pragma Inline (Task_Present); pragma Inline (Then_Actions); pragma Inline (Then_Statements); pragma Inline (Triggering_Alternative); pragma Inline (Triggering_Statement); pragma Inline (Treat_Fixed_As_Integer); pragma Inline (TSS_Elist); pragma Inline (Type_Definition); pragma Inline (Unit); pragma Inline (Unknown_Discriminants_Present); pragma Inline (Unreferenced_In_Spec); pragma Inline (Variant_Part); pragma Inline (Variants); pragma Inline (Visible_Declarations); pragma Inline (Was_Originally_Stub); pragma Inline (Zero_Cost_Handling); pragma Inline (Set_ABE_Is_Certain); pragma Inline (Set_Abort_Present); pragma Inline (Set_Abortable_Part); pragma Inline (Set_Abstract_Present); pragma Inline (Set_Accept_Handler_Records); pragma Inline (Set_Accept_Statement); pragma Inline (Set_Access_Definition); pragma Inline (Set_Access_To_Subprogram_Definition); pragma Inline (Set_Access_Types_To_Process); pragma Inline (Set_Actions); pragma Inline (Set_Activation_Chain_Entity); pragma Inline (Set_Acts_As_Spec); pragma Inline (Set_Actual_Designated_Subtype); pragma Inline (Set_Aggregate_Bounds); pragma Inline (Set_Aliased_Present); pragma Inline (Set_All_Others); pragma Inline (Set_All_Present); pragma Inline (Set_Alternatives); pragma Inline (Set_Ancestor_Part); pragma Inline (Set_Array_Aggregate); pragma Inline (Set_Assignment_OK); pragma Inline (Set_Associated_Node); pragma Inline (Set_At_End_Proc); pragma Inline (Set_Attribute_Name); pragma Inline (Set_Aux_Decls_Node); pragma Inline (Set_Backwards_OK); pragma Inline (Set_Bad_Is_Detected); pragma Inline (Set_Body_To_Inline); pragma Inline (Set_Body_Required); pragma Inline (Set_By_Ref); pragma Inline (Set_Box_Present); pragma Inline (Set_Char_Literal_Value); pragma Inline (Set_Chars); pragma Inline (Set_Check_Address_Alignment); pragma Inline (Set_Choice_Parameter); pragma Inline (Set_Choices); pragma Inline (Set_Compile_Time_Known_Aggregate); pragma Inline (Set_Component_Associations); pragma Inline (Set_Component_Clauses); pragma Inline (Set_Component_Definition); pragma Inline (Set_Component_Items); pragma Inline (Set_Component_List); pragma Inline (Set_Component_Name); pragma Inline (Set_Condition); pragma Inline (Set_Condition_Actions); pragma Inline (Set_Config_Pragmas); pragma Inline (Set_Constant_Present); pragma Inline (Set_Constraint); pragma Inline (Set_Constraints); pragma Inline (Set_Context_Installed); pragma Inline (Set_Context_Items); pragma Inline (Set_Controlling_Argument); pragma Inline (Set_Conversion_OK); pragma Inline (Set_Corresponding_Body); pragma Inline (Set_Corresponding_Formal_Spec); pragma Inline (Set_Corresponding_Generic_Association); pragma Inline (Set_Corresponding_Integer_Value); pragma Inline (Set_Corresponding_Spec); pragma Inline (Set_Corresponding_Stub); pragma Inline (Set_Dcheck_Function); pragma Inline (Set_Debug_Statement); pragma Inline (Set_Declarations); pragma Inline (Set_Default_Expression); pragma Inline (Set_Default_Name); pragma Inline (Set_Defining_Identifier); pragma Inline (Set_Defining_Unit_Name); pragma Inline (Set_Delay_Alternative); pragma Inline (Set_Delay_Finalize_Attach); pragma Inline (Set_Delay_Statement); pragma Inline (Set_Delta_Expression); pragma Inline (Set_Digits_Expression); pragma Inline (Set_Discr_Check_Funcs_Built); pragma Inline (Set_Discrete_Choices); pragma Inline (Set_Discrete_Range); pragma Inline (Set_Discrete_Subtype_Definition); pragma Inline (Set_Discrete_Subtype_Definitions); pragma Inline (Set_Discriminant_Specifications); pragma Inline (Set_Discriminant_Type); pragma Inline (Set_Do_Accessibility_Check); pragma Inline (Set_Do_Discriminant_Check); pragma Inline (Set_Do_Length_Check); pragma Inline (Set_Do_Division_Check); pragma Inline (Set_Do_Overflow_Check); pragma Inline (Set_Do_Range_Check); pragma Inline (Set_Do_Storage_Check); pragma Inline (Set_Do_Tag_Check); pragma Inline (Set_Elaborate_Present); pragma Inline (Set_Elaborate_All_Desirable); pragma Inline (Set_Elaborate_All_Present); pragma Inline (Set_Elaborate_Desirable); pragma Inline (Set_Elaboration_Boolean); pragma Inline (Set_Else_Actions); pragma Inline (Set_Else_Statements); pragma Inline (Set_Elsif_Parts); pragma Inline (Set_Enclosing_Variant); pragma Inline (Set_End_Label); pragma Inline (Set_End_Span); pragma Inline (Set_Entity); pragma Inline (Set_Entry_Body_Formal_Part); pragma Inline (Set_Entry_Call_Alternative); pragma Inline (Set_Entry_Call_Statement); pragma Inline (Set_Entry_Direct_Name); pragma Inline (Set_Entry_Index); pragma Inline (Set_Entry_Index_Specification); pragma Inline (Set_Etype); pragma Inline (Set_Exception_Choices); pragma Inline (Set_Exception_Junk); pragma Inline (Set_Exception_Handlers); pragma Inline (Set_Expansion_Delayed); pragma Inline (Set_Explicit_Actual_Parameter); pragma Inline (Set_Explicit_Generic_Actual_Parameter); pragma Inline (Set_Expression); pragma Inline (Set_Expressions); pragma Inline (Set_First_Bit); pragma Inline (Set_First_Inlined_Subprogram); pragma Inline (Set_First_Name); pragma Inline (Set_First_Named_Actual); pragma Inline (Set_First_Real_Statement); pragma Inline (Set_First_Subtype_Link); pragma Inline (Set_Float_Truncate); pragma Inline (Set_Formal_Type_Definition); pragma Inline (Set_Forwards_OK); pragma Inline (Set_From_At_Mod); pragma Inline (Set_From_Default); pragma Inline (Set_Generic_Associations); pragma Inline (Set_Generic_Formal_Declarations); pragma Inline (Set_Generic_Parent); pragma Inline (Set_Generic_Parent_Type); pragma Inline (Set_Handled_Statement_Sequence); pragma Inline (Set_Handler_List_Entry); pragma Inline (Set_Has_Created_Identifier); pragma Inline (Set_Has_Dynamic_Length_Check); pragma Inline (Set_Has_Dynamic_Range_Check); pragma Inline (Set_Has_No_Elaboration_Code); pragma Inline (Set_Has_Priority_Pragma); pragma Inline (Set_Has_Private_View); pragma Inline (Set_Has_Storage_Size_Pragma); pragma Inline (Set_Has_Task_Info_Pragma); pragma Inline (Set_Has_Task_Name_Pragma); pragma Inline (Set_Has_Wide_Character); pragma Inline (Set_Hidden_By_Use_Clause); pragma Inline (Set_High_Bound); pragma Inline (Set_Identifier); pragma Inline (Set_Implicit_With); pragma Inline (Set_Includes_Infinities); pragma Inline (Set_Interface_List); pragma Inline (Set_Interface_Present); pragma Inline (Set_In_Present); pragma Inline (Set_Instance_Spec); pragma Inline (Set_Intval); pragma Inline (Set_Is_Asynchronous_Call_Block); pragma Inline (Set_Is_Component_Left_Opnd); pragma Inline (Set_Is_Component_Right_Opnd); pragma Inline (Set_Is_Controlling_Actual); pragma Inline (Set_Is_In_Discriminant_Check); pragma Inline (Set_Is_Machine_Number); pragma Inline (Set_Is_Null_Loop); pragma Inline (Set_Is_Overloaded); pragma Inline (Set_Is_Power_Of_2_For_Shift); pragma Inline (Set_Is_Protected_Subprogram_Body); pragma Inline (Set_Is_Static_Expression); pragma Inline (Set_Is_Subprogram_Descriptor); pragma Inline (Set_Is_Task_Allocation_Block); pragma Inline (Set_Is_Task_Master); pragma Inline (Set_Iteration_Scheme); pragma Inline (Set_Itype); pragma Inline (Set_Kill_Range_Check); pragma Inline (Set_Last_Bit); pragma Inline (Set_Last_Name); pragma Inline (Set_Library_Unit); pragma Inline (Set_Label_Construct); pragma Inline (Set_Left_Opnd); pragma Inline (Set_Limited_View_Installed); pragma Inline (Set_Limited_Present); pragma Inline (Set_Literals); pragma Inline (Set_Loop_Actions); pragma Inline (Set_Loop_Parameter_Specification); pragma Inline (Set_Low_Bound); pragma Inline (Set_Mod_Clause); pragma Inline (Set_More_Ids); pragma Inline (Set_Must_Be_Byte_Aligned); pragma Inline (Set_Must_Not_Freeze); pragma Inline (Set_Must_Not_Override); pragma Inline (Set_Must_Override); pragma Inline (Set_Name); pragma Inline (Set_Names); pragma Inline (Set_Next_Entity); pragma Inline (Set_Next_Named_Actual); pragma Inline (Set_Next_Use_Clause); pragma Inline (Set_No_Ctrl_Actions); pragma Inline (Set_No_Elaboration_Check); pragma Inline (Set_No_Entities_Ref_In_Spec); pragma Inline (Set_No_Initialization); pragma Inline (Set_No_Truncation); pragma Inline (Set_Null_Present); pragma Inline (Set_Null_Exclusion_Present); pragma Inline (Set_Null_Record_Present); pragma Inline (Set_Object_Definition); pragma Inline (Set_Original_Discriminant); pragma Inline (Set_Original_Entity); pragma Inline (Set_Others_Discrete_Choices); pragma Inline (Set_Out_Present); pragma Inline (Set_Parameter_Associations); pragma Inline (Set_Parameter_Specifications); pragma Inline (Set_Parameter_List_Truncated); pragma Inline (Set_Parameter_Type); pragma Inline (Set_Parent_Spec); pragma Inline (Set_Position); pragma Inline (Set_Pragma_Argument_Associations); pragma Inline (Set_Pragmas_After); pragma Inline (Set_Pragmas_Before); pragma Inline (Set_Prefix); pragma Inline (Set_Present_Expr); pragma Inline (Set_Prev_Ids); pragma Inline (Set_Print_In_Hex); pragma Inline (Set_Private_Declarations); pragma Inline (Set_Private_Present); pragma Inline (Set_Procedure_To_Call); pragma Inline (Set_Proper_Body); pragma Inline (Set_Protected_Definition); pragma Inline (Set_Protected_Present); pragma Inline (Set_Raises_Constraint_Error); pragma Inline (Set_Range_Constraint); pragma Inline (Set_Range_Expression); pragma Inline (Set_Real_Range_Specification); pragma Inline (Set_Realval); pragma Inline (Set_Reason); pragma Inline (Set_Record_Extension_Part); pragma Inline (Set_Redundant_Use); pragma Inline (Set_Result_Definition); pragma Inline (Set_Return_Type); pragma Inline (Set_Reverse_Present); pragma Inline (Set_Right_Opnd); pragma Inline (Set_Rounded_Result); pragma Inline (Set_Scope); pragma Inline (Set_Select_Alternatives); pragma Inline (Set_Selector_Name); pragma Inline (Set_Selector_Names); pragma Inline (Set_Shift_Count_OK); pragma Inline (Set_Source_Type); pragma Inline (Set_Specification); pragma Inline (Set_Statements); pragma Inline (Set_Static_Processing_OK); pragma Inline (Set_Storage_Pool); pragma Inline (Set_Strval); pragma Inline (Set_Subtype_Indication); pragma Inline (Set_Subtype_Mark); pragma Inline (Set_Subtype_Marks); pragma Inline (Set_Synchronized_Present); pragma Inline (Set_Tagged_Present); pragma Inline (Set_Target_Type); pragma Inline (Set_Task_Definition); pragma Inline (Set_Task_Present); pragma Inline (Set_Then_Actions); pragma Inline (Set_Then_Statements); pragma Inline (Set_Triggering_Alternative); pragma Inline (Set_Triggering_Statement); pragma Inline (Set_Treat_Fixed_As_Integer); pragma Inline (Set_TSS_Elist); pragma Inline (Set_Type_Definition); pragma Inline (Set_Unit); pragma Inline (Set_Unknown_Discriminants_Present); pragma Inline (Set_Unreferenced_In_Spec); pragma Inline (Set_Variant_Part); pragma Inline (Set_Variants); pragma Inline (Set_Visible_Declarations); pragma Inline (Set_Was_Originally_Stub); pragma Inline (Set_Zero_Cost_Handling); end Sinfo;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T A S K _ A T T R I B U T E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2014-2016, 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/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ with System.Tasking; with System.Tasking.Initialization; with System.Tasking.Task_Attributes; pragma Elaborate_All (System.Tasking.Task_Attributes); with System.Task_Primitives.Operations; with Ada.Finalization; use Ada.Finalization; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; package body Ada.Task_Attributes is use System, System.Tasking.Initialization, System.Tasking, System.Tasking.Task_Attributes; package STPO renames System.Task_Primitives.Operations; type Attribute_Cleanup is new Limited_Controlled with null record; procedure Finalize (Cleanup : in out Attribute_Cleanup); -- Finalize all tasks' attributes for this package Cleanup : Attribute_Cleanup; pragma Unreferenced (Cleanup); -- Will call Finalize when this instantiation gets out of scope --------------------------- -- Unchecked Conversions -- --------------------------- type Real_Attribute is record Free : Deallocator; Value : Attribute; end record; type Real_Attribute_Access is access all Real_Attribute; pragma No_Strict_Aliasing (Real_Attribute_Access); -- Each value in the task control block's Attributes array is either -- mapped to the attribute value directly if Fast_Path is True, or -- is in effect a Real_Attribute_Access. -- -- Note: the Deallocator field must be first, for compatibility with -- System.Tasking.Task_Attributes.Attribute_Record and to allow unchecked -- conversions between Attribute_Access and Real_Attribute_Access. function New_Attribute (Val : Attribute) return Atomic_Address; -- Create a new Real_Attribute using Val, and return its address. The -- returned value can be converted via To_Real_Attribute. procedure Deallocate (Ptr : Atomic_Address); -- Free memory associated with Ptr, a Real_Attribute_Access in reality function To_Real_Attribute is new Ada.Unchecked_Conversion (Atomic_Address, Real_Attribute_Access); pragma Warnings (Off); -- Kill warning about possible size mismatch function To_Address is new Ada.Unchecked_Conversion (Attribute, Atomic_Address); function To_Attribute is new Ada.Unchecked_Conversion (Atomic_Address, Attribute); function To_Address is new Ada.Unchecked_Conversion (Attribute, System.Address); function To_Int is new Ada.Unchecked_Conversion (Attribute, Integer); pragma Warnings (On); function To_Address is new Ada.Unchecked_Conversion (Real_Attribute_Access, Atomic_Address); pragma Warnings (Off); -- Kill warning about possible aliasing function To_Handle is new Ada.Unchecked_Conversion (System.Address, Attribute_Handle); pragma Warnings (On); function To_Task_Id is new Ada.Unchecked_Conversion (Task_Identification.Task_Id, Task_Id); -- To access TCB of identified task procedure Free is new Ada.Unchecked_Deallocation (Real_Attribute, Real_Attribute_Access); Fast_Path : constant Boolean := (Attribute'Size = Integer'Size and then Attribute'Alignment <= Atomic_Address'Alignment and then To_Int (Initial_Value) = 0) or else (Attribute'Size = System.Address'Size and then Attribute'Alignment <= Atomic_Address'Alignment and then To_Address (Initial_Value) = System.Null_Address); -- If the attribute fits in an Atomic_Address (both size and alignment) -- and Initial_Value is 0 (or null), then we will map the attribute -- directly into ATCB.Attributes (Index), otherwise we will create -- a level of indirection and instead use Attributes (Index) as a -- Real_Attribute_Access. Index : constant Integer := Next_Index (Require_Finalization => not Fast_Path); -- Index in the task control block's Attributes array -------------- -- Finalize -- -------------- procedure Finalize (Cleanup : in out Attribute_Cleanup) is pragma Unreferenced (Cleanup); begin STPO.Lock_RTS; declare C : System.Tasking.Task_Id := System.Tasking.All_Tasks_List; begin while C /= null loop STPO.Write_Lock (C); if C.Attributes (Index) /= 0 and then Require_Finalization (Index) then Deallocate (C.Attributes (Index)); C.Attributes (Index) := 0; end if; STPO.Unlock (C); C := C.Common.All_Tasks_Link; end loop; end; Finalize (Index); STPO.Unlock_RTS; end Finalize; ---------------- -- Deallocate -- ---------------- procedure Deallocate (Ptr : Atomic_Address) is Obj : Real_Attribute_Access := To_Real_Attribute (Ptr); begin Free (Obj); end Deallocate; ------------------- -- New_Attribute -- ------------------- function New_Attribute (Val : Attribute) return Atomic_Address is Tmp : Real_Attribute_Access; begin Tmp := new Real_Attribute'(Free => Deallocate'Unrestricted_Access, Value => Val); return To_Address (Tmp); end New_Attribute; --------------- -- Reference -- --------------- function Reference (T : Task_Identification.Task_Id := Task_Identification.Current_Task) return Attribute_Handle is Self_Id : Task_Id; TT : constant Task_Id := To_Task_Id (T); Error_Message : constant String := "trying to get the reference of a "; Result : Attribute_Handle; begin if TT = null then raise Program_Error with Error_Message & "null task"; end if; if TT.Common.State = Terminated then raise Tasking_Error with Error_Message & "terminated task"; end if; if Fast_Path then -- Kill warning about possible alignment mismatch. If this happens, -- Fast_Path will be False anyway pragma Warnings (Off); return To_Handle (TT.Attributes (Index)'Address); pragma Warnings (On); else Self_Id := STPO.Self; Task_Lock (Self_Id); if TT.Attributes (Index) = 0 then TT.Attributes (Index) := New_Attribute (Initial_Value); end if; Result := To_Handle (To_Real_Attribute (TT.Attributes (Index)).Value'Address); Task_Unlock (Self_Id); return Result; end if; end Reference; ------------------ -- Reinitialize -- ------------------ procedure Reinitialize (T : Task_Identification.Task_Id := Task_Identification.Current_Task) is Self_Id : Task_Id; TT : constant Task_Id := To_Task_Id (T); Error_Message : constant String := "Trying to Reinitialize a "; begin if TT = null then raise Program_Error with Error_Message & "null task"; end if; if TT.Common.State = Terminated then raise Tasking_Error with Error_Message & "terminated task"; end if; if Fast_Path then -- No finalization needed, simply reset to Initial_Value TT.Attributes (Index) := To_Address (Initial_Value); else Self_Id := STPO.Self; Task_Lock (Self_Id); declare Attr : Atomic_Address renames TT.Attributes (Index); begin if Attr /= 0 then Deallocate (Attr); Attr := 0; end if; end; Task_Unlock (Self_Id); end if; end Reinitialize; --------------- -- Set_Value -- --------------- procedure Set_Value (Val : Attribute; T : Task_Identification.Task_Id := Task_Identification.Current_Task) is Self_Id : Task_Id; TT : constant Task_Id := To_Task_Id (T); Error_Message : constant String := "trying to set the value of a "; begin if TT = null then raise Program_Error with Error_Message & "null task"; end if; if TT.Common.State = Terminated then raise Tasking_Error with Error_Message & "terminated task"; end if; if Fast_Path then -- No finalization needed, simply set to Val TT.Attributes (Index) := To_Address (Val); else Self_Id := STPO.Self; Task_Lock (Self_Id); declare Attr : Atomic_Address renames TT.Attributes (Index); begin if Attr /= 0 then Deallocate (Attr); end if; Attr := New_Attribute (Val); end; Task_Unlock (Self_Id); end if; end Set_Value; ----------- -- Value -- ----------- function Value (T : Task_Identification.Task_Id := Task_Identification.Current_Task) return Attribute is Self_Id : Task_Id; TT : constant Task_Id := To_Task_Id (T); Error_Message : constant String := "trying to get the value of a "; begin if TT = null then raise Program_Error with Error_Message & "null task"; end if; if TT.Common.State = Terminated then raise Tasking_Error with Error_Message & "terminated task"; end if; if Fast_Path then return To_Attribute (TT.Attributes (Index)); else Self_Id := STPO.Self; Task_Lock (Self_Id); declare Attr : Atomic_Address renames TT.Attributes (Index); begin if Attr = 0 then Task_Unlock (Self_Id); return Initial_Value; else declare Result : constant Attribute := To_Real_Attribute (Attr).Value; begin Task_Unlock (Self_Id); return Result; end; end if; end; end if; end Value; end Ada.Task_Attributes;
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S . -- -- S P E C I F I C -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1991-1999, Florida State University -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. It is -- -- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -- State University (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This is a POSIX version of this package where foreign threads are -- recognized. -- Currently, DEC Unix, SCO UnixWare 7 and RTEMS use this version. with System.Soft_Links; -- used to initialize TSD for a C thread, in function Self separate (System.Task_Primitives.Operations) package body Specific is ------------------ -- Local Data -- ------------------ -- The followings are logically constants, but need to be initialized -- at run time. -- The following gives the Ada run-time direct access to a variable -- context switched by RTEMS at the lowest level. RTEMS_Ada_Self : System.Address; pragma Import (C, RTEMS_Ada_Self, "rtems_ada_self"); -- The following are used to allow the Self function to -- automatically generate ATCB's for C threads that happen to call -- Ada procedure, which in turn happen to call the Ada runtime system. type Fake_ATCB; type Fake_ATCB_Ptr is access Fake_ATCB; type Fake_ATCB is record Stack_Base : Interfaces.C.unsigned := 0; -- A value of zero indicates the node is not in use. Next : Fake_ATCB_Ptr; Real_ATCB : aliased Ada_Task_Control_Block (0); end record; Fake_ATCB_List : Fake_ATCB_Ptr; -- A linear linked list. -- The list is protected by All_Tasks_L; -- Nodes are added to this list from the front. -- Once a node is added to this list, it is never removed. Fake_Task_Elaborated : aliased Boolean := True; -- Used to identified fake tasks (i.e., non-Ada Threads). Next_Fake_ATCB : Fake_ATCB_Ptr; -- Used to allocate one Fake_ATCB in advance. See comment in New_Fake_ATCB ----------------------- -- Local Subprograms -- ----------------------- --------------------------------- -- Support for New_Fake_ATCB -- --------------------------------- function New_Fake_ATCB return Task_ID; -- Allocate and Initialize a new ATCB. This code can safely be called from -- a foreign thread, as it doesn't access implicitely or explicitely -- "self" before having initialized the new ATCB. ------------------- -- New_Fake_ATCB -- ------------------- function New_Fake_ATCB return Task_ID is Self_ID : Task_ID; P, Q : Fake_ATCB_Ptr; Succeeded : Boolean; begin -- This section is ticklish. -- We dare not call anything that might require an ATCB, until -- we have the new ATCB in place. Write_Lock (All_Tasks_L'Access); Q := null; P := Fake_ATCB_List; while P /= null loop if P.Stack_Base = 0 then Q := P; end if; P := P.Next; end loop; if Q = null then -- Create a new ATCB with zero entries. Self_ID := Next_Fake_ATCB.Real_ATCB'Access; Next_Fake_ATCB.Stack_Base := 1; Next_Fake_ATCB.Next := Fake_ATCB_List; Fake_ATCB_List := Next_Fake_ATCB; Next_Fake_ATCB := null; else -- Reuse an existing fake ATCB. Self_ID := Q.Real_ATCB'Access; Q.Stack_Base := 1; end if; -- Record this as the Task_ID for the current thread. Self_ID.Common.LL.Thread := pthread_self; RTEMS_Ada_Self := To_Address (Self_ID); -- Do the standard initializations System.Tasking.Initialize_ATCB (Self_ID, null, Null_Address, Null_Task, Fake_Task_Elaborated'Access, System.Priority'First, Task_Info.Unspecified_Task_Info, 0, Self_ID, Succeeded); pragma Assert (Succeeded); -- Finally, it is safe to use an allocator in this thread. if Next_Fake_ATCB = null then Next_Fake_ATCB := new Fake_ATCB; end if; Self_ID.Common.State := Runnable; Self_ID.Awake_Count := 1; -- Since this is not an ordinary Ada task, we will start out undeferred Self_ID.Deferral_Level := 0; System.Soft_Links.Create_TSD (Self_ID.Common.Compiler_Data); -- ???? -- The following call is commented out to avoid dependence on -- the System.Tasking.Initialization package. -- It seems that if we want Ada.Task_Attributes to work correctly -- for C threads we will need to raise the visibility of this soft -- link to System.Soft_Links. -- We are putting that off until this new functionality is otherwise -- stable. -- System.Tasking.Initialization.Initialize_Attributes_Link.all (T); for J in Known_Tasks'Range loop if Known_Tasks (J) = null then Known_Tasks (J) := Self_ID; Self_ID.Known_Tasks_Index := J; exit; end if; end loop; -- Must not unlock until Next_ATCB is again allocated. Unlock (All_Tasks_L'Access); return Self_ID; end New_Fake_ATCB; ---------------- -- Initialize -- ---------------- procedure Initialize (Environment_Task : Task_ID) is begin RTEMS_Ada_Self := To_Address (Environment_Task); -- Create a free ATCB for use on the Fake_ATCB_List. Next_Fake_ATCB := new Fake_ATCB; end Initialize; --------- -- Set -- --------- procedure Set (Self_Id : Task_ID) is begin RTEMS_Ada_Self := To_Address (Self_Id); end Set; ---------- -- Self -- ---------- -- To make Ada tasks and C threads interoperate better, we have -- added some functionality to Self. Suppose a C main program -- (with threads) calls an Ada procedure and the Ada procedure -- calls the tasking runtime system. Eventually, a call will be -- made to self. Since the call is not coming from an Ada task, -- there will be no corresponding ATCB. -- (The entire Ada run-time system may not have been elaborated, -- either, but that is a different problem, that we will need to -- solve another way.) -- What we do in Self is to catch references that do not come -- from recognized Ada tasks, and create an ATCB for the calling -- thread. -- The new ATCB will be "detached" from the normal Ada task -- master hierarchy, much like the existing implicitly created -- signal-server tasks. -- We will also use such points to poll for disappearance of the -- threads associated with any implicit ATCBs that we created -- earlier, and take the opportunity to recover them. -- A nasty problem here is the limitations of the compilation -- order dependency, and in particular the GNARL/GNULLI layering. -- To initialize an ATCB we need to assume System.Tasking has -- been elaborated. function Self return Task_ID is Result : System.Address; begin Result := RTEMS_Ada_Self; -- If the key value is Null, then it is a non-Ada task. if Result = System.Null_Address then return New_Fake_ATCB; end if; return To_Task_ID (Result); end Self; end Specific;
----------------------------------------------------------------------- -- util-xunit - Unit tests on top of AUnit -- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with AUnit.Options; with AUnit.Reporter.Text; with AUnit.Run; with AUnit.Assertions; with Util.Tests.Reporter; package body Util.XUnit is procedure Assert (T : in Test_Case; Condition : in Boolean; Message : in String := "Test failed"; Source : in String := GNAT.Source_Info.File; Line : in Natural := GNAT.Source_Info.Line) is pragma Unreferenced (T); begin AUnit.Assertions.Assert (Condition, Message, Source, Line); end Assert; procedure Assert (T : in Test; Condition : in Boolean; Message : in String := "Test failed"; Source : in String := GNAT.Source_Info.File; Line : in Natural := GNAT.Source_Info.Line) is pragma Unreferenced (T); begin AUnit.Assertions.Assert (Condition, Message, Source, Line); end Assert; -- ------------------------------ -- The main testsuite program. This launches the tests, collects the -- results, create performance logs and set the program exit status -- according to the testsuite execution status. -- ------------------------------ procedure Harness (Output : in Ada.Strings.Unbounded.Unbounded_String; XML : in Boolean; Result : out Status) is use type AUnit.Status; function Runner is new AUnit.Run.Test_Runner_With_Status (Suite); O : AUnit.Options.AUnit_Options := AUnit.Options.Default_Options; begin O.Global_Timer := True; O.Test_Case_Timer := True; if XML then declare Reporter : Util.Tests.Reporter.XML_Reporter; begin Reporter.File := Output; Result := Runner (Reporter, O); end; else declare Reporter : AUnit.Reporter.Text.Text_Reporter; begin Result := Runner (Reporter, O); end; end if; end Harness; end Util.XUnit;
----------------------------------------------------------------------- -- util-listeners-lifecycles -- Listeners -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- The `Lifecycles` package provides a listener interface dedicated to -- track lifecycle managements on objects. It defines a set of procedures to be -- notified when an object is created, updated or deleted. -- -- Notes: another implementation can be made by using three different listener lists -- that use the simple observer pattern. generic type Element_Type (<>) is limited private; package Util.Listeners.Lifecycles is -- ------------------------------ -- Lifecycle listener -- ------------------------------ type Listener is limited interface and Util.Listeners.Listener; -- The `On_Create` procedure is called by `Notify_Create` to notify the creation of the item. procedure On_Create (Instance : in Listener; Item : in Element_Type) is abstract; -- The `On_Update` procedure is called by `Notify_Update` to notify the update of the item. procedure On_Update (Instance : in Listener; Item : in Element_Type) is abstract; -- The `On_Delete` procedure is called by `Notify_Delete` to notify the deletion of the item. procedure On_Delete (Instance : in Listener; Item : in Element_Type) is abstract; -- Inform the the lifecycle listeners registered in `List` that the item passed in `Item` -- has been created (calls `On_Create`). procedure Notify_Create (List : in Util.Listeners.List; Item : in Element_Type); -- Inform the the lifecycle listeners registered in `List` that the item passed in `Item` -- has been updated (calls `On_Update`). procedure Notify_Update (List : in Util.Listeners.List; Item : in Element_Type); -- Inform the the lifecycle listeners registered in `List` that the item passed in `Item` -- has been deleted (calls `On_Delete`). procedure Notify_Delete (List : in Util.Listeners.List; Item : in Element_Type); end Util.Listeners.Lifecycles;
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with swig; with Interfaces.C; package xcb is -- xcb_connection_t -- subtype xcb_connection_t is swig.opaque_structure; type xcb_connection_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_connection_t; -- xcb_special_event_t -- subtype xcb_special_event_t is swig.opaque_structure; type xcb_special_event_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_special_event_t; -- xcb_window_t -- subtype xcb_window_t is Interfaces.Unsigned_32; type xcb_window_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_window_t; -- xcb_pixmap_t -- subtype xcb_pixmap_t is Interfaces.Unsigned_32; type xcb_pixmap_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_pixmap_t; -- xcb_cursor_t -- subtype xcb_cursor_t is Interfaces.Unsigned_32; type xcb_cursor_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_cursor_t; -- xcb_font_t -- subtype xcb_font_t is Interfaces.Unsigned_32; type xcb_font_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_font_t; -- xcb_gcontext_t -- subtype xcb_gcontext_t is Interfaces.Unsigned_32; type xcb_gcontext_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_gcontext_t; -- xcb_colormap_t -- subtype xcb_colormap_t is Interfaces.Unsigned_32; type xcb_colormap_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_colormap_t; -- xcb_atom_t -- subtype xcb_atom_t is Interfaces.Unsigned_32; type xcb_atom_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_atom_t; -- xcb_drawable_t -- subtype xcb_drawable_t is Interfaces.Unsigned_32; type xcb_drawable_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_drawable_t; -- xcb_fontable_t -- subtype xcb_fontable_t is Interfaces.Unsigned_32; type xcb_fontable_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_fontable_t; -- xcb_bool32_t -- subtype xcb_bool32_t is Interfaces.Unsigned_32; type xcb_bool32_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_bool32_t; -- xcb_visualid_t -- subtype xcb_visualid_t is Interfaces.Unsigned_32; type xcb_visualid_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_visualid_t; -- xcb_timestamp_t -- subtype xcb_timestamp_t is Interfaces.Unsigned_32; type xcb_timestamp_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_timestamp_t; -- xcb_keysym_t -- subtype xcb_keysym_t is Interfaces.Unsigned_32; type xcb_keysym_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_keysym_t; -- xcb_keycode_t -- subtype xcb_keycode_t is Interfaces.Unsigned_8; type xcb_keycode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_keycode_t; -- xcb_keycode32_t -- subtype xcb_keycode32_t is Interfaces.Unsigned_32; type xcb_keycode32_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_keycode32_t; -- xcb_button_t -- subtype xcb_button_t is Interfaces.Unsigned_8; type xcb_button_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_button_t; -- xcb_visual_class_t -- type xcb_visual_class_t is (XCB_VISUAL_CLASS_STATIC_GRAY, XCB_VISUAL_CLASS_GRAY_SCALE, XCB_VISUAL_CLASS_STATIC_COLOR, XCB_VISUAL_CLASS_PSEUDO_COLOR, XCB_VISUAL_CLASS_TRUE_COLOR, XCB_VISUAL_CLASS_DIRECT_COLOR); for xcb_visual_class_t use (XCB_VISUAL_CLASS_STATIC_GRAY => 0, XCB_VISUAL_CLASS_GRAY_SCALE => 1, XCB_VISUAL_CLASS_STATIC_COLOR => 2, XCB_VISUAL_CLASS_PSEUDO_COLOR => 3, XCB_VISUAL_CLASS_TRUE_COLOR => 4, XCB_VISUAL_CLASS_DIRECT_COLOR => 5); pragma Convention (C, xcb_visual_class_t); type xcb_visual_class_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_visual_class_t; -- xcb_event_mask_t -- type xcb_event_mask_t is (XCB_EVENT_MASK_NO_EVENT, XCB_EVENT_MASK_KEY_PRESS, XCB_EVENT_MASK_KEY_RELEASE, XCB_EVENT_MASK_BUTTON_PRESS, XCB_EVENT_MASK_BUTTON_RELEASE, XCB_EVENT_MASK_ENTER_WINDOW, XCB_EVENT_MASK_LEAVE_WINDOW, XCB_EVENT_MASK_POINTER_MOTION, XCB_EVENT_MASK_POINTER_MOTION_HINT, XCB_EVENT_MASK_BUTTON_1_MOTION, XCB_EVENT_MASK_BUTTON_2_MOTION, XCB_EVENT_MASK_BUTTON_3_MOTION, XCB_EVENT_MASK_BUTTON_4_MOTION, XCB_EVENT_MASK_BUTTON_5_MOTION, XCB_EVENT_MASK_BUTTON_MOTION, XCB_EVENT_MASK_KEYMAP_STATE, XCB_EVENT_MASK_EXPOSURE, XCB_EVENT_MASK_VISIBILITY_CHANGE, XCB_EVENT_MASK_STRUCTURE_NOTIFY, XCB_EVENT_MASK_RESIZE_REDIRECT, XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY, XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, XCB_EVENT_MASK_FOCUS_CHANGE, XCB_EVENT_MASK_PROPERTY_CHANGE, XCB_EVENT_MASK_COLOR_MAP_CHANGE, XCB_EVENT_MASK_OWNER_GRAB_BUTTON); for xcb_event_mask_t use (XCB_EVENT_MASK_NO_EVENT => 0, XCB_EVENT_MASK_KEY_PRESS => 1, XCB_EVENT_MASK_KEY_RELEASE => 2, XCB_EVENT_MASK_BUTTON_PRESS => 4, XCB_EVENT_MASK_BUTTON_RELEASE => 8, XCB_EVENT_MASK_ENTER_WINDOW => 16, XCB_EVENT_MASK_LEAVE_WINDOW => 32, XCB_EVENT_MASK_POINTER_MOTION => 64, XCB_EVENT_MASK_POINTER_MOTION_HINT => 128, XCB_EVENT_MASK_BUTTON_1_MOTION => 256, XCB_EVENT_MASK_BUTTON_2_MOTION => 512, XCB_EVENT_MASK_BUTTON_3_MOTION => 1_024, XCB_EVENT_MASK_BUTTON_4_MOTION => 2_048, XCB_EVENT_MASK_BUTTON_5_MOTION => 4_096, XCB_EVENT_MASK_BUTTON_MOTION => 8_192, XCB_EVENT_MASK_KEYMAP_STATE => 16_384, XCB_EVENT_MASK_EXPOSURE => 32_768, XCB_EVENT_MASK_VISIBILITY_CHANGE => 65_536, XCB_EVENT_MASK_STRUCTURE_NOTIFY => 131_072, XCB_EVENT_MASK_RESIZE_REDIRECT => 262_144, XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY => 524_288, XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT => 1_048_576, XCB_EVENT_MASK_FOCUS_CHANGE => 2_097_152, XCB_EVENT_MASK_PROPERTY_CHANGE => 4_194_304, XCB_EVENT_MASK_COLOR_MAP_CHANGE => 8_388_608, XCB_EVENT_MASK_OWNER_GRAB_BUTTON => 16_777_216); pragma Convention (C, xcb_event_mask_t); type xcb_event_mask_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_event_mask_t; -- xcb_backing_store_t -- type xcb_backing_store_t is (XCB_BACKING_STORE_NOT_USEFUL, XCB_BACKING_STORE_WHEN_MAPPED, XCB_BACKING_STORE_ALWAYS); for xcb_backing_store_t use (XCB_BACKING_STORE_NOT_USEFUL => 0, XCB_BACKING_STORE_WHEN_MAPPED => 1, XCB_BACKING_STORE_ALWAYS => 2); pragma Convention (C, xcb_backing_store_t); type xcb_backing_store_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_backing_store_t; -- xcb_image_order_t -- type xcb_image_order_t is (XCB_IMAGE_ORDER_LSB_FIRST, XCB_IMAGE_ORDER_MSB_FIRST); for xcb_image_order_t use (XCB_IMAGE_ORDER_LSB_FIRST => 0, XCB_IMAGE_ORDER_MSB_FIRST => 1); pragma Convention (C, xcb_image_order_t); type xcb_image_order_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_image_order_t; -- xcb_mod_mask_t -- type xcb_mod_mask_t is (XCB_MOD_MASK_SHIFT, XCB_MOD_MASK_LOCK, XCB_MOD_MASK_CONTROL, XCB_MOD_MASK_1, XCB_MOD_MASK_2, XCB_MOD_MASK_3, XCB_MOD_MASK_4, XCB_MOD_MASK_5, XCB_MOD_MASK_ANY); for xcb_mod_mask_t use (XCB_MOD_MASK_SHIFT => 1, XCB_MOD_MASK_LOCK => 2, XCB_MOD_MASK_CONTROL => 4, XCB_MOD_MASK_1 => 8, XCB_MOD_MASK_2 => 16, XCB_MOD_MASK_3 => 32, XCB_MOD_MASK_4 => 64, XCB_MOD_MASK_5 => 128, XCB_MOD_MASK_ANY => 32_768); pragma Convention (C, xcb_mod_mask_t); type xcb_mod_mask_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_mod_mask_t; -- xcb_key_but_mask_t -- type xcb_key_but_mask_t is (XCB_KEY_BUT_MASK_SHIFT, XCB_KEY_BUT_MASK_LOCK, XCB_KEY_BUT_MASK_CONTROL, XCB_KEY_BUT_MASK_MOD_1, XCB_KEY_BUT_MASK_MOD_2, XCB_KEY_BUT_MASK_MOD_3, XCB_KEY_BUT_MASK_MOD_4, XCB_KEY_BUT_MASK_MOD_5, XCB_KEY_BUT_MASK_BUTTON_1, XCB_KEY_BUT_MASK_BUTTON_2, XCB_KEY_BUT_MASK_BUTTON_3, XCB_KEY_BUT_MASK_BUTTON_4, XCB_KEY_BUT_MASK_BUTTON_5); for xcb_key_but_mask_t use (XCB_KEY_BUT_MASK_SHIFT => 1, XCB_KEY_BUT_MASK_LOCK => 2, XCB_KEY_BUT_MASK_CONTROL => 4, XCB_KEY_BUT_MASK_MOD_1 => 8, XCB_KEY_BUT_MASK_MOD_2 => 16, XCB_KEY_BUT_MASK_MOD_3 => 32, XCB_KEY_BUT_MASK_MOD_4 => 64, XCB_KEY_BUT_MASK_MOD_5 => 128, XCB_KEY_BUT_MASK_BUTTON_1 => 256, XCB_KEY_BUT_MASK_BUTTON_2 => 512, XCB_KEY_BUT_MASK_BUTTON_3 => 1_024, XCB_KEY_BUT_MASK_BUTTON_4 => 2_048, XCB_KEY_BUT_MASK_BUTTON_5 => 4_096); pragma Convention (C, xcb_key_but_mask_t); type xcb_key_but_mask_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_key_but_mask_t; -- xcb_window_enum_t -- type xcb_window_enum_t is (XCB_WINDOW_NONE); for xcb_window_enum_t use (XCB_WINDOW_NONE => 0); pragma Convention (C, xcb_window_enum_t); type xcb_window_enum_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_window_enum_t; -- xcb_button_mask_t -- type xcb_button_mask_t is (XCB_BUTTON_MASK_1, XCB_BUTTON_MASK_2, XCB_BUTTON_MASK_3, XCB_BUTTON_MASK_4, XCB_BUTTON_MASK_5, XCB_BUTTON_MASK_ANY); for xcb_button_mask_t use (XCB_BUTTON_MASK_1 => 256, XCB_BUTTON_MASK_2 => 512, XCB_BUTTON_MASK_3 => 1_024, XCB_BUTTON_MASK_4 => 2_048, XCB_BUTTON_MASK_5 => 4_096, XCB_BUTTON_MASK_ANY => 32_768); pragma Convention (C, xcb_button_mask_t); type xcb_button_mask_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_button_mask_t; -- xcb_motion_t -- type xcb_motion_t is (XCB_MOTION_NORMAL, XCB_MOTION_HINT); for xcb_motion_t use (XCB_MOTION_NORMAL => 0, XCB_MOTION_HINT => 1); pragma Convention (C, xcb_motion_t); type xcb_motion_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_motion_t; -- xcb_notify_detail_t -- type xcb_notify_detail_t is (XCB_NOTIFY_DETAIL_ANCESTOR, XCB_NOTIFY_DETAIL_VIRTUAL, XCB_NOTIFY_DETAIL_INFERIOR, XCB_NOTIFY_DETAIL_NONLINEAR, XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL, XCB_NOTIFY_DETAIL_POINTER, XCB_NOTIFY_DETAIL_POINTER_ROOT, XCB_NOTIFY_DETAIL_NONE); for xcb_notify_detail_t use (XCB_NOTIFY_DETAIL_ANCESTOR => 0, XCB_NOTIFY_DETAIL_VIRTUAL => 1, XCB_NOTIFY_DETAIL_INFERIOR => 2, XCB_NOTIFY_DETAIL_NONLINEAR => 3, XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL => 4, XCB_NOTIFY_DETAIL_POINTER => 5, XCB_NOTIFY_DETAIL_POINTER_ROOT => 6, XCB_NOTIFY_DETAIL_NONE => 7); pragma Convention (C, xcb_notify_detail_t); type xcb_notify_detail_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_notify_detail_t; -- xcb_notify_mode_t -- type xcb_notify_mode_t is (XCB_NOTIFY_MODE_NORMAL, XCB_NOTIFY_MODE_GRAB, XCB_NOTIFY_MODE_UNGRAB, XCB_NOTIFY_MODE_WHILE_GRABBED); for xcb_notify_mode_t use (XCB_NOTIFY_MODE_NORMAL => 0, XCB_NOTIFY_MODE_GRAB => 1, XCB_NOTIFY_MODE_UNGRAB => 2, XCB_NOTIFY_MODE_WHILE_GRABBED => 3); pragma Convention (C, xcb_notify_mode_t); type xcb_notify_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_notify_mode_t; -- xcb_visibility_t -- type xcb_visibility_t is (XCB_VISIBILITY_UNOBSCURED, XCB_VISIBILITY_PARTIALLY_OBSCURED, XCB_VISIBILITY_FULLY_OBSCURED); for xcb_visibility_t use (XCB_VISIBILITY_UNOBSCURED => 0, XCB_VISIBILITY_PARTIALLY_OBSCURED => 1, XCB_VISIBILITY_FULLY_OBSCURED => 2); pragma Convention (C, xcb_visibility_t); type xcb_visibility_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_visibility_t; -- xcb_place_t -- type xcb_place_t is (XCB_PLACE_ON_TOP, XCB_PLACE_ON_BOTTOM); for xcb_place_t use (XCB_PLACE_ON_TOP => 0, XCB_PLACE_ON_BOTTOM => 1); pragma Convention (C, xcb_place_t); type xcb_place_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_place_t; -- xcb_property_t -- type xcb_property_t is (XCB_PROPERTY_NEW_VALUE, XCB_PROPERTY_DELETE); for xcb_property_t use (XCB_PROPERTY_NEW_VALUE => 0, XCB_PROPERTY_DELETE => 1); pragma Convention (C, xcb_property_t); type xcb_property_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_property_t; -- xcb_time_t -- type xcb_time_t is (XCB_TIME_CURRENT_TIME); for xcb_time_t use (XCB_TIME_CURRENT_TIME => 0); pragma Convention (C, xcb_time_t); type xcb_time_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_time_t; -- xcb_atom_enum_t -- type xcb_atom_enum_t is (XCB_ATOM_NONE, XCB_ATOM_PRIMARY, XCB_ATOM_SECONDARY, XCB_ATOM_ARC, XCB_ATOM_ATOM, XCB_ATOM_BITMAP, XCB_ATOM_CARDINAL, XCB_ATOM_COLORMAP, XCB_ATOM_CURSOR, XCB_ATOM_CUT_BUFFER0, XCB_ATOM_CUT_BUFFER1, XCB_ATOM_CUT_BUFFER2, XCB_ATOM_CUT_BUFFER3, XCB_ATOM_CUT_BUFFER4, XCB_ATOM_CUT_BUFFER5, XCB_ATOM_CUT_BUFFER6, XCB_ATOM_CUT_BUFFER7, XCB_ATOM_DRAWABLE, XCB_ATOM_FONT, XCB_ATOM_INTEGER, XCB_ATOM_PIXMAP, XCB_ATOM_POINT, XCB_ATOM_RECTANGLE, XCB_ATOM_RESOURCE_MANAGER, XCB_ATOM_RGB_COLOR_MAP, XCB_ATOM_RGB_BEST_MAP, XCB_ATOM_RGB_BLUE_MAP, XCB_ATOM_RGB_DEFAULT_MAP, XCB_ATOM_RGB_GRAY_MAP, XCB_ATOM_RGB_GREEN_MAP, XCB_ATOM_RGB_RED_MAP, XCB_ATOM_STRING, XCB_ATOM_VISUALID, XCB_ATOM_WINDOW, XCB_ATOM_WM_COMMAND, XCB_ATOM_WM_HINTS, XCB_ATOM_WM_CLIENT_MACHINE, XCB_ATOM_WM_ICON_NAME, XCB_ATOM_WM_ICON_SIZE, XCB_ATOM_WM_NAME, XCB_ATOM_WM_NORMAL_HINTS, XCB_ATOM_WM_SIZE_HINTS, XCB_ATOM_WM_ZOOM_HINTS, XCB_ATOM_MIN_SPACE, XCB_ATOM_NORM_SPACE, XCB_ATOM_MAX_SPACE, XCB_ATOM_END_SPACE, XCB_ATOM_SUPERSCRIPT_X, XCB_ATOM_SUPERSCRIPT_Y, XCB_ATOM_SUBSCRIPT_X, XCB_ATOM_SUBSCRIPT_Y, XCB_ATOM_UNDERLINE_POSITION, XCB_ATOM_UNDERLINE_THICKNESS, XCB_ATOM_STRIKEOUT_ASCENT, XCB_ATOM_STRIKEOUT_DESCENT, XCB_ATOM_ITALIC_ANGLE, XCB_ATOM_X_HEIGHT, XCB_ATOM_QUAD_WIDTH, XCB_ATOM_WEIGHT, XCB_ATOM_POINT_SIZE, XCB_ATOM_RESOLUTION, XCB_ATOM_COPYRIGHT, XCB_ATOM_NOTICE, XCB_ATOM_FONT_NAME, XCB_ATOM_FAMILY_NAME, XCB_ATOM_FULL_NAME, XCB_ATOM_CAP_HEIGHT, XCB_ATOM_WM_CLASS, XCB_ATOM_WM_TRANSIENT_FOR); for xcb_atom_enum_t use (XCB_ATOM_NONE => 0, XCB_ATOM_PRIMARY => 1, XCB_ATOM_SECONDARY => 2, XCB_ATOM_ARC => 3, XCB_ATOM_ATOM => 4, XCB_ATOM_BITMAP => 5, XCB_ATOM_CARDINAL => 6, XCB_ATOM_COLORMAP => 7, XCB_ATOM_CURSOR => 8, XCB_ATOM_CUT_BUFFER0 => 9, XCB_ATOM_CUT_BUFFER1 => 10, XCB_ATOM_CUT_BUFFER2 => 11, XCB_ATOM_CUT_BUFFER3 => 12, XCB_ATOM_CUT_BUFFER4 => 13, XCB_ATOM_CUT_BUFFER5 => 14, XCB_ATOM_CUT_BUFFER6 => 15, XCB_ATOM_CUT_BUFFER7 => 16, XCB_ATOM_DRAWABLE => 17, XCB_ATOM_FONT => 18, XCB_ATOM_INTEGER => 19, XCB_ATOM_PIXMAP => 20, XCB_ATOM_POINT => 21, XCB_ATOM_RECTANGLE => 22, XCB_ATOM_RESOURCE_MANAGER => 23, XCB_ATOM_RGB_COLOR_MAP => 24, XCB_ATOM_RGB_BEST_MAP => 25, XCB_ATOM_RGB_BLUE_MAP => 26, XCB_ATOM_RGB_DEFAULT_MAP => 27, XCB_ATOM_RGB_GRAY_MAP => 28, XCB_ATOM_RGB_GREEN_MAP => 29, XCB_ATOM_RGB_RED_MAP => 30, XCB_ATOM_STRING => 31, XCB_ATOM_VISUALID => 32, XCB_ATOM_WINDOW => 33, XCB_ATOM_WM_COMMAND => 34, XCB_ATOM_WM_HINTS => 35, XCB_ATOM_WM_CLIENT_MACHINE => 36, XCB_ATOM_WM_ICON_NAME => 37, XCB_ATOM_WM_ICON_SIZE => 38, XCB_ATOM_WM_NAME => 39, XCB_ATOM_WM_NORMAL_HINTS => 40, XCB_ATOM_WM_SIZE_HINTS => 41, XCB_ATOM_WM_ZOOM_HINTS => 42, XCB_ATOM_MIN_SPACE => 43, XCB_ATOM_NORM_SPACE => 44, XCB_ATOM_MAX_SPACE => 45, XCB_ATOM_END_SPACE => 46, XCB_ATOM_SUPERSCRIPT_X => 47, XCB_ATOM_SUPERSCRIPT_Y => 48, XCB_ATOM_SUBSCRIPT_X => 49, XCB_ATOM_SUBSCRIPT_Y => 50, XCB_ATOM_UNDERLINE_POSITION => 51, XCB_ATOM_UNDERLINE_THICKNESS => 52, XCB_ATOM_STRIKEOUT_ASCENT => 53, XCB_ATOM_STRIKEOUT_DESCENT => 54, XCB_ATOM_ITALIC_ANGLE => 55, XCB_ATOM_X_HEIGHT => 56, XCB_ATOM_QUAD_WIDTH => 57, XCB_ATOM_WEIGHT => 58, XCB_ATOM_POINT_SIZE => 59, XCB_ATOM_RESOLUTION => 60, XCB_ATOM_COPYRIGHT => 61, XCB_ATOM_NOTICE => 62, XCB_ATOM_FONT_NAME => 63, XCB_ATOM_FAMILY_NAME => 64, XCB_ATOM_FULL_NAME => 65, XCB_ATOM_CAP_HEIGHT => 66, XCB_ATOM_WM_CLASS => 67, XCB_ATOM_WM_TRANSIENT_FOR => 68); pragma Convention (C, xcb_atom_enum_t); type xcb_atom_enum_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_atom_enum_t; -- xcb_colormap_state_t -- type xcb_colormap_state_t is (XCB_COLORMAP_STATE_UNINSTALLED, XCB_COLORMAP_STATE_INSTALLED); for xcb_colormap_state_t use (XCB_COLORMAP_STATE_UNINSTALLED => 0, XCB_COLORMAP_STATE_INSTALLED => 1); pragma Convention (C, xcb_colormap_state_t); type xcb_colormap_state_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_colormap_state_t; -- xcb_colormap_enum_t -- type xcb_colormap_enum_t is (XCB_COLORMAP_NONE); for xcb_colormap_enum_t use (XCB_COLORMAP_NONE => 0); pragma Convention (C, xcb_colormap_enum_t); type xcb_colormap_enum_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_colormap_enum_t; -- xcb_mapping_t -- type xcb_mapping_t is (XCB_MAPPING_MODIFIER, XCB_MAPPING_KEYBOARD, XCB_MAPPING_POINTER); for xcb_mapping_t use (XCB_MAPPING_MODIFIER => 0, XCB_MAPPING_KEYBOARD => 1, XCB_MAPPING_POINTER => 2); pragma Convention (C, xcb_mapping_t); type xcb_mapping_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_mapping_t; -- xcb_window_class_t -- type xcb_window_class_t is (XCB_WINDOW_CLASS_COPY_FROM_PARENT, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_INPUT_ONLY); for xcb_window_class_t use (XCB_WINDOW_CLASS_COPY_FROM_PARENT => 0, XCB_WINDOW_CLASS_INPUT_OUTPUT => 1, XCB_WINDOW_CLASS_INPUT_ONLY => 2); pragma Convention (C, xcb_window_class_t); type xcb_window_class_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_window_class_t; -- xcb_cw_t -- type xcb_cw_t is (XCB_CW_BACK_PIXMAP, XCB_CW_BACK_PIXEL, XCB_CW_BORDER_PIXMAP, XCB_CW_BORDER_PIXEL, XCB_CW_BIT_GRAVITY, XCB_CW_WIN_GRAVITY, XCB_CW_BACKING_STORE, XCB_CW_BACKING_PLANES, XCB_CW_BACKING_PIXEL, XCB_CW_OVERRIDE_REDIRECT, XCB_CW_SAVE_UNDER, XCB_CW_EVENT_MASK, XCB_CW_DONT_PROPAGATE, XCB_CW_COLORMAP, XCB_CW_CURSOR); for xcb_cw_t use (XCB_CW_BACK_PIXMAP => 1, XCB_CW_BACK_PIXEL => 2, XCB_CW_BORDER_PIXMAP => 4, XCB_CW_BORDER_PIXEL => 8, XCB_CW_BIT_GRAVITY => 16, XCB_CW_WIN_GRAVITY => 32, XCB_CW_BACKING_STORE => 64, XCB_CW_BACKING_PLANES => 128, XCB_CW_BACKING_PIXEL => 256, XCB_CW_OVERRIDE_REDIRECT => 512, XCB_CW_SAVE_UNDER => 1_024, XCB_CW_EVENT_MASK => 2_048, XCB_CW_DONT_PROPAGATE => 4_096, XCB_CW_COLORMAP => 8_192, XCB_CW_CURSOR => 16_384); pragma Convention (C, xcb_cw_t); type xcb_cw_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_cw_t; -- xcb_back_pixmap_t -- type xcb_back_pixmap_t is (XCB_BACK_PIXMAP_NONE, XCB_BACK_PIXMAP_PARENT_RELATIVE); for xcb_back_pixmap_t use (XCB_BACK_PIXMAP_NONE => 0, XCB_BACK_PIXMAP_PARENT_RELATIVE => 1); pragma Convention (C, xcb_back_pixmap_t); type xcb_back_pixmap_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_back_pixmap_t; -- xcb_gravity_t -- type xcb_gravity_t is (XCB_GRAVITY_BIT_FORGET, XCB_GRAVITY_NORTH_WEST, XCB_GRAVITY_NORTH, XCB_GRAVITY_NORTH_EAST, XCB_GRAVITY_WEST, XCB_GRAVITY_CENTER, XCB_GRAVITY_EAST, XCB_GRAVITY_SOUTH_WEST, XCB_GRAVITY_SOUTH, XCB_GRAVITY_SOUTH_EAST, XCB_GRAVITY_STATIC); for xcb_gravity_t use (XCB_GRAVITY_BIT_FORGET => 0, XCB_GRAVITY_NORTH_WEST => 1, XCB_GRAVITY_NORTH => 2, XCB_GRAVITY_NORTH_EAST => 3, XCB_GRAVITY_WEST => 4, XCB_GRAVITY_CENTER => 5, XCB_GRAVITY_EAST => 6, XCB_GRAVITY_SOUTH_WEST => 7, XCB_GRAVITY_SOUTH => 8, XCB_GRAVITY_SOUTH_EAST => 9, XCB_GRAVITY_STATIC => 10); pragma Convention (C, xcb_gravity_t); type xcb_gravity_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_gravity_t; -- xcb_map_state_t -- type xcb_map_state_t is (XCB_MAP_STATE_UNMAPPED, XCB_MAP_STATE_UNVIEWABLE, XCB_MAP_STATE_VIEWABLE); for xcb_map_state_t use (XCB_MAP_STATE_UNMAPPED => 0, XCB_MAP_STATE_UNVIEWABLE => 1, XCB_MAP_STATE_VIEWABLE => 2); pragma Convention (C, xcb_map_state_t); type xcb_map_state_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_map_state_t; -- xcb_set_mode_t -- type xcb_set_mode_t is (XCB_SET_MODE_INSERT, XCB_SET_MODE_DELETE); for xcb_set_mode_t use (XCB_SET_MODE_INSERT => 0, XCB_SET_MODE_DELETE => 1); pragma Convention (C, xcb_set_mode_t); type xcb_set_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_set_mode_t; -- xcb_config_window_t -- type xcb_config_window_t is (XCB_CONFIG_WINDOW_X, XCB_CONFIG_WINDOW_Y, XCB_CONFIG_WINDOW_WIDTH, XCB_CONFIG_WINDOW_HEIGHT, XCB_CONFIG_WINDOW_BORDER_WIDTH, XCB_CONFIG_WINDOW_SIBLING, XCB_CONFIG_WINDOW_STACK_MODE); for xcb_config_window_t use (XCB_CONFIG_WINDOW_X => 1, XCB_CONFIG_WINDOW_Y => 2, XCB_CONFIG_WINDOW_WIDTH => 4, XCB_CONFIG_WINDOW_HEIGHT => 8, XCB_CONFIG_WINDOW_BORDER_WIDTH => 16, XCB_CONFIG_WINDOW_SIBLING => 32, XCB_CONFIG_WINDOW_STACK_MODE => 64); pragma Convention (C, xcb_config_window_t); type xcb_config_window_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_config_window_t; -- xcb_stack_mode_t -- type xcb_stack_mode_t is (XCB_STACK_MODE_ABOVE, XCB_STACK_MODE_BELOW, XCB_STACK_MODE_TOP_IF, XCB_STACK_MODE_BOTTOM_IF, XCB_STACK_MODE_OPPOSITE); for xcb_stack_mode_t use (XCB_STACK_MODE_ABOVE => 0, XCB_STACK_MODE_BELOW => 1, XCB_STACK_MODE_TOP_IF => 2, XCB_STACK_MODE_BOTTOM_IF => 3, XCB_STACK_MODE_OPPOSITE => 4); pragma Convention (C, xcb_stack_mode_t); type xcb_stack_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_stack_mode_t; -- xcb_circulate_t -- type xcb_circulate_t is (XCB_CIRCULATE_RAISE_LOWEST, XCB_CIRCULATE_LOWER_HIGHEST); for xcb_circulate_t use (XCB_CIRCULATE_RAISE_LOWEST => 0, XCB_CIRCULATE_LOWER_HIGHEST => 1); pragma Convention (C, xcb_circulate_t); type xcb_circulate_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_circulate_t; -- xcb_prop_mode_t -- type xcb_prop_mode_t is (XCB_PROP_MODE_REPLACE, XCB_PROP_MODE_PREPEND, XCB_PROP_MODE_APPEND); for xcb_prop_mode_t use (XCB_PROP_MODE_REPLACE => 0, XCB_PROP_MODE_PREPEND => 1, XCB_PROP_MODE_APPEND => 2); pragma Convention (C, xcb_prop_mode_t); type xcb_prop_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_prop_mode_t; -- xcb_get_property_type_t -- type xcb_get_property_type_t is (XCB_GET_PROPERTY_TYPE_ANY); for xcb_get_property_type_t use (XCB_GET_PROPERTY_TYPE_ANY => 0); pragma Convention (C, xcb_get_property_type_t); type xcb_get_property_type_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_get_property_type_t; -- xcb_send_event_dest_t -- type xcb_send_event_dest_t is (XCB_SEND_EVENT_DEST_POINTER_WINDOW, XCB_SEND_EVENT_DEST_ITEM_FOCUS); for xcb_send_event_dest_t use (XCB_SEND_EVENT_DEST_POINTER_WINDOW => 0, XCB_SEND_EVENT_DEST_ITEM_FOCUS => 1); pragma Convention (C, xcb_send_event_dest_t); type xcb_send_event_dest_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_send_event_dest_t; -- xcb_grab_mode_t -- type xcb_grab_mode_t is (XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC); for xcb_grab_mode_t use (XCB_GRAB_MODE_SYNC => 0, XCB_GRAB_MODE_ASYNC => 1); pragma Convention (C, xcb_grab_mode_t); type xcb_grab_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_grab_mode_t; -- xcb_grab_status_t -- type xcb_grab_status_t is (XCB_GRAB_STATUS_SUCCESS, XCB_GRAB_STATUS_ALREADY_GRABBED, XCB_GRAB_STATUS_INVALID_TIME, XCB_GRAB_STATUS_NOT_VIEWABLE, XCB_GRAB_STATUS_FROZEN); for xcb_grab_status_t use (XCB_GRAB_STATUS_SUCCESS => 0, XCB_GRAB_STATUS_ALREADY_GRABBED => 1, XCB_GRAB_STATUS_INVALID_TIME => 2, XCB_GRAB_STATUS_NOT_VIEWABLE => 3, XCB_GRAB_STATUS_FROZEN => 4); pragma Convention (C, xcb_grab_status_t); type xcb_grab_status_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_grab_status_t; -- xcb_cursor_enum_t -- type xcb_cursor_enum_t is (XCB_CURSOR_NONE); for xcb_cursor_enum_t use (XCB_CURSOR_NONE => 0); pragma Convention (C, xcb_cursor_enum_t); type xcb_cursor_enum_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_cursor_enum_t; -- xcb_button_index_t -- type xcb_button_index_t is (XCB_BUTTON_INDEX_ANY, XCB_BUTTON_INDEX_1, XCB_BUTTON_INDEX_2, XCB_BUTTON_INDEX_3, XCB_BUTTON_INDEX_4, XCB_BUTTON_INDEX_5); for xcb_button_index_t use (XCB_BUTTON_INDEX_ANY => 0, XCB_BUTTON_INDEX_1 => 1, XCB_BUTTON_INDEX_2 => 2, XCB_BUTTON_INDEX_3 => 3, XCB_BUTTON_INDEX_4 => 4, XCB_BUTTON_INDEX_5 => 5); pragma Convention (C, xcb_button_index_t); type xcb_button_index_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_button_index_t; -- xcb_grab_t -- type xcb_grab_t is (XCB_GRAB_ANY); for xcb_grab_t use (XCB_GRAB_ANY => 0); pragma Convention (C, xcb_grab_t); type xcb_grab_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_grab_t; -- xcb_allow_t -- type xcb_allow_t is (XCB_ALLOW_ASYNC_POINTER, XCB_ALLOW_SYNC_POINTER, XCB_ALLOW_REPLAY_POINTER, XCB_ALLOW_ASYNC_KEYBOARD, XCB_ALLOW_SYNC_KEYBOARD, XCB_ALLOW_REPLAY_KEYBOARD, XCB_ALLOW_ASYNC_BOTH, XCB_ALLOW_SYNC_BOTH); for xcb_allow_t use (XCB_ALLOW_ASYNC_POINTER => 0, XCB_ALLOW_SYNC_POINTER => 1, XCB_ALLOW_REPLAY_POINTER => 2, XCB_ALLOW_ASYNC_KEYBOARD => 3, XCB_ALLOW_SYNC_KEYBOARD => 4, XCB_ALLOW_REPLAY_KEYBOARD => 5, XCB_ALLOW_ASYNC_BOTH => 6, XCB_ALLOW_SYNC_BOTH => 7); pragma Convention (C, xcb_allow_t); type xcb_allow_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_allow_t; -- xcb_input_focus_t -- type xcb_input_focus_t is (XCB_INPUT_FOCUS_NONE, XCB_INPUT_FOCUS_POINTER_ROOT, XCB_INPUT_FOCUS_PARENT, XCB_INPUT_FOCUS_FOLLOW_KEYBOARD); for xcb_input_focus_t use (XCB_INPUT_FOCUS_NONE => 0, XCB_INPUT_FOCUS_POINTER_ROOT => 1, XCB_INPUT_FOCUS_PARENT => 2, XCB_INPUT_FOCUS_FOLLOW_KEYBOARD => 3); pragma Convention (C, xcb_input_focus_t); type xcb_input_focus_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_input_focus_t; -- xcb_font_draw_t -- type xcb_font_draw_t is (XCB_FONT_DRAW_LEFT_TO_RIGHT, XCB_FONT_DRAW_RIGHT_TO_LEFT); for xcb_font_draw_t use (XCB_FONT_DRAW_LEFT_TO_RIGHT => 0, XCB_FONT_DRAW_RIGHT_TO_LEFT => 1); pragma Convention (C, xcb_font_draw_t); type xcb_font_draw_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_font_draw_t; -- xcb_gc_t -- type xcb_gc_t is (XCB_GC_FUNCTION, XCB_GC_PLANE_MASK, XCB_GC_FOREGROUND, XCB_GC_BACKGROUND, XCB_GC_LINE_WIDTH, XCB_GC_LINE_STYLE, XCB_GC_CAP_STYLE, XCB_GC_JOIN_STYLE, XCB_GC_FILL_STYLE, XCB_GC_FILL_RULE, XCB_GC_TILE, XCB_GC_STIPPLE, XCB_GC_TILE_STIPPLE_ORIGIN_X, XCB_GC_TILE_STIPPLE_ORIGIN_Y, XCB_GC_FONT, XCB_GC_SUBWINDOW_MODE, XCB_GC_GRAPHICS_EXPOSURES, XCB_GC_CLIP_ORIGIN_X, XCB_GC_CLIP_ORIGIN_Y, XCB_GC_CLIP_MASK, XCB_GC_DASH_OFFSET, XCB_GC_DASH_LIST, XCB_GC_ARC_MODE); for xcb_gc_t use (XCB_GC_FUNCTION => 1, XCB_GC_PLANE_MASK => 2, XCB_GC_FOREGROUND => 4, XCB_GC_BACKGROUND => 8, XCB_GC_LINE_WIDTH => 16, XCB_GC_LINE_STYLE => 32, XCB_GC_CAP_STYLE => 64, XCB_GC_JOIN_STYLE => 128, XCB_GC_FILL_STYLE => 256, XCB_GC_FILL_RULE => 512, XCB_GC_TILE => 1_024, XCB_GC_STIPPLE => 2_048, XCB_GC_TILE_STIPPLE_ORIGIN_X => 4_096, XCB_GC_TILE_STIPPLE_ORIGIN_Y => 8_192, XCB_GC_FONT => 16_384, XCB_GC_SUBWINDOW_MODE => 32_768, XCB_GC_GRAPHICS_EXPOSURES => 65_536, XCB_GC_CLIP_ORIGIN_X => 131_072, XCB_GC_CLIP_ORIGIN_Y => 262_144, XCB_GC_CLIP_MASK => 524_288, XCB_GC_DASH_OFFSET => 1_048_576, XCB_GC_DASH_LIST => 2_097_152, XCB_GC_ARC_MODE => 4_194_304); pragma Convention (C, xcb_gc_t); type xcb_gc_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_gc_t; -- xcb_gx_t -- type xcb_gx_t is (XCB_GX_CLEAR, XCB_GX_AND, XCB_GX_AND_REVERSE, XCB_GX_COPY, XCB_GX_AND_INVERTED, XCB_GX_NOOP, XCB_GX_XOR, XCB_GX_OR, XCB_GX_NOR, XCB_GX_EQUIV, XCB_GX_INVERT, XCB_GX_OR_REVERSE, XCB_GX_COPY_INVERTED, XCB_GX_OR_INVERTED, XCB_GX_NAND, XCB_GX_SET); for xcb_gx_t use (XCB_GX_CLEAR => 0, XCB_GX_AND => 1, XCB_GX_AND_REVERSE => 2, XCB_GX_COPY => 3, XCB_GX_AND_INVERTED => 4, XCB_GX_NOOP => 5, XCB_GX_XOR => 6, XCB_GX_OR => 7, XCB_GX_NOR => 8, XCB_GX_EQUIV => 9, XCB_GX_INVERT => 10, XCB_GX_OR_REVERSE => 11, XCB_GX_COPY_INVERTED => 12, XCB_GX_OR_INVERTED => 13, XCB_GX_NAND => 14, XCB_GX_SET => 15); pragma Convention (C, xcb_gx_t); type xcb_gx_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_gx_t; -- xcb_line_style_t -- type xcb_line_style_t is (XCB_LINE_STYLE_SOLID, XCB_LINE_STYLE_ON_OFF_DASH, XCB_LINE_STYLE_DOUBLE_DASH); for xcb_line_style_t use (XCB_LINE_STYLE_SOLID => 0, XCB_LINE_STYLE_ON_OFF_DASH => 1, XCB_LINE_STYLE_DOUBLE_DASH => 2); pragma Convention (C, xcb_line_style_t); type xcb_line_style_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_line_style_t; -- xcb_cap_style_t -- type xcb_cap_style_t is (XCB_CAP_STYLE_NOT_LAST, XCB_CAP_STYLE_BUTT, XCB_CAP_STYLE_ROUND, XCB_CAP_STYLE_PROJECTING); for xcb_cap_style_t use (XCB_CAP_STYLE_NOT_LAST => 0, XCB_CAP_STYLE_BUTT => 1, XCB_CAP_STYLE_ROUND => 2, XCB_CAP_STYLE_PROJECTING => 3); pragma Convention (C, xcb_cap_style_t); type xcb_cap_style_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_cap_style_t; -- xcb_join_style_t -- type xcb_join_style_t is (XCB_JOIN_STYLE_MITER, XCB_JOIN_STYLE_ROUND, XCB_JOIN_STYLE_BEVEL); for xcb_join_style_t use (XCB_JOIN_STYLE_MITER => 0, XCB_JOIN_STYLE_ROUND => 1, XCB_JOIN_STYLE_BEVEL => 2); pragma Convention (C, xcb_join_style_t); type xcb_join_style_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_join_style_t; -- xcb_fill_style_t -- type xcb_fill_style_t is (XCB_FILL_STYLE_SOLID, XCB_FILL_STYLE_TILED, XCB_FILL_STYLE_STIPPLED, XCB_FILL_STYLE_OPAQUE_STIPPLED); for xcb_fill_style_t use (XCB_FILL_STYLE_SOLID => 0, XCB_FILL_STYLE_TILED => 1, XCB_FILL_STYLE_STIPPLED => 2, XCB_FILL_STYLE_OPAQUE_STIPPLED => 3); pragma Convention (C, xcb_fill_style_t); type xcb_fill_style_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_fill_style_t; -- xcb_fill_rule_t -- type xcb_fill_rule_t is (XCB_FILL_RULE_EVEN_ODD, XCB_FILL_RULE_WINDING); for xcb_fill_rule_t use (XCB_FILL_RULE_EVEN_ODD => 0, XCB_FILL_RULE_WINDING => 1); pragma Convention (C, xcb_fill_rule_t); type xcb_fill_rule_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_fill_rule_t; -- xcb_subwindow_mode_t -- type xcb_subwindow_mode_t is (XCB_SUBWINDOW_MODE_CLIP_BY_CHILDREN, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS); for xcb_subwindow_mode_t use (XCB_SUBWINDOW_MODE_CLIP_BY_CHILDREN => 0, XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS => 1); pragma Convention (C, xcb_subwindow_mode_t); type xcb_subwindow_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_subwindow_mode_t; -- xcb_arc_mode_t -- type xcb_arc_mode_t is (XCB_ARC_MODE_CHORD, XCB_ARC_MODE_PIE_SLICE); for xcb_arc_mode_t use (XCB_ARC_MODE_CHORD => 0, XCB_ARC_MODE_PIE_SLICE => 1); pragma Convention (C, xcb_arc_mode_t); type xcb_arc_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_arc_mode_t; -- xcb_clip_ordering_t -- type xcb_clip_ordering_t is (XCB_CLIP_ORDERING_UNSORTED, XCB_CLIP_ORDERING_Y_SORTED, XCB_CLIP_ORDERING_YX_SORTED, XCB_CLIP_ORDERING_YX_BANDED); for xcb_clip_ordering_t use (XCB_CLIP_ORDERING_UNSORTED => 0, XCB_CLIP_ORDERING_Y_SORTED => 1, XCB_CLIP_ORDERING_YX_SORTED => 2, XCB_CLIP_ORDERING_YX_BANDED => 3); pragma Convention (C, xcb_clip_ordering_t); type xcb_clip_ordering_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_clip_ordering_t; -- xcb_coord_mode_t -- type xcb_coord_mode_t is (XCB_COORD_MODE_ORIGIN, XCB_COORD_MODE_PREVIOUS); for xcb_coord_mode_t use (XCB_COORD_MODE_ORIGIN => 0, XCB_COORD_MODE_PREVIOUS => 1); pragma Convention (C, xcb_coord_mode_t); type xcb_coord_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_coord_mode_t; -- xcb_poly_shape_t -- type xcb_poly_shape_t is (XCB_POLY_SHAPE_COMPLEX, XCB_POLY_SHAPE_NONCONVEX, XCB_POLY_SHAPE_CONVEX); for xcb_poly_shape_t use (XCB_POLY_SHAPE_COMPLEX => 0, XCB_POLY_SHAPE_NONCONVEX => 1, XCB_POLY_SHAPE_CONVEX => 2); pragma Convention (C, xcb_poly_shape_t); type xcb_poly_shape_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_poly_shape_t; -- xcb_image_format_t -- type xcb_image_format_t is (XCB_IMAGE_FORMAT_XY_BITMAP, XCB_IMAGE_FORMAT_XY_PIXMAP, XCB_IMAGE_FORMAT_Z_PIXMAP); for xcb_image_format_t use (XCB_IMAGE_FORMAT_XY_BITMAP => 0, XCB_IMAGE_FORMAT_XY_PIXMAP => 1, XCB_IMAGE_FORMAT_Z_PIXMAP => 2); pragma Convention (C, xcb_image_format_t); type xcb_image_format_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_image_format_t; -- xcb_colormap_alloc_t -- type xcb_colormap_alloc_t is (XCB_COLORMAP_ALLOC_NONE, XCB_COLORMAP_ALLOC_ALL); for xcb_colormap_alloc_t use (XCB_COLORMAP_ALLOC_NONE => 0, XCB_COLORMAP_ALLOC_ALL => 1); pragma Convention (C, xcb_colormap_alloc_t); type xcb_colormap_alloc_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_colormap_alloc_t; -- xcb_color_flag_t -- type xcb_color_flag_t is (XCB_COLOR_FLAG_RED, XCB_COLOR_FLAG_GREEN, XCB_COLOR_FLAG_BLUE); for xcb_color_flag_t use (XCB_COLOR_FLAG_RED => 1, XCB_COLOR_FLAG_GREEN => 2, XCB_COLOR_FLAG_BLUE => 4); pragma Convention (C, xcb_color_flag_t); type xcb_color_flag_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_color_flag_t; -- xcb_pixmap_enum_t -- type xcb_pixmap_enum_t is (XCB_PIXMAP_NONE); for xcb_pixmap_enum_t use (XCB_PIXMAP_NONE => 0); pragma Convention (C, xcb_pixmap_enum_t); type xcb_pixmap_enum_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_pixmap_enum_t; -- xcb_font_enum_t -- type xcb_font_enum_t is (XCB_FONT_NONE); for xcb_font_enum_t use (XCB_FONT_NONE => 0); pragma Convention (C, xcb_font_enum_t); type xcb_font_enum_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_font_enum_t; -- xcb_query_shape_of_t -- type xcb_query_shape_of_t is (XCB_QUERY_SHAPE_OF_LARGEST_CURSOR, XCB_QUERY_SHAPE_OF_FASTEST_TILE, XCB_QUERY_SHAPE_OF_FASTEST_STIPPLE); for xcb_query_shape_of_t use (XCB_QUERY_SHAPE_OF_LARGEST_CURSOR => 0, XCB_QUERY_SHAPE_OF_FASTEST_TILE => 1, XCB_QUERY_SHAPE_OF_FASTEST_STIPPLE => 2); pragma Convention (C, xcb_query_shape_of_t); type xcb_query_shape_of_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_query_shape_of_t; -- xcb_kb_t -- type xcb_kb_t is (XCB_KB_KEY_CLICK_PERCENT, XCB_KB_BELL_PERCENT, XCB_KB_BELL_PITCH, XCB_KB_BELL_DURATION, XCB_KB_LED, XCB_KB_LED_MODE, XCB_KB_KEY, XCB_KB_AUTO_REPEAT_MODE); for xcb_kb_t use (XCB_KB_KEY_CLICK_PERCENT => 1, XCB_KB_BELL_PERCENT => 2, XCB_KB_BELL_PITCH => 4, XCB_KB_BELL_DURATION => 8, XCB_KB_LED => 16, XCB_KB_LED_MODE => 32, XCB_KB_KEY => 64, XCB_KB_AUTO_REPEAT_MODE => 128); pragma Convention (C, xcb_kb_t); type xcb_kb_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_kb_t; -- xcb_led_mode_t -- type xcb_led_mode_t is (XCB_LED_MODE_OFF, XCB_LED_MODE_ON); for xcb_led_mode_t use (XCB_LED_MODE_OFF => 0, XCB_LED_MODE_ON => 1); pragma Convention (C, xcb_led_mode_t); type xcb_led_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_led_mode_t; -- xcb_auto_repeat_mode_t -- type xcb_auto_repeat_mode_t is (XCB_AUTO_REPEAT_MODE_OFF, XCB_AUTO_REPEAT_MODE_ON, XCB_AUTO_REPEAT_MODE_DEFAULT); for xcb_auto_repeat_mode_t use (XCB_AUTO_REPEAT_MODE_OFF => 0, XCB_AUTO_REPEAT_MODE_ON => 1, XCB_AUTO_REPEAT_MODE_DEFAULT => 2); pragma Convention (C, xcb_auto_repeat_mode_t); type xcb_auto_repeat_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_auto_repeat_mode_t; -- xcb_blanking_t -- type xcb_blanking_t is (XCB_BLANKING_NOT_PREFERRED, XCB_BLANKING_PREFERRED, XCB_BLANKING_DEFAULT); for xcb_blanking_t use (XCB_BLANKING_NOT_PREFERRED => 0, XCB_BLANKING_PREFERRED => 1, XCB_BLANKING_DEFAULT => 2); pragma Convention (C, xcb_blanking_t); type xcb_blanking_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_blanking_t; -- xcb_exposures_t -- type xcb_exposures_t is (XCB_EXPOSURES_NOT_ALLOWED, XCB_EXPOSURES_ALLOWED, XCB_EXPOSURES_DEFAULT); for xcb_exposures_t use (XCB_EXPOSURES_NOT_ALLOWED => 0, XCB_EXPOSURES_ALLOWED => 1, XCB_EXPOSURES_DEFAULT => 2); pragma Convention (C, xcb_exposures_t); type xcb_exposures_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_exposures_t; -- xcb_host_mode_t -- type xcb_host_mode_t is (XCB_HOST_MODE_INSERT, XCB_HOST_MODE_DELETE); for xcb_host_mode_t use (XCB_HOST_MODE_INSERT => 0, XCB_HOST_MODE_DELETE => 1); pragma Convention (C, xcb_host_mode_t); type xcb_host_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_host_mode_t; -- xcb_family_t -- type xcb_family_t is (XCB_FAMILY_INTERNET, XCB_FAMILY_DECNET, XCB_FAMILY_CHAOS, XCB_FAMILY_SERVER_INTERPRETED, XCB_FAMILY_INTERNET_6); for xcb_family_t use (XCB_FAMILY_INTERNET => 0, XCB_FAMILY_DECNET => 1, XCB_FAMILY_CHAOS => 2, XCB_FAMILY_SERVER_INTERPRETED => 5, XCB_FAMILY_INTERNET_6 => 6); pragma Convention (C, xcb_family_t); type xcb_family_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_family_t; -- xcb_access_control_t -- type xcb_access_control_t is (XCB_ACCESS_CONTROL_DISABLE, XCB_ACCESS_CONTROL_ENABLE); for xcb_access_control_t use (XCB_ACCESS_CONTROL_DISABLE => 0, XCB_ACCESS_CONTROL_ENABLE => 1); pragma Convention (C, xcb_access_control_t); type xcb_access_control_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_access_control_t; -- xcb_close_down_t -- type xcb_close_down_t is (XCB_CLOSE_DOWN_DESTROY_ALL, XCB_CLOSE_DOWN_RETAIN_PERMANENT, XCB_CLOSE_DOWN_RETAIN_TEMPORARY); for xcb_close_down_t use (XCB_CLOSE_DOWN_DESTROY_ALL => 0, XCB_CLOSE_DOWN_RETAIN_PERMANENT => 1, XCB_CLOSE_DOWN_RETAIN_TEMPORARY => 2); pragma Convention (C, xcb_close_down_t); type xcb_close_down_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_close_down_t; -- xcb_kill_t -- type xcb_kill_t is (XCB_KILL_ALL_TEMPORARY); for xcb_kill_t use (XCB_KILL_ALL_TEMPORARY => 0); pragma Convention (C, xcb_kill_t); type xcb_kill_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_kill_t; -- xcb_screen_saver_t -- type xcb_screen_saver_t is (XCB_SCREEN_SAVER_RESET, XCB_SCREEN_SAVER_ACTIVE); for xcb_screen_saver_t use (XCB_SCREEN_SAVER_RESET => 0, XCB_SCREEN_SAVER_ACTIVE => 1); pragma Convention (C, xcb_screen_saver_t); type xcb_screen_saver_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_screen_saver_t; -- xcb_mapping_status_t -- type xcb_mapping_status_t is (XCB_MAPPING_STATUS_SUCCESS, XCB_MAPPING_STATUS_BUSY, XCB_MAPPING_STATUS_FAILURE); for xcb_mapping_status_t use (XCB_MAPPING_STATUS_SUCCESS => 0, XCB_MAPPING_STATUS_BUSY => 1, XCB_MAPPING_STATUS_FAILURE => 2); pragma Convention (C, xcb_mapping_status_t); type xcb_mapping_status_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_mapping_status_t; -- xcb_map_index_t -- type xcb_map_index_t is (XCB_MAP_INDEX_SHIFT, XCB_MAP_INDEX_LOCK, XCB_MAP_INDEX_CONTROL, XCB_MAP_INDEX_1, XCB_MAP_INDEX_2, XCB_MAP_INDEX_3, XCB_MAP_INDEX_4, XCB_MAP_INDEX_5); for xcb_map_index_t use (XCB_MAP_INDEX_SHIFT => 0, XCB_MAP_INDEX_LOCK => 1, XCB_MAP_INDEX_CONTROL => 2, XCB_MAP_INDEX_1 => 3, XCB_MAP_INDEX_2 => 4, XCB_MAP_INDEX_3 => 5, XCB_MAP_INDEX_4 => 6, XCB_MAP_INDEX_5 => 7); pragma Convention (C, xcb_map_index_t); type xcb_map_index_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_map_index_t; -- xcb_render_pict_type_t -- type xcb_render_pict_type_t is (XCB_RENDER_PICT_TYPE_INDEXED, XCB_RENDER_PICT_TYPE_DIRECT); for xcb_render_pict_type_t use (XCB_RENDER_PICT_TYPE_INDEXED => 0, XCB_RENDER_PICT_TYPE_DIRECT => 1); pragma Convention (C, xcb_render_pict_type_t); type xcb_render_pict_type_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_pict_type_t; -- xcb_render_picture_enum_t -- type xcb_render_picture_enum_t is (XCB_RENDER_PICTURE_NONE); for xcb_render_picture_enum_t use (XCB_RENDER_PICTURE_NONE => 0); pragma Convention (C, xcb_render_picture_enum_t); type xcb_render_picture_enum_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_picture_enum_t; -- xcb_render_pict_op_t -- type xcb_render_pict_op_t is (XCB_RENDER_PICT_OP_CLEAR, XCB_RENDER_PICT_OP_SRC, XCB_RENDER_PICT_OP_DST, XCB_RENDER_PICT_OP_OVER, XCB_RENDER_PICT_OP_OVER_REVERSE, XCB_RENDER_PICT_OP_IN, XCB_RENDER_PICT_OP_IN_REVERSE, XCB_RENDER_PICT_OP_OUT, XCB_RENDER_PICT_OP_OUT_REVERSE, XCB_RENDER_PICT_OP_ATOP, XCB_RENDER_PICT_OP_ATOP_REVERSE, XCB_RENDER_PICT_OP_XOR, XCB_RENDER_PICT_OP_ADD, XCB_RENDER_PICT_OP_SATURATE, XCB_RENDER_PICT_OP_DISJOINT_CLEAR, XCB_RENDER_PICT_OP_DISJOINT_SRC, XCB_RENDER_PICT_OP_DISJOINT_DST, XCB_RENDER_PICT_OP_DISJOINT_OVER, XCB_RENDER_PICT_OP_DISJOINT_OVER_REVERSE, XCB_RENDER_PICT_OP_DISJOINT_IN, XCB_RENDER_PICT_OP_DISJOINT_IN_REVERSE, XCB_RENDER_PICT_OP_DISJOINT_OUT, XCB_RENDER_PICT_OP_DISJOINT_OUT_REVERSE, XCB_RENDER_PICT_OP_DISJOINT_ATOP, XCB_RENDER_PICT_OP_DISJOINT_ATOP_REVERSE, XCB_RENDER_PICT_OP_DISJOINT_XOR, XCB_RENDER_PICT_OP_CONJOINT_CLEAR, XCB_RENDER_PICT_OP_CONJOINT_SRC, XCB_RENDER_PICT_OP_CONJOINT_DST, XCB_RENDER_PICT_OP_CONJOINT_OVER, XCB_RENDER_PICT_OP_CONJOINT_OVER_REVERSE, XCB_RENDER_PICT_OP_CONJOINT_IN, XCB_RENDER_PICT_OP_CONJOINT_IN_REVERSE, XCB_RENDER_PICT_OP_CONJOINT_OUT, XCB_RENDER_PICT_OP_CONJOINT_OUT_REVERSE, XCB_RENDER_PICT_OP_CONJOINT_ATOP, XCB_RENDER_PICT_OP_CONJOINT_ATOP_REVERSE, XCB_RENDER_PICT_OP_CONJOINT_XOR, XCB_RENDER_PICT_OP_MULTIPLY, XCB_RENDER_PICT_OP_SCREEN, XCB_RENDER_PICT_OP_OVERLAY, XCB_RENDER_PICT_OP_DARKEN, XCB_RENDER_PICT_OP_LIGHTEN, XCB_RENDER_PICT_OP_COLOR_DODGE, XCB_RENDER_PICT_OP_COLOR_BURN, XCB_RENDER_PICT_OP_HARD_LIGHT, XCB_RENDER_PICT_OP_SOFT_LIGHT, XCB_RENDER_PICT_OP_DIFFERENCE, XCB_RENDER_PICT_OP_EXCLUSION, XCB_RENDER_PICT_OP_HSL_HUE, XCB_RENDER_PICT_OP_HSL_SATURATION, XCB_RENDER_PICT_OP_HSL_COLOR, XCB_RENDER_PICT_OP_HSL_LUMINOSITY); for xcb_render_pict_op_t use (XCB_RENDER_PICT_OP_CLEAR => 0, XCB_RENDER_PICT_OP_SRC => 1, XCB_RENDER_PICT_OP_DST => 2, XCB_RENDER_PICT_OP_OVER => 3, XCB_RENDER_PICT_OP_OVER_REVERSE => 4, XCB_RENDER_PICT_OP_IN => 5, XCB_RENDER_PICT_OP_IN_REVERSE => 6, XCB_RENDER_PICT_OP_OUT => 7, XCB_RENDER_PICT_OP_OUT_REVERSE => 8, XCB_RENDER_PICT_OP_ATOP => 9, XCB_RENDER_PICT_OP_ATOP_REVERSE => 10, XCB_RENDER_PICT_OP_XOR => 11, XCB_RENDER_PICT_OP_ADD => 12, XCB_RENDER_PICT_OP_SATURATE => 13, XCB_RENDER_PICT_OP_DISJOINT_CLEAR => 16, XCB_RENDER_PICT_OP_DISJOINT_SRC => 17, XCB_RENDER_PICT_OP_DISJOINT_DST => 18, XCB_RENDER_PICT_OP_DISJOINT_OVER => 19, XCB_RENDER_PICT_OP_DISJOINT_OVER_REVERSE => 20, XCB_RENDER_PICT_OP_DISJOINT_IN => 21, XCB_RENDER_PICT_OP_DISJOINT_IN_REVERSE => 22, XCB_RENDER_PICT_OP_DISJOINT_OUT => 23, XCB_RENDER_PICT_OP_DISJOINT_OUT_REVERSE => 24, XCB_RENDER_PICT_OP_DISJOINT_ATOP => 25, XCB_RENDER_PICT_OP_DISJOINT_ATOP_REVERSE => 26, XCB_RENDER_PICT_OP_DISJOINT_XOR => 27, XCB_RENDER_PICT_OP_CONJOINT_CLEAR => 32, XCB_RENDER_PICT_OP_CONJOINT_SRC => 33, XCB_RENDER_PICT_OP_CONJOINT_DST => 34, XCB_RENDER_PICT_OP_CONJOINT_OVER => 35, XCB_RENDER_PICT_OP_CONJOINT_OVER_REVERSE => 36, XCB_RENDER_PICT_OP_CONJOINT_IN => 37, XCB_RENDER_PICT_OP_CONJOINT_IN_REVERSE => 38, XCB_RENDER_PICT_OP_CONJOINT_OUT => 39, XCB_RENDER_PICT_OP_CONJOINT_OUT_REVERSE => 40, XCB_RENDER_PICT_OP_CONJOINT_ATOP => 41, XCB_RENDER_PICT_OP_CONJOINT_ATOP_REVERSE => 42, XCB_RENDER_PICT_OP_CONJOINT_XOR => 43, XCB_RENDER_PICT_OP_MULTIPLY => 48, XCB_RENDER_PICT_OP_SCREEN => 49, XCB_RENDER_PICT_OP_OVERLAY => 50, XCB_RENDER_PICT_OP_DARKEN => 51, XCB_RENDER_PICT_OP_LIGHTEN => 52, XCB_RENDER_PICT_OP_COLOR_DODGE => 53, XCB_RENDER_PICT_OP_COLOR_BURN => 54, XCB_RENDER_PICT_OP_HARD_LIGHT => 55, XCB_RENDER_PICT_OP_SOFT_LIGHT => 56, XCB_RENDER_PICT_OP_DIFFERENCE => 57, XCB_RENDER_PICT_OP_EXCLUSION => 58, XCB_RENDER_PICT_OP_HSL_HUE => 59, XCB_RENDER_PICT_OP_HSL_SATURATION => 60, XCB_RENDER_PICT_OP_HSL_COLOR => 61, XCB_RENDER_PICT_OP_HSL_LUMINOSITY => 62); pragma Convention (C, xcb_render_pict_op_t); type xcb_render_pict_op_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_pict_op_t; -- xcb_render_poly_edge_t -- type xcb_render_poly_edge_t is (XCB_RENDER_POLY_EDGE_SHARP, XCB_RENDER_POLY_EDGE_SMOOTH); for xcb_render_poly_edge_t use (XCB_RENDER_POLY_EDGE_SHARP => 0, XCB_RENDER_POLY_EDGE_SMOOTH => 1); pragma Convention (C, xcb_render_poly_edge_t); type xcb_render_poly_edge_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_poly_edge_t; -- xcb_render_poly_mode_t -- type xcb_render_poly_mode_t is (XCB_RENDER_POLY_MODE_PRECISE, XCB_RENDER_POLY_MODE_IMPRECISE); for xcb_render_poly_mode_t use (XCB_RENDER_POLY_MODE_PRECISE => 0, XCB_RENDER_POLY_MODE_IMPRECISE => 1); pragma Convention (C, xcb_render_poly_mode_t); type xcb_render_poly_mode_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_poly_mode_t; -- xcb_render_cp_t -- type xcb_render_cp_t is (XCB_RENDER_CP_REPEAT, XCB_RENDER_CP_ALPHA_MAP, XCB_RENDER_CP_ALPHA_X_ORIGIN, XCB_RENDER_CP_ALPHA_Y_ORIGIN, XCB_RENDER_CP_CLIP_X_ORIGIN, XCB_RENDER_CP_CLIP_Y_ORIGIN, XCB_RENDER_CP_CLIP_MASK, XCB_RENDER_CP_GRAPHICS_EXPOSURE, XCB_RENDER_CP_SUBWINDOW_MODE, XCB_RENDER_CP_POLY_EDGE, XCB_RENDER_CP_POLY_MODE, XCB_RENDER_CP_DITHER, XCB_RENDER_CP_COMPONENT_ALPHA); for xcb_render_cp_t use (XCB_RENDER_CP_REPEAT => 1, XCB_RENDER_CP_ALPHA_MAP => 2, XCB_RENDER_CP_ALPHA_X_ORIGIN => 4, XCB_RENDER_CP_ALPHA_Y_ORIGIN => 8, XCB_RENDER_CP_CLIP_X_ORIGIN => 16, XCB_RENDER_CP_CLIP_Y_ORIGIN => 32, XCB_RENDER_CP_CLIP_MASK => 64, XCB_RENDER_CP_GRAPHICS_EXPOSURE => 128, XCB_RENDER_CP_SUBWINDOW_MODE => 256, XCB_RENDER_CP_POLY_EDGE => 512, XCB_RENDER_CP_POLY_MODE => 1_024, XCB_RENDER_CP_DITHER => 2_048, XCB_RENDER_CP_COMPONENT_ALPHA => 4_096); pragma Convention (C, xcb_render_cp_t); type xcb_render_cp_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_cp_t; -- xcb_render_sub_pixel_t -- type xcb_render_sub_pixel_t is (XCB_RENDER_SUB_PIXEL_UNKNOWN, XCB_RENDER_SUB_PIXEL_HORIZONTAL_RGB, XCB_RENDER_SUB_PIXEL_HORIZONTAL_BGR, XCB_RENDER_SUB_PIXEL_VERTICAL_RGB, XCB_RENDER_SUB_PIXEL_VERTICAL_BGR, XCB_RENDER_SUB_PIXEL_NONE); for xcb_render_sub_pixel_t use (XCB_RENDER_SUB_PIXEL_UNKNOWN => 0, XCB_RENDER_SUB_PIXEL_HORIZONTAL_RGB => 1, XCB_RENDER_SUB_PIXEL_HORIZONTAL_BGR => 2, XCB_RENDER_SUB_PIXEL_VERTICAL_RGB => 3, XCB_RENDER_SUB_PIXEL_VERTICAL_BGR => 4, XCB_RENDER_SUB_PIXEL_NONE => 5); pragma Convention (C, xcb_render_sub_pixel_t); type xcb_render_sub_pixel_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_sub_pixel_t; -- xcb_render_repeat_t -- type xcb_render_repeat_t is (XCB_RENDER_REPEAT_NONE, XCB_RENDER_REPEAT_NORMAL, XCB_RENDER_REPEAT_PAD, XCB_RENDER_REPEAT_REFLECT); for xcb_render_repeat_t use (XCB_RENDER_REPEAT_NONE => 0, XCB_RENDER_REPEAT_NORMAL => 1, XCB_RENDER_REPEAT_PAD => 2, XCB_RENDER_REPEAT_REFLECT => 3); pragma Convention (C, xcb_render_repeat_t); type xcb_render_repeat_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_repeat_t; -- xcb_render_glyph_t -- subtype xcb_render_glyph_t is Interfaces.Unsigned_32; type xcb_render_glyph_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_glyph_t; -- xcb_render_glyphset_t -- subtype xcb_render_glyphset_t is Interfaces.Unsigned_32; type xcb_render_glyphset_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_glyphset_t; -- xcb_render_picture_t -- subtype xcb_render_picture_t is Interfaces.Unsigned_32; type xcb_render_picture_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_picture_t; -- xcb_render_pictformat_t -- subtype xcb_render_pictformat_t is Interfaces.Unsigned_32; type xcb_render_pictformat_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_pictformat_t; -- xcb_render_fixed_t -- subtype xcb_render_fixed_t is Interfaces.Integer_32; type xcb_render_fixed_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_render_fixed_t; -- iovec -- subtype iovec is swig.opaque_structure; type iovec_array is array (Interfaces.C.size_t range <>) of aliased xcb.iovec; -- xcb_send_request_flags_t -- type xcb_send_request_flags_t is (XCB_REQUEST_CHECKED, XCB_REQUEST_RAW, XCB_REQUEST_DISCARD_REPLY, XCB_REQUEST_REPLY_FDS); for xcb_send_request_flags_t use (XCB_REQUEST_CHECKED => 1, XCB_REQUEST_RAW => 2, XCB_REQUEST_DISCARD_REPLY => 4, XCB_REQUEST_REPLY_FDS => 8); pragma Convention (C, xcb_send_request_flags_t); type xcb_send_request_flags_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_send_request_flags_t; -- xcb_pict_format_t -- type xcb_pict_format_t is (XCB_PICT_FORMAT_ID, XCB_PICT_FORMAT_TYPE, XCB_PICT_FORMAT_DEPTH, XCB_PICT_FORMAT_RED, XCB_PICT_FORMAT_RED_MASK, XCB_PICT_FORMAT_GREEN, XCB_PICT_FORMAT_GREEN_MASK, XCB_PICT_FORMAT_BLUE, XCB_PICT_FORMAT_BLUE_MASK, XCB_PICT_FORMAT_ALPHA, XCB_PICT_FORMAT_ALPHA_MASK, XCB_PICT_FORMAT_COLORMAP); for xcb_pict_format_t use (XCB_PICT_FORMAT_ID => 1, XCB_PICT_FORMAT_TYPE => 2, XCB_PICT_FORMAT_DEPTH => 4, XCB_PICT_FORMAT_RED => 8, XCB_PICT_FORMAT_RED_MASK => 16, XCB_PICT_FORMAT_GREEN => 32, XCB_PICT_FORMAT_GREEN_MASK => 64, XCB_PICT_FORMAT_BLUE => 128, XCB_PICT_FORMAT_BLUE_MASK => 256, XCB_PICT_FORMAT_ALPHA => 512, XCB_PICT_FORMAT_ALPHA_MASK => 1_024, XCB_PICT_FORMAT_COLORMAP => 2_048); pragma Convention (C, xcb_pict_format_t); type xcb_pict_format_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_pict_format_t; -- xcb_pict_standard_t -- type xcb_pict_standard_t is (XCB_PICT_STANDARD_ARGB_32, XCB_PICT_STANDARD_RGB_24, XCB_PICT_STANDARD_A_8, XCB_PICT_STANDARD_A_4, XCB_PICT_STANDARD_A_1); for xcb_pict_standard_t use (XCB_PICT_STANDARD_ARGB_32 => 0, XCB_PICT_STANDARD_RGB_24 => 1, XCB_PICT_STANDARD_A_8 => 2, XCB_PICT_STANDARD_A_4 => 3, XCB_PICT_STANDARD_A_1 => 4); pragma Convention (C, xcb_pict_standard_t); type xcb_pict_standard_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_pict_standard_t; -- xcb_render_util_composite_text_stream_t -- subtype xcb_render_util_composite_text_stream_t is swig.opaque_structure; type xcb_render_util_composite_text_stream_t_array is array (Interfaces.C.size_t range <>) of aliased xcb .xcb_render_util_composite_text_stream_t; -- xcb_glx_pixmap_t -- subtype xcb_glx_pixmap_t is Interfaces.Unsigned_32; type xcb_glx_pixmap_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_pixmap_t; -- xcb_glx_context_t -- subtype xcb_glx_context_t is Interfaces.Unsigned_32; type xcb_glx_context_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_context_t; -- xcb_glx_pbuffer_t -- subtype xcb_glx_pbuffer_t is Interfaces.Unsigned_32; type xcb_glx_pbuffer_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_pbuffer_t; -- xcb_glx_window_t -- subtype xcb_glx_window_t is Interfaces.Unsigned_32; type xcb_glx_window_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_window_t; -- xcb_glx_fbconfig_t -- subtype xcb_glx_fbconfig_t is Interfaces.Unsigned_32; type xcb_glx_fbconfig_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_fbconfig_t; -- xcb_glx_drawable_t -- subtype xcb_glx_drawable_t is Interfaces.Unsigned_32; type xcb_glx_drawable_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_drawable_t; -- xcb_glx_float32_t -- subtype xcb_glx_float32_t is Interfaces.C.C_float; type xcb_glx_float32_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_float32_t; -- xcb_glx_float64_t -- subtype xcb_glx_float64_t is Interfaces.C.double; type xcb_glx_float64_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_float64_t; -- xcb_glx_bool32_t -- subtype xcb_glx_bool32_t is Interfaces.Unsigned_32; type xcb_glx_bool32_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_bool32_t; -- xcb_glx_context_tag_t -- subtype xcb_glx_context_tag_t is Interfaces.Unsigned_32; type xcb_glx_context_tag_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_context_tag_t; -- xcb_glx_pbcet_t -- type xcb_glx_pbcet_t is (XCB_GLX_PBCET_DAMAGED, XCB_GLX_PBCET_SAVED); for xcb_glx_pbcet_t use (XCB_GLX_PBCET_DAMAGED => 32_791, XCB_GLX_PBCET_SAVED => 32_792); pragma Convention (C, xcb_glx_pbcet_t); type xcb_glx_pbcet_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_pbcet_t; -- xcb_glx_pbcdt_t -- type xcb_glx_pbcdt_t is (XCB_GLX_PBCDT_WINDOW, XCB_GLX_PBCDT_PBUFFER); for xcb_glx_pbcdt_t use (XCB_GLX_PBCDT_WINDOW => 32_793, XCB_GLX_PBCDT_PBUFFER => 32_794); pragma Convention (C, xcb_glx_pbcdt_t); type xcb_glx_pbcdt_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_pbcdt_t; -- xcb_glx_gc_t -- type xcb_glx_gc_t is (XCB_GLX_GC_GL_CURRENT_BIT, XCB_GLX_GC_GL_POINT_BIT, XCB_GLX_GC_GL_LINE_BIT, XCB_GLX_GC_GL_POLYGON_BIT, XCB_GLX_GC_GL_POLYGON_STIPPLE_BIT, XCB_GLX_GC_GL_PIXEL_MODE_BIT, XCB_GLX_GC_GL_LIGHTING_BIT, XCB_GLX_GC_GL_FOG_BIT, XCB_GLX_GC_GL_DEPTH_BUFFER_BIT, XCB_GLX_GC_GL_ACCUM_BUFFER_BIT, XCB_GLX_GC_GL_STENCIL_BUFFER_BIT, XCB_GLX_GC_GL_VIEWPORT_BIT, XCB_GLX_GC_GL_TRANSFORM_BIT, XCB_GLX_GC_GL_ENABLE_BIT, XCB_GLX_GC_GL_COLOR_BUFFER_BIT, XCB_GLX_GC_GL_HINT_BIT, XCB_GLX_GC_GL_EVAL_BIT, XCB_GLX_GC_GL_LIST_BIT, XCB_GLX_GC_GL_TEXTURE_BIT, XCB_GLX_GC_GL_SCISSOR_BIT, XCB_GLX_GC_GL_ALL_ATTRIB_BITS); for xcb_glx_gc_t use (XCB_GLX_GC_GL_CURRENT_BIT => 1, XCB_GLX_GC_GL_POINT_BIT => 2, XCB_GLX_GC_GL_LINE_BIT => 4, XCB_GLX_GC_GL_POLYGON_BIT => 8, XCB_GLX_GC_GL_POLYGON_STIPPLE_BIT => 16, XCB_GLX_GC_GL_PIXEL_MODE_BIT => 32, XCB_GLX_GC_GL_LIGHTING_BIT => 64, XCB_GLX_GC_GL_FOG_BIT => 128, XCB_GLX_GC_GL_DEPTH_BUFFER_BIT => 256, XCB_GLX_GC_GL_ACCUM_BUFFER_BIT => 512, XCB_GLX_GC_GL_STENCIL_BUFFER_BIT => 1_024, XCB_GLX_GC_GL_VIEWPORT_BIT => 2_048, XCB_GLX_GC_GL_TRANSFORM_BIT => 4_096, XCB_GLX_GC_GL_ENABLE_BIT => 8_192, XCB_GLX_GC_GL_COLOR_BUFFER_BIT => 16_384, XCB_GLX_GC_GL_HINT_BIT => 32_768, XCB_GLX_GC_GL_EVAL_BIT => 65_536, XCB_GLX_GC_GL_LIST_BIT => 131_072, XCB_GLX_GC_GL_TEXTURE_BIT => 262_144, XCB_GLX_GC_GL_SCISSOR_BIT => 524_288, XCB_GLX_GC_GL_ALL_ATTRIB_BITS => 16_777_215); pragma Convention (C, xcb_glx_gc_t); type xcb_glx_gc_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_gc_t; -- xcb_glx_rm_t -- type xcb_glx_rm_t is (XCB_GLX_RM_GL_RENDER, XCB_GLX_RM_GL_FEEDBACK, XCB_GLX_RM_GL_SELECT); for xcb_glx_rm_t use (XCB_GLX_RM_GL_RENDER => 7_168, XCB_GLX_RM_GL_FEEDBACK => 7_169, XCB_GLX_RM_GL_SELECT => 7_170); pragma Convention (C, xcb_glx_rm_t); type xcb_glx_rm_t_array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_glx_rm_t; -- Display -- subtype Display is swig.opaque_structure; type Display_array is array (Interfaces.C.size_t range <>) of aliased xcb.Display; -- XEventQueueOwner -- type XEventQueueOwner is (XlibOwnsEventQueue, XCBOwnsEventQueue); for XEventQueueOwner use (XlibOwnsEventQueue => 0, XCBOwnsEventQueue => 1); pragma Convention (C, XEventQueueOwner); type XEventQueueOwner_array is array (Interfaces.C.size_t range <>) of aliased xcb.XEventQueueOwner; XCB_ATOM_ANY : aliased constant xcb.xcb_atom_enum_t := XCB_ATOM_NONE; XCB_GRAVITY_WIN_UNMAP : aliased constant xcb.xcb_gravity_t := XCB_GRAVITY_BIT_FORGET; X_PROTOCOL : constant := 11; X_PROTOCOL_REVISION : constant := 0; X_TCP_PORT : constant := 6_000; XCB_CONN_ERROR : constant := 1; XCB_CONN_CLOSED_EXT_NOTSUPPORTED : constant := 2; XCB_CONN_CLOSED_MEM_INSUFFICIENT : constant := 3; XCB_CONN_CLOSED_REQ_LEN_EXCEED : constant := 4; XCB_CONN_CLOSED_PARSE_ERR : constant := 5; XCB_CONN_CLOSED_INVALID_SCREEN : constant := 6; XCB_CONN_CLOSED_FDPASSING_FAILED : constant := 7; XCB_NONE : aliased constant Interfaces.C.long := 8#0#; XCB_COPY_FROM_PARENT : aliased constant Interfaces.C.long := 8#0#; XCB_CURRENT_TIME : aliased constant Interfaces.C.long := 8#0#; XCB_NO_SYMBOL : aliased constant Interfaces.C.long := 8#0#; XCB_KEY_PRESS : constant := 2; XCB_KEY_RELEASE : constant := 3; XCB_BUTTON_PRESS : constant := 4; XCB_BUTTON_RELEASE : constant := 5; XCB_MOTION_NOTIFY : constant := 6; XCB_ENTER_NOTIFY : constant := 7; XCB_LEAVE_NOTIFY : constant := 8; XCB_FOCUS_IN : constant := 9; XCB_FOCUS_OUT : constant := 10; XCB_KEYMAP_NOTIFY : constant := 11; XCB_EXPOSE : constant := 12; XCB_GRAPHICS_EXPOSURE : constant := 13; XCB_NO_EXPOSURE : constant := 14; XCB_VISIBILITY_NOTIFY : constant := 15; XCB_CREATE_NOTIFY : constant := 16; XCB_DESTROY_NOTIFY : constant := 17; XCB_UNMAP_NOTIFY : constant := 18; XCB_MAP_NOTIFY : constant := 19; XCB_MAP_REQUEST : constant := 20; XCB_REPARENT_NOTIFY : constant := 21; XCB_CONFIGURE_NOTIFY : constant := 22; XCB_CONFIGURE_REQUEST : constant := 23; XCB_GRAVITY_NOTIFY : constant := 24; XCB_RESIZE_REQUEST : constant := 25; XCB_CIRCULATE_NOTIFY : constant := 26; XCB_CIRCULATE_REQUEST : constant := 27; XCB_PROPERTY_NOTIFY : constant := 28; XCB_SELECTION_CLEAR : constant := 29; XCB_SELECTION_REQUEST : constant := 30; XCB_SELECTION_NOTIFY : constant := 31; XCB_COLORMAP_NOTIFY : constant := 32; XCB_CLIENT_MESSAGE : constant := 33; XCB_MAPPING_NOTIFY : constant := 34; XCB_GE_GENERIC : constant := 35; XCB_REQUEST : constant := 1; XCB_VALUE : constant := 2; XCB_WINDOW : constant := 3; XCB_PIXMAP : constant := 4; XCB_ATOM : constant := 5; XCB_CURSOR : constant := 6; XCB_FONT : constant := 7; XCB_MATCH : constant := 8; XCB_DRAWABLE : constant := 9; XCB_ACCESS : constant := 10; XCB_ALLOC : constant := 11; XCB_COLORMAP : constant := 12; XCB_G_CONTEXT : constant := 13; XCB_ID_CHOICE : constant := 14; XCB_NAME : constant := 15; XCB_LENGTH : constant := 16; XCB_IMPLEMENTATION : constant := 17; XCB_CREATE_WINDOW : constant := 1; XCB_CHANGE_WINDOW_ATTRIBUTES : constant := 2; XCB_GET_WINDOW_ATTRIBUTES : constant := 3; XCB_DESTROY_WINDOW : constant := 4; XCB_DESTROY_SUBWINDOWS : constant := 5; XCB_CHANGE_SAVE_SET : constant := 6; XCB_REPARENT_WINDOW : constant := 7; XCB_MAP_WINDOW : constant := 8; XCB_MAP_SUBWINDOWS : constant := 9; XCB_UNMAP_WINDOW : constant := 10; XCB_UNMAP_SUBWINDOWS : constant := 11; XCB_CONFIGURE_WINDOW : constant := 12; XCB_CIRCULATE_WINDOW : constant := 13; XCB_GET_GEOMETRY : constant := 14; XCB_QUERY_TREE : constant := 15; XCB_INTERN_ATOM : constant := 16; XCB_GET_ATOM_NAME : constant := 17; XCB_CHANGE_PROPERTY : constant := 18; XCB_DELETE_PROPERTY : constant := 19; XCB_GET_PROPERTY : constant := 20; XCB_LIST_PROPERTIES : constant := 21; XCB_SET_SELECTION_OWNER : constant := 22; XCB_GET_SELECTION_OWNER : constant := 23; XCB_CONVERT_SELECTION : constant := 24; XCB_SEND_EVENT : constant := 25; XCB_GRAB_POINTER : constant := 26; XCB_UNGRAB_POINTER : constant := 27; XCB_GRAB_BUTTON : constant := 28; XCB_UNGRAB_BUTTON : constant := 29; XCB_CHANGE_ACTIVE_POINTER_GRAB : constant := 30; XCB_GRAB_KEYBOARD : constant := 31; XCB_UNGRAB_KEYBOARD : constant := 32; XCB_GRAB_KEY : constant := 33; XCB_UNGRAB_KEY : constant := 34; XCB_ALLOW_EVENTS : constant := 35; XCB_GRAB_SERVER : constant := 36; XCB_UNGRAB_SERVER : constant := 37; XCB_QUERY_POINTER : constant := 38; XCB_GET_MOTION_EVENTS : constant := 39; XCB_TRANSLATE_COORDINATES : constant := 40; XCB_WARP_POINTER : constant := 41; XCB_SET_INPUT_FOCUS : constant := 42; XCB_GET_INPUT_FOCUS : constant := 43; XCB_QUERY_KEYMAP : constant := 44; XCB_OPEN_FONT : constant := 45; XCB_CLOSE_FONT : constant := 46; XCB_QUERY_FONT : constant := 47; XCB_QUERY_TEXT_EXTENTS : constant := 48; XCB_LIST_FONTS : constant := 49; XCB_LIST_FONTS_WITH_INFO : constant := 50; XCB_SET_FONT_PATH : constant := 51; XCB_GET_FONT_PATH : constant := 52; XCB_CREATE_PIXMAP : constant := 53; XCB_FREE_PIXMAP : constant := 54; XCB_CREATE_GC : constant := 55; XCB_CHANGE_GC : constant := 56; XCB_COPY_GC : constant := 57; XCB_SET_DASHES : constant := 58; XCB_SET_CLIP_RECTANGLES : constant := 59; XCB_FREE_GC : constant := 60; XCB_CLEAR_AREA : constant := 61; XCB_COPY_AREA : constant := 62; XCB_COPY_PLANE : constant := 63; XCB_POLY_POINT : constant := 64; XCB_POLY_LINE : constant := 65; XCB_POLY_SEGMENT : constant := 66; XCB_POLY_RECTANGLE : constant := 67; XCB_POLY_ARC : constant := 68; XCB_FILL_POLY : constant := 69; XCB_POLY_FILL_RECTANGLE : constant := 70; XCB_POLY_FILL_ARC : constant := 71; XCB_PUT_IMAGE : constant := 72; XCB_GET_IMAGE : constant := 73; XCB_POLY_TEXT_8 : constant := 74; XCB_POLY_TEXT_16 : constant := 75; XCB_IMAGE_TEXT_8 : constant := 76; XCB_IMAGE_TEXT_16 : constant := 77; XCB_CREATE_COLORMAP : constant := 78; XCB_FREE_COLORMAP : constant := 79; XCB_COPY_COLORMAP_AND_FREE : constant := 80; XCB_INSTALL_COLORMAP : constant := 81; XCB_UNINSTALL_COLORMAP : constant := 82; XCB_LIST_INSTALLED_COLORMAPS : constant := 83; XCB_ALLOC_COLOR : constant := 84; XCB_ALLOC_NAMED_COLOR : constant := 85; XCB_ALLOC_COLOR_CELLS : constant := 86; XCB_ALLOC_COLOR_PLANES : constant := 87; XCB_FREE_COLORS : constant := 88; XCB_STORE_COLORS : constant := 89; XCB_STORE_NAMED_COLOR : constant := 90; XCB_QUERY_COLORS : constant := 91; XCB_LOOKUP_COLOR : constant := 92; XCB_CREATE_CURSOR : constant := 93; XCB_CREATE_GLYPH_CURSOR : constant := 94; XCB_FREE_CURSOR : constant := 95; XCB_RECOLOR_CURSOR : constant := 96; XCB_QUERY_BEST_SIZE : constant := 97; XCB_QUERY_EXTENSION : constant := 98; XCB_LIST_EXTENSIONS : constant := 99; XCB_CHANGE_KEYBOARD_MAPPING : constant := 100; XCB_GET_KEYBOARD_MAPPING : constant := 101; XCB_CHANGE_KEYBOARD_CONTROL : constant := 102; XCB_GET_KEYBOARD_CONTROL : constant := 103; XCB_BELL : constant := 104; XCB_CHANGE_POINTER_CONTROL : constant := 105; XCB_GET_POINTER_CONTROL : constant := 106; XCB_SET_SCREEN_SAVER : constant := 107; XCB_GET_SCREEN_SAVER : constant := 108; XCB_CHANGE_HOSTS : constant := 109; XCB_LIST_HOSTS : constant := 110; XCB_SET_ACCESS_CONTROL : constant := 111; XCB_SET_CLOSE_DOWN_MODE : constant := 112; XCB_KILL_CLIENT : constant := 113; XCB_ROTATE_PROPERTIES : constant := 114; XCB_FORCE_SCREEN_SAVER : constant := 115; XCB_SET_POINTER_MAPPING : constant := 116; XCB_GET_POINTER_MAPPING : constant := 117; XCB_SET_MODIFIER_MAPPING : constant := 118; XCB_GET_MODIFIER_MAPPING : constant := 119; XCB_NO_OPERATION : constant := 127; XCB_BIGREQUESTS_MAJOR_VERSION : constant := 0; XCB_BIGREQUESTS_MINOR_VERSION : constant := 0; XCB_BIG_REQUESTS_ENABLE : constant := 0; XCB_RENDER_MAJOR_VERSION : constant := 0; XCB_RENDER_MINOR_VERSION : constant := 11; XCB_RENDER_PICT_FORMAT : constant := 0; XCB_RENDER_PICTURE : constant := 1; XCB_RENDER_PICT_OP : constant := 2; XCB_RENDER_GLYPH_SET : constant := 3; XCB_RENDER_GLYPH : constant := 4; XCB_RENDER_QUERY_VERSION : constant := 0; XCB_RENDER_QUERY_PICT_FORMATS : constant := 1; XCB_RENDER_QUERY_PICT_INDEX_VALUES : constant := 2; XCB_RENDER_CREATE_PICTURE : constant := 4; XCB_RENDER_CHANGE_PICTURE : constant := 5; XCB_RENDER_SET_PICTURE_CLIP_RECTANGLES : constant := 6; XCB_RENDER_FREE_PICTURE : constant := 7; XCB_RENDER_COMPOSITE : constant := 8; XCB_RENDER_TRAPEZOIDS : constant := 10; XCB_RENDER_TRIANGLES : constant := 11; XCB_RENDER_TRI_STRIP : constant := 12; XCB_RENDER_TRI_FAN : constant := 13; XCB_RENDER_CREATE_GLYPH_SET : constant := 17; XCB_RENDER_REFERENCE_GLYPH_SET : constant := 18; XCB_RENDER_FREE_GLYPH_SET : constant := 19; XCB_RENDER_ADD_GLYPHS : constant := 20; XCB_RENDER_FREE_GLYPHS : constant := 22; XCB_RENDER_COMPOSITE_GLYPHS_8 : constant := 23; XCB_RENDER_COMPOSITE_GLYPHS_16 : constant := 24; XCB_RENDER_COMPOSITE_GLYPHS_32 : constant := 25; XCB_RENDER_FILL_RECTANGLES : constant := 26; XCB_RENDER_CREATE_CURSOR : constant := 27; XCB_RENDER_SET_PICTURE_TRANSFORM : constant := 28; XCB_RENDER_QUERY_FILTERS : constant := 29; XCB_RENDER_SET_PICTURE_FILTER : constant := 30; XCB_RENDER_CREATE_ANIM_CURSOR : constant := 31; XCB_RENDER_ADD_TRAPS : constant := 32; XCB_RENDER_CREATE_SOLID_FILL : constant := 33; XCB_RENDER_CREATE_LINEAR_GRADIENT : constant := 34; XCB_RENDER_CREATE_RADIAL_GRADIENT : constant := 35; XCB_RENDER_CREATE_CONICAL_GRADIENT : constant := 36; XCB_XCMISC_MAJOR_VERSION : constant := 1; XCB_XCMISC_MINOR_VERSION : constant := 1; XCB_XC_MISC_GET_VERSION : constant := 0; XCB_XC_MISC_GET_XID_RANGE : constant := 1; XCB_XC_MISC_GET_XID_LIST : constant := 2; XCB_GLX_MAJOR_VERSION : constant := 1; XCB_GLX_MINOR_VERSION : constant := 4; XCB_GLX_GENERIC : constant := -1; XCB_GLX_BAD_CONTEXT : constant := 0; XCB_GLX_BAD_CONTEXT_STATE : constant := 1; XCB_GLX_BAD_DRAWABLE : constant := 2; XCB_GLX_BAD_PIXMAP : constant := 3; XCB_GLX_BAD_CONTEXT_TAG : constant := 4; XCB_GLX_BAD_CURRENT_WINDOW : constant := 5; XCB_GLX_BAD_RENDER_REQUEST : constant := 6; XCB_GLX_BAD_LARGE_REQUEST : constant := 7; XCB_GLX_UNSUPPORTED_PRIVATE_REQUEST : constant := 8; XCB_GLX_BAD_FB_CONFIG : constant := 9; XCB_GLX_BAD_PBUFFER : constant := 10; XCB_GLX_BAD_CURRENT_DRAWABLE : constant := 11; XCB_GLX_BAD_WINDOW : constant := 12; XCB_GLX_GLX_BAD_PROFILE_ARB : constant := 13; XCB_GLX_PBUFFER_CLOBBER : constant := 0; XCB_GLX_BUFFER_SWAP_COMPLETE : constant := 1; XCB_GLX_RENDER : constant := 1; XCB_GLX_RENDER_LARGE : constant := 2; XCB_GLX_CREATE_CONTEXT : constant := 3; XCB_GLX_DESTROY_CONTEXT : constant := 4; XCB_GLX_MAKE_CURRENT : constant := 5; XCB_GLX_IS_DIRECT : constant := 6; XCB_GLX_QUERY_VERSION : constant := 7; XCB_GLX_WAIT_GL : constant := 8; XCB_GLX_WAIT_X : constant := 9; XCB_GLX_COPY_CONTEXT : constant := 10; XCB_GLX_SWAP_BUFFERS : constant := 11; XCB_GLX_USE_X_FONT : constant := 12; XCB_GLX_CREATE_GLX_PIXMAP : constant := 13; XCB_GLX_GET_VISUAL_CONFIGS : constant := 14; XCB_GLX_DESTROY_GLX_PIXMAP : constant := 15; XCB_GLX_VENDOR_PRIVATE : constant := 16; XCB_GLX_VENDOR_PRIVATE_WITH_REPLY : constant := 17; XCB_GLX_QUERY_EXTENSIONS_STRING : constant := 18; XCB_GLX_QUERY_SERVER_STRING : constant := 19; XCB_GLX_CLIENT_INFO : constant := 20; XCB_GLX_GET_FB_CONFIGS : constant := 21; XCB_GLX_CREATE_PIXMAP : constant := 22; XCB_GLX_DESTROY_PIXMAP : constant := 23; XCB_GLX_CREATE_NEW_CONTEXT : constant := 24; XCB_GLX_QUERY_CONTEXT : constant := 25; XCB_GLX_MAKE_CONTEXT_CURRENT : constant := 26; XCB_GLX_CREATE_PBUFFER : constant := 27; XCB_GLX_DESTROY_PBUFFER : constant := 28; XCB_GLX_GET_DRAWABLE_ATTRIBUTES : constant := 29; XCB_GLX_CHANGE_DRAWABLE_ATTRIBUTES : constant := 30; XCB_GLX_CREATE_WINDOW : constant := 31; XCB_GLX_DELETE_WINDOW : constant := 32; XCB_GLX_SET_CLIENT_INFO_ARB : constant := 33; XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB : constant := 34; XCB_GLX_SET_CLIENT_INFO_2ARB : constant := 35; XCB_GLX_NEW_LIST : constant := 101; XCB_GLX_END_LIST : constant := 102; XCB_GLX_DELETE_LISTS : constant := 103; XCB_GLX_GEN_LISTS : constant := 104; XCB_GLX_FEEDBACK_BUFFER : constant := 105; XCB_GLX_SELECT_BUFFER : constant := 106; XCB_GLX_RENDER_MODE : constant := 107; XCB_GLX_FINISH : constant := 108; XCB_GLX_PIXEL_STOREF : constant := 109; XCB_GLX_PIXEL_STOREI : constant := 110; XCB_GLX_READ_PIXELS : constant := 111; XCB_GLX_GET_BOOLEANV : constant := 112; XCB_GLX_GET_CLIP_PLANE : constant := 113; XCB_GLX_GET_DOUBLEV : constant := 114; XCB_GLX_GET_ERROR : constant := 115; XCB_GLX_GET_FLOATV : constant := 116; XCB_GLX_GET_INTEGERV : constant := 117; XCB_GLX_GET_LIGHTFV : constant := 118; XCB_GLX_GET_LIGHTIV : constant := 119; XCB_GLX_GET_MAPDV : constant := 120; XCB_GLX_GET_MAPFV : constant := 121; XCB_GLX_GET_MAPIV : constant := 122; XCB_GLX_GET_MATERIALFV : constant := 123; XCB_GLX_GET_MATERIALIV : constant := 124; XCB_GLX_GET_PIXEL_MAPFV : constant := 125; XCB_GLX_GET_PIXEL_MAPUIV : constant := 126; XCB_GLX_GET_PIXEL_MAPUSV : constant := 127; XCB_GLX_GET_POLYGON_STIPPLE : constant := 128; XCB_GLX_GET_STRING : constant := 129; XCB_GLX_GET_TEX_ENVFV : constant := 130; XCB_GLX_GET_TEX_ENVIV : constant := 131; XCB_GLX_GET_TEX_GENDV : constant := 132; XCB_GLX_GET_TEX_GENFV : constant := 133; XCB_GLX_GET_TEX_GENIV : constant := 134; XCB_GLX_GET_TEX_IMAGE : constant := 135; XCB_GLX_GET_TEX_PARAMETERFV : constant := 136; XCB_GLX_GET_TEX_PARAMETERIV : constant := 137; XCB_GLX_GET_TEX_LEVEL_PARAMETERFV : constant := 138; XCB_GLX_GET_TEX_LEVEL_PARAMETERIV : constant := 139; XCB_GLX_IS_ENABLED : constant := 140; XCB_GLX_IS_LIST : constant := 141; XCB_GLX_FLUSH : constant := 142; XCB_GLX_ARE_TEXTURES_RESIDENT : constant := 143; XCB_GLX_DELETE_TEXTURES : constant := 144; XCB_GLX_GEN_TEXTURES : constant := 145; XCB_GLX_IS_TEXTURE : constant := 146; XCB_GLX_GET_COLOR_TABLE : constant := 147; XCB_GLX_GET_COLOR_TABLE_PARAMETERFV : constant := 148; XCB_GLX_GET_COLOR_TABLE_PARAMETERIV : constant := 149; XCB_GLX_GET_CONVOLUTION_FILTER : constant := 150; XCB_GLX_GET_CONVOLUTION_PARAMETERFV : constant := 151; XCB_GLX_GET_CONVOLUTION_PARAMETERIV : constant := 152; XCB_GLX_GET_SEPARABLE_FILTER : constant := 153; XCB_GLX_GET_HISTOGRAM : constant := 154; XCB_GLX_GET_HISTOGRAM_PARAMETERFV : constant := 155; XCB_GLX_GET_HISTOGRAM_PARAMETERIV : constant := 156; XCB_GLX_GET_MINMAX : constant := 157; XCB_GLX_GET_MINMAX_PARAMETERFV : constant := 158; XCB_GLX_GET_MINMAX_PARAMETERIV : constant := 159; XCB_GLX_GET_COMPRESSED_TEX_IMAGE_ARB : constant := 160; XCB_GLX_DELETE_QUERIES_ARB : constant := 161; XCB_GLX_GEN_QUERIES_ARB : constant := 162; XCB_GLX_IS_QUERY_ARB : constant := 163; XCB_GLX_GET_QUERYIV_ARB : constant := 164; XCB_GLX_GET_QUERY_OBJECTIV_ARB : constant := 165; XCB_GLX_GET_QUERY_OBJECTUIV_ARB : constant := 166; end xcb;
-- Copyright (c) 2021 Devin Hill -- zlib License -- see LICENSE for details. with System; use System; with Interfaces.C; use Interfaces; function GBA.BIOS.Memset ( Dest : in Address; Value : Integer; Num_Bytes : C.size_t ) return Address with Linker_Section => ".iwram"; pragma Machine_Attribute (Memset, "target", "arm");
with impact.d2.orbs.Fixture; package impact.d2.orbs.Contact.circle -- -- -- is type b2CircleContact is new b2Contact with null record; type View is access all b2CircleContact'Class; function to_b2CircleContact (fixtureA, fixtureB : access fixture.item'Class) return b2CircleContact; overriding procedure Evaluate (Self : in out b2CircleContact; manifold : access collision.b2Manifold; xfA, xfB : in b2Transform); function Create (fixtureA, fixtureB : access Fixture.item) return access b2Contact'Class; procedure Destroy (contact : in out impact.d2.orbs.Contact.view); end impact.d2.orbs.Contact.circle;
------------------------------------------------------------------------------- -- Copyright 2021, The Trendy Terminal Developers (see AUTHORS file) -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- http://www.apache.org/licenses/LICENSE-2.0 -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT 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.Latin_1; with Ada.Containers.Ordered_Maps; with Ada.Strings.Unbounded; package Trendy_Terminal.Maps is package ASU renames Ada.Strings.Unbounded; package Characters renames Ada.Characters.Latin_1; CSI : constant String := Characters.ESC & "["; type Key is (Key_Up, Key_Left, Key_Right, Key_Down, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11, Key_F12, Key_Backspace, Key_Pause, Key_Escape, Key_Home, Key_End, Key_Insert, Key_Delete, Key_Page_Up, Key_Page_Down, Key_Tab, -- Keys with modifiers. Key_Shift_Tab, Key_Ctrl_Up, Key_Ctrl_Left, Key_Ctrl_Right, Key_Ctrl_Down, Key_Ctrl_C, Key_Ctrl_D ); function Sequence_For (K : Key) return String; function Is_Key (Sequence : String) return Boolean; function Key_For (Sequence : String) return Key with Pre => Is_Key (Sequence); end Trendy_Terminal.Maps;
with Generic_Fifo; with Ada.Text_Io; use Ada.Text_Io; procedure Generic_Fifo_Test is package Int_Fifo is new Generic_Fifo(Integer); use Int_Fifo; My_Fifo : Fifo_Type; Val : Integer; begin for I in 1..10 loop My_Fifo.Push(I); end loop; while not My_Fifo.Is_Empty loop My_Fifo.Pop(Val); Put_Line(Integer'Image(Val)); end loop; end Generic_Fifo_Test;
-- -- Copyright (C) 2015-2016 secunet Security Networks AG -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with HW.Time; with HW.Debug; with GNAT.Source_Info; with HW.GFX.GMA.Config; with HW.GFX.GMA.Registers; with HW.GFX.GMA.Power_And_Clocks; use type HW.Word8; use type HW.GFX.GMA.Registers.Registers_Invalid_Index; package body HW.GFX.GMA.DP_Aux_Request is DP_AUX_CTL_SEND_BUSY : constant := 1 * 2 ** 31; DP_AUX_CTL_DONE : constant := 1 * 2 ** 30; DP_AUX_CTL_INTERRUPT_ON_DONE : constant := 1 * 2 ** 29; DP_AUX_CTL_TIME_OUT_ERROR : constant := 1 * 2 ** 28; DP_AUX_CTL_TIME_OUT_TIMER_MASK : constant := 3 * 2 ** 26; DP_AUX_CTL_TIME_OUT_TIMER_400US : constant := 0 * 2 ** 26; DP_AUX_CTL_TIME_OUT_TIMER_600US : constant := 1 * 2 ** 26; DP_AUX_CTL_TIME_OUT_TIMER_800US : constant := 2 * 2 ** 26; DP_AUX_CTL_TIME_OUT_TIMER_1600US : constant := 3 * 2 ** 26; DP_AUX_CTL_RECEIVE_ERROR : constant := 1 * 2 ** 25; DP_AUX_CTL_MESSAGE_SIZE_MASK : constant := 31 * 2 ** 20; DP_AUX_CTL_MESSAGE_SIZE_SHIFT : constant := 2 ** 20; DP_AUX_CTL_PRECHARGE_TIME_MASK : constant := 15 * 2 ** 16; DP_AUX_CTL_PRECHARGE_TIME_SHIFT : constant := 2 ** 16; DP_AUX_CTL_2X_BIT_CLOCK_DIV_MASK : constant := 2047 * 2 ** 0; -- TODO: HSW/BDW with LPT-H might need a workaround for the 2x bit clock. subtype DP_AUX_CTL_MESSAGE_SIZE_T is Natural range 1 .. 20; function DP_AUX_CTL_MESSAGE_SIZE (Message_Length : DP_AUX_CTL_MESSAGE_SIZE_T) return Word32; DDI_AUX_MUTEX_MUTEX_ENABLE : constant := 1 * 2 ** 31; DDI_AUX_MUTEX_MUTEX_STATUS : constant := 1 * 2 ** 30; type AUX_CH_Data_Regs is new Positive range 1 .. 5; type AUX_CH_Data_Regs_Array is array (AUX_CH_Data_Regs) of Registers.Registers_Index; type AUX_CH_Registers is record CTL : Registers.Registers_Index; DATA : AUX_CH_Data_Regs_Array; MUTEX : Registers.Registers_Invalid_Index; end record; type AUX_CH_Registers_Array is array (DP_Port) of AUX_CH_Registers; AUX_CH : constant AUX_CH_Registers_Array := (if Config.Has_PCH_Aux_Channels then AUX_CH_Registers_Array' (DP_A => AUX_CH_Registers' (CTL => Registers.DP_AUX_CTL_A, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.DP_AUX_DATA_A_1, 2 => Registers.DP_AUX_DATA_A_2, 3 => Registers.DP_AUX_DATA_A_3, 4 => Registers.DP_AUX_DATA_A_4, 5 => Registers.DP_AUX_DATA_A_5), MUTEX => Registers.Invalid_Register), DP_B => AUX_CH_Registers' (CTL => Registers.PCH_DP_AUX_CTL_B, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.PCH_DP_AUX_DATA_B_1, 2 => Registers.PCH_DP_AUX_DATA_B_2, 3 => Registers.PCH_DP_AUX_DATA_B_3, 4 => Registers.PCH_DP_AUX_DATA_B_4, 5 => Registers.PCH_DP_AUX_DATA_B_5), MUTEX => Registers.Invalid_Register), DP_C => AUX_CH_Registers' (CTL => Registers.PCH_DP_AUX_CTL_C, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.PCH_DP_AUX_DATA_C_1, 2 => Registers.PCH_DP_AUX_DATA_C_2, 3 => Registers.PCH_DP_AUX_DATA_C_3, 4 => Registers.PCH_DP_AUX_DATA_C_4, 5 => Registers.PCH_DP_AUX_DATA_C_5), MUTEX => Registers.Invalid_Register), DP_D => AUX_CH_Registers' (CTL => Registers.PCH_DP_AUX_CTL_D, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.PCH_DP_AUX_DATA_D_1, 2 => Registers.PCH_DP_AUX_DATA_D_2, 3 => Registers.PCH_DP_AUX_DATA_D_3, 4 => Registers.PCH_DP_AUX_DATA_D_4, 5 => Registers.PCH_DP_AUX_DATA_D_5), MUTEX => Registers.Invalid_Register)) else AUX_CH_Registers_Array' (DP_A => AUX_CH_Registers' (CTL => Registers.DDI_AUX_CTL_A, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.DDI_AUX_DATA_A_1, 2 => Registers.DDI_AUX_DATA_A_2, 3 => Registers.DDI_AUX_DATA_A_3, 4 => Registers.DDI_AUX_DATA_A_4, 5 => Registers.DDI_AUX_DATA_A_5), MUTEX => Registers.DDI_AUX_MUTEX_A), DP_B => AUX_CH_Registers' (CTL => Registers.DDI_AUX_CTL_B, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.DDI_AUX_DATA_B_1, 2 => Registers.DDI_AUX_DATA_B_2, 3 => Registers.DDI_AUX_DATA_B_3, 4 => Registers.DDI_AUX_DATA_B_4, 5 => Registers.DDI_AUX_DATA_B_5), MUTEX => Registers.DDI_AUX_MUTEX_B), DP_C => AUX_CH_Registers' (CTL => Registers.DDI_AUX_CTL_C, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.DDI_AUX_DATA_C_1, 2 => Registers.DDI_AUX_DATA_C_2, 3 => Registers.DDI_AUX_DATA_C_3, 4 => Registers.DDI_AUX_DATA_C_4, 5 => Registers.DDI_AUX_DATA_C_5), MUTEX => Registers.DDI_AUX_MUTEX_C), DP_D => AUX_CH_Registers' (CTL => Registers.DDI_AUX_CTL_D, DATA => AUX_CH_Data_Regs_Array' (1 => Registers.DDI_AUX_DATA_D_1, 2 => Registers.DDI_AUX_DATA_D_2, 3 => Registers.DDI_AUX_DATA_D_3, 4 => Registers.DDI_AUX_DATA_D_4, 5 => Registers.DDI_AUX_DATA_D_5), MUTEX => Registers.DDI_AUX_MUTEX_D))); ---------------------------------------------------------------------------- function DP_AUX_CTL_MESSAGE_SIZE (Message_Length : DP_AUX_CTL_MESSAGE_SIZE_T) return Word32 is begin return Word32 (Message_Length) * DP_AUX_CTL_MESSAGE_SIZE_SHIFT; end DP_AUX_CTL_MESSAGE_SIZE; ---------------------------------------------------------------------------- procedure Aux_Request_Low (Port : in DP_Port; Request : in DP_Defs.Aux_Request; Request_Length : in DP_Defs.Aux_Request_Length; Response : out DP_Defs.Aux_Response; Response_Length : out DP_Defs.Aux_Response_Length; Success : out Boolean) with Global => (In_Out => Registers.Register_State, Input => (Time.State, Config.Raw_Clock)), Depends => ((Registers.Register_State, Response, Response_Length, Success) => (Registers.Register_State, Config.Raw_Clock, Time.State, Port, Request, Request_Length)) is procedure Write_Data_Reg (Register : in Registers.Registers_Index; Buf : in DP_Defs.Aux_Request; Length : in DP_Defs.Aux_Request_Length; Offset : in DP_Defs.Aux_Request_Index) is Value : Word32; Count : Natural; begin if Offset < Length then if Length - Offset > 4 then Count := 4; else Count := Length - Offset; end if; Value := 0; for Idx in DP_Defs.Aux_Request_Index range 0 .. Count - 1 loop Value := Value or Shift_Left (Word32 (Buf (Offset + Idx)), (3 - Idx) * 8); end loop; Registers.Write (Register => Register, Value => Value); end if; end Write_Data_Reg; procedure Read_Data_Reg (Register : in Registers.Registers_Index; Buf : in out DP_Defs.Aux_Response; Length : in DP_Defs.Aux_Response_Length; Offset : in DP_Defs.Aux_Response_Index) is Value : Word32; Count : DP_Defs.Aux_Response_Length; begin if Offset < Length then if Length - Offset > 4 then Count := 4; else Count := Length - Offset; end if; Registers.Read (Register => Register, Value => Value); for Idx in 0 .. Count - 1 loop Buf (Offset + Idx) := Word8 (Shift_Right (Value, (3 - Idx) * 8) and 16#ff#); end loop; end if; end Read_Data_Reg; DP_AUX_CTL_2x_Clock_Mask : constant := (if Config.Has_PCH_Aux_Channels then DP_AUX_CTL_2X_BIT_CLOCK_DIV_MASK else 0); DP_AUX_CTL_2x_Clock : constant Word32 := (if Config.Has_PCH_Aux_Channels then (if Port = DP_A then Word32 ((Config.Default_CDClk_Freq + 1_000_000) / 2_000_000) else Word32 ((Config.Raw_Clock + 1_000_000) / 2_000_000)) elsif Config.Has_GMCH_RawClk then Word32 (Div_Round_Closest (Config.Raw_Clock, 2_000_000)) else 0); Busy : Boolean; Status : Word32; begin Response := (others => 0); -- Don't care Response_Length := DP_Defs.Aux_Response_Length'First; if Config.Need_DP_Aux_Mutex then Registers.Set_Mask (Register => AUX_CH (Port).MUTEX, Mask => DDI_AUX_MUTEX_MUTEX_ENABLE); Registers.Wait_Set_Mask (Register => AUX_CH (Port).MUTEX, Mask => DDI_AUX_MUTEX_MUTEX_STATUS); end if; Registers.Is_Set_Mask (Register => AUX_CH (Port).CTL, Mask => DP_AUX_CTL_SEND_BUSY, Result => Busy); if Busy then Success := False; else for Idx in AUX_CH_Data_Regs loop Write_Data_Reg (Register => AUX_CH (Port).DATA (Idx), Buf => Request, Length => Request_Length, Offset => (Natural (Idx) - 1) * 4); end loop; Registers.Unset_And_Set_Mask (Register => AUX_CH (Port).CTL, Mask_Unset => DP_AUX_CTL_INTERRUPT_ON_DONE or DP_AUX_CTL_TIME_OUT_TIMER_MASK or DP_AUX_CTL_MESSAGE_SIZE_MASK or DP_AUX_CTL_2x_Clock_Mask, Mask_Set => DP_AUX_CTL_SEND_BUSY or -- starts transfer DP_AUX_CTL_DONE or -- clears the status DP_AUX_CTL_TIME_OUT_ERROR or -- clears the status DP_AUX_CTL_RECEIVE_ERROR or -- clears the status DP_AUX_CTL_TIME_OUT_TIMER_600US or DP_AUX_CTL_MESSAGE_SIZE (Request_Length) or DP_AUX_CTL_2x_Clock); Registers.Wait_Unset_Mask (Register => AUX_CH (Port).CTL, Mask => DP_AUX_CTL_SEND_BUSY); Registers.Read (Register => AUX_CH (Port).CTL, Value => Status); Success := (Status and (DP_AUX_CTL_TIME_OUT_ERROR or DP_AUX_CTL_RECEIVE_ERROR)) = 0; if Success then Status := (Status and DP_AUX_CTL_MESSAGE_SIZE_MASK) / DP_AUX_CTL_MESSAGE_SIZE_SHIFT; if Natural (Status) < DP_Defs.Aux_Response_Length'First then Success := False; elsif Natural (Status) > DP_Defs.Aux_Response_Length'Last then Response_Length := DP_Defs.Aux_Response_Length'Last; else Response_Length := Natural (Status); end if; end if; if Success then for Idx in AUX_CH_Data_Regs loop Read_Data_Reg (Register => AUX_CH (Port).DATA (Idx), Buf => Response, Length => Response_Length, Offset => (Natural (Idx) - 1) * 4); end loop; end if; end if; if Config.Need_DP_Aux_Mutex then Registers.Unset_And_Set_Mask (Register => AUX_CH (Port).MUTEX, Mask_Unset => DDI_AUX_MUTEX_MUTEX_ENABLE, Mask_Set => DDI_AUX_MUTEX_MUTEX_STATUS); -- frees the mutex end if; end Aux_Request_Low; ---------------------------------------------------------------------------- procedure Do_Aux_Request (Port : in DP_Port; Request : in DP_Defs.Aux_Request; Request_Length : in DP_Defs.Aux_Request_Length; Response : out DP_Defs.Aux_Response; Response_Length : out DP_Defs.Aux_Response_Length; Success : out Boolean) is begin for Try in Positive range 1 .. 3 loop Aux_Request_Low (Port => Port, Request => Request, Request_Length => Request_Length, Response => Response, Response_Length => Response_Length, Success => Success); exit when Success; end loop; end Do_Aux_Request; end HW.GFX.GMA.DP_Aux_Request;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with SDL.Events.Events; with SDL.Events.Keyboards; with SDL.Events.Mice; with SDL.Events.Windows; with SDL.Video.Windows.Makers; with Orka.Inputs.SDL; with Orka.Logging; with GL.Context; with GL.Viewports; package body Orka.Windows.SDL is use all type Orka.Logging.Source; use all type Orka.Logging.Severity; use Orka.Logging; package Messages is new Orka.Logging.Messages (Window_System); overriding procedure Finalize (Object : in out SDL_Context) is begin if Object.Flags.Debug then Messages.Log (Debug, "Shutting down SDL"); end if; Standard.SDL.Finalise; end Finalize; overriding procedure Enable (Object : in out SDL_Context; Subject : Contexts.Feature) is begin Contexts.Enable (Object.Features, Subject); end Enable; overriding function Enabled (Object : SDL_Context; Subject : Contexts.Feature) return Boolean is (Contexts.Enabled (Object.Features, Subject)); overriding function Is_Current (Object : SDL_Context; Kind : Orka.Contexts.Task_Kind) return Boolean is begin raise GL.Feature_Not_Supported_Exception; return True; end Is_Current; overriding procedure Make_Current (Object : SDL_Context) is begin raise GL.Feature_Not_Supported_Exception; end Make_Current; overriding procedure Make_Current (Object : SDL_Context; Window : in out Orka.Windows.Window'Class) is package GL renames Standard.SDL.Video.GL; package Windows renames Standard.SDL.Video.Windows; begin GL.Set_Current (SDL_Window (Window).Context, Windows.Window (Window)); end Make_Current; overriding procedure Make_Not_Current (Object : SDL_Context) is begin raise GL.Feature_Not_Supported_Exception; -- TODO Make sure Object is current on calling task end Make_Not_Current; overriding function Version (Object : SDL_Context) return Contexts.Context_Version is begin return (Major => GL.Context.Major_Version, Minor => GL.Context.Minor_Version); end Version; overriding function Flags (Object : SDL_Context) return Contexts.Context_Flags is Flags : constant GL.Context.Context_Flags := GL.Context.Flags; Result : Contexts.Context_Flags; begin pragma Assert (Flags.Forward_Compatible); Result.Debug := Flags.Debug; Result.Robust := Flags.Robust_Access; Result.No_Error := Flags.No_Error; return Result; end Flags; overriding function Create_Context (Version : Contexts.Context_Version; Flags : Contexts.Context_Flags := (others => False)) return SDL_Context is package GL renames Standard.SDL.Video.GL; use type GL.Flags; Context_Flags : GL.Flags := GL.Context_Forward_Compatible; begin if Flags.Debug then Context_Flags := Context_Flags or GL.Context_Debug; end if; if Flags.Robust then Context_Flags := Context_Flags or GL.Context_Robust_Access; end if; -- Initialize SDL if not Standard.SDL.Initialise then raise Program_Error with "Initializing SDL failed"; end if; pragma Assert (Standard.SDL.Was_Initialised (Standard.SDL.Enable_Screen)); Standard.SDL.Video.Disable_Screen_Saver; Messages.Log (Debug, "SDL driver: " & Standard.SDL.Video.Current_Driver_Name); -- Initialize OpenGL context GL.Set_Context_Major_Version (GL.Major_Versions (Version.Major)); GL.Set_Context_Minor_Version (GL.Minor_Versions (Version.Minor)); GL.Set_Context_Profile (GL.Core); GL.Set_Context_Flags (Context_Flags); return (Ada.Finalization.Limited_Controlled with Version => Version, Flags => Flags, Features => <>); end Create_Context; overriding procedure Finalize (Object : in out SDL_Window) is begin if not Object.Finalized then Messages.Log (Debug, "Closing SDL window"); Object.Window.Finalize; Object.Finalized := True; end if; end Finalize; overriding function Create_Window (Context : Contexts.Surface_Context'Class; Width, Height : Positive; Title : String := ""; Samples : Natural := 0; Visible, Resizable : Boolean := True; Transparent : Boolean := False) return SDL_Window is package SDL_GL renames Standard.SDL.Video.GL; package SDL_Windows renames Standard.SDL.Video.Windows; use type SDL_Windows.Window_Flags; begin return Result : aliased SDL_Window := SDL_Window'(Ada.Finalization.Limited_Controlled with Input => Inputs.SDL.Create_Pointer_Input, Finalized => False, others => <>) do declare Reference : SDL_Windows.Window renames Result.Window; Position : constant Standard.SDL.Natural_Coordinates := (X => SDL_Windows.Centered_Window_Position (0), Y => SDL_Windows.Centered_Window_Position (1)); Extents : constant Standard.SDL.Positive_Sizes := (Standard.SDL.Positive_Dimension (Width), Standard.SDL.Positive_Dimension (Height)); Flags : SDL_Windows.Window_Flags := SDL_Windows.OpenGL; begin if Resizable then Flags := Flags or SDL_Windows.Resizable; end if; if Visible then Flags := Flags or SDL_Windows.Shown; end if; SDL_GL.Set_Multisampling (Samples > 0); SDL_GL.Set_Multisampling_Samples (SDL_GL.Multisample_Samples (Samples)); -- Create window and make GL context current SDL_Windows.Makers.Create (Reference, Title, Position, Extents, Flags); SDL_GL.Create (Result.Context, Reference); pragma Assert (SDL_Windows.Exist); Inputs.SDL.SDL_Pointer_Input (Result.Input.all).Set_Window (Reference); declare Extents : constant Standard.SDL.Sizes := Reference.Get_Size; begin Result.Width := Positive (Extents.Width); Result.Height := Positive (Extents.Height); Messages.Log (Debug, "Created SDL window and GL context"); Messages.Log (Debug, " size: " & Trim (Result.Width'Image) & " × " & Trim (Result.Height'Image)); Messages.Log (Debug, " visible: " & (if Visible then "yes" else "no")); Messages.Log (Debug, " resizable: " & (if Resizable then "yes" else "no")); end; SDL_GL.Set_Current (Result.Context, Reference); Messages.Log (Debug, " context:"); Messages.Log (Debug, " flags: " & Orka.Contexts.Image (Context.Flags)); Messages.Log (Debug, " version: " & GL.Context.Version_String); Messages.Log (Debug, " renderer: " & GL.Context.Renderer); GL.Viewports.Set_Clipping (GL.Viewports.Lower_Left, GL.Viewports.Zero_To_One); Result.Vertex_Array.Create; end; end return; end Create_Window; overriding function Pointer_Input (Object : SDL_Window) return Inputs.Pointers.Pointer_Input_Ptr is (Object.Input); overriding function Width (Object : SDL_Window) return Positive is (Object.Width); overriding function Height (Object : SDL_Window) return Positive is (Object.Height); overriding procedure Set_Title (Object : in out SDL_Window; Value : String) is begin Object.Window.Set_Title (Value); end Set_Title; overriding procedure Close (Object : in out SDL_Window) is begin Object.Close_Window := True; end Close; overriding function Should_Close (Object : SDL_Window) return Boolean is begin return Object.Close_Window; end Should_Close; overriding procedure Process_Input (Object : in out SDL_Window) is package Events renames Standard.SDL.Events; Event : Events.Events.Events; Quit : Boolean := False; use type Events.Event_Types; use type Events.Keyboards.Key_Codes; use type GL.Types.Double; begin Object.Scroll_X := 0.0; Object.Scroll_Y := 0.0; while Events.Events.Poll (Event) loop case Event.Common.Event_Type is when Events.Quit => Object.Close; Quit := True; when Events.Keyboards.Key_Down => -- TODO Add Button_Input object if Event.Keyboard.Key_Sym.Key_Code = Events.Keyboards.Code_Escape then Object.Close; Quit := True; end if; when Events.Keyboards.Key_Up => null; when Events.Mice.Motion => Object.Position_X := GL.Types.Double (Event.Mouse_Motion.X); Object.Position_Y := GL.Types.Double (Event.Mouse_Motion.Y); when Events.Mice.Wheel => -- Accumulate the offset in case multiple events are processed Object.Scroll_X := Object.Scroll_X + GL.Types.Double (Event.Mouse_Wheel.X); Object.Scroll_Y := Object.Scroll_Y + GL.Types.Double (Event.Mouse_Wheel.Y); when Events.Mice.Button_Down => Inputs.SDL.SDL_Pointer_Input (Object.Input.all).Set_Button_State (Event.Mouse_Button.Button, Inputs.Pointers.Pressed); when Events.Mice.Button_Up => Inputs.SDL.SDL_Pointer_Input (Object.Input.all).Set_Button_State (Event.Mouse_Button.Button, Inputs.Pointers.Released); when Events.Windows.Window => case Event.Window.Event_ID is when Events.Windows.Resized | Events.Windows.Size_Changed => Object.Width := Integer (Event.Window.Data_1); Object.Height := Integer (Event.Window.Data_2); when Events.Windows.Close => Object.Close; Quit := True; when others => -- Ignore other window events null; end case; when others => -- Ignore other events null; end case; exit when Quit; end loop; -- Update position of mouse Inputs.SDL.SDL_Pointer_Input (Object.Input.all).Set_Position (Object.Position_X, Object.Position_Y); -- Update scroll offset of mouse Inputs.SDL.SDL_Pointer_Input (Object.Input.all).Set_Scroll_Offset (Object.Scroll_X, Object.Scroll_Y); end Process_Input; overriding procedure Swap_Buffers (Object : in out SDL_Window) is begin Standard.SDL.Video.GL.Swap (Object.Window); end Swap_Buffers; overriding procedure Set_Vertical_Sync (Object : in out SDL_Window; Enable : Boolean) is use all type Standard.SDL.Video.GL.Swap_Intervals; begin if not Standard.SDL.Video.GL.Set_Swap_Interval ((if Enable then Synchronised else Not_Synchronised), Late_Swap_Tear => True) then Messages.Log (Debug, (if Enable then "Enabling" else "Disabling") & " vertical sync failed"); end if; end Set_Vertical_Sync; end Orka.Windows.SDL;
package body Numeric_Tests is function Is_Numeric (Item : in String) return Boolean is Dummy : Float; begin Dummy := Float'Value (Item); return True; exception when others => return False; end Is_Numeric; end Numeric_Tests;
package body System.Long_Long_Integer_Types is pragma Suppress (All_Checks); -- libgcc function udivmoddi4 ( a, b : Long_Long_Unsigned; c : not null access Long_Long_Unsigned) return Long_Long_Unsigned with Import, Convention => C, External_Name => "__udivmoddi4"; -- implementation procedure Divide ( Left, Right : Long_Long_Unsigned; Quotient, Remainder : out Long_Long_Unsigned) is begin if Long_Long_Integer'Size <= Standard'Word_Size then -- word size "/" and "rem" would be optimized Quotient := Left / Right; Remainder := Left rem Right; else declare Aliased_Remainder : aliased Long_Long_Unsigned; begin Quotient := udivmoddi4 (Left, Right, Aliased_Remainder'Access); Remainder := Aliased_Remainder; end; end if; end Divide; end System.Long_Long_Integer_Types;
pragma License (Unrestricted); -- implementation unit required by compiler with Ada.Streams.Block_Transmission.Strings; with Ada.Streams.Block_Transmission.Wide_Strings; with Ada.Streams.Block_Transmission.Wide_Wide_Strings; with System.Storage_Elements; package System.Strings.Stream_Ops is pragma Pure; pragma Suppress (All_Checks); -- for instantiation -- required for String'Read by compiler (s-ststop.ads) procedure String_Read_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out String) renames Ada.Streams.Block_Transmission.Strings.Read; -- required for String'Write by compiler (s-ststop.ads) procedure String_Write_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : String) renames Ada.Streams.Block_Transmission.Strings.Write; -- required for String'Input by compiler (s-ststop.ads) function String_Input_Blk_IO is new Ada.Streams.Block_Transmission.Input ( Positive, Character, String, String_Read_Blk_IO); -- required for String'Output by compiler (s-ststop.ads) procedure String_Output_Blk_IO is new Ada.Streams.Block_Transmission.Output ( Positive, Character, String, String_Write_Blk_IO); -- required for Wide_String'Read by compiler (s-ststop.ads) procedure Wide_String_Read_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out Wide_String) renames Ada.Streams.Block_Transmission.Wide_Strings.Read; -- required for Wide_String'Write by compiler (s-ststop.ads) procedure Wide_String_Write_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : Wide_String) renames Ada.Streams.Block_Transmission.Wide_Strings.Write; -- required for Wide_String'Input by compiler (s-ststop.ads) function Wide_String_Input_Blk_IO is new Ada.Streams.Block_Transmission.Input ( Positive, Wide_Character, Wide_String, Wide_String_Read_Blk_IO); -- required for Wide_String'Output by compiler (s-ststop.ads) procedure Wide_String_Output_Blk_IO is new Ada.Streams.Block_Transmission.Output ( Positive, Wide_Character, Wide_String, Wide_String_Write_Blk_IO); -- required for Wide_Wide_String'Read by compiler (s-ststop.ads) procedure Wide_Wide_String_Read_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out Wide_Wide_String) renames Ada.Streams.Block_Transmission.Wide_Wide_Strings.Read; -- required for Wide_Wide_String'Write by compiler (s-ststop.ads) procedure Wide_Wide_String_Write_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : Wide_Wide_String) renames Ada.Streams.Block_Transmission.Wide_Wide_Strings.Write; -- required for Wide_Wide_String'Input by compiler (s-ststop.ads) function Wide_Wide_String_Input_Blk_IO is new Ada.Streams.Block_Transmission.Input ( Positive, Wide_Wide_Character, Wide_Wide_String, Wide_Wide_String_Read_Blk_IO); -- required for Wide_Wide_String'Output by compiler (s-ststop.ads) procedure Wide_Wide_String_Output_Blk_IO is new Ada.Streams.Block_Transmission.Output ( Positive, Wide_Wide_Character, Wide_Wide_String, Wide_Wide_String_Write_Blk_IO); -- required for System.Storage_Elements.Storage_Array'Read (s-ststop.ads) procedure Storage_Array_Read_Blk_IO is new Ada.Streams.Block_Transmission.Read ( Storage_Elements.Storage_Offset, Storage_Elements.Storage_Element, Storage_Elements.Storage_Array); -- required for System.Storage_Elements.Storage_Array'Write (s-ststop.ads) procedure Storage_Array_Write_Blk_IO is new Ada.Streams.Block_Transmission.Write ( Storage_Elements.Storage_Offset, Storage_Elements.Storage_Element, Storage_Elements.Storage_Array); -- required for System.Storage_Elements.Storage_Array'Input (s-ststop.ads) function Storage_Array_Input_Blk_IO is new Ada.Streams.Block_Transmission.Input ( Storage_Elements.Storage_Offset, Storage_Elements.Storage_Element, Storage_Elements.Storage_Array, Storage_Array_Read_Blk_IO); -- required for System.Storage_Elements.Storage_Array'Output (s-ststop.ads) procedure Storage_Array_Output_Blk_IO is new Ada.Streams.Block_Transmission.Output ( Storage_Elements.Storage_Offset, Storage_Elements.Storage_Element, Storage_Elements.Storage_Array, Storage_Array_Write_Blk_IO); -- required for Ada.Streams.Stream_Element_Array'Read (s-ststop.ads) procedure Stream_Element_Array_Read_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out Ada.Streams.Stream_Element_Array) renames Ada.Streams.Block_Transmission.Stream_Element_Arrays.Read; -- required for Ada.Streams.Stream_Element_Array'Write (s-ststop.ads) procedure Stream_Element_Array_Write_Blk_IO ( Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : Ada.Streams.Stream_Element_Array) renames Ada.Streams.Block_Transmission.Stream_Element_Arrays.Write; -- required for Ada.Streams.Stream_Element_Array'Input (s-ststop.ads) function Stream_Element_Array_Input_Blk_IO is new Ada.Streams.Block_Transmission.Input ( Ada.Streams.Stream_Element_Offset, Ada.Streams.Stream_Element, Ada.Streams.Stream_Element_Array, Stream_Element_Array_Read_Blk_IO); -- required for Ada.Streams.Stream_Element_Array'Output (s-ststop.ads) procedure Stream_Element_Array_Output_Blk_IO is new Ada.Streams.Block_Transmission.Output ( Ada.Streams.Stream_Element_Offset, Ada.Streams.Stream_Element, Ada.Streams.Stream_Element_Array, Stream_Element_Array_Write_Blk_IO); end System.Strings.Stream_Ops;
with Vecteurs; use Vecteurs; package Math is -- Hypothénuse -- https://en.wikipedia.org/wiki/Hypot function Hypot(P : Point2D) return Float; end;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Orka.Jobs; with Orka.Resources.Locations; package Orka.Resources.Loaders is pragma Preelaborate; type Resource_Data is record Bytes : Byte_Array_Pointers.Pointer; Reading_Time : Duration; Start_Time : Time; Path : SU.Unbounded_String; end record; subtype Extension_String is String with Dynamic_Predicate => Extension_String'Length <= 4; type Loader is limited interface; function Extension (Object : Loader) return Extension_String is abstract; -- Return the extension of files that the loader can load procedure Load (Object : Loader; Data : Resource_Data; Enqueue : not null access procedure (Element : Jobs.Job_Ptr); Location : Locations.Location_Ptr) is abstract; -- Load the given resource data type Loader_Access is access Loader'Class; subtype Loader_Ptr is not null Loader_Access; end Orka.Resources.Loaders;
----------------------------------------------------------------------- -- cosin -- Generate a sinus/cosinus table -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Text_IO; with Ada.Numerics.Generic_Elementary_Functions; procedure Cosin is type Float_Type is digits 15 range 0.0 .. 655336.0; package F_IO is new Ada.Text_IO.Float_IO (Float_Type); package Maths is new Ada.Numerics.Generic_Elementary_Functions (Float_Type); To_Rad : constant Float_Type := Ada.Numerics.Pi / 180.0; Angle : Float_Type; Value : Float_Type; Scale : constant Float_Type := 65536.0; begin Ada.Text_IO.Put_Line ("package Cosin_Table is"); Ada.Text_IO.Put_Line (" type Cosin_Value is new Integer;"); Ada.Text_IO.Put_Line (" type Cosin_Array is array (0 .. 179) of Cosin_Value;"); Ada.Text_IO.Put_Line (" Factor : constant Cosin_Value := 65536;"); Ada.Text_IO.Put_Line (" Sin_Table : constant array (0 .. 179) of Cosin_Value := ("); Ada.Text_IO.Put (" "); for I in 0 .. 89 loop Angle := To_Rad * Float_Type (I); Value := Scale * Maths.Sin (Angle); Ada.Text_IO.Put (Integer'Image (Integer (Value))); Ada.Text_IO.Put (","); Angle := Angle + To_Rad / 2.0; Value := Scale * Maths.Sin (Angle); Ada.Text_IO.Put (Integer'Image (Integer (Value))); if (I mod 4) = 3 then Ada.Text_IO.Put_Line (","); Ada.Text_IO.Put (" "); elsif I /= 89 then Ada.Text_IO.Put (","); end if; end loop; Ada.Text_IO.Put_Line (");"); Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line (" Cos_Table : constant array (0 .. 179) of Cosin_Value := ("); Ada.Text_IO.Put (" "); for I in 0 .. 89 loop Angle := To_Rad * Float_Type (I); Value := Scale * Maths.Cos (Angle); Ada.Text_IO.Put (Integer'Image (Integer (Value))); Ada.Text_IO.Put (","); Angle := Angle + To_Rad / 2.0; Value := Scale * Maths.Cos (Angle); Ada.Text_IO.Put (Integer'Image (Integer (Value))); if (I mod 4) = 3 then Ada.Text_IO.Put_Line (","); Ada.Text_IO.Put (" "); elsif I /= 89 then Ada.Text_IO.Put (","); end if; end loop; Ada.Text_IO.Put_Line (");"); Ada.Text_IO.Put_Line ("end Cosin_Table;"); end Cosin;
package Benchmark.Matrix.MM is type MM_Type is new Matrix_Type with private; function Create_MM return Benchmark_Pointer; overriding procedure Run(benchmark : in MM_Type); private type MM_Type is new Matrix_Type with null record; end Benchmark.Matrix.MM;
with ada.text_io, ada.integer_text_io; use ada.text_io, ada.integer_text_io; procedure divisores (n1: in Integer) is begin new_line; put("Los divisores de ese numero son:"); for divisor in 1..n1 loop if n1 rem divisor = 0 then put(divisor); end if; end loop; new_line; end divisores;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ S T R M -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Elists; use Elists; with Exp_Util; use Exp_Util; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Rtsfind; use Rtsfind; with Sem_Aux; use Sem_Aux; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uintp; use Uintp; package body Exp_Strm is ----------------------- -- Local Subprograms -- ----------------------- procedure Build_Array_Read_Write_Procedure (Nod : Node_Id; Typ : Entity_Id; Decl : out Node_Id; Pnam : Entity_Id; Nam : Name_Id); -- Common routine shared to build either an array Read procedure or an -- array Write procedure, Nam is Name_Read or Name_Write to select which. -- Pnam is the defining identifier for the constructed procedure. The -- other parameters are as for Build_Array_Read_Procedure except that -- the first parameter Nod supplies the Sloc to be used to generate code. procedure Build_Record_Read_Write_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : Entity_Id; Nam : Name_Id); -- Common routine shared to build a record Read Write procedure, Nam -- is Name_Read or Name_Write to select which. Pnam is the defining -- identifier for the constructed procedure. The other parameters are -- as for Build_Record_Read_Procedure. procedure Build_Stream_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : Entity_Id; Decls : List_Id; Stms : List_Id); -- Called to build an array or record stream function. The first three -- arguments are the same as Build_Record_Or_Elementary_Input_Function. -- Decls and Stms are the declarations and statements for the body and -- The parameter Fnam is the name of the constructed function. function Has_Stream_Standard_Rep (U_Type : Entity_Id) return Boolean; -- This function is used to test the type U_Type, to determine if it has -- a standard representation from a streaming point of view. Standard means -- that it has a standard representation (e.g. no enumeration rep clause), -- and the size of the root type is the same as the streaming size (which -- is defined as value specified by a Stream_Size clause if present, or -- the Esize of U_Type if not). function Make_Stream_Subprogram_Name (Loc : Source_Ptr; Typ : Entity_Id; Nam : TSS_Name_Type) return Entity_Id; -- Return the entity that identifies the stream subprogram for type Typ -- that is identified by the given Nam. This procedure deals with the -- difference between tagged types (where a single subprogram associated -- with the type is generated) and all other cases (where a subprogram -- is generated at the point of the stream attribute reference). The -- Loc parameter is used as the Sloc of the created entity. function Stream_Base_Type (E : Entity_Id) return Entity_Id; -- Stream attributes work on the basis of the base type except for the -- array case. For the array case, we do not go to the base type, but -- to the first subtype if it is constrained. This avoids problems with -- incorrect conversions in the packed array case. Stream_Base_Type is -- exactly this function (returns the base type, unless we have an array -- type whose first subtype is constrained, in which case it returns the -- first subtype). -------------------------------- -- Build_Array_Input_Function -- -------------------------------- -- The function we build looks like -- function typSI[_nnn] (S : access RST) return Typ is -- L1 : constant Index_Type_1 := Index_Type_1'Input (S); -- H1 : constant Index_Type_1 := Index_Type_1'Input (S); -- L2 : constant Index_Type_2 := Index_Type_2'Input (S); -- H2 : constant Index_Type_2 := Index_Type_2'Input (S); -- .. -- Ln : constant Index_Type_n := Index_Type_n'Input (S); -- Hn : constant Index_Type_n := Index_Type_n'Input (S); -- -- V : Typ'Base (L1 .. H1, L2 .. H2, ... Ln .. Hn) -- begin -- Typ'Read (S, V); -- return V; -- end typSI[_nnn] -- Note: the suffix [_nnn] is present for untagged types, where we generate -- a local subprogram at the point of the occurrence of the attribute -- reference, so the name must be unique. procedure Build_Array_Input_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id) is Dim : constant Pos := Number_Dimensions (Typ); Lnam : Name_Id; Hnam : Name_Id; Decls : List_Id; Ranges : List_Id; Stms : List_Id; Rstmt : Node_Id; Indx : Node_Id; Odecl : Node_Id; begin Decls := New_List; Ranges := New_List; Indx := First_Index (Typ); for J in 1 .. Dim loop Lnam := New_External_Name ('L', J); Hnam := New_External_Name ('H', J); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Lnam), Constant_Present => True, Object_Definition => New_Occurrence_Of (Etype (Indx), Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Input, Expressions => New_List (Make_Identifier (Loc, Name_S))))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Hnam), Constant_Present => True, Object_Definition => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Input, Expressions => New_List (Make_Identifier (Loc, Name_S))))); Append_To (Ranges, Make_Range (Loc, Low_Bound => Make_Identifier (Loc, Lnam), High_Bound => Make_Identifier (Loc, Hnam))); Next_Index (Indx); end loop; -- If the type is constrained, use it directly. Otherwise build a -- subtype indication with the proper bounds. if Is_Constrained (Typ) then Odecl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_V), Object_Definition => New_Occurrence_Of (Typ, Loc)); else Odecl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_V), Object_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Stream_Base_Type (Typ), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Ranges))); end if; Rstmt := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Typ, Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Identifier (Loc, Name_V))); Stms := New_List ( Make_Extended_Return_Statement (Loc, Return_Object_Declarations => New_List (Odecl), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, New_List (Rstmt)))); Fnam := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name_Local (Typ, TSS_Stream_Input)); Build_Stream_Function (Loc, Typ, Decl, Fnam, Decls, Stms); end Build_Array_Input_Function; ---------------------------------- -- Build_Array_Output_Procedure -- ---------------------------------- procedure Build_Array_Output_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is Stms : List_Id; Indx : Node_Id; begin -- Build series of statements to output bounds Indx := First_Index (Typ); Stms := New_List; for J in 1 .. Number_Dimensions (Typ) loop Append_To (Stms, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_First, Expressions => New_List ( Make_Integer_Literal (Loc, J)))))); Append_To (Stms, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Indx)), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Last, Expressions => New_List ( Make_Integer_Literal (Loc, J)))))); Next_Index (Indx); end loop; -- Append Write attribute to write array elements Append_To (Stms, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Typ, Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Identifier (Loc, Name_V)))); Pnam := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name_Local (Typ, TSS_Stream_Output)); Build_Stream_Procedure (Loc, Typ, Decl, Pnam, Stms, False); end Build_Array_Output_Procedure; -------------------------------- -- Build_Array_Read_Procedure -- -------------------------------- procedure Build_Array_Read_Procedure (Nod : Node_Id; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is Loc : constant Source_Ptr := Sloc (Nod); begin Pnam := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name_Local (Typ, TSS_Stream_Read)); Build_Array_Read_Write_Procedure (Nod, Typ, Decl, Pnam, Name_Read); end Build_Array_Read_Procedure; -------------------------------------- -- Build_Array_Read_Write_Procedure -- -------------------------------------- -- The form of the array read/write procedure is as follows: -- procedure pnam (S : access RST, V : [out] Typ) is -- begin -- for L1 in V'Range (1) loop -- for L2 in V'Range (2) loop -- ... -- for Ln in V'Range (n) loop -- Component_Type'Read/Write (S, V (L1, L2, .. Ln)); -- end loop; -- .. -- end loop; -- end loop -- end pnam; -- The out keyword for V is supplied in the Read case procedure Build_Array_Read_Write_Procedure (Nod : Node_Id; Typ : Entity_Id; Decl : out Node_Id; Pnam : Entity_Id; Nam : Name_Id) is Loc : constant Source_Ptr := Sloc (Nod); Ndim : constant Pos := Number_Dimensions (Typ); Ctyp : constant Entity_Id := Component_Type (Typ); Stm : Node_Id; Exl : List_Id; RW : Entity_Id; begin -- First build the inner attribute call Exl := New_List; for J in 1 .. Ndim loop Append_To (Exl, Make_Identifier (Loc, New_External_Name ('L', J))); end loop; Stm := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Base_Type (Ctyp), Loc), Attribute_Name => Nam, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Indexed_Component (Loc, Prefix => Make_Identifier (Loc, Name_V), Expressions => Exl))); -- The corresponding stream attribute for the component type of the -- array may be user-defined, and be frozen after the type for which -- we are generating the stream subprogram. In that case, freeze the -- stream attribute of the component type, whose declaration could not -- generate any additional freezing actions in any case. if Nam = Name_Read then RW := TSS (Base_Type (Ctyp), TSS_Stream_Read); else RW := TSS (Base_Type (Ctyp), TSS_Stream_Write); end if; if Present (RW) and then not Is_Frozen (RW) then Set_Is_Frozen (RW); end if; -- Now this is the big loop to wrap that statement up in a sequence -- of loops. The first time around, Stm is the attribute call. The -- second and subsequent times, Stm is an inner loop. for J in 1 .. Ndim loop Stm := Make_Implicit_Loop_Statement (Nod, Iteration_Scheme => Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars => New_External_Name ('L', Ndim - J + 1)), Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_V), Attribute_Name => Name_Range, Expressions => New_List ( Make_Integer_Literal (Loc, Ndim - J + 1))))), Statements => New_List (Stm)); end loop; Build_Stream_Procedure (Loc, Typ, Decl, Pnam, New_List (Stm), Nam = Name_Read); end Build_Array_Read_Write_Procedure; --------------------------------- -- Build_Array_Write_Procedure -- --------------------------------- procedure Build_Array_Write_Procedure (Nod : Node_Id; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is Loc : constant Source_Ptr := Sloc (Nod); begin Pnam := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name_Local (Typ, TSS_Stream_Write)); Build_Array_Read_Write_Procedure (Nod, Typ, Decl, Pnam, Name_Write); end Build_Array_Write_Procedure; --------------------------------- -- Build_Elementary_Input_Call -- --------------------------------- function Build_Elementary_Input_Call (N : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); P_Type : constant Entity_Id := Entity (Prefix (N)); U_Type : constant Entity_Id := Underlying_Type (P_Type); Rt_Type : constant Entity_Id := Root_Type (U_Type); FST : constant Entity_Id := First_Subtype (U_Type); Strm : constant Node_Id := First (Expressions (N)); Targ : constant Node_Id := Next (Strm); P_Size : constant Uint := Get_Stream_Size (FST); Res : Node_Id; Lib_RE : RE_Id; begin -- Check first for Boolean and Character. These are enumeration types, -- but we treat them specially, since they may require special handling -- in the transfer protocol. However, this special handling only applies -- if they have standard representation, otherwise they are treated like -- any other enumeration type. if Rt_Type = Standard_Boolean and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_I_B; elsif Rt_Type = Standard_Character and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_I_C; elsif Rt_Type = Standard_Wide_Character and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_I_WC; elsif Rt_Type = Standard_Wide_Wide_Character and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_I_WWC; -- Floating point types elsif Is_Floating_Point_Type (U_Type) then -- Question: should we use P_Size or Rt_Type to distinguish between -- possible floating point types? If a non-standard size or a stream -- size is specified, then we should certainly use the size. But if -- we have two types the same (notably Short_Float_Size = Float_Size -- which is close to universally true, and Long_Long_Float_Size = -- Long_Float_Size, true on most targets except the x86), then we -- would really rather use the root type, so that if people want to -- fiddle with System.Stream_Attributes to get inter-target portable -- streams, they get the size they expect. Consider in particular the -- case of a stream written on an x86, with 96-bit Long_Long_Float -- being read into a non-x86 target with 64 bit Long_Long_Float. A -- special version of System.Stream_Attributes can deal with this -- provided the proper type is always used. -- To deal with these two requirements we add the special checks -- on equal sizes and use the root type to distinguish. if P_Size <= Standard_Short_Float_Size and then (Standard_Short_Float_Size /= Standard_Float_Size or else Rt_Type = Standard_Short_Float) then Lib_RE := RE_I_SF; elsif P_Size <= Standard_Float_Size then Lib_RE := RE_I_F; elsif P_Size <= Standard_Long_Float_Size and then (Standard_Long_Float_Size /= Standard_Long_Long_Float_Size or else Rt_Type = Standard_Long_Float) then Lib_RE := RE_I_LF; else Lib_RE := RE_I_LLF; end if; -- Signed integer types. Also includes signed fixed-point types and -- enumeration types with a signed representation. -- Note on signed integer types. We do not consider types as signed for -- this purpose if they have no negative numbers, or if they have biased -- representation. The reason is that the value in either case basically -- represents an unsigned value. -- For example, consider: -- type W is range 0 .. 2**32 - 1; -- for W'Size use 32; -- This is a signed type, but the representation is unsigned, and may -- be outside the range of a 32-bit signed integer, so this must be -- treated as 32-bit unsigned. -- Similarly, if we have -- type W is range -1 .. +254; -- for W'Size use 8; -- then the representation is unsigned elsif not Is_Unsigned_Type (FST) -- The following set of tests gets repeated many times, we should -- have an abstraction defined ??? and then (Is_Fixed_Point_Type (U_Type) or else Is_Enumeration_Type (U_Type) or else (Is_Signed_Integer_Type (U_Type) and then not Has_Biased_Representation (FST))) then if P_Size <= Standard_Short_Short_Integer_Size then Lib_RE := RE_I_SSI; elsif P_Size <= Standard_Short_Integer_Size then Lib_RE := RE_I_SI; elsif P_Size <= Standard_Integer_Size then Lib_RE := RE_I_I; elsif P_Size <= Standard_Long_Integer_Size then Lib_RE := RE_I_LI; else Lib_RE := RE_I_LLI; end if; -- Unsigned integer types, also includes unsigned fixed-point types -- and enumeration types with an unsigned representation (note that -- we know they are unsigned because we already tested for signed). -- Also includes signed integer types that are unsigned in the sense -- that they do not include negative numbers. See above for details. elsif Is_Modular_Integer_Type (U_Type) or else Is_Fixed_Point_Type (U_Type) or else Is_Enumeration_Type (U_Type) or else Is_Signed_Integer_Type (U_Type) then if P_Size <= Standard_Short_Short_Integer_Size then Lib_RE := RE_I_SSU; elsif P_Size <= Standard_Short_Integer_Size then Lib_RE := RE_I_SU; elsif P_Size <= Standard_Integer_Size then Lib_RE := RE_I_U; elsif P_Size <= Standard_Long_Integer_Size then Lib_RE := RE_I_LU; else Lib_RE := RE_I_LLU; end if; else pragma Assert (Is_Access_Type (U_Type)); if P_Size > System_Address_Size then Lib_RE := RE_I_AD; else Lib_RE := RE_I_AS; end if; end if; -- Call the function, and do an unchecked conversion of the result -- to the actual type of the prefix. If the target is a discriminant, -- and we are in the body of the default implementation of a 'Read -- attribute, set target type to force a constraint check (13.13.2(35)). -- If the type of the discriminant is currently private, add another -- unchecked conversion from the full view. if Nkind (Targ) = N_Identifier and then Is_Internal_Name (Chars (Targ)) and then Is_TSS (Scope (Entity (Targ)), TSS_Stream_Read) then Res := Unchecked_Convert_To (Base_Type (U_Type), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (Lib_RE), Loc), Parameter_Associations => New_List ( Relocate_Node (Strm)))); Set_Do_Range_Check (Res); if Base_Type (P_Type) /= Base_Type (U_Type) then Res := Unchecked_Convert_To (Base_Type (P_Type), Res); end if; return Res; else Res := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (Lib_RE), Loc), Parameter_Associations => New_List ( Relocate_Node (Strm))); -- Now convert to the base type if we do not have a biased type. Note -- that we did not do this in some older versions, and the result was -- losing a required range check in the case where 'Input is being -- called from 'Read. if not Has_Biased_Representation (P_Type) then return Unchecked_Convert_To (Base_Type (P_Type), Res); -- For the biased case, the conversion to the base type loses the -- biasing, so just convert to Ptype. This is not quite right, and -- for example may lose a corner case CE test, but it is such a -- rare case that for now we ignore it ??? else return Unchecked_Convert_To (P_Type, Res); end if; end if; end Build_Elementary_Input_Call; --------------------------------- -- Build_Elementary_Write_Call -- --------------------------------- function Build_Elementary_Write_Call (N : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); P_Type : constant Entity_Id := Entity (Prefix (N)); U_Type : constant Entity_Id := Underlying_Type (P_Type); Rt_Type : constant Entity_Id := Root_Type (U_Type); FST : constant Entity_Id := First_Subtype (U_Type); Strm : constant Node_Id := First (Expressions (N)); Item : constant Node_Id := Next (Strm); P_Size : Uint; Lib_RE : RE_Id; Libent : Entity_Id; begin -- Compute the size of the stream element. This is either the size of -- the first subtype or if given the size of the Stream_Size attribute. if Has_Stream_Size_Clause (FST) then P_Size := Static_Integer (Expression (Stream_Size_Clause (FST))); else P_Size := Esize (FST); end if; -- Find the routine to be called -- Check for First Boolean and Character. These are enumeration types, -- but we treat them specially, since they may require special handling -- in the transfer protocol. However, this special handling only applies -- if they have standard representation, otherwise they are treated like -- any other enumeration type. if Rt_Type = Standard_Boolean and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_W_B; elsif Rt_Type = Standard_Character and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_W_C; elsif Rt_Type = Standard_Wide_Character and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_W_WC; elsif Rt_Type = Standard_Wide_Wide_Character and then Has_Stream_Standard_Rep (U_Type) then Lib_RE := RE_W_WWC; -- Floating point types elsif Is_Floating_Point_Type (U_Type) then -- Question: should we use P_Size or Rt_Type to distinguish between -- possible floating point types? If a non-standard size or a stream -- size is specified, then we should certainly use the size. But if -- we have two types the same (notably Short_Float_Size = Float_Size -- which is close to universally true, and Long_Long_Float_Size = -- Long_Float_Size, true on most targets except the x86), then we -- would really rather use the root type, so that if people want to -- fiddle with System.Stream_Attributes to get inter-target portable -- streams, they get the size they expect. Consider in particular the -- case of a stream written on an x86, with 96-bit Long_Long_Float -- being read into a non-x86 target with 64 bit Long_Long_Float. A -- special version of System.Stream_Attributes can deal with this -- provided the proper type is always used. -- To deal with these two requirements we add the special checks -- on equal sizes and use the root type to distinguish. if P_Size <= Standard_Short_Float_Size and then (Standard_Short_Float_Size /= Standard_Float_Size or else Rt_Type = Standard_Short_Float) then Lib_RE := RE_W_SF; elsif P_Size <= Standard_Float_Size then Lib_RE := RE_W_F; elsif P_Size <= Standard_Long_Float_Size and then (Standard_Long_Float_Size /= Standard_Long_Long_Float_Size or else Rt_Type = Standard_Long_Float) then Lib_RE := RE_W_LF; else Lib_RE := RE_W_LLF; end if; -- Signed integer types. Also includes signed fixed-point types and -- signed enumeration types share this circuitry. -- Note on signed integer types. We do not consider types as signed for -- this purpose if they have no negative numbers, or if they have biased -- representation. The reason is that the value in either case basically -- represents an unsigned value. -- For example, consider: -- type W is range 0 .. 2**32 - 1; -- for W'Size use 32; -- This is a signed type, but the representation is unsigned, and may -- be outside the range of a 32-bit signed integer, so this must be -- treated as 32-bit unsigned. -- Similarly, the representation is also unsigned if we have: -- type W is range -1 .. +254; -- for W'Size use 8; -- forcing a biased and unsigned representation elsif not Is_Unsigned_Type (FST) and then (Is_Fixed_Point_Type (U_Type) or else Is_Enumeration_Type (U_Type) or else (Is_Signed_Integer_Type (U_Type) and then not Has_Biased_Representation (FST))) then if P_Size <= Standard_Short_Short_Integer_Size then Lib_RE := RE_W_SSI; elsif P_Size <= Standard_Short_Integer_Size then Lib_RE := RE_W_SI; elsif P_Size <= Standard_Integer_Size then Lib_RE := RE_W_I; elsif P_Size <= Standard_Long_Integer_Size then Lib_RE := RE_W_LI; else Lib_RE := RE_W_LLI; end if; -- Unsigned integer types, also includes unsigned fixed-point types -- and unsigned enumeration types (note we know they are unsigned -- because we already tested for signed above). -- Also includes signed integer types that are unsigned in the sense -- that they do not include negative numbers. See above for details. elsif Is_Modular_Integer_Type (U_Type) or else Is_Fixed_Point_Type (U_Type) or else Is_Enumeration_Type (U_Type) or else Is_Signed_Integer_Type (U_Type) then if P_Size <= Standard_Short_Short_Integer_Size then Lib_RE := RE_W_SSU; elsif P_Size <= Standard_Short_Integer_Size then Lib_RE := RE_W_SU; elsif P_Size <= Standard_Integer_Size then Lib_RE := RE_W_U; elsif P_Size <= Standard_Long_Integer_Size then Lib_RE := RE_W_LU; else Lib_RE := RE_W_LLU; end if; else pragma Assert (Is_Access_Type (U_Type)); if P_Size > System_Address_Size then Lib_RE := RE_W_AD; else Lib_RE := RE_W_AS; end if; end if; -- Unchecked-convert parameter to the required type (i.e. the type of -- the corresponding parameter, and call the appropriate routine. Libent := RTE (Lib_RE); return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Libent, Loc), Parameter_Associations => New_List ( Relocate_Node (Strm), Unchecked_Convert_To (Etype (Next_Formal (First_Formal (Libent))), Relocate_Node (Item)))); end Build_Elementary_Write_Call; ----------------------------------------- -- Build_Mutable_Record_Read_Procedure -- ----------------------------------------- procedure Build_Mutable_Record_Read_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is Out_Formal : Node_Id; -- Expression denoting the out formal parameter Dcls : constant List_Id := New_List; -- Declarations for the 'Read body Stms : constant List_Id := New_List; -- Statements for the 'Read body Disc : Entity_Id; -- Entity of the discriminant being processed Tmp_For_Disc : Entity_Id; -- Temporary object used to read the value of Disc Tmps_For_Discs : constant List_Id := New_List; -- List of object declarations for temporaries holding the read values -- for the discriminants. Cstr : constant List_Id := New_List; -- List of constraints to be applied on temporary record Discriminant_Checks : constant List_Id := New_List; -- List of discriminant checks to be performed if the actual object -- is constrained. Tmp : constant Entity_Id := Make_Defining_Identifier (Loc, Name_V); -- Temporary record must hide formal (assignments to components of the -- record are always generated with V as the identifier for the record). Constrained_Stms : List_Id := New_List; -- Statements within the block where we have the constrained temporary begin -- A mutable type cannot be a tagged type, so we generate a new name -- for the stream procedure. Pnam := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name_Local (Typ, TSS_Stream_Read)); if Is_Unchecked_Union (Typ) then -- If this is an unchecked union, the stream procedure is erroneous, -- because there are no discriminants to read. -- This should generate a warning ??? Append_To (Stms, Make_Raise_Program_Error (Loc, Reason => PE_Unchecked_Union_Restriction)); Build_Stream_Procedure (Loc, Typ, Decl, Pnam, Stms, Outp => True); return; end if; Disc := First_Discriminant (Typ); Out_Formal := Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Pnam, Loc), Selector_Name => Make_Identifier (Loc, Name_V)); -- Generate Reads for the discriminants of the type. The discriminants -- need to be read before the rest of the components, so that variants -- are initialized correctly. The discriminants must be read into temp -- variables so an incomplete Read (interrupted by an exception, for -- example) does not alter the passed object. while Present (Disc) loop Tmp_For_Disc := Make_Defining_Identifier (Loc, New_External_Name (Chars (Disc), "D")); Append_To (Tmps_For_Discs, Make_Object_Declaration (Loc, Defining_Identifier => Tmp_For_Disc, Object_Definition => New_Occurrence_Of (Etype (Disc), Loc))); Set_No_Initialization (Last (Tmps_For_Discs)); Append_To (Stms, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etype (Disc), Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Identifier (Loc, Name_S), New_Occurrence_Of (Tmp_For_Disc, Loc)))); Append_To (Cstr, Make_Discriminant_Association (Loc, Selector_Names => New_List (New_Occurrence_Of (Disc, Loc)), Expression => New_Occurrence_Of (Tmp_For_Disc, Loc))); Append_To (Discriminant_Checks, Make_Raise_Constraint_Error (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Tmp_For_Disc, Loc), Right_Opnd => Make_Selected_Component (Loc, Prefix => New_Copy_Tree (Out_Formal), Selector_Name => New_Occurrence_Of (Disc, Loc))), Reason => CE_Discriminant_Check_Failed)); Next_Discriminant (Disc); end loop; -- Generate reads for the components of the record (including those -- that depend on discriminants). Build_Record_Read_Write_Procedure (Loc, Typ, Decl, Pnam, Name_Read); -- Save original statement sequence for component assignments, and -- replace it with Stms. Constrained_Stms := Statements (Handled_Statement_Sequence (Decl)); Set_Handled_Statement_Sequence (Decl, Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms)); -- If Typ has controlled components (i.e. if it is classwide or -- Has_Controlled), or components constrained using the discriminants -- of Typ, then we need to ensure that all component assignments are -- performed on an object that has been appropriately constrained -- prior to being initialized. To this effect, we wrap the component -- assignments in a block where V is a constrained temporary. Append_To (Dcls, Make_Object_Declaration (Loc, Defining_Identifier => Tmp, Object_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (Base_Type (Typ), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => Cstr)))); -- AI05-023-1: Insert discriminant check prior to initialization of the -- constrained temporary. Append_To (Stms, Make_Implicit_If_Statement (Pnam, Condition => Make_Attribute_Reference (Loc, Prefix => New_Copy_Tree (Out_Formal), Attribute_Name => Name_Constrained), Then_Statements => Discriminant_Checks)); -- Now insert back original component assignments, wrapped in a block -- in which V is the constrained temporary. Append_To (Stms, Make_Block_Statement (Loc, Declarations => Dcls, Handled_Statement_Sequence => Parent (Constrained_Stms))); Append_To (Constrained_Stms, Make_Assignment_Statement (Loc, Name => Out_Formal, Expression => Make_Identifier (Loc, Name_V))); Set_Declarations (Decl, Tmps_For_Discs); end Build_Mutable_Record_Read_Procedure; ------------------------------------------ -- Build_Mutable_Record_Write_Procedure -- ------------------------------------------ procedure Build_Mutable_Record_Write_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is Stms : List_Id; Disc : Entity_Id; D_Ref : Node_Id; begin Stms := New_List; Disc := First_Discriminant (Typ); -- Generate Writes for the discriminants of the type -- If the type is an unchecked union, use the default values of -- the discriminants, because they are not stored. while Present (Disc) loop if Is_Unchecked_Union (Typ) then D_Ref := New_Copy_Tree (Discriminant_Default_Value (Disc)); else D_Ref := Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Disc, Loc)); end if; Append_To (Stms, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etype (Disc), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Identifier (Loc, Name_S), D_Ref))); Next_Discriminant (Disc); end loop; -- A mutable type cannot be a tagged type, so we generate a new name -- for the stream procedure. Pnam := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name_Local (Typ, TSS_Stream_Write)); Build_Record_Read_Write_Procedure (Loc, Typ, Decl, Pnam, Name_Write); -- Write the discriminants before the rest of the components, so -- that discriminant values are properly set of variants, etc. if Is_Non_Empty_List ( Statements (Handled_Statement_Sequence (Decl))) then Insert_List_Before (First (Statements (Handled_Statement_Sequence (Decl))), Stms); else Set_Statements (Handled_Statement_Sequence (Decl), Stms); end if; end Build_Mutable_Record_Write_Procedure; ----------------------------------------------- -- Build_Record_Or_Elementary_Input_Function -- ----------------------------------------------- -- The function we build looks like -- function InputN (S : access RST) return Typ is -- C1 : constant Disc_Type_1; -- Discr_Type_1'Read (S, C1); -- C2 : constant Disc_Type_2; -- Discr_Type_2'Read (S, C2); -- ... -- Cn : constant Disc_Type_n; -- Discr_Type_n'Read (S, Cn); -- V : Typ (C1, C2, .. Cn) -- begin -- Typ'Read (S, V); -- return V; -- end InputN -- The discriminants are of course only present in the case of a record -- with discriminants. In the case of a record with no discriminants, or -- an elementary type, then no Cn constants are defined. procedure Build_Record_Or_Elementary_Input_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id; Use_Underlying : Boolean := True) is B_Typ : Entity_Id := Base_Type (Typ); Cn : Name_Id; Constr : List_Id; Decls : List_Id; Discr : Entity_Id; Discr_Elmt : Elmt_Id := No_Elmt; J : Pos; Obj_Decl : Node_Id; Odef : Node_Id; Stms : List_Id; begin if Use_Underlying then B_Typ := Underlying_Type (B_Typ); end if; Decls := New_List; Constr := New_List; J := 1; -- In the presence of multiple instantiations (as in uses of the Booch -- components) the base type may be private, and the underlying type -- already constrained, in which case there's no discriminant constraint -- to construct. if Has_Discriminants (Typ) and then No (Discriminant_Default_Value (First_Discriminant (Typ))) and then not Is_Constrained (Underlying_Type (B_Typ)) then Discr := First_Discriminant (B_Typ); -- If the prefix subtype is constrained, then retrieve the first -- element of its constraint. if Is_Constrained (Typ) then Discr_Elmt := First_Elmt (Discriminant_Constraint (Typ)); end if; while Present (Discr) loop Cn := New_External_Name ('C', J); Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Cn), Object_Definition => New_Occurrence_Of (Etype (Discr), Loc)); -- If this is an access discriminant, do not perform default -- initialization. The discriminant is about to get its value -- from Read, and if the type is null excluding we do not want -- spurious warnings on an initial null value. if Is_Access_Type (Etype (Discr)) then Set_No_Initialization (Decl); end if; Append_To (Decls, Decl); Append_To (Decls, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etype (Discr), Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Identifier (Loc, Cn)))); Append_To (Constr, Make_Identifier (Loc, Cn)); -- If the prefix subtype imposes a discriminant constraint, then -- check that each discriminant value equals the value read. if Present (Discr_Elmt) then Append_To (Decls, Make_Raise_Constraint_Error (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Defining_Identifier (Decl), Loc), Right_Opnd => New_Copy_Tree (Node (Discr_Elmt))), Reason => CE_Discriminant_Check_Failed)); Next_Elmt (Discr_Elmt); end if; Next_Discriminant (Discr); J := J + 1; end loop; Odef := Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (B_Typ, Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => Constr)); -- If no discriminants, then just use the type with no constraint else Odef := New_Occurrence_Of (B_Typ, Loc); end if; -- Create an extended return statement encapsulating the result object -- and 'Read call, which is needed in general for proper handling of -- build-in-place results (such as when the result type is inherently -- limited). Obj_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_V), Object_Definition => Odef); -- If the type is an access type, do not perform default initialization. -- The object is about to get its value from Read, and if the type is -- null excluding we do not want spurious warnings on an initial null. if Is_Access_Type (B_Typ) then Set_No_Initialization (Obj_Decl); end if; Stms := New_List ( Make_Extended_Return_Statement (Loc, Return_Object_Declarations => New_List (Obj_Decl), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (B_Typ, Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Identifier (Loc, Name_V))))))); Fnam := Make_Stream_Subprogram_Name (Loc, B_Typ, TSS_Stream_Input); Build_Stream_Function (Loc, B_Typ, Decl, Fnam, Decls, Stms); end Build_Record_Or_Elementary_Input_Function; ------------------------------------------------- -- Build_Record_Or_Elementary_Output_Procedure -- ------------------------------------------------- procedure Build_Record_Or_Elementary_Output_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is Stms : List_Id; Disc : Entity_Id; Disc_Ref : Node_Id; begin Stms := New_List; -- Note that of course there will be no discriminants for the elementary -- type case, so Has_Discriminants will be False. Note that the language -- rules do not allow writing the discriminants in the defaulted case, -- because those are written by 'Write. if Has_Discriminants (Typ) and then No (Discriminant_Default_Value (First_Discriminant (Typ))) then Disc := First_Discriminant (Typ); while Present (Disc) loop -- If the type is an unchecked union, it must have default -- discriminants (this is checked earlier), and those defaults -- are written out to the stream. if Is_Unchecked_Union (Typ) then Disc_Ref := New_Copy_Tree (Discriminant_Default_Value (Disc)); else Disc_Ref := Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Disc, Loc)); end if; Append_To (Stms, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Base_Type (Etype (Disc)), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Identifier (Loc, Name_S), Disc_Ref))); Next_Discriminant (Disc); end loop; end if; Append_To (Stms, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Typ, Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Identifier (Loc, Name_V)))); Pnam := Make_Stream_Subprogram_Name (Loc, Typ, TSS_Stream_Output); Build_Stream_Procedure (Loc, Typ, Decl, Pnam, Stms, False); end Build_Record_Or_Elementary_Output_Procedure; --------------------------------- -- Build_Record_Read_Procedure -- --------------------------------- procedure Build_Record_Read_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is begin Pnam := Make_Stream_Subprogram_Name (Loc, Typ, TSS_Stream_Read); Build_Record_Read_Write_Procedure (Loc, Typ, Decl, Pnam, Name_Read); end Build_Record_Read_Procedure; --------------------------------------- -- Build_Record_Read_Write_Procedure -- --------------------------------------- -- The form of the record read/write procedure is as shown by the -- following example for a case with one discriminant case variant: -- procedure pnam (S : access RST, V : [out] Typ) is -- begin -- Component_Type'Read/Write (S, V.component); -- Component_Type'Read/Write (S, V.component); -- ... -- Component_Type'Read/Write (S, V.component); -- -- case V.discriminant is -- when choices => -- Component_Type'Read/Write (S, V.component); -- Component_Type'Read/Write (S, V.component); -- ... -- Component_Type'Read/Write (S, V.component); -- -- when choices => -- Component_Type'Read/Write (S, V.component); -- Component_Type'Read/Write (S, V.component); -- ... -- Component_Type'Read/Write (S, V.component); -- ... -- end case; -- end pnam; -- The out keyword for V is supplied in the Read case procedure Build_Record_Read_Write_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : Entity_Id; Nam : Name_Id) is Rdef : Node_Id; Stms : List_Id; Typt : Entity_Id; In_Limited_Extension : Boolean := False; -- Set to True while processing the record extension definition -- for an extension of a limited type (for which an ancestor type -- has an explicit Nam attribute definition). function Make_Component_List_Attributes (CL : Node_Id) return List_Id; -- Returns a sequence of attributes to process the components that -- are referenced in the given component list. function Make_Field_Attribute (C : Entity_Id) return Node_Id; -- Given C, the entity for a discriminant or component, build -- an attribute for the corresponding field values. function Make_Field_Attributes (Clist : List_Id) return List_Id; -- Given Clist, a component items list, construct series of attributes -- for fieldwise processing of the corresponding components. ------------------------------------ -- Make_Component_List_Attributes -- ------------------------------------ function Make_Component_List_Attributes (CL : Node_Id) return List_Id is CI : constant List_Id := Component_Items (CL); VP : constant Node_Id := Variant_Part (CL); Result : List_Id; Alts : List_Id; V : Node_Id; DC : Node_Id; DCH : List_Id; D_Ref : Node_Id; begin Result := Make_Field_Attributes (CI); if Present (VP) then Alts := New_List; V := First_Non_Pragma (Variants (VP)); while Present (V) loop DCH := New_List; DC := First (Discrete_Choices (V)); while Present (DC) loop Append_To (DCH, New_Copy_Tree (DC)); Next (DC); end loop; Append_To (Alts, Make_Case_Statement_Alternative (Loc, Discrete_Choices => DCH, Statements => Make_Component_List_Attributes (Component_List (V)))); Next_Non_Pragma (V); end loop; -- Note: in the following, we make sure that we use new occurrence -- of for the selector, since there are cases in which we make a -- reference to a hidden discriminant that is not visible. -- If the enclosing record is an unchecked_union, we use the -- default expressions for the discriminant (it must exist) -- because we cannot generate a reference to it, given that -- it is not stored. if Is_Unchecked_Union (Scope (Entity (Name (VP)))) then D_Ref := New_Copy_Tree (Discriminant_Default_Value (Entity (Name (VP)))); else D_Ref := Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (Entity (Name (VP)), Loc)); end if; Append_To (Result, Make_Case_Statement (Loc, Expression => D_Ref, Alternatives => Alts)); end if; return Result; end Make_Component_List_Attributes; -------------------------- -- Make_Field_Attribute -- -------------------------- function Make_Field_Attribute (C : Entity_Id) return Node_Id is Field_Typ : constant Entity_Id := Stream_Base_Type (Etype (C)); TSS_Names : constant array (Name_Input .. Name_Write) of TSS_Name_Type := (Name_Read => TSS_Stream_Read, Name_Write => TSS_Stream_Write, Name_Input => TSS_Stream_Input, Name_Output => TSS_Stream_Output, others => TSS_Null); pragma Assert (TSS_Names (Nam) /= TSS_Null); begin if In_Limited_Extension and then Is_Limited_Type (Field_Typ) and then No (Find_Inherited_TSS (Field_Typ, TSS_Names (Nam))) then -- The declaration is illegal per 13.13.2(9/1), and this is -- enforced in Exp_Ch3.Check_Stream_Attributes. Keep the caller -- happy by returning a null statement. return Make_Null_Statement (Loc); end if; return Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Field_Typ, Loc), Attribute_Name => Nam, Expressions => New_List ( Make_Identifier (Loc, Name_S), Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Name_V), Selector_Name => New_Occurrence_Of (C, Loc)))); end Make_Field_Attribute; --------------------------- -- Make_Field_Attributes -- --------------------------- function Make_Field_Attributes (Clist : List_Id) return List_Id is Item : Node_Id; Result : List_Id; begin Result := New_List; if Present (Clist) then Item := First (Clist); -- Loop through components, skipping all internal components, -- which are not part of the value (e.g. _Tag), except that we -- don't skip the _Parent, since we do want to process that -- recursively. If _Parent is an interface type, being abstract -- with no components there is no need to handle it. while Present (Item) loop if Nkind (Item) = N_Component_Declaration and then ((Chars (Defining_Identifier (Item)) = Name_uParent and then not Is_Interface (Etype (Defining_Identifier (Item)))) or else not Is_Internal_Name (Chars (Defining_Identifier (Item)))) then Append_To (Result, Make_Field_Attribute (Defining_Identifier (Item))); end if; Next (Item); end loop; end if; return Result; end Make_Field_Attributes; -- Start of processing for Build_Record_Read_Write_Procedure begin -- For the protected type case, use corresponding record if Is_Protected_Type (Typ) then Typt := Corresponding_Record_Type (Typ); else Typt := Typ; end if; -- Note that we do nothing with the discriminants, since Read and -- Write do not read or write the discriminant values. All handling -- of discriminants occurs in the Input and Output subprograms. Rdef := Type_Definition (Declaration_Node (Base_Type (Underlying_Type (Typt)))); Stms := Empty_List; -- In record extension case, the fields we want, including the _Parent -- field representing the parent type, are to be found in the extension. -- Note that we will naturally process the _Parent field using the type -- of the parent, and hence its stream attributes, which is appropriate. if Nkind (Rdef) = N_Derived_Type_Definition then Rdef := Record_Extension_Part (Rdef); if Is_Limited_Type (Typt) then In_Limited_Extension := True; end if; end if; if Present (Component_List (Rdef)) then Append_List_To (Stms, Make_Component_List_Attributes (Component_List (Rdef))); end if; Build_Stream_Procedure (Loc, Typ, Decl, Pnam, Stms, Nam = Name_Read); end Build_Record_Read_Write_Procedure; ---------------------------------- -- Build_Record_Write_Procedure -- ---------------------------------- procedure Build_Record_Write_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : out Entity_Id) is begin Pnam := Make_Stream_Subprogram_Name (Loc, Typ, TSS_Stream_Write); Build_Record_Read_Write_Procedure (Loc, Typ, Decl, Pnam, Name_Write); end Build_Record_Write_Procedure; ------------------------------- -- Build_Stream_Attr_Profile -- ------------------------------- function Build_Stream_Attr_Profile (Loc : Source_Ptr; Typ : Entity_Id; Nam : TSS_Name_Type) return List_Id is Profile : List_Id; begin -- (Ada 2005: AI-441): Set the null-excluding attribute because it has -- no semantic meaning in Ada 95 but it is a requirement in Ada 2005. Profile := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_S), Parameter_Type => Make_Access_Definition (Loc, Null_Exclusion_Present => True, Subtype_Mark => New_Occurrence_Of ( Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc)))); if Nam /= TSS_Stream_Input then Append_To (Profile, Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_V), Out_Present => (Nam = TSS_Stream_Read), Parameter_Type => New_Occurrence_Of (Typ, Loc))); end if; return Profile; end Build_Stream_Attr_Profile; --------------------------- -- Build_Stream_Function -- --------------------------- procedure Build_Stream_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : Entity_Id; Decls : List_Id; Stms : List_Id) is Spec : Node_Id; begin -- Construct function specification -- (Ada 2005: AI-441): Set the null-excluding attribute because it has -- no semantic meaning in Ada 95 but it is a requirement in Ada 2005. Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_S), Parameter_Type => Make_Access_Definition (Loc, Null_Exclusion_Present => True, Subtype_Mark => New_Occurrence_Of (Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc)))), Result_Definition => New_Occurrence_Of (Typ, Loc)); Decl := Make_Subprogram_Body (Loc, Specification => Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms)); end Build_Stream_Function; ---------------------------- -- Build_Stream_Procedure -- ---------------------------- procedure Build_Stream_Procedure (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Pnam : Entity_Id; Stms : List_Id; Outp : Boolean) is Spec : Node_Id; begin -- Construct procedure specification -- (Ada 2005: AI-441): Set the null-excluding attribute because it has -- no semantic meaning in Ada 95 but it is a requirement in Ada 2005. Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => Pnam, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_S), Parameter_Type => Make_Access_Definition (Loc, Null_Exclusion_Present => True, Subtype_Mark => New_Occurrence_Of (Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc))), Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_V), Out_Present => Outp, Parameter_Type => New_Occurrence_Of (Typ, Loc)))); Decl := Make_Subprogram_Body (Loc, Specification => Spec, Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms)); end Build_Stream_Procedure; ----------------------------- -- Has_Stream_Standard_Rep -- ----------------------------- function Has_Stream_Standard_Rep (U_Type : Entity_Id) return Boolean is Siz : Uint; begin if Has_Non_Standard_Rep (U_Type) then return False; end if; if Has_Stream_Size_Clause (U_Type) then Siz := Static_Integer (Expression (Stream_Size_Clause (U_Type))); else Siz := Esize (First_Subtype (U_Type)); end if; return Siz = Esize (Root_Type (U_Type)); end Has_Stream_Standard_Rep; --------------------------------- -- Make_Stream_Subprogram_Name -- --------------------------------- function Make_Stream_Subprogram_Name (Loc : Source_Ptr; Typ : Entity_Id; Nam : TSS_Name_Type) return Entity_Id is Sname : Name_Id; begin -- For tagged types, we are dealing with a TSS associated with the -- declaration, so we use the standard primitive function name. For -- other types, generate a local TSS name since we are generating -- the subprogram at the point of use. if Is_Tagged_Type (Typ) then Sname := Make_TSS_Name (Typ, Nam); else Sname := Make_TSS_Name_Local (Typ, Nam); end if; return Make_Defining_Identifier (Loc, Sname); end Make_Stream_Subprogram_Name; ---------------------- -- Stream_Base_Type -- ---------------------- function Stream_Base_Type (E : Entity_Id) return Entity_Id is begin if Is_Array_Type (E) and then Is_First_Subtype (E) then return E; else return Base_Type (E); end if; end Stream_Base_Type; end Exp_Strm;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- M L I B . T G T . S P E C I F I C -- -- (Solaris Version) -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2008, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the Solaris version of the body with MLib.Fil; with MLib.Utl; with Opt; with Output; use Output; package body MLib.Tgt.Specific is -- Non default subprograms procedure Build_Dynamic_Library (Ofiles : Argument_List; Options : Argument_List; Interfaces : Argument_List; Lib_Filename : String; Lib_Dir : String; Symbol_Data : Symbol_Record; Driver_Name : Name_Id := No_Name; Lib_Version : String := ""; Auto_Init : Boolean := False); function Is_Archive_Ext (Ext : String) return Boolean; --------------------------- -- Build_Dynamic_Library -- --------------------------- procedure Build_Dynamic_Library (Ofiles : Argument_List; Options : Argument_List; Interfaces : Argument_List; Lib_Filename : String; Lib_Dir : String; Symbol_Data : Symbol_Record; Driver_Name : Name_Id := No_Name; Lib_Version : String := ""; Auto_Init : Boolean := False) is pragma Unreferenced (Interfaces); pragma Unreferenced (Symbol_Data); pragma Unreferenced (Auto_Init); Lib_File : constant String := "lib" & Fil.Append_To (Lib_Filename, DLL_Ext); Lib_Path : constant String := Lib_Dir & Directory_Separator & Lib_File; Version_Arg : String_Access; Symbolic_Link_Needed : Boolean := False; begin if Opt.Verbose_Mode then Write_Str ("building relocatable shared library "); Write_Line (Lib_Path); end if; if Lib_Version = "" then Utl.Gcc (Output_File => Lib_Path, Objects => Ofiles, Options => Options, Options_2 => No_Argument_List, Driver_Name => Driver_Name); else declare Maj_Version : constant String := Major_Id_Name (Lib_File, Lib_Version); begin if Maj_Version'Length /= 0 then Version_Arg := new String'("-Wl,-h," & Maj_Version); else Version_Arg := new String'("-Wl,-h," & Lib_Version); end if; if Is_Absolute_Path (Lib_Version) then Utl.Gcc (Output_File => Lib_Version, Objects => Ofiles, Options => Options & Version_Arg, Options_2 => No_Argument_List, Driver_Name => Driver_Name); Symbolic_Link_Needed := Lib_Version /= Lib_Path; else Utl.Gcc (Output_File => Lib_Dir & Directory_Separator & Lib_Version, Objects => Ofiles, Options => Options & Version_Arg, Options_2 => No_Argument_List, Driver_Name => Driver_Name); Symbolic_Link_Needed := Lib_Dir & Directory_Separator & Lib_Version /= Lib_Path; end if; if Symbolic_Link_Needed then Create_Sym_Links (Lib_Path, Lib_Version, Lib_Dir, Maj_Version); end if; end; end if; end Build_Dynamic_Library; -------------------- -- Is_Archive_Ext -- -------------------- function Is_Archive_Ext (Ext : String) return Boolean is begin return Ext = ".a" or else Ext = ".so"; end Is_Archive_Ext; begin Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access; Is_Archive_Ext_Ptr := Is_Archive_Ext'Access; end MLib.Tgt.Specific;
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; -- with Pixtend.arm_linux_gnueabihf_bits_stdint_uintn_h; package Pixtend.pixtend_h is type pixtOut is record byDigOut : aliased unsigned_char; -- pixtend.h:36 byRelayOut : aliased unsigned_char; -- pixtend.h:37 byGpioOut : aliased unsigned_char; -- pixtend.h:38 wPwm0 : aliased unsigned_short; -- pixtend.h:39 wPwm1 : aliased unsigned_short; -- pixtend.h:40 byPwm0Ctrl0 : aliased unsigned_char; -- pixtend.h:41 byPwm0Ctrl1 : aliased unsigned_char; -- pixtend.h:42 byPwm0Ctrl2 : aliased unsigned_char; -- pixtend.h:43 byGpioCtrl : aliased unsigned_char; -- pixtend.h:44 byUcCtrl : aliased unsigned_char; -- pixtend.h:45 byAiCtrl0 : aliased unsigned_char; -- pixtend.h:46 byAiCtrl1 : aliased unsigned_char; -- pixtend.h:47 byPiStatus : aliased unsigned_char; -- pixtend.h:48 byAux0 : aliased unsigned_char; -- pixtend.h:49 end record with Convention => C_Pass_By_Copy; -- pixtend.h:35 type anon1799_array1800 is array (0 .. 31) of aliased unsigned_char; type pixtOutV2S is record byModelOut : aliased unsigned_char; -- pixtend.h:53 byUCMode : aliased unsigned_char; -- pixtend.h:54 byUCCtrl0 : aliased unsigned_char; -- pixtend.h:55 byUCCtrl1 : aliased unsigned_char; -- pixtend.h:56 byDigitalInDebounce01 : aliased unsigned_char; -- pixtend.h:57 byDigitalInDebounce23 : aliased unsigned_char; -- pixtend.h:58 byDigitalInDebounce45 : aliased unsigned_char; -- pixtend.h:59 byDigitalInDebounce67 : aliased unsigned_char; -- pixtend.h:60 byDigitalOut : aliased unsigned_char; -- pixtend.h:61 byRelayOut : aliased unsigned_char; -- pixtend.h:62 byGPIOCtrl : aliased unsigned_char; -- pixtend.h:63 byGPIOOut : aliased unsigned_char; -- pixtend.h:64 byGPIODebounce01 : aliased unsigned_char; -- pixtend.h:65 byGPIODebounce23 : aliased unsigned_char; -- pixtend.h:66 byPWM0Ctrl0 : aliased unsigned_char; -- pixtend.h:67 wPWM0Ctrl1 : aliased unsigned_short; -- pixtend.h:68 wPWM0A : aliased unsigned_short; -- pixtend.h:69 wPWM0B : aliased unsigned_short; -- pixtend.h:70 byPWM1Ctrl0 : aliased unsigned_char; -- pixtend.h:71 byPWM1Ctrl1 : aliased unsigned_char; -- pixtend.h:72 byPWM1A : aliased unsigned_char; -- pixtend.h:73 byPWM1B : aliased unsigned_char; -- pixtend.h:74 byJumper10V : aliased unsigned_char; -- pixtend.h:75 byGPIO0Dht11 : aliased unsigned_char; -- pixtend.h:76 byGPIO1Dht11 : aliased unsigned_char; -- pixtend.h:77 byGPIO2Dht11 : aliased unsigned_char; -- pixtend.h:78 byGPIO3Dht11 : aliased unsigned_char; -- pixtend.h:79 abyRetainDataOut : aliased anon1799_array1800; -- pixtend.h:80 end record with Convention => C_Pass_By_Copy; -- pixtend.h:52 type anon1802_array1804 is array (0 .. 63) of aliased unsigned_char; type pixtOutV2L is record byModelOut : aliased unsigned_char; -- pixtend.h:84 byUCMode : aliased unsigned_char; -- pixtend.h:85 byUCCtrl0 : aliased unsigned_char; -- pixtend.h:86 byUCCtrl1 : aliased unsigned_char; -- pixtend.h:87 byDigitalInDebounce01 : aliased unsigned_char; -- pixtend.h:88 byDigitalInDebounce23 : aliased unsigned_char; -- pixtend.h:89 byDigitalInDebounce45 : aliased unsigned_char; -- pixtend.h:90 byDigitalInDebounce67 : aliased unsigned_char; -- pixtend.h:91 byDigitalInDebounce89 : aliased unsigned_char; -- pixtend.h:92 byDigitalInDebounce1011 : aliased unsigned_char; -- pixtend.h:93 byDigitalInDebounce1213 : aliased unsigned_char; -- pixtend.h:94 byDigitalInDebounce1415 : aliased unsigned_char; -- pixtend.h:95 byDigitalOut0 : aliased unsigned_char; -- pixtend.h:96 byDigitalOut1 : aliased unsigned_char; -- pixtend.h:97 byRelayOut : aliased unsigned_char; -- pixtend.h:98 byGPIOCtrl : aliased unsigned_char; -- pixtend.h:99 byGPIOOut : aliased unsigned_char; -- pixtend.h:100 byGPIODebounce01 : aliased unsigned_char; -- pixtend.h:101 byGPIODebounce23 : aliased unsigned_char; -- pixtend.h:102 byPWM0Ctrl0 : aliased unsigned_char; -- pixtend.h:103 wPWM0Ctrl1 : aliased unsigned_short; -- pixtend.h:104 wPWM0A : aliased unsigned_short; -- pixtend.h:105 wPWM0B : aliased unsigned_short; -- pixtend.h:106 byPWM1Ctrl0 : aliased unsigned_char; -- pixtend.h:107 wPWM1Ctrl1 : aliased unsigned_short; -- pixtend.h:108 wPWM1A : aliased unsigned_short; -- pixtend.h:109 wPWM1B : aliased unsigned_short; -- pixtend.h:110 byPWM2Ctrl0 : aliased unsigned_char; -- pixtend.h:111 wPWM2Ctrl1 : aliased unsigned_short; -- pixtend.h:112 wPWM2A : aliased unsigned_short; -- pixtend.h:113 wPWM2B : aliased unsigned_short; -- pixtend.h:114 byJumper10V : aliased unsigned_char; -- pixtend.h:115 byGPIO0Dht11 : aliased unsigned_char; -- pixtend.h:116 byGPIO1Dht11 : aliased unsigned_char; -- pixtend.h:117 byGPIO2Dht11 : aliased unsigned_char; -- pixtend.h:118 byGPIO3Dht11 : aliased unsigned_char; -- pixtend.h:119 abyRetainDataOut : aliased anon1802_array1804; -- pixtend.h:120 end record with Convention => C_Pass_By_Copy; -- pixtend.h:83 type pixtOutDAC is record wAOut0 : aliased unsigned_short; -- pixtend.h:124 wAOut1 : aliased unsigned_short; -- pixtend.h:125 end record with Convention => C_Pass_By_Copy; -- pixtend.h:123 type pixtIn is record byDigIn : aliased unsigned_char; -- pixtend.h:129 wAi0 : aliased unsigned_short; -- pixtend.h:130 wAi1 : aliased unsigned_short; -- pixtend.h:131 wAi2 : aliased unsigned_short; -- pixtend.h:132 wAi3 : aliased unsigned_short; -- pixtend.h:133 byGpioIn : aliased unsigned_char; -- pixtend.h:134 wTemp0 : aliased unsigned_short; -- pixtend.h:135 wTemp1 : aliased unsigned_short; -- pixtend.h:136 wTemp2 : aliased unsigned_short; -- pixtend.h:137 wTemp3 : aliased unsigned_short; -- pixtend.h:138 wHumid0 : aliased unsigned_short; -- pixtend.h:139 wHumid1 : aliased unsigned_short; -- pixtend.h:140 wHumid2 : aliased unsigned_short; -- pixtend.h:141 wHumid3 : aliased unsigned_short; -- pixtend.h:142 byUcVersionL : aliased unsigned_char; -- pixtend.h:143 byUcVersionH : aliased unsigned_char; -- pixtend.h:144 byUcStatus : aliased unsigned_char; -- pixtend.h:145 rAi0 : aliased float; -- pixtend.h:146 rAi1 : aliased float; -- pixtend.h:147 rAi2 : aliased float; -- pixtend.h:148 rAi3 : aliased float; -- pixtend.h:149 rTemp0 : aliased float; -- pixtend.h:150 rTemp1 : aliased float; -- pixtend.h:151 rTemp2 : aliased float; -- pixtend.h:152 rTemp3 : aliased float; -- pixtend.h:153 rHumid0 : aliased float; -- pixtend.h:154 rHumid1 : aliased float; -- pixtend.h:155 rHumid2 : aliased float; -- pixtend.h:156 rHumid3 : aliased float; -- pixtend.h:157 end record with Convention => C_Pass_By_Copy; -- pixtend.h:128 type anon1808_array1800 is array (0 .. 31) of aliased unsigned_char; type pixtInV2S is record byFirmware : aliased unsigned_char; -- pixtend.h:161 byHardware : aliased unsigned_char; -- pixtend.h:162 byModelIn : aliased unsigned_char; -- pixtend.h:163 byUCState : aliased unsigned_char; -- pixtend.h:164 byUCWarnings : aliased unsigned_char; -- pixtend.h:165 byDigitalIn : aliased unsigned_char; -- pixtend.h:166 wAnalogIn0 : aliased unsigned_short; -- pixtend.h:167 wAnalogIn1 : aliased unsigned_short; -- pixtend.h:168 byGPIOIn : aliased unsigned_char; -- pixtend.h:169 wTemp0 : aliased unsigned_short; -- pixtend.h:170 byTemp0Error : aliased unsigned_char; -- pixtend.h:171 wTemp1 : aliased unsigned_short; -- pixtend.h:172 byTemp1Error : aliased unsigned_char; -- pixtend.h:173 wTemp2 : aliased unsigned_short; -- pixtend.h:174 byTemp2Error : aliased unsigned_char; -- pixtend.h:175 wTemp3 : aliased unsigned_short; -- pixtend.h:176 byTemp3Error : aliased unsigned_char; -- pixtend.h:177 wHumid0 : aliased unsigned_short; -- pixtend.h:178 wHumid1 : aliased unsigned_short; -- pixtend.h:179 wHumid2 : aliased unsigned_short; -- pixtend.h:180 wHumid3 : aliased unsigned_short; -- pixtend.h:181 rAnalogIn0 : aliased float; -- pixtend.h:182 rAnalogIn1 : aliased float; -- pixtend.h:183 rTemp0 : aliased float; -- pixtend.h:184 rTemp1 : aliased float; -- pixtend.h:185 rTemp2 : aliased float; -- pixtend.h:186 rTemp3 : aliased float; -- pixtend.h:187 rHumid0 : aliased float; -- pixtend.h:188 rHumid1 : aliased float; -- pixtend.h:189 rHumid2 : aliased float; -- pixtend.h:190 rHumid3 : aliased float; -- pixtend.h:191 abyRetainDataIn : aliased anon1808_array1800; -- pixtend.h:192 end record with Convention => C_Pass_By_Copy; -- pixtend.h:160 type anon1809_array1804 is array (0 .. 63) of aliased unsigned_char; type pixtInV2L is record byFirmware : aliased unsigned_char; -- pixtend.h:196 byHardware : aliased unsigned_char; -- pixtend.h:197 byModelIn : aliased unsigned_char; -- pixtend.h:198 byUCState : aliased unsigned_char; -- pixtend.h:199 byUCWarnings : aliased unsigned_char; -- pixtend.h:200 byDigitalIn0 : aliased unsigned_char; -- pixtend.h:201 byDigitalIn1 : aliased unsigned_char; -- pixtend.h:202 wAnalogIn0 : aliased unsigned_short; -- pixtend.h:203 wAnalogIn1 : aliased unsigned_short; -- pixtend.h:204 wAnalogIn2 : aliased unsigned_short; -- pixtend.h:205 wAnalogIn3 : aliased unsigned_short; -- pixtend.h:206 wAnalogIn4 : aliased unsigned_short; -- pixtend.h:207 wAnalogIn5 : aliased unsigned_short; -- pixtend.h:208 byGPIOIn : aliased unsigned_char; -- pixtend.h:209 wTemp0 : aliased unsigned_short; -- pixtend.h:210 byTemp0Error : aliased unsigned_char; -- pixtend.h:211 wTemp1 : aliased unsigned_short; -- pixtend.h:212 byTemp1Error : aliased unsigned_char; -- pixtend.h:213 wTemp2 : aliased unsigned_short; -- pixtend.h:214 byTemp2Error : aliased unsigned_char; -- pixtend.h:215 wTemp3 : aliased unsigned_short; -- pixtend.h:216 byTemp3Error : aliased unsigned_char; -- pixtend.h:217 wHumid0 : aliased unsigned_short; -- pixtend.h:218 wHumid1 : aliased unsigned_short; -- pixtend.h:219 wHumid2 : aliased unsigned_short; -- pixtend.h:220 wHumid3 : aliased unsigned_short; -- pixtend.h:221 rAnalogIn0 : aliased float; -- pixtend.h:222 rAnalogIn1 : aliased float; -- pixtend.h:223 rAnalogIn2 : aliased float; -- pixtend.h:224 rAnalogIn3 : aliased float; -- pixtend.h:225 rAnalogIn4 : aliased float; -- pixtend.h:226 rAnalogIn5 : aliased float; -- pixtend.h:227 rTemp0 : aliased float; -- pixtend.h:228 rTemp1 : aliased float; -- pixtend.h:229 rTemp2 : aliased float; -- pixtend.h:230 rTemp3 : aliased float; -- pixtend.h:231 rHumid0 : aliased float; -- pixtend.h:232 rHumid1 : aliased float; -- pixtend.h:233 rHumid2 : aliased float; -- pixtend.h:234 rHumid3 : aliased float; -- pixtend.h:235 abyRetainDataIn : aliased anon1809_array1804; -- pixtend.h:236 end record with Convention => C_Pass_By_Copy; -- pixtend.h:195 function crc16_calc (crc : unsigned_short; data : unsigned_char) return unsigned_short -- pixtend.h:239 with Import => True, Convention => C, External_Name => "crc16_calc"; function Spi_AutoMode (OutputData : access pixtOut; InputData : access pixtIn) return int -- pixtend.h:240 with Import => True, Convention => C, External_Name => "Spi_AutoMode"; function Spi_AutoModeV2S (OutputData : access pixtOutV2S; InputData : access pixtInV2S) return int -- pixtend.h:241 with Import => True, Convention => C, External_Name => "Spi_AutoModeV2S"; function Spi_AutoModeV2L (OutputData : access pixtOutV2L; InputData : access pixtInV2L) return int -- pixtend.h:242 with Import => True, Convention => C, External_Name => "Spi_AutoModeV2L"; function Spi_AutoModeDAC (OutputDataDAC : access pixtOutDAC) return int -- pixtend.h:243 with Import => True, Convention => C, External_Name => "Spi_AutoModeDAC"; function Spi_Set_Dout (value : int) return int -- pixtend.h:244 with Import => True, Convention => C, External_Name => "Spi_Set_Dout"; function Spi_Get_Dout return unsigned_char -- pixtend.h:245 with Import => True, Convention => C, External_Name => "Spi_Get_Dout"; function Spi_Get_Din return int -- pixtend.h:246 with Import => True, Convention => C, External_Name => "Spi_Get_Din"; function Spi_Get_Ain (Idx : int) return unsigned_short -- pixtend.h:247 with Import => True, Convention => C, External_Name => "Spi_Get_Ain"; function Spi_Set_Aout (channel : int; value : unsigned_short) return int -- pixtend.h:248 with Import => True, Convention => C, External_Name => "Spi_Set_Aout"; function Spi_Set_Relays (value : int) return int -- pixtend.h:249 with Import => True, Convention => C, External_Name => "Spi_Set_Relays"; function Spi_Get_Relays return unsigned_char -- pixtend.h:250 with Import => True, Convention => C, External_Name => "Spi_Get_Relays"; function Spi_Get_Temp (Idx : int) return unsigned_short -- pixtend.h:251 with Import => True, Convention => C, External_Name => "Spi_Get_Temp"; function Spi_Get_Hum (Idx : int) return unsigned_short -- pixtend.h:252 with Import => True, Convention => C, External_Name => "Spi_Get_Hum"; function Spi_Set_Servo (channel : int; value : int) return int -- pixtend.h:253 with Import => True, Convention => C, External_Name => "Spi_Set_Servo"; function Spi_Set_Pwm (channel : int; value : unsigned_short) return int -- pixtend.h:254 with Import => True, Convention => C, External_Name => "Spi_Set_Pwm"; function Spi_Set_PwmControl (value0 : int; value1 : int; value2 : int) return int -- pixtend.h:255 with Import => True, Convention => C, External_Name => "Spi_Set_PwmControl"; function Spi_Set_GpioControl (value : int) return int -- pixtend.h:256 with Import => True, Convention => C, External_Name => "Spi_Set_GpioControl"; function Spi_Set_UcControl (value : int) return int -- pixtend.h:257 with Import => True, Convention => C, External_Name => "Spi_Set_UcControl"; function Spi_Set_AiControl (value0 : int; value1 : int) return int -- pixtend.h:258 with Import => True, Convention => C, External_Name => "Spi_Set_AiControl"; function Spi_Set_RaspStat (value : int) return int -- pixtend.h:259 with Import => True, Convention => C, External_Name => "Spi_Set_RaspStat"; function Spi_Setup (spi_device : int) return int -- pixtend.h:260 with Import => True, Convention => C, External_Name => "Spi_Setup"; function Spi_SetupV2 (spi_device : int) return int -- pixtend.h:261 with Import => True, Convention => C, External_Name => "Spi_SetupV2"; function Spi_uC_Reset return int -- pixtend.h:262 with Import => True, Convention => C, External_Name => "Spi_uC_Reset"; function Spi_Get_uC_Status return int -- pixtend.h:263 with Import => True, Convention => C, External_Name => "Spi_Get_uC_Status"; function Spi_Get_uC_Version return unsigned_short -- pixtend.h:264 with Import => True, Convention => C, External_Name => "Spi_Get_uC_Version"; function Change_Gpio_Mode (pin : char; mode : char) return int -- pixtend.h:265 with Import => True, Convention => C, External_Name => "Change_Gpio_Mode"; function Change_Serial_Mode (mode : unsigned_char) return int -- pixtend.h:266 with Import => True, Convention => C, External_Name => "Change_Serial_Mode"; function Spi_Set_Gpio (value : int) return int -- pixtend.h:267 with Import => True, Convention => C, External_Name => "Spi_Set_Gpio"; function Spi_Get_Gpio return int -- pixtend.h:268 with Import => True, Convention => C, External_Name => "Spi_Get_Gpio"; end Pixtend.pixtend_h;
package Operator_Subprogram_Calls is procedure Test; procedure Test2; end Operator_Subprogram_Calls;
with ada.calendar; with gnat.calendar.time_io; procedure HackingDate is begin gnat.calendar.time_io.put_time(ada.calendar.clock, "%Y-%m-%d"); end HackingDate;
with DDS.ReadCondition; with DDS.Request_Reply.impl; package DDS.Request_Reply.Requester.Impl is type Ref is abstract limited new DDS.Request_Reply.impl.ref and DDS.Request_Reply.Requester.Ref with private; type Ref_Access is access all Ref'Class; function Get_Request_Data_Writer (Self : not null access Ref) return DDS.DataWriter.Ref_Access; function Get_Reply_Data_Reader (Self : not null access Ref) return DDS.DataReader.Ref_Access; function Touch_Samples (Self : not null access Ref; Max_Count : DDS.Integer; Read_Condition : DDS.ReadCondition.Ref_Access) return Integer; function Wait_For_Any_Sample (Self : not null access Ref; Max_Wait : DDS.Duration_T; Min_Sample_Count : DDS.Integer) return DDS.ReturnCode_T; private type Ref is abstract limited new DDS.Request_Reply.impl.ref and DDS.Request_Reply.Requester.Ref with record null; end record; end DDS.Request_Reply.Requester.Impl;
with ada.unchecked_Conversion, ada.unchecked_Deallocation, interfaces.C.Strings, system.Storage_Elements; package body XML.Reader is package C renames Interfaces.C; package S renames Interfaces.C.Strings; type XML_Char is new C.unsigned_short; type XML_Char_Ptr is access all XML_Char; type Char_Ptr_Ptr is access all S.chars_ptr; procedure XML_SetUserData (XML_Parser : in XML_Parser_Ptr; Parser_Ptr : in Parser); pragma Import (C, XML_SetUserData, "XML_SetUserData"); procedure Internal_Start_Handler (My_Parser : in Parser; Name : in S.chars_ptr; AttAdd : in System.Address); pragma Convention (C, Internal_Start_Handler); procedure Internal_Start_Handler (My_Parser : in Parser; Name : in S.chars_ptr; AttAdd : in System.Address) is use S, System, System.Storage_Elements; procedure Free is new ada.Unchecked_Deallocation (Attributes_t, Attributes_view); function To_CP is new ada.unchecked_Conversion (System.Address, Char_Ptr_Ptr); AA_Size : Storage_Offset; the_Attribute_Array : Attributes_view; N_Atts : Natural; Atts : System.Address; begin -- Calculate the size of a single attribute (name or value) pointer. -- AA_Size := S.Chars_Ptr'Size / System.Storage_Unit; -- Count the number of attributes by scanning for a null pointer. -- N_Atts := 0; Atts := AttAdd; while To_CP (Atts).all /= S.Null_Ptr loop N_Atts := N_Atts + 1; Atts := Atts + (AA_Size * 2); end loop; -- Allocate a new attribute array of the correct size. -- the_Attribute_Array := new Attributes_t (1 .. N_Atts); -- Convert the attribute strings to unbounded_String. -- Atts := AttAdd; for Att in 1 .. N_Atts loop the_Attribute_Array (Att).Name := to_unbounded_String (S.Value (To_CP (Atts).all)); Atts := Atts + AA_Size; the_Attribute_Array (Att).Value := to_unbounded_String (S.Value (To_CP (Atts).all)); Atts := Atts + AA_Size; end loop; -- Call the user's handler. -- My_Parser.Start_Handler (to_unbounded_String (S.Value (Name)), the_Attribute_Array); -- Give back the attribute array. -- Free (the_Attribute_Array); end Internal_Start_Handler; procedure Internal_End_Handler (My_Parser : in Parser; Name : in S.chars_ptr); pragma Convention (C, Internal_End_Handler); procedure Internal_End_Handler (My_Parser : in Parser; Name : in S.chars_ptr) is begin My_Parser.End_Handler (to_unbounded_String (S.Value (Name))); end Internal_End_Handler; procedure Internal_CD_Handler (My_Parser : in Parser; Data : in S.chars_ptr; Len : in C.int); pragma Convention (C, Internal_CD_Handler); procedure Internal_CD_Handler (My_Parser : in Parser; Data : in S.chars_ptr; Len : in C.int) is the_Data : constant unbounded_String := to_unbounded_String (S.Value (Data, c.size_t (Len))); begin if the_Data /= "" then My_Parser.CD_Handler (the_Data); end if; end Internal_CD_Handler; function Create_Parser return Parser is function XML_ParserCreate (Encoding: in XML_Char_Ptr) return XML_Parser_Ptr; pragma Import (C, XML_ParserCreate, "XML_ParserCreate"); begin return new Parser_Rec' (XML_ParserCreate (null), null, null, null); end Create_Parser; procedure Set_Element_Handler (The_Parser : in Parser; Start_Handler : in Start_Element_Handler; End_Handler : in End_Element_Handler) is type Internal_Start_Element_Handler is access procedure (My_Parser : in Parser; Name : in S.chars_ptr; AttAdd : in System.Address); pragma Convention (C, Internal_Start_Element_Handler); type Internal_End_Element_Handler is access procedure (My_Parser : in Parser; Name : in S.chars_ptr); pragma Convention (C, Internal_End_Element_Handler); procedure XML_SetElementHandler (XML_Parser : in XML_Parser_Ptr; Start_Handler : in Internal_Start_Element_Handler; End_Handler : in Internal_End_Element_Handler); pragma Import (C, XML_SetElementHandler, "XML_SetElementHandler"); begin XML_SetUserData (The_Parser.XML_Parser, The_Parser); The_Parser.Start_Handler := Start_Handler; The_Parser.End_Handler := End_Handler; XML_SetElementHandler (The_Parser.XML_Parser, Internal_Start_Handler'Access, Internal_End_Handler 'Access); end Set_Element_Handler; procedure Set_Character_Data_Handler (The_Parser : in Parser; CD_Handler : in Character_Data_Handler) is type Internal_Character_Data_Handler is access procedure (My_Parser : in Parser; Data : in S.chars_ptr; Len : in C.int); pragma Convention (C, Internal_Character_Data_Handler); procedure XML_SetCharacterDataHandler (XML_Parser : in XML_Parser_Ptr; CD_Handler : in Internal_Character_Data_Handler); pragma Import (C, XML_SetCharacterDataHandler, "XML_SetCharacterDataHandler"); begin XML_SetUserData (The_Parser.XML_Parser, The_Parser); The_Parser.CD_Handler := CD_Handler; XML_SetCharacterDataHandler (The_Parser.XML_Parser, Internal_CD_Handler'Access); end Set_Character_Data_Handler; procedure Parse (The_Parser : in Parser; XML : in String; Is_Final : in Boolean) is function XML_Parse (XML_Parser : in XML_Parser_Ptr; XML : in S.chars_ptr; Len : in C.int; Is_Final : in C.int) return C.int; pragma Import (C, XML_Parse, "XML_Parse"); use C; XML_STATUS_ERROR : constant C.int := 0; XML_STATUS_OK : constant C.int := 1; Final_Flag : C.int; Status : C.int; XML_Data : S.chars_ptr; begin if Is_Final then Final_Flag := 1; else Final_Flag := 0; end if; XML_Data := S.New_Char_Array (C.To_C (XML)); Status := XML_Parse (The_Parser.XML_Parser, XML_Data, C.int (XML'Length), Final_Flag); S.Free (XML_Data); if Status /= XML_STATUS_OK then raise XML_Parse_Error; end if; end Parse; end XML.Reader;
-- Institution: Technische Universität München -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- Module: CRC-8 -- -- Authors: Emanuel Regnath (emanuel.regnath@tum.de) -- -- Description: Checksum according to fletcher's algorithm with HIL; with Interfaces; use Interfaces; package body Fletcher16 with SPARK_Mode is -- init function Checksum(Data : Array_Type) return Checksum_Type is result : Checksum_Type := (0 , 0); begin for i in Data'Range loop -- result.ck_a := result.ck_a + Element_Type'Pos (Data (i)); result.ck_a := result.ck_a + Data (i); -- Byte + Element_Type result.ck_b := result.ck_b + result.ck_a; end loop; return result; end Checksum; end Fletcher16;
------------------------------------------------------------------------------ -- -- -- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . C O M P I L E R _ E X C E P T I O N S -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- Copyright (c) 1991,1992,1993,1994, FSU, All Rights Reserved -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU Library General Public License as published by the -- -- Free Software Foundation; either version 2, or (at your option) any -- -- later version. GNARL is distributed in the hope that it will be use- -- -- ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Gen- -- -- eral Library Public License for more details. You should have received -- -- a copy of the GNU Library General Public License along with GNARL; see -- -- file COPYING.LIB. If not, write to the Free Software Foundation, 675 -- -- Mass Ave, Cambridge, MA 02139, USA. -- -- -- ------------------------------------------------------------------------------ with System.Task_Primitives; -- Uses, Task_Primitives.Machine_Exceptions -- Task_Primitives.Error_Information package System.Compiler_Exceptions is -- This interface is described in the document -- Gnu Ada Runtime Library Interface (GNARLI). type Exception_ID is private; Null_Exception : constant Exception_ID; Constraint_Error_ID : constant Exception_ID; Numeric_Error_ID : constant Exception_ID; Program_Error_ID : constant Exception_ID; Storage_Error_ID : constant Exception_ID; Tasking_Error_ID : constant Exception_ID; type Pre_Call_State is private; procedure Raise_Exception (E : Exception_ID); procedure Notify_Exception (Which : System.Task_Primitives.Machine_Exceptions; Info : System.Task_Primitives.Error_Information; Modified_Registers : Pre_Call_State); function Current_Exception return Exception_ID; subtype Exception_ID_String is String (1 .. 16); function Image (E : Exception_ID) return Exception_ID_String; private type Exception_ID is new Integer; Null_Exception : constant Exception_ID := 0; Constraint_Error_ID : constant Exception_ID := 1; Numeric_Error_ID : constant Exception_ID := 2; Program_Error_ID : constant Exception_ID := 3; Storage_Error_ID : constant Exception_ID := 4; Tasking_Error_ID : constant Exception_ID := 5; type tmp is record d : integer; end record; type Pre_Call_State is access tmp; end System.Compiler_Exceptions;
-- { dg-do run } -- { dg-options "-gnatW8" } procedure wide_test is X : constant Wide_Character := 'Я'; begin declare S3 : constant Wide_String := (''', X, '''); X3 : Wide_Character; begin X3 := Wide_Character'Wide_Value (S3); if X /= X3 then raise Program_Error; end if; end; end;
with Ada.Real_Time; use Ada.Real_Time; package body Solar_System.Graphics is procedure Draw_Body(Object : Body_Type; Canvas : Canvas_ID) is begin if Object.Visible then Draw_Sphere(Canvas => Canvas, Position => (Object.Pos.X, Object.Pos.Y, 0.0), Radius => Object.Radius, Color => Object.Color); if Object.With_Tail then for I in T_Tail'Range loop Draw_Sphere(Canvas => Canvas, Position => (Object.Tail(I).X, Object.Tail(I).Y, 0.0), Radius => Object.Radius, Color => Object.Color); end loop; end if; end if; end Draw_Body; protected body Graphic_Context is procedure Set_Window(W : Window_ID) is begin Window := W; Canvas := Get_Canvas(W); Is_Set := True; end Set_Window; entry Get_Window(W : out Window_ID; C : out Canvas_ID) when Is_Set is begin W := Window; C := Canvas; end Get_Window; end Graphic_Context; task body T_Display is -- declare a variable Now of type Time to record current time Now : Time; -- declare a constant Period of 40 milliseconds of type Time_Span defining the loop period Period : constant Time_Span := Milliseconds (30); Canvas : Canvas_ID; Window : Window_ID; begin Graphic_Context.Get_Window(Window, Canvas); loop Now := Clock; for B of Bodies loop Draw_Body(Object => B.Get_Data, Canvas => Canvas); end loop; Swap_Buffers(Window); delay until Now + Period; end loop; end T_Display; end Solar_System.Graphics;
-- { dg-do compile } -- { dg-options "-O -fdump-tree-optimized" } procedure Loop_Optimization19 is type Array_T is array (Positive range <>) of Integer; type Obj_T (Length : Natural) is record Elements : Array_T (1 .. Length); end record; type T is access Obj_T; function Equal (S1, S2 : T) return Boolean; pragma No_Inline (Equal); function Equal (S1, S2 : T) return Boolean is begin if S1.Length = S2.Length then for I in 1 .. S1.Length loop if S1.Elements (I) /= S2.Elements (I) then return False; end if; end loop; return True; else return False; end if; end Equal; A : T := new Obj_T (Length => 10); B : T := new Obj_T (Length => 20); C : T := new Obj_T (Length => 30); begin if Equal (A, B) then raise Program_Error; else if Equal (B, C) then raise Program_Error; end if; end if; end; -- { dg-final { scan-tree-dump-not "Index_Check" "optimized" } }
-- Abstract : -- -- Types and operations shared by Ada and Ada_Emacs outputs. -- -- Copyright (C) 2017, 2018 Free Software Foundation, Inc. -- -- 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 MERCHAN- -- TABILITY 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. pragma License (Modified_GPL); with WisiToken.BNF.Generate_Utils; with WisiToken.Generate.Packrat; with WisiToken_Grammar_Runtime; package WisiToken.BNF.Output_Ada_Common is function To_Token_Ada_Name (WY_Name : in String) return String; type Common_Data is limited record -- Validated versions of Tuple values Generate_Algorithm : WisiToken.BNF.Valid_Generate_Algorithm; Lexer : Lexer_Type; -- 'none' valid for Libadalang Output_Language : Ada_Output_Language; Interface_Kind : Valid_Interface; Text_Rep : Boolean; Lower_File_Name_Root : Standard.Ada.Strings.Unbounded.Unbounded_String; end record; function Initialize (Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Tuple : in Generate_Tuple; Output_File_Root : in String; Check_Interface : in Boolean) return Common_Data; function File_Name_To_Ada (File_Name : in String) return String; procedure Create_Ada_Actions_Spec (Output_File_Name : in String; Package_Name : in String; Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Common_Data : in Output_Ada_Common.Common_Data; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data); procedure Create_Ada_Main_Spec (Output_File_Name : in String; Main_Package_Name : in String; Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Common_Data : in Output_Ada_Common.Common_Data) with Pre => Common_Data.Generate_Algorithm /= External; procedure Create_External_Main_Spec (Main_Package_Name : in String; Tuple : in Generate_Tuple; Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type); procedure LR_Create_Create_Parser (Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Common_Data : in out Output_Ada_Common.Common_Data; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data); -- If not Common_Data.Text_Rep, includes LR parse table in generated -- source. Otherwise, includes call to LR.Get_Text_Rep; caller must -- call Put_Text_Rep to create file. procedure Packrat_Create_Create_Parser (Common_Data : in out Output_Ada_Common.Common_Data; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data; Packrat_Data : in WisiToken.Generate.Packrat.Data); procedure External_Create_Create_Grammar (Generate_Data : in WisiToken.BNF.Generate_Utils.Generate_Data); procedure Create_re2c (Input_Data : in WisiToken_Grammar_Runtime.User_Data_Type; Tuple : in Generate_Tuple; Generate_Data : aliased in WisiToken.BNF.Generate_Utils.Generate_Data; Output_File_Name_Root : in String); -- Create_re2c is called from wisitoken-bnf-generate, which does not declare -- Common_Data. end WisiToken.BNF.Output_Ada_Common;
with Ada.Containers.Indefinite_Vectors; with Ada.Text_IO; procedure Ordered_Words is package Word_Vectors is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, Element_Type => String); function Is_Ordered (The_Word : String) return Boolean is Highest_Character : Character := 'a'; begin for I in The_Word'Range loop if The_Word(I) not in 'a' .. 'z' then return False; end if; if The_Word(I) < Highest_Character then return False; end if; Highest_Character := The_Word(I); end loop; return True; end Is_Ordered; procedure Print_Word (Position : Word_Vectors.Cursor) is begin Ada.Text_IO.Put_Line (Word_Vectors.Element (Position)); end Print_Word; File : Ada.Text_IO.File_Type; Ordered_Words : Word_Vectors.Vector; Max_Length : Positive := 1; begin Ada.Text_IO.Open (File, Ada.Text_IO.In_File, "unixdict.txt"); while not Ada.Text_IO.End_Of_File (File) loop declare Next_Word : String := Ada.Text_IO.Get_Line (File); begin if Is_Ordered (Next_Word) then if Next_Word'Length > Max_Length then Max_Length := Next_Word'Length; Word_Vectors.Clear (Ordered_Words); Word_Vectors.Append (Ordered_Words, Next_Word); elsif Next_Word'Length = Max_Length then Word_Vectors.Append (Ordered_Words, Next_Word); end if; end if; end; end loop; Word_Vectors.Iterate (Ordered_Words, Print_Word'Access); end Ordered_Words;
with Knights_Tour, Ada.Command_Line; procedure Test_Fast is Size: Positive := Positive'Value(Ada.Command_Line.Argument(1)); package KT is new Knights_Tour(Size => Size); begin KT.Tour_IO(KT.Warnsdorff_Get_Tour(1, 1)); end Test_Fast;
with Ada.Text_IO; with zlib; procedure version is begin Ada.Text_IO.Put_Line (zlib.Version); end version;
with System; package Lv.Style is type Style is private; type Style_Anim is private; -- unsupported macro: LV_RADIUS_CIRCLE (LV_COORD_MAX) subtype Border_Part_T is Uint8_T; subtype Shadow_Type_T is Uint8_T; procedure Style_Init; pragma Import (C, Style_Init, "lv_style_init"); procedure Style_Copy (Dest : access Style; Src : access Style); pragma Import (C, Style_Copy, "lv_style_copy"); procedure Style_Mix (Start : access Style; End_P : access Style; Result : access Style; Ratio : Uint16_T); pragma Import (C, Style_Mix, "lv_style_mix"); function Style_Anim_Create (Anim_P : Style_Anim) return System.Address; pragma Import (C, Style_Anim_Create, "lv_style_anim_create"); Style_Scr : constant access constant Style; Style_Transp : constant access constant Style; Style_Transp_Fit : constant access constant Style; Style_Transp_Tight : constant access constant Style; Style_Plain : constant access constant Style; Style_Plain_Color : constant access constant Style; Style_Pretty : constant access constant Style; Style_Pretty_Color : constant access constant Style; Style_Btn_Rel : constant access constant Style; Style_Btn_Pr : constant access constant Style; Style_Btn_Tgl_Rel : constant access constant Style; Style_Btn_Tgl_Pr : constant access constant Style; Style_Btn_Ina : constant access constant Style; private type Style is new Uint32_T; -- FIXME: proper style mapping Lv_Style_Scr : aliased Style; pragma Import (C, Lv_Style_Scr, "lv_style_scr"); Lv_Style_Transp : aliased Style; pragma Import (C, Lv_Style_Transp, "lv_style_transp"); Lv_Style_Transp_Fit : aliased Style; pragma Import (C, Lv_Style_Transp_Fit, "lv_style_transp_fit"); Lv_Style_Transp_Tight : aliased Style; pragma Import (C, Lv_Style_Transp_Tight, "lv_style_transp_tight"); Lv_Style_Plain : aliased Style; pragma Import (C, Lv_Style_Plain, "lv_style_plain"); Lv_Style_Plain_Color : aliased Style; pragma Import (C, Lv_Style_Plain_Color, "lv_style_plain_color"); Lv_Style_Pretty : aliased Style; pragma Import (C, Lv_Style_Pretty, "lv_style_pretty"); Lv_Style_Pretty_Color : aliased Style; pragma Import (C, Lv_Style_Pretty_Color, "lv_style_pretty_color"); Lv_Style_Btn_Rel : aliased Style; pragma Import (C, Lv_Style_Btn_Rel, "lv_style_btn_rel"); Lv_Style_Btn_Pr : aliased Style; pragma Import (C, Lv_Style_Btn_Pr, "lv_style_btn_pr"); Lv_Style_Btn_Tgl_Rel : aliased Style; pragma Import (C, Lv_Style_Btn_Tgl_Rel, "lv_style_btn_tgl_rel"); Lv_Style_Btn_Tgl_Pr : aliased Style; pragma Import (C, Lv_Style_Btn_Tgl_Pr, "lv_style_btn_tgl_pr"); Lv_Style_Btn_Ina : aliased Style; pragma Import (C, Lv_Style_Btn_Ina, "lv_style_btn_ina"); Style_Scr : constant access constant Style := Lv_Style_Scr'Access; Style_Transp : constant access constant Style := Lv_Style_Transp'Access; Style_Transp_Fit : constant access constant Style := Lv_Style_Transp_Fit'Access; Style_Transp_Tight : constant access constant Style := Lv_Style_Transp_Tight'Access; Style_Plain : constant access constant Style := Lv_Style_Plain'Access; Style_Plain_Color : constant access constant Style := Lv_Style_Plain_Color'Access; Style_Pretty : constant access constant Style := Lv_Style_Pretty'Access; Style_Pretty_Color : constant access constant Style := Lv_Style_Pretty_Color'Access; Style_Btn_Rel : constant access constant Style := Lv_Style_Btn_Rel'Access; Style_Btn_Pr : constant access constant Style := Lv_Style_Btn_Pr'Access; Style_Btn_Tgl_Rel : constant access constant Style := Lv_Style_Btn_Tgl_Rel'Access; Style_Btn_Tgl_Pr : constant access constant Style := Lv_Style_Btn_Tgl_Pr'Access; Style_Btn_Ina : constant access constant Style := Lv_Style_Btn_Ina'Access; type Style_Anim is new System.Address; No_Style_Anim : constant Style_Anim := Style_Anim (System.Null_Address); -- type lv_style_t; -- type lv_style_t_border_struct is record -- color : aliased LV.Color.lv_color_t; -- width : aliased LV.Area.Coord_T; -- part : aliased lv_border_part_t; -- opa : aliased LV.Color.lv_opa_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_border_struct); -- type lv_style_t_shadow_struct is record -- color : aliased LV.Color.lv_color_t; -- width : aliased LV.Area.Coord_T; -- c_type : aliased lv_shadow_type_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_shadow_struct); -- type lv_style_t_padding_struct is record -- ver : aliased LV.Area.Coord_T; -- hor : aliased LV.Area.Coord_T; -- inner : aliased LV.Area.Coord_T; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_padding_struct); -- type lv_style_t_c_body_struct is record -- main_color : aliased LV.Color.lv_color_t; -- grad_color : aliased LV.Color.lv_color_t; -- radius : aliased LV.Area.Coord_T; -- opa : aliased LV.Color.lv_opa_t; -- border : aliased lv_style_t_border_struct; -- shadow : aliased lv_style_t_shadow_struct; -- padding : aliased lv_style_t_padding_struct; -- empty : Extensions.Unsigned_1; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_c_body_struct); -- type lv_style_t_text_struct is record -- color : aliased LV.Color.lv_color_t; -- font : access constant LV.Font.lv_font_t; -- letter_space : aliased LV.Area.Coord_T; -- line_space : aliased LV.Area.Coord_T; -- opa : aliased LV.Color.lv_opa_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_text_struct); -- type lv_style_t_image_struct is record -- color : aliased LV.Color.lv_color_t; -- intense : aliased LV.Color.lv_opa_t; -- opa : aliased LV.Color.lv_opa_t; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_image_struct); -- type lv_style_t_line_struct is record -- color : aliased LV.Color.lv_color_t; -- width : aliased LV.Area.Coord_T; -- opa : aliased LV.Color.lv_opa_t; -- rounded : Extensions.Unsigned_1; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t_line_struct); -- type lv_style_t is record -- glass : Extensions.Unsigned_1; -- c_body : aliased lv_style_t_c_body_struct; -- text : aliased lv_style_t_text_struct; -- image : aliased lv_style_t_image_struct; -- line : aliased lv_style_t_line_struct; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_t); -- pragma Pack (lv_style_t); -- -- type lv_style_anim_t is record -- style_start : access constant lv_style_t; -- style_end : access constant lv_style_t; -- style_anim : access lv_style_t; -- end_cb : LV.Anim.lv_anim_cb_t; -- time : aliased int16_t; -- act_time : aliased int16_t; -- playback_pause : aliased uint16_t; -- repeat_pause : aliased uint16_t; -- playback : Extensions.Unsigned_1; -- repeat : Extensions.Unsigned_1; -- end record; -- pragma Convention (C_Pass_By_Copy, lv_style_anim_t); -- pragma Pack (lv_style_anim_t); end Lv.Style;
with Ada.Containers.Formal_Doubly_Linked_Lists; with Ada.Containers.Formal_Hashed_Maps; with Ada.Containers.Functional_Maps; with Ada.Containers; use all type Ada.Containers.Count_Type; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Automation_Request_Validator_Communication; use Automation_Request_Validator_Communication; with Common; use Common; with LMCP_Messages; use LMCP_Messages; -- Package containing the fonctionality of the service. It uses its communication -- counter-part to send and receive messages. package Automation_Request_Validator with SPARK_Mode is pragma Unevaluated_Use_Of_Old (Allow); -- Configuration data is separated from the service state as it is not -- handled by the same primitives. We use functional containers, as it is -- not supposed to be modified often. type OperatingRegionAreas is record KeepInAreas : Int64_Seq; KeepOutAreas : Int64_Seq; end record; package Int64_Operating_Region_Maps is new Ada.Containers.Functional_Maps (Key_Type => Int64, Element_Type => OperatingRegionAreas); type Operating_Region_Map is new Int64_Operating_Region_Maps.Map; type Task_Kind is (Angled_Area_Search_Task, Impact_Line_Search_Task, Impact_Point_Search_Task, Other_Task); type Task_Kind_And_Id (Kind : Task_Kind := Other_Task) is record case Kind is when Angled_Area_Search_Task => SearchAreaID : Int64; when Impact_Line_Search_Task => LineID : Int64; when Impact_Point_Search_Task => SearchLocationID : Int64; when Other_Task => null; end case; end record; package Int64_Task_Maps is new Ada.Containers.Functional_Maps (Key_Type => Int64, Element_Type => Task_Kind_And_Id); type Task_Map is new Int64_Task_Maps.Map; type Automation_Request_Validator_Configuration_Data is record Available_Configuration_Entity_Ids : Int64_Set; Available_State_Entity_Ids : Int64_Set; Available_KeepIn_Zones_Ids : Int64_Set; Available_KeepOut_Zones_Ids : Int64_Set; Available_Area_of_Interest_Ids : Int64_Set; Available_Line_of_Interest_Ids : Int64_Set; Available_Point_of_Interest_Ids : Int64_Set; Available_Operating_Regions : Operating_Region_Map; Available_Tasks : Task_Map; Available_Initialized_Tasks : Int64_Set; end record; -- The mutable state of the service is stored inside formal containers which -- can be modified. type Automation_Request_Type is (Automation_Request, Sandbox_Automation_Request, Task_Automation_Request); type Request_Details (Request_Type : Automation_Request_Type := Automation_Request) is record case Request_Type is when Sandbox_Automation_Request => Play_Id : Int64 := 0; Soln_Id : Int64 := 0; when Task_Automation_Request => Task_Request_Id : Int64 := 0; when others => null; end case; end record; package Int64_Request_Details_Maps is new Ada.Containers.Formal_Hashed_Maps (Key_Type => Int64, Element_Type => Request_Details, Hash => Int64_Hash); Request_Details_Max_Capacity : constant := 200; -- arbitrary subtype Request_Details_Map is Int64_Request_Details_Maps.Map (Request_Details_Max_Capacity, Int64_Request_Details_Maps.Default_Modulus (Request_Details_Max_Capacity)); package UniqueAutomationRequest_Lists is new Ada.Containers.Formal_Doubly_Linked_Lists (Element_Type => UniqueAutomationRequest); Max_UniqueAutomationRequest_Deque_Depth : constant := 200; -- arbitrary subtype UniqueAutomationRequest_Ref_Deque is UniqueAutomationRequest_Lists.List (Capacity => Max_UniqueAutomationRequest_Deque_Depth); use UniqueAutomationRequest_Lists; type Automation_Request_Validator_State is record Sandbox : Request_Details_Map; Pending_Requests : UniqueAutomationRequest_Ref_Deque; Requests_Waiting_For_Tasks : UniqueAutomationRequest_Ref_Deque; end record; -------------------------------------- -- Functions for annotation purpose -- -------------------------------------- function All_Elements_In (V : Int64_Seq; S : Int64_Set) return Boolean with Ghost; function Contains (V : Int64_Seq; E : Int64) return Boolean with Ghost; function Valid_Automation_Request (This : Automation_Request_Validator_Configuration_Data; Request : UniqueAutomationRequest) return Boolean with Ghost, Global => null; ------------------------------------- -- Regular Service Functionalities -- ------------------------------------- use Int64_Request_Details_Maps; use Int64_Request_Details_Maps.Formal_Model; -- In the specification, we can clearly separate the parts which are updated -- or not to simplify annotation. procedure Check_Automation_Request_Requirements (Config : Automation_Request_Validator_Configuration_Data; Sandbox : in out Request_Details_Map; Mailbox : in out Automation_Request_Validator_Mailbox; Request : in out UniqueAutomationRequest; IsReady : out Boolean) with Pre => Contains (Sandbox, Request.RequestID), Post => -- Request was removed from Sandbox iff IsReady is False Contains (Sandbox, Request.RequestID) = IsReady and then Model (Sandbox) <= Model (Sandbox)'Old and then M.Keys_Included_Except (Left => Model (Sandbox)'Old, Right => Model (Sandbox), New_Key => Request.RequestID) -- IsReady is true if the automation request is valid and then IsReady = Valid_Automation_Request (Config, Request'Old) and then Request.OperatingRegion'Old = Request.OperatingRegion and then Request.TaskList'Old = Request.TaskList and then Request.RedoAllTasks'Old = Request.RedoAllTasks and then Request.RequestID'Old = Request.RequestID and then Request.PlanningStates'Old = Request.PlanningStates and then Request.SandboxRequest'Old = Request.SandboxRequest; procedure Handle_Automation_Request (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Request : AutomationRequest); procedure Handle_Impact_Automation_Request (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Request : ImpactAutomationRequest) with Pre => not Contains (State.Sandbox, Request.RequestID); procedure Handle_Task_Automation_Request (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Request : TaskAutomationRequest) with Pre => not Contains (State.Sandbox, Request.RequestID); procedure Handle_Automation_Response (State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox; Response : UniqueAutomationResponse); procedure Check_Tasks_Initialized (Config : Automation_Request_Validator_Configuration_Data; State : in out Automation_Request_Validator_State; Mailbox : in out Automation_Request_Validator_Mailbox); private function All_Elements_In (V : Int64_Seq; S : Int64_Set) return Boolean is (for all E of V => Contains (S, E)); function Contains (V : Int64_Seq; E : Int64) return Boolean is (for some F of V => E = F); function Check_For_Required_Entity_Configurations (Entity_Ids : Int64_Seq; Configurations : Int64_Set; States : Int64_Set; Planning_States : PlanningState_Seq) return Boolean is (All_Elements_In (Entity_Ids, Configurations) and then (for all E of Entity_Ids => (Contains (States, E) or else (not Is_Empty (States) and then (for some Planning_State of Planning_States => E = Planning_State.EntityID)))) and then (if Length (Entity_Ids) = 0 then (for some Id of Configurations => Contains (States, Id)))) with Ghost; function Check_For_Required_Operating_Region_And_Keepin_Keepout_Zones (Operating_Region : Int64; Operating_Regions : Operating_Region_Map; KeepIn_Zones_Ids : Int64_Set; KeepOut_Zones_Ids : Int64_Set) return Boolean is (if Operating_Region /= 0 then Has_Key (Operating_Regions, Operating_Region) and then All_Elements_In (Get (Operating_Regions, Operating_Region).KeepInAreas, KeepIn_Zones_Ids) and then All_Elements_In (Get (Operating_Regions, Operating_Region).KeepOutAreas, KeepOut_Zones_Ids)) with Ghost; function Check_For_Specific_Task_Requirements (Available_Area_of_Interest_Ids : Int64_Set; Available_Line_of_Interest_Ids : Int64_Set; Available_Point_of_Interest_Ids : Int64_Set; ItTask : Task_Kind_And_Id) return Boolean is (case ItTask.Kind is when Angled_Area_Search_Task => ItTask.SearchAreaID = 0 or else Contains (Available_Area_of_Interest_Ids, ItTask.SearchAreaID), when Impact_Line_Search_Task => ItTask.LineID = 0 or else Contains (Available_Line_of_Interest_Ids, ItTask.LineID), when Impact_Point_Search_Task => ItTask.SearchLocationID = 0 or else Contains (Available_Point_of_Interest_Ids, ItTask.SearchLocationID), when Other_Task => True) with Ghost; function Check_For_Required_Tasks_And_Task_Requirements (Available_Tasks : Task_Map; Available_Area_of_Interest_Ids : Int64_Set; Available_Line_of_Interest_Ids : Int64_Set; Available_Point_of_Interest_Ids : Int64_Set; TaskIds : Int64_Seq) return Boolean is (for all T of TaskIds => Has_Key (Available_Tasks, T) and then Check_For_Specific_Task_Requirements (Available_Area_of_Interest_Ids, Available_Line_of_Interest_Ids, Available_Point_of_Interest_Ids, Get (Available_Tasks, T))) with Ghost; function Valid_Automation_Request (This : Automation_Request_Validator_Configuration_Data; Request : UniqueAutomationRequest) return Boolean is (Check_For_Required_Entity_Configurations (Entity_Ids => Request.EntityList, Configurations => This.Available_Configuration_Entity_Ids, States => This.Available_State_Entity_Ids, Planning_States => Request.PlanningStates) and then Check_For_Required_Operating_Region_And_Keepin_Keepout_Zones (Operating_Region => Request.OperatingRegion, Operating_Regions => This.Available_Operating_Regions, KeepIn_Zones_Ids => This.Available_KeepIn_Zones_Ids, KeepOut_Zones_Ids => This.Available_KeepOut_Zones_Ids) and then Check_For_Required_Tasks_And_Task_Requirements (Available_Tasks => This.Available_Tasks, Available_Area_of_Interest_Ids => This.Available_Area_of_Interest_Ids, Available_Line_of_Interest_Ids => This.Available_Line_of_Interest_Ids, Available_Point_of_Interest_Ids => This.Available_Point_of_Interest_Ids, TaskIds => Request.TaskList)); end Automation_Request_Validator;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- G N A T . D Y N A M I C _ H T A B L E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Hash table searching routines -- This package contains two separate packages. The Simple_HTable package -- provides a very simple abstraction that associates one element to one key -- value and takes care of all allocations automatically using the heap. The -- Static_HTable package provides a more complex interface that allows full -- control over allocation. -- This package provides a facility similar to that of GNAT.HTable, except -- that this package declares types that can be used to define dynamic -- instances of hash tables, while instantiations in GNAT.HTable creates a -- single instance of the hash table. -- Note that this interface should remain synchronized with those in -- GNAT.HTable to keep as much coherency as possible between these two -- related units. pragma Compiler_Unit_Warning; package GNAT.Dynamic_HTables is ------------------- -- Static_HTable -- ------------------- -- A low-level Hash-Table abstraction, not as easy to instantiate as -- Simple_HTable. This mirrors the interface of GNAT.HTable.Static_HTable, -- but does require dynamic allocation (since we allow multiple instances -- of the table). The model is that each Element contains its own Key that -- can be retrieved by Get_Key. Furthermore, Element provides a link that -- can be used by the HTable for linking elements with same hash codes: -- Element -- +-------------------+ -- | Key | -- +-------------------+ -- : other data : -- +-------------------+ -- | Next Elmt | -- +-------------------+ generic type Header_Num is range <>; -- An integer type indicating the number and range of hash headers type Element (<>) is limited private; -- The type of element to be stored type Elmt_Ptr is private; -- The type used to reference an element (will usually be an access -- type, but could be some other form of type such as an integer type). Null_Ptr : Elmt_Ptr; -- The null value of the Elmt_Ptr type with function Next (E : Elmt_Ptr) return Elmt_Ptr; with procedure Set_Next (E : Elmt_Ptr; Next : Elmt_Ptr); -- The type must provide an internal link for the sake of the -- staticness of the HTable. type Key is limited private; with function Get_Key (E : Elmt_Ptr) return Key; with function Hash (F : Key) return Header_Num; with function Equal (F1 : Key; F2 : Key) return Boolean; package Static_HTable is type Instance is private; Nil : constant Instance; procedure Reset (T : in out Instance); -- Resets the hash table by releasing all memory associated with it. The -- hash table can safely be reused after this call. For the most common -- case where Elmt_Ptr is an access type, and Null_Ptr is null, this is -- only needed if the same table is reused in a new context. If Elmt_Ptr -- is other than an access type, or Null_Ptr is other than null, then -- Reset must be called before the first use of the hash table. procedure Set (T : in out Instance; E : Elmt_Ptr); -- Insert the element pointer in the HTable function Get (T : Instance; K : Key) return Elmt_Ptr; -- Returns the latest inserted element pointer with the given Key or -- null if none. procedure Remove (T : Instance; K : Key); -- Removes the latest inserted element pointer associated with the given -- key if any, does nothing if none. function Get_First (T : Instance) return Elmt_Ptr; -- Returns Null_Ptr if the Htable is empty, otherwise returns one -- unspecified element. There is no guarantee that 2 calls to this -- function will return the same element. function Get_Next (T : Instance) return Elmt_Ptr; -- Returns an unspecified element that has not been returned by the same -- function since the last call to Get_First or Null_Ptr if there is no -- such element or Get_First has never been called. If there is no call -- to 'Set' in between Get_Next calls, all the elements of the Htable -- will be traversed. private type Table_Type is array (Header_Num) of Elmt_Ptr; type Instance_Data is record Table : Table_Type; Iterator_Index : Header_Num; Iterator_Ptr : Elmt_Ptr; Iterator_Started : Boolean := False; end record; type Instance is access all Instance_Data; Nil : constant Instance := null; end Static_HTable; ------------------- -- Simple_HTable -- ------------------- -- A simple hash table abstraction, easy to instantiate, easy to use. -- The table associates one element to one key with the procedure Set. -- Get retrieves the Element stored for a given Key. The efficiency of -- retrieval is function of the size of the Table parameterized by -- Header_Num and the hashing function Hash. generic type Header_Num is range <>; -- An integer type indicating the number and range of hash headers type Element is private; -- The type of element to be stored No_Element : Element; -- The object that is returned by Get when no element has been set for -- a given key type Key is private; with function Hash (F : Key) return Header_Num; with function Equal (F1 : Key; F2 : Key) return Boolean; package Simple_HTable is type Instance is private; Nil : constant Instance; type Key_Option (Present : Boolean := False) is record case Present is when True => K : Key; when False => null; end case; end record; procedure Set (T : in out Instance; K : Key; E : Element); -- Associates an element with a given key. Overrides any previously -- associated element. procedure Reset (T : in out Instance); -- Releases all memory associated with the table. The table can be -- reused after this call (it is automatically allocated on the first -- access to the table). function Get (T : Instance; K : Key) return Element; -- Returns the Element associated with a key or No_Element if the given -- key has not associated element procedure Remove (T : Instance; K : Key); -- Removes the latest inserted element pointer associated with the given -- key if any, does nothing if none. function Get_First (T : Instance) return Element; -- Returns No_Element if the Htable is empty, otherwise returns one -- unspecified element. There is no guarantee that two calls to this -- function will return the same element, if the Htable has been -- modified between the two calls. function Get_First_Key (T : Instance) return Key_Option; -- Returns an option type giving an unspecified key. If the Htable -- is empty, the discriminant will have field Present set to False, -- otherwise its Present field is set to True and the field K contains -- the key. There is no guarantee that two calls to this function will -- return the same key, if the Htable has been modified between the two -- calls. function Get_Next (T : Instance) return Element; -- Returns an unspecified element that has not been returned by the -- same function since the last call to Get_First or No_Element if -- there is no such element. If there is no call to 'Set' in between -- Get_Next calls, all the elements of the Htable will be traversed. -- To guarantee that all the elements of the Htable will be traversed, -- no modification of the Htable (Set, Reset, Remove) should occur -- between a call to Get_First and subsequent consecutive calls to -- Get_Next, until one of these calls returns No_Element. function Get_Next_Key (T : Instance) return Key_Option; -- Same as Get_Next except that this returns an option type having field -- Present set either to False if there no key never returned before by -- either Get_First_Key or this very same function, or to True if there -- is one, with the field K containing the key specified as before. The -- same restrictions apply as Get_Next. private type Element_Wrapper; type Elmt_Ptr is access all Element_Wrapper; type Element_Wrapper is record K : Key; E : Element; Next : Elmt_Ptr; end record; procedure Set_Next (E : Elmt_Ptr; Next : Elmt_Ptr); function Next (E : Elmt_Ptr) return Elmt_Ptr; function Get_Key (E : Elmt_Ptr) return Key; package Tab is new Static_HTable (Header_Num => Header_Num, Element => Element_Wrapper, Elmt_Ptr => Elmt_Ptr, Null_Ptr => null, Set_Next => Set_Next, Next => Next, Key => Key, Get_Key => Get_Key, Hash => Hash, Equal => Equal); type Instance is new Tab.Instance; Nil : constant Instance := Instance (Tab.Nil); end Simple_HTable; -------------------- -- Dynamic_HTable -- -------------------- -- The following package offers a hash table abstraction with the following -- characteristics: -- -- * Dynamic resizing based on load factor. -- * Creation of multiple instances, of different sizes. -- * Iterable keys. -- -- This type of hash table is best used in scenarios where the size of the -- key set is not known. The dynamic resizing aspect allows for performance -- to remain within reasonable bounds as the size of the key set grows. -- -- The following use pattern must be employed when operating this table: -- -- Table : Instance := Create (<some size>); -- -- <various operations> -- -- Destroy (Table); -- -- The destruction of the table reclaims all storage occupied by it. -- The following type denotes the multiplicative factor used in expansion -- and compression of the hash table. subtype Factor_Type is Bucket_Range_Type range 2 .. 100; -- The following type denotes the threshold range used in expansion and -- compression of the hash table. subtype Threshold_Type is Long_Float range 0.0 .. Long_Float'Last; generic type Key_Type is private; type Value_Type is private; -- The types of the key-value pairs stored in the hash table No_Value : Value_Type; -- An indicator for a non-existent value Expansion_Threshold : Threshold_Type; Expansion_Factor : Factor_Type; -- Once the load factor goes over Expansion_Threshold, the size of the -- buckets is increased using the formula -- -- New_Size = Old_Size * Expansion_Factor -- -- An Expansion_Threshold of 1.5 and Expansion_Factor of 2 indicate that -- the size of the buckets will be doubled once the load factor exceeds -- 1.5. Compression_Threshold : Threshold_Type; Compression_Factor : Factor_Type; -- Once the load factor drops below Compression_Threshold, the size of -- the buckets is decreased using the formula -- -- New_Size = Old_Size / Compression_Factor -- -- A Compression_Threshold of 0.5 and Compression_Factor of 2 indicate -- that the size of the buckets will be halved once the load factor -- drops below 0.5. with function "=" (Left : Key_Type; Right : Key_Type) return Boolean; with function Hash (Key : Key_Type) return Bucket_Range_Type; -- Map an arbitrary key into the range of buckets package Dynamic_HTable is ---------------------- -- Table operations -- ---------------------- -- The following type denotes a hash table handle. Each instance must be -- created using routine Create. type Instance is private; Nil : constant Instance; function Create (Initial_Size : Positive) return Instance; -- Create a new table with bucket capacity Initial_Size. This routine -- must be called at the start of a hash table's lifetime. procedure Delete (T : Instance; Key : Key_Type); -- Delete the value which corresponds to key Key from hash table T. The -- routine has no effect if the value is not present in the hash table. -- This action will raise Iterated if the hash table has outstanding -- iterators. If the load factor drops below Compression_Threshold, the -- size of the buckets is decreased by Copression_Factor. procedure Destroy (T : in out Instance); -- Destroy the contents of hash table T, rendering it unusable. This -- routine must be called at the end of a hash table's lifetime. This -- action will raise Iterated if the hash table has outstanding -- iterators. function Get (T : Instance; Key : Key_Type) return Value_Type; -- Obtain the value which corresponds to key Key from hash table T. If -- the value does not exist, return No_Value. function Is_Empty (T : Instance) return Boolean; -- Determine whether hash table T is empty procedure Put (T : Instance; Key : Key_Type; Value : Value_Type); -- Associate value Value with key Key in hash table T. If the table -- already contains a mapping of the same key to a previous value, the -- previous value is overwritten. This action will raise Iterated if -- the hash table has outstanding iterators. If the load factor goes -- over Expansion_Threshold, the size of the buckets is increased by -- Expansion_Factor. procedure Reset (T : Instance); -- Destroy the contents of hash table T, and reset it to its initial -- created state. This action will raise Iterated if the hash table -- has outstanding iterators. function Size (T : Instance) return Natural; -- Obtain the number of key-value pairs in hash table T ------------------------- -- Iterator operations -- ------------------------- -- The following type represents a key iterator. An iterator locks -- all mutation operations, and unlocks them once it is exhausted. -- The iterator must be used with the following pattern: -- -- Iter := Iterate (My_Table); -- while Has_Next (Iter) loop -- Key := Next (Iter); -- . . . -- end loop; -- -- It is possible to advance the iterator by using Next only, however -- this risks raising Iterator_Exhausted. type Iterator is private; function Iterate (T : Instance) return Iterator; -- Obtain an iterator over the keys of hash table T. This action locks -- all mutation functionality of the associated hash table. function Has_Next (Iter : Iterator) return Boolean; -- Determine whether iterator Iter has more keys to examine. If the -- iterator has been exhausted, restore all mutation functionality of -- the associated hash table. procedure Next (Iter : in out Iterator; Key : out Key_Type); -- Return the current key referenced by iterator Iter and advance to -- the next available key. If the iterator has been exhausted and -- further attempts are made to advance it, this routine restores -- mutation functionality of the associated hash table, and then -- raises Iterator_Exhausted. private -- The following type represents a doubly linked list node used to -- store a key-value pair. There are several reasons to use a doubly -- linked list: -- -- * Most read and write operations utilize the same primitve -- routines to locate, create, and delete a node, allowing for -- greater degree of code sharing. -- -- * Special cases are eliminated by maintaining a circular node -- list with a dummy head (see type Bucket_Table). -- -- A node is said to be "valid" if it is non-null, and does not refer to -- the dummy head of some bucket. type Node; type Node_Ptr is access all Node; type Node is record Key : Key_Type; Value : Value_Type := No_Value; -- Key-value pair stored in a bucket Prev : Node_Ptr := null; Next : Node_Ptr := null; end record; -- The following type represents a bucket table. Each bucket contains a -- circular doubly linked list of nodes with a dummy head. Initially, -- the head does not refer to itself. This is intentional because it -- improves the performance of creation, compression, and expansion by -- avoiding a separate pass to link a head to itself. Several routines -- ensure that the head is properly formed. type Bucket_Table is array (Bucket_Range_Type range <>) of aliased Node; type Bucket_Table_Ptr is access Bucket_Table; -- The following type represents a hash table type Hash_Table is record Buckets : Bucket_Table_Ptr := null; -- Reference to the compressing / expanding buckets Initial_Size : Bucket_Range_Type := 0; -- The initial size of the buckets as specified at creation time Iterators : Natural := 0; -- Number of outstanding iterators Pairs : Natural := 0; -- Number of key-value pairs in the buckets end record; type Instance is access Hash_Table; Nil : constant Instance := null; -- The following type represents a key iterator type Iterator is record Idx : Bucket_Range_Type := 0; -- Index of the current bucket being examined. This index is always -- kept within the range of the buckets. Nod : Node_Ptr := null; -- Reference to the current node being examined within the current -- bucket. The invariant of the iterator requires that this field -- always point to a valid node. A value of null indicates that the -- iterator is exhausted. Table : Instance := null; -- Reference to the associated hash table end record; end Dynamic_HTable; end GNAT.Dynamic_HTables;
with Ada.Text_IO; use Ada.Text_IO; package body Radar_Internals is T : Natural := 0; procedure Time_Step (Radar_Angle : Float; Time_To_Arrival : Float; John_Connor_Status : String) is E_T_A_H : Integer := Integer (Float'Floor (Time_To_Arrival / 3600.0)); E_T_A_M : Integer := Integer (Float'Floor (Time_To_Arrival / 60.0)) mod 60; E_T_A_S : Integer := Integer (Float'Rounding (Time_To_Arrival)) mod 60; begin Put_Line ("T =" & Natural'Image(T) & " " & "ETA" & Integer'Image (E_T_A_H) & "h" & Integer'Image (E_T_A_M) & "m" & Integer'Image (E_T_A_S) & "s" & " " & "John Connor is " & John_Connor_Status); T := T + 1; end Time_Step; end Radar_Internals;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- M L I B . T G T -- -- (Integrity VMS Version) -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2005 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the Integrity VMS version of the body with Ada.Characters.Handling; use Ada.Characters.Handling; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with MLib.Fil; with MLib.Utl; with Namet; use Namet; with Opt; use Opt; with Output; use Output; with Prj.Com; with System; use System; with System.Case_Util; use System.Case_Util; with System.CRTL; use System.CRTL; package body MLib.Tgt is use GNAT; Empty_Argument_List : aliased Argument_List := (1 .. 0 => null); Additional_Objects : Argument_List_Access := Empty_Argument_List'Access; -- Used to add the generated auto-init object files for auto-initializing -- stand-alone libraries. Macro_Name : constant String := "mcr gnu:[bin]gcc -c -x assembler"; -- The name of the command to invoke the macro-assembler VMS_Options : Argument_List := (1 .. 1 => null); Gnatsym_Name : constant String := "gnatsym"; Gnatsym_Path : String_Access; Arguments : Argument_List_Access := null; Last_Argument : Natural := 0; Success : Boolean := False; Shared_Libgcc : aliased String := "-shared-libgcc"; No_Shared_Libgcc_Switch : aliased Argument_List := (1 .. 0 => null); Shared_Libgcc_Switch : aliased Argument_List := (1 => Shared_Libgcc'Access); Link_With_Shared_Libgcc : Argument_List_Access := No_Shared_Libgcc_Switch'Access; --------------------- -- Archive_Builder -- --------------------- function Archive_Builder return String is begin return "ar"; end Archive_Builder; ----------------------------- -- Archive_Builder_Options -- ----------------------------- function Archive_Builder_Options return String_List_Access is begin return new String_List'(1 => new String'("cr")); end Archive_Builder_Options; ----------------- -- Archive_Ext -- ----------------- function Archive_Ext return String is begin return "olb"; end Archive_Ext; --------------------- -- Archive_Indexer -- --------------------- function Archive_Indexer return String is begin return "ranlib"; end Archive_Indexer; ----------------------------- -- Archive_Indexer_Options -- ----------------------------- function Archive_Indexer_Options return String_List_Access is begin return new String_List (1 .. 0); end Archive_Indexer_Options; --------------------------- -- Build_Dynamic_Library -- --------------------------- procedure Build_Dynamic_Library (Ofiles : Argument_List; Foreign : Argument_List; Afiles : Argument_List; Options : Argument_List; Options_2 : Argument_List; Interfaces : Argument_List; Lib_Filename : String; Lib_Dir : String; Symbol_Data : Symbol_Record; Driver_Name : Name_Id := No_Name; Lib_Version : String := ""; Auto_Init : Boolean := False) is pragma Unreferenced (Foreign); pragma Unreferenced (Afiles); Lib_File : constant String := Lib_Dir & Directory_Separator & "lib" & Fil.Ext_To (Lib_Filename, DLL_Ext); Opts : Argument_List := Options; Last_Opt : Natural := Opts'Last; Opts2 : Argument_List (Options'Range); Last_Opt2 : Natural := Opts2'First - 1; Inter : constant Argument_List := Interfaces; function Is_Interface (Obj_File : String) return Boolean; -- For a Stand-Alone Library, returns True if Obj_File is the object -- file name of an interface of the SAL. For other libraries, always -- return True. function Option_File_Name return String; -- Returns Symbol_File, if not empty. Otherwise, returns "symvec.opt" function Version_String return String; -- Returns Lib_Version if not empty and if Symbol_Data.Symbol_Policy is -- not Autonomous, otherwise returns "". -- When Symbol_Data.Symbol_Policy is Autonomous, fails gnatmake if -- Lib_Version is not the image of a positive number. ------------------ -- Is_Interface -- ------------------ function Is_Interface (Obj_File : String) return Boolean is ALI : constant String := Fil.Ext_To (Filename => To_Lower (Base_Name (Obj_File)), New_Ext => "ali"); begin if Inter'Length = 0 then return True; elsif ALI'Length > 2 and then ALI (ALI'First .. ALI'First + 2) = "b__" then return True; else for J in Inter'Range loop if Inter (J).all = ALI then return True; end if; end loop; return False; end if; end Is_Interface; ---------------------- -- Option_File_Name -- ---------------------- function Option_File_Name return String is begin if Symbol_Data.Symbol_File = No_Name then return "symvec.opt"; else Get_Name_String (Symbol_Data.Symbol_File); To_Lower (Name_Buffer (1 .. Name_Len)); return Name_Buffer (1 .. Name_Len); end if; end Option_File_Name; -------------------- -- Version_String -- -------------------- function Version_String return String is Version : Integer := 0; begin if Lib_Version = "" or else Symbol_Data.Symbol_Policy /= Autonomous then return ""; else begin Version := Integer'Value (Lib_Version); if Version <= 0 then raise Constraint_Error; end if; return Lib_Version; exception when Constraint_Error => Fail ("illegal version """, Lib_Version, """ (on VMS version must be a positive number)"); return ""; end; end if; end Version_String; Opt_File_Name : constant String := Option_File_Name; Version : constant String := Version_String; For_Linker_Opt : String_Access; -- Start of processing for Build_Dynamic_Library begin -- Invoke gcc with -shared-libgcc, but only for GCC 3 or higher if GCC_Version >= 3 then Link_With_Shared_Libgcc := Shared_Libgcc_Switch'Access; else Link_With_Shared_Libgcc := No_Shared_Libgcc_Switch'Access; end if; -- Option file must end with ".opt" if Opt_File_Name'Length > 4 and then Opt_File_Name (Opt_File_Name'Last - 3 .. Opt_File_Name'Last) = ".opt" then For_Linker_Opt := new String'("--for-linker=" & Opt_File_Name); else Fail ("Options File """, Opt_File_Name, """ must end with .opt"); end if; VMS_Options (VMS_Options'First) := For_Linker_Opt; for J in Inter'Range loop To_Lower (Inter (J).all); end loop; -- "gnatsym" is necessary for building the option file if Gnatsym_Path = null then Gnatsym_Path := OS_Lib.Locate_Exec_On_Path (Gnatsym_Name); if Gnatsym_Path = null then Fail (Gnatsym_Name, " not found in path"); end if; end if; -- For auto-initialization of a stand-alone library, we create -- a macro-assembly file and we invoke the macro-assembler. if Auto_Init then declare Macro_File_Name : constant String := Lib_Filename & "__init.asm"; Macro_File : File_Descriptor; Init_Proc : String := Lib_Filename & "INIT"; Popen_Result : System.Address; Pclose_Result : Integer; Len : Natural; OK : Boolean := True; command : constant String := Macro_Name & " " & Macro_File_Name & ASCII.NUL; -- The command to invoke the assembler on the generated auto-init -- assembly file. mode : constant String := "r" & ASCII.NUL; -- The mode for the invocation of Popen begin To_Upper (Init_Proc); if Verbose_Mode then Write_Str ("Creating auto-init assembly file """); Write_Str (Macro_File_Name); Write_Line (""""); end if; -- Create and write the auto-init assembly file declare First_Line : constant String := ASCII.HT & ".type " & Init_Proc & "#, @function" & ASCII.LF; Second_Line : constant String := ASCII.HT & ".global " & Init_Proc & "#" & ASCII.LF; Third_Line : constant String := ASCII.HT & ".global LIB$INITIALIZE#" & ASCII.LF; Fourth_Line : constant String := ASCII.HT & ".section LIB$INITIALIZE#,""a"",@progbits" & ASCII.LF; Fifth_Line : constant String := ASCII.HT & "data4 @fptr(" & Init_Proc & "#)" & ASCII.LF; begin Macro_File := Create_File (Macro_File_Name, Text); OK := Macro_File /= Invalid_FD; if OK then Len := Write (Macro_File, First_Line (First_Line'First)'Address, First_Line'Length); OK := Len = First_Line'Length; end if; if OK then Len := Write (Macro_File, Second_Line (Second_Line'First)'Address, Second_Line'Length); OK := Len = Second_Line'Length; end if; if OK then Len := Write (Macro_File, Third_Line (Third_Line'First)'Address, Third_Line'Length); OK := Len = Third_Line'Length; end if; if OK then Len := Write (Macro_File, Fourth_Line (Fourth_Line'First)'Address, Fourth_Line'Length); OK := Len = Fourth_Line'Length; end if; if OK then Len := Write (Macro_File, Fifth_Line (Fifth_Line'First)'Address, Fifth_Line'Length); OK := Len = Fifth_Line'Length; end if; if OK then Close (Macro_File, OK); end if; if not OK then Fail ("creation of auto-init assembly file """, Macro_File_Name, """ failed"); end if; end; -- Invoke the macro-assembler if Verbose_Mode then Write_Str ("Assembling auto-init assembly file """); Write_Str (Macro_File_Name); Write_Line (""""); end if; Popen_Result := popen (command (command'First)'Address, mode (mode'First)'Address); if Popen_Result = Null_Address then Fail ("assembly of auto-init assembly file """, Macro_File_Name, """ failed"); end if; -- Wait for the end of execution of the macro-assembler Pclose_Result := pclose (Popen_Result); if Pclose_Result < 0 then Fail ("assembly of auto init assembly file """, Macro_File_Name, """ failed"); end if; -- Add the generated object file to the list of objects to be -- included in the library. Additional_Objects := new Argument_List' (1 => new String'(Lib_Filename & "__init.obj")); end; end if; -- Allocate the argument list and put the symbol file name, the -- reference (if any) and the policy (if not autonomous). Arguments := new Argument_List (1 .. Ofiles'Length + 8); Last_Argument := 0; -- Verbosity if Verbose_Mode then Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'("-v"); end if; -- Version number (major ID) if Lib_Version /= "" then Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'("-V"); Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'(Version); end if; -- Symbol file Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'("-s"); Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'(Opt_File_Name); -- Reference Symbol File if Symbol_Data.Reference /= No_Name then Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'("-r"); Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'(Get_Name_String (Symbol_Data.Reference)); end if; -- Policy case Symbol_Data.Symbol_Policy is when Autonomous => null; when Compliant => Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'("-c"); when Controlled => Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'("-C"); when Restricted => Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'("-R"); end case; -- Add each relevant object file for Index in Ofiles'Range loop if Is_Interface (Ofiles (Index).all) then Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := new String'(Ofiles (Index).all); end if; end loop; -- Spawn gnatsym Spawn (Program_Name => Gnatsym_Path.all, Args => Arguments (1 .. Last_Argument), Success => Success); if not Success then Fail ("unable to create symbol file for library """, Lib_Filename, """"); end if; Free (Arguments); -- Move all the -l switches from Opts to Opts2 declare Index : Natural := Opts'First; Opt : String_Access; begin while Index <= Last_Opt loop Opt := Opts (Index); if Opt'Length > 2 and then Opt (Opt'First .. Opt'First + 1) = "-l" then if Index < Last_Opt then Opts (Index .. Last_Opt - 1) := Opts (Index + 1 .. Last_Opt); end if; Last_Opt := Last_Opt - 1; Last_Opt2 := Last_Opt2 + 1; Opts2 (Last_Opt2) := Opt; else Index := Index + 1; end if; end loop; end; -- Invoke gcc to build the library Utl.Gcc (Output_File => Lib_File, Objects => Ofiles & Additional_Objects.all, Options => VMS_Options, Options_2 => Link_With_Shared_Libgcc.all & Opts (Opts'First .. Last_Opt) & Opts2 (Opts2'First .. Last_Opt2) & Options_2, Driver_Name => Driver_Name); -- The auto-init object file need to be deleted, so that it will not -- be included in the library as a regular object file, otherwise -- it will be included twice when the library will be built next -- time, which may lead to errors. if Auto_Init then declare Auto_Init_Object_File_Name : constant String := Lib_Filename & "__init.obj"; Disregard : Boolean; begin if Verbose_Mode then Write_Str ("deleting auto-init object file """); Write_Str (Auto_Init_Object_File_Name); Write_Line (""""); end if; Delete_File (Auto_Init_Object_File_Name, Success => Disregard); end; end if; end Build_Dynamic_Library; ------------- -- DLL_Ext -- ------------- function DLL_Ext return String is begin return "exe"; end DLL_Ext; ---------------- -- DLL_Prefix -- ---------------- function DLL_Prefix return String is begin return "lib"; end DLL_Prefix; -------------------- -- Dynamic_Option -- -------------------- function Dynamic_Option return String is begin return "-shared"; end Dynamic_Option; ------------------- -- Is_Object_Ext -- ------------------- function Is_Object_Ext (Ext : String) return Boolean is begin return Ext = ".obj"; end Is_Object_Ext; -------------- -- Is_C_Ext -- -------------- function Is_C_Ext (Ext : String) return Boolean is begin return Ext = ".c"; end Is_C_Ext; -------------------- -- Is_Archive_Ext -- -------------------- function Is_Archive_Ext (Ext : String) return Boolean is begin return Ext = ".olb" or else Ext = ".exe"; end Is_Archive_Ext; ------------- -- Libgnat -- ------------- function Libgnat return String is Libgnat_A : constant String := "libgnat.a"; Libgnat_Olb : constant String := "libgnat.olb"; begin Name_Len := Libgnat_A'Length; Name_Buffer (1 .. Name_Len) := Libgnat_A; if Osint.Find_File (Name_Enter, Osint.Library) /= No_File then return Libgnat_A; else return Libgnat_Olb; end if; end Libgnat; ------------------------ -- Library_Exists_For -- ------------------------ function Library_Exists_For (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean is begin if not In_Tree.Projects.Table (Project).Library then Fail ("INTERNAL ERROR: Library_Exists_For called " & "for non library project"); return False; else declare Lib_Dir : constant String := Get_Name_String (In_Tree.Projects.Table (Project).Library_Dir); Lib_Name : constant String := Get_Name_String (In_Tree.Projects.Table (Project).Library_Name); begin if In_Tree.Projects.Table (Project).Library_Kind = Static then return Is_Regular_File (Lib_Dir & Directory_Separator & "lib" & Fil.Ext_To (Lib_Name, Archive_Ext)); else return Is_Regular_File (Lib_Dir & Directory_Separator & "lib" & Fil.Ext_To (Lib_Name, DLL_Ext)); end if; end; end if; end Library_Exists_For; --------------------------- -- Library_File_Name_For -- --------------------------- function Library_File_Name_For (Project : Project_Id; In_Tree : Project_Tree_Ref) return Name_Id is begin if not In_Tree.Projects.Table (Project).Library then Prj.Com.Fail ("INTERNAL ERROR: Library_File_Name_For called " & "for non library project"); return No_Name; else declare Lib_Name : constant String := Get_Name_String (In_Tree.Projects.Table (Project).Library_Name); begin Name_Len := 3; Name_Buffer (1 .. Name_Len) := "lib"; if In_Tree.Projects.Table (Project).Library_Kind = Static then Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); else Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); end if; return Name_Find; end; end if; end Library_File_Name_For; ---------------- -- Object_Ext -- ---------------- function Object_Ext return String is begin return "obj"; end Object_Ext; ---------------- -- PIC_Option -- ---------------- function PIC_Option return String is begin return ""; end PIC_Option; ----------------------------------------------- -- Standalone_Library_Auto_Init_Is_Supported -- ----------------------------------------------- function Standalone_Library_Auto_Init_Is_Supported return Boolean is begin return True; end Standalone_Library_Auto_Init_Is_Supported; --------------------------- -- Support_For_Libraries -- --------------------------- function Support_For_Libraries return Library_Support is begin return Full; end Support_For_Libraries; end MLib.Tgt;
-- C95041A.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 AN ENTRY FAMILY INDEX CAN BE SPECIFIED WITH THE FORM -- A'RANGE. -- HISTORY: -- DHH 03/17/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C95041A IS GLOBAL_A, GLOBAL_B : INTEGER; GLOBAL_C, GLOBAL_D : INTEGER; TYPE COLOR IS (RED, BLUE, YELLOW); TYPE ARR IS ARRAY(COLOR RANGE RED .. BLUE) OF BOOLEAN; ARRY : ARR; TASK CHECK IS ENTRY CHECK_LINK(ARR'RANGE)(I : INTEGER); END CHECK; TASK CHECK_OBJ IS ENTRY CHECK_OBJ_LINK(ARRY'RANGE)(I : INTEGER); END CHECK_OBJ; TASK BODY CHECK IS BEGIN ACCEPT CHECK_LINK(RED)(I : INTEGER) DO GLOBAL_A := IDENT_INT(I); END; ACCEPT CHECK_LINK(BLUE)(I : INTEGER) DO GLOBAL_B := IDENT_INT(I); END; END CHECK; TASK BODY CHECK_OBJ IS BEGIN ACCEPT CHECK_OBJ_LINK(RED)(I : INTEGER) DO GLOBAL_C := IDENT_INT(I); END; ACCEPT CHECK_OBJ_LINK(BLUE)(I : INTEGER) DO GLOBAL_D := IDENT_INT(I); END; END CHECK_OBJ; BEGIN TEST("C95041A", "CHECK THAT AN ENTRY FAMILY INDEX CAN BE " & "SPECIFIED WITH THE FORM A'RANGE"); CHECK.CHECK_LINK(RED)(10); CHECK.CHECK_LINK(BLUE)(5); CHECK_OBJ.CHECK_OBJ_LINK(RED)(10); CHECK_OBJ.CHECK_OBJ_LINK(BLUE)(5); IF GLOBAL_A /= IDENT_INT(10) THEN FAILED("ENTRY CHECK_LINK(RED) HAS INCORRECT VALUE"); END IF; IF GLOBAL_B /= IDENT_INT(5) THEN FAILED("ENTRY CHECK_LINK(BLUE) HAS INCORRECT VALUE"); END IF; IF GLOBAL_C /= IDENT_INT(10) THEN FAILED("ENTRY CHECK_LINK(RED) HAS INCORRECT VALUE"); END IF; IF GLOBAL_D /= IDENT_INT(5) THEN FAILED("ENTRY CHECK_LINK(BLUE) HAS INCORRECT VALUE"); END IF; RESULT; END C95041A;
pragma Check_Policy (Validate => Disable); -- with Ada.Strings.Naked_Maps.Debug; with Ada.Strings.Naked_Maps.General_Category; with System.Once; with System.Reference_Counting; package body Ada.Strings.Naked_Maps.Set_Constants is function Total_Length (Source : Character_Set_Array) return Natural; function Total_Length (Source : Character_Set_Array) return Natural is Result : Natural := 0; begin for I in Source'Range loop Result := Result + Source (I).Length; end loop; return Result; end Total_Length; type Character_Set_Access_With_Pool is access Character_Set_Data; -- implementation Decimal_Digit_Set_Data : Character_Set_Access_With_Pool; Decimal_Digit_Flag : aliased System.Once.Flag := 0; procedure Decimal_Digit_Init; procedure Decimal_Digit_Init is begin Decimal_Digit_Set_Data := new Character_Set_Data'( Length => 1, Reference_Count => System.Reference_Counting.Static, Items => (1 => ('0', '9'))); pragma Check (Validate, Debug.Valid (Decimal_Digit_Set_Data.all)); end Decimal_Digit_Init; function Decimal_Digit_Set return not null Character_Set_Access is begin System.Once.Initialize ( Decimal_Digit_Flag'Access, Decimal_Digit_Init'Access); return Character_Set_Access (Decimal_Digit_Set_Data); end Decimal_Digit_Set; Hexadecimal_Digit_Set_Data : Character_Set_Access_With_Pool; Hexadecimal_Digit_Flag : aliased System.Once.Flag := 0; procedure Hexadecimal_Digit_Init; procedure Hexadecimal_Digit_Init is begin Hexadecimal_Digit_Set_Data := new Character_Set_Data'( Length => 3, Reference_Count => System.Reference_Counting.Static, Items => (('0', '9'), ('A', 'F'), ('a', 'f'))); pragma Check (Validate, Debug.Valid (Hexadecimal_Digit_Set_Data.all)); end Hexadecimal_Digit_Init; function Hexadecimal_Digit_Set return not null Character_Set_Access is begin System.Once.Initialize ( Hexadecimal_Digit_Flag'Access, Hexadecimal_Digit_Init'Access); return Character_Set_Access (Hexadecimal_Digit_Set_Data); end Hexadecimal_Digit_Set; ISO_646_Set_Data : Character_Set_Access_With_Pool; ISO_646_Flag : aliased System.Once.Flag := 0; procedure ISO_646_Init; procedure ISO_646_Init is begin ISO_646_Set_Data := new Character_Set_Data'( Length => 1, Reference_Count => System.Reference_Counting.Static, Items => (1 => (Character_Type'Val (0), Character_Type'Val (16#7F#)))); pragma Check (Validate, Debug.Valid (ISO_646_Set_Data.all)); end ISO_646_Init; function ISO_646_Set return not null Character_Set_Access is begin System.Once.Initialize ( ISO_646_Flag'Access, ISO_646_Init'Access); return Character_Set_Access (ISO_646_Set_Data); end ISO_646_Set; Wide_Character_Set_Data : Character_Set_Access_With_Pool; Wide_Character_Flag : aliased System.Once.Flag := 0; procedure Wide_Character_Init; procedure Wide_Character_Init is begin Wide_Character_Set_Data := new Character_Set_Data'( Length => 2, Reference_Count => System.Reference_Counting.Static, Items => ( 1 => ( Character_Type'Val (0), Character_Type'Val (16#D7FF#)), 2 => ( Character_Type'Val (16#E000#), Character_Type'Val (16#FFFF#)))); pragma Check (Validate, Debug.Valid (Wide_Character_Set_Data.all)); end Wide_Character_Init; function Wide_Character_Set return not null Character_Set_Access is begin System.Once.Initialize ( Wide_Character_Flag'Access, Wide_Character_Init'Access); return Character_Set_Access (Wide_Character_Set_Data); end Wide_Character_Set; Letter_Set_Data : Character_Set_Access_With_Pool; Letter_Flag : aliased System.Once.Flag := 0; procedure Letter_Init; procedure Letter_Init is Source : Character_Set_Array := ( General_Category.Lowercase_Letter, General_Category.Uppercase_Letter, General_Category.Titlecase_Letter, General_Category.Modifier_Letter, General_Category.Other_Letter); Items : Character_Ranges (1 .. Total_Length (Source)); Last : Natural; begin Union (Items, Last, Source); Letter_Set_Data := new Character_Set_Data'( Length => Last, Reference_Count => System.Reference_Counting.Static, Items => Items (1 .. Last)); pragma Check (Validate, Debug.Valid (Letter_Set_Data.all)); end Letter_Init; function Letter_Set return not null Character_Set_Access is begin System.Once.Initialize ( Letter_Flag'Access, Letter_Init'Access); return Character_Set_Access (Letter_Set_Data); end Letter_Set; Alphanumeric_Set_Data : Character_Set_Access_With_Pool; Alphanumeric_Flag : aliased System.Once.Flag := 0; procedure Alphanumeric_Init; procedure Alphanumeric_Init is Source : Character_Set_Array := ( Letter_Set, General_Category.Decimal_Number, General_Category.Letter_Number, General_Category.Other_Number); Items : Character_Ranges (1 .. Total_Length (Source)); Last : Natural; begin Union (Items, Last, Source); Alphanumeric_Set_Data := new Character_Set_Data'( Length => Last, Reference_Count => System.Reference_Counting.Static, Items => Items (1 .. Last)); pragma Check (Validate, Debug.Valid (Alphanumeric_Set_Data.all)); end Alphanumeric_Init; function Alphanumeric_Set return not null Character_Set_Access is begin System.Once.Initialize ( Alphanumeric_Flag'Access, Alphanumeric_Init'Access); return Character_Set_Access (Alphanumeric_Set_Data); end Alphanumeric_Set; Special_Set_Data : Character_Set_Access_With_Pool; Special_Flag : aliased System.Once.Flag := 0; procedure Special_Init; procedure Special_Init is Source : Character_Set_Array := ( General_Category.Nonspacing_Mark, General_Category.Enclosing_Mark, General_Category.Spacing_Mark, General_Category.Space_Separator, General_Category.Dash_Punctuation, General_Category.Open_Punctuation, General_Category.Close_Punctuation, General_Category.Connector_Punctuation, General_Category.Other_Punctuation, General_Category.Math_Symbol, General_Category.Currency_Symbol, General_Category.Modifier_Symbol, General_Category.Other_Symbol, General_Category.Initial_Punctuation, General_Category.Final_Punctuation); Items : Character_Ranges (1 .. Total_Length (Source)); Last : Natural; begin Union (Items, Last, Source); Special_Set_Data := new Character_Set_Data'( Length => Last, Reference_Count => System.Reference_Counting.Static, Items => Items (1 .. Last)); pragma Check (Validate, Debug.Valid (Special_Set_Data.all)); end Special_Init; function Special_Set return not null Character_Set_Access is begin System.Once.Initialize ( Special_Flag'Access, Special_Init'Access); return Character_Set_Access (Special_Set_Data); end Special_Set; Graphic_Set_Data : Character_Set_Access_With_Pool; Graphic_Flag : aliased System.Once.Flag := 0; procedure Graphic_Init; procedure Graphic_Init is Items : Character_Ranges ( 1 .. Alphanumeric_Set.Length + Special_Set.Length); Last : Natural; begin Union (Items, Last, Alphanumeric_Set.Items, Special_Set.Items); Graphic_Set_Data := new Character_Set_Data'( Length => Last, Reference_Count => System.Reference_Counting.Static, Items => Items (1 .. Last)); pragma Check (Validate, Debug.Valid (Graphic_Set_Data.all)); end Graphic_Init; function Graphic_Set return not null Character_Set_Access is begin System.Once.Initialize ( Graphic_Flag'Access, Graphic_Init'Access); return Character_Set_Access (Graphic_Set_Data); end Graphic_Set; end Ada.Strings.Naked_Maps.Set_Constants;
----------------------------------------------------------------------- -- asf-events-exceptions -- Exceptions Events -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Events; with Ada.Exceptions; with Ada.Containers.Vectors; package ASF.Events.Exceptions is -- ------------------------------ -- Exception event -- ------------------------------ -- The <b>Exception_Event</b> represents an exception that is raised while processing -- a request. If is posted by the ASF framework when an unhandled exception is caught. -- An application can also publish such event when necessary. -- -- After each lifecycle phase, the exception handler is invoked to process the -- <b>Exception_Event</b> that have been queued. type Exception_Event is new Util.Events.Event with record Ex : Ada.Exceptions.Exception_Occurrence; end record; type Exception_Event_Access is access all Exception_Event'Class; -- Get the exception name. function Get_Exception_Name (Event : in Exception_Event) return String; -- Get the exception name. function Get_Exception_Message (Event : in Exception_Event) return String; -- Create an exception event with the given exception. function Create_Exception_Event (Ex : in Ada.Exceptions.Exception_Occurrence) return Exception_Event_Access; package Event_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Exception_Event_Access); subtype Exception_Event_Vector is Event_Vectors.Vector; subtype Exception_Event_Cursor is Event_Vectors.Cursor; end ASF.Events.Exceptions;
-- Ada regular expression library -- (c) Kristian Klomsten Skordal 2020-2021 <kristian.skordal@wafflemail.net> -- Report bugs and issues on <https://github.com/skordal/ada-regex> with AUnit.Test_Fixtures; private with Regex.Regular_Expressions; package Regex_Test_Cases is type Test_Fixture is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Single_Character (T : in out Test_Fixture); procedure Test_Kleene_Closure (T : in out Test_Fixture); procedure Test_Concatenation (T : in out Test_Fixture); procedure Test_Alternation_Single (T : in out Test_Fixture); procedure Test_Alternation_Multiple (T : in out Test_Fixture); procedure Test_Dragon_Example (T : in out Test_Fixture); procedure Test_Any_Char_Single (T : in out Test_Fixture); procedure Test_Any_Char_Optional (T : in out Test_Fixture); procedure Test_Any_Alternate (T : in out Test_Fixture); procedure Test_Escape_Seqs (T : in out Test_Fixture); procedure Test_Quotes (T : in out Test_Fixture); procedure Test_Single_Quotes (T : in out Test_Fixture); procedure Test_Single_Range (T : in out Test_Fixture); procedure Test_Multiple_Ranges (T : in out Test_Fixture); procedure Test_Ranges_And_Chars (T : in out Test_Fixture); procedure Test_Plus_Operator (T : in out Test_Fixture); procedure Test_Hexadecimal (T : in out Test_Fixture); procedure Test_Question_Operator (T : in out Test_Fixture); procedure Test_Partial_Matching (T : in out Test_Fixture); procedure Test_Newlines (T : in out Test_Fixture); procedure Test_Syntax_Tree_Compile (T : in out Test_Fixture); procedure Test_Multiple_Accept (T : in out Test_Fixture); private use Regex.Regular_Expressions; procedure Matches_Empty_Strings (Regex : in Regular_Expression) with Inline; procedure Does_Not_Match_Empty_Strings (Regex : in Regular_Expression) with Inline; procedure Matches (Regex : in Regular_Expression; Matching : in String) with Inline; procedure Matches (Regex : in Regular_Expression; Matching : in String; Expected_Id : in Natural) with Inline; procedure Does_Not_Match (Regex : in Regular_Expression; Not_Matching : in String) with Inline; end Regex_Test_Cases;
------------------------------------------------------------------------------ -- 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 body Asis.Gela.Elements.Assoc is function Formal_Parameter (Element : Pragma_Argument_Association_Node) return Asis.Identifier is begin return Element.Formal_Parameter; end Formal_Parameter; procedure Set_Formal_Parameter (Element : in out Pragma_Argument_Association_Node; Value : in Asis.Identifier) is begin Element.Formal_Parameter := Value; end Set_Formal_Parameter; function Actual_Parameter (Element : Pragma_Argument_Association_Node) return Asis.Expression is begin return Element.Actual_Parameter; end Actual_Parameter; procedure Set_Actual_Parameter (Element : in out Pragma_Argument_Association_Node; Value : in Asis.Expression) is begin Element.Actual_Parameter := Value; end Set_Actual_Parameter; function New_Pragma_Argument_Association_Node (The_Context : ASIS.Context) return Pragma_Argument_Association_Ptr is Result : Pragma_Argument_Association_Ptr := new Pragma_Argument_Association_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Pragma_Argument_Association_Node; function Association_Kind (Element : Pragma_Argument_Association_Node) return Asis.Association_Kinds is begin return A_Pragma_Argument_Association; end; function Children (Element : access Pragma_Argument_Association_Node) return Traverse_List is begin return ((False, Element.Formal_Parameter'Access), (False, Element.Actual_Parameter'Access)); end Children; function Clone (Element : Pragma_Argument_Association_Node; Parent : Asis.Element) return Asis.Element is Result : constant Pragma_Argument_Association_Ptr := new Pragma_Argument_Association_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Pragma_Argument_Association_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Formal_Parameter := Copy (Cloner, Formal_Parameter (Source.all), Asis.Element (Target)); Target.Actual_Parameter := Copy (Cloner, Actual_Parameter (Source.all), Asis.Element (Target)); end Copy; function Is_Normalized (Element : Parameter_Association_Node) return Boolean is begin return Element.Is_Normalized; end Is_Normalized; procedure Set_Is_Normalized (Element : in out Parameter_Association_Node; Value : in Boolean) is begin Element.Is_Normalized := Value; end Set_Is_Normalized; function Is_Defaulted_Association (Element : Parameter_Association_Node) return Boolean is begin return Element.Is_Defaulted_Association; end Is_Defaulted_Association; procedure Set_Is_Defaulted_Association (Element : in out Parameter_Association_Node; Value : in Boolean) is begin Element.Is_Defaulted_Association := Value; end Set_Is_Defaulted_Association; function New_Parameter_Association_Node (The_Context : ASIS.Context) return Parameter_Association_Ptr is Result : Parameter_Association_Ptr := new Parameter_Association_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Parameter_Association_Node; function Association_Kind (Element : Parameter_Association_Node) return Asis.Association_Kinds is begin return A_Parameter_Association; end; function Clone (Element : Parameter_Association_Node; Parent : Asis.Element) return Asis.Element is Result : constant Parameter_Association_Ptr := new Parameter_Association_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Is_Normalized := Element.Is_Normalized; Result.Is_Defaulted_Association := Element.Is_Defaulted_Association; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Parameter_Association_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Formal_Parameter := Copy (Cloner, Formal_Parameter (Source.all), Asis.Element (Target)); Target.Actual_Parameter := Copy (Cloner, Actual_Parameter (Source.all), Asis.Element (Target)); end Copy; function New_Generic_Association_Node (The_Context : ASIS.Context) return Generic_Association_Ptr is Result : Generic_Association_Ptr := new Generic_Association_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Generic_Association_Node; function Association_Kind (Element : Generic_Association_Node) return Asis.Association_Kinds is begin return A_Generic_Association; end; function Clone (Element : Generic_Association_Node; Parent : Asis.Element) return Asis.Element is Result : constant Generic_Association_Ptr := new Generic_Association_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Is_Normalized := Element.Is_Normalized; Result.Is_Defaulted_Association := Element.Is_Defaulted_Association; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Generic_Association_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Target.Formal_Parameter := Copy (Cloner, Formal_Parameter (Source.all), Asis.Element (Target)); Target.Actual_Parameter := Copy (Cloner, Actual_Parameter (Source.all), Asis.Element (Target)); end Copy; function Is_Normalized (Element : Discriminant_Association_Node) return Boolean is begin return Element.Is_Normalized; end Is_Normalized; procedure Set_Is_Normalized (Element : in out Discriminant_Association_Node; Value : in Boolean) is begin Element.Is_Normalized := Value; end Set_Is_Normalized; function Discriminant_Expression (Element : Discriminant_Association_Node) return Asis.Expression is begin return Element.Discriminant_Expression; end Discriminant_Expression; procedure Set_Discriminant_Expression (Element : in out Discriminant_Association_Node; Value : in Asis.Expression) is begin Element.Discriminant_Expression := Value; end Set_Discriminant_Expression; function Discriminant_Selector_Name (Element : Discriminant_Association_Node) return Asis.Expression is begin return Element.Discriminant_Selector_Name; end Discriminant_Selector_Name; procedure Set_Discriminant_Selector_Name (Element : in out Discriminant_Association_Node; Value : in Asis.Expression) is begin Element.Discriminant_Selector_Name := Value; end Set_Discriminant_Selector_Name; function Discriminant_Selector_Names (Element : Discriminant_Association_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Choise_Lists.To_Element_List (Element.Discriminant_Selector_Names, Include_Pragmas); end Discriminant_Selector_Names; procedure Set_Discriminant_Selector_Names (Element : in out Discriminant_Association_Node; Value : in Asis.Element) is begin Element.Discriminant_Selector_Names := Primary_Choise_Lists.List (Value); end Set_Discriminant_Selector_Names; function Discriminant_Selector_Names_List (Element : Discriminant_Association_Node) return Asis.Element is begin return Asis.Element (Element.Discriminant_Selector_Names); end Discriminant_Selector_Names_List; function New_Discriminant_Association_Node (The_Context : ASIS.Context) return Discriminant_Association_Ptr is Result : Discriminant_Association_Ptr := new Discriminant_Association_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Discriminant_Association_Node; function Association_Kind (Element : Discriminant_Association_Node) return Asis.Association_Kinds is begin return A_Discriminant_Association; end; function Children (Element : access Discriminant_Association_Node) return Traverse_List is begin if Element.Is_Normalized then return ((False, Element.Discriminant_Selector_Name'Access), (False, Element.Discriminant_Expression'Access)); end if; return ((True, Asis.Element (Element.Discriminant_Selector_Names)), (False, Element.Discriminant_Expression'Access)); end Children; function Clone (Element : Discriminant_Association_Node; Parent : Asis.Element) return Asis.Element is Result : constant Discriminant_Association_Ptr := new Discriminant_Association_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Is_Normalized := Element.Is_Normalized; Result.Discriminant_Selector_Name := Element.Discriminant_Selector_Name; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Discriminant_Association_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Discriminant_Selector_Names (Target.all, Primary_Choise_Lists.Deep_Copy (Discriminant_Selector_Names (Source.all), Cloner, Asis.Element (Target))); Target.Discriminant_Expression := Copy (Cloner, Discriminant_Expression (Source.all), Asis.Element (Target)); end Copy; function Is_Normalized (Element : Record_Component_Association_Node) return Boolean is begin return Element.Is_Normalized; end Is_Normalized; procedure Set_Is_Normalized (Element : in out Record_Component_Association_Node; Value : in Boolean) is begin Element.Is_Normalized := Value; end Set_Is_Normalized; function Component_Expression (Element : Record_Component_Association_Node) return Asis.Expression is begin return Element.Component_Expression; end Component_Expression; procedure Set_Component_Expression (Element : in out Record_Component_Association_Node; Value : in Asis.Expression) is begin Element.Component_Expression := Value; end Set_Component_Expression; function Record_Component_Choice (Element : Record_Component_Association_Node) return Asis.Defining_Name is begin return Element.Record_Component_Choice; end Record_Component_Choice; procedure Set_Record_Component_Choice (Element : in out Record_Component_Association_Node; Value : in Asis.Defining_Name) is begin Element.Record_Component_Choice := Value; end Set_Record_Component_Choice; function Record_Component_Choices (Element : Record_Component_Association_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Choise_Lists.To_Element_List (Element.Record_Component_Choices, Include_Pragmas); end Record_Component_Choices; procedure Set_Record_Component_Choices (Element : in out Record_Component_Association_Node; Value : in Asis.Element) is begin Element.Record_Component_Choices := Primary_Choise_Lists.List (Value); end Set_Record_Component_Choices; function Record_Component_Choices_List (Element : Record_Component_Association_Node) return Asis.Element is begin return Asis.Element (Element.Record_Component_Choices); end Record_Component_Choices_List; function New_Record_Component_Association_Node (The_Context : ASIS.Context) return Record_Component_Association_Ptr is Result : Record_Component_Association_Ptr := new Record_Component_Association_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Record_Component_Association_Node; function Association_Kind (Element : Record_Component_Association_Node) return Asis.Association_Kinds is begin return A_Record_Component_Association; end; function Children (Element : access Record_Component_Association_Node) return Traverse_List is begin if Element.Is_Normalized then return ((False, Element.Record_Component_Choice'Access), (False, Element.Component_Expression'Access)); end if; return ((True, Asis.Element (Element.Record_Component_Choices)), (False, Element.Component_Expression'Access)); end Children; function Clone (Element : Record_Component_Association_Node; Parent : Asis.Element) return Asis.Element is Result : constant Record_Component_Association_Ptr := new Record_Component_Association_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; Result.Is_Normalized := Element.Is_Normalized; Result.Record_Component_Choice := Element.Record_Component_Choice; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Record_Component_Association_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Record_Component_Choices (Target.all, Primary_Choise_Lists.Deep_Copy (Record_Component_Choices (Source.all), Cloner, Asis.Element (Target))); Target.Component_Expression := Copy (Cloner, Component_Expression (Source.all), Asis.Element (Target)); end Copy; function Array_Component_Choices (Element : Array_Component_Association_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is begin return Primary_Choise_Lists.To_Element_List (Element.Array_Component_Choices, Include_Pragmas); end Array_Component_Choices; procedure Set_Array_Component_Choices (Element : in out Array_Component_Association_Node; Value : in Asis.Element) is begin Element.Array_Component_Choices := Primary_Choise_Lists.List (Value); end Set_Array_Component_Choices; function Array_Component_Choices_List (Element : Array_Component_Association_Node) return Asis.Element is begin return Asis.Element (Element.Array_Component_Choices); end Array_Component_Choices_List; function Component_Expression (Element : Array_Component_Association_Node) return Asis.Expression is begin return Element.Component_Expression; end Component_Expression; procedure Set_Component_Expression (Element : in out Array_Component_Association_Node; Value : in Asis.Expression) is begin Element.Component_Expression := Value; end Set_Component_Expression; function New_Array_Component_Association_Node (The_Context : ASIS.Context) return Array_Component_Association_Ptr is Result : Array_Component_Association_Ptr := new Array_Component_Association_Node; begin Set_Enclosing_Compilation_Unit (Result.all, Current_Unit (The_Context.all)); return Result; end New_Array_Component_Association_Node; function Association_Kind (Element : Array_Component_Association_Node) return Asis.Association_Kinds is begin return An_Array_Component_Association; end; function Children (Element : access Array_Component_Association_Node) return Traverse_List is begin return ((True, Asis.Element (Element.Array_Component_Choices)), (False, Element.Component_Expression'Access)); end Children; function Clone (Element : Array_Component_Association_Node; Parent : Asis.Element) return Asis.Element is Result : constant Array_Component_Association_Ptr := new Array_Component_Association_Node; begin Result.Enclosing_Element := Parent; Result.Is_Part_Of_Implicit := Element.Is_Part_Of_Implicit; Result.Is_Part_Of_Inherited := Element.Is_Part_Of_Inherited; Result.Is_Part_Of_Instance := Element.Is_Part_Of_Instance; Result.Start_Position := Element.Start_Position; Result.End_Position := Element.End_Position; Result.Enclosing_Compilation_Unit := Enclosing_Compilation_Unit (Parent.all); Result.Hash := Element.Hash; return Asis.Element (Result); end Clone; procedure Copy (Source : in Asis.Element; Target : access Array_Component_Association_Node; Cloner : in Cloner_Class; Parent : in Asis.Element) is begin Set_Array_Component_Choices (Target.all, Primary_Choise_Lists.Deep_Copy (Array_Component_Choices (Source.all), Cloner, Asis.Element (Target))); Target.Component_Expression := Copy (Cloner, Component_Expression (Source.all), Asis.Element (Target)); end Copy; end Asis.Gela.Elements.Assoc;
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr> -- MIT license. Please refer to the LICENSE file. with Ada.Text_IO; with Apsepp.Test_Node_Class; with Apsepp.Abstract_Early_Test_Case; package body Apsepp.Test_Reporter_Class.Instant_Standard is use Test_Node_Class; ---------------------------------------------------------------------------- Child_Acc : constant String := "accessing child"; Child_Acc_1 : constant String := "accessing first child"; Early_R : constant String := "early test routine"; Start : constant String := "Start "; Cond_Checking : constant String := "condition checking"; Cond_Assert : constant String := "condition assertion"; Early_R_Not_Run : constant String := " (" & Early_R & " not run)"; Test_Assert : constant String := "test assertion"; Ru : constant String := "run"; Unexp_Error : constant String := "UNEXPECTED ERROR while "; ---------------------------------------------------------------------------- function Is_Early_Test (Node_Tag : Tag) return Boolean is (Is_Descendant_At_Same_Level (Node_Tag, Abstract_Early_Test_Case.Early_Test_Case'Tag)); ---------------------------------------------------------------------------- function Early_R_Not_Run_Compliment (Node_Tag : Tag; Str : String) return String is (Str & (if Is_Early_Test (Node_Tag) then Early_R_Not_Run else "")); ---------------------------------------------------------------------------- generic type Integer_Type is range <>; Designation : String; function Kth (K : Integer_Type; K_Avail : Boolean := True) return String; ---------------------------------------------------------------------------- function Kth (K : Integer_Type; K_Avail : Boolean := True) return String is K_Str : String := (if K_Avail then Integer_Type'Image (K) else " [unavailable]"); begin K_Str(K_Str'First) := '#'; return Designation & " " & K_Str; end Kth; ---------------------------------------------------------------------------- function Kth_Routine_Access is new Kth (Integer_Type => Test_Routine_Count, Designation => "access to test routine"); ---------------------------------------------------------------------------- function Kth_Routine_Setup is new Kth (Integer_Type => Test_Routine_Count, Designation => "setup of test routine"); ---------------------------------------------------------------------------- function Kth_Routine is new Kth (Integer_Type => Test_Routine_Count, Designation => "test routine"); ---------------------------------------------------------------------------- function From_Kth_Routine is new Kth (Integer_Type => Test_Routine_Count, Designation => "test routines"); ---------------------------------------------------------------------------- function To_Kth_Routine is new Kth (Integer_Type => Test_Routine_Count, Designation => " to"); ---------------------------------------------------------------------------- function Kth_Test_Assert is new Kth (Integer_Type => Test_Assert_Count, Designation => Test_Assert); ---------------------------------------------------------------------------- function Kth_Kth (K_A_Avail : Boolean; K_A : Test_Assert_Count; K_R : Test_Routine_Count) return String is (Kth_Test_Assert (K_A, K_A_Avail) & " for " & Kth_Routine (K_R)); ---------------------------------------------------------------------------- function Routine_Range (First_K, Last_K : Test_Routine_Count) return String is (if Last_K = First_K then Kth_Routine (First_K) else From_Kth_Routine (First_K) & To_Kth_Routine (Last_K)); ---------------------------------------------------------------------------- function Outcome_Prepended (Outcome : Test_Outcome; Head : String) return String is ((case Outcome is when Failed => "FAILED", when Passed => "Passed") & " " & Head); ---------------------------------------------------------------------------- function Test_Node_W_Tag (Node_Tag : Tag) return String is (" test node with tag " & Expanded_Name (Node_Tag)); ---------------------------------------------------------------------------- procedure Put_Exception_Message (Name, Message : String; Quiet_If_Zero_Length_Message : Boolean := False) is Zero_Length_Name : constant Boolean := Name'Length = 0; Zero_Length_Message : constant Boolean := Message'Length = 0; Quiet : constant Boolean := Zero_Length_Message and then Quiet_If_Zero_Length_Message; begin if not Quiet then Ada.Text_IO.New_Line; if Zero_Length_Message then Ada.Text_IO.Put_Line(Name); else Ada.Text_IO.Put_Line(Name & (if Zero_Length_Name then "" else ": ") & Message); end if; Ada.Text_IO.New_Line; end if; end Put_Exception_Message; ---------------------------------------------------------------------------- procedure Put_Report_Line (Head : String; Node_Tag : Tag; Prev_Brother : Tag := No_Tag) is use Ada.Text_IO; Next_Brother : constant String := (if Prev_Brother = No_Tag then "" else " (next sibling of" & Test_Node_W_Tag (Prev_Brother) & ")"); begin Put_Line (Head & " for" & Test_Node_W_Tag (Node_Tag) & Next_Brother); end Put_Report_Line; ---------------------------------------------------------------------------- procedure Report_Test_Assert_Outcome (Node_Tag : Tag; Outcome : Test_Outcome; K : Test_Routine_Count; Assert_Num_Avail : Boolean; Assert_Num : Test_Assert_Count) is begin Put_Report_Line (Outcome_Prepended (Outcome, (if Is_Early_Test (Node_Tag) then Early_R else Kth_Kth (Assert_Num_Avail, Assert_Num, K))), Node_Tag); end Report_Test_Assert_Outcome; ---------------------------------------------------------------------------- protected body Test_Reporter_Instant_Standard is ----------------------------------------------------- function Is_Conflicting_Node_Tag (Node_Tag : Tag) return Boolean is (False); ----------------------------------------------------- procedure Provide_Node_Lineage (Node_Lineage : Tag_Array) is pragma Unreferenced (Node_Lineage); begin null; end Provide_Node_Lineage; ----------------------------------------------------- procedure Report_Failed_Child_Test_Node_Access (Node_Tag : Tag; Previous_Child_Tag : Tag; E : Exception_Occurrence) is begin if Previous_Child_Tag = No_Tag then Put_Report_Line (Outcome_Prepended (Failed, Child_Acc_1), Node_Tag); else Put_Report_Line (Outcome_Prepended (Failed, Child_Acc), Node_Tag, Previous_Child_Tag); end if; Put_Exception_Message (Exception_Name (E), Exception_Message (E)); end Report_Failed_Child_Test_Node_Access; ----------------------------------------------------- procedure Report_Unexpected_Node_Cond_Check_Error (Node_Tag : Tag; E : Exception_Occurrence) is begin Put_Report_Line (Unexp_Error & "checking condition", Node_Tag); Put_Exception_Message (Exception_Name (E), Exception_Message (E)); end Report_Unexpected_Node_Cond_Check_Error; ----------------------------------------------------- procedure Report_Unexpected_Node_Run_Error (Node_Tag : Tag; E : Exception_Occurrence) is use Ada.Text_IO; begin Put_Line (Unexp_Error & "running" & Test_Node_W_Tag (Node_Tag)); Put_Exception_Message (Exception_Name (E), Exception_Message (E)); end Report_Unexpected_Node_Run_Error; ----------------------------------------------------- procedure Report_Node_Cond_Check_Start (Node_Tag : Tag) is begin Put_Report_Line (Start & Cond_Checking, Node_Tag); end Report_Node_Cond_Check_Start; ----------------------------------------------------- procedure Report_Passed_Node_Cond_Check (Node_Tag : Tag) is begin Put_Report_Line (Outcome_Prepended (Passed, Cond_Checking), Node_Tag); end Report_Passed_Node_Cond_Check; ----------------------------------------------------- procedure Report_Failed_Node_Cond_Check (Node_Tag : Tag) is begin Put_Report_Line (Outcome_Prepended (Failed, Early_R_Not_Run_Compliment (Node_Tag, Cond_Checking)), Node_Tag); end Report_Failed_Node_Cond_Check; ----------------------------------------------------- procedure Report_Passed_Node_Cond_Assert (Node_Tag : Tag) is begin Put_Report_Line (Outcome_Prepended (Passed, Cond_Assert), Node_Tag); end Report_Passed_Node_Cond_Assert; ----------------------------------------------------- procedure Report_Failed_Node_Cond_Assert (Node_Tag : Tag) is begin Put_Report_Line (Outcome_Prepended (Failed, Early_R_Not_Run_Compliment (Node_Tag, Cond_Assert)), Node_Tag); end Report_Failed_Node_Cond_Assert; ----------------------------------------------------- procedure Report_Node_Run_Start (Node_Tag : Tag) is begin Put_Report_Line (Start & Ru, Node_Tag); end Report_Node_Run_Start; ----------------------------------------------------- procedure Report_Test_Routine_Start (Node_Tag : Tag; K : Test_Routine_Count) is begin if not Is_Early_Test (Node_Tag) then Put_Report_Line (Start & Kth_Routine (K), Node_Tag); end if; end Report_Test_Routine_Start; ----------------------------------------------------- procedure Report_Test_Routines_Cancellation (Node_Tag : Tag; First_K, Last_K : Test_Routine_Count) is begin Put_Report_Line ("CANCELLED " & Routine_Range (First_K, Last_K), Node_Tag); end Report_Test_Routines_Cancellation; ----------------------------------------------------- procedure Report_Failed_Test_Routine_Access (Node_Tag : Tag; K : Test_Routine_Count; E : Exception_Occurrence) is begin Put_Report_Line (Outcome_Prepended (Failed, Kth_Routine_Access (K)), Node_Tag); Put_Exception_Message (Exception_Name (E), Exception_Message (E)); end Report_Failed_Test_Routine_Access; ----------------------------------------------------- procedure Report_Failed_Test_Routine_Setup (Node_Tag : Tag; K : Test_Routine_Count; E : Exception_Occurrence) is begin Put_Report_Line (Outcome_Prepended (Failed, Kth_Routine_Setup (K)), Node_Tag); Put_Exception_Message (Exception_Name (E), Exception_Message (E)); end Report_Failed_Test_Routine_Setup; ----------------------------------------------------- procedure Report_Passed_Test_Assert (Node_Tag : Tag; K : Test_Routine_Count; Assert_Num_Avail : Boolean; Assert_Num : Test_Assert_Count) is begin Report_Test_Assert_Outcome (Node_Tag, Passed, K, Assert_Num_Avail, Assert_Num); end Report_Passed_Test_Assert; ----------------------------------------------------- procedure Report_Failed_Test_Assert (Node_Tag : Tag; K : Test_Routine_Count; Assert_Num_Avail : Boolean; Assert_Num : Test_Assert_Count; E : Exception_Occurrence) is begin Report_Test_Assert_Outcome (Node_Tag, Failed, K, Assert_Num_Avail, Assert_Num); Put_Exception_Message ((if Is_Early_Test (Node_Tag) then "" else "Message"), Exception_Message (E), True); end Report_Failed_Test_Assert; ----------------------------------------------------- procedure Report_Unexpected_Routine_Exception (Node_Tag : Tag; K : Test_Routine_Count; E : Exception_Occurrence) is begin Put_Report_Line (Unexp_Error & "running " & Kth_Routine (K), Node_Tag); Put_Exception_Message (Exception_Name (E), Exception_Message (E)); end Report_Unexpected_Routine_Exception; ----------------------------------------------------- procedure Report_Passed_Test_Routine (Node_Tag : Tag; K : Test_Routine_Count) is begin if not Is_Early_Test (Node_Tag) then Put_Report_Line (Outcome_Prepended (Passed, Kth_Routine (K)), Node_Tag); end if; end Report_Passed_Test_Routine; ----------------------------------------------------- procedure Report_Failed_Test_Routine (Node_Tag : Tag; K : Test_Routine_Count) is begin if not Is_Early_Test (Node_Tag) then Put_Report_Line (Outcome_Prepended (Failed, Kth_Routine (K)), Node_Tag); end if; end Report_Failed_Test_Routine; ----------------------------------------------------- procedure Report_Passed_Node_Run (Node_Tag : Tag) is begin Put_Report_Line (Outcome_Prepended (Passed, Ru), Node_Tag); end Report_Passed_Node_Run; ----------------------------------------------------- procedure Report_Failed_Node_Run (Node_Tag : Tag) is begin Put_Report_Line (Outcome_Prepended (Failed, Ru), Node_Tag); end Report_Failed_Node_Run; ----------------------------------------------------- end Test_Reporter_Instant_Standard; ---------------------------------------------------------------------------- end Apsepp.Test_Reporter_Class.Instant_Standard;
with estado_casillero,direccion; use estado_casillero,direccion; package casillero is type t_casillero is tagged record estado : t_estado_casillero; end record; procedure set_estado(c : in out t_casillero; e : in t_estado_casillero); function get_estado(c: in t_casillero) return t_estado_casillero; end casillero;
with Interfaces.C; package body usb_handler is -- External IRQ handler function usb_handler return Interfaces.C.int with Import => True, Convention => C, External_Name => "OTG_FS_IRQHandler"; -- Main usb device protected body Device_Interface is procedure Handler is unused : Interfaces.C.int; begin unused := usb_handler; end Handler; end Device_Interface; end usb_handler;
----------------------------------------------------------------------- -- util-systems-dlls -- Unix shared library support -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Interfaces.C.Strings; package body Util.Systems.DLLs is pragma Linker_Options (Util.Systems.Constants.DLL_OPTIONS); function Sys_Dlopen (Path : in Interfaces.C.Strings.chars_ptr; Mode : in Flags) return Handle; pragma Import (C, Sys_Dlopen, "dlopen"); function Sys_Dlclose (Lib : in Handle) return Interfaces.C.int; pragma Import (C, Sys_Dlclose, "dlclose"); function Sys_Dlsym (Lib : in Handle; Symbol : in Interfaces.C.Strings.chars_ptr) return System.Address; pragma Import (C, Sys_Dlsym, "dlsym"); function Sys_Dlerror return Interfaces.C.Strings.chars_ptr; pragma Import (C, Sys_Dlerror, "dlerror"); function Error_Message return String; function Error_Message return String is begin return Interfaces.C.Strings.Value (Sys_Dlerror); end Error_Message; -- ----------------------- -- Load the shared library with the given name or path and return a library handle. -- Raises the <tt>Load_Error</tt> exception if the library cannot be loaded. -- ----------------------- function Load (Path : in String; Mode : in Flags := Util.Systems.Constants.RTLD_LAZY) return Handle is Lib : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Path); Result : constant Handle := Sys_Dlopen (Lib, Mode); begin Interfaces.C.Strings.Free (Lib); if Result = Null_Handle then raise Load_Error with Error_Message; else return Result; end if; end Load; -- ----------------------- -- Unload the shared library. -- ----------------------- procedure Unload (Lib : in Handle) is Result : Interfaces.C.int; pragma Unreferenced (Result); begin if Lib /= Null_Handle then Result := Sys_Dlclose (Lib); end if; end Unload; -- ----------------------- -- Get a global symbol with the given name in the library. -- Raises the <tt>Not_Found</tt> exception if the symbol does not exist. -- ----------------------- function Get_Symbol (Lib : in Handle; Name : in String) return System.Address is use type System.Address; Symbol : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Name); Result : constant System.Address := Sys_Dlsym (Lib, Symbol); begin Interfaces.C.Strings.Free (Symbol); if Result = System.Null_Address then raise Not_Found with Error_Message; else return Result; end if; end Get_Symbol; end Util.Systems.DLLs;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015-2017, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings.Hash; package body League.Pretty_Printers is ------------ -- Append -- ------------ procedure Append (Self : in out Printer; Item : Output_Item; Index : out Document_Index) is Cursor : constant Maps.Cursor := Self.Back.Find (Item); begin if Maps.Has_Element (Cursor) then Index := Maps.Element (Cursor); else Self.Store.Append (Item); Index := Self.Store.Last_Index; Self.Back.Insert (Item, Index); end if; end Append; ------------ -- Append -- ------------ not overriding function Append (Self : Document'Class; Right : Document'Class) return Document is Index : Document_Index; begin Self.Printer.Concat (Self.Index, Right.Index, Index); return (Self.Printer, Index); end Append; ------------ -- Append -- ------------ not overriding procedure Append (Self : in out Document; Right : Document'Class) is begin Self.Printer.Concat (Self.Index, Right.Index, Self.Index); end Append; ------------ -- Concat -- ------------ procedure Concat (Self : in out Printer; Left : Document_Index; Right : Document_Index; Result : out Document_Index) is begin Self.Append ((Concat_Output, Left, Right), Result); end Concat; ------------- -- Flatten -- ------------- procedure Flatten (Self : in out Printer; Input : Document_Index; Result : out Document_Index) is Item : constant Output_Item := Self.Store.Element (Input); Temp : Document_Index; Down : Document_Index; begin case Item.Kind is when Empty_Output | Text_Output => Result := Input; when Concat_Output => Self.Flatten (Item.Left, Down); Self.Flatten (Item.Right, Temp); Self.Append ((Concat_Output, Down, Temp), Result); when Nest_Output => Self.Flatten (Item.Down, Result); when New_Line_Output => declare Space : constant Output_Item := (Kind => Text_Output, Text => Item.Gap); begin Self.Append (Space, Result); end; when Union_Output => Self.Flatten (Item.Left, Result); end case; end Flatten; ----------- -- Group -- ----------- procedure Group (Self : in out Printer; Input : Document_Index; Result : out Document_Index) is Down : Document_Index; begin Self.Flatten (Input, Down); if Input = Down then Result := Input; else Self.Append ((Union_Output, Down, Input), Result); end if; end Group; ----------- -- Group -- ----------- not overriding function Group (Self : Document'Class) return Document is Index : Document_Index; begin Self.Printer.Group (Self.Index, Index); return (Self.Printer, Index); end Group; ----------- -- Group -- ----------- not overriding procedure Group (Self : in out Document) is begin Self.Printer.Group (Self.Index, Self.Index); end Group; ---------- -- Hash -- ---------- function Hash (Item : Output_Item) return Ada.Containers.Hash_Type is use type Ada.Containers.Hash_Type; begin case Item.Kind is when Empty_Output => return 1; when New_Line_Output => return League.Strings.Hash (Item.Gap) * 11; when Text_Output => return League.Strings.Hash (Item.Text); when Nest_Output => return Ada.Containers.Hash_Type (Item.Indent) * 1046527 + Ada.Containers.Hash_Type (Item.Down); when Union_Output => return Ada.Containers.Hash_Type (Item.Left) * 1046527 + 16127 * Ada.Containers.Hash_Type (Item.Right); when Concat_Output => return Ada.Containers.Hash_Type (Item.Left) * 1046527 - 16127 * Ada.Containers.Hash_Type (Item.Right); end case; end Hash; ---------- -- Nest -- ---------- procedure Nest (Self : in out Printer; Indent : Natural; Input : Document_Index; Result : out Document_Index) is begin Self.Append ((Nest_Output, Indent, Input), Result); end Nest; ---------- -- Nest -- ---------- not overriding function Nest (Self : Document'Class; Indent : Natural) return Document is Index : Document_Index; begin Self.Printer.Nest (Indent, Self.Index, Index); return (Self.Printer, Index); end Nest; ---------- -- Nest -- ---------- not overriding procedure Nest (Self : in out Document; Indent : Natural) is begin Self.Printer.Nest (Indent, Self.Index, Self.Index); end Nest; ------------------ -- New_Document -- ------------------ not overriding function New_Document (Self : access Printer'Class) return Document is Index : Document_Index; begin Self.Nil (Index); return (Self.all'Unchecked_Access, Index); end New_Document; -------------- -- New_Line -- -------------- procedure New_Line (Self : in out Printer; Result : out Document_Index; Gap : League.Strings.Universal_String) is begin Self.Append ((New_Line_Output, Gap), Result); end New_Line; -------------- -- New_Line -- -------------- not overriding function New_Line (Self : Document'Class; Gap : Wide_Wide_String := " ") return Document is Index : Document_Index; begin Self.Printer.New_Line (Index, League.Strings.To_Universal_String (Gap)); Self.Printer.Concat (Self.Index, Index, Index); return (Self.Printer, Index); end New_Line; -------------- -- New_Line -- -------------- not overriding procedure New_Line (Self : in out Document; Gap : Wide_Wide_String := " ") is Index : Document_Index; begin Self.Printer.New_Line (Index, League.Strings.To_Universal_String (Gap)); Self.Printer.Concat (Self.Index, Index, Self.Index); end New_Line; --------- -- Nil -- --------- procedure Nil (Self : in out Printer; Result : out Document_Index) is begin Self.Append ((Kind => Empty_Output), Result); end Nil; ------------ -- Pretty -- ------------ function Pretty (Self : in out Printer; Width : Positive; Input : Document'Class) return League.String_Vectors.Universal_String_Vector is package Formatted_Documents is -- Formatted document is represented as sequence of Items. -- Item is either text (without new line) or -- new line together with indent spaces. type Item; type Document is access all Item'Class; type Item is abstract tagged limited record Next : aliased Document; end record; type Text_Collector is record Lines : League.String_Vectors.Universal_String_Vector; Last : League.Strings.Universal_String; Last_Used : Boolean := False; end record; procedure Append_Last_Line (Result : in out Text_Collector); not overriding procedure Append (Self : Item; Result : in out Text_Collector) is abstract; -- Append text representation of given item to Result type Text_Item is new Item with record Text : League.Strings.Universal_String; end record; overriding procedure Append (Self : Text_Item; Result : in out Text_Collector); type Line_Item is new Item with record Indent : Natural; end record; overriding procedure Append (Self : Line_Item; Result : in out Text_Collector); type Pair; type Pair_Access is access all Pair; type Pair is record Indent : Natural; Document : Pretty_Printers.Document_Index; Next : Pair_Access; end record; function New_Pair (Indent : Natural; Doc : Pretty_Printers.Document_Index; Next : Pair_Access) return not null Pair_Access; function Best (Offset : Natural; List : not null Pair_Access) return Document; function Layout (Input : Document) return League.String_Vectors.Universal_String_Vector; end Formatted_Documents; package body Formatted_Documents is Free_List : Pair_Access; function Fits (Offset : Natural; List : not null Pair_Access) return Boolean; procedure Free_Pair (Value : Pair_Access); ------------ -- Append -- ------------ overriding procedure Append (Self : Text_Item; Result : in out Text_Collector) is begin Result.Last.Append (Self.Text); Result.Last_Used := True; end Append; ------------ -- Append -- ------------ overriding procedure Append (Self : Line_Item; Result : in out Text_Collector) is Space : constant Wide_Wide_String := (1 .. Self.Indent => ' '); begin Append_Last_Line (Result); Result.Last.Append (Space); end Append; ---------------------- -- Append_Last_Line -- ---------------------- procedure Append_Last_Line (Result : in out Text_Collector) is begin if not Result.Last_Used then Result.Last_Used := True; elsif Result.Last.Count (' ') = Result.Last.Length then -- if line with spaces only, output an empty line Result.Last.Clear; Result.Lines.Append (Result.Last); else Result.Lines.Append (Result.Last); Result.Last.Clear; end if; end Append_Last_Line; ---------- -- Best -- ---------- function Best (Offset : Natural; List : not null Pair_Access) return Document is Placed : Natural := Offset; Head : not null Pair_Access := List; Tail : Pair_Access; -- Shortcut for Head.Next Result : aliased Document; Hook : access Document := Result'Access; Indent : Natural; Item : Pretty_Printers.Output_Item; Pairs : Natural := 0; -- Count of pair at the top of Tail -- allocated in this call of Fits begin loop Indent := Head.Indent; Tail := Head.Next; Item := Self.Store.Element (Head.Document); if Pairs > 0 then Pairs := Pairs - 1; Free_Pair (Head); end if; case Item.Kind is when Empty_Output => exit when Tail = null; Head := Tail; when Concat_Output => Head := New_Pair (Indent, Item.Right, Tail); Head := New_Pair (Indent, Item.Left, Head); Pairs := Pairs + 2; when Nest_Output => Head := New_Pair (Indent + Item.Indent, Item.Down, Tail); Pairs := Pairs + 1; when Text_Output => Hook.all := new Text_Item'(null, Item.Text); exit when Tail = null; Hook := Hook.all.Next'Access; Placed := Placed + Item.Text.Length; Head := Tail; when New_Line_Output => Hook.all := new Line_Item'(null, Indent); exit when Tail = null; Hook := Hook.all.Next'Access; Placed := Indent; Head := Tail; when Union_Output => if Width >= Placed then Head := New_Pair (Indent, Item.Left, Tail); if Fits (Placed, Head) then Hook.all := Best (Placed, Head); Free_Pair (Head); exit; end if; end if; Head := New_Pair (Indent, Item.Right, Tail); Hook.all := Best (Placed, Head); Free_Pair (Head); exit; end case; end loop; -- Here we can free any Pair allocated in this call for J in 1 .. Pairs loop Head := Tail; Tail := Tail.Next; Free_Pair (Head); end loop; return Result; end Best; ---------- -- Fits -- ---------- function Fits (Offset : Natural; List : not null Pair_Access) return Boolean is -- This is simplified version of Best that check if result of -- corresponding Best call fits into Width or not without -- actual constructing of formated document Placed : Natural := Offset; Head : not null Pair_Access := List; Tail : Pair_Access; -- Shortcut for Head.Next Result : Boolean := False; Indent : Natural; Item : Pretty_Printers.Output_Item; Pairs : Natural := 0; -- Count of pair at the top of Tail -- allocated in this call of Fits begin loop Indent := Head.Indent; Tail := Head.Next; Item := Self.Store.Element (Head.Document); if Pairs > 0 then Pairs := Pairs - 1; Free_Pair (Head); end if; case Item.Kind is when Empty_Output => exit when Tail = null; Head := Tail; when Concat_Output => Head := New_Pair (Indent, Item.Right, Tail); Head := New_Pair (Indent, Item.Left, Head); Pairs := Pairs + 2; when Nest_Output => Head := New_Pair (Indent + Item.Indent, Item.Down, Tail); Pairs := Pairs + 1; when Text_Output => Placed := Placed + Item.Text.Length; if Tail = null or Placed > Width then Result := Placed <= Width; exit; end if; Head := Tail; when New_Line_Output => Result := True; exit; when Union_Output => if Width >= Placed then Head := New_Pair (Indent, Item.Left, Tail); Result := Fits (Placed, Head); Free_Pair (Head); exit when Result; end if; Head := New_Pair (Indent, Item.Right, Tail); Result := Fits (Placed, Head); Free_Pair (Head); exit; end case; end loop; -- Here we can free any Pair allocated in this call for J in 1 .. Pairs loop Head := Tail; Tail := Tail.Next; Free_Pair (Head); end loop; return Result; end Fits; --------------- -- Free_Pair -- --------------- procedure Free_Pair (Value : Pair_Access) is begin Value.Next := Free_List; Free_List := Value; end Free_Pair; ------------ -- Layout -- ------------ function Layout (Input : Document) return League.String_Vectors.Universal_String_Vector is Next : Document := Input; Result : Text_Collector; begin while Next /= null loop Next.Append (Result); Next := Next.Next; end loop; Append_Last_Line (Result); return Result.Lines; end Layout; -------------- -- New_Pair -- -------------- function New_Pair (Indent : Natural; Doc : Pretty_Printers.Document_Index; Next : Pair_Access) return not null Pair_Access is begin if Free_List = null then return new Pair'(Indent, Doc, Next); else return Value : constant not null Pair_Access := Free_List do Free_List := Value.Next; Value.all := (Indent, Doc, Next); end return; end if; end New_Pair; end Formatted_Documents; Temp : Formatted_Documents.Document; begin Temp := Formatted_Documents.Best (Offset => 0, List => Formatted_Documents.New_Pair (0, Input.Index, null)); return Formatted_Documents.Layout (Temp); end Pretty; --------- -- Put -- --------- not overriding function Put (Self : Document'Class; Right : League.Strings.Universal_String) return Document is Index : Document_Index; begin Self.Printer.Text (Right, Index); Self.Printer.Concat (Self.Index, Index, Index); return (Self.Printer, Index); end Put; --------- -- Put -- --------- not overriding function Put (Self : Document'Class; Right : Wide_Wide_String) return Document is begin return Self.Put (League.Strings.To_Universal_String (Right)); end Put; --------- -- Put -- --------- not overriding procedure Put (Self : in out Document; Right : League.Strings.Universal_String) is Index : Document_Index; begin Self.Printer.Text (Right, Index); Self.Printer.Concat (Self.Index, Index, Self.Index); end Put; --------- -- Put -- --------- not overriding procedure Put (Self : in out Document; Right : Wide_Wide_String) is begin Self.Put (League.Strings.To_Universal_String (Right)); end Put; -------------- -- Put_Line -- -------------- not overriding procedure Put_Line (Self : in out Document; Right : Wide_Wide_String) is begin Self.Put (Right); Self.New_Line; end Put_Line; ---------- -- Text -- ---------- procedure Text (Self : in out Printer; Line : League.Strings.Universal_String; Result : out Document_Index) is begin Self.Append ((Text_Output, Line), Result); end Text; end League.Pretty_Printers;
with Ada.Containers.Indefinite_Ordered_Maps; with Protypo.Api.Engine_Values.Handlers; -- -- This package provides a wrapper around a map structure. The field names -- are the keys of the map. -- package Protypo.Api.Engine_Values.Record_Wrappers is package Record_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => ID, Element_Type => Engine_Value); subtype Record_Map is Record_Maps.Map; type Record_Map_Reference (Ref : access Record_Map) is limited private with Implicit_Dereference => Ref; type Record_Wrapper is new Handlers.Record_Interface with private; type Record_Wrapper_Access is access Record_Wrapper; overriding function Get (X : Record_Wrapper; Field : ID) return Handler_Value; overriding function Is_Field (X : Record_Wrapper; Field : ID) return Boolean; function Create_Wrapper return Record_Wrapper_Access; function Map (Item : in out Record_Wrapper) return Record_Map_Reference; private type Record_Map_Reference (Ref : access Record_Map) is limited null record; type Record_Wrapper is new Handlers.Record_Interface with record Map : aliased Record_Map; end record; function Create_Wrapper return Record_Wrapper_Access is (new Record_Wrapper'(Map => Record_Maps.Empty_Map)); function Map (Item : in out Record_Wrapper) return Record_Map_Reference is (Record_Map_Reference'(Ref => Item.Map'Access)); function Is_Field (X : Record_Wrapper; Field : ID) return Boolean is (X.Map.Contains (Field)); end Protypo.Api.Engine_Values.Record_Wrappers;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 9 -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-1999 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Expand routines for chapter 9 constructs with Types; use Types; package Exp_Ch9 is procedure Add_Discriminal_Declarations (Decls : List_Id; Typ : Entity_Id; Name : Name_Id; Loc : Source_Ptr); -- This routine is used to add discriminal declarations to task and -- protected operation bodies. The discriminants are available by normal -- selection from the concurrent object (whose name is passed as the third -- parameter). Discriminant references inside the body have already -- been replaced by references to the corresponding discriminals. The -- declarations constructed by this procedure hook the references up with -- the objects: -- -- discriminal_name : discr_type renames name.discriminant_name; -- -- Obviously we could have expanded the discriminant references in the -- first place to be the appropriate selection, but this turns out to -- be hard to do because it would introduce difference in handling of -- discriminant references depending on their location. procedure Add_Private_Declarations (Decls : List_Id; Typ : Entity_Id; Name : Name_Id; Loc : Source_Ptr); -- This routine is used to add private declarations to protected bodies. -- These are analogous to the discriminal declarations added to tasks -- and protected operations, and consist of a renaming of each private -- object to a selection from the concurrent object passed as an extra -- parameter to each such operation: -- private_name : private_type renames name.private_name; -- As with discriminals, private references inside the protected -- subprogram bodies have already been replaced by references to the -- corresponding privals. procedure Build_Activation_Chain_Entity (N : Node_Id); -- Given a declaration N of an object that is a task, or contains tasks -- (other than allocators to tasks) this routine ensures that an activation -- chain has been declared in the appropriate scope, building the required -- declaration for the chain variable if not. The name of this variable -- is always _Chain and it is accessed by name. This procedure also adds -- an appropriate call to Activate_Tasks to activate the tasks for this -- activation chain. It does not however deal with the call needed in the -- case of allocators to Expunge_Unactivated_Tasks, this is separately -- handled in the Expand_Task_Allocator routine. function Build_Call_With_Task (N : Node_Id; E : Entity_Id) return Node_Id; -- N is a node representing the name of a task or an access to a task. -- The value returned is a call to the function whose name is the entity -- E (typically a runtime routine entity obtained using RTE) with the -- Task_Id of the associated task as the parameter. The caller is -- responsible for analyzing and resolving the resulting tree. procedure Build_Master_Entity (E : Entity_Id); -- Given an entity E for the declaration of an object containing tasks -- or of a type declaration for an allocator whose designated type is a -- task or contains tasks, this routine marks the appropriate enclosing -- context as a master, and also declares a variable called _Master in -- the current declarative part which captures the value of Current_Master -- (if not already built by a prior call). We build this object (instead -- of just calling Current_Master) for two reasons. First it is clearly -- more efficient to call Current_Master only once for a bunch of tasks -- in the same declarative part, and second it makes things easier in -- generating the initialization routines, since they can just reference -- the object _Master by name, and they will get the proper Current_Master -- value at the outer level, and copy in the parameter value for the outer -- initialization call if the call is for a nested component). Note that -- in the case of nested packages, we only really need to make one such -- object at the outer level, but it is much easier to generate one per -- declarative part. function Build_Protected_Sub_Specification (N : Node_Id; Prottyp : Entity_Id; Unprotected : Boolean := False) return Node_Id; -- Build specification for protected subprogram. This is called when -- expanding a protected type, and also when expanding the declaration for -- an Access_To_Protected_Subprogram type. In the latter case, Prottyp is -- empty, and the first parameter of the signature of the protected op is -- of type System.Address. procedure Build_Protected_Subprogram_Call (N : Node_Id; Name : Node_Id; Rec : Node_Id; External : Boolean := True); -- The node N is a subprogram or entry call to a protected subprogram. -- This procedure rewrites this call with the appropriate expansion. -- Name is the subprogram, and Rec is the record corresponding to the -- protected object. External is False if the call is to another -- protected subprogram within the same object. procedure Build_Task_Activation_Call (N : Node_Id); -- This procedure is called for constructs that can be task activators -- i.e. task bodies, subprogram bodies, package bodies and blocks. If -- the construct is a task activator (as indicated by the non-empty -- setting of Activation_Chain_Entity, either in the construct, or, in -- the case of a package body, in its associated package spec), then -- a call to Activate_Tasks with this entity as the single parameter -- is inserted at the start of the statements of the activator. procedure Build_Task_Allocate_Block (Actions : List_Id; N : Node_Id; Args : List_Id); -- This routine is used in the case of allocators where the designated -- type is a task or contains tasks. In this case, the normal initialize -- call is replaced by: -- -- blockname : label; -- blockname : declare -- _Chain : Activation_Chain; -- -- procedure _Expunge is -- begin -- Expunge_Unactivated_Tasks (_Chain); -- end; -- -- begin -- Init (Args); -- Activate_Tasks (_Chain); -- at end -- _Expunge; -- end; -- -- to get the task or tasks created and initialized. The expunge call -- ensures that any tasks that get created but not activated due to an -- exception are properly expunged (it has no effect in the normal case) -- The argument N is the allocator, and Args is the list of arguments -- for the initialization call, constructed by the caller, which uses -- the Master_Id of the access type as the _Master parameter, and _Chain -- (defined above) as the _Chain parameter. function Concurrent_Ref (N : Node_Id) return Node_Id; -- Given the name of a concurrent object (task or protected object), or -- the name of an access to a concurrent object, this function returns an -- expression referencing the associated Task_Id or Protection object, -- respectively. Note that a special case is when the name is a reference -- to a task type name. This can only happen within a task body, and the -- meaning is to get the Task_Id for the currently executing task. function Convert_Concurrent (N : Node_Id; Typ : Entity_Id) return Node_Id; -- N is an expression of type Typ. If the type is not a concurrent -- type then it is returned unchanged. If it is a task or protected -- reference, Convert_Concurrent creates an unchecked conversion node -- from this expression to the corresponding concurrent record type -- value. We need this in any situation where the concurrent type is -- used, because the actual concurrent object is an object of the -- corresponding concurrent type, and manipulations on the concurrent -- object actually manipulate the corresponding object of the record -- type. function Entry_Index_Expression (Sloc : Source_Ptr; Ent : Entity_Id; Index : Node_Id; Ttyp : Entity_Id) return Node_Id; -- Returns an expression to compute a task entry index given the name -- of the entry or entry family. For the case of a task entry family, -- the Index parameter contains the expression for the subscript. -- Ttyp is the task type. procedure Establish_Task_Master (N : Node_Id); -- Given a subprogram body, or a block statement, or a task body, this -- proccedure makes the necessary transformations required of a task -- master (add Enter_Master call at start, and establish a cleanup -- routine to make sure Complete_Master is called on exit). procedure Expand_Access_Protected_Subprogram_Type (N : Node_Id); -- Build Equivalent_Type for an Access_to_protected_Subprogram. procedure Expand_Accept_Declarations (N : Node_Id; Ent : Entity_Id); -- Expand declarations required for accept statement. See bodies of -- both Expand_Accept_Declarations and Expand_N_Accept_Statement for -- full details of the nature and use of these declarations, which -- are inserted immediately before the accept node N. The second -- argument is the entity for the corresponding entry. procedure Expand_Entry_Barrier (N : Node_Id; Ent : Entity_Id); -- Expand the entry barrier into a function. This is called directly -- from Analyze_Entry_Body so that the discriminals and privals of the -- barrier can be attached to the function declaration list, and a new -- set prepared for the entry body procedure, bedore the entry body -- statement sequence can be expanded. The resulting function is analyzed -- now, within the context of the protected object, to resolve calls to -- other protected functions. procedure Expand_Entry_Body_Declarations (N : Node_Id); -- Expand declarations required for the expansion of the -- statements of the body. procedure Expand_N_Abort_Statement (N : Node_Id); procedure Expand_N_Accept_Statement (N : Node_Id); procedure Expand_N_Asynchronous_Select (N : Node_Id); procedure Expand_N_Conditional_Entry_Call (N : Node_Id); procedure Expand_N_Delay_Relative_Statement (N : Node_Id); procedure Expand_N_Delay_Until_Statement (N : Node_Id); procedure Expand_N_Entry_Body (N : Node_Id); procedure Expand_N_Entry_Call_Statement (N : Node_Id); procedure Expand_N_Entry_Declaration (N : Node_Id); procedure Expand_N_Protected_Body (N : Node_Id); procedure Expand_N_Protected_Type_Declaration (N : Node_Id); -- Expands protected type declarations. This results, among -- other things, in the declaration of a record type for the -- representation of protected objects and (if there are entries) -- in an entry service procedure. The Protection value used by -- the GNARL to control the object will always be the first -- field of the record, and the entry service procedure spec -- (if it exists) will always immediately follow the record -- declaration. This allows these two nodes to be found from -- the type using Corresponding_Record, without benefit of -- of further attributes. procedure Expand_N_Requeue_Statement (N : Node_Id); procedure Expand_N_Selective_Accept (N : Node_Id); procedure Expand_N_Single_Task_Declaration (N : Node_Id); procedure Expand_N_Task_Body (N : Node_Id); procedure Expand_N_Task_Type_Declaration (N : Node_Id); procedure Expand_N_Timed_Entry_Call (N : Node_Id); procedure Expand_Protected_Body_Declarations (N : Node_Id; Spec_Id : Entity_Id); -- Expand declarations required for a protected body. See bodies of -- both Expand_Protected_Body_Declarations and Expand_N_Protected_Body -- for full details of the nature and use of these declarations. -- The second argument is the entity for the corresponding -- protected type declaration. function External_Subprogram (E : Entity_Id) return Entity_Id; -- return the external version of a protected operation, which locks -- the object before invoking the internal protected subprogram body. function First_Protected_Operation (D : List_Id) return Node_Id; -- Given the declarations list for a protected body, find the -- first protected operation body. function Make_Task_Create_Call (Task_Rec : Entity_Id) return Node_Id; -- Given the entity of the record type created for a task type, build -- the call to Create_Task function Make_Initialize_Protection (Protect_Rec : Entity_Id) return List_Id; -- Given the entity of the record type created for a protected type, build -- a list of statements needed for proper initialization of the object. function Next_Protected_Operation (N : Node_Id) return Node_Id; -- Given a protected operation node (a subprogram or entry body), -- find the following node in the declarations list. procedure Set_Discriminals (Dec : Node_Id; Op : Node_Id; Loc : Source_Ptr); -- Replace discriminals in a protected type for use by the -- next protected operation on the type. Each operation needs a -- new set of discirminals, since it needs a unique renaming of -- the discriminant fields in the record used to implement the -- protected type. procedure Set_Privals (Dec : Node_Id; Op : Node_Id; Loc : Source_Ptr); -- Associates a new set of privals (placeholders for later access to -- private components of protected objects) with the private object -- declarations of a protected object. These will be used to expand -- the references to private objects in the next protected -- subprogram or entry body to be expanded. end Exp_Ch9;
-- Copyright 2016-2019 NXP -- All rights reserved.SPDX-License-Identifier: BSD-3-Clause -- This spec has been automatically generated from LPC55S6x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NXP_SVD.RTC is pragma Preelaborate; --------------- -- Registers -- --------------- -- Software reset control type CTRL_SWRESET_Field is ( -- Not in reset. The RTC is not held in reset. This bit must be cleared -- prior to configuring or initiating any operation of the RTC. Not_In_Reset, -- In reset. The RTC is held in reset. All register bits within the RTC -- will be forced to their reset value except the OFD bit. This bit must -- be cleared before writing to any register in the RTC - including -- writes to set any of the other bits within this register. Do not -- attempt to write to any bits of this register at the same time that -- the reset bit is being cleared. In_Reset) with Size => 1; for CTRL_SWRESET_Field use (Not_In_Reset => 0, In_Reset => 1); -- RTC 1 Hz timer alarm flag status. type CTRL_ALARM1HZ_Field is ( -- No match. No match has occurred on the 1 Hz RTC timer. Writing a 0 -- has no effect. No_Match, -- Match. A match condition has occurred on the 1 Hz RTC timer. This -- flag generates an RTC alarm interrupt request RTC_ALARM which can -- also wake up the part from any low power mode. Writing a 1 clears -- this bit. Match) with Size => 1; for CTRL_ALARM1HZ_Field use (No_Match => 0, Match => 1); -- RTC 1 kHz timer wake-up flag status. type CTRL_WAKE1KHZ_Field is ( -- Run. The RTC 1 kHz timer is running. Writing a 0 has no effect. Run, -- Time-out. The 1 kHz high-resolution/wake-up timer has timed out. This -- flag generates an RTC wake-up interrupt request RTC-WAKE which can -- also wake up the part from any low power mode. Writing a 1 clears -- this bit. Timeout) with Size => 1; for CTRL_WAKE1KHZ_Field use (Run => 0, Timeout => 1); -- RTC 1 Hz timer alarm enable for Deep power-down. type CTRL_ALARMDPD_EN_Field is ( -- Disable. A match on the 1 Hz RTC timer will not bring the part out of -- Deep power-down mode. Disable, -- Enable. A match on the 1 Hz RTC timer bring the part out of Deep -- power-down mode. Enable) with Size => 1; for CTRL_ALARMDPD_EN_Field use (Disable => 0, Enable => 1); -- RTC 1 kHz timer wake-up enable for Deep power-down. type CTRL_WAKEDPD_EN_Field is ( -- Disable. A match on the 1 kHz RTC timer will not bring the part out -- of Deep power-down mode. Disable, -- Enable. A match on the 1 kHz RTC timer bring the part out of Deep -- power-down mode. Enable) with Size => 1; for CTRL_WAKEDPD_EN_Field use (Disable => 0, Enable => 1); -- RTC 1 kHz clock enable. This bit can be set to 0 to conserve power if -- the 1 kHz timer is not used. This bit has no effect when the RTC is -- disabled (bit 7 of this register is 0). type CTRL_RTC1KHZ_EN_Field is ( -- Disable. A match on the 1 kHz RTC timer will not bring the part out -- of Deep power-down mode. Disable, -- Enable. The 1 kHz RTC timer is enabled. Enable) with Size => 1; for CTRL_RTC1KHZ_EN_Field use (Disable => 0, Enable => 1); -- RTC enable. type CTRL_RTC_EN_Field is ( -- Disable. The RTC 1 Hz and 1 kHz clocks are shut down and the RTC -- operation is disabled. This bit should be 0 when writing to load a -- value in the RTC counter register. Disable, -- Enable. The 1 Hz RTC clock is running and RTC operation is enabled. -- This bit must be set to initiate operation of the RTC. The first -- clock to the RTC counter occurs 1 s after this bit is set. To also -- enable the high-resolution, 1 kHz clock, set bit 6 in this register. Enable) with Size => 1; for CTRL_RTC_EN_Field use (Disable => 0, Enable => 1); -- RTC oscillator power-down control. type CTRL_RTC_OSC_PD_Field is ( -- See RTC_OSC_BYPASS Power_Up, -- RTC oscillator is powered-down. Powered_Down) with Size => 1; for CTRL_RTC_OSC_PD_Field use (Power_Up => 0, Powered_Down => 1); -- RTC oscillator bypass control. type CTRL_RTC_OSC_BYPASS_Field is ( -- The RTC Oscillator operates normally as a crystal oscillator with the -- crystal connected between the RTC_XTALIN and RTC_XTALOUT pins. Used, -- The RTC Oscillator is in bypass mode. In this mode a clock can be -- directly input into the RTC_XTALIN pin. Bypass) with Size => 1; for CTRL_RTC_OSC_BYPASS_Field use (Used => 0, Bypass => 1); -- RTC Sub-second counter control. type CTRL_RTC_SUBSEC_ENA_Field is ( -- The sub-second counter (if implemented) is disabled. This bit is -- cleared by a system-level POR or BOD reset as well as a by the -- RTC_ENA bit (bit 7 in this register). On modules not equipped with a -- sub-second counter, this bit will always read-back as a '0'. Power_Up, -- The 32 KHz sub-second counter is enabled (if implemented). Counting -- commences on the start of the first one-second interval after this -- bit is set. Note: This bit can only be set after the RTC_ENA bit (bit -- 7) is set by a previous write operation. Note: The RTC sub-second -- counter must be re-enabled whenever the chip exits deep power-down -- mode. Powered_Down) with Size => 1; for CTRL_RTC_SUBSEC_ENA_Field use (Power_Up => 0, Powered_Down => 1); -- RTC control register type CTRL_Register is record -- Software reset control SWRESET : CTRL_SWRESET_Field := NXP_SVD.RTC.In_Reset; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- RTC 1 Hz timer alarm flag status. ALARM1HZ : CTRL_ALARM1HZ_Field := NXP_SVD.RTC.No_Match; -- RTC 1 kHz timer wake-up flag status. WAKE1KHZ : CTRL_WAKE1KHZ_Field := NXP_SVD.RTC.Run; -- RTC 1 Hz timer alarm enable for Deep power-down. ALARMDPD_EN : CTRL_ALARMDPD_EN_Field := NXP_SVD.RTC.Disable; -- RTC 1 kHz timer wake-up enable for Deep power-down. WAKEDPD_EN : CTRL_WAKEDPD_EN_Field := NXP_SVD.RTC.Disable; -- RTC 1 kHz clock enable. This bit can be set to 0 to conserve power if -- the 1 kHz timer is not used. This bit has no effect when the RTC is -- disabled (bit 7 of this register is 0). RTC1KHZ_EN : CTRL_RTC1KHZ_EN_Field := NXP_SVD.RTC.Disable; -- RTC enable. RTC_EN : CTRL_RTC_EN_Field := NXP_SVD.RTC.Disable; -- RTC oscillator power-down control. RTC_OSC_PD : CTRL_RTC_OSC_PD_Field := NXP_SVD.RTC.Power_Up; -- RTC oscillator bypass control. RTC_OSC_BYPASS : CTRL_RTC_OSC_BYPASS_Field := NXP_SVD.RTC.Used; -- RTC Sub-second counter control. RTC_SUBSEC_ENA : CTRL_RTC_SUBSEC_ENA_Field := NXP_SVD.RTC.Power_Up; -- unspecified Reserved_11_31 : HAL.UInt21 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CTRL_Register use record SWRESET at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; ALARM1HZ at 0 range 2 .. 2; WAKE1KHZ at 0 range 3 .. 3; ALARMDPD_EN at 0 range 4 .. 4; WAKEDPD_EN at 0 range 5 .. 5; RTC1KHZ_EN at 0 range 6 .. 6; RTC_EN at 0 range 7 .. 7; RTC_OSC_PD at 0 range 8 .. 8; RTC_OSC_BYPASS at 0 range 9 .. 9; RTC_SUBSEC_ENA at 0 range 10 .. 10; Reserved_11_31 at 0 range 11 .. 31; end record; subtype WAKE_VAL_Field is HAL.UInt16; -- High-resolution/wake-up timer control register type WAKE_Register is record -- A read reflects the current value of the high-resolution/wake-up -- timer. A write pre-loads a start count value into the wake-up timer -- and initializes a count-down sequence. Do not write to this register -- while counting is in progress. VAL : WAKE_VAL_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for WAKE_Register use record VAL at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype SUBSEC_SUBSEC_Field is HAL.UInt15; -- Sub-second counter register type SUBSEC_Register is record -- Read-only. A read reflects the current value of the 32KHz sub-second -- counter. This counter is cleared whenever the SUBSEC_ENA bit in the -- RTC_CONTROL register is low. Up-counting at a 32KHz rate commences at -- the start of the next one-second interval after the SUBSEC_ENA bit is -- set. This counter must be re-enabled after exiting deep power-down -- mode or after the main RTC module is disabled and re-enabled. On -- modules not equipped with a sub-second counter, this register will -- read-back as all zeroes. SUBSEC : SUBSEC_SUBSEC_Field; -- unspecified Reserved_15_31 : HAL.UInt17; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for SUBSEC_Register use record SUBSEC at 0 range 0 .. 14; Reserved_15_31 at 0 range 15 .. 31; end record; -- General Purpose register -- General Purpose register type GPREG_Registers is array (0 .. 7) of HAL.UInt32 with Volatile; ----------------- -- Peripherals -- ----------------- -- Real-Time Clock (RTC) type RTC_Peripheral is record -- RTC control register CTRL : aliased CTRL_Register; -- RTC match register MATCH : aliased HAL.UInt32; -- RTC counter register COUNT : aliased HAL.UInt32; -- High-resolution/wake-up timer control register WAKE : aliased WAKE_Register; -- Sub-second counter register SUBSEC : aliased SUBSEC_Register; -- General Purpose register GPREG : aliased GPREG_Registers; end record with Volatile; for RTC_Peripheral use record CTRL at 16#0# range 0 .. 31; MATCH at 16#4# range 0 .. 31; COUNT at 16#8# range 0 .. 31; WAKE at 16#C# range 0 .. 31; SUBSEC at 16#10# range 0 .. 31; GPREG at 16#40# range 0 .. 255; end record; -- Real-Time Clock (RTC) RTC_Periph : aliased RTC_Peripheral with Import, Address => System'To_Address (16#4002C000#); end NXP_SVD.RTC;