Commit 848b7a0a authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Give proper access to the system state to Python

parent 4dc61ebb
...@@ -102,6 +102,9 @@ package body Simulator_Interface is ...@@ -102,6 +102,9 @@ package body Simulator_Interface is
end case; end case;
-- User code modified the application state -> place it in the full state -- User code modified the application state -> place it in the full state
Update_State (Full_State, User_State); Update_State (Full_State, User_State);
-- Uncomment the following line to display the current system state
-- (useful when debugging the Python interface)
-- Put_Line ("[-] Simulator.State: " & ASN1_GSER.Image (User_State));
end Process_Event; end Process_Event;
......
...@@ -22,8 +22,11 @@ package Simulator_Interface is ...@@ -22,8 +22,11 @@ package Simulator_Interface is
-- not visible here. This is an opaque type, but it is tagged, -- not visible here. This is an opaque type, but it is tagged,
-- and user provides function to read/write the application state -- and user provides function to read/write the application state
Full_State : State_With_Observers; Full_State : State_With_Observers;
-- State without observers, exported for python ctypes interfacing User_State : aliased asn1SccSystem_State;
User_State : aliased asn1SccSystem_State
-- Interface to get the system state exported for python calls from ctypes
function Get_User_State return access asn1SccSystem_State
is (User_State'Access)
with Export, Convention => C, Link_Name => "global_state"; with Export, Convention => C, Link_Name => "global_state";
procedure Simulation_Startup; procedure Simulation_Startup;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment