Formats a print line.
None (provided by the print formatter)
int lineout ( fileptr)
The lineout subroutine is invoked by the formatter driver only if the setup subroutine returns a non-null pointer. This subroutine is invoked for each line of the document being formatted. The lineout subroutine reads the input data stream from the fileptr parameter. It then formats and outputs the print line until it recognizes a situation that causes vertical movement on the page.
The lineout subroutine should process all characters to be printed and all printer commands related to horizontal movement on the page.
The lineout subroutine should not output any printer commands that cause vertical movement on the page. Instead, it should update the vpos (new vertical position) variable pointed to by the shars_vars structure that it shares with the formatter driver to indicate the new vertical position on the page. It should also refresh the shar_vars variables for vertical increment and vertical decrement (reverse line-feed) commands.
When the lineout subroutine returns, the formatter driver sends the necessary commands to the printer to advance to the new vertical position on the page. This position is specified by the vpos variable. The formatter driver automatically handles top and bottom margins, new pages, initial pages to be skipped, and progress reports to the qdaemon daemon.
The following conditions can cause vertical movements:
Other conditions unique to a specific printer also cause vertical movement.
|fileptr||Specifies a file structure for the input data stream.|
Upon successful completion, the lineout subroutine returns the number of bytes processed from the input data stream. It excludes the end-of-file character and any control characters or escape sequences that result only in vertical movement on the page (for example, line feed or vertical tab).
If a value of 0 is returned and the value in the vpos variable pointed to by the shars_vars structure has not changed, or there are no more data bytes in the input data stream, the formatter driver assumes that printing is complete.
If the lineout subroutine detects an error, it uses the piomsgout subroutine to issue an error message. It then invokes the pioexit subroutine with a value of PIOEXITBAD.
Note: If either the piocmdout or piogetstr subroutine detects an error, it automatically issues its own error messages and terminates the print job.
The piocmdout subroutine, pioexit subroutine, piogetstr subroutine, piomsgout subroutine, setup subroutine.
Adding a New Printer Type to Your System and Printer Addition Management Subsystem: Programming Overview in AIX 5L Version 5.1 Kernel Extensions and Device Support Programming Concepts.
Example of Print Formatter in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.