Guardian Programmer's Guide

Table Of Contents
Communicating With Printers
Guardian Programmer’s Guide 421922-014
11 - 39
Sample Program for Using a Printer
!------------------------------------------------------------
! Procedure to stop printing. This procedure positions the
! paper at the top of the form and closes the printer.
!------------------------------------------------------------
PROC FORMFEED^AND^CLOSE(PNUM);
INT PNUM;
BEGIN
LITERAL POSITION = 1;
LITERAL TOP^OF^FORM = 0;
! Position the paper to the top-of-form:
CALL CONTROL(PNUM,POSITION,TOP^OF^FORM);
IF <> THEN CALL FILE^ERRORS(PNUM);
! Close the printer:
CALL FILE_CLOSE_(PNUM);
IF <> THEN CALL FILE^ERRORS(PNUM);
END;
!------------------------------------------------------------
! Procedure for printing a line on the printer. This
! procedure returns when the line has been successfully
! printed.
!
! If printing is unsuccessful, then the FILEERROR procedure
! offers the user the option of trying again.
!------------------------------------------------------------
PROC PRINT^OUT(PRINTER^NUM,SBUFFER,WCOUNT);
INT PRINTER^NUM;
STRING .SBUFFER;
INT WCOUNT;
BEGIN
INT ERROR;
ERROR := 1;
WHILE ERROR DO
BEGIN
CALL WRITEX(PRINTER^NUM,SBUFFER,WCOUNT);
IF <> THEN
BEGIN
IF NOT FILEERROR(PRINTER^NUM)
THEN CALL FILE^ERRORS(PRINTER^NUM);
END
ELSE ERROR := 0;
END;
END;