text stringlengths 0 234 |
|---|
Stop : Boolean := False; |
S: String(1..5) := (others => ASCII.NUL); |
--CMD : BControl.Command_Type := (1 => 'b', 2 => 'l', 3 => 's'); |
CMD : BControl.Command_Type; |
begin |
-- Init; |
-- Gio.Gio_Set_Direction(Reg_Het.hetPort1'Access, 16#FFFFFFFF#); |
loop |
--Control.Put_Line("Before Get_Line"); |
S := Control.Get_Line; |
Control.Put_Line("Got Data"); |
Control.Put_Line(S); |
--CMD := Bcontrol.Command_Type(S(1..3)); |
CMD := BControl.Command_Type'Value(S(1..3)); |
Bcontrol.Command.Send(CMD); |
end loop; |
-- Blinker_Control.Blink_Stop; |
Function Definition: procedure Main is |
Function Body: task type Blinker_Type is |
entry Start(S : String); |
entry Stop; |
end Blinker_Type; |
task Blinker_Control is |
entry Blink_Left; |
entry Blink_Right; |
entry Blink_Emergency; |
entry Blink_Stop; |
end Blinker_Control; |
Left_Blinker, Right_Blinker: Blinker_Type; |
task body Blinker_Control is |
Blinker_Left_Started : Boolean := False; |
Blinker_Right_Started : Boolean := False; |
begin |
loop |
select |
when not Blinker_Left_Started => |
accept Blink_Left; |
Left_Blinker.Start("left "); |
Blinker_Left_Started := True; |
or |
when not Blinker_Right_Started => |
accept Blink_Right; |
Right_Blinker.Start("right"); |
Blinker_Right_Started := True; |
or |
accept Blink_Emergency; |
Left_Blinker.Start("left "); |
Right_Blinker.Start("right"); |
Blinker_Left_Started := True; |
Blinker_Right_Started := True; |
or |
when Blinker_Left_Started or Blinker_Right_Started => |
accept Blink_Stop; |
if Blinker_Left_Started then |
Left_Blinker.Stop; |
end if; |
if Blinker_Right_Started then |
Right_Blinker.Stop; |
end if; |
or |
terminate; |
end select; |
end loop; |
end Blinker_Control; |
task body Blinker_Type is |
Id : String(1..5); |
begin |
loop |
select |
accept Start(S : String) do |
Id := S; |
end Start; |
loop |
select |
accept Stop; |
exit; |
or |
delay 0.5; |
Text_Io.Put_Line("Blinker " & Id & " toggling"); |
end select; |
end loop; |
or terminate; |
end select; |
end loop; |
end Blinker_Type; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.