Skip to content

Commit

Permalink
Make the router a task type and start it during GUI creation
Browse files Browse the repository at this point in the history
  • Loading branch information
SMerrony committed Mar 13, 2022
1 parent 10ab6e4 commit c4b8dbd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Src/gui.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,8 @@ package body GUI is
Main_Window.Add (Main_Grid);
Main_Window.Set_Position (Gtk.Enums.Win_Pos_Center);

Redirector.Router := new Redirector.Router_TT;

Redirector.Router.Set_Destination (Redirector.Local);
Redirector.Router.Set_Handler (Redirector.Visual);
Main_Window.On_Key_Press_Event (Handle_Key_Press_Event_CB'Unrestricted_Access);
Expand Down
2 changes: 1 addition & 1 deletion Src/gui.ads
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ package GUI is
package Handlers is new Gtk.Handlers.Callback (Widget_Type => Gtk.Widget.Gtk_Widget_Record);
package SB_Timeout_P is new Glib.Main.Generic_Sources (Gtk.Box.Gtk_Box);

App_SemVer : constant String := "v0.11.0"; -- TODO Update Version each release!
App_SemVer : constant String := "v0.11.1"; -- TODO Update Version each release!
App_Title : constant String := "DasherA";
App_Comment : constant String := "A Data General DASHER terminal emulator";
App_Author : constant String := "Stephen Merrony";
Expand Down
4 changes: 2 additions & 2 deletions Src/redirector.adb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ with Xmodem;

package body Redirector is

task body Router is
task body Router_TT is
begin
loop
select
Expand Down Expand Up @@ -62,6 +62,6 @@ package body Redirector is
terminate;
end select;
end loop;
end Router;
end Router_TT;

end Redirector;
13 changes: 8 additions & 5 deletions Src/redirector.ads
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,24 @@

package Redirector is

pragma Elaborate_Body;
-- pragma Elaborate_Body;

type Connection_T is (Local, Async, Network);
type Handler_T is (Visual, Xmodem_Rx, Xmodem_Tx);

task Router is
task type Router_TT is
Entry Set_Destination (Dest : in Connection_T);
Entry Get_Destination (Dest : out Connection_T);
Entry Send_Data (Data : in String);
Entry Set_Handler (Handlr : in Handler_T);
Entry Handle_Data (C : in Character);
end Router;
end Router_TT;
type Router_Acc is access Router_TT;

Router : Router_Acc;

private
Destination : Connection_T;
Handler : Handler_T;
Destination : Connection_T := Local;
Handler : Handler_T := Visual;

end Redirector;

0 comments on commit c4b8dbd

Please sign in to comment.