text
stringlengths
0
234
-- Unix_Time : Time :=
-- Value (Date => Image (Date => Now, Include_Time_Fraction => True),
-- Time_Zone => UTC_Time_Offset);
begin
for A in 1 .. Argument_Count loop
if Argument (A) = "-iso" or
Argument (A) = "-I" or
Argument (A) = "-i"
then
String'Write
(Stream (Current_Output),
Image (Date => Now, Picture => "%Y-%m-%d"));
elsif Argument (A) = "-n" or Argument (A) = "-nano" then
String'Write
(Stream (Current_Output),
Image (Date => Unix_Time, Picture => "%s.%o"));
elsif Argument (A) (1) = '+' then
declare
Feature_Argument : String := Argument (A);
begin
String'Write
(Stream (Current_Output),
Image
(Date => Now,
Picture =>
Picture_String
(Feature_Argument
(Feature_Argument'First + 1 ..
Feature_Argument'Last))));
Function Definition: procedure ArrivalForRepair is
Function Body: package FloatIO is new Ada.Text_IO.Float_IO(float);
use FloatIO;
package IntIO is new Ada.Text_IO.Integer_IO(Integer);
use IntIO;
package Fix_IO is new Ada.Text_IO.Fixed_IO(DAY_DURATION);
use Fix_IO;
function intToChar is new Unchecked_Conversion(Integer, Character);
charStar, charTie : Character := 'A';
intStar, intTie : Integer := 64;
subtype getChar is Character range 'A'..'Z';
lastCharOfTie, lastCharOfStar : getChar := getChar'First;
type vehicle is
(Star_Destroyer, Tie_Fighter);
package vechileIO is new Ada.Text_IO.Enumeration_IO(vehicle);
type vName is
(Tie, Star);
package nameIO is new Ada.Text_IO.Enumeration_IO(vName);
-- Maintainance bay record
type garageBay is record
vehicleType : vehicle;
vehicleName: String(1..5);
time2Fix: integer;
startTime: Time;
finishTime: Time;
--elapsedTime: DAY_DURATION;
end record;
a : garageBay;
-- Function to determine if the arriving planes are Star or Tie
function StarOrTie(x: in out integer) return garageBay is
randNum: float;
z,b,c,d : garageBay;
e : Time := Clock;
--seed: integer;
begin
randNum := next_float(x); -- 0.0 <= randNumm <= 1.0.
if randNum <= 0.25 then
z := (vehicleType => Tie_Fighter, vehicleName => "Tie ", time2Fix => 0, startTime => e, finishTime => e);
return a; -- return tie
elsif randNum <= 0.5 then
b := (vehicleType => Tie_Fighter, vehicleName => "Tie ", time2Fix => 0, startTime => e, finishTime => e);
return b; -- return tie
elsif randNum <= 0.75 then
c := (vehicleType => Tie_Fighter, vehicleName => "Tie ", time2Fix => 0, startTime => e, finishTime => e);
return c; -- return tie
else
d := (vehicleType => Star_Destroyer, vehicleName => "Star ", time2Fix => 0, startTime => e, finishTime => e);
return d; -- return stsr
end if;
end StarOrTie;
-- Determine the number of new arrivals for Step 1 in the lab.
-- Either 1, 2, 3 or 4 uniformly distributed on each call.
function NumberNewArrivals(x: in out integer) return Integer is