home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s1.arc / CAPTUREC.MOD < prev    next >
Text File  |  1988-01-25  |  3KB  |  79 lines

  1. (*----------------------------------------------------------------------*)
  2. (*          Capture_Char -- write character to capture file             *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Capture_Char( Ch : CHAR );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Capture_Char                                         *)
  10. (*                                                                      *)
  11. (*     Purpose:    Writes character to capture file                     *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Capture_Char( Ch : CHAR );                                    *)
  16. (*                                                                      *)
  17. (*           Ch --- the character to be written out                     *)
  18. (*                                                                      *)
  19. (*     Remarks:                                                         *)
  20. (*                                                                      *)
  21. (*        If Exact_Capture is TRUE, then characters are written just    *)
  22. (*        as they are received.  If Exact_Capture is FALSE, then        *)
  23. (*        a full screen image line is gathered up and written when      *)
  24. (*        an LF or FF is encountered.                                   *)
  25. (*                                                                      *)
  26. (*----------------------------------------------------------------------*)
  27.  
  28. VAR
  29.    Screen_Line : AnyStr;
  30.    IY          : INTEGER;
  31.    Local_Save  : Saved_Screen_Ptr;
  32.  
  33. BEGIN (* Capture_Char *)
  34.  
  35.    IF Exact_Capture THEN
  36.       IF ( Ch = CHR( LF ) ) THEN
  37.          WRITELN( Capture_File )
  38.       ELSE
  39.          WRITE( Capture_File , Ch )
  40.    ELSE
  41.       BEGIN
  42.          IF ( ( Ch = CHR( LF ) ) OR ( Ch = CHR( FF ) ) ) THEN
  43.             BEGIN
  44.                IY := WhereY;
  45.                Get_Screen_Text_Line( Screen_Line , IY, 1 );
  46.                WRITELN( Capture_File , TRIM( Screen_Line ) );
  47.             END;
  48.          IF ( Ch = CHR( FF ) ) THEN
  49.             WRITE( Capture_File , Ch );
  50.       END;
  51.                                    (* If I/O error on capture file, *)
  52.                                    (* close it.                     *)
  53.    IF ( Int24Result <> 0 ) THEN
  54.       BEGIN
  55.  
  56.          Draw_Titled_Box( Local_Save, 10, 10, 70, 16, 'Error in Capture' );
  57.  
  58.          CLOSE( Capture_File );
  59.  
  60.          IY         := Int24Result;
  61.  
  62.          Capture_On := FALSE;
  63.  
  64.          WRITELN;
  65.          WRITELN('*** Capture to ', Capture_File_Name,
  66.                  ' stopped because of I/O error.');
  67.          WRITELN('*** The receiving disk may be out of room.');
  68.  
  69.          Press_Any;
  70.  
  71.          Restore_Screen_And_Colors( Local_Save );
  72.  
  73.          Set_Status_Line_Name( Short_Terminal_Name );
  74.          Write_To_Status_Line( Status_Line_Name, 1 );
  75.  
  76.       END;
  77.  
  78. END   (* Capture_Char *);
  79.