Commit 732f3930 authored by yoogx's avatar yoogx

Merge branch 'spark2014'

Conflicts:
	src/Makefile.am
	support/update_headers.sh
parents 678782f9 014306ed
......@@ -20,18 +20,13 @@ build-all:
fi
check-all: build-all
# XXX the following has been disabled due to issue with the execution
# of test programs by emulators
#
# if test ! "$(CHECKABLE_SCENARIO_FILES)" = ""; then \
# $(MAKE) scenarios-check; \
# elif test ! "$(CHECKABLE_SCENARIO_FILE)" = ""; then \
# $(MAKE) scenario-check; \
# else \
# echo "No scenario files, nothing to be done"; \
# fi
if test ! "$(CHECKABLE_SCENARIO_FILES)" = ""; then \
$(MAKE) scenarios-check; \
elif test ! "$(CHECKABLE_SCENARIO_FILE)" = ""; then \
$(MAKE) scenario-check; \
else \
echo "No scenario files, nothing to be done"; \
fi
############################################################################
# Code generation from AADL
......@@ -97,4 +92,3 @@ debug-makefile:
@echo "SAMPLE_DIR = $(SAMPLE_DIR)"
@echo "SCENARIO_FILES = $(SCENARIO_FILES)"
@echo "SCENARIO_FILE = $(SCENARIO_FILE)"
......@@ -19,7 +19,7 @@ REF_OUTPUTS = $(srcdir)/node_a_leon.ref
include $(srcdir)/../../Makefile.common
SCENARIO_FILES=$(srcdir)/scenario.aadl
CHECKABLE_SCENARIO_FILES=
CHECKABLE_SCENARIO_FILES=$(SCENARIO_FILES)
if HAS_GNATMAKE_FOR_LEON
SCENARIO_FILES+=$(srcdir)/scenario_local.aadl
......
......@@ -24,7 +24,7 @@ AADL_SOURCES = \
include $(srcdir)/../../Makefile.common
SCENARIO_FILES=$(srcdir)/scenario.aadl
CHECKABLE_SCENARIO_FILES=
CHECKABLE_SCENARIO_FILES= $(SCENARIO_FILES)
if HAS_GNATMAKE_FOR_MARTE
SCENARIO_FILES+=$(srcdir)/scenario_local_marte.aadl
......
[ 0.006661000] Hello! This is the pinger thread starting
[ 0.006661000] Hello! This is the pinger thread starting
[ 0.006691000] Sending ORDER: TRUE
[ 0.006698000] ORDER: TRUE
[ 0.006704000] Sending (+1) PING 1
......@@ -11,4 +12,3 @@
[ 3.006810000] Sending ORDER: FALSE
[ 3.006823000] ORDER: FALSE
[ 3.006829000] Sending (+5) PING 12
......@@ -51,7 +51,7 @@ package body Ping is
begin
Order := not Order;
Data_Source := Order;
Put_Line (Normal, "Sending ORDER: " & Opaque_Type'Image (Order));
Put_Line (Normal, "Sending ORDER: " + Opaque_Type'Image (Order));
end Do_Ping_Spg;
--------------------
......@@ -63,14 +63,14 @@ package body Ping is
Data_Source : out Simple_type)
is
begin
Put_Line (Normal, "ORDER: " & Opaque_Type'Image (Data_Sink));
Put_Line (Normal, "ORDER: " + Opaque_Type'Image (Data_Sink));
if Data_Sink then
Var := Var + 1;
Put_Line (Normal, "Sending (+1) PING" & Simple_Type'Image (Var));
Put_Line (Normal, "Sending (+1) PING" + Simple_Type'Image (Var));
else
Var := Var + 5;
Put_Line (Normal, "Sending (+5) PING" & Simple_Type'Image (Var));
Put_Line (Normal, "Sending (+5) PING" + Simple_Type'Image (Var));
end if;
Data_Source := Var;
......
-- This is a scenario file describing the AADL
-- This is a scenario file describing the AADL
-- application ping
-- $Id: scenario.aadl 6713 2009-06-20 20:58:28Z lanarre $
system ping
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files =>
Ocarina_Config::Timeout_Property => 5000ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a_native.ref",
"node_b", "node_b_native.ref");
Ocarina_Config::AADL_Files =>
Ocarina_Config::AADL_Files =>
("ping.aadl", "software.aadl");
Ocarina_Config::Generator => polyorb_hi_ada;
Ocarina_Config::Needed_Property_Sets =>
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
Ocarina_Config::AADL_Version => AADLv2;
end ping;
system implementation ping.Impl
end ping.Impl;
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2009, GET-Telecom Paris. --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- --
-- PolyORB HI is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
......@@ -26,7 +26,8 @@
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- PolyORB HI is maintained by GET Telecom Paris --
-- PolyORB-HI/Ada is maintained by the TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
......@@ -61,6 +62,11 @@ package body Producer_Consumer is
procedure Produce_Spg (Data_Source : out Alpha_Type) is
begin
Data_Source := The_Data;
if The_Data > 1000 then
The_Data := 1;
end if;
The_Data := The_Data + 1;
Put_Line (Normal, Get_Node
......
......@@ -15,6 +15,9 @@ AADL_SOURCES = \
include $(srcdir)/../../Makefile.common
SCENARIO_FILE=$(srcdir)/scenario.aadl
CHECKABLE_SCENARIO_FILES=
#$(SCENARIO_FILE)
# For this example, there is an issue in the ordering of events arriving..
EXTRA_DIST = $(ADA_SPECS) $(ADA_BODIES) $(AADL_SOURCES) $(SCENARIO_FILE)
......
[ 0.004515000] ***** Received Boolean_Type: TRUE
[ 0.004553000] ***** Received Integer_Type: 1
[ 0.004610000] ***** Receivinng Array : ( 1, 2, 3, 4)
[ 0.004642000] ***** Received String_Type: "Bounded string message"
[ 1.004364000] ***** Received Boolean_Type: FALSE
[ 1.004432000] ***** Received Integer_Type: 2
[ 1.004477000] ***** Receivinng Array : ( 2, 3, 4, 1)
[ 1.004525000] ***** Received String_Type: "Longer bounded string message"
[ 2.004523000] ***** Receivinng Array : ( 3, 4, 1, 2)
[ 2.004530000] ***** Received Boolean_Type: TRUE
[ 2.004545000] ***** Received String_Type: "Even longer bounded string message"
[ 2.004551000] ***** Received Integer_Type: 3
[ 3.004497000] ***** Received Boolean_Type: FALSE
***** Received Boolean_Type: TRUE
***** Received Integer_Type: 1
***** Receivinng Array : ( 1, 2, 3, 4)
***** Received String_Type: "Bounded string message"
***** Received Boolean_Type: FALSE
***** Received Integer_Type: 2
***** Receivinng Array : ( 2, 3, 4, 1)
***** Received String_Type: "Longer bounded string message"
***** Received Boolean_Type: TRUE
***** Received Integer_Type: 3
***** Receivinng Array : ( 3, 4, 1, 2)
***** Received String_Type: "Even longer bounded string message"
***** Received Boolean_Type: FALSE
***** Receivinng Array : ( 4, 1, 2, 3)
***** Received String_Type: "Very much longer bounded string message"
***** Received Integer_Type: 4
-- This is a scenario file describing the AADL
-- This is a scenario file describing the AADL
-- application some_types
-- $Id: scenario.aadl 6713 2009-06-20 20:58:28Z lanarre $
system some_types
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files =>
Ocarina_Config::Timeout_Property => 5000ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a_native.ref",
"node_b", "node_b_native.ref");
Ocarina_Config::AADL_Files =>
Ocarina_Config::AADL_Files =>
("some_types.aadl", "software.aadl");
Ocarina_Config::Generator => polyorb_hi_ada;
Ocarina_Config::Needed_Property_Sets =>
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
......@@ -21,4 +21,3 @@ end some_types;
system implementation some_types.Impl
end some_types.Impl;
......@@ -19,7 +19,7 @@ REF_OUTPUTS = $(srcdir)/sunseeker_local.ref
include $(srcdir)/../../Makefile.common
SCENARIO_FILES=$(srcdir)/scenario_dist.aadl
CHECKABLE_SCENARIO_FILES=
CHECKABLE_SCENARIO_FILES=#$(SCENARIO_FILES)
if HAS_GNATMAKE_FOR_LEON
SCENARIO_FILES+=$(srcdir)/scenario_local.aadl
......
-- This is a scenario file describing the AADL
-- This is a scenario file describing the AADL
-- application sunseeker
-- $Id: scenario_dist.aadl 6713 2009-06-20 20:58:28Z lanarre $
system sunseeker
properties
Ocarina_Config::Timeout_Property => 1000ms;
Ocarina_Config::Referencial_Files =>
Ocarina_Config::Timeout_Property => 5000ms;
Ocarina_Config::Referencial_Files =>
("sunseekercontroller", "sunseeker_controller_native.ref",
"sunseekerplant", "sunseekerplant_native.ref");
Ocarina_Config::AADL_Files =>
Ocarina_Config::AADL_Files =>
("sunseeker.aadl", "sunseeker_dist.aadl");
Ocarina_Config::Generator => polyorb_hi_ada;
Ocarina_Config::Needed_Property_Sets =>
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
......@@ -21,4 +21,3 @@ end sunseeker;
system implementation sunseeker.Impl
end sunseeker.Impl;
......@@ -8,6 +8,7 @@ ADA_SPECS_WITH_BODY = $(srcdir)/polyorb_hi-aperiodic_task.ads \
$(srcdir)/polyorb_hi-isr_task.ads \
$(srcdir)/polyorb_hi-marshallers_g.ads \
$(srcdir)/polyorb_hi-messages.ads \
$(srcdir)/polyorb_hi-null_task.ads \
$(srcdir)/polyorb_hi-output.ads \
$(srcdir)/polyorb_hi-periodic_task.ads \
$(srcdir)/polyorb_hi-port_kinds.ads \
......@@ -16,16 +17,16 @@ ADA_SPECS_WITH_BODY = $(srcdir)/polyorb_hi-aperiodic_task.ads \
$(srcdir)/polyorb_hi-suspenders.ads \
$(srcdir)/polyorb_hi-thread_interrogators.ads \
$(srcdir)/polyorb_hi-scheduler.ads \
$(srcdir)/polyorb_hi-time_marshallers.ads \
$(srcdir)/polyorb_hi-unprotected_queue.ads \
$(srcdir)/polyorb_hi-utils.ads
ADA_SPECS = $(ADA_SPECS_WITH_BODY) $(srcdir)/polyorb_hi.ads \
$(srcdir)/polyorb_hi-errors.ads \
$(srcdir)/polyorb_hi_generated.ads \
$(srcdir)/polyorb_hi-output_low_level.ads \
$(srcdir)/polyorb_hi-port_type_marshallers.ads \
$(srcdir)/polyorb_hi-streams.ads \
$(srcdir)/polyorb_hi-time_marshallers.ads \
$(srcdir)/polyorb_hi-transport_low_level.ads
ADA_BODIES = $(ADA_SPECS_WITH_BODY:.ads=.adb) \
......
......@@ -218,7 +218,7 @@ package body PolyORB_HI_Drivers_GRSPW is
PolyORB_HI_Generated.Transport.Deliver
(Corresponding_Entity
(Integer_8 (SEA (Message_Length_Size + 1))),
(Unsigned_8 (SEA (Message_Length_Size + 1))),
To_PO_HI_Full_Stream (SEA)
(1 .. Stream_Element_Offset (SEO)));
end loop Main_Loop;
......
......@@ -304,7 +304,7 @@ package body PolyORB_HI_Drivers_GRUART is
PolyORB_HI_Generated.Transport.Deliver
(Corresponding_Entity
(Integer_8 (SEA (Message_Length_Size + 1))),
(Unsigned_8 (SEA (Message_Length_Size + 1))),
To_PO_HI_Full_Stream (SEA)
(1 .. Stream_Element_Offset (SEO)));
else
......
......@@ -276,7 +276,7 @@ package body PolyORB_HI_Drivers_Native_TCP_IP is
-- Identify peer node
Node := Corresponding_Node (Integer_8 (SEC (SEC'First)));
Node := Corresponding_Node (Unsigned_8 (SEC (SEC'First)));
Nodes (Node).Socket_Receive := Socket;
pragma Debug (Put_Line (Verbose, "Connection from node "
& Node_Type'Image (Node)));
......@@ -365,7 +365,7 @@ package body PolyORB_HI_Drivers_Native_TCP_IP is
PolyORB_HI_Generated.Transport.Deliver
(Corresponding_Entity
(Integer_8 (SEA (Message_Length_Size + 1))),
(Unsigned_8 (SEA (Message_Length_Size + 1))),
To_PO_HI_Full_Stream (SEA)
(1 .. Stream_Element_Offset (SEO)));
end if;
......
......@@ -324,7 +324,7 @@ package body PolyORB_HI_Drivers_Native_UART is
begin
PolyORB_HI_Generated.Transport.Deliver
(Corresponding_Entity
(Integer_8 (SEA (Message_Length_Size + 1))),
(Unsigned_8 (SEA (Message_Length_Size + 1))),
To_PO_HI_Full_Stream (SEA)
(1 .. Stream_Element_Offset (SEO)));
exception
......
......@@ -11,6 +11,13 @@
pragma Locking_Policy (Ceiling_Locking); -- D.13.1
--------------------------------------------------------------------------------
-- Activate SPARK Mode, even if we do not actually use it on the
-- target: the code has Spark_Mode disabled in some occurences,
-- without this pragma the code would be rejected.
pragma Spark_Mode (On);
--------------------------------------------------------------------------------
-- The following define restrictions to be supported by the
-- PolyORB-HI, common restrictions
......
-- Ada restrictions to be supported by PolyORB HI, for native targets
-- pragma Profile_Warnings (Ravenscar); -- D.13.1
pragma Profile_Warnings (Ravenscar); -- D.13.1
......@@ -64,8 +64,8 @@ package body PolyORB_HI.Aperiodic_Task is
(Put_Line
(Verbose,
"Aperiodic Task "
& Entity_Image (Entity)
& ": Wait initialization"));
+ Entity_Image (Entity)
+ ": Wait initialization"));
Suspend_Until_True (Task_Suspension_Objects (Entity));
delay until System_Startup_Time;
......@@ -73,7 +73,7 @@ package body PolyORB_HI.Aperiodic_Task is
pragma Debug (Put_Line
(Verbose,
"Aperiodic task initialized for entity "
& Entity_Image (Entity)));
+ Entity_Image (Entity)));
-- Main task loop
......@@ -83,8 +83,8 @@ package body PolyORB_HI.Aperiodic_Task is
(Put_Line
(Verbose,
"Aperiodic Task "
& Entity_Image (Entity)
& ": New Dispatch"));
+ Entity_Image (Entity)
+ ": New Dispatch"));
-- Block until an event is received
......@@ -94,8 +94,8 @@ package body PolyORB_HI.Aperiodic_Task is
(Put_Line
(Verbose,
"Aperiodic Task "
& Entity_Image (Entity)
& ": received event"));
+ Entity_Image (Entity)
+ ": received event"));
-- Execute the job
......
......@@ -63,8 +63,8 @@ package body PolyORB_HI.Background_Task is
(Put_Line
(Verbose,
"Background Task "
& Entity_Image (Entity)
& ": Wait initialization"));
+ Entity_Image (Entity)
+ ": Wait initialization"));
Suspend_Until_True (Task_Suspension_Objects (Entity));
delay until System_Startup_Time;
......@@ -72,14 +72,14 @@ package body PolyORB_HI.Background_Task is
pragma Debug (Put_Line
(Verbose,
"Background task initialized for entity "
& Entity_Image (Entity)));
+ Entity_Image (Entity)));
pragma Debug
(Put_Line
(Verbose,
"Background Task "
& Entity_Image (Entity)
& ": Run job"));
+ Entity_Image (Entity)
+ ": Run job"));
Error := Job;
......
......@@ -65,8 +65,8 @@ package body PolyORB_HI.Hybrid_Task is
(Put_Line
(Verbose,
"Hybrid Task "
& Entity_Image (Entity)
& ": Wait initialization"));
+ Entity_Image (Entity)
+ ": Wait initialization"));
Suspend_Until_True (Task_Suspension_Objects (Entity));
delay until System_Startup_Time;
......@@ -74,7 +74,7 @@ package body PolyORB_HI.Hybrid_Task is
pragma Debug (Put_Line
(Verbose,
"Hybrid task initialized for entity "
& Entity_Image (Entity)));
+ Entity_Image (Entity)));
-- Run the initialize entrypoint (if any)
......@@ -87,8 +87,8 @@ package body PolyORB_HI.Hybrid_Task is
(Put_Line
(Verbose,
"Hybrid Task "
& Entity_Image (Entity)
& ": New Dispatch"));
+ Entity_Image (Entity)
+ ": New Dispatch"));
-- Block until an event is received
......@@ -98,8 +98,8 @@ package body PolyORB_HI.Hybrid_Task is
(Put_Line
(Verbose,
"Hybrid Task "
& Entity_Image (Entity)
& ": received event"));
+ Entity_Image (Entity)
+ ": received event"));
-- Calculate the next deadline according to the minimal
-- inter-arrival time.
......
......@@ -104,7 +104,7 @@ package body PolyORB_HI.Hybrid_Task_Driver is
(Put_Line
(Verbose,
"Hybrid thread driver: Triggering task: "
& Entity_Image (T.The_Task)));
+ Entity_Image (T.The_Task)));
Trigger (T);
end if;
......@@ -144,7 +144,7 @@ package body PolyORB_HI.Hybrid_Task_Driver is
(Put_Line
(Verbose,
"Hybrid thread driver: Eligible task: "
& Entity_Image (T.The_Task)));
+ Entity_Image (T.The_Task)));
T.Eligible := True;
end if;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- PolyORB HI is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
......@@ -37,29 +37,11 @@ with PolyORB_HI.Streams;
package body PolyORB_HI.Marshallers_G is
use type PolyORB_HI.Streams.Stream_Element_Offset;
function Data_Size return PolyORB_HI.Streams.Stream_Element_Count;
-- Return the smallest integer greater than or equal
-- Data_Type'Size/8.0.
Data_Size : constant PolyORB_HI.Streams.Stream_Element_Offset
:= Data_Type'Object_Size / 8;
---------------
-- Data_Size --
---------------
function Data_Size return PolyORB_HI.Streams.Stream_Element_Count is
use PolyORB_HI.Streams;
Size_In_Bits : constant Stream_Element_Count := Data_Type'Size;
begin
if Size_In_Bits mod 8 = 0 then
return Size_In_Bits / 8;
else
return Size_In_Bits / 8 + 1;
end if;
end Data_Size;
type Data_Type_Stream is
new PolyORB_HI.Streams.Stream_Element_Array
(1 .. Data_Size);
subtype Data_Type_Stream is
PolyORB_HI.Streams.Stream_Element_Array (1 .. Data_Size);
function Data_Type_To_Stream is
new Ada.Unchecked_Conversion (Data_Type, Data_Type_Stream);
......@@ -72,10 +54,12 @@ package body PolyORB_HI.Marshallers_G is
procedure Marshall
(R : Data_Type;
M : in out Messages.Message_Type) is
M : in out Messages.Message_Type)
is
Data : constant Data_Type_Stream := Data_Type_To_Stream (R);
begin
Messages.Write
(M, PolyORB_HI.Streams.Stream_Element_Array (Data_Type_To_Stream (R)));
Messages.Write (M, Data);
end Marshall;
----------------
......@@ -91,11 +75,9 @@ package body PolyORB_HI.Marshallers_G is
begin
Messages.Read (M, Data, Last);
if Last /= Data'Length then
raise Program_Error with "Incomplete message";
if Last = Data_Size then -- XXX Data'Size [attribute]
R := Stream_To_Data_Type (Data_Type_Stream (Data));
end if;
R := Stream_To_Data_Type (Data_Type_Stream (Data));
end Unmarshall;
end PolyORB_HI.Marshallers_G;
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- --
-- PolyORB HI is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
......@@ -61,6 +61,11 @@ package body PolyORB_HI.Messages is
Receiver_Offset : constant Stream_Element_Offset := Message_Length_Size + 1;
Sender_Offset : constant Stream_Element_Offset := Message_Length_Size + 2;
function Length (M : Message_Type) return PDU_Index is
(M.Last - M.First + 1)
with Pre => (Valid (M));
-- Return length of message M
-----------------
-- Encapsulate --
-----------------
......@@ -71,59 +76,27 @@ package body PolyORB_HI.Messages is
Entity : Entity_Type)
return Stream_Element_Array
is
L : constant Stream_Element_Count := Length (Message) + Header_Size;
R : Stream_Element_Array (1 .. L);
L : constant Stream_Element_Count := Message.Last + Header_Size;
R : Stream_Element_Array (1 .. L) := (others => 0);
P : constant Stream_Element_Array (1 .. Length (Message))
:= Payload (Message);
begin
R (1 .. Message_Length_Size) := To_Buffer (L - 1);
R (Receiver_Offset) := Stream_Element (Internal_Code (Entity));
R (Sender_Offset) := Stream_Element (Internal_Code (From));
for J in 1 .. Length (Message) loop
R (Header_Size + J) := Message.Content (J);
end loop;
R (Header_Size + 1 .. Header_Size + Length (Message)) := P;
-- XXX GNATProve GPL 2014 limitation ?
return R;
end Encapsulate;
------------
-- Length --
------------
function Length (M : Message_Type) return Stream_Element_Count is
begin
return M.Last + 1 - M.First;
end Length;
-------------
-- Payload --
-------------
function Payload (M : Message_Type) return Stream_Element_Array is
Payload : Stream_Element_Array (M.First .. M.Last);
begin
for J in M.First .. M.Last loop
Payload (J) := M.Content (J);
end loop;
return Payload;
end Payload;
------------
-- Sender --
------------
function Sender (M : Message_Type) return Entity_Type is
begin
return Sender (M.Content (M.First .. M.Last));
end Sender;
------------
-- Sender --
------------
function Sender (M : Stream_Element_Array) return Entity_Type is
begin
return Corresponding_Entity (Integer_8 (M (Sender_Offset)));
return Corresponding_Entity (Unsigned_8 (M (Sender_Offset)));
end Sender;
----------
......@@ -135,19 +108,29 @@ package body PolyORB_HI.Messages is
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
L1 : constant Stream_Element_Count := Item'Length;
L2 : Stream_Element_Count := Length (Stream);
Read_Elts : constant Stream_Element_Count
:= Stream_Element_Count'Min (Item'Length, Length (Stream));
begin
if L1 < L2 then
L2 := L1;
Item := (others => 0);
if Read_Elts < 1 then
-- We have nothing to read, exit
Last := 0;
return;
elsif Read_Elts = Item'Length then
Last := Item'Last;
else
Last := Item'First + Read_Elts - 1;
end if;
for J in 0 .. L2 - 1 loop
Item (Item'First + J) := Stream.Content (Stream.First + J);
end loop;
Item (Item'First .. Last)
:= Stream.Content (Stream.First .. Stream.First + Read_Elts - 1);
Last := Item'First + L2 - 1;
Stream.First := Stream.First + L2;
if Stream.First + Read_Elts < Stream.Content'Last then
Stream.First := Stream.First + Read_Elts;
else
Stream.First := 0;