Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ada 2022 @ syntax #80

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ package body Component.Active_Component.Implementation.Tester is
if not Self.Expect_Packed_Byte_T_Send_Dropped then
pragma Assert (False, "The component's queue filled up when Packed_Byte_T_Send was called!");
else
Self.Packed_Byte_T_Send_Dropped_Count := Self.Packed_Byte_T_Send_Dropped_Count + 1;
Self.Packed_Byte_T_Send_Dropped_Count := @ + 1;
Self.Expect_Packed_Byte_T_Send_Dropped := False;
end if;
end Packed_Byte_T_Send_Dropped;
Expand All @@ -83,7 +83,7 @@ package body Component.Active_Component.Implementation.Tester is
if not Self.Expect_Packed_U16_T_Send_Dropped then
pragma Assert (False, "The component's queue filled up when Packed_U16_T_Send was called!");
else
Self.Packed_U16_T_Send_Dropped_Count := Self.Packed_U16_T_Send_Dropped_Count + 1;
Self.Packed_U16_T_Send_Dropped_Count := @ + 1;
Self.Expect_Packed_U16_T_Send_Dropped := False;
end if;
end Packed_U16_T_Send_Dropped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ package body Component.Background_Component.Implementation is
end;

-- Calculate the next wake up time as 500ms after this wake up time.
Self.Wake_Up_Time := Self.Wake_Up_Time + Ada.Real_Time.Microseconds (500_000);
Self.Wake_Up_Time := @ + Ada.Real_Time.Microseconds (500_000);
end Cycle;

end Component.Background_Component.Implementation;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package body Component.Data_Product_Component.Implementation is
Self.Data_Product_T_Send (Self.Data_Products.Last_Tick_Received (Timestamp, Arg));

-- Increment the count:
Self.Count := Self.Count + 1;
Self.Count := @ + 1;
end Tick_T_Recv_Sync;

end Component.Data_Product_Component.Implementation;
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package body Component.Event_Component.Implementation is
Self.Event_T_Send (Self.Events.Tick_Received (Timestamp, Arg));

-- Increment the count:
Self.Count := Self.Count + 1;
Self.Count := @ + 1;
end Tick_T_Recv_Sync;

end Component.Event_Component.Implementation;
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ package body Component.Example_Component.Implementation is
end loop;

-- Increment counter:
Self.Counter := Self.Counter + 1;
Self.Counter := @ + 1;
end Tick_T_Recv_Sync;

end Component.Example_Component.Implementation;
2 changes: 1 addition & 1 deletion doc/example_architecture/last_chance_handler.adb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package body Last_Chance_Handler is
GNAT.IO.Put ("LCH called => ");
while Peek (A) /= Ascii.Nul loop
GNAT.IO.Put (Peek (A));
A := A + 1;
A := @ + 1;
end loop;
GNAT.IO.Put (": ");
GNAT.IO.Put (Line); -- avoid the secondary stack for Line'Image
Expand Down
2 changes: 1 addition & 1 deletion doc/example_architecture/main/main.adb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ begin
loop
-- Wait for time:
delay until Next_Time;
Next_Time := Next_Time + Wait_Time;
Next_Time := @ + Wait_Time;
end loop;
end Main;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package body Component.Packet_Component.Implementation is
Self.Packet_T_Send (Self.Packets.Last_Tick_Received (Timestamp, Arg));

-- Increment the count:
Self.Count := Self.Count + 1;
Self.Count := @ + 1;
end Tick_T_Recv_Sync;

end Component.Packet_Component.Implementation;
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ package body Component.Parameter_Component.Implementation is
end if;

-- Increment the count:
Self.Count := Self.Count + 1;
Self.Count := @ + 1;
end Tick_T_Recv_Sync;

