Harlequin RIP SDK
DEVICETYPE implementations provided by the SDK

DEVICETYPE implementations provided by the SDK. More...

Files

file  devutils.h
 Contains functions which can be shared between multiple devices.
 
file  kitdevs.h
 Device and IOCTL numbers for SDK devices.
 
file  namedcolordev.h
 Example of a PostScript device type to implement named color lookup.
 
file  pgbdev.h
 Page buffer device functions.
 
file  photoinkdev.h
 Example of a PostScript device type to implement photoink splitting.
 
file  streamdev.h
 Functions for interfacing the skinkit streaming device with the client stream implementations.
 
file  caldev.c
 Implementation of the calendar device type. See Postscript Language Reference Supplement for Version 2 (Pages 150-151).
 
file  config.c
 Implementation of the %config% (configuration) device type.
 
file  devparam.h
 Contains definitions shared between the PageBuffer (pgbdev) and Screening (scrndev) example device implememtations.
 
file  devutils.c
 Contains functions which can be shared between multiple devices.
 
file  fdecrypt.c
 Example implementation of the font decoder filter.
 
file  filedev.c
 Implementation of the file system device type.
 
file  fndcrypt.c
 Example implementation of the font decoder and encoder filter. If you wish to just test font decoding, define TEST_DECRYPTFONT instead. There are two encryption algorithms supported, to show how to implement multiple strategies.
 
file  monitor.c
 The monitor device type. This implements standard input and output for the rip.
 
file  namedcolordev.c
 Example of a PostScript device type to implement named color lookup. This example is unusual in that it is split into two files.
 
file  pgbdev.c
 The implementation of the %pagebuffer% device.
 
file  photoinkdev.c
 Example of a PostScript device type to implement photoink splitting. This example is unusual in that it is split into two files. The photoinksplitter.c file is in skintest. It contains the device specific code for light/dark splitting algorithms. The photoinkdev.c file (this file) contains boilerplate code for a PostScript device that acts as the intermediary between the RIP and the photoink splitting algorithms. This file is not expected to require any changes.
 
file  preboot.c
 Implementation of the preboot device type.
 
file  progdev.c
 Implementation of an example progress device.
 
file  ramdev.c
 Implementation of a filesystem device tied to in-memory data.
 
file  scrndev.c
 An example implementation of an AM screen parameter capture device.
 
file  scrndev.h
 Describes interface shared between the Screening (scrndev) and PageBuffer (pgbdev) example device implementations.
 
file  sockdev.c
 Implementation of socket input device type.
 
file  streamdev.c
 Implementation of an input/output device tied to a stream reader.
 
file  uniondev.c
 Implementation of the union device type.
 

Macros

#define OEM_NUMBER   0xffff0000
 
#define MONITOR_DEVICE_TYPE   ( OEM_NUMBER | 1 )
 Required output log and console device.
 
#define CONFIG_DEVICE_TYPE   ( OEM_NUMBER | 2 )
 Required %config% device implementation.
 
#define PAGEBUFFER_DEVICE_TYPE   ( OEM_NUMBER | 3 )
 Required %pagebuffer% device implementation.
 
#define SCREENING_DEVICE_TYPE   ( OEM_NUMBER | 4 )
 Optional screening export device, for use with RLE output.
 
#define CALENDAR_DEVICE_TYPE   ( OEM_NUMBER | 5 )
 Optional persistent calendar device implementation.
 
#define STREAM_DEVICE_TYPE   ( OEM_NUMBER | 6 )
 Optional device to input and output to stream abstraction.
 
#define SOCKET_DEVICE_TYPE   ( OEM_NUMBER | 7 )
 Optional device to input from and output to network socket.
 
#define RAM_DEVICE_TYPE   ( OEM_NUMBER | 8 )
 Optional RAM based filesystem device implementation.
 
#define PROGRESS_DEVICE_TYPE   ( OEM_NUMBER | 11 )
 Optional progress reporting device.
 
#define NAMEDCOLOR_DEVICE_TYPE   ( OEM_NUMBER | 15 )
 Optional named color lookup device.
 
#define PHOTOINK_DEVICE_TYPE   ( OEM_NUMBER | 16 )
 Optional PhotoInk splitting device.
 
#define CMM_PARAMS_DEVICE_TYPE   ( OEM_NUMBER | 17 )
 Optional CMM params device.
 
#define DeviceIOCtl_EndPage   ( OEM_NUMBER | 1 )
 IOCTL operator code for ending page. This allows devices to implement a device-specific page ending procedure.
 
#define DeviceIOCtl_SetCompressionMode   ( OEM_NUMBER | 2 )
 IOCTL opcode for setting the compression mode when storing files on resource-limited devices. The RAM device implements this opcode.
 
#define IOCTL_COMPRESSION_OFF   0
 Parameter value for DeviceIOCtl_SetCompressionMode to disable compression.
 
#define IOCTL_COMPRESSION_ON   1
 Parameter value for DeviceIOCtl_SetCompressionMode to enable compression.
 

Functions

