(*----------------------------------------------------------------------*)
(*         Writelne --- Write line and echo to printer/capture file     *)
(*----------------------------------------------------------------------*)

PROCEDURE Writelne( T : AnyStr; On_Screen : BOOLEAN );

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Procedure:  Writelne                                             *)
(*                                                                      *)
(*     Purpose:    Displays line on screen/printer/capture file.        *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        Writelne( T : AnyStr; On_Screen : BOOLEAN );                  *)
(*                                                                      *)
(*           T         --- Text to be displayed                         *)
(*           On_Screen --- TRUE to display text on screen               *)
(*                                                                      *)
(*      Calls:   None                                                   *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

BEGIN (* Writelne *)
                                   (* Display on screen *)
   IF On_Screen THEN
      WRITELN( T );
                                   (* Write to capture file *)
   IF Capture_On THEN
      WRITELN( Capture_File, T );
                                   (* Write to printer *)
   IF Printer_On THEN
      WRITELN( Lst, T );
                                   (* Point to next slot in review buffer *)

   Review_Head := Review_Head + 1;
   IF Review_Head > Max_Review_Length THEN
      Review_Head := 1;
                                   (* If we wrapped into last line,       *)
                                   (* update last line pointer            *)

   IF Review_Head = Review_Tail THEN
      BEGIN
         Review_Tail := Review_Tail + 1;
         IF Review_Tail > Max_Review_Length THEN
            Review_Tail := 1;
      END;

   IF Review_Tail = 0 THEN
      Review_Tail := 1;

   Review_Buffer^[Review_Head] := T;

END   (* Writelne *);
