Skip to content

Commit

Permalink
Improve tracing of events (in table, x_mng and event_mng)
Browse files Browse the repository at this point in the history
  • Loading branch information
malaise committed Aug 24, 2023
1 parent dcf21a8 commit a7f715d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion usr/freecell/freecell.adb
Expand Up @@ -48,7 +48,8 @@ procedure Freecell is
begin
-- Init traces to debug
Trace.Init_Env (
(As.U.Tus ("Main"), As.U.Tus ("Memory"),
(As.U.Tus ("X_Mng"), As.U.Tus ("Event_Mng"),
As.U.Tus ("Main"), As.U.Tus ("Memory"),
As.U.Tus ("Movements"), As.U.Tus ("Table")),
"Debug", "/tmp/Freecell.log");
Logger.Init ("Main");
Expand Down
8 changes: 6 additions & 2 deletions usr/freecell/table.adb
Expand Up @@ -379,7 +379,7 @@ package body Table is
if Dur = Timers.Infinite_Seconds and then not Event_Pool.Is_Empty then
-- Event expected and present
Event := Event_Pool.Pop;
Logger.Log_Debug (" Popping " & Event.Kind'Img &
Logger.Log_Debug (" Wait: Popping " & Event.Kind'Img &
(if Event.Kind in Card_Event_List then
" " & Event.Card.Image else "") );
return Event;
Expand All @@ -392,7 +392,9 @@ package body Table is
when Con_Io.Break =>
Event := (Kind => Quit);
Event_Pool.Push (Event);
Logger.Log_Debug (" Wait: Break");
when Con_Io.Mouse_Button =>
Logger.Log_Debug (" Wait: Mouse");
Console.Get_Mouse_Event (Mouse_Event, Con_Io.X_Y);
if Mouse_Event.Xref /= X_Mng.Null_Reference then
if Decode_Card_Event (Mouse_Event, Event) then
Expand All @@ -408,11 +410,13 @@ package body Table is
end if;
Console.Get_Mouse_Event (Mouse_Event, Con_Io.X_Y);
when Con_Io.Refresh =>
Logger.Log_Debug (" Wait: Refresh");
Put_Menu;
when Con_Io.Timeout =>
Logger.Log_Debug (" Wait: Timeout");
return Event;
when others =>
null;
Logger.Log_Debug (" Wait: " & Stat'Img);
end case;
end loop;
end Wait;
Expand Down
3 changes: 2 additions & 1 deletion usr/lapeau/lapeau.adb
Expand Up @@ -48,7 +48,8 @@ procedure Lapeau is
begin
-- Init traces to debug
Trace.Init_Env (
(As.U.Tus ("Main"), As.U.Tus ("Memory"),
(As.U.Tus ("X_Mng"), As.U.Tus ("Event_Mng"),
As.U.Tus ("Main"), As.U.Tus ("Memory"),
As.U.Tus ("Movements"), As.U.Tus ("Table")),
"Debug", "/tmp/Lapeau.log");
Logger.Init ("Main");
Expand Down
8 changes: 6 additions & 2 deletions usr/lapeau/table.adb
Expand Up @@ -397,7 +397,7 @@ package body Table is
if Dur = Timers.Infinite_Seconds and then not Event_Pool.Is_Empty then
-- Event expected and present
Event := Event_Pool.Pop;
Logger.Log_Debug (" Popping " & Event.Kind'Img &
Logger.Log_Debug (" Wait: Popping " & Event.Kind'Img &
(if Event.Kind in Card_Event_List then
" " & Event.Card.Image else "") );
return Event;
Expand All @@ -408,9 +408,11 @@ package body Table is
Time_Out => Expiration);
case Stat is
when Con_Io.Break =>
Logger.Log_Debug (" Wait: Break");
Event := (Kind => Quit);
Event_Pool.Push (Event);
when Con_Io.Mouse_Button =>
Logger.Log_Debug (" Wait: Mouse");
Console.Get_Mouse_Event (Mouse_Event, Con_Io.X_Y);
if Mouse_Event.Xref /= X_Mng.Null_Reference then
if Decode_Card_Event (Mouse_Event, Event) then
Expand All @@ -426,11 +428,13 @@ package body Table is
end if;
Console.Get_Mouse_Event (Mouse_Event, Con_Io.X_Y);
when Con_Io.Refresh =>
Logger.Log_Debug (" Wait: Refresh");
Put_Menu;
when Con_Io.Timeout =>
Logger.Log_Debug (" Wait: Tiemout");
return Event;
when others =>
null;
Logger.Log_Debug (" Wait: " & Stat'Img);
end case;
end loop;
end Wait;
Expand Down

0 comments on commit a7f715d

Please sign in to comment.