#ifndef _CUPS_PWG_PRIVATE_H_
# define _CUPS_PWG_PRIVATE_H_
# include <cups/cups.h>
# ifdef __cplusplus
extern "C" {
# endif
# define _PWG_FROMPTS(n) (int)((n) * 2540 / 72)
# define _PWG_TOPTS(n) ((n) * 72.0 / 2540.0)
typedef struct _pwg_media_s
{
const char *pwg,
*legacy,
*ppd;
int width,
length;
} _pwg_media_t;
typedef struct _pwg_map_s
{
char *pwg,
*ppd;
} _pwg_map_t;
typedef struct _pwg_size_s
{
_pwg_map_t map;
int width,
length,
left,
bottom,
right,
top;
} _pwg_size_t;
typedef struct _pwg_s
{
int num_bins;
_pwg_map_t *bins;
int num_sizes;
_pwg_size_t *sizes;
int custom_max_width,
custom_max_length,
custom_min_width,
custom_min_length;
char *custom_max_keyword,
*custom_min_keyword,
custom_ppd_size[41];
_pwg_size_t custom_size;
int num_sources;
_pwg_map_t *sources;
int num_types;
_pwg_map_t *types;
} _pwg_t;
extern _pwg_t *_pwgCreateWithFile(const char *filename);
extern _pwg_t *_pwgCreateWithPPD(ppd_file_t *ppd);
extern void _pwgDestroy(_pwg_t *pwg);
extern void _pwgGenerateSize(char *keyword, size_t keysize,
const char *prefix,
const char *ppdname,
int width, int length);
extern const char *_pwgGetBin(_pwg_t *pwg, const char *output_bin);
extern const char *_pwgGetInputSlot(_pwg_t *pwg, ipp_t *job,
const char *keyword);
extern const char *_pwgGetMediaType(_pwg_t *pwg, ipp_t *job,
const char *keyword);
extern const char *_pwgGetOutputBin(_pwg_t *pwg, const char *keyword);
extern const char *_pwgGetPageSize(_pwg_t *pwg, ipp_t *job,
const char *keyword, int *exact);
extern _pwg_size_t *_pwgGetSize(_pwg_t *pwg, const char *page_size);
extern const char *_pwgGetSource(_pwg_t *pwg, const char *input_slot);
extern const char *_pwgGetType(_pwg_t *pwg, const char *media_type);
extern int _pwgInitSize(_pwg_size_t *size, ipp_t *job,
int *margins_set);
extern const char *_pwgInputSlotForSource(const char *media_source,
char *name, size_t namesize);
extern _pwg_media_t *_pwgMediaForLegacy(const char *legacy);
extern _pwg_media_t *_pwgMediaForPPD(const char *ppd);
extern _pwg_media_t *_pwgMediaForPWG(const char *pwg);
extern _pwg_media_t *_pwgMediaForSize(int width, int length);
extern const char *_pwgMediaTypeForType(const char *media_source,
char *name, size_t namesize);
extern const char *_pwgPageSizeForMedia(_pwg_media_t *media,
char *name, size_t namesize);
extern int _pwgWriteFile(_pwg_t *pwg, const char *filename);
# ifdef __cplusplus
}
# endif
#endif