-- This procedure is called when the parameters of a component have been updated. The default implementation of this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ package body Component.Queued_Component.Implementation.Tester is
if not Self.Expect_Packed_Byte_T_Send_Dropped then
pragma Assert (False, "The component's queue filled up when Packed_Byte_T_Send was called!");
else
Self.Packed_Byte_T_Send_Dropped_Count := Self.Packed_Byte_T_Send_Dropped_Count + 1;
Self.Packed_Byte_T_Send_Dropped_Count := @ + 1;
Self.Expect_Packed_Byte_T_Send_Dropped := False;
end if;
end Packed_Byte_T_Send_Dropped;
Expand All @@ -84,7 +84,7 @@ package body Component.Queued_Component.Implementation.Tester is
if not Self.Expect_Packed_U16_T_Send_Dropped then
pragma Assert (False, "The component's queue filled up when Packed_U16_T_Send was called!");
else
Self.Packed_U16_T_Send_Dropped_Count := Self.Packed_U16_T_Send_Dropped_Count + 1;
Self.Packed_U16_T_Send_Dropped_Count := @ + 1;
Self.Expect_Packed_U16_T_Send_Dropped := False;
end if;
end Packed_U16_T_Send_Dropped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ package body Component.Queued_Component.Implementation.Tester is
if not Self.Expect_Packed_Byte_T_Send_Dropped then
pragma Assert (False, "The component's queue filled up when Packed_Byte_T_Send was called!");
else
Self.Packed_Byte_T_Send_Dropped_Count := Self.Packed_Byte_T_Send_Dropped_Count + 1;
Self.Packed_Byte_T_Send_Dropped_Count := @ + 1;
Self.Expect_Packed_Byte_T_Send_Dropped := False;
end if;
end Packed_Byte_T_Send_Dropped;
Expand All @@ -84,7 +84,7 @@ package body Component.Queued_Component.Implementation.Tester is
if not Self.Expect_Packed_U16_T_Send_Dropped then
pragma Assert (False, "The component's queue filled up when Packed_U16_T_Send was called!");
else
Self.Packed_U16_T_Send_Dropped_Count := Self.Packed_U16_T_Send_Dropped_Count + 1;
Self.Packed_U16_T_Send_Dropped_Count := @ + 1;
Self.Expect_Packed_U16_T_Send_Dropped := False;
end if;
end Packed_U16_T_Send_Dropped;
Expand Down
2 changes: 1 addition & 1 deletion doc/example_architecture/spark_package/spark_package.adb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ is

procedure Increment (X : in out Integer) is
begin
X := X + 1;
X := @ + 1;
end Increment;

end Spark_Package;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ is

procedure Increment (X : in out Integer) is
begin
X := X + 1;
X := @ + 1;
end Increment;

end Spark_Package;
6 changes: 3 additions & 3 deletions gen/templates/array/name-validation.adb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ package body {{ name }}.Validation is
end if;
{% endif %}
{% endif %}
Count := Count + 1;
Count := @ + 1;
end loop;
{% endif %}

Expand Down Expand Up @@ -127,7 +127,7 @@ package body {{ name }}.Validation is
end if;
{% endif %}
{% endif %}
Count := Count + 1;
Count := @ + 1;
end loop;
{% endif %}

Expand Down Expand Up @@ -198,7 +198,7 @@ package body {{ name }}.Validation is
end if;
{% endif %}
{% endif %}
Count := Count + 1;
Count := @ + 1;
end loop;
{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions gen/templates/component/component-name.adb
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ package body Component.{{ name }} is
if Base_Instance'Class (Self).Dispatch_Nonblock = False then
return Elements_Dispatched;
end if;
Elements_Dispatched := Elements_Dispatched + 1;
Elements_Dispatched := @ + 1;
end loop;
return Elements_Dispatched;
end Dispatch_N;
Expand Down Expand Up @@ -419,7 +419,7 @@ package body Component.{{ name }} is
-- However, to be safe, let's just sleep for a short amount of time
-- to give up the processor so we don't end up hogging the CPU if this is a high priority
-- task.
Count := Count + 1;
Count := @ + 1;
if Count > 5 then
-- We are still in an error condition after trying many time, something is terribly
-- wrong, drop the message.
Expand Down
8 changes: 4 additions & 4 deletions gen/templates/packets/name_packets.adb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ package body {{ name }} is

-- Update the packet length and sequence count:
Pkt.Header.Buffer_Length := Num_Bytes_Serialized;
Self.{{ p.name }}_Sequence_Count := Self.{{ p.name }}_Sequence_Count + 1;
Self.{{ p.name }}_Sequence_Count := @ + 1;

return Stat;
end {{ p.name }};
Expand Down Expand Up @@ -122,7 +122,7 @@ package body {{ name }} is
Num_Bytes_Copied : constant Natural := Safe_Left_Copy (P.Buffer, Overlay);
begin
P.Header.Buffer_Length := Num_Bytes_Copied;
Self.{{ p.name }}_Sequence_Count := Self.{{ p.name }}_Sequence_Count + 1;
Self.{{ p.name }}_Sequence_Count := @ + 1;
end;

return P;
Expand All @@ -145,7 +145,7 @@ package body {{ name }} is
);
begin
P.Buffer (P.Buffer'First .. P.Buffer'First + Packet_Serializer.Serialized_Length - 1) := Packet_Serializer.To_Byte_Array (Item);
Self.{{ p.name }}_Sequence_Count := Self.{{ p.name }}_Sequence_Count + 1;
Self.{{ p.name }}_Sequence_Count := @ + 1;
return P;
end {{ p.name }};
{% endif %}
Expand Down Expand Up @@ -192,7 +192,7 @@ package body {{ name }} is
);
begin
-- Increment the sequence count:
Self.{{ p.name }}_Sequence_Count := Self.{{ p.name }}_Sequence_Count + 1;
Self.{{ p.name }}_Sequence_Count := @ + 1;
return P;
end {{ p.name }}_Empty;
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions gen/templates/record/name.adb
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ package body {{ name }} is
-- Size of variable sized field "{{ field.name }}":
Length := (Integer (Src.{{ field.variable_length }}) + Integer ({{ field.variable_length_offset }})) * {{ field.name }}_Unit_Length;
if Length > 0 then
Size_In_Bytes_To_Return := Size_In_Bytes_To_Return + Length;
Size_In_Bytes_To_Return := @ + Length;
end if;
{% else %}
-- Add size of packed type for field "{{ field.name }}":
if {{ field.type_package }}.Serialized_Length (Src.{{ field.name }}, Length) = Failure then
Num_Bytes_Serialized := Size_In_Bytes_To_Return;
return Failure;
end if;
Size_In_Bytes_To_Return := Size_In_Bytes_To_Return + Length;
Size_In_Bytes_To_Return := @ + Length;
{% endif %}