DEVICE_result KMapPlatformError (int32 pkError)
 Provides a mapping from the skin platform error codes to their nearest equivalent RIP device code. More...
 
HqBool SubDeviceMount (DEVICELIST *dev, DEVICELIST **pSub, const char *subname, DEVICETYPE *subdevtype)
 Allocate and mount a private instance of a devicetype for use by a parent device. More...
 
HqBool SubDeviceDismount (DEVICELIST *dev, DEVICELIST **pSub)
 Dismount and free a private instance of a devicetype. More...
 
HqBool param_match_name (const DEVICEPARAM *param, const uint8 *name, int32 namelen)
 Utility function for device implementations to match incoming parameter name to a string. More...
 
HqBool param_match_cname (const DEVICEPARAM *param, const char *name, size_t namelen)
 Utility function for device implementations to match incoming parameter name to a C string. More...
 
void param_store_name (DEVICEPARAM *param, uint8 *name, int32 length)
 Utility function for device implementations to store a parameter name in a DEVICEPARAM. This function exists mainly for clients to use STRING_AND_NAME() to set parameter names to constant strings. More...
 
void param_store_string (DEVICEPARAM *param, uint8 *str, int32 length)
 Utility function for device implementations to store a string value in a DEVICEPARAM. This function exists mainly for clients to use STRING_AND_NAME() to set parameter values to constant strings. More...
 
HqBool SwLeGetIntDevParam (DEVICELIST *pDev, uint8 *pszParamName, int32 *pInt)
 A convenience function to get the current value of an integer device parameter. More...
 
HqBool SwLeGetBoolDevParam (DEVICELIST *pDev, uint8 *pszParamName, HqBool *pBool)
 A convenience function to get the current value of a boolean device parameter. More...
 
HqBool SwLeGetFloatDevParam (DEVICELIST *pDev, uint8 *pszParamName, float *pFloat)
 A convenience function to get the current value of a floating-point (real) device parameter. More...
 
HqBool SwLeGetStringDevParam (DEVICELIST *pDev, uint8 *pszParamName, uint8 **ppStr, int32 *pStrLen)
 A convenience function to get the current value of a string device parameter. More...
 

Detailed Description

DEVICETYPE implementations provided by the SDK.

The device abstraction is a fundamental mechanism by which the Core RIP communicates with its environment, and by which PostScript configuration can communicate with compiled C code.

Devices are usually mounted by the SW/Sys/ExtraDevices file, with the device number providing the mechanism to connect to the DEVICETYPE definition in C.

With the exception of the device types with specific numbers below, all device types you define should have numbers in which the most significant 16 bits are the OEM number allocated to you as a developer. For the purposes of these examples, the number 0xffff is used: this value is reserved for private use in closed environments, and can also be used. It will not conflict with any other numbers already used within the system.

The choice of the least significant 16 bits is arbitrary: so long as the numbers used in the SW/Sys/ExtraDevices file are consistent with those used in the C, everything should work.

You are expected to provide an implementation of the following device types. The SDK includes implementations of these which may be used or modified:

A number of devices are implemented in the SDK, and may be linked into a RIP product as-is, or used as as examples to help build production-ready devices. These devices are optional, but some functionality will be lost if some of them are excluded from a RIP product:

There are a small number of device types already built into the rip which are available for OEM use. See the DEVICE interface for details.

Utility functions for working with devices include:

Macro Definition Documentation

◆ OEM_NUMBER

#define OEM_NUMBER   0xffff0000

Private number to use for SDK-supplied devices. If you change this, you will also have to change the device type mounts in Sys/ExtraDevices.

Function Documentation

◆ KMapPlatformError()

DEVICE_result KMapPlatformError ( int32  pkError)

Provides a mapping from the skin platform error codes to their nearest equivalent RIP device code.

Parameters
[in]pkErrorSkin error code.
Returns
Equivalent error code for the RIP device interface.

◆ param_match_cname()

HqBool param_match_cname ( const DEVICEPARAM param,
const char *  name,
size_t  namelen 
)

Utility function for device implementations to match incoming parameter name to a C string.

Parameters
[in]paramParameter to match.
[in]nameName to match
namelenLength of name, or zero if NUL-terminated and the caller does not know the length.
Return values
TRUEif the parameter name matches
FALSEif the parameter name does not match.

◆ param_match_name()

HqBool param_match_name ( const DEVICEPARAM param,
const uint8 name,
int32  namelen 
)

Utility function for device implementations to match incoming parameter name to a string.

Parameters
[in]paramParameter to match.
[in]nameName to match
namelenLength of name.
Return values
TRUEif the parameter name matches
FALSEif the parameter name does not match.

◆ param_store_name()

void param_store_name ( DEVICEPARAM param,
uint8 name,
int32  length 
)

Utility function for device implementations to store a parameter name in a DEVICEPARAM. This function exists mainly for clients to use STRING_AND_NAME() to set parameter names to constant strings.

Parameters
[in]paramParameter to store name in.
[in]nameName to store.
lengthLength of name, or zero if NUL-terminated and the caller does not know the length.

◆ param_store_string()

