{***********************************************************************}
{									}
{ __DateStr   Return the system date					}
{									}
{ function  __DateStr(var Year,Month,Day : word) : string;		}
{									}
{	      Year	The returned year in the range 1980 to 2099.	}
{	      Month	The returned month in the range 1 to 12.	}
{	      Day	The returned day in the range 1 to 31.		}
{									}
{ Description __DateStr returns the system date in the word vari-	}
{	      ables Year, Month, and Day.  The functional value is a	}
{	      string providing a full day and date description.  For	}
{	      example, 05/26/85 is returned as: 			}
{									}
{			Sunday May 26, 1988				}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc. 1987		}
{_______________________________________________________________________}

function  __DateStr(var Year,Month,Day : word) : string;

  type
    WeekDays	= array[0..6]  of string[9];
    Months	= array[1..12] of string[9];

  const
    BLANK      = #32;
    COMMA      = #44;		       { Comma (ASCII 44) character	}

  var
    DayNames   : WeekDays;
    MonthNames : Months;
    DayOfWeek  : word;
    YearStr    : string[4];
    DayStr     : string[2];
    Regs       : registers;

  begin {__DateStr}

    { The arrays DayNames and MonthNames are initialized here to avoid	}
    { the data space overhead imposed by typed constants.  This 	}
    { approach is taken so that use of the string unit does not impose	}
    { an overhead for procedures which may not be used. 		}

    DayNames[0]    := 'Sunday';
    DayNames[1]    := 'Monday';
    DayNames[2]    := 'Tuesday';
    DayNames[3]    := 'Wednesday';
    DayNames[4]    := 'Thursday';
    DayNames[5]    := 'Friday';
    DayNames[6]    := 'Saturday';

    MonthNames[1]  := 'January';
    MonthNames[2]  := 'February';
    MonthNames[3]  := 'March';
    MonthNames[4]  := 'April';
    MonthNames[5]  := 'May';
    MonthNames[6]  := 'June';
    MonthNames[7]  := 'July';
    MonthNames[8]  := 'August';
    MonthNames[9]  := 'September';
    MonthNames[10] := 'October';
    MonthNames[11] := 'November';
    MonthNames[12] := 'December';

    GetDate(Year,Month,Day,DayOfWeek);
    Str(Year:4,YearStr);	       { Now construct the string.	}
    Str(Day,DayStr);
    __DateStr := DayNames[DayOfWeek] + BLANK + MonthNames[Month] +
		 BLANK + DayStr + COMMA + BLANK + YearStr

  end;	{__DateStr}
