procedure MAKE_A_STEP is NEED_GO : BOOLEAN;
begin
INCREMENT_STEPN;
-- advance steps counter
if IS_SYNC_TIME = true then
-- synchronous (simulated) time model is used
if get_stepN >1 then
INCR_TIME;
-- in synchronous time model,
-- time is advanced at each step
-- except for the first step when model
-- enters its default states
end if;
WAS_UPDATE := true;
-- this means that each step
-- involves some update
WAIT4INPUT;
end if;
TOP_LEVEL.LO_MAIN;
-- execution of step; all changes are
-- buffered till the end of the step
SEMAPHORE.LOCK;
-- to process the last step’s changes,
-- block the arrival of new external
-- changes to the main task
UPDATE_VALUES(NEED_GO);
-- assign elements their new values,
-- according to changes in the step
WAS_UPDATE := WAS_UPDATE or DEB_WAS_UPDATE;
-- true if there were changes in the
-- previous step, or
-- an element was changed between
-- steps using the Debugger’s SET command
if not NEED_GO and then (not WAS_UPDATE) then
-- check whether to enter the wait mode;
-- do it if there were no updates in
-- 2 last steps
SLEEPING := TRUE;
-- mark the main task as going
-- to enter the wait mode
SEMAPHORE.RELEASE;
-- and now allow arrival of new
-- external changes to the main task
WAIT4INPUT;
-- if meanwhile an external input was
-- generated then accept it
-- otherwise enter the wait mode
else
SEMAPHORE.RELEASE;
-- allow arrival of new external changes
end if;
WAS_UPDATE := NEED_GO;
TRANSMITTER.EVAL_CALLBACKS;
-- at the end of step, evaluate all
-- callbacks - according to hooks
-- requested in Compilation Profile,
-- and according to panel bindings
GARBAGE_COLLECT;
-- free memory which was temporarily allocated