void param_store_string ( DEVICEPARAM param,
uint8 str,
int32  length 
)

Utility function for device implementations to store a string value in a DEVICEPARAM. This function exists mainly for clients to use STRING_AND_NAME() to set parameter values to constant strings.

Parameters
[in]paramParameter to store string value in.
[in]strString to store.
lengthLength of str, or zero if NUL-terminated and the caller does not know the length.

◆ SubDeviceDismount()

HqBool SubDeviceDismount ( DEVICELIST dev,
DEVICELIST **  pSub 
)

Dismount and free a private instance of a devicetype.

Parameters
devThe parent device.
pSubA location where the sub-device pointer to dismount and free is stored.
Return values
TRUEThe sub-device dismounted without error. The parent device's error status was not changed.
FALSEThe sub-device dismounted with and error. The error was propagated to the parent device dev.

On exit, the memory for the sub-device is always freed.

◆ SubDeviceMount()

HqBool SubDeviceMount ( DEVICELIST dev,
DEVICELIST **  pSub,
const char *  subname,
DEVICETYPE subdevtype 
)

Allocate and mount a private instance of a devicetype for use by a parent device.

Parameters
devThe parent device.
pSubA location where the new sub-device pointer will be stored.
subnameThe suffix of the sub-device. The sub-device name will be constructed from the parent device name and this suffix. The sub-device is not discoverable through SwFindDevice.
subdevtypeThe device type for the sub-device.
Return values
TRUEThe sub-device was allocated and initialised without error. The parent device's error status was not changed.
FALSEThe sub-device could not be allocated or initialised. The parent device's last error is set to indicate the failure.

Allocate and mount a private instance of a devicetype for use by a parent device.

◆ SwLeGetBoolDevParam()

HqBool SwLeGetBoolDevParam ( DEVICELIST pDev,
uint8 pszParamName,
HqBool pBool 
)

A convenience function to get the current value of a boolean device parameter.

Parameters
pDevThe device to get the parameter value from. It is safe to pass NULL, but the function will fail and return FALSE.
pszParamNamezero-terminated name of the required parameter.
pBoolIf the function succeeds, this receives the current value of the specified device parameter. If the function fails, the contents are left undefined.
Returns
TRUE if the function succeeds, otherwise FALSE.

◆ SwLeGetFloatDevParam()

HqBool SwLeGetFloatDevParam ( DEVICELIST pDev,
uint8 pszParamName,
float *  pFloat 
)

A convenience function to get the current value of a floating-point (real) device parameter.

For full documentation, see SwLeGetIntDevParam(). The contract of this function is the same, except that it specializes for floats instead of integers.

Parameters
pDevThe device to get the parameter value from. It is safe to pass NULL, but the function will fail and return FALSE.
pszParamNamezero-terminated name of the required parameter.
pFloatIf the function succeeds, this receives the current value of the specified device parameter. If the function fails, the contents are left undefined.
Returns
TRUE if the function succeeds, otherwise FALSE.

◆ SwLeGetIntDevParam()

HqBool SwLeGetIntDevParam ( DEVICELIST pDev,
uint8 pszParamName,
int32 pInt 
)

A convenience function to get the current value of an integer device parameter.

Parameters
pDevThe device to get the parameter value from. It is safe to pass NULL, but the function will fail and return FALSE.
pszParamNamezero-terminated name of the required parameter. This should not use PostScript syntax - there should be no leading slash. For example, "PageNumber" is correct, while "/PageNumber" is not.
pIntIf the function succeeds, this receives the current value of the specified device parameter. If the function fails, the contents are left undefined.
Returns
TRUE if the function succeeds; FALSE if the function fails. Reasons why the function may fail include the following:-
  • NULL was passed as pDev.
  • The device handle is no longer valid, because the device was dismounted since the handle was obtained.
  • The name of the parameter is unknown to the device. It might be mis-spelled, for instance, or have a spurious leading slash character.
  • The parameter is not of integer type.

This convenience routine does not distinguish between the reasons for failure. Use the core RIP interface directly for richer diagnostics.

◆ SwLeGetStringDevParam()

HqBool SwLeGetStringDevParam ( DEVICELIST pDev,
uint8 pszParamName,
uint8 **  ppStr,
int32 pStrLen 
)

A convenience function to get the current value of a string device parameter.

For full documentation, see SwLeGetIntDevParam(). The contract of this function is the same, except that it specializes for strings instead of integers.

The string memory returned by this function is owned by the underlying device, not by the caller. The caller should not free the string. The caller should make its own copy if the data is needed persistently.

Parameters
pDevThe device to get the parameter value from. It is safe to pass NULL, but the function will fail and return FALSE.
pszParamNamezero-terminated name of the required parameter.
ppStrIf the function succeeds, this receives a pointer to the parameter value. This string data is not necessarily zero-terminated. The length of the string's valid portion is returned separately. If the function fails, the contents are undefined.
pStrLenIf the function succeeds, this receives the number of valid character bytes in the string. If the function fails, the contents are undefined.
Returns
TRUE if the function succeeds, otherwise FALSE.