{% endfor %}
Expand Down Expand Up @@ -189,15 +189,15 @@ package body {{ name }} is
-- Size of variable sized field "{{ field.name }}":
Length := (Integer (Src.{{ field.variable_length }}) + Integer ({{ field.variable_length_offset }})) * {{ field.name }}_Unit_Length;
if Length > 0 then
Size_In_Bytes_To_Return := Size_In_Bytes_To_Return + Length;
Size_In_Bytes_To_Return := @ + Length;
end if;
{% else %}
-- Add size of packed type for field "{{ field.name }}":
if {{ field.type_package }}.Serialized_Length (Src.{{ field.name }}, Length) = Failure then
Num_Bytes_Serialized := Size_In_Bytes_To_Return;
return Failure;
end if;
Size_In_Bytes_To_Return := Size_In_Bytes_To_Return + Length;
Size_In_Bytes_To_Return := @ + Length;
{% endif %}

{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ package body Component.{{ name }}.Implementation.Tester is
pragma Assert (False, "The component's queue filled up when {{ connector.tester_name }} was called!");
{% endif %}
else
Self.{{ connector.tester_name }}_Dropped_Count := Self.{{ connector.tester_name }}_Dropped_Count + 1;
Self.{{ connector.tester_name }}_Dropped_Count := @ + 1;
Self.Expect_{{ connector.tester_name }}_Dropped := False;
end if;
end {{ connector.tester_name }}_Dropped;
Expand Down
2 changes: 1 addition & 1 deletion gen/templates/tests/name.adb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ package body {{ name }} is
Self.Log (" Finishing Tear_Down for test " & Closing_Test);
Self.End_Logging (Closing_Test);
-- Increment counter for the next test name in the list and pass the log to close back up to the tear down (or component unit test)
Self.Test_Name_Index := Self.Test_Name_Index + 1;
Self.Test_Name_Index := @ + 1;
{% if component and not component.generic %}
-- Delete tester:
Free_Tester (Self.Tester);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ package body Component.Generic_Queued.Implementation.Tester is
if not Self.Expect_Generic_Type_2_Send_Dropped then
pragma Assert (False, "The component's queue filled up when Generic_Type_2_Send was called!");
else
Self.Generic_Type_2_Send_Dropped_Count := Self.Generic_Type_2_Send_Dropped_Count + 1;
Self.Generic_Type_2_Send_Dropped_Count := @ + 1;
Self.Expect_Generic_Type_2_Send_Dropped := False;
end if;
end Generic_Type_2_Send_Dropped;
Expand Down
2 changes: 1 addition & 1 deletion redo/test/spark_compile/spark_fail.adb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ is

procedure Increment (X : in out Integer) is
begin
X := X + 1 + Depends.Global_Var;
X := @ + 1 + Depends.Global_Var;
end Increment;

end Spark_Fail;
2 changes: 1 addition & 1 deletion redo/test/spark_compile/spark_test.adb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ is

procedure Increment (X : in out Integer) is
begin
X := X + 1;
X := @ + 1;
end Increment;

end Spark_Test;
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ package body Component.Ccsds_Command_Depacketizer.Implementation is
-- First check the checksum. If the checksum is not zero, then it is invalid, since the checksum within
-- the packet itself should zero out the rest of the computed checksum.
Checksum := Xor_8.Compute_Xor_8 (Ccsds_Primary_Header.Serialization.To_Byte_Array (Arg.Header)); -- checksum header
Checksum := Xor_8.Compute_Xor_8 (Arg.Data (Arg.Data'First .. Arg.Data'First + Data_Length - 1), Checksum); -- checksum data
Checksum := Xor_8.Compute_Xor_8 (Arg.Data (Arg.Data'First .. Arg.Data'First + Data_Length - 1), @); -- checksum data
if Checksum /= 0 then
Self.Drop_Packet (Arg, Self.Events.Invalid_Packet_Checksum (Self.Sys_Time_T_Get, (
Ccsds_Header => (
Expand Down Expand Up @@ -111,14 +111,14 @@ package body Component.Ccsds_Command_Depacketizer.Implementation is
else
-- We don't need anything else out of the secondary header, unless an error
-- occurs, so just skip right over it.
Next_Index := Next_Index + Ccsds_Command_Secondary_Header_Length;
Next_Index := @ + Ccsds_Command_Secondary_Header_Length;

-- Set the command header arg buffer length:
The_Command.Header.Arg_Buffer_Length := Argument_Data_Length;

-- Extract command id:
The_Command.Header.Id := Command_Id.Serialization.From_Byte_Array (Arg.Data (Next_Index .. Next_Index + Command_Id_Length - 1)).Id;
Next_Index := Next_Index + Command_Id_Length;
Next_Index := @ + Command_Id_Length;

-- Copy argument buffer:
The_Command.Arg_Buffer (The_Command.Arg_Buffer'First .. The_Command.Arg_Buffer'First + Argument_Data_Length - 1) := Arg.Data (Next_Index .. Next_Index + Argument_Data_Length - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ package body Ccsds_Command_Depacketizer_Tests.Implementation is
Packet : Ccsds_Space_Packet.T := Construct_Packet (Ccsds_Command_Secondary_Header.Serialization.To_Byte_Array (The_Secondary_Header) & Command_Id.Serialization.To_Byte_Array ((Id => Cmd_Id)) & Data & (1 .. Natural (Function_Code) => 0), Packet_Type, Secondary_Header, Apid, Sequence_Count);
begin
-- Adjust packet length if requested:
Packet.Header.Packet_Length := Unsigned_16 (Natural (Packet.Header.Packet_Length) + Packet_Length_Adjustment);
Packet.Header.Packet_Length := Unsigned_16 (Natural (@) + Packet_Length_Adjustment);
declare
-- Get packet header bytes:
Header_Bytes : constant Byte_Array := Ccsds_Primary_Header.Serialization.To_Byte_Array (Packet.Header);
Expand Down
10 changes: 5 additions & 5 deletions src/components/ccsds_downsampler/apid_tree/apid_tree.adb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ package body Apid_Tree is
-- If we couldn't find the packet, then increment the pass count and move on
when False =>
-- Update the counter and return the status
Self.Num_Passed_Packets := Self.Num_Passed_Packets + 1;
Self.Num_Passed_Packets := @ + 1;
Count := Self.Num_Passed_Packets;
Return_Status := Invalid_Id;
when True =>
Expand All @@ -52,24 +52,24 @@ package body Apid_Tree is
-- When the factor is set to 0, we dont pass anything along.
when 0 =>
-- Update counter
Self.Num_Filtered_Packets := Self.Num_Filtered_Packets + 1;
Self.Num_Filtered_Packets := @ + 1;
Return_Status := Filter;
Count := Self.Num_Filtered_Packets;
-- Use the filter factor value for all other values to determine if it needs to be filtered or not
when others =>
if (Fetched_Entry.Filter_Count mod Fetched_Entry.Filter_Factor) = 0 then
Self.Num_Passed_Packets := Self.Num_Passed_Packets + 1;
Self.Num_Passed_Packets := @ + 1;
Return_Status := Pass;
Count := Self.Num_Passed_Packets;
else
-- Filtered here
Self.Num_Filtered_Packets := Self.Num_Filtered_Packets + 1;
Self.Num_Filtered_Packets := @ + 1;
Return_Status := Filter;
Count := Self.Num_Filtered_Packets;
end if;
end case;
-- If we found the entry in the tree, then make sure we update with the new count for that entry
Fetched_Entry.Filter_Count := Fetched_Entry.Filter_Count + 1;
Fetched_Entry.Filter_Count := @ + 1;
Self.Downsample_Entry.Set (Tree_Index, Fetched_Entry);
end case;

Expand Down
Loading