text
stringlengths
0
234
"L: display licence notice;" & NL &
"X: exit program.";
Command : Character := ' ';
Roman_calendar_type : Calendar_type := Unspecified;
-- Duration to substract to Julian Day of first day of a year, in order
-- to obtain time of "doomsday" at which the moon phase is computed.
To_Doomsday_time_duration : constant Historical_Duration
:= 86_400.0 + 4*3600.0 + 30*60.0;
-- To substract to Milesian epact to obtain a good estimate
-- of Easter full moon residue
To_Spring_Full_Moon : Constant := 12.52 * 86_400;
This_year : Historical_year_number := 0;
M_date: Milesian_date := (4, 12, -4713);
R_date : Roman_date := (1, 1, -4712);
This_Julian_day: Julian_day := 0; -- in integer days
This_historical_time: Historical_Time := 0.0; -- in seconds
Displayed_time: Fractional_day_duration := 0.0; -- in fractional days
This_hour : Hour_Number := 12;
This_minute : Minute_Number := 0;
This_second : Second_Number :=0;
Day_time : Day_Duration := 0.0;
Julian_hour : Day_Historical_Duration := 0.0;
Day_Number_in_Week : Integer range 0..6;
Moon_time, Moon_time_shift : H24_Historical_Duration;
Moon_hour : Hour_Number;
Moon_minute: Minute_Number;
Moon_second: Second_Number;
Moon_subsecond: Second_Duration;
Help_request, Licence_request : Exception;
begin
Put (Licence_text); New_Line;
loop
begin -- a block with exception handler
Put (Prompter); New_Line;
Get (Command);
case Command is
when 'H' => Skip_Line; raise Help_request;
when 'L' => Skip_Line; raise Licence_request;
when 'D' =>
--Get section
Get (Displayed_time); Skip_Line;
-- Conversion section
This_historical_time := Convert_from_julian_day (Displayed_time);
This_Julian_day := Julian_Day_Of (This_historical_time);
M_date := jd_to_milesian (This_Julian_day);
Julian_hour := This_historical_time - Julian_Duration_Of (This_Julian_day);
Day_time := Day_Offset (Julian_hour);
This_hour := Integer (Day_time) / 3600;
This_minute := Integer (Day_time) / 60 - This_hour*60;
This_second := Integer (Day_time) - This_hour*3600 - This_minute*60;
when 'G' | 'J' =>
-- Get section.
case Command is
when 'G' => Roman_calendar_type := Gregorian;
when 'J' => Roman_calendar_type := Julian;
when others => Roman_calendar_type := Unspecified;
end case;
R_date := (1, 1, -4712);
This_hour := 12; This_minute := 0; This_second := 0;
Get (R_date.year);
if not End_Of_Line then Get (R_date.month); end if;
if not End_Of_Line then Get (R_date.day); end if;
if not End_Of_Line then Get (This_hour); end if;
if not End_Of_Line then Get (This_minute); end if;
if not End_Of_Line then Get (This_second); end if;
Skip_Line;
-- Conversion section;
This_Julian_day := Roman_to_JD (R_date, Roman_calendar_type);
-- This function raises Time_Error if date is improper
Day_time := 3600.0 * This_hour + 60.0 * This_minute + 1.0 * This_second;
This_historical_time := Julian_Duration_Of (This_Julian_day) + Day_Julian_Offset (Day_time);
Displayed_time := Fractionnal_day_of (This_historical_time);
M_date := JD_to_Milesian (This_Julian_day);
when 'M' =>
M_Date := (1, 1, -4712);
This_hour := 12; This_minute := 0; This_second := 0;
Get (M_date.year);
if not End_Of_Line then Get (M_date.month); end if;
if not End_Of_Line then Get (M_date.day); end if;
if not End_Of_Line then Get (This_hour); end if;
if not End_Of_Line then Get (This_minute); end if;
if not End_Of_Line then Get (This_second); end if;
Skip_Line;
-- Conversion section;
This_Julian_day := Milesian_to_JD (M_date);
-- This function raises Time_Error if date is improper
Day_time := 3600.0 * This_hour + 60.0 * This_minute + 1.0 * This_second;
This_historical_time := Julian_Duration_Of (This_Julian_day) + Day_Julian_Offset (Day_time);