home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s4.arc / WRITEPRT.MOD < prev    next >
Text File  |  1988-02-11  |  4KB  |  98 lines

  1. (*----------------------------------------------------------------------*)
  2. (*         Write_Prt  --- Write a character to the printer              *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Write_Prt( Ch : CHAR );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Write_Prt                                            *)
  10. (*                                                                      *)
  11. (*     Purpose:    Writes one character to printer                      *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Write_Prt( Ch : CHAR );                                       *)
  16. (*                                                                      *)
  17. (*           Ch  --- Character to write out to printer                  *)
  18. (*                                                                      *)
  19. (*----------------------------------------------------------------------*)
  20.  
  21. VAR
  22.    Ierr        : INTEGER;
  23.    KCh         : CHAR;
  24.    Local_Save  : Saved_Screen_Ptr;
  25.  
  26. BEGIN (* Write_Prt *)
  27.                                    (* Don't write if printer not open! *)
  28.    Ierr := 0;
  29.    
  30.    IF Lst_OK THEN
  31.       BEGIN
  32.          WRITE( Lst , Ch );
  33.          Ierr := Int24Result;
  34.       END;
  35.                                    (* Indicate printing error occurred *)
  36.  
  37.    IF ( Lst_OK AND ( Ierr <> 0 ) ) THEN
  38.       BEGIN
  39.  
  40.          Draw_Titled_Box( Local_Save, 10, 10, 60, 17, 'Printer Error' );
  41.  
  42.                                    (* Have to drain keyboard in case  *)
  43.                                    (* error occurred with stuff still *)
  44.                                    (* in keyboard buffer -- needed to *)
  45.                                    (* prevent premature exit at the   *)
  46.                                    (* "press any" prompt.             *)
  47.  
  48.          WHILE PibTerm_KeyPressed DO
  49.             Read_Kbd( KCh );
  50.  
  51.          WRITELN;
  52.          WRITELN(' Printer is not ready, please check to see');
  53.          WRITELN(' that it is powered on and has enough paper.');
  54.          WRITELN(' ');
  55.          WRITE  (' ');
  56.  
  57.          Press_Any;
  58.  
  59.          Restore_Screen_And_Colors( Local_Save );
  60.  
  61.          WRITE( Lst , Ch );
  62.  
  63.          Lst_OK := ( Int24Result = 0 );
  64.  
  65.       END;
  66.  
  67. END   (* Write_Prt *);
  68.  
  69. (*----------------------------------------------------------------------*)
  70. (*         Write_Prt_Str     --- Write string to the printer            *)
  71. (*----------------------------------------------------------------------*)
  72.  
  73. PROCEDURE Write_Prt_Str( S : AnyStr );
  74.  
  75. (*----------------------------------------------------------------------*)
  76. (*                                                                      *)
  77. (*     Procedure:  Write_Prt_Str                                        *)
  78. (*                                                                      *)
  79. (*     Purpose:    Writes a string to the printer                       *)
  80. (*                                                                      *)
  81. (*     Calling Sequence:                                                *)
  82. (*                                                                      *)
  83. (*        Write_Prt_Str( S : AnyStr );                                  *)
  84. (*                                                                      *)
  85. (*           S --- String to write to printer                           *)
  86. (*                                                                      *)
  87. (*----------------------------------------------------------------------*)
  88.  
  89. VAR
  90.    IS : INTEGER;
  91.  
  92. BEGIN (* Write_Prt_Str *)
  93.  
  94.    IF Lst_OK THEN
  95.       FOR IS := 1 TO LENGTH( S ) DO
  96.          Write_Prt( S[IS] );
  97.  
  98. END   (* Write_Prt_Str *);