CAPS Universe documentation  1.0.4
All you need to know to be successful
Functions
job-loop.c File Reference

Functions to loop through a full print job. More...

Functions

static int caps_drv_job_process (struct caps_drv *cdrv)
 
static int caps_drv_job_wait (struct caps_drv *cdrv)
 
static int _job_attach (struct caps_drv *cdrv, int fd, struct caps_ppd_options_table *ppd_options, const char *params)
 
static int _job_print (struct caps_drv *cdrv)
 
int caps_drv_jobs_loop (struct caps_drv *cdrv, const char *filename, const char *params)
 

Detailed Description

Author
Jürgen Borleis
Warning
Use as experimental

Function Documentation

◆ caps_drv_job_process()

static int caps_drv_job_process ( struct caps_drv cdrv)
static
Return values
-ENODEVTerminate whole driver (from caps_drv_printer_check())
-EINVALCancel current job (from caps_drv_printer_check())
-EBUSYBe patient, the driver is in an error state (paper jam, out of paper etc. from caps_drv_printer_check())
-EOFPremature end of document
Postcondition
The state of the job must be one of the final states

◆ caps_drv_job_wait()

static int caps_drv_job_wait ( struct caps_drv cdrv)
static

Wait for a new job and monitor the printer while waiting

Parameters
[in,out]cdrvAll required information about the current print job
Return values
0A new job is available
-ENODEVPrinter device is gone
Precondition
Function relies on the timeout of caps_pp_job_check()

◆ _job_attach()

static int _job_attach ( struct caps_drv cdrv,
int  fd,
struct caps_ppd_options_table ppd_options,
const char *  params 
)
static

Attach a new job to a rasterizer in libcapsraster and do error processing on demand

Parameters
[in,out]cdrvAll required information about the current print job
[in]fdOpened filedescriptor to the document's content
[in]ppd_optionsTable with the corresponding PPD options (printer depended)
[in]paramsPrinting parameter specific to this job (can be NULL)
Return values
-EPERMPrinting prohibited (PDF has such a feature), job should be aborted
-ENOTSUPJob format isn't supported, job should be aborted
-EINVALJob is somehow unprintable due to unexpected content, job should be aborted
-ENODATAJob's MIME format failed to detect due to low on data, job should be aborted
Note
Does not return in case of an unexpected return code from caps_rstr_job_attach()

The final states set here (if the job failed) are only set, if not already set by the called subroutines.

Postcondition
Final job state set in case of a failure.

◆ _job_print()

static int _job_print ( struct caps_drv cdrv)
static

Process (e.g. print) the job and handle some error cases

Parameters
[in,out]cdrvAll required information about the current print job
Return values
-ENODEVPrinter device is gone, driver should terminate
-EBUSYPrinter is in an unknown state, driver should terminate
-EINVALJob is somehow unprintable due to processing issues, job should be aborted
-EOFJob is somehow unprintable due to its content, job should be aborted

Just log some more detailed error messages, if the job fails somehow. It is expected the subroutines have set a finale job state if an processing error occurred.

Note
Does not return in case of an unexpected return code
Postcondition
We do not touch the job's status here.

◆ caps_drv_jobs_loop()

int caps_drv_jobs_loop ( struct caps_drv drvi,
const char *  filename,
const char *  params 
)

The function returns if:

  • the program should terminate
  • the printer is gone, e.g. the filedescriptor is invalid