DEFINITION MODULE CalUtil;

(* Library module for Calendar and Cycling Diary Programs 

Author:  John Forester

Last edit: 22 Oct 87  *)


EXPORT QUALIFIED JulDay, CalDate, DayWeek, GetSDate, GetDate, WriteDate,
								 PrintDate;

(* Note About StartYr:
StartYr in the following procedure definitions is the last two digits of the
year that starts the century of dates that is available 
in any one implementation. 

StartYr must be the year immediately after a leap year
(such as 1981, for which StartYr = 81) 
and must be no earlier than 1901 (1)and no later than 1997 (97). 

Each using program must have a global CONST StartYr = the year you select.
(You could write the number into each parameter list, but that is dangerous.)

Select StartYr acording to the needs of the user of the program.

Do not change StartYr while any dated records are in files, because changing
StartYr changes the day sequence number on which all dates and index files
are based. *)

PROCEDURE JulDay(Day, Month, Year, StartYr : CARDINAL; VAR  Jday : CARDINAL);
(* Converts date to day sequence number *)
                                     
PROCEDURE CalDate(Jday, StartYr : CARDINAL; VAR Day : CARDINAL;
              VAR Month : ARRAY OF CHAR; VAR  MonthNum, Year : CARDINAL);
(* Converts day sequence number to date with format '15 Jan 80' *)

PROCEDURE DayWeek(Jday, StartYr : CARDINAL; VAR Wday : ARRAY OF CHAR);
(* Converts day sequence number to day of week in format 'Wed' *)

PROCEDURE GetSDate(VAR Day, Month, Year, Hour, Minute : CARDINAL;
                  VAR Monthstring, DayString : ARRAY OF CHAR;
                  StartYr : CARDINAL);
(* Gets system's date and time from DOS *)

PROCEDURE GetDate(VAR Day, Month, Year : CARDINAL; DateStyle : CHAR);
(* Gets a date in American or British format. 
   DateStyle must be 'A' or 'B' *)

PROCEDURE WriteDate(Day, Month, Year : CARDINAL; DateStyle : CHAR);
(* Writes Date on screen in American or British format. 
   DateStyle must be 'A' or 'B' *)
   
PROCEDURE PrintDate(Day, Month, Year : CARDINAL; DateStyle : CHAR);
(* Prints Date in American or British format.
	 DateStyle must be 'A' or 'B' *)
	 
END CalUtil.
