-- Transport mechanism: TelNet interface to Log facilities

-- [Juniper]<DMS>MS>ReadLog.mesa

-- Randy Gobbel		19-May-81 18:46:13
-- Andrew Birrell	 2-Jun-81 15:45:36

DIRECTORY
Ascii		USING[ CR ],
EnquiryDefs	USING[ Handle ],
LogPrivateDefs	USING[ AppendElapsedTime, houses, NumberHouse, startUpTime,
		       uptimeHouse ],
Time		USING[ Current ];

ReadLog: PROGRAM
IMPORTS LogPrivateDefs, Time
EXPORTS EnquiryDefs =

BEGIN

DisplayStats: PUBLIC PROC[str: EnquiryDefs.Handle] =
   BEGIN
   OPEN str;
   WriteChar[Ascii.CR];
   WriteString[LogPrivateDefs.uptimeHouse.caption];
   BEGIN
      s: STRING = [20];
      LogPrivateDefs.AppendElapsedTime[s,
        Time.Current[] - LogPrivateDefs.startUpTime];
      WriteString[s];
   END;
   WriteChar[Ascii.CR];
      FOR houseIndex: CARDINAL IN [0..LENGTH[LogPrivateDefs.houses])
      DO house: LogPrivateDefs.NumberHouse =
             @(LogPrivateDefs.houses[houseIndex]);
         WriteChar[Ascii.CR];
         WriteString[house.caption];
         WriteString[":  "L];
         WITH h:house SELECT FROM
           short =>
             BEGIN
             WriteDecimal[h.min]; WriteString[" .. "L];
             WriteDecimal[h.p↑]; WriteString[" .. "L];
             WriteDecimal[h.max];
             END;
           long =>
             BEGIN
             WriteLongDecimal[h.min]; WriteString[" .. "L];
             WriteLongDecimal[h.p↑]; WriteString[" .. "L];
             WriteLongDecimal[h.max];
             END;
           percent =>
             BEGIN
             WriteDecimal[h.min]; WriteString[" .. "L];
             WriteDecimal[h.p↑]; WriteString[" .. "L];
             WriteDecimal[h.max]; WriteChar['%];
             END;
         ENDCASE => ERROR;
      ENDLOOP;
      WriteChar[Ascii.CR];
   END;


END.