text stringlengths 0 234 |
|---|
procedure Delete (Item : in out Finder_Access) is |
begin |
Item := null; |
end Delete; |
begin |
Finder_Array.Update_Element (ID, Delete'Access); |
Function Definition: procedure Main is |
Function Body: package SU renames Ada.Strings.Unbounded; |
package Calendar renames Ada.Calendar; |
type Argument_Option is (verbose, input, output); |
type Boolean_Flag is (True, False); |
File : File_Type; |
Fields : Slice_Set; |
Seconds_Per_Hour : Integer; |
Start : Calendar.Time; |
Clock : array(1..2) of Integer; |
Verbose_Flag : Boolean := FALSE; |
In_Filename : SU.Unbounded_String := SU.To_Unbounded_String ("input"); |
Out_Filename : SU.Unbounded_String := SU.To_Unbounded_String ("output"); |
T : Integer; -- number of trains |
TT : Integer; -- number of Turntables |
NT : Integer; -- number of NormalTracks |
ST : Integer; -- number of StationTracks |
Turntables : Turntables_Ptr; |
Normal_Tracks : Normal_Tracks_Ptr; |
Station_Tracks : Station_Tracks_Ptr; |
Trains : Trains_Ptr; |
Connections : Connections_Ptr; |
type Command is ('c', 'p', 't', 'u', 'n', 's', 'h', 'q'); |
task Talk is |
entry Start; |
end Talk; |
task body Talk is |
C : String (1..1); |
Last : Natural; |
begin |
accept Start; |
Put_Line("Input char for action, availble commands:"); |
Put_Line(" 'p' - current trains positions,"); |
Put_Line(" 't' - list trains,"); |
Put_Line(" 'u' - list turntables,"); |
Put_Line(" 'n' - list normal tracks,"); |
Put_Line(" 's' - list station tracks,"); |
Put_Line(" 'h' - print this menu again,"); |
Put_Line(" 'q' - to quit simulation."); |
while TRUE loop |
Get_Line(C, Last); |
case C(1) is |
when 'p' => |
null; |
for I in 0 .. T-1 loop |
Put_Line(As_String(Trains (I)) & ": " & Trains (I).Att.As_String); |
end loop; |
when 't' => |
for I in 0 .. T-1 loop |
Put_Line(As_Verbose_String(Trains (I))); |
end loop; |
when 'u' => |
for I in 0 .. TT-1 loop |
Put_Line(Turntables (I).As_Verbose_String); |
end loop; |
when 'n' => |
for I in 0 .. NT-1 loop |
Put_Line(Normal_Tracks (I).As_Verbose_String); |
end loop; |
when 's' => |
for I in 0 .. ST-1 loop |
Put_Line(Station_Tracks (I).As_Verbose_String); |
end loop; |
when 'h' => |
Put_Line("Input char for action, availble commands:"); |
Put_Line(" 'p' - current trains positions,"); |
Put_Line(" 't' - list trains,"); |
Put_Line(" 'u' - list turntables,"); |
Put_Line(" 'n' - list normal tracks,"); |
Put_Line(" 's' - list station tracks,"); |
Put_Line(" 'h' - print this menu again,"); |
Put_Line(" 'q' - to quit simulation."); |
when 'q' => OS_Exit(0); |
when others => null; |
end case; |
C := "#"; |
end loop; |
end Talk; |
function Read_Fields(F: File_Type; Expected: Positive) return Slice_Set is |
File_Line : SU.Unbounded_String; |
Fields : Slice_Set; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.