Implementation of an example progress device. More...
#include "skinkit.h"
#include "swdevice.h"
#include "skindevs.h"
#include "devutils.h"
#include "kitdevs.h"
#include "skinmon.h"
#include "mem.h"
#include <string.h>
Data Structures | |
struct | ProgressDeviceState |
Encapsulates the state of a single instance of this device. More... | |
Typedefs | |
typedef struct ProgressDeviceState | ProgressDeviceState |
Encapsulates the state of a single instance of this device. | |
Functions | |
static HqBool | validHandle (uint8 type, intptr_t depth) |
Validate the specified handle information. | |
static int32 | progressHandle (uint8 type, int32 depth) |
Construct a handle from the type and depth. More... | |
static uint8 | progressHandleType (DEVICE_FILEDESCRIPTOR handle) |
Extract the type from a handle. | |
static intptr_t | progressHandleDepth (DEVICE_FILEDESCRIPTOR handle) |
Extract the depth from a handle. | |
static int32 | progress_init_device (DEVICELIST *dev) |
Perform any required device initialization. | |
static DEVICE_FILEDESCRIPTOR | progress_open_file (DEVICELIST *dev, uint8 *filename, int32 openflags) |
The progress device's DEVICETYPE::open_file() callback. More... | |
static int32 | progress_read_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, uint8 *buff, int32 len) |
A no-op. More... | |
static int32 | progress_write_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, uint8 *buff, int32 len) |
Called to report human-readable information from progress text files. | |
static int32 | progress_close_common (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, int32 fAbort) |
Close the specified file. | |
static int32 | progress_close_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor) |
static int32 | progress_abort_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor) |
static int32 | progress_seek_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, Hq32x2 *destn, int32 flags) |
Called by the RIP to report bounded progress information. More... | |
static int32 | progress_bytes_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, Hq32x2 *bytes, int32 reason) |
A no-op. | |
static int32 | progress_status_file (DEVICELIST *dev, uint8 *filename, STAT *statbuff) |
A no-op. | |
static int32 | progress_rename_file (DEVICELIST *dev, uint8 *file1, uint8 *file2) |
A no-op. | |
static int32 | progress_delete_file (DEVICELIST *dev, uint8 *filename) |
A no-op. | |
static int32 | progress_start_param (DEVICELIST *dev) |
The DEVICETYPE::start_param() routine for the progress device type. More... | |
static int32 | progress_set_param (DEVICELIST *dev, DEVICEPARAM *param) |
The DEVICETYPE::set_param() routine for the progress device type. More... | |
static int32 | progress_get_param (DEVICELIST *dev, DEVICEPARAM *param) |
The DEVICETYPE::get_param() routine for the progress device type. More... | |
static int32 | progress_status_device (DEVICELIST *dev, DEVSTAT *devstat) |
A no-op. | |
static int32 | progress_dismount_device (DEVICELIST *dev) |
Destroy state created in progress_init_device(). | |
static int32 | progress_buffersize (DEVICELIST *dev) |
A no-op. | |
static int32 | progress_void (void) |
A no-op. | |
Variables | |
static HqBool | fCaptureTextStreamOutput |
Whether output from RIP JobLog is passed to the skin monitor. More... | |
static ProgressStream | aStreams [] |
progress_open_file() is driven by this table. More... | |
static uint8 | openCount [4] |
Number of times each of the progress types is open. More... | |
DEVICETYPE | Progress_Device_Type |
The DEVICETYPE object describing the callbacks in this device. | |
Implementation of an example progress device.
The progress device is an optional device, known as %progress%
in PostScript. It exists when it has been mounted and its device type set during execution of the Sys/ExtraDevices
file. If it does not exist the RIP works silently.
The RIP will open named files on the %progress%
device, which will then either use the progress_write_file() call to write arbitrary data (text files) or the progress_seek_file() call (seek files) to indicate numerical progress information; it will not use both for the same file.
|
static |
|
static |
|
static |
The DEVICETYPE::get_param() routine for the progress device type.
This routine serves two purposes: When the parameter name is NULL
, it is to return the next device parameter. pState->iParam
keeps track of how far through the list we are (though in this case there is only one) otherwise it should return the one called for by the name.
|
static |
The progress device's DEVICETYPE::open_file() callback.
This function should return -1 for unsupported progress types. The RIP will not treat this as an error; it just will not generate progress information for this type of progress. However, if the file is opened from the PostScript language an error will be reported unless the file is opened in a stopped context.
|
static |
A no-op.
All files on the progress device will be opened by the RIP as write-only, so there is no need to implement a comprehensive DEVICETYPE::read_file() call.
|
static |
Called by the RIP to report bounded progress information.
'Seek files' are intended to relay the amount of work done in a task by first telling the device how much work has to be done, and then telling it repeatedly how far through that amount of work the RIP has processed. After the progress_open_file() call, a series of calls are made to progress_seek_file() that indicate how far the process has gotten in its task.
The first call to progress_seek_file() will be passed the SW_XTND to flags. The destn argument gives an estimate of how much work is expected (e.g. the total size of a file in bytes). Later calls will express work done so far as a proportion of this total. Periodically thereafter a number of calls will be made, but with flags set to SW_SET or SW_INCR. SW_INCR is used to show how much data remains buffered but unread by the RIP (for unbounded reading), and SW_SET says how much has been consumed to date.
|
static |
The DEVICETYPE::set_param() routine for the progress device type.
In this example the only custom device param is JobTiming
. Setting this Boolean value to true will allow RIP timing information to be passed to the skin monitor.
|
static |
The DEVICETYPE::start_param() routine for the progress device type.
The routine is called as part of the currentdevparams
operator; the individual parameters are returned one at a time by subsequent calls to progress_get_param(). pState->iParam
is used to maintain the state between calls to progress_get_param().
Construct a handle from the type and depth.
The encoding of type and depth as a handle relies on the fact that depth can only be non zero for type 0 (PROGRESS_TYPE_DIAL_READ
), and is bounded to 0 <= depth < MAX_OPEN_READ_DIALS
. This allows the handle to be a zero based index of all possible open streams.
Handle Type Depth 0 0 2 1 0 1 2 0 0 3 1 0 4 2 0 ... ... ... h h-2 0
|
static |
progress_open_file() is driven by this table.
%progress%HalftoneInfo:
This text file is responsible for reporting the usage and accuracy of the screens in a job.
%progress%HalftoneCaching:
This seek file indicates the progress when the RIP is caching a Harlequin Precision Screen (most often when color separating). progress_seek_file() is called first with SW_XTND, giving a number that is an indication of the size of the task. A percentage is obtained by dividing subsequent SW_SET seek amounts by first SW_XTND amount.
%progress%JobLog:
The RIP supports the ability to log job information, such as how long each job took to interpret, rasterize, and output.
|
static |
Whether output from RIP JobLog is passed to the skin monitor.
This value corresponds to the JobTiming
device parameter.
|
static |
Number of times each of the progress types is open.