int num_options = 0;
cups_option_t *options = NULL;
int fd, nullfd;
- filter_data_t filter_data;
- universal_parameter_t universal_parameters;
- filter_external_cups_t ipp_backend_params;
- filter_filter_in_chain_t universal_in_chain,
+ cf_filter_data_t filter_data;
+ cf_filter_universal_parameter_t universal_parameters;
+ cf_filter_external_cups_t ipp_backend_params;
+ cf_filter_filter_in_chain_t universal_in_chain,
ipp_in_chain;
cups_array_t *filter_chain;
int retval;
fprintf(stderr,"DEBUG: Received job for the printer with the destination uri - %s, Final-document format for the printer - %s and requested resolution - %s\n",
printer_uri, document_format, resolution);
- /* Adjust option list for the universal() filter function call */
+ /* Adjust option list for the cfFilterUniversal() filter function call */
num_options = cupsAddOption("Resolution", resolution,
num_options, &options);
num_options = cupsRemoveOption("cups-browsed-dest-printer",
filter_data.back_pipe[1] = -1;
filter_data.side_pipe[0] = -1;
filter_data.side_pipe[1] = -1;
- filter_data.logfunc = cups_logfunc; /* Logging scheme of CUPS */
+ filter_data.logfunc = cfCUPSLogFunc; /* Logging scheme of CUPS */
filter_data.logdata = NULL;
- filter_data.iscanceledfunc = cups_iscanceledfunc; /* Job-is-canceled
+ filter_data.iscanceledfunc = cfCUPSIsCanceledFunc; /* Job-is-canceled
function */
filter_data.iscanceleddata = &job_canceled;
- filterOpenBackAndSidePipes(&filter_data);
+ cfFilterOpenBackAndSidePipes(&filter_data);
- /* Parameters (input/output MIME types) for universal() call */
+ /* Parameters (input/output MIME types) for cfFilterUniversal() call */
universal_parameters.input_format = "application/vnd.cups-pdf";
universal_parameters.output_format = document_format;
memset(&(universal_parameters.texttopdf_params), 0,
- sizeof(texttopdf_parameter_t));
+ sizeof(cf_filter_texttopdf_parameter_t));
- /* Parameters for filterExternalCUPS() call for IPP backend */
+ /* Parameters for cfFilterExternalCUPS() call for IPP backend */
ipp_backend_params.filter = "ipp";
ipp_backend_params.is_backend = 1;
ipp_backend_params.device_uri = printer_uri;
ipp_backend_params.options = NULL;
ipp_backend_params.envp = NULL;
- /* Filter chain entry for the universal() filter function call */
- universal_in_chain.function = universal;
+ /* Filter chain entry for the cfFilterUniversal() filter function call */
+ universal_in_chain.function = cfFilterUniversal;
universal_in_chain.parameters = &universal_parameters;
universal_in_chain.name = "Filters";
/* Filter chain entry for the IPP CUPS backend call */
- ipp_in_chain.function = filterExternalCUPS;
+ ipp_in_chain.function = cfFilterExternalCUPS;
ipp_in_chain.parameters = &ipp_backend_params;
ipp_in_chain.name = "Backend";
nullfd = open("/dev/null", O_WRONLY);
/* Call the filter chain to run the needed filters and the backend */
- retval = filterChain(fd, nullfd, fd != 0 ? 1 : 0, &filter_data,
+ retval = cfFilterChain(fd, nullfd, fd != 0 ? 1 : 0, &filter_data,
filter_chain);
- filterCloseBackAndSidePipes(&filter_data);
+ cfFilterCloseBackAndSidePipes(&filter_data);
/* Clean up */
cupsArrayDelete(filter_chain);
else if (!strcasecmp(tok, "time-at-processing"))
info |= INFO_TIME_AT_PROCESSING;
else if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "bannertopdf: error: unknown value for 'Show': %s\n", tok);
+ log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: error: unknown value for 'Show': %s\n", tok);
}
return info;
}
{
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "bannertopdf: Error opening temporary file with input stream");
+ "cfFilterBannerToPDF: Error opening temporary file with input stream");
goto out;
}
{
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "bannertopdf: No banner instructions found in input stream");
+ "cfFilterBannerToPDF: No banner instructions found in input stream");
goto out;
}
break;
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "bannertopdf: Line %d is missing a value", linenr);
+ "cfFilterBannerToPDF: Line %d is missing a value", linenr);
continue;
}
{
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "bannertopdf: Note: %d: bannertopdf does not support '%s'",
+ "cfFilterBannerToPDF: Note: %d: bannertopdf does not support '%s'",
linenr, key);
}
else
break;
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "bannertopdf: Error: %d: unknown keyword '%s'",
+ "cfFilterBannerToPDF: Error: %d: unknown keyword '%s'",
linenr, key);
}
}
return value ? atoi(value) : def;
}
-static void get_pagesize(filter_data_t *data,
+static void get_pagesize(cf_filter_data_t *data,
int noptions,
cups_option_t *options,
float *width,
* Create PDF form's field names according above.
*/
opt_t *get_known_opts(
- filter_data_t *data,
+ cf_filter_data_t *data,
const char *jobid,
const char *user,
const char *jobtitle,
}
static int generate_banner_pdf(banner_t *banner,
- filter_data_t *data,
+ cf_filter_data_t *data,
const char *jobid,
const char *user,
const char *jobtitle,
if ((s = tmpfile()) == NULL)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "bannertopdf: Cannot create temp file: %s\n", strerror(errno));
+ log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot create temp file: %s\n", strerror(errno));
pdf_free(doc);
return 1;
}
if (fstat(fileno(s), &st) < 0)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "bannertopdf: Cannot fstat(): %s\n", , strerror(errno));
+ log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot fstat(): %s\n", , strerror(errno));
return 1;
}
fseek(s, 0L, SEEK_SET);
if ((buf = malloc(st.st_size + 1)) == NULL)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "bannertopdf: Cannot malloc(): %s\n", , strerror(errno));
+ log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Cannot malloc(): %s\n", , strerror(errno));
return 1;
}
size_t nbytes = fread(buf, 1, st.st_size, s);
return 0;
}
-int bannertopdf(int inputfd, /* I - File descriptor input stream */
+int cfFilterBannerToPDF(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused)*/
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters -
Template/Banner data directory */
{
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
char jobid[50];
{
if (log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "bannertopdf: Unable to open input data stream.");
+ "cfFilterBannerToPDF: Unable to open input data stream.");
}
return (1);
}
if ((tempfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "bannertopdf: Unable to copy input file: %s",
+ "cfFilterBannerToPDF: Unable to copy input file: %s",
strerror(errno));
return (1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "bannertopdf: Copying input to temp file \"%s\"",
+ "cfFilterBannerToPDF: Copying input to temp file \"%s\"",
tempfile);
while ((bytes = fread(buffer, 1, sizeof(buffer), inputfp)) > 0)
{
if (log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "bannertopdf: Unable to open output data stream.");
+ "cfFilterBannerToPDF: Unable to open output data stream.");
}
fclose(inputfp);
if (!ppd)
{
if (log)
- log(ld, FILTER_LOGLEVEL_DEBUG, "bannertopdf: Could not open PPD file '%s'", ppd);
+ log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterBannerToPDF: Could not open PPD file '%s'", ppd);
}
/*
if (!banner)
{
if (log)
- log(ld, FILTER_LOGLEVEL_ERROR, "bannertopdf: Could not read banner file");
+ log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterBannerToPDF: Could not read banner file");
return 1;
}
#ifdef HAVE_DBUS
static char *
-get_filename_for_profile_path ( filter_data_t *data,
+get_filename_for_profile_path ( cf_filter_data_t *data,
DBusConnection *con,
const char *object_path)
{
}
static char *
-get_profile_for_device_path ( filter_data_t *data,
+get_profile_for_device_path ( cf_filter_data_t *data,
DBusConnection *con,
const char *object_path,
const char **split)
}
static char *
-get_device_path_for_device_id ( filter_data_t *data,
+get_device_path_for_device_id ( cf_filter_data_t *data,
DBusConnection *con,
const char *device_id)
{
}
char *
-cfColordGetProfileForDeviceID (filter_data_t *data,
+cfColordGetProfileForDeviceID (cf_filter_data_t *data,
const char *device_id,
const char **qualifier_tuple)
{
}
int
-get_profile_inhibitors ( filter_data_t *data,
+get_profile_inhibitors ( cf_filter_data_t *data,
DBusConnection *con, const char *object_path)
{
filter_logfunc_t log = data->logfunc;
}
int
-cfColordGetInhibitForDeviceID (filter_data_t *data,
+cfColordGetInhibitForDeviceID (cf_filter_data_t *data,
const char *device_id)
{
filter_logfunc_t log = data->logfunc;
#else
char *
-cfColordGetProfileForDeviceID (filter_data_t *data,
+cfColordGetProfileForDeviceID (cf_filter_data_t *data,
const char *device_id,
const char **qualifier_tuple)
{
}
int
-cfColordGetInhibitForDeviceID (filter_data_t *data,
+cfColordGetInhibitForDeviceID (cf_filter_data_t *data,
const char *device_id)
{
filter_logfunc_t log = data->logfunc;
#include <cupsfilters/filter.h>
char **cfColordGetQualifierForPPD(ppd_file_t *ppd);
-char *cfColordGetProfileForDeviceID(filter_data_t *data,
+char *cfColordGetProfileForDeviceID(cf_filter_data_t *data,
const char *device_id,
const char **qualifier_tuple);
-int cfColordGetInhibitForDeviceID(filter_data_t *data,
+int cfColordGetInhibitForDeviceID(cf_filter_data_t *data,
const char *device_id);
# ifdef __cplusplus
/* Private function prototypes */
-static int _get_colord_printer_cm_status (filter_data_t *data);
-static char *_get_colord_printer_id (filter_data_t *data);
-static int _get_colord_profile (filter_data_t *data,
+static int _get_colord_printer_cm_status (cf_filter_data_t *data);
+static char *_get_colord_printer_id (cf_filter_data_t *data);
+static int _get_colord_profile (cf_filter_data_t *data,
char **profile,
ppd_file_t *ppd);
-static char *_get_ppd_icc_fallback (filter_data_t *data,
+static char *_get_ppd_icc_fallback (cf_filter_data_t *data,
ppd_file_t *ppd,
char **qualifier);
/* Get printer color management status from the system's color manager */
int
-cfCmIsPrinterCmDisabled(filter_data_t *data)
+cfCmIsPrinterCmDisabled(cf_filter_data_t *data)
{
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
/* Get printer ICC profile from the system's color manager */
int
-cfCmGetPrinterIccProfile(filter_data_t *data,
+cfCmGetPrinterIccProfile(cf_filter_data_t *data,
char **icc_profile, /* ICC Profile Path */
ppd_file_t *ppd) /* Optional PPD file for fallback profile */
{
/* Find the "cm-calibration" CUPS option */
cf_cm_calibration_t
-cfCmGetCupsColorCalibrateMode(filter_data_t *data,
+cfCmGetCupsColorCalibrateMode(cf_filter_data_t *data,
cups_option_t *options, /* Options from CUPS */
int num_options) /* Options from CUPS */
{
char *
-_get_colord_printer_id( filter_data_t *data)
+_get_colord_printer_id( cf_filter_data_t *data)
{
filter_logfunc_t log = data->logfunc;
int
-_get_colord_printer_cm_status( filter_data_t *data)
+_get_colord_printer_cm_status( cf_filter_data_t *data)
{
filter_logfunc_t log = data->logfunc;
}
int
-_get_colord_profile(filter_data_t *data,
+_get_colord_profile(cf_filter_data_t *data,
char **profile, /* Requested icc profile path */
ppd_file_t *ppd) /* PPD file */
{
/* From gstoraster */
char *
-_get_ppd_icc_fallback (filter_data_t *data, ppd_file_t *ppd, char **qualifier)
+_get_ppd_icc_fallback (cf_filter_data_t *data, ppd_file_t *ppd, char **qualifier)
{
filter_logfunc_t log = data->logfunc;
extern
-cf_cm_calibration_t cfCmGetCupsColorCalibrateMode(filter_data_t *data,
+cf_cm_calibration_t cfCmGetCupsColorCalibrateMode(cf_filter_data_t *data,
cups_option_t *options,
int num_options);
-extern int cfCmGetPrinterIccProfile(filter_data_t *data,
+extern int cfCmGetPrinterIccProfile(cf_filter_data_t *data,
char **icc_profile,
ppd_file_t *ppd);
-extern int cfCmIsPrinterCmDisabled(filter_data_t *data);
+extern int cfCmIsPrinterCmDisabled(cf_filter_data_t *data);
extern double* cfCmGammaAdobeRGB(void);
extern double* cfCmGammaSGray(void);
/*
- * 'cups_logfunc()' - Output log messages on stderr, compatible to CUPS,
+ * 'cfCUPSLogFunc()' - Output log messages on stderr, compatible to CUPS,
* meaning that the debug level is represented by a
* prefix like "DEBUG: ", "INFO: ", ...
*/
void
-cups_logfunc(void *data,
+cfCUPSLogFunc(void *data,
filter_loglevel_t level,
const char *message,
...)
/*
- * 'cups_iscanceledfunc()' - Return 1 if the job is canceled, which is
+ * 'cfCUPSIsCanceledFunc()' - Return 1 if the job is canceled, which is
* the case when the integer pointed at by data
* is not zero.
*/
int
-cups_iscanceledfunc(void *data)
+cfCUPSIsCanceledFunc(void *data)
{
return (*((int *)data) != 0 ? 1 : 0);
}
/*
- * 'filterCUPSWrapper()' - Wrapper function to use a filter function as
+ * 'cfFilterCUPSWrapper()' - Wrapper function to use a filter function as
* classic CUPS filter
*/
int /* O - Exit status */
-filterCUPSWrapper(
+cfFilterCUPSWrapper(
int argc, /* I - Number of command-line args */
char *argv[], /* I - Command-line arguments */
- filter_function_t filter, /* I - Filter function */
+ cf_filter_function_t filter, /* I - Filter function */
void *parameters, /* I - Filter function parameters */
int *JobCanceled) /* I - Var set to 1 when job canceled */
{
not stdin)? */
int num_options; /* Number of print options */
cups_option_t *options; /* Print options */
- filter_data_t filter_data;
+ cf_filter_data_t filter_data;
int retval = 0;
filter_data.back_pipe[1] = 3; /* the back channel */
filter_data.side_pipe[0] = 4; /* CUPS uses file descriptor 4 for */
filter_data.side_pipe[1] = 4; /* the side channel */
- filter_data.logfunc = cups_logfunc; /* Logging scheme of CUPS */
+ filter_data.logfunc = cfCUPSLogFunc; /* Logging scheme of CUPS */
filter_data.logdata = NULL;
- filter_data.iscanceledfunc = cups_iscanceledfunc; /* Job-is-canceled
+ filter_data.iscanceledfunc = cfCUPSIsCanceledFunc; /* Job-is-canceled
function */
filter_data.iscanceleddata = JobCanceled;
/*
- * 'filterTee()' - This filter function is mainly for debugging. it
+ * 'cfFilterTee()' - This filter function is mainly for debugging. it
* resembles the "tee" utility, passing through the
* data unfiltered and copying it to a file. The file
* name is simply given as parameter. This makes using
* the function easy (add it as item of a filter chain
- * called via filterChain()) and can even be used more
+ * called via cfFilterChain()) and can even be used more
* than once in the same filter chain (using different
* file names). In case of write error to the copy
* file, copying is stopped but the rest of the job is
*/
int /* O - Error status */
-filterTee(int inputfd, /* I - File descriptor input stream */
+cfFilterTee(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (File name) */
{
const char *filename = (const char *)parameters;
total += bytes;
if (log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterTee (%s): Passing on%s %d bytes, total %d bytes.",
+ "cfFilterTee (%s): Passing on%s %d bytes, total %d bytes.",
filename, teefd >= 0 ? " and copying" : "", bytes, total);
if (teefd >= 0)
{
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "filterTee (%s): Unable to write %d bytes to the copy, stopping copy, continuing job output.",
+ "cfFilterTee (%s): Unable to write %d bytes to the copy, stopping copy, continuing job output.",
filename, (int)bytes);
close(teefd);
teefd = -1;
{
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "filterTee (%s): Unable to pass on %d bytes.",
+ "cfFilterTee (%s): Unable to pass on %d bytes.",
filename, (int)bytes);
if (teefd >= 0)
close(teefd);
/*
- * 'filterPOpen()' - Pipe a stream to or from a filter function
+ * 'cfFilterPOpen()' - Pipe a stream to or from a filter function
* Can be the input to or the output from the
* filter function.
*/
int /* O - File decriptor */
-filterPOpen(filter_function_t filter_func, /* I - Filter function */
+cfFilterPOpen(cf_filter_function_t filter_func, /* I - Filter function */
int inputfd, /* I - File descriptor input stream or -1 */
int outputfd, /* I - File descriptor output stream or -1 */
int inputseekable, /* I - Is input stream seekable? */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters, /* I - Filter-specific parameters */
int *filter_pid) /* O - PID of forked filter process */
{
{
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "filterPOpen: Either inputfd or outputfd must be < 0, not both");
+ "cfFilterPOpen: Either inputfd or outputfd must be < 0, not both");
return (-1);
}
{
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "filterPOpen: One of inputfd or outputfd must be < 0");
+ "cfFilterPOpen: One of inputfd or outputfd must be < 0");
return (-1);
}
if (pipe(pipefds) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterPOpen: Could not create pipe for %s: %s",
+ "cfFilterPOpen: Could not create pipe for %s: %s",
inputfd < 0 ? "input" : "output",
strerror(errno));
return (-1);
close(infd);
close(outfd);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterPOpen: Filter function completed with status %d.",
+ "cfFilterPOpen: Filter function completed with status %d.",
ret);
exit(ret);
} else if (pid > 0) {
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterPOpen: Filter function (PID %d) started.", pid);
+ "cfFilterPOpen: Filter function (PID %d) started.", pid);
/*
* Save PID for waiting for or terminating the sub-process
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterPOpen: Could not fork to start filter function: %s",
+ "cfFilterPOpen: Could not fork to start filter function: %s",
strerror(errno));
return (-1);
}
/*
- * 'filterPClose()' - Close a piped stream created with
- * filterPOpen().
+ * 'cfFilterPClose()' - Close a piped stream created with
+ * cfFilterPOpen().
*/
int /* O - Error status */
-filterPClose(int fd, /* I - Pipe file descriptor */
+cfFilterPClose(int fd, /* I - Pipe file descriptor */
int filter_pid, /* I - PID of forked filter process */
- filter_data_t *data)
+ cf_filter_data_t *data)
{
int status, /* Exit status */
retval; /* Return value */
goto retry_wait;
if (log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterPClose: Filter function (PID %d) stopped with an error: %s!",
+ "cfFilterPClose: Filter function (PID %d) stopped with an error: %s!",
filter_pid, strerror(errno));
goto out;
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterPClose: Filter function (PID %d) exited with no errors.",
+ "cfFilterPClose: Filter function (PID %d) exited with no errors.",
filter_pid);
/* How did the filter function terminate */
/*
- * 'filterChain()' - Call filter functions in a chain to do a data
+ * 'cfFilterChain()' - Call filter functions in a chain to do a data
* format conversion which non of the individual
* filter functions does
*/
int /* O - Error status */
-filterChain(int inputfd, /* I - File descriptor input stream */
+cfFilterChain(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters */
{
cups_array_t *filter_chain = (cups_array_t *)parameters;
- filter_filter_in_chain_t *filter, /* Current filter */
+ cf_filter_filter_in_chain_t *filter, /* Current filter */
*next; /* Next filter */
int current, /* Current filter */
filterfds[2][2], /* Pipes for filters */
key; /* Search key for filters */
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
* Remove NULL filters...
*/
- for (filter = (filter_filter_in_chain_t *)cupsArrayFirst(filter_chain);
+ for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain);
filter;
- filter = (filter_filter_in_chain_t *)cupsArrayNext(filter_chain)) {
+ filter = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain)) {
if (!filter->function) {
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterChain: Invalid filter: %s - Removing...",
+ "cfFilterChain: Invalid filter: %s - Removing...",
filter->name ? filter->name : "Unspecified");
cupsArrayRemove(filter_chain, filter);
} else
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterChain: Running filter: %s",
+ "cfFilterChain: Running filter: %s",
filter->name ? filter->name : "Unspecified");
}
if (cupsArrayCount(filter_chain) == 0)
{
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterChain: No filter at all in chain, passing through the data.");
+ "cfFilterChain: No filter at all in chain, passing through the data.");
retval = 0;
while ((bytes = read(inputfd, buf, sizeof(buf))) > 0)
if (write(outputfd, buf, bytes) < bytes)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterChain: Data write error: %s", strerror(errno));
+ "cfFilterChain: Data write error: %s", strerror(errno));
retval = 1;
break;
}
if (bytes < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterChain: Data read error: %s", strerror(errno));
+ "cfFilterChain: Data read error: %s", strerror(errno));
retval = 1;
}
close(inputfd);
filterfds[1][0] = -1;
filterfds[1][1] = -1;
- for (filter = (filter_filter_in_chain_t *)cupsArrayFirst(filter_chain);
+ for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain);
filter;
filter = next, current = 1 - current) {
- next = (filter_filter_in_chain_t *)cupsArrayNext(filter_chain);
+ next = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain);
if (filterfds[1 - current][0] > 1) {
close(filterfds[1 - current][0]);
if (next) {
if (pipe(filterfds[1 - current]) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterChain: Could not create pipe for output of %s: %s",
+ "cfFilterChain: Could not create pipe for output of %s: %s",
filter->name ? filter->name : "Unspecified filter",
strerror(errno));
return (1);
close(infd);
close(outfd);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterChain: %s completed with status %d.",
+ "cfFilterChain: %s completed with status %d.",
filter->name ? filter->name : "Unspecified filter", ret);
exit(ret);
} else if (pid > 0) {
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterChain: %s (PID %d) started.",
+ "cfFilterChain: %s (PID %d) started.",
filter->name ? filter->name : "Unspecified filter", pid);
pid_entry = malloc(sizeof(filter_function_pid_t));
cupsArrayAdd(pids, pid_entry);
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterChain: Could not fork to start %s: %s",
+ "cfFilterChain: Could not fork to start %s: %s",
filter->name ? filter->name : "Unspecified filter",
strerror(errno));
break;
if ((pid = wait(&status)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterChain: Job canceled, killing filters ...");
+ "cfFilterChain: Job canceled, killing filters ...");
for (pid_entry = (filter_function_pid_t *)cupsArrayFirst(pids);
pid_entry;
pid_entry = (filter_function_pid_t *)cupsArrayNext(pids)) {
if (status) {
if (WIFEXITED(status)) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterChain: %s (PID %d) stopped with status %d",
+ "cfFilterChain: %s (PID %d) stopped with status %d",
pid_entry->name, pid, WEXITSTATUS(status));
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterChain: %s (PID %d) crashed on signal %d",
+ "cfFilterChain: %s (PID %d) crashed on signal %d",
pid_entry->name, pid, WTERMSIG(status));
}
retval = 1;
} else {
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterChain: %s (PID %d) exited with no errors.",
+ "cfFilterChain: %s (PID %d) exited with no errors.",
pid_entry->name, pid);
}
/*
- * 'get_env_var()' - Auxiliary function for filterExternalCUPS(), gets value of
+ * 'get_env_var()' - Auxiliary function for cfFilterExternalCUPS(), gets value of
* an environment variable in a list of environment variables
* as used by the execve() function
*/
/*
- * 'add_env_var()' - Auxiliary function for filterExternalCUPS(), adds/sets
+ * 'add_env_var()' - Auxiliary function for cfFilterExternalCUPS(), adds/sets
* an environment variable in a list of environment variables
* as used by the execve() function
*/
/*
- * 'filterExternalCUPS()' - Filter function which calls an external,
+ * 'cfFilterExternalCUPS()' - Filter function which calls an external,
* classic CUPS filter, for example a
* (proprietary) printer driver which cannot
* be converted to a filter function or is to
*/
int /* O - Error status */
-filterExternalCUPS(int inputfd, /* I - File descriptor input stream */
+cfFilterExternalCUPS(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters */
{
- filter_external_cups_t *params = (filter_external_cups_t *)parameters;
+ cf_filter_external_cups_t *params = (cf_filter_external_cups_t *)parameters;
int i;
int is_backend = 0; /* Do we call a CUPS backend? */
int pid, /* Process ID of filter */
int wstatus;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
if (!params->filter || !params->filter[0]) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS: Filter executable path/command not specified");
+ "cfFilterExternalCUPS: Filter executable path/command not specified");
return (1);
}
{
for (i = 0; envp[i]; i ++)
if (!strncmp(envp[i], "AUTH_", 5))
- log(ld, FILTER_LOGLEVEL_DEBUG, "filterExternalCUPS (%s): envp[%d]: AUTH_%c****",
+ log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: AUTH_%c****",
filter_name, i, envp[i][5]);
else if (!strncmp(envp[i], "DEVICE_URI=", 11))
- log(ld, FILTER_LOGLEVEL_DEBUG, "filterExternalCUPS (%s): envp[%d]: DEVICE_URI=%s",
+ log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: DEVICE_URI=%s",
filter_name, i, sanitize_device_uri(envp[i] + 11,
buf, sizeof(buf)));
else
- log(ld, FILTER_LOGLEVEL_DEBUG, "filterExternalCUPS (%s): envp[%d]: %s",
+ log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): envp[%d]: %s",
filter_name, i, envp[i]);
}
/* Log the arguments */
if (log)
for (i = 0; argv[i]; i ++)
- log(ld, FILTER_LOGLEVEL_DEBUG, "filterExternalCUPS (%s): argv[%d]: %s",
+ log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterExternalCUPS (%s): argv[%d]: %s",
filter_name, i, argv[i]);
} else {
/*
if (pipe(stderrpipe) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): Could not create pipe for stderr: %s",
+ "cfFilterExternalCUPS (%s): Could not create pipe for stderr: %s",
filter_name, strerror(errno));
return (1);
}
if (inputfd < 0) {
inputfd = open("/dev/null", O_RDONLY);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): No input file descriptor supplied for CUPS filter - %s",
+ "cfFilterExternalCUPS (%s): No input file descriptor supplied for CUPS filter - %s",
filter_name, strerror(errno));
}
fcntl_add_cloexec(inputfd);
if (dup2(inputfd, 0) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): Failed to connect input file descriptor with CUPS filter's stdin - %s",
+ "cfFilterExternalCUPS (%s): Failed to connect input file descriptor with CUPS filter's stdin - %s",
filter_name, strerror(errno));
goto fd_error;
} else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterExternalCUPS (%s): Connected input file descriptor %d to CUPS filter's stdin.",
+ "cfFilterExternalCUPS (%s): Connected input file descriptor %d to CUPS filter's stdin.",
filter_name, inputfd);
close(inputfd);
}
} else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterExternalCUPS (%s): Input comes from stdin, letting the filter grab stdin directly",
+ "cfFilterExternalCUPS (%s): Input comes from stdin, letting the filter grab stdin directly",
filter_name);
if (outputfd != 1) {
execve(filter_path, argv, envp);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): Execution of %s %s failed - %s",
+ "cfFilterExternalCUPS (%s): Execution of %s %s failed - %s",
filter_name, params->is_backend ? "backend" : "filter",
filter_path, strerror(errno));
exit(errno);
} else if (pid > 0) {
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterExternalCUPS (%s): %s (PID %d) started.",
+ "cfFilterExternalCUPS (%s): %s (PID %d) started.",
filter_name, filter_path, pid);
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): Unable to fork process for %s %s",
+ "cfFilterExternalCUPS (%s): Unable to fork process for %s %s",
filter_name, params->is_backend ? "backend" : "filter",
filter_path);
close(stderrpipe[0]);
if (log_level == FILTER_LOGLEVEL_CONTROL)
log(ld, log_level, msg);
else
- log(ld, log_level, "filterExternalCUPS (%s): %s", filter_name, msg);
+ log(ld, log_level, "cfFilterExternalCUPS (%s): %s", filter_name, msg);
}
cupsFileClose(fp);
/* No need to close the fd stderrpipe[0], as cupsFileClose(fp) does this
exit(0);
} else if (stderrpid > 0) {
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterExternalCUPS (%s): Logging (PID %d) started.",
+ "cfFilterExternalCUPS (%s): Logging (PID %d) started.",
filter_name, stderrpid);
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): Unable to fork process for logging",
+ "cfFilterExternalCUPS (%s): Unable to fork process for logging",
filter_name);
close(stderrpipe[0]);
close(stderrpipe[1]);
if ((wpid = wait(&wstatus)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "filterExternalCUPS (%s): Job canceled, killing %s ...",
+ "cfFilterExternalCUPS (%s): Job canceled, killing %s ...",
filter_name, params->is_backend ? "backend" : "filter");
kill(pid, SIGTERM);
pid = -1;
if (WIFEXITED(wstatus)) {
/* Via exit() anywhere or return() in the main() function */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): %s (PID %d) stopped with status %d",
+ "cfFilterExternalCUPS (%s): %s (PID %d) stopped with status %d",
filter_name,
(wpid == pid ?
(params->is_backend ? "Backend" : "Filter") :
} else {
/* Via signal */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "filterExternalCUPS (%s): %s (PID %d) crashed on signal %d",
+ "cfFilterExternalCUPS (%s): %s (PID %d) crashed on signal %d",
filter_name,
(wpid == pid ?
(params->is_backend ? "Backend" : "Filter") :
status = 1;
} else {
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "filterExternalCUPS (%s): %s (PID %d) exited with no errors.",
+ "cfFilterExternalCUPS (%s): %s (PID %d) exited with no errors.",
filter_name,
(wpid == pid ?
(params->is_backend ? "Backend" : "Filter") : "Logging"),
/*
- * 'filterOpenBackAndSidePipes()' - Open the pipes for the back
+ * 'cfFilterOpenBackAndSidePipes()' - Open the pipes for the back
* channel and the side channel, so
* that the filter functions can
* communicate with a backend. Only
* needed if a CUPS backend (either
* implemented as filter function or
- * called via filterExternalCUPS())
+ * called via cfFilterExternalCUPS())
* is called with the same
* filter_data record as the
* filters. Usually to be called when
*/
int /* O - 0 on success, -1 on error */
-filterOpenBackAndSidePipes(
- filter_data_t *data) /* O - FDs in filter_data record */
+cfFilterOpenBackAndSidePipes(
+ cf_filter_data_t *data) /* O - FDs in filter_data record */
{
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
"Unable to open pipes for back and side channels");
- filterCloseBackAndSidePipes(data);
+ cfFilterCloseBackAndSidePipes(data);
return (-1);
}
/*
- * 'filterCloseBackAndSidePipes()' - Close the pipes for the back
+ * 'cfFilterCloseBackAndSidePipes()' - Close the pipes for the back
* hannel and the side channel.
* sually to be called when done
* with the filter chain .
*/
void
-filterCloseBackAndSidePipes(
- filter_data_t *data) /* O - FDs in filter_data record */
+cfFilterCloseBackAndSidePipes(
+ cf_filter_data_t *data) /* O - FDs in filter_data record */
{
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
/*
- * 'filterSetCommonOptions()' - Set common filter options for media size, etc.
+ * 'cfFilterSetCommonOptions()' - Set common filter options for media size, etc.
* based on PPD file
*/
void
-filterSetCommonOptions(
+cfFilterSetCommonOptions(
ppd_file_t *ppd, /* I - PPD file */
int num_options, /* I - Number of options */
cups_option_t *options, /* I - Options */
}
if (change_size)
- filterUpdatePageVars(*Orientation, PageLeft, PageRight,
+ cfFilterUpdatePageVars(*Orientation, PageLeft, PageRight,
PageTop, PageBottom, PageWidth, PageLength);
if (ppdIsMarked(ppd, "Duplex", "DuplexNoTumble") ||
/*
- * 'filterUpdatePageVars()' - Update the page variables for the orientation.
+ * 'cfFilterUpdatePageVars()' - Update the page variables for the orientation.
*/
void
-filterUpdatePageVars(int Orientation,
+cfFilterUpdatePageVars(int Orientation,
float *PageLeft, float *PageRight,
float *PageTop, float *PageBottom,
float *PageWidth, float *PageLength)
* Types and structures...
*/
-typedef int (*filter_iscanceledfunc_t)(void *data);
+typedef int (*cf_filter_iscanceledfunc_t)(void *data);
-typedef struct filter_data_s {
+typedef struct cf_filter_data_s {
char *printer; /* Print queue name or NULL */
int job_id; /* Job ID or 0 */
char *job_user; /* Job user or NULL */
int side_pipe[2]; /* File descriptors of sidechannel pipe */
filter_logfunc_t logfunc; /* Logging function, NULL for no logging */
void *logdata; /* User data for logging function, can be NULL */
- filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
- job is canceled, NULL for not
- supporting stop on cancel */
+ cf_filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
+ job is canceled, NULL for not
+ supporting stop on cancel */
void *iscanceleddata; /* User data for is-canceled function, can be
NULL */
-} filter_data_t;
-
-typedef int (*filter_function_t)(int inputfd, int outputfd, int inputseekable,
- filter_data_t *data, void *parameters);
-
-typedef enum filter_out_format_e { /* Possible output formats for filter
- functions */
- OUTPUT_FORMAT_PDF, /* PDF */
- OUTPUT_FORMAT_PDF_IMAGE, /* Raster-only PDF */
- OUTPUT_FORMAT_PCLM, /* PCLM */
- OUTPUT_FORMAT_CUPS_RASTER, /* CUPS Raster */
- OUTPUT_FORMAT_PWG_RASTER, /* PWG Raster */
- OUTPUT_FORMAT_APPLE_RASTER,/* Apple Raster */
- OUTPUT_FORMAT_PXL /* PCL-XL */
-} filter_out_format_t;
-
-typedef struct filter_external_cups_s { /* Parameters for the
- filterExternalCUPS() filter
+} cf_filter_data_t;
+
+typedef int (*cf_filter_function_t)(int inputfd, int outputfd,
+ int inputseekable, cf_filter_data_t *data,
+ void *parameters);
+
+typedef enum cf_filter_out_format_e { /* Possible output formats for filter
+ functions */
+ CF_FILTER_OUT_FORMAT_PDF, /* PDF */
+ CF_FILTER_OUT_FORMAT_PDF_IMAGE, /* Raster-only PDF */
+ CF_FILTER_OUT_FORMAT_PCLM, /* PCLM */
+ CF_FILTER_OUT_FORMAT_CUPS_RASTER, /* CUPS Raster */
+ CF_FILTER_OUT_FORMAT_PWG_RASTER, /* PWG Raster */
+ CF_FILTER_OUT_FORMAT_APPLE_RASTER, /* Apple Raster */
+ CF_FILTER_OUT_FORMAT_PXL /* PCL-XL */
+} cf_filter_out_format_t;
+
+typedef struct cf_filter_external_cups_s { /* Parameters for the
+ cfFilterExternalCUPS() filter
function */
const char *filter; /* Path/Name of the CUPS filter to be called by
this filter function, required */
char **envp; /* Additional environment variables, the already
defined ones stay valid but can be overwritten
by these ones, NULL if none */
-} filter_external_cups_t;
-
-typedef struct filter_filter_in_chain_s { /* filter entry for CUPS array to
- be supplied to filterChain()
- filter function */
- filter_function_t function; /* Filter function to be called */
- void *parameters; /* Parameters for this filter function call */
- char *name; /* Name/comment, only for logging */
-} filter_filter_in_chain_t;
-
-typedef struct texttopdf_parameter_s { /* parameters container of environemnt
- variables needed by texttopdf
- filter function */
+} cf_filter_external_cups_t;
+
+typedef struct cf_filter_filter_in_chain_s { /* filter entry for CUPS array to
+ be supplied to cfFilterChain()
+ filter function */
+ cf_filter_function_t function; /* Filter function to be called */
+ void *parameters; /* Parameters for this filter function call */
+ char *name; /* Name/comment, only for logging */
+} cf_filter_filter_in_chain_t;
+
+typedef struct cf_filter_texttopdf_parameter_s { /* parameters container of
+ environemnt variables needed
+ by texttopdf filter
+ function */
char *data_dir;
char *char_set;
char *content_type;
char *classification;
-} texttopdf_parameter_t;
+} cf_filter_texttopdf_parameter_t;
-typedef struct universal_parameter_s { /* Contains input and output
- type to be supplied to the
- universal function, and also
- parameters for texttopdf() */
+typedef struct cf_filter_universal_parameter_s { /* Contains input and output
+ type to be supplied to the
+ universal function, and also
+ parameters for
+ cfFilterTextToPDF() */
char *input_format;
char *output_format;
- texttopdf_parameter_t texttopdf_params;
-} universal_parameter_t;
+ cf_filter_texttopdf_parameter_t texttopdf_params;
+} cf_filter_universal_parameter_t;
/*
* Prototypes...
*/
-extern void cups_logfunc(void *data,
- filter_loglevel_t level,
- const char *message,
- ...);
+extern void cfCUPSLogFunc(void *data,
+ filter_loglevel_t level,
+ const char *message,
+ ...);
-extern int cups_iscanceledfunc(void *data);
+extern int cfCUPSIsCanceledFunc(void *data);
-extern int filterCUPSWrapper(int argc,
- char *argv[],
- filter_function_t filter,
- void *parameters,
- int *JobCanceled);
+extern int cfFilterCUPSWrapper(int argc,
+ char *argv[],
+ cf_filter_function_t filter,
+ void *parameters,
+ int *JobCanceled);
-extern int filterTee(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterTee(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
/* Parameters: Filename/path (const char *) to copy the data to */
-extern int filterPOpen(filter_function_t filter_func, /* I - Filter function */
- int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters,
- int *filter_pid);
+extern int cfFilterPOpen(cf_filter_function_t filter_func, /* I - Filter
+ function */
+ int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters,
+ int *filter_pid);
-extern int filterPClose(int fd,
- int filter_pid,
- filter_data_t *data);
+extern int cfFilterPClose(int fd,
+ int filter_pid,
+ cf_filter_data_t *data);
-extern int filterChain(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterChain(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: Unsorted (!) CUPS array of filter_filter_in_chain_t*
+/* Parameters: Unsorted (!) CUPS array of cf_filter_filter_in_chain_t*
List of filters to execute in a chain, next filter takes output of
previous filter as input, all get the same filter data, parameters
from the array */
-extern int filterExternalCUPS(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterExternalCUPS(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_external_cups_t*
+/* Parameters: cf_filter_external_cups_t*
Path/Name of the CUPS filter to be called by this filter function,
extra options for the 5th command line argument, and extra environment
variables */
-extern int filterOpenBackAndSidePipes(filter_data_t *data);
+extern int cfFilterOpenBackAndSidePipes(cf_filter_data_t *data);
-extern void filterCloseBackAndSidePipes(filter_data_t *data);
+extern void cfFilterCloseBackAndSidePipes(cf_filter_data_t *data);
-extern int ghostscript(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterGhostscript(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_out_format_t*
+/* Parameters: cf_filter_out_format_t*
Ouput format: PDF, raster-only PDF, PCLm, PostScript, CUPS Raster,
PWG Raster, Apple Raster, PCL-XL
Note: On the Apple Raster selection the output is actually CUPS Raster
device.*/
-extern int bannertopdf(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterBannerToPDF(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
/* Parameters: const char*
Template directory: In this directory there are the PDF template files
as template. */
-extern int imagetopdf(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterImageToPDF(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-extern int imagetops(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterImageToPS(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-extern int imagetoraster(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterImageToRaster(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_out_format_t* Ouput format: CUPS Raster, PWG
+/* Parameters: cf_filter_out_format_t* Ouput format: CUPS Raster, PWG
Raster, Apple Raster, PCLM
Note: On the Apple Raster, PWG Raster, and PCLm selection the
output is actually CUPS Raster but information about available
this filter function. */
-extern int mupdftopwg(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterMuPDFToPWG(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_out_format_t*
+/* Parameters: cf_filter_out_format_t*
Ouput format: CUPS Raster, PWG Raster, Apple Raster, PCLm
Note: With CUPS Raster, Apple Raster, or PCLm selections the output
is actually PWG Raster but information about available color spaces
future when MuPDF adds further output formats. */
-extern int pclmtoraster(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterPCLmToRaster(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_out_format_t*
+/* Parameters: cf_filter_out_format_t*
Ouput format: CUPS Raster, Apple Raster, or PWG Raster */
-extern int pdftopdf(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterPDFToPDF(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
/* Parameters: const char*
For CUPS value of FINAL_CONTENT_TYPE environment variable, generally
MIME type of the final output format of the filter chain for this job
- (not the output of the pdftopdf() filter function) */
+ (not the output of the cfFilterPDFToPDF() filter function) */
-extern int pdftops(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterPDFToPS(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-extern int pdftoraster(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void* parameters);
+extern int cfFilterPDFToRaster(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void* parameters);
-/* Parameters: filter_out_format_t*
+/* Parameters: cf_filter_out_format_t*
Ouput format: CUPS Raster, PWG Raster, Apple Raster, PCLm
Note: With Apple Raster or PCLm selections the output is actually
CUPS Raster but information about available color spaces and depths
Raster output support to this filter. */
-extern int pstops(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterPSToPS(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-extern int pwgtoraster(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterPWGToRaster(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_out_format_t*
+/* Parameters: cf_filter_out_format_t*
Ouput format: CUPS Raster, PWG Raster, Apple Raster, PCLm
Note: On the PCLM selection the output is actually CUPS Raster
but information about available color spaces and depths is taken from
attribute. This mode is for further processing with rastertopclm. */
-extern int rastertopdf(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterRasterToPDF(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_out_format_t*
+/* Parameters: cf_filter_out_format_t*
Ouput format: PDF, PCLm */
-extern int rastertops(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterRasterToPS(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-extern int rastertopwg(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterRasterToPWG(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: filter_out_format_t*
+/* Parameters: cf_filter_out_format_t*
Ouput format: Apple Raster or PWG Raster */
-extern int texttopdf(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterTextToPDF(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: texttopdf_parameter_t*
+/* Parameters: cf_filter_texttopdf_parameter_t*
Data directory (fonts, charsets), charset, content type (for prettyprint),
classification (for overprint/watermark) */
-extern int texttotext(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterTextToText(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-extern int universal(int inputfd,
- int outputfd,
- int inputseekable,
- filter_data_t *data,
- void *parameters);
+extern int cfFilterUniversal(int inputfd,
+ int outputfd,
+ int inputseekable,
+ cf_filter_data_t *data,
+ void *parameters);
-/* Parameters: universal_parameter_t
+/* Parameters: cf_filter_universal_parameter_t
Contains : Input_type: CONTENT_TYPE environment variable of CUPS
Output type: FINAL_CONTENT TYPE environment variable of CUPS
texttopdf_params: parameters for texttopdf */
-extern void filterSetCommonOptions(ppd_file_t *ppd,
- int num_options,
- cups_option_t *options,
- int change_size,
- int *Orientation,
- int *Duplex,
- int *LanguageLevel,
- int *ColorDevice,
- float *PageLeft,
- float *PageRight,
- float *PageTop,
- float *PageBottom,
- float *PageWidth,
- float *PageLength,
- filter_logfunc_t log,
- void *ld);
-
-
-extern void filterUpdatePageVars(int Orientation,
- float *PageLeft, float *PageRight,
- float *PageTop, float *PageBottom,
- float *PageWidth, float *PageLength);
+extern void cfFilterSetCommonOptions(ppd_file_t *ppd,
+ int num_options,
+ cups_option_t *options,
+ int change_size,
+ int *Orientation,
+ int *Duplex,
+ int *LanguageLevel,
+ int *ColorDevice,
+ float *PageLeft,
+ float *PageRight,
+ float *PageTop,
+ float *PageBottom,
+ float *PageWidth,
+ float *PageLength,
+ filter_logfunc_t log,
+ void *ld);
+
+
+extern void cfFilterUpdatePageVars(int Orientation,
+ float *PageLeft, float *PageRight,
+ float *PageTop, float *PageBottom,
+ float *PageWidth, float *PageLength);
# ifdef __cplusplus
static void
add_pdf_header_options(gs_page_header *h, cups_array_t *gs_args,
- filter_out_format_t outformat, int pxlcolor)
+ cf_filter_out_format_t outformat, int pxlcolor)
{
int i;
char tmpstr[1024];
/* Simple boolean, enumerated choice, numerical, and string parameters */
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER) {
if (h->MediaClass[0] |= '\0') {
snprintf(tmpstr, sizeof(tmpstr), "-sMediaClass=%s", h->MediaClass);
cupsArrayAdd(gs_args, strdup(tmpstr));
cupsArrayAdd(gs_args, strdup(tmpstr));
}
}
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER ||
- outformat == OUTPUT_FORMAT_PXL) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PXL) {
/* PDF output is only for turning PostScript input data into PDF
not for sending PDF to a PDF printer (this is done by pdftopdf)
therefore we do not apply duplex/tumble here. */
cupsArrayAdd(gs_args, strdup("-dDuplex"));
}
}
- if (outformat != OUTPUT_FORMAT_PCLM) {
+ if (outformat != CF_FILTER_OUT_FORMAT_PCLM) {
/* In PCLM we have our own method to generate the needed
resolution, to respect the printer's supported resolutions for
PCLm, so this is only for non-PCLm output formats */
h->HWResolution[0], h->HWResolution[1]);
cupsArrayAdd(gs_args, strdup(tmpstr));
}
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER) {
if (h->InsertSheet) {
cupsArrayAdd(gs_args, strdup("-dInsertSheet"));
}
cupsArrayAdd(gs_args, strdup("-dManualFeed"));
}
}
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER ||
- outformat == OUTPUT_FORMAT_PXL) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PXL) {
if (h->MediaPosition) {
int mediapos;
- if (outformat == OUTPUT_FORMAT_PXL) {
+ if (outformat == CF_FILTER_OUT_FORMAT_PXL) {
/* Convert PWG MediaPosition values to PXL-ones */
if (h->MediaPosition == 1) /* Main */
mediapos = 4;
cupsArrayAdd(gs_args, strdup(tmpstr));
}
}
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER) {
if (h->MediaWeight) {
snprintf(tmpstr, sizeof(tmpstr), "-dMediaWeight=%d",
(unsigned)(h->MediaWeight));
cupsArrayAdd(gs_args, strdup(tmpstr));
snprintf(tmpstr, sizeof(tmpstr), "-dDEVICEHEIGHTPOINTS=%d",h->PageSize[1]);
cupsArrayAdd(gs_args, strdup(tmpstr));
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER) {
if (h->Separations) {
cupsArrayAdd(gs_args, strdup("-dSeparations"));
}
cupsArrayAdd(gs_args, strdup("-dTraySwitch"));
}
}
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER ||
- outformat == OUTPUT_FORMAT_PXL) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PXL) {
/* PDF output is only for turning PostScript input data into PDF
not for sending PDF to a PDF printer (this is done by pdftopdf)
therefore we do not apply duplex/tumble here. */
cupsArrayAdd(gs_args, strdup("-dTumble"));
}
}
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER) {
if (h->cupsMediaType) {
snprintf(tmpstr, sizeof(tmpstr), "-dcupsMediaType=%d",
(unsigned)(h->cupsMediaType));
cupsArrayAdd(gs_args, strdup(tmpstr));
}
- if (outformat == OUTPUT_FORMAT_PXL) {
+ if (outformat == CF_FILTER_OUT_FORMAT_PXL) {
if (h->cupsColorSpace == CUPS_CSPACE_W ||
h->cupsColorSpace == CUPS_CSPACE_K ||
h->cupsColorSpace == CUPS_CSPACE_WHITE ||
else
cupsArrayAdd(gs_args, strdup("-sDEVICE=pxlmono"));
}
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER) {
if (h->cupsCompression) {
snprintf(tmpstr, sizeof(tmpstr), "-dcupsCompression=%d",
(unsigned)(h->cupsCompression));
}
}
#ifdef CUPS_RASTER_SYNCv1
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER) {
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER) {
if (h->cupsBorderlessScalingFactor != 1.0f) {
snprintf(tmpstr, sizeof(tmpstr), "-dcupsBorderlessScalingFactor=%.4f",
h->cupsBorderlessScalingFactor);
int outputfd,
filter_logfunc_t log,
void *ld,
- filter_iscanceledfunc_t iscanceled,
+ cf_filter_iscanceledfunc_t iscanceled,
void *icd)
{
char *argument;
if (log) {
/* Debug output: Full Ghostscript command line and environment variables */
- snprintf(buf, sizeof(buf), "ghostscript: Ghostscript command line:");
+ snprintf(buf, sizeof(buf),
+ "cfFilterGhostscript: Ghostscript command line:");
for (i = 0; gsargv[i]; i ++) {
if ((strchr(gsargv[i],' ')) || (strchr(gsargv[i],'\t')))
apos = "'";
for (i = 0; envp[i]; i ++)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: envp[%d]=\"%s\"", i, envp[i]);
+ "cfFilterGhostscript: envp[%d]=\"%s\"", i, envp[i]);
}
/* Create a pipe for feeding the job into Ghostscript */
infds[0] = -1;
infds[1] = -1;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to establish stdin pipe for Ghostscript "
- "call");
+ "cfFilterGhostscript: Unable to establish stdin pipe for Ghostscript call");
goto out;
}
errfds[0] = -1;
errfds[1] = -1;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to establish stderr pipe for Ghostscript "
- "call");
+ "cfFilterGhostscript: Unable to establish stderr pipe for Ghostscript call");
goto out;
}
infds[0] = -1;
infds[1] = -1;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to set \"close on exec\" flag on read "
- "end of the stdin pipe for Ghostscript call");
+ "cfFilterGhostscript: Unable to set \"close on exec\" flag on read end of the stdin pipe for Ghostscript call");
goto out;
}
if (fcntl(infds[1], F_SETFD, fcntl(infds[1], F_GETFD) | FD_CLOEXEC))
close(infds[0]);
close(infds[1]);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to set \"close on exec\" flag on write "
- "end of the stdin pipe for Ghostscript call");
+ "cfFilterGhostscript: Unable to set \"close on exec\" flag on write end of the stdin pipe for Ghostscript call");
goto out;
}
if (fcntl(errfds[0], F_SETFD, fcntl(errfds[0], F_GETFD) | FD_CLOEXEC))
errfds[0] = -1;
errfds[1] = -1;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to set \"close on exec\" flag on read "
- "end of the stderr pipe for Ghostscript call");
+ "cfFilterGhostscript: Unable to set \"close on exec\" flag on read end of the stderr pipe for Ghostscript call");
goto out;
}
if (fcntl(errfds[1], F_SETFD, fcntl(errfds[1], F_GETFD) | FD_CLOEXEC))
close(errfds[0]);
close(errfds[1]);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to set \"close on exec\" flag on write "
- "end of the stderr pipe for Ghostscript call");
+ "cfFilterGhostscript: Unable to set \"close on exec\" flag on write end of the stderr pipe for Ghostscript call");
goto out;
}
if (infds[0] != 0) {
if (dup2(infds[0], 0) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to couple pipe with stdin of "
- "Ghostscript process");
+ "cfFilterGhostscript: Unable to couple pipe with stdin of Ghostscript process");
exit(1);
}
close(infds[0]);
close(infds[1]);
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: invalid pipe file descriptor to couple with "
- "stdin of Ghostscript process");
+ "cfFilterGhostscript: invalid pipe file descriptor to couple with stdin of Ghostscript process");
exit(1);
}
if (errfds[1] != 2) {
if (dup2(errfds[1], 2) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to couple pipe with stderr of "
- "Ghostscript process");
+ "cfFilterGhostscript: Unable to couple pipe with stderr of Ghostscript process");
exit(1);
}
close(errfds[1]);
close(errfds[0]);
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: invalid pipe file descriptor to couple with "
- "stderr of Ghostscript process");
+ "cfFilterGhostscript: invalid pipe file descriptor to couple with stderr of Ghostscript process");
exit(1);
}
if (outputfd != 1) {
if (dup2(outputfd, 1) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to couple stdout of Ghostscript "
- "process");
+ "cfFilterGhostscript: Unable to couple stdout of Ghostscript process");
exit(1);
}
close(outputfd);
}
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Invalid file descriptor to couple with "
- "stdout of Ghostscript process");
+ "cfFilterGhostscript: Invalid file descriptor to couple with stdout of Ghostscript process");
exit(1);
}
/* Execute Ghostscript command line ... */
execvpe(filename, gsargv, envp);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to launch Ghostscript: %s: %s", filename,
- strerror(errno));
+ "cfFilterGhostscript: Unable to launch Ghostscript: %s: %s",
+ filename, strerror(errno));
exit(1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Started Ghostscript (PID %d)", gspid);
+ "cfFilterGhostscript: Started Ghostscript (PID %d)", gspid);
close(infds[0]);
close(errfds[1]);
log_level = FILTER_LOGLEVEL_DEBUG;
msg = buf;
}
- log(ld, log_level, "ghostscript: %s", msg);
+ log(ld, log_level, "cfFilterGhostscript: %s", msg);
}
cupsFileClose(logfp);
/* No need to close the fd errfds[0], as cupsFileClose(fp) does this
exit(0);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Started logging (PID %d)", errpid);
+ "cfFilterGhostscript: Started logging (PID %d)", errpid);
close(errfds[0]);
if (errno == EINTR)
goto retry_write;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: write failed: %s", strerror(errno));
+ "cfFilterGhostscript: write failed: %s", strerror(errno));
}
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Can't feed job data into Ghostscript");
+ "cfFilterGhostscript: Can't feed job data into Ghostscript");
goto out;
}
}
close (infds[1]);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Input data feed completed");
+ "cfFilterGhostscript: Input data feed completed");
while (gspid > 0 || errpid > 0) {
if ((pid = wait(&wstatus)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Job canceled, killing Ghostscript ...");
+ "cfFilterGhostscript: Job canceled, killing Ghostscript ...");
kill(gspid, SIGTERM);
gspid = -1;
kill(errpid, SIGTERM);
if (WIFEXITED(wstatus)) {
/* Via exit() anywhere or return() in the main() function */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: %s (PID %d) stopped with status %d",
+ "cfFilterGhostscript: %s (PID %d) stopped with status %d",
(pid == gspid ? "Ghostscript" : "Logging"), pid,
WEXITSTATUS(wstatus));
status = WEXITSTATUS(wstatus);
} else {
/* Via signal */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: %s (PID %d) crashed on signal %d",
+ "cfFilterGhostscript: %s (PID %d) crashed on signal %d",
(pid == gspid ? "Ghostscript" : "Logging"), pid,
WTERMSIG(wstatus));
status = 256 * WTERMSIG(wstatus);
}
} else {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: %s (PID %d) exited with no errors.",
+ "cfFilterGhostscript: %s (PID %d) exited with no errors.",
(pid == gspid ? "Ghostscript" : "Logging"), pid);
status = 0;
}
}
/*
- * 'ghostscript()' - Filter function to use Ghostscript for print
- * data conversions
+ * 'cfFilterGhostscript()' - Filter function to use Ghostscript for print
+ * data conversions
*/
-int /* O - Error status */
-ghostscript(int inputfd, /* I - File descriptor input stream */
- int outputfd, /* I - File descriptor output stream */
- int inputseekable, /* I - Is input stream seekable? */
- filter_data_t *data, /* I - Job and printer data */
- void *parameters) /* I - Filter-specific parameters */
+int /* O - Error status */
+cfFilterGhostscript(int inputfd, /* I - File descriptor input
+ stream */
+ int outputfd, /* I - File descriptor output
+ stream */
+ int inputseekable, /* I - Is input stream seekable? */
+ cf_filter_data_t *data, /* I - Job and printer data */
+ void *parameters) /* I - Filter-specific parameters */
{
- filter_out_format_t outformat;
+ cf_filter_out_format_t outformat;
char buf[BUFSIZ];
char *filename;
char *icc_profile = NULL;
ipp_attribute_t *ipp_attr;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
- /* Note: With the OUTPUT_FORMAT_APPLE_RASTER selection the output is
+ /* Note: With the CF_FILTER_OUT_FORMAT_APPLE_RASTER selection the output is
actually CUPS Raster but information about available color spaces
and depths is taken from the urf-supported printer IPP attribute
or appropriate PPD file attribute. This mode is for further
device. */
if (parameters) {
- outformat = *(filter_out_format_t *)parameters;
- if (outformat != OUTPUT_FORMAT_PDF &&
- outformat != OUTPUT_FORMAT_PDF_IMAGE &&
- outformat != OUTPUT_FORMAT_PCLM &&
- outformat != OUTPUT_FORMAT_CUPS_RASTER &&
- outformat != OUTPUT_FORMAT_PWG_RASTER &&
- outformat != OUTPUT_FORMAT_APPLE_RASTER &&
- outformat != OUTPUT_FORMAT_PXL)
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = *(cf_filter_out_format_t *)parameters;
+ if (outformat != CF_FILTER_OUT_FORMAT_PDF &&
+ outformat != CF_FILTER_OUT_FORMAT_PDF_IMAGE &&
+ outformat != CF_FILTER_OUT_FORMAT_PCLM &&
+ outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PWG_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PXL)
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
} else
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Output format: %s",
- (outformat == OUTPUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
- (outformat == OUTPUT_FORMAT_PWG_RASTER ? "PWG Raster" :
- (outformat == OUTPUT_FORMAT_APPLE_RASTER ? "Apple Raster" :
- (outformat == OUTPUT_FORMAT_PDF ? "PDF" :
- (outformat == OUTPUT_FORMAT_PDF_IMAGE ? "raster-only PDF" :
- (outformat == OUTPUT_FORMAT_PCLM ? "PCLm" :
+ "cfFilterGhostscript: Output format: %s",
+ (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER ?
+ "Apple Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_PDF ? "PDF" :
+ (outformat == CF_FILTER_OUT_FORMAT_PDF_IMAGE ?
+ "raster-only PDF" :
+ (outformat == CF_FILTER_OUT_FORMAT_PCLM ? "PCLm" :
"PCL XL")))))));
memset(&sa, 0, sizeof(sa));
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Unable to open input data stream.");
+ "cfFilterGhostscript: Unable to open input data stream.");
}
return (1);
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to copy PDF file: %s", strerror(errno));
+ "cfFilterGhostscript: Unable to copy PDF file: %s", strerror(errno));
fclose(fp);
return (1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Copying input to temp file \"%s\"",
+ "cfFilterGhostscript: Copying input to temp file \"%s\"",
tempfile);
while ((bytes = fread(buf, 1, sizeof(buf), fp)) > 0)
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Unable to open temporary file.");
+ "cfFilterGhostscript: Unable to open temporary file.");
}
goto out;
if (doc_type == GS_DOC_TYPE_EMPTY) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Input is empty, outputting empty file.");
+ "cfFilterGhostscript: Input is empty, outputting empty file.");
status = 0;
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER)
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER)
if (write(outputfd, "RaS2", 4)) {};
goto out;
} if (doc_type == GS_DOC_TYPE_UNKNOWN) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Can't detect file type");
+ "cfFilterGhostscript: Can't detect file type");
goto out;
}
if (pages == 0) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: No pages left, outputting empty file.");
+ "cfFilterGhostscript: No pages left, outputting empty file.");
status = 0;
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER)
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER)
if (write(outputfd, "RaS2", 4)) {};
goto out;
}
if (pages < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unexpected page count");
+ "cfFilterGhostscript: Unexpected page count");
goto out;
}
} else {
FILE *pd = popen(gscommand, "r");
if (!pd) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Failed to execute ghostscript to determine "
+ "cfFilterGhostscript: Failed to execute ghostscript to determine "
"number of input pages!");
goto out;
}
if (pagecount == 0) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: No pages left, outputting empty file.");
+ "cfFilterGhostscript: No pages left, outputting empty file.");
status = 0;
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER)
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER)
if (write(outputfd, "RaS2", 4)) {};
goto out;
}
if (pagecount < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unexpected page count");
+ "cfFilterGhostscript: Unexpected page count");
goto out;
}
}
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Input format: %s",
+ "cfFilterGhostscript: Input format: %s",
(doc_type == GS_DOC_TYPE_PDF ? "PDF" :
(doc_type == GS_DOC_TYPE_PS ? "PostScript" :
(doc_type == GS_DOC_TYPE_EMPTY ? "Empty file" :
{
doc_type = GS_DOC_TYPE_UNKNOWN;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Input format: Not determined");
+ "cfFilterGhostscript: Input format: Not determined");
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Streaming mode, no checks for input format, zero-page input, instructions from previous filter");
+ "cfFilterGhostscript: Streaming mode, no checks for input format, zero-page input, instructions from previous filter");
}
/* Find print-rendering-intent */
gs_args = cupsArrayNew(NULL, NULL);
if (!gs_args) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "ghostscript: Unable to allocate memory for Ghostscript "
- "arguments array");
+ "cfFilterGhostscript: Unable to allocate memory for Ghostscript arguments array");
goto out;
}
cupsArrayAdd(gs_args, strdup("-sOutputFile=%stdout"));
/* Ghostscript output device */
- if (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER)
+ if (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER)
cupsArrayAdd(gs_args, strdup("-sDEVICE=cups"));
- else if (outformat == OUTPUT_FORMAT_PDF)
+ else if (outformat == CF_FILTER_OUT_FORMAT_PDF)
cupsArrayAdd(gs_args, strdup("-sDEVICE=pdfwrite"));
/* In case of PCL XL, raster-obly PDF, or PCLm output we determine
the exact output device later */
/* Special Ghostscript options for PDF output */
- if (outformat == OUTPUT_FORMAT_PDF) {
+ if (outformat == CF_FILTER_OUT_FORMAT_PDF) {
/* If we output PDF we are running as a PostScript-to-PDF filter
for incoming PostScript jobs. If the client embeds a command
for multiple copies in the PostScript job instead of using the
cspace = icc_profile ? CUPS_CSPACE_RGB : -1;
cupsRasterPrepareHeader(&h, data, outformat,
- (outformat != OUTPUT_FORMAT_APPLE_RASTER ?
- outformat : OUTPUT_FORMAT_CUPS_RASTER), 0,
+ (outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER ?
+ outformat : CF_FILTER_OUT_FORMAT_CUPS_RASTER), 0,
&cspace);
/* Special Ghostscript options for raster-only PDF output */
/* Note that these output formats require Ghostscript 9.55.0 or later */
- if (outformat == OUTPUT_FORMAT_PDF_IMAGE ||
- outformat == OUTPUT_FORMAT_PCLM) {
+ if (outformat == CF_FILTER_OUT_FORMAT_PDF_IMAGE ||
+ outformat == CF_FILTER_OUT_FORMAT_PCLM) {
int res_x, res_y,
sup_res_x, sup_res_y,
best_res_x = 0, best_res_y = 0,
ipp_attr = NULL;
attr = NULL;
- if (outformat == OUTPUT_FORMAT_PCLM || /* PCLm forced */
+ if (outformat == CF_FILTER_OUT_FORMAT_PCLM || /* PCLm forced */
/* PCLm supported according to printer IPP attributes */
(printer_attrs &&
(ipp_attr =
(attr =
ppdFindAttr(ppd, "cupsPclmSourceResolutionSupported", 0)) != NULL)) {
- outformat = OUTPUT_FORMAT_PCLM;
+ outformat = CF_FILTER_OUT_FORMAT_PCLM;
/* Resolution */
cupsArrayAdd(gs_args, strdup("-dDownScaleFactor=1"));
}
- if (outformat == OUTPUT_FORMAT_PXL)
+ if (outformat == CF_FILTER_OUT_FORMAT_PXL)
{
if (ppd)
{
snprintf(tmpstr, sizeof(tmpstr), "-sOutputICCProfile=%s", icc_profile);
cupsArrayAdd(gs_args, strdup(tmpstr));
} else if (!cm_disabled &&
- (outformat == OUTPUT_FORMAT_CUPS_RASTER ||
- outformat == OUTPUT_FORMAT_PWG_RASTER ||
- outformat == OUTPUT_FORMAT_APPLE_RASTER)) {
+ (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER)) {
/* Set standard output ICC profile sGray/sRGB/AdobeRGB */
if (h.cupsColorSpace == CUPS_CSPACE_SW)
cupsArrayAdd(gs_args, strdup("-sOutputICCProfile=sgray.icc"));
else if (h.cupsColorSpace == CUPS_CSPACE_ADOBERGB)
cupsArrayAdd(gs_args, strdup("-sOutputICCProfile=a98.icc"));
} else if (!cm_disabled &&
- outformat == OUTPUT_FORMAT_PCLM) {
+ outformat == CF_FILTER_OUT_FORMAT_PCLM) {
/* Set standard output ICC profile sGray/sRGB */
/*if (h.cupsColorSpace == CUPS_CSPACE_SW)
cupsArrayAdd(gs_args, strdup("-sOutputICCProfile=sgray.icc"));
filtering case which happens for converting PostScript input
files before pdftopdf so margins will be handled later, whereas
the other output formats for PDF-to-something filtering after
- pdftopdf, to format the pages for the printer, so margins are
+ cfFilterPDFToPDF, to format the pages for the printer, so margins are
important. */
- if (h.cupsImagingBBox[3] > 0.0 && outformat != OUTPUT_FORMAT_PDF) {
+ if (h.cupsImagingBBox[3] > 0.0 && outformat != CF_FILTER_OUT_FORMAT_PDF) {
snprintf(tmpstr, sizeof(tmpstr),
"<</.HWMargins[%f %f %f %f] /Margins[0 0]>>setpagedevice",
h.cupsImagingBBox[0], h.cupsImagingBBox[1],
(t && (!strcasecmp(t, "true") || !strcasecmp(t, "on") ||
!strcasecmp(t, "yes")))) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Ghostscript using Center-of-Pixel method to "
+ "cfFilterGhostscript: Ghostscript using Center-of-Pixel method to "
"fill paths.");
cupsArrayAdd(gs_args, strdup("0 0 .setfilladjust2"));
} else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "ghostscript: Ghostscript using Any-Part-of-Pixel method to "
+ "cfFilterGhostscript: Ghostscript using Any-Part-of-Pixel method to "
"fill paths.");
/* Mark the end of PostScript commands supplied on the Ghostscript command
}
/*
- * 'imagetopdf()' - Filter function to convert many common image file
+ * 'cfFilterImageToPDF()' - Filter function to convert many common image file
* formats into PDF
*/
int /* O - Error status */
-imagetopdf(int inputfd, /* I - File descriptor input stream */
+cfFilterImageToPDF(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
imagetopdf_doc_t doc; /* Document information */
int cropfit = 0; /* -o crop-to-fit = true */
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
ipp_t *printer_attrs = data->printer_attrs;
ipp_t *job_attrs = data->job_attrs;
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Unable to open input data stream.");
+ "cfFilterImageToPDF: Unable to open input data stream.");
}
return (1);
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Unable to copy input: %s",
+ "cfFilterImageToPDF: Unable to copy input: %s",
strerror(errno));
fclose(fp);
return (1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Copying input to temp file \"%s\"",
+ "cfFilterImageToPDF: Copying input to temp file \"%s\"",
tempfile);
while ((bytes = fread(buf, 1, sizeof(buf), fp)) > 0)
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Unable to open temporary file.");
+ "cfFilterImageToPDF: Unable to open temporary file.");
}
unlink(tempfile);
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Unable to open output data stream.");
+ "cfFilterImageToPDF: Unable to open output data stream.");
}
fclose(fp);
*/
doc.ppd = data->ppd;
- filterSetCommonOptions(doc.ppd, num_options, options, 0,
+ cfFilterSetCommonOptions(doc.ppd, num_options, options, 0,
&doc.Orientation, &doc.Duplex,
&doc.LanguageLevel, &doc.Color,
&doc.PageLeft, &doc.PageRight,
&doc.PageWidth, &doc.PageLength,
log, ld);
- /* The filterSetCommonOptions() does not set doc.Color
+ /* The cfFilterSetCommonOptions() does not set doc.Color
according to option settings (user's demand for color/gray),
so we parse the options and set the mode here */
cupsRasterParseIPPOptions(&h, data, 0, 1);
if (doc.img == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Unable to open image file for printing!");
+ "cfFilterImageToPDF: Unable to open image file for printing!");
fclose(doc.outputfp);
close(outputfd);
return (1);
yppi = xppi;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
+ "cfFilterImageToPDF: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
xppi, yppi, zoom);
if (xppi > 0)
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Before scaling: xprint=%.1f, yprint=%.1f",
+ "cfFilterImageToPDF: Before scaling: xprint=%.1f, yprint=%.1f",
doc.xprint, doc.yprint);
doc.xinches = (float)cupsImageGetWidth(doc.img) / (float)xppi;
doc.yinches = (float)cupsImageGetHeight(doc.img) / (float)yppi;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Image size is %.1f x %.1f inches...",
+ "cfFilterImageToPDF: Image size is %.1f x %.1f inches...",
doc.xinches, doc.yinches);
if ((val = cupsGetOption("natural-scaling", num_options, options)) != NULL)
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Auto orientation...");
+ "cfFilterImageToPDF: Auto orientation...");
if ((doc.xinches > doc.xprint || doc.yinches > doc.yprint) &&
doc.xinches <= doc.yprint && doc.yinches <= doc.xprint)
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Using landscape orientation...");
+ "cfFilterImageToPDF: Using landscape orientation...");
doc.Orientation = (doc.Orientation + 1) & 3;
doc.xsize = doc.yprint;
(float)cupsImageGetXPPI(doc.img);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Before scaling: xprint=%.1f, yprint=%.1f",
+ "cfFilterImageToPDF: Before scaling: xprint=%.1f, yprint=%.1f",
doc.xprint, doc.yprint);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: cupsImageGetXPPI(img) = %d, "
+ "cfFilterImageToPDF: cupsImageGetXPPI(img) = %d, "
"cupsImageGetYPPI(img) = %d, aspect = %f",
cupsImageGetXPPI(doc.img), cupsImageGetYPPI(doc.img),
doc.aspect);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Portrait size is %.2f x %.2f inches",
+ "cfFilterImageToPDF: Portrait size is %.2f x %.2f inches",
doc.xsize, doc.ysize);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Landscape size is %.2f x %.2f inches",
+ "cfFilterImageToPDF: Landscape size is %.2f x %.2f inches",
doc.xsize2, doc.ysize2);
if (cupsGetOption("orientation-requested", num_options, options) == NULL &&
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Auto orientation...");
+ "cfFilterImageToPDF: Auto orientation...");
if ((doc.xsize * doc.ysize) < (doc.xsize2 * doc.xsize2))
{
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Using landscape orientation...");
+ "cfFilterImageToPDF: Using landscape orientation...");
doc.Orientation = 1;
doc.xinches = doc.xsize2;
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Using portrait orientation...");
+ "cfFilterImageToPDF: Using portrait orientation...");
doc.Orientation = 0;
doc.xinches = doc.xsize;
else if (doc.Orientation & 1)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Using landscape orientation...");
+ "cfFilterImageToPDF: Using landscape orientation...");
doc.xinches = doc.xsize2;
doc.yinches = doc.ysize2;
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Using portrait orientation...");
+ "cfFilterImageToPDF: Using portrait orientation...");
doc.xinches = doc.xsize;
doc.yinches = doc.ysize;
doc.yprint = doc.yinches / doc.ypages;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: xpages = %dx%.2fin, ypages = %dx%.2fin",
+ "cfFilterImageToPDF: xpages = %dx%.2fin, ypages = %dx%.2fin",
doc.xpages, doc.xprint, doc.ypages, doc.yprint);
/*
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Updated custom page size to %.2f x %.2f "
+ "cfFilterImageToPDF: Updated custom page size to %.2f x %.2f "
"inches...",
width / 72.0, length / 72.0);
if (log) {
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: XPosition=%d, YPosition=%d, Orientation=%d",
+ "cfFilterImageToPDF: XPosition=%d, YPosition=%d, Orientation=%d",
doc.XPosition, doc.YPosition, doc.Orientation);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: xprint=%.2f, yprint=%.2f", doc.xprint, doc.yprint);
+ "cfFilterImageToPDF: xprint=%.2f, yprint=%.2f", doc.xprint, doc.yprint);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f",
+ "cfFilterImageToPDF: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f",
doc.PageLeft, doc.PageRight, doc.PageWidth);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f",
+ "cfFilterImageToPDF: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f",
doc.PageBottom, doc.PageTop, doc.PageLength);
}
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: left=%.2f, top=%.2f", doc.left, doc.top);
+ "cfFilterImageToPDF: left=%.2f, top=%.2f", doc.left, doc.top);
if (doc.Collate)
{
if ((contentsObjs = malloc(sizeof(int)*doc.xpages*doc.ypages)) == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Can't allocate contentsObjs");
+ "cfFilterImageToPDF: Can't allocate contentsObjs");
goto out_of_memory;
}
if ((imgObjs = malloc(sizeof(int)*doc.xpages*doc.ypages)) == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Can't allocate imgObjs");
+ "cfFilterImageToPDF: Can't allocate imgObjs");
goto out_of_memory;
}
for (doc.xpage = 0; doc.xpage < doc.xpages; doc.xpage ++)
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Job canceled");
+ "cfFilterImageToPDF: Job canceled");
goto canceled;
}
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Job canceled");
+ "cfFilterImageToPDF: Job canceled");
goto canceled;
}
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Job canceled");
+ "cfFilterImageToPDF: Job canceled");
goto canceled;
}
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Job canceled");
+ "cfFilterImageToPDF: Job canceled");
goto canceled;
}
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetopdf: Job canceled");
+ "cfFilterImageToPDF: Job canceled");
goto canceled;
}
out_of_memory:
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetopdf: Cannot allocate any more memory.");
+ "cfFilterImageToPDF: Cannot allocate any more memory.");
freeAllObj(&doc);
cupsImageClose(doc.img);
fclose(doc.outputfp);
*
* Contents:
*
- * imagetops() - imagetops filter function
+ * cfFilterImageToPS() - imagetops filter function
* WriteCommon() - Write common procedures...
* WriteLabelProlog() - Write the prolog with the classification
* and page label.
/*
- * 'imagetops()' - Filter function to convert many common image file
+ * 'cfFilterImageToPS()' - Filter function to convert many common image file
* formats into PostScript
*/
int /* O - Error status */
-imagetops(int inputfd, /* I - File descriptor input stream */
+cfFilterImageToPS(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
imagetops_doc_t doc; /* Document information */
int bytes;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetops: Unable to open input data stream.");
+ "cfFilterImageToPS: Unable to open input data stream.");
}
return (1);
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetops: Unable to copy input: %s",
+ "cfFilterImageToPS: Unable to copy input: %s",
strerror(errno));
return (1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Copying input to temp file \"%s\"",
+ "cfFilterImageToPS: Copying input to temp file \"%s\"",
tempfile);
while ((bytes = fread(buf, 1, sizeof(buf), inputfp)) > 0)
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetops: Unable to open temporary file.");
+ "cfFilterImageToPS: Unable to open temporary file.");
}
unlink(tempfile);
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetops: Unable to open output data stream.");
+ "cfFilterImageToPS: Unable to open output data stream.");
}
fclose(inputfp);
*/
ppd = data->ppd;
- filterSetCommonOptions(ppd, num_options, options, 0,
+ cfFilterSetCommonOptions(ppd, num_options, options, 0,
&doc.Orientation, &doc.Duplex,
&doc.LanguageLevel, &doc.Color,
&doc.PageLeft, &doc.PageRight,
&doc.PageWidth, &doc.PageLength,
log, ld);
- /* The filterSetCommonOptions() does not set doc.Color
+ /* The cfFilterSetCommonOptions() does not set doc.Color
according to option settings (user's demand for color/gray),
so we parse the options and set the mode here */
cupsRasterParseIPPOptions(&h, data, 0, 1);
if (img == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetops: The print file could not be opened - %s",
+ "cfFilterImageToPS: The print file could not be opened - %s",
strerror(errno));
return (1);
}
yppi = xppi;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
+ "cfFilterImageToPS: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
xppi, yppi, zoom);
if (xppi > 0)
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Before scaling: xprint=%.1f, yprint=%.1f",
+ "cfFilterImageToPS: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
xinches = (float)cupsImageGetWidth(img) / (float)xppi;
yinches = (float)cupsImageGetHeight(img) / (float)yppi;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Image size is %.1f x %.1f inches...",
+ "cfFilterImageToPS: Image size is %.1f x %.1f inches...",
xinches, yinches);
if ((val = cupsGetOption("natural-scaling", num_options, options)) != NULL)
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Auto orientation...");
+ "cfFilterImageToPS: Auto orientation...");
if ((xinches > xprint || yinches > yprint) &&
xinches <= yprint && yinches <= xprint)
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Using landscape orientation...");
+ "cfFilterImageToPS: Using landscape orientation...");
doc.Orientation = (doc.Orientation + 1) & 3;
xsize = yprint;
aspect = (float)cupsImageGetYPPI(img) / (float)cupsImageGetXPPI(img);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Before scaling: xprint=%.1f, yprint=%.1f",
+ "cfFilterImageToPS: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: cupsImageGetXPPI(img) = %d, "
+ "cfFilterImageToPS: cupsImageGetXPPI(img) = %d, "
"cupsImageGetYPPI(img) = %d, aspect = %f",
cupsImageGetXPPI(img), cupsImageGetYPPI(img), aspect);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Portrait size is %.2f x %.2f inches",
+ "cfFilterImageToPS: Portrait size is %.2f x %.2f inches",
xsize, ysize);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Landscape size is %.2f x %.2f inches",
+ "cfFilterImageToPS: Landscape size is %.2f x %.2f inches",
xsize2, ysize2);
if (cupsGetOption("orientation-requested", num_options, options) == NULL &&
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Auto orientation...");
+ "cfFilterImageToPS: Auto orientation...");
if ((xsize * ysize) < (xsize2 * xsize2))
{
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Using landscape orientation...");
+ "cfFilterImageToPS: Using landscape orientation...");
doc.Orientation = 1;
xinches = xsize2;
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Using portrait orientation...");
+ "cfFilterImageToPS: Using portrait orientation...");
doc.Orientation = 0;
xinches = xsize;
else if (doc.Orientation & 1)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Using landscape orientation...");
+ "cfFilterImageToPS: Using landscape orientation...");
xinches = xsize2;
yinches = ysize2;
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Using portrait orientation...");
+ "cfFilterImageToPS: Using portrait orientation...");
xinches = xsize;
yinches = ysize;
yprint = yinches / ypages;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: xpages = %dx%.2fin, ypages = %dx%.2fin",
+ "cfFilterImageToPS: xpages = %dx%.2fin, ypages = %dx%.2fin",
xpages, xprint, ypages, yprint);
/*
length = ppd->custom_min[1];
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Updated custom page size to %.2f x %.2f inches...",
+ "cfFilterImageToPS: Updated custom page size to %.2f x %.2f inches...",
width / 72.0, length / 72.0);
/*
if (row == NULL)
{
log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetops: Could not allocate memory.");
+ "cfFilterImageToPS: Could not allocate memory.");
cupsImageClose(img);
return (2);
}
if (log)
{
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: XPosition=%d, YPosition=%d, Orientation=%d",
+ "cfFilterImageToPS: XPosition=%d, YPosition=%d, Orientation=%d",
XPosition, YPosition, doc.Orientation);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: xprint=%.1f, yprint=%.1f", xprint, yprint);
+ "cfFilterImageToPS: xprint=%.1f, yprint=%.1f", xprint, yprint);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f",
+ "cfFilterImageToPS: PageLeft=%.0f, PageRight=%.0f, PageWidth=%.0f",
doc.PageLeft, doc.PageRight, doc.PageWidth);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f",
+ "cfFilterImageToPS: PageBottom=%.0f, PageTop=%.0f, PageLength=%.0f",
doc.PageBottom, doc.PageTop, doc.PageLength);
}
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: left=%.2f, top=%.2f", left, top);
+ "cfFilterImageToPS: left=%.2f, top=%.2f", left, top);
for (page = 1; Copies > 0; Copies --)
for (xpage = 0; xpage < xpages; xpage ++)
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Job canceled");
+ "cfFilterImageToPS: Job canceled");
goto canceled;
}
"PAGE: %d %d", page, realcopies);
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "imagetops: Printing page %d.", page);
+ "cfFilterImageToPS: Printing page %d.", page);
fprintf(doc.outputfp, "%%%%Page: %d %d\n", page, page);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetops: Printing completed.", page);
+ "cfFilterImageToPS: Printing completed.", page);
/*
* Close files...
*
* Contents:
*
- * imagetoraster() - The image conversion filter function
+ * cfFilterImageToRaster() - The image conversion filter function
* blank_line() - Clear a line buffer to the blank value...
* format_CMY() - Convert image data to CMY.
* format_CMYK() - Convert image data to CMYK.
/*
- * 'imagetoraster()' - Filter function to convert many common image file
+ * 'cfFilterImageToRaster()' - Filter function to convert many common image file
* formats into CUPS Raster
*/
int /* O - Error status */
-imagetoraster(int inputfd, /* I - File descriptor input stream */
+cfFilterImageToRaster(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
imagetoraster_doc_t doc; /* Document information */
int cropfit = 0; /* -o crop-to-fit */
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
ipp_t *printer_attrs = data->printer_attrs;
ipp_t *job_attrs = data->job_attrs;
customRight = 0.0, /* ppd->custom_margin[2] */
customTop = 0.0; /* ppd->custom_margin[3] */
char defSize[41];
- filter_out_format_t outformat;
+ cf_filter_out_format_t outformat;
- /* Note: With the OUTPUT_FORMAT_APPLE_RASTER,
- OUTPUT_FORMAT_PWG_RASTER, or OUTPUT_FORMAT_PCLM selections the
+ /* Note: With the CF_FILTER_OUT_FORMAT_APPLE_RASTER,
+ CF_FILTER_OUT_FORMAT_PWG_RASTER, or CF_FILTER_OUT_FORMAT_PCLM selections the
output is actually CUPS Raster but information about available
color spaces and depths are taken from the urf-supported or
pwg-raster-document-type-supported printer IPP attributes or
Raster and PWG Raster output support to this filter. */
if (parameters) {
- outformat = *(filter_out_format_t *)parameters;
- if (outformat != OUTPUT_FORMAT_PCLM &&
- outformat != OUTPUT_FORMAT_CUPS_RASTER &&
- outformat != OUTPUT_FORMAT_PWG_RASTER &&
- outformat != OUTPUT_FORMAT_APPLE_RASTER)
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = *(cf_filter_out_format_t *)parameters;
+ if (outformat != CF_FILTER_OUT_FORMAT_PCLM &&
+ outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PWG_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER)
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
} else
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Final output format: %s",
- (outformat == OUTPUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
- (outformat == OUTPUT_FORMAT_PWG_RASTER ? "PWG Raster" :
- (outformat == OUTPUT_FORMAT_APPLE_RASTER ? "Apple Raster" :
+ "cfFilterImageToRaster: Final output format: %s",
+ (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER ? "Apple Raster" :
"PCLm"))));
if (printer_attrs != NULL) {
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Unable to open input data stream.");
+ "cfFilterImageToRaster: Unable to open input data stream.");
}
return (1);
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetoraster: Unable to copy input: %s",
+ "cfFilterImageToRaster: Unable to copy input: %s",
strerror(errno));
fclose(fp);
return (1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Copying input to temp file \"%s\"",
+ "cfFilterImageToRaster: Copying input to temp file \"%s\"",
tempfile);
while ((bytes = fread(buf, 1, sizeof(buf), fp)) > 0)
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Unable to open temporary file.");
+ "cfFilterImageToRaster: Unable to open temporary file.");
}
unlink(tempfile);
*/
cupsRasterPrepareHeader(&header, data, outformat,
- OUTPUT_FORMAT_CUPS_RASTER, 1, &cspace);
+ CF_FILTER_OUT_FORMAT_CUPS_RASTER, 1, &cspace);
ppd = data->ppd;
doc.Orientation = header.Orientation;
doc.Duplex = header.Duplex;
if (log)
{
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.color = %d", doc.Color);
+ "cfFilterImageToRaster: doc.color = %d", doc.Color);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.Orientation = %d", doc.Orientation);
+ "cfFilterImageToRaster: doc.Orientation = %d", doc.Orientation);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.Duplex = %d", doc.Duplex);
+ "cfFilterImageToRaster: doc.Duplex = %d", doc.Duplex);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.PageWidth = %.1f", doc.PageWidth);
+ "cfFilterImageToRaster: doc.PageWidth = %.1f", doc.PageWidth);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.PageLength = %.1f", doc.PageLength);
+ "cfFilterImageToRaster: doc.PageLength = %.1f", doc.PageLength);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.PageLeft = %.1f", doc.PageLeft);
+ "cfFilterImageToRaster: doc.PageLeft = %.1f", doc.PageLeft);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.PageRight = %.1f", doc.PageRight);
+ "cfFilterImageToRaster: doc.PageRight = %.1f", doc.PageRight);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.PageTop = %.1f", doc.PageTop);
+ "cfFilterImageToRaster: doc.PageTop = %.1f", doc.PageTop);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: doc.PageBottom = %.1f", doc.PageBottom);
+ "cfFilterImageToRaster: doc.PageBottom = %.1f", doc.PageBottom);
}
/* Find print-rendering-intent */
getPrintRenderIntent(data, &header);
if(log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Print rendering intent = %s",
+ "cfFilterImageToRaster: Print rendering intent = %s",
header.cupsRenderingIntent);
if ((val = cupsGetOption("multiple-document-handling",
case CUPS_CSPACE_DEVICEE :
case CUPS_CSPACE_DEVICEF :
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Colorspace %d not supported.",
+ "cfFilterImageToRaster: Colorspace %d not supported.",
header.cupsColorSpace);
if (!inputseekable)
unlink(tempfile);
else if (ppd != NULL && !cm_disabled)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Searching for profile \"%s/%s\"...",
+ "cfFilterImageToRaster: Searching for profile \"%s/%s\"...",
resolution, media_type);
for (i = 0, profile = ppd->profiles; i < ppd->num_profiles;
i ++, profile ++)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: \"%s/%s\" = ", profile->resolution,
+ "cfFilterImageToRaster: \"%s/%s\" = ", profile->resolution,
profile->media_type);
if ((strcmp(profile->resolution, resolution) == 0 ||
profile->media_type[0] == '-'))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: MATCH");
+ "cfFilterImageToRaster: MATCH");
break;
}
else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: no.");
+ "cfFilterImageToRaster: no.");
}
/*
*/
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "imagetoraster: Loading print file.");
+ "cfFilterImageToRaster: Loading print file.");
if (header.cupsColorSpace == CUPS_CSPACE_CIEXYZ ||
header.cupsColorSpace == CUPS_CSPACE_CIELab ||
if (img == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetoraster: The print file could not be opened.");
+ "cfFilterImageToRaster: The print file could not be opened.");
return (1);
}
yppi = xppi;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
+ "cfFilterImageToRaster: Before scaling: xppi=%d, yppi=%d, zoom=%.2f",
xppi, yppi, zoom);
if (xppi > 0)
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Before scaling: xprint=%.1f, yprint=%.1f",
+ "cfFilterImageToRaster: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
xinches = (float)img->xsize / (float)xppi;
yinches = (float)img->ysize / (float)yppi;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Image size is %.1f x %.1f inches...",
+ "cfFilterImageToRaster: Image size is %.1f x %.1f inches...",
xinches, yinches);
if ((val = cupsGetOption("natural-scaling", num_options, options)) != NULL)
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Auto orientation...");
+ "cfFilterImageToRaster: Auto orientation...");
if ((xinches > xprint || yinches > yprint) &&
xinches <= yprint && yinches <= xprint)
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Using landscape orientation...");
+ "cfFilterImageToRaster: Using landscape orientation...");
doc.Orientation = (doc.Orientation + 1) & 3;
xsize = yprint;
aspect = (float)img->yppi / (float)img->xppi;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Before scaling: xprint=%.1f, yprint=%.1f",
+ "cfFilterImageToRaster: Before scaling: xprint=%.1f, yprint=%.1f",
xprint, yprint);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: img->xppi = %d, img->yppi = %d, aspect = %f",
+ "cfFilterImageToRaster: img->xppi = %d, img->yppi = %d, aspect = %f",
img->xppi, img->yppi, aspect);
xsize = xprint * zoom;
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Portrait size is %.2f x %.2f inches",
+ "cfFilterImageToRaster: Portrait size is %.2f x %.2f inches",
xsize, ysize);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Landscape size is %.2f x %.2f inches",
+ "cfFilterImageToRaster: Landscape size is %.2f x %.2f inches",
xsize2, ysize2);
if (cupsGetOption("orientation-requested", num_options, options) == NULL &&
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Auto orientation...");
+ "cfFilterImageToRaster: Auto orientation...");
if ((xsize * ysize) < (xsize2 * ysize2))
{
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Using landscape orientation...");
+ "cfFilterImageToRaster: Using landscape orientation...");
doc.Orientation = 1;
xinches = xsize2;
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Using portrait orientation...");
+ "cfFilterImageToRaster: Using portrait orientation...");
doc.Orientation = 0;
xinches = xsize;
else if (doc.Orientation & 1)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Using landscape orientation...");
+ "cfFilterImageToRaster: Using landscape orientation...");
xinches = xsize2;
yinches = ysize2;
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Using portrait orientation...");
+ "cfFilterImageToRaster: Using portrait orientation...");
xinches = xsize;
yinches = ysize;
yprint = yinches / ypages;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: xpages = %dx%.2fin, ypages = %dx%.2fin",
+ "cfFilterImageToRaster: xpages = %dx%.2fin, ypages = %dx%.2fin",
xpages, xprint, ypages, yprint);
/*
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Updated custom page size to %.2f x %.2f "
+ "cfFilterImageToRaster: Updated custom page size to %.2f x %.2f "
"inches...",
width / 72.0, length / 72.0);
header.Margins[1] = doc.PageBottom;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: PageSize = [%d %d]", header.PageSize[0],
+ "cfFilterImageToRaster: PageSize = [%d %d]", header.PageSize[0],
header.PageSize[1]);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: PageLeft = %f, PageRight = %f, "
+ "cfFilterImageToRaster: PageLeft = %f, PageRight = %f, "
"PageBottom = %f, PageTop = %f",
doc.PageLeft, doc.PageRight, doc.PageBottom, doc.PageTop);
header.ImagingBoundingBox[3] = header.cupsImagingBBox[3];
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Orientation: %d, XPosition: %d, YPosition: %d, "
+ "cfFilterImageToRaster: Orientation: %d, XPosition: %d, YPosition: %d, "
"ImagingBoundingBox = [%d %d %d %d]",
doc.Orientation, doc.XPosition, doc.YPosition,
header.ImagingBoundingBox[0], header.ImagingBoundingBox[1],
if (log) {
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: cupsWidth = %d", header.cupsWidth);
+ "cfFilterImageToRaster: cupsWidth = %d", header.cupsWidth);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: cupsHeight = %d", header.cupsHeight);
+ "cfFilterImageToRaster: cupsHeight = %d", header.cupsHeight);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: cupsBitsPerColor = %d", header.cupsBitsPerColor);
+ "cfFilterImageToRaster: cupsBitsPerColor = %d", header.cupsBitsPerColor);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: cupsBitsPerPixel = %d", header.cupsBitsPerPixel);
+ "cfFilterImageToRaster: cupsBitsPerPixel = %d", header.cupsBitsPerPixel);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: cupsBytesPerLine = %d", header.cupsBytesPerLine);
+ "cfFilterImageToRaster: cupsBytesPerLine = %d", header.cupsBytesPerLine);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: cupsColorOrder = %d", header.cupsColorOrder);
+ "cfFilterImageToRaster: cupsColorOrder = %d", header.cupsColorOrder);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: cupsColorSpace = %d", header.cupsColorSpace);
+ "cfFilterImageToRaster: cupsColorSpace = %d", header.cupsColorSpace);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: img->colorspace = %d", img->colorspace);
+ "cfFilterImageToRaster: img->colorspace = %d", img->colorspace);
}
row = malloc(2 * header.cupsBytesPerLine);
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Job canceled");
+ "cfFilterImageToRaster: Job canceled");
goto canceled;
}
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "imagetoraster: Formatting page %d.", page);
+ "cfFilterImageToRaster: Formatting page %d.", page);
if (doc.Orientation & 1)
{
y /= 2;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Writing %d leading blank lines...",
+ "cfFilterImageToRaster: Writing %d leading blank lines...",
y);
for (; y > 0; y --)
header.cupsBytesPerLine)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetoraster: Unable to send raster data.");
+ "cfFilterImageToRaster: Unable to send raster data.");
cupsImageClose(img);
return (1);
}
header.cupsBytesPerLine)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Unable to send raster data.");
+ "cfFilterImageToRaster: Unable to send raster data.");
cupsImageClose(img);
return (1);
}
y = y - y / 2;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "imagetoraster: Writing %d trailing blank lines...",
+ "cfFilterImageToRaster: Writing %d trailing blank lines...",
y);
for (; y > 0; y --)
header.cupsBytesPerLine)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "imagetoraster: Unable to send raster data.");
+ "cfFilterImageToRaster: Unable to send raster data.");
cupsImageClose(img);
return (1);
}
if (strncmp(buf,"%PDF",4) == 0)
return 0;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "mupdftopwg: input file cannot be identified");
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterMuPDFToPWG: input file cannot be identified");
return -1;
}
static void
add_pdf_header_options(mupdf_page_header *h,
- filter_out_format_t outformat,
+ cf_filter_out_format_t outformat,
cups_array_t *mupdf_args)
{
char tmpstr[1024];
break;
case CUPS_CSPACE_CMYK:
- if (outformat == OUTPUT_FORMAT_PWG_RASTER) /* No post-filtering needed */
+ if (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER) /* No post-filtering needed */
snprintf(tmpstr, sizeof(tmpstr), "-ccmyk");
else
snprintf(tmpstr, sizeof(tmpstr), "-crgb"); /* Post-filtering needed, only
int outputfd,
filter_logfunc_t log,
void *ld,
- filter_iscanceledfunc_t iscanceled,
+ cf_filter_iscanceledfunc_t iscanceled,
void *icd)
{
char *argument;
if (log) {
/* Debug output: Full mutool command line and environment variables */
- snprintf(buf, sizeof(buf), "mupdftopwg: mutool command line:");
+ snprintf(buf, sizeof(buf), "cfFilterMuPDFToPWG: mutool command line:");
for (i = 0; mutoolargv[i]; i ++) {
if ((strchr(mutoolargv[i],' ')) || (strchr(mutoolargv[i],'\t')))
apos = "'";
errfds[0] = -1;
errfds[1] = -1;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: Unable to establish stderr pipe for mutool "
+ "cfFilterMuPDFToPWG: Unable to establish stderr pipe for mutool "
"call");
goto out;
}
errfds[0] = -1;
errfds[1] = -1;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: Unable to set \"close on exec\" flag on read "
+ "cfFilterMuPDFToPWG: Unable to set \"close on exec\" flag on read "
"end of the stderr pipe for mutool call");
goto out;
}
close(errfds[0]);
close(errfds[1]);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: Unable to set \"close on exec\" flag on write "
+ "cfFilterMuPDFToPWG: Unable to set \"close on exec\" flag on write "
"end of the stderr pipe for mutool call");
goto out;
}
if (errfds[1] != 2) {
if (dup2(errfds[1], 2) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: Unable to couple pipe with stderr of "
+ "cfFilterMuPDFToPWG: Unable to couple pipe with stderr of "
"mutool process");
exit(1);
}
close(errfds[0]);
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: invalid pipe file descriptor to couple with "
+ "cfFilterMuPDFToPWG: invalid pipe file descriptor to couple with "
"stderr of mutool process");
exit(1);
}
if (outputfd != 1) {
if (dup2(outputfd, 1) < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: Unable to couple stdout of mutool "
+ "cfFilterMuPDFToPWG: Unable to couple stdout of mutool "
"process");
exit(1);
}
}
} else {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: Invalid file descriptor to couple with "
+ "cfFilterMuPDFToPWG: Invalid file descriptor to couple with "
"stdout of mutool process");
exit(1);
}
/* Execute mutool command line ... */
execvp(filename, mutoolargv);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: Unable to launch mutool: %s: %s", filename,
+ "cfFilterMuPDFToPWG: Unable to launch mutool: %s: %s", filename,
strerror(errno));
exit(1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "mupdftopwg: Started mutool (PID %d)", mutoolpid);
+ "cfFilterMuPDFToPWG: Started mutool (PID %d)", mutoolpid);
close(errfds[1]);
log_level = FILTER_LOGLEVEL_DEBUG;
msg = buf;
}
- log(ld, log_level, "mupdftopwg: %s", msg);
+ log(ld, log_level, "cfFilterMuPDFToPWG: %s", msg);
}
cupsFileClose(logfp);
/* No need to close the fd errfds[0], as cupsFileClose(fp) does this
exit(0);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "mupdftopwg: Started logging (PID %d)", errpid);
+ "cfFilterMuPDFToPWG: Started logging (PID %d)", errpid);
close(errfds[0]);
if ((pid = wait(&wstatus)) < 0) {
if (errno == EINTR && iscanceled && iscanceled(icd)) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "mupdftopwg: Job canceled, killing mutool ...");
+ "cfFilterMuPDFToPWG: Job canceled, killing mutool ...");
kill(mutoolpid, SIGTERM);
mutoolpid = -1;
kill(errpid, SIGTERM);
if (WIFEXITED(wstatus)) {
/* Via exit() anywhere or return() in the main() function */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: %s (PID %d) stopped with status %d",
+ "cfFilterMuPDFToPWG: %s (PID %d) stopped with status %d",
(pid == mutoolpid ? "mutool" : "Logging"), pid,
WEXITSTATUS(wstatus));
status = WEXITSTATUS(wstatus);
} else {
/* Via signal */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "mupdftopwg: %s (PID %d) crashed on signal %d",
+ "cfFilterMuPDFToPWG: %s (PID %d) crashed on signal %d",
(pid == mutoolpid ? "mutool" : "Logging"), pid,
WTERMSIG(wstatus));
status = 256 * WTERMSIG(wstatus);
}
} else {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "mupdftopwg: %s (PID %d) exited with no errors.",
+ "cfFilterMuPDFToPWG: %s (PID %d) exited with no errors.",
(pid == mutoolpid ? "mutool" : "Logging"), pid);
status = 0;
}
int
-mupdftopwg (int inputfd, /* I - File descriptor input stream */
- int outputfd, /* I - File descriptor output stream */
- int inputseekable, /* I - Is input stream seekable? (unused)*/
- filter_data_t *data, /* I - Job and printer data */
- void *parameters) /* I - Filter-specific parameters */
+cfFilterMuPDFToPWG(int inputfd, /* I - File descriptor input stream */
+ int outputfd, /* I - File descriptor output stream */
+ int inputseekable, /* I - Is input stream seekable?
+ (unused)*/
+ cf_filter_data_t *data, /* I - Job and printer data */
+ void *parameters) /* I - Filter-specific parameters */
{
- filter_out_format_t outformat;
+ cf_filter_out_format_t outformat;
char buf[BUFSIZ];
char *icc_profile = NULL;
char tmpstr[1024];
cf_cm_calibration_t cm_calibrate;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
cups_cspace_t cspace = -1;
(void)inputseekable;
if (parameters) {
- outformat = *(filter_out_format_t *)parameters;
- if (outformat != OUTPUT_FORMAT_CUPS_RASTER &&
- outformat != OUTPUT_FORMAT_PWG_RASTER &&
- outformat != OUTPUT_FORMAT_APPLE_RASTER &&
- outformat != OUTPUT_FORMAT_PCLM)
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = *(cf_filter_out_format_t *)parameters;
+ if (outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PWG_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PCLM)
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
} else
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "mupdftopwg: Output format: %s",
- (outformat == OUTPUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
- (outformat == OUTPUT_FORMAT_PWG_RASTER ? "PWG Raster" :
- (outformat == OUTPUT_FORMAT_APPLE_RASTER ? "Apple Raster" :
+ "cfFilterMuPDFToPWG: Output format: %s",
+ (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER ? "Apple Raster" :
"PCLM"))));
memset(&sa, 0, sizeof(sa));
fd = cupsTempFd(infilename, 1024);
if (fd < 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "mupdftopwg: Can't create temporary file");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't create temporary file");
goto out;
}
/* copy input file to the tmp file */
while ((n = read(inputfd, buf, BUFSIZ)) > 0) {
if (write(fd,buf,n) != n) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "mupdftopwg: Can't copy input to temporary file");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't copy input to temporary file");
close(fd);
goto out;
}
if (!inputfd) {
if (lseek(fd,0,SEEK_SET) < 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "mupdftopwg: Can't rewind temporary file");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't rewind temporary file");
close(fd);
goto out;
}
if ((fp = fdopen(fd,"rb")) == 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "mupdftopwg: Can't open temporary file");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't open temporary file");
close(fd);
goto out;
}
/* filename is specified */
if ((fp = fdopen(fd,"rb")) == 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "mupdftopwg: Can't open temporary file");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Can't open temporary file");
goto out;
}
}
/* mutool parameters */
mupdf_args = cupsArrayNew(NULL, NULL);
if (!mupdf_args) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "mupdftopwg: Unable to allocate memory for mutool arguments array");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Unable to allocate memory for mutool arguments array");
goto out;
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "mupdftopwg: command: %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterMuPDFToPWG: command: %s",
CUPS_MUTOOL);
snprintf(tmpstr, sizeof(tmpstr), "%s", CUPS_MUTOOL);
cupsArrayAdd(mupdf_args, strdup(tmpstr));
From the header h only cupsWidth/cupsHeight (dimensions in pixels),
resolution, and color space are used here. */
cupsRasterPrepareHeader(&h, data, outformat,
- OUTPUT_FORMAT_PWG_RASTER, 1, &cspace);
+ CF_FILTER_OUT_FORMAT_PWG_RASTER, 1, &cspace);
if ((h.HWResolution[0] == 100) && (h.HWResolution[1] == 100)) {
/* No "Resolution" option */
if(empty)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "mupdftopwg: Input is empty, outputting empty file.");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterMuPDFToPWG: Input is empty, outputting empty file.");
status = 0;
}
out:
typedef struct pclmtoraster_data_s
{
- filter_out_format_t outformat = OUTPUT_FORMAT_PWG_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
int numcolors = 0;
int rowsize = 0;
cups_page_header2_t header;
} conversion_function_t;
static int
-parseOpts(filter_data_t *data, filter_out_format_t outformat,
+parseOpts(cf_filter_data_t *data, cf_filter_out_format_t outformat,
pclmtoraster_data_t *pclmtoraster_data)
{
int num_options = 0;
(!strcasecmp(attr->value, "true")
|| !strcasecmp(attr->value, "on") ||
!strcasecmp(attr->value, "yes")))
- pclmtoraster_data->outformat = OUTPUT_FORMAT_PWG_RASTER;
+ pclmtoraster_data->outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pclmtoraster: PPD file is not specified.");
+ "cfFilterPCLmToRaster: PPD file is not specified.");
t = cupsGetOption("media-class", num_options, options);
if (t == NULL)
if (t != NULL)
{
if (strcasestr(t, "pwg"))
- pclmtoraster_data->outformat = OUTPUT_FORMAT_PWG_RASTER;
+ pclmtoraster_data->outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
}
}
strncpy(pclmtoraster_data->pageSizeRequested, header->cupsPageSizeName, 64);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pclmtoraster: Page size requested: %s.",
+ "cfFilterPCLmToRaster: Page size requested: %s.",
header->cupsPageSizeName);
return(0);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pclmtoraster: Incorrect Rotate Value %d, not rotating",
+ "cfFilterPCLmToRaster: Incorrect Rotate Value %d, not rotating",
rotate);
return (src);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pclmtoraster: Colorspace %s not supported, "
+ "cfFilterPCLmToRaster: Colorspace %s not supported, "
"defaulting to /deviceRGB",
colorspace.c_str());
data->colorspace = "/DeviceRGB";
filter_logfunc_t log, /* I - Log function */
void* ld, /* I - Aux. data for log function */
pclmtoraster_data_t *data, /* I - pclmtoraster filter data */
- filter_data_t *filter_data, /* I - filter data */
+ cf_filter_data_t *filter_data, /* I - filter data */
conversion_function_t *convert) /* I - Conversion functions */
{
long long rotate = 0,
if (!mediaboxlookup(page, mediaBox))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pclmtoraster: PDF page %d doesn't contain a valid mediaBox",
+ "cfFilterPCLmToRaster: PDF page %d doesn't contain a valid mediaBox",
pgno + 1);
return (1);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pclmtoraster: mediaBox = [%f %f %f %f]: ",
+ "cfFilterPCLmToRaster: mediaBox = [%f %f %f %f]: ",
mediaBox[0], mediaBox[1], mediaBox[2], mediaBox[3]);
l = mediaBox[2] - mediaBox[0];
if (l < 0) l = -l;
{
ppdRasterMatchPPDSize(&(data->header), ppd, margins, paperdimensions, NULL,
NULL);
- if (data->outformat != OUTPUT_FORMAT_CUPS_RASTER)
+ if (data->outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER)
memset(margins, 0, sizeof(margins));
}
else if(filter_data!=NULL &&(filter_data->printer_attrs)!=NULL)
{
ippRasterMatchIPPSize(&(data->header), filter_data, margins, paperdimensions, NULL, NULL);
- if (data->outformat != OUTPUT_FORMAT_CUPS_RASTER)
+ if (data->outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER)
memset(margins, 0, sizeof(margins));
}
else
if (data->header.cupsImagingBBox[3] > 0.0)
{
/* Set margins if we have a bounding box defined ... */
- if (data->outformat == OUTPUT_FORMAT_CUPS_RASTER)
+ if (data->outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER)
{
margins[0] = data->header.cupsImagingBBox[0];
margins[1] = data->header.cupsImagingBBox[1];
data->header.cupsPageSize[i] = paperdimensions[i];
data->header.PageSize[i] = (unsigned int)(data->header.cupsPageSize[i] +
0.5);
- if (data->outformat == OUTPUT_FORMAT_CUPS_RASTER)
+ if (data->outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER)
data->header.Margins[i] = margins[i] + 0.5;
else
data->header.Margins[i] = 0;
}
- if (data->outformat == OUTPUT_FORMAT_CUPS_RASTER)
+ if (data->outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER)
{
data->header.cupsImagingBBox[0] = margins[0];
data->header.cupsImagingBBox[1] = margins[1];
if (!cupsRasterWriteHeader2(raster,&(data->header)))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pclmtoraster: Can't write page %d header", pgno + 1);
+ "cfFilterPCLmToRaster: Can't write page %d header", pgno + 1);
return (1);
}
}
/*
- * 'pclmtoraster()' - Filter function to convert raster-only PDF/PCLm input to
+ * 'cfFilterPCLmToRaster()' - Filter function to convert raster-only PDF/PCLm input to
* CUPS/PWG Raster output.
*/
int /* O - Error status */
-pclmtoraster(int inputfd, /* I - File descriptor input stream */
+cfFilterPCLmToRaster(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
- filter_out_format_t outformat;
+ cf_filter_out_format_t outformat;
FILE *inputfp; /* Input file pointer */
int fd = 0; /* Copy file descriptor */
char *filename, /* PDF file to convert */
conversion_function_t convert;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
if (parameters) {
- outformat = *(filter_out_format_t *)parameters;
- if (outformat != OUTPUT_FORMAT_CUPS_RASTER &&
- outformat != OUTPUT_FORMAT_PWG_RASTER &&
- outformat != OUTPUT_FORMAT_APPLE_RASTER)
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = *(cf_filter_out_format_t *)parameters;
+ if (outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PWG_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER)
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
} else
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pclmtoraster: Output format: %s",
- (outformat == OUTPUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
- (outformat == OUTPUT_FORMAT_PWG_RASTER ? "PWG Raster" :
+ "cfFilterPCLmToRaster: Output format: %s",
+ (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
"Apple Raster")));
/*
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pclmtoraster: Unable to open input data stream.");
+ "cfFilterPCLmToRaster: Unable to open input data stream.");
}
return (1);
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pclmtoraster: Unable to copy PDF file: %s",
+ "cfFilterPCLmToRaster: Unable to copy PDF file: %s",
strerror(errno));
fclose(inputfp);
return (1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pclmtoraster: Copying input to temp file \"%s\"",
+ "cfFilterPCLmToRaster: Copying input to temp file \"%s\"",
tempfile);
while ((bytes = fread(buffer, 1, sizeof(buffer), inputfp)) > 0)
&& pclmtoraster_data.header.cupsBitsPerColor != 16)
{
if(log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pclmtoraster: Specified color format is not supported: %s",
+ "cfFilterPCLmToRaster: Specified color format is not supported: %s",
strerror(errno));
delete(pdf);
unlink(tempfile);
if ((raster = cupsRasterOpen(outputfd,
(pclmtoraster_data.outformat ==
- OUTPUT_FORMAT_CUPS_RASTER ?
+ CF_FILTER_OUT_FORMAT_CUPS_RASTER ?
CUPS_RASTER_WRITE :
(pclmtoraster_data.outformat ==
- OUTPUT_FORMAT_PWG_RASTER ?
+ CF_FILTER_OUT_FORMAT_PWG_RASTER ?
CUPS_RASTER_WRITE_PWG :
CUPS_RASTER_WRITE_APPLE)))) == 0)
{
if(log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pclmtoraster: Can't open raster stream: %s",
+ "cfFilterPCLmToRaster: Can't open raster stream: %s",
strerror(errno));
delete(pdf);
unlink(tempfile);
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pclmtoraster: Job canceled");
+ "cfFilterPCLmToRaster: Job canceled");
break;
}
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "pclmtoraster: Starting page %d.", i+1);
+ "cfFilterPCLmToRaster: Starting page %d.", i+1);
if (outPage(raster, pages[i], i, log, ld, &pclmtoraster_data,data,
&convert) != 0)
break;
int len=data.size();
if (len==0) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: (empty)");
+ "cfFilterPDFToPDF: (empty)");
return;
}
len--;
for (int iA=0;iA<len;iA++) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: [%d,%d)",
+ "cfFilterPDFToPDF: [%d,%d)",
data[iA].first, data[iA].second);
}
if (data[len].second==npos) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: [%d,inf)",
+ "cfFilterPDFToPDF: [%d,inf)",
data[len].first);
} else {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: [%d,%d)",
+ "cfFilterPDFToPDF: [%d,%d)",
data[len].first, data[len].second);
}
}
void NupParameters::dump(pdftopdf_doc_t *doc) const // {{{
{
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: NupX: %d, NupY: %d, "
+ "cfFilterPDFToPDF: NupX: %d, NupY: %d, "
"width: %f, height: %f",
nupX,nupY,
width,height);
}
if (first==Axis::X) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: First Axis: X");
+ "cfFilterPDFToPDF: First Axis: X");
opos=0;
} else if (first==Axis::Y) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: First Axis: Y");
+ "cfFilterPDFToPDF: First Axis: Y");
opos=2;
std::swap(fpos,spos);
}
if ( (opos==-1)||(fpos==-1)||(spos==-1) ) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Bad Spec: %d; start: %d, %d",
+ "cfFilterPDFToPDF: Bad Spec: %d; start: %d, %d",
first,xstart,ystart);
} else {
static const char *order[4]={"lr","rl","bt","tb"};
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Order: %s%s",
+ "cfFilterPDFToPDF: Order: %s%s",
order[opos+fpos],order[(opos+2)%4+spos]);
}
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Alignment:");
+ "cfFilterPDFToPDF: Alignment:");
Position_dump(xalign,Axis::X,doc);
Position_dump(yalign,Axis::Y,doc);
}
void NupPageEdit::dump(pdftopdf_doc_t *doc) const // {{{
{
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: xpos: %f, ypos: %f, scale: %f",
+ "cfFilterPDFToPDF: xpos: %f, ypos: %f, scale: %f",
xpos,ypos,scale);
sub.dump(doc);
}
}
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported output-order "
+ "cfFilterPDFToPDF: Unsupported output-order "
"value %s, using 'normal'!",
val);
return false;
}
// }}}
-void getParameters(filter_data_t *data,int num_options,cups_option_t *options,ProcessingParameters ¶m,char *final_content_type,pdftopdf_doc_t *doc) // {{{
+void getParameters(cf_filter_data_t *data,int num_options,cups_option_t *options,ProcessingParameters ¶m,char *final_content_type,pdftopdf_doc_t *doc) // {{{
{
ppd_file_t *ppd = data->ppd;
if ((ipprot<3)||(ipprot>6)) {
if (ipprot && doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Bad value (%d) for "
+ "cfFilterPDFToPDF: Bad value (%d) for "
"orientation-requested, using 0 degrees",
ipprot);
param.noOrientation = true;
(val = cupsGetOption("PageSize", num_options, options)) != NULL) {
pwg_media_t *size_found = NULL;
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Page size from command "
+ "cfFilterPDFToPDF: Page size from command "
"line: %s", val);
if ((size_found = pwgMediaForPWG(val)) == NULL)
if ((size_found = pwgMediaForPPD(val)) == NULL)
param.page.right=param.page.width-param.page.right;
param.page.top=param.page.height-param.page.top;
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Width: %f, Length: %f",
+ "cfFilterPDFToPDF: Width: %f, Length: %f",
param.page.width, param.page.height);
}
else
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Unsupported page size %s.",
+ "cfFilterPDFToPDF: Unsupported page size %s.",
val);
}
#endif /* HAVE_CUPS_1_7 */
param.setDuplex=true;
} else if (strcasecmp(val,"one-sided")!=0) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported sides value %s, "
+ "cfFilterPDFToPDF: Unsupported sides value %s, "
"using sides=one-sided!", val);
}
}
if (optGetInt("number-up",num_options,options,&nup)) {
if (!NupParameters::possible(nup)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported number-up value "
+ "cfFilterPDFToPDF: Unsupported number-up value "
"%d, using number-up=1!", nup);
nup=1;
}
if ((val=cupsGetOption("number-up-layout",num_options,options)) != NULL) {
if (!parseNupLayout(val,param.nup)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported number-up-layout "
+ "cfFilterPDFToPDF: Unsupported number-up-layout "
"%s, using number-up-layout=lrtb!" ,val);
param.nup.first=Axis::X;
param.nup.xstart=Position::LEFT;
if ((val=cupsGetOption("page-border",num_options,options)) != NULL) {
if (!parseBorder(val,param.border)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported page-border value "
+ "cfFilterPDFToPDF: Unsupported page-border value "
"%s, using page-border=none!", val);
param.border=BorderType::NONE;
}
param.evenPages=false;
} else if (strcasecmp(val,"all")!=0) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported page-set value %s, "
+ "cfFilterPDFToPDF: Unsupported page-set value %s, "
"using page-set=all!", val);
}
}
param.booklet=BookletMode::BOOKLET_ON;
} else if (!is_false(val)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported booklet value %s, "
+ "cfFilterPDFToPDF: Unsupported booklet value %s, "
"using booklet=off!", val);
}
}
if (optGetInt("booklet-signature",num_options,options,¶m.bookSignature)) {
if (param.bookSignature==0) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported booklet-signature "
+ "cfFilterPDFToPDF: Unsupported booklet-signature "
"value, using booklet-signature=-1 "
"(all)!", val);
param.bookSignature=-1;
if ((val=cupsGetOption("position",num_options,options)) != NULL) {
if (!parsePosition(val,param.xpos,param.ypos)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unrecognized position value "
+ "cfFilterPDFToPDF: Unrecognized position value "
"%s, using position=center!", val);
param.xpos=Position::CENTER;
param.ypos=Position::CENTER;
if (strcasecmp(val,"auto") == 0) {
param.page_logging = -1;
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Automatic page logging "
+ "cfFilterPDFToPDF: Automatic page logging "
"selected by command line.");
} else if (is_true(val)) {
param.page_logging = 1;
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Forced page logging selected "
+ "cfFilterPDFToPDF: Forced page logging selected "
"by command line.");
} else if (is_false(val)) {
param.page_logging = 0;
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Suppressed page logging "
+ "cfFilterPDFToPDF: Suppressed page logging "
"selected by command line.");
} else {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unsupported page-logging "
+ "cfFilterPDFToPDF: Unsupported page-logging "
"value %s, using page-logging=auto!",val);
param.page_logging = -1;
}
param.page_logging = -1;
}
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: No PPD file specified, "
+ "cfFilterPDFToPDF: No PPD file specified, "
"determined whether to log pages or "
"not using final_content_type env variable.");
doc->logfunc(doc->logdata,FILTER_LOGLEVEL_DEBUG,"final_content_type = %s page_logging=%d",final_content_type?final_content_type:"NULL",param.page_logging);
// whether we have to log pages, so do not log.
param.page_logging = 0;
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: No FINAL_CONTENT_TYPE "
+ "cfFilterPDFToPDF: No FINAL_CONTENT_TYPE "
"environment variable, could not "
"determine whether to log pages or "
"not, so turned off page logging.");
// Proceed depending on number of cupsFilter(2) lines in PPD
} else if (ppd->num_filters == 0) {
// No filter line, manufacturer-supplied PostScript PPD
- // In this case pstops, called by pdftops, does the logging
+ // In this case cfFilterPSToPS, called by cfFilterPDFToPS, does the logging
param.page_logging = 0;
} else if (ppd->num_filters == 1) {
// One filter line, so this one filter is the last filter
!strcasecmp(lastfilter + strlen(lastfilter) - 5,
"topwg")) {
// On IPP Everywhere printers which accept PWG Raster data one
- // of gstoraster, pdftoraster, or mupdftopwg is the last
+ // of gstoraster, cfFilterPDFToRaster, or mupdftopwg is the last
// filter. These filters do not log pages so pdftopdf has to
// do it
param.page_logging = 1;
}
} else {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Last filter could not "
+ "cfFilterPDFToPDF: Last filter could not "
"get determined, page logging turned "
"off.");
param.page_logging = 0;
}
}
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Last filter determined by the "
+ "cfFilterPDFToPDF: Last filter determined by the "
"PPD: %s; FINAL_CONTENT_TYPE: "
"%s => pdftopdf will %slog pages in "
"page_log.",
}
// }}}
-void calculate(filter_data_t *data,ProcessingParameters ¶m,char *final_content_type) // {{{
+void calculate(cf_filter_data_t *data,ProcessingParameters ¶m,char *final_content_type) // {{{
{
ppd_file_t *ppd = data->ppd;
int num_options = 0;
int outfd=cupsTempFd(buf,sizeof(buf));
if (outfd<0) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Can't create temporary file");
+ "cfFilterPDFToPDF: Can't create temporary file");
return NULL;
}
// remove name
while ((n=read(infd,buf,BUFSIZ)) > 0) {
if (write(outfd,buf,n) != n) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Can't copy stdin to temporary "
+ "cfFilterPDFToPDF: Can't copy stdin to temporary "
"file");
close(outfd);
return NULL;
}
if (lseek(outfd,0,SEEK_SET) < 0) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Can't rewind temporary file");
+ "cfFilterPDFToPDF: Can't rewind temporary file");
close(outfd);
return NULL;
}
FILE *f;
if ((f=fdopen(outfd,"rb")) == 0) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Can't fdopen temporary file");
+ "cfFilterPDFToPDF: Can't fdopen temporary file");
close(outfd);
return NULL;
}
int /* O - Error status */
-pdftopdf(int inputfd, /* I - File descriptor input stream */
+cfFilterPDFToPDF(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters */
{
pdftopdf_doc_t doc; /* Document information */
char buf[BUFSIZ];
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
int num_options = 0;
cups_option_t *options = NULL;
strcasecmp(t, "no"))) {
streaming = 1;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Streaming mode: No PDF processing, only adding of JCL");
+ "cfFilterPDFToPDF: Streaming mode: No PDF processing, only adding of JCL");
}
std::unique_ptr<PDFTOPDF_Processor> proc(PDFTOPDF_Factory::processor());
if (is_empty(inputfp)) {
fclose(inputfp);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Input is empty, outputting empty file.");
+ "cfFilterPDFToPDF: Input is empty, outputting empty file.");
return 0;
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Processing PDF input with QPDF: Page-ranges, page-set, number-up, booklet, size adjustment, ...");
+ "cfFilterPDFToPDF: Processing PDF input with QPDF: Page-ranges, page-set, number-up, booklet, size adjustment, ...");
// Load the PDF input data into QPDF
if (!proc->loadFile(inputfp, &doc, WillStayAlive, 1)) {
} else {
// Pass through the input data
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Passing on unchanged PDF data from input");
+ "cfFilterPDFToPDF: Passing on unchanged PDF data from input");
while ((bytes = fread(buf, 1, sizeof(buf), inputfp)) > 0)
if (fwrite(buf, 1, bytes, outputfp) != bytes)
break;
} catch (std::exception &e) {
// TODO? exception type
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Exception: %s",e.what());
+ "cfFilterPDFToPDF: Exception: %s",e.what());
return 5;
} catch (...) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: Unknown exception caught. Exiting.");
+ "cfFilterPDFToPDF: Unknown exception caught. Exiting.");
return 6;
}
{
filter_logfunc_t logfunc; /* Log function */
void *logdata; /* Log data */
- filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
+ cf_filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
job is canceled, NULL for not
supporting stop on cancel */
void *iscanceleddata; /* User data for is-canceled function, can be
static const char *bstr[3]={"Off","On","Shuffle-Only"};
if ((bkm<BOOKLET_OFF) || (bkm>BOOKLET_JUSTSHUFFLE)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: bookletMode: (bad booklet mode: "
+ "cfFilterPDFToPDF: bookletMode: (bad booklet mode: "
"%d)", bkm);
} else {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: bookletMode: %s", bstr[bkm]);
+ "cfFilterPDFToPDF: bookletMode: %s", bstr[bkm]);
}
}
// }}}
void ProcessingParameters::dump(pdftopdf_doc_t *doc) const // {{{
{
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: jobId: %d, numCopies: %d",
+ "cfFilterPDFToPDF: jobId: %d, numCopies: %d",
jobId,numCopies);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: user: %s, title: %s",
+ "cfFilterPDFToPDF: user: %s, title: %s",
(user)?user:"(null)",(title)?title:"(null)");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: fitplot: %s",
+ "cfFilterPDFToPDF: fitplot: %s",
(fitplot)?"true":"false");
page.dump(doc);
Rotation_dump(orientation,doc);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: paper_is_landscape: %s",
+ "cfFilterPDFToPDF: paper_is_landscape: %s",
(paper_is_landscape)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: duplex: %s",
+ "cfFilterPDFToPDF: duplex: %s",
(duplex)?"true":"false");
BorderType_dump(border,doc);
nup.dump(doc);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: reverse: %s",
+ "cfFilterPDFToPDF: reverse: %s",
(reverse)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: evenPages: %s, oddPages: %s",
+ "cfFilterPDFToPDF: evenPages: %s, oddPages: %s",
(evenPages)?"true":"false",
(oddPages)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: input page range:");
+ "cfFilterPDFToPDF: input page range:");
inputPageRange.dump(doc);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: page range:");
+ "cfFilterPDFToPDF: page range:");
pageRange.dump(doc);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: mirror: %s",
+ "cfFilterPDFToPDF: mirror: %s",
(mirror)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Position:");
+ "cfFilterPDFToPDF: Position:");
Position_dump(xpos,Axis::X,doc);
Position_dump(ypos,Axis::Y,doc);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: collate: %s",
+ "cfFilterPDFToPDF: collate: %s",
(collate)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: evenDuplex: %s",
+ "cfFilterPDFToPDF: evenDuplex: %s",
(evenDuplex)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: pageLabel: %s",
+ "cfFilterPDFToPDF: pageLabel: %s",
pageLabel.empty () ? "(none)" :
pageLabel.c_str());
BookletMode_dump(booklet,doc);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: booklet signature: %d",
+ "cfFilterPDFToPDF: booklet signature: %d",
bookSignature);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: autoRotate: %s",
+ "cfFilterPDFToPDF: autoRotate: %s",
(autoRotate)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: emitJCL: %s",
+ "cfFilterPDFToPDF: emitJCL: %s",
(emitJCL)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: deviceCopies: %d",
+ "cfFilterPDFToPDF: deviceCopies: %d",
deviceCopies);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: deviceCollate: %s",
+ "cfFilterPDFToPDF: deviceCollate: %s",
(deviceCollate)?"true":"false");
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: setDuplex: %s",
+ "cfFilterPDFToPDF: setDuplex: %s",
(setDuplex)?"true":"false");
}
// }}}
{
if (!proc.check_print_permissions(doc)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Not allowed to print");
+ "cfFilterPDFToPDF: Not allowed to print");
return false;
}
const int numPages=std::max(shuffle.size(),input_page_range_list.size());
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: \"print-scaling\" IPP attribute: %s",
+ "cfFilterPDFToPDF: \"print-scaling\" IPP attribute: %s",
(param.autoprint ? "auto" :
(param.autofit ? "auto-fit" :
(param.fitplot ? "fit" :
{
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Page %d too large for output page size, scaling pages to fit.",
+ "cfFilterPDFToPDF: Page %d too large for output page size, scaling pages to fit.",
i + 1);
document_large = true;
}
}
if (param.fidelity && doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: \"ipp-attribute-fidelity\" IPP attribute is set, scaling pages to fit.");
+ "cfFilterPDFToPDF: \"ipp-attribute-fidelity\" IPP attribute is set, scaling pages to fit.");
if (param.autoprint)
{
}
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Print scaling mode: %s",
+ "cfFilterPDFToPDF: Print scaling mode: %s",
(param.fitplot ?
"Scale to fit printable area" :
(param.fillprint ?
static const char *pstr[3]={"Left/Bottom","Center","Right/Top"};
if ((pos < LEFT) || (pos > RIGHT)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: (bad position: %d)",pos);
+ "cfFilterPDFToPDF: (bad position: %d)",pos);
} else {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: %s",pstr[pos+1]);
+ "cfFilterPDFToPDF: %s",pstr[pos+1]);
}
}
// }}}
assert((axis == Axis::X) || (axis == Axis::Y));
if ((pos < LEFT) || (pos > RIGHT)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Position %s: (bad position: %d)",
+ "cfFilterPDFToPDF: Position %s: (bad position: %d)",
(axis == Axis::X) ? "X" : "Y", pos);
return;
}
if (axis==Axis::X) {
static const char *pxstr[3]={"Left","Center","Right"};
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Position X: %s", pxstr[pos+1]);
+ "cfFilterPDFToPDF: Position X: %s", pxstr[pos+1]);
} else {
static const char *pystr[3]={"Bottom","Center","Top"};
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Position Y: %s",pystr[pos+1]);
+ "cfFilterPDFToPDF: Position Y: %s",pystr[pos+1]);
}
}
// }}}
static const char *rstr[4]={"0 deg","90 deg","180 deg","270 deg"}; // CCW
if ((rot < ROT_0) || (rot > ROT_270)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Rotation(CCW): (bad rotation: %d)",rot);
+ "cfFilterPDFToPDF: Rotation(CCW): (bad rotation: %d)",rot);
} else {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Rotation(CCW): %s",rstr[rot]);
+ "cfFilterPDFToPDF: Rotation(CCW): %s",rstr[rot]);
}
}
// }}}
{
if ((border < NONE) || (border == 1) || (border > TWO_THICK)) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Border: (bad border: %d)",border);
+ "cfFilterPDFToPDF: Border: (bad border: %d)",border);
} else {
static const char *bstr[6]={"None",NULL,"one thin","one thick","two thin","two thick"};
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: Border: %s",bstr[border]);
+ "cfFilterPDFToPDF: Border: %s",bstr[border]);
}
}
// }}}
void PageRect::dump(pdftopdf_doc_t *doc) const // {{{
{
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: top: %f, left: %f, right: %f, bottom: %f, "
+ "cfFilterPDFToPDF: top: %f, left: %f, right: %f, bottom: %f, "
"width: %f, height: %f",
top,left,right,bottom,
width,height);
final_h = pageHeight;
}
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: After Cropping: %lf %lf %lf %lf",
+ "cfFilterPDFToPDF: After Cropping: %lf %lf %lf %lf",
width,height,final_w,final_h);
double posw = (width-final_w)/2,
posh = (height-final_h)/2;
pdf->processFile("temp file",f,false);
} catch (const std::exception &e) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: loadFile failed: %s", e.what());
+ "cfFilterPDFToPDF: loadFile failed: %s", e.what());
return false;
}
break;
pdf->processFile("temp file",f,true);
} catch (const std::exception &e) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: loadFile failed: %s", e.what());
+ "cfFilterPDFToPDF: loadFile failed: %s", e.what());
return false;
}
break;
case MustDuplicate:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: loadFile with MustDuplicate is not supported");
+ "cfFilterPDFToPDF: loadFile with MustDuplicate is not supported");
return false;
}
start(flatten_forms);
pdf->processFile(name);
} catch (const std::exception &e) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: loadFilename failed: %s",e.what());
+ "cfFilterPDFToPDF: loadFilename failed: %s",e.what());
return false;
}
start(flatten_forms);
{
if (!pdf) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: No PDF loaded");
+ "cfFilterPDFToPDF: No PDF loaded");
return false;
}
return pdf->allowPrintHighRes() || pdf->allowPrintLowRes(); // from legacy pdftopdf
std::vector<std::shared_ptr<PDFTOPDF_PageHandle>> ret;
if (!pdf) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: No PDF loaded");
+ "cfFilterPDFToPDF: No PDF loaded");
assert(0);
return ret;
}
{
if (!pdf) {
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: No PDF loaded");
+ "cfFilterPDFToPDF: No PDF loaded");
assert(0);
return std::shared_ptr<PDFTOPDF_PageHandle>();
}
break;
case MustDuplicate:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "pdftopdf: emitFile with MustDuplicate is not supported");
+ "cfFilterPDFToPDF: emitFile with MustDuplicate is not supported");
return;
}
if (hasCM) {
out.write();
else
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "pdftopdf: No pages left, outputting empty file.");
+ "cfFilterPDFToPDF: No pages left, outputting empty file.");
}
// }}}
* parsePDFTOPDFComment() - Check whether we are executed after pdftopdf
* remove_options() - Remove unwished entries from an option list
* log_command_line() - Log the command line of a program which we call
- * pdftops() - pdftops filter function
+ * cfFilterPDFToPS() - pdftops filter function
*/
/*
if ((fp = fopen(filename,"rb")) == NULL) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Cannot open input file \"%s\"",
+ "cfFilterPDFToPS: Cannot open input file \"%s\"",
filename);
return;
}
if (fp == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Cannot open input file \"%s\"",
+ "cfFilterPDFToPS: Cannot open input file \"%s\"",
filename);
return 1;
}
if (fread(buf, 1, 1, fp) == 0) {
fclose(fp);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Input is empty, outputting empty file.");
+ "cfFilterPDFToPS: Input is empty, outputting empty file.");
return 1;
}
fclose(fp);
int pages = pdf_pages(filename);
if (pages == 0) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: No pages left, outputting empty file.");
+ "cfFilterPDFToPS: No pages left, outputting empty file.");
return 1;
}
if (pages > 0)
return;
/* Debug output: Full command line of program to be called */
- snprintf(buf, sizeof(buf) - 1, "pdftops: Running command line for %s:",
+ snprintf(buf, sizeof(buf) - 1, "cfFilterPDFToPS: Running command line for %s:",
(file ? file : argv[0]));
if (file)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf) - 1,
/*
- * 'pdftops()' - Filter function to convert PDF input into
+ * 'cfFilterPDFToPS()' - Filter function to convert PDF input into
* PostScript to be printed on PostScript printers
*/
int /* O - Error status */
-pdftops(int inputfd, /* I - File descriptor input stream */
+cfFilterPDFToPS(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
renderer_t renderer = CUPS_PDFTOPS_RENDERER; /* Renderer: gs or pdftops
*pstops_options, /* Options for pstops filter function */
*option;
const char *exclude;
- filter_data_t pstops_filter_data;
+ cf_filter_data_t pstops_filter_data;
int ret;
const char *val; /* Option value */
ppd_file_t *ppd; /* PPD file */
printing */
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
ipp_t *printer_attrs = data->printer_attrs;
ipp_t *job_attrs = data->job_attrs;
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Unable to open input data stream.");
+ "cfFilterPDFToPS: Unable to open input data stream.");
}
return (1);
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to copy PDF file: %s", strerror(errno));
+ "cfFilterPDFToPS: Unable to copy PDF file: %s", strerror(errno));
return (1);
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Copying input to temp file \"%s\"",
+ "cfFilterPDFToPS: Copying input to temp file \"%s\"",
tempfile);
while ((bytes = fread(buffer, 1, sizeof(buffer), inputfp)) > 0)
make_model[strlen(make_model) - 1] = '\0';
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Printer make and model: %s", make_model);
+ "cfFilterPDFToPS: Printer make and model: %s", make_model);
/*
* Select the PDF renderer: Ghostscript (gs), Poppler (pdftops),
renderer = HYBRID;
else
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Invalid value for \"pdftops-renderer\": \"%s\"",
+ "cfFilterPDFToPS: Invalid value for \"pdftops-renderer\": \"%s\"",
val);
}
(ptr = strcasestr(make_model, "LaserWriter")))))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Switching to Poppler's pdftops instead of "
+ "cfFilterPDFToPS: Switching to Poppler's pdftops instead of "
"Ghostscript for Brother, Minolta, Konica Minolta, Dell, "
"and Apple LaserWriter printers to work around bugs in the "
"printer's PS interpreters");
if (!*ptr) /* End of string, no further word */
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Switching to Poppler's pdftops instead of "
+ "cfFilterPDFToPS: Switching to Poppler's pdftops instead of "
"Ghostscript for old HP LaserJet (\"LaserJet "
"<number>\", no letters before <number>, no "
"additional words after <number>) printers to "
}
/*
- * Build the command-line for the pdftops, gs, mutool, pdftocairo, or
+ * Build the command-line for the cfFilterPDFToPS, gs, mutool, pdftocairo, or
* acroread filter...
*/
else if (renderer == PDFTOCAIRO)
{
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Level 1 PostScript not supported by "
+ "cfFilterPDFToPS: Level 1 PostScript not supported by "
"pdftocairo.");
}
else if (renderer == ACROREAD)
{
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Level 1 PostScript not supported by acroread.");
+ "cfFilterPDFToPS: Level 1 PostScript not supported by acroread.");
}
else if (renderer == MUPDF)
{
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Level 1 PostScript not supported by mutool.");
+ "cfFilterPDFToPS: Level 1 PostScript not supported by mutool.");
}
}
else if (ppd->language_level == 2)
else if (renderer == MUPDF)
{
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Level 3 PostScript not supported by mutool.");
+ "cfFilterPDFToPS: Level 3 PostScript not supported by mutool.");
}
else /* PDFTOCAIRO || ACROREAD */
pdf_argv[pdf_argc++] = (char *)"-level3";
if ((xres == 0) && (yres == 0) &&
((numvalues = sscanf(resolution, "%dx%d", &xres, &yres)) <= 0))
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: No resolution information found in the PPD file.");
+ "cfFilterPDFToPS: No resolution information found in the PPD file.");
}
else{
cupsRasterParseIPPOptions(&header, data, 0, 1);
strcasecmp(ptr, "dpcm")))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Bad resolution value \"%s\".", val);
+ "cfFilterPDFToPS: Bad resolution value \"%s\".", val);
}
else
{
maxres = mres;
else
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Invalid value for "
+ "cfFilterPDFToPS: Invalid value for "
"\"pdftops-max-image-resolution\": \"%s\"",
val);
}
snprintf(resolution, sizeof(resolution), "%d", res);
pdf_argv[pdf_argc++] = resolution;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Using image rendering resolution %d dpi", res);
+ "cfFilterPDFToPS: Using image rendering resolution %d dpi", res);
#endif /* HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION */
if (gray_output == 1) /* Checking for monochrome/grayscale PostScript
output */
pdf_argv[pdf_argc++] = (char *)"-optimizecolorspace"; */
/* Issue a warning message when printing a grayscale job with Poppler */
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Grayscale/monochrome printing requested for this "
+ "cfFilterPDFToPS: Grayscale/monochrome printing requested for this "
"job but Poppler is not able to convert to "
"grayscale/monochrome PostScript.");
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pdftops: Use \"pdftops-renderer\" option (see "
+ "cfFilterPDFToPS: Use \"pdftops-renderer\" option (see "
"cups-filters README file) to use Ghostscript or MuPDF for "
"the PDF -> PostScript conversion.");
}
snprintf(resolution, 127, "-r%d", res);
pdf_argv[pdf_argc++] = resolution;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Using image rendering resolution %d dpi", res);
+ "cfFilterPDFToPS: Using image rendering resolution %d dpi", res);
/*
* PostScript debug mode: If you send a job with "lpr -o psdebug" Ghostscript
* will not compress the pages, so that the PostScript code can get
!strncasecmp(make_model, "Utax", 4))))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Deactivated compression of pages in "
+ "cfFilterPDFToPS: Deactivated compression of pages in "
"Ghostscript's PostScript output (\"psdebug\" debug mode "
"or Kyocera/Utax printer)");
pdf_argv[pdf_argc++] = (char *)"-dCompressPages=false";
!strncasecmp(make_model, "Brother", 7))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Deactivation of Ghostscript's image compression "
+ "cfFilterPDFToPS: Deactivation of Ghostscript's image compression "
"for Brother printers to workarounmd PS interpreter bug");
pdf_argv[pdf_argc++] = (char *)"-dEncodeMonoImages=false";
pdf_argv[pdf_argc++] = (char *)"-dEncodeColorImages=false";
!strncasecmp(make_model, "Toshiba", 7))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: To work around a bug in Toshiba's PS "
+ "cfFilterPDFToPS: To work around a bug in Toshiba's PS "
"interpreters turn TTF font glyphs into bitmaps, usually "
"Type 3 PS fonts, or images for large characters");
pdf_argv[pdf_argc++] = (char *)"-dHaveTrueTypes=false";
if (pipe(pstops_pipe))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to create pipe for pstops: %s",
+ "cfFilterPDFToPS: Unable to create pipe for cfFilterPSToPS: %s",
strerror(errno));
exit_status = 1;
if (pipe(post_proc_pipe))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to create pipe for post-processing: %s",
+ "cfFilterPDFToPS: Unable to create pipe for post-processing: %s",
strerror(errno));
exit_status = 1;
{
execvp(CUPS_POPPLER_PDFTOPS, pdf_argv);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute pdftops program: %s",
+ "cfFilterPDFToPS: Unable to execute pdftops program: %s",
strerror(errno));
}
else if (renderer == GS)
{
execvp(CUPS_GHOSTSCRIPT, pdf_argv);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute gs program: %s",
+ "cfFilterPDFToPS: Unable to execute gs program: %s",
strerror(errno));
}
else if (renderer == PDFTOCAIRO)
{
execvp(CUPS_POPPLER_PDFTOCAIRO, pdf_argv);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute pdftocairo program: %s",
+ "cfFilterPDFToPS: Unable to execute pdftocairo program: %s",
strerror(errno));
}
else if (renderer == ACROREAD)
execvp(CUPS_ACROREAD, pdf_argv);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute acroread program: %s",
+ "cfFilterPDFToPS: Unable to execute acroread program: %s",
strerror(errno));
}
else if (renderer == MUPDF)
{
execvp(CUPS_MUTOOL, pdf_argv);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute mutool program: %s",
+ "cfFilterPDFToPS: Unable to execute mutool program: %s",
strerror(errno));
}
{
if (renderer == PDFTOPS)
log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute pdftops program: %s",
+ "cfFilterPDFToPS: Unable to execute pdftops program: %s",
strerror(errno));
else if (renderer == GS)
log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute gs program: %s",
+ "cfFilterPDFToPS: Unable to execute gs program: %s",
strerror(errno));
else if (renderer == PDFTOCAIRO)
log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute pdftocairo program: %s",
+ "cfFilterPDFToPS: Unable to execute pdftocairo program: %s",
strerror(errno));
else if (renderer == ACROREAD)
log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute acroread program: %s",
+ "cfFilterPDFToPS: Unable to execute acroread program: %s",
strerror(errno));
else if (renderer == MUPDF)
log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute mutool program: %s",
+ "cfFilterPDFToPS: Unable to execute mutool program: %s",
strerror(errno));
}
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Started filter %s (PID %d)", pdf_argv[0], pdf_pid);
+ "cfFilterPDFToPS: Started filter %s (PID %d)", pdf_argv[0], pdf_pid);
if (need_post_proc)
{
{
/* No Prolog section, create one */
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Adding Prolog section for workaround "
+ "cfFilterPDFToPS: Adding Prolog section for workaround "
"PostScript code");
puts("%%BeginProlog");
}
!strncasecmp(make_model, "Utax", 4))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Inserted workaround PostScript code for "
+ "cfFilterPDFToPS: Inserted workaround PostScript code for "
"Kyocera and Utax printers");
puts("% ===== Workaround insertion by pdftops CUPS filter =====");
puts("% Kyocera's/Utax's PostScript interpreter crashes on "
else if (!strncasecmp(make_model, "Brother", 7))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Inserted workaround PostScript code for "
+ "cfFilterPDFToPS: Inserted workaround PostScript code for "
"Brother printers");
puts("% ===== Workaround insertion by pdftops CUPS filter =====");
puts("% Brother's PostScript interpreter spits out the current "
{
/* No Setup section, create one */
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Adding Setup section for option "
+ "cfFilterPDFToPS: Adding Setup section for option "
"PostScript code");
puts("%%BeginSetup");
}
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute post-processing process: %s",
+ "cfFilterPDFToPS: Unable to execute post-processing process: %s",
strerror(errno));
exit_status = 1;
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Started post-processing (PID %d)", post_proc_pid);
+ "cfFilterPDFToPS: Started post-processing (PID %d)", post_proc_pid);
}
if (ppd)
close(post_proc_pipe[1]);
}
- ret = pstops(pstops_pipe[0], outputfd, 0, &pstops_filter_data, NULL);
+ ret = cfFilterPSToPS(pstops_pipe[0], outputfd, 0, &pstops_filter_data, NULL);
close(pstops_pipe[0]);
if (ret && log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: pstops filter function failed.");
+ "cfFilterPDFToPS: pstops filter function failed.");
close(outputfd);
exit(ret);
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: Unable to execute pstops program: %s",
+ "cfFilterPDFToPS: Unable to execute pstops program: %s",
strerror(errno));
exit_status = 1;
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Started filter pstops (PID %d)", pstops_pid);
+ "cfFilterPDFToPS: Started filter pstops (PID %d)", pstops_pid);
close(pstops_pipe[0]);
close(pstops_pipe[1]);
exit_status = WEXITSTATUS(wait_status);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: PID %d (%s) stopped with status %d!",
+ "cfFilterPDFToPS: PID %d (%s) stopped with status %d!",
wait_pid,
wait_pid == pdf_pid ?
(renderer == PDFTOPS ? "pdftops" :
else if (WTERMSIG(wait_status) == SIGTERM)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: PID %d (%s) was terminated normally with "
+ "cfFilterPDFToPS: PID %d (%s) was terminated normally with "
"signal %d!",
wait_pid,
wait_pid == pdf_pid ?
exit_status = WTERMSIG(wait_status);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftops: PID %d (%s) crashed on signal %d!",
+ "cfFilterPDFToPS: PID %d (%s) crashed on signal %d!",
wait_pid,
wait_pid == pdf_pid ?
(renderer == PDFTOPS ? "pdftops" :
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: PID %d (%s) exited with no errors.",
+ "cfFilterPDFToPS: PID %d (%s) exited with no errors.",
wait_pid,
wait_pid == pdf_pid ?
(renderer == PDFTOPS ? "pdftops" :
error:
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftops: Closing files ...");
+ "cfFilterPDFToPS: Closing files ...");
close(outputfd);
}
}
-static int parseOpts(filter_data_t *data,
+static int parseOpts(cf_filter_data_t *data,
void *parameters,
pdftoraster_doc_t *doc)
{
#ifdef HAVE_CUPS_1_7
- filter_out_format_t outformat;
+ cf_filter_out_format_t outformat;
#endif /* HAVE_CUPS_1_7 */
int num_options = 0;
cups_option_t *options = NULL;
ipp_t *printer_attrs = data->printer_attrs;
cups_cspace_t cspace = (cups_cspace_t)(-1);
- /* Note: With the OUTPUT_FORMAT_APPLE_RASTER or OUTPUT_FORMAT_PCLM
+ /* Note: With the CF_FILTER_OUT_FORMAT_APPLE_RASTER or CF_FILTER_OUT_FORMAT_PCLM
selections the output is actually CUPS Raster but information
about available color spaces and depths is taken from the
urf-supported printer IPP attribute or the appropriate PPD file
this filter. */
if (parameters) {
- outformat = *(filter_out_format_t *)parameters;
- if (outformat != OUTPUT_FORMAT_CUPS_RASTER &&
- outformat != OUTPUT_FORMAT_PWG_RASTER &&
- outformat != OUTPUT_FORMAT_APPLE_RASTER &&
- outformat != OUTPUT_FORMAT_PCLM)
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = *(cf_filter_out_format_t *)parameters;
+ if (outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PWG_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PCLM)
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
} else
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftoraster: Output format: %s",
- (outformat == OUTPUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
+ "cfFilterPDFToRaster: Output format: %s",
+ (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
"PWG Raster"));
- if (outformat == OUTPUT_FORMAT_PWG_RASTER)
+ if (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER)
doc->pwgraster = 1;
num_options = joinJobOptionsAndAttrs(data, num_options, &options);
handleRqeuiresPageRegion(doc);
} else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftoraster: PPD file is not specified.");
+ "cfFilterPDFToRaster: PPD file is not specified.");
cupsRasterPrepareHeader(&(doc->header), data, outformat,
- (outformat == OUTPUT_FORMAT_PWG_RASTER ?
- outformat : OUTPUT_FORMAT_CUPS_RASTER), 0,
+ (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ?
+ outformat : CF_FILTER_OUT_FORMAT_CUPS_RASTER), 0,
&cspace);
if (doc->ppd) {
&& !strncasecmp(val, "bi-level", 8))
doc->bi_level = 1;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftoraster: Page size requested: %s", doc->header.cupsPageSizeName);
+ "cfFilterPDFToRaster: Page size requested: %s", doc->header.cupsPageSizeName);
if (num_options)
cupsFreeOptions(num_options, options);
BYTES_SH(bytes),
doc->colour_profile.renderingIntent,0)) == 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Can't create color transform.");
+ "cfFilterPDFToRaster: Can't create color transform.");
return (1);
}
} else {
break;
default:
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Specified ColorSpace is not supported");
+ "cfFilterPDFToRaster: Specified ColorSpace is not supported");
return (1);
}
}
}
static void writePageImage(cups_raster_t *raster, pdftoraster_doc_t *doc,
- int pageNo, conversion_function_t* convert, filter_iscanceledfunc_t iscanceled, void *icd)
+ int pageNo, conversion_function_t* convert, cf_filter_iscanceledfunc_t iscanceled, void *icd)
{
ConvertLineFunc convertLine;
unsigned char *lineBuf = NULL;
if (doc->allocLineBuf) delete[] lineBuf;
}
-static int outPage(pdftoraster_doc_t *doc, int pageNo, filter_data_t *data,
- cups_raster_t *raster, conversion_function_t *convert, filter_logfunc_t log, void* ld, filter_iscanceledfunc_t iscanceled, void *icd)
+static int outPage(pdftoraster_doc_t *doc, int pageNo, cf_filter_data_t *data,
+ cups_raster_t *raster, conversion_function_t *convert, filter_logfunc_t log, void* ld, cf_filter_iscanceledfunc_t iscanceled, void *icd)
{
int rotate = 0;
double paperdimensions[2], /* Physical size of the paper */
default:rotate=0;
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftoraster: mediabox = [ %f %f %f %f ]; rotate = %d",
+ "cfFilterPDFToRaster: mediabox = [ %f %f %f %f ]; rotate = %d",
mediaBox.left(), mediaBox.top(), mediaBox.right(),
mediaBox.bottom(), rotate);
l = mediaBox.width();
}
if (!cupsRasterWriteHeader2(raster,&(doc->header))) {
if (log) log(ld,FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Cannot write page %d header", pageNo);
+ "cfFilterPDFToRaster: Cannot write page %d header", pageNo);
return (1);
}
break;
default:
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Specified ColorSpace is not supported");
+ "cfFilterPDFToRaster: Specified ColorSpace is not supported");
return (1);
break;
}
return (0);
}
-int pdftoraster(int inputfd, /* I - File descriptor input stream */
+int cfFilterPDFToRaster(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused)*/
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters */
{
pdftoraster_doc_t doc;
int deviceCopies = 1;
bool deviceCollate = false;
conversion_function_t convert;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
int ret = 0;
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Unable to open input data stream.");
+ "cfFilterPDFToRaster: Unable to open input data stream.");
}
return (1);
fd = cupsTempFd(name,sizeof(name));
if (fd < 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Can't create temporary file.");
+ "cfFilterPDFToRaster: Can't create temporary file.");
return (1);
}
while ((n = read(inputfd, buf, BUFSIZ)) > 0) {
if (write(fd, buf, n) != n) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Can't copy input data to temporary file.");
+ "cfFilterPDFToRaster: Can't copy input data to temporary file.");
close(fd);
unlink(name);
return (1);
FILE *fp;
if ((fp = fdopen(inputfd,"rb")) == 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Can't open input file.");
+ "cfFilterPDFToRaster: Can't open input file.");
ret = 1;
goto out;
}
&& doc.header.cupsBitsPerColor != 8
&& doc.header.cupsBitsPerColor != 16) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Specified color format is not supported.");
+ "cfFilterPDFToRaster: Specified color format is not supported.");
ret = 1;
goto out;
}
|| (doc.header.cupsBitsPerColor != 8
&& doc.header.cupsBitsPerColor != 16)) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Specified color format is not supported.");
+ "cfFilterPDFToRaster: Specified color format is not supported.");
ret = 1;
goto out;
}
break;
default:
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Specified ColorSpace is not supported.");
+ "cfFilterPDFToRaster: Specified ColorSpace is not supported.");
ret = 1;
goto out;
}
if (!(doc.colour_profile.cm_disabled)) {
if (setPopplerColorProfile(&doc, log, ld) != 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Cannot set color profile.");
+ "cfFilterPDFToRaster: Cannot set color profile.");
ret = 1;
goto out;
}
if ((raster = cupsRasterOpen(outputfd, doc.pwgraster ? CUPS_RASTER_WRITE_PWG :
CUPS_RASTER_WRITE)) == 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Cannot open raster stream.");
+ "cfFilterPDFToRaster: Cannot open raster stream.");
ret = 1;
goto out;
}
if (selectConvertFunc(raster, &doc, &convert, log, ld) == 1)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pdftoraster: Unable to select color conversion function.");
+ "cfFilterPDFToRaster: Unable to select color conversion function.");
ret = 1;
goto out;
}
if (outPage(&doc,i,data,raster, &convert, log, ld, iscanceled, icd) == 1)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftoraster: Unable to output page %d.", i);
+ "cfFilterPDFToRaster: Unable to output page %d.", i);
ret = 1;
goto out;
}
}
} else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pdftoraster: Input is empty outputting empty file.");
+ "cfFilterPDFToRaster: Input is empty outputting empty file.");
out:
if (raster)
logging */
void *logdata; /* User data for logging function, can
be NULL */
- filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
+ cf_filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
job is canceled, NULL for not
supporting stop on cancel */
void *iscanceleddata; /* User data for is-canceled function,
cups_option_t *options,
filter_logfunc_t logfunc,
void *logdata,
- filter_iscanceledfunc_t
+ cf_filter_iscanceledfunc_t
iscanceledfunc,
void *iscanceleddata);
static ssize_t skip_page(pstops_doc_t *doc,
const char *name, const char *value);
/*
- * 'pstops()' - Filter function to insert PostScript code from
+ * 'cfFilterPSToPS()' - Filter function to insert PostScript code from
* PPD file (PostScript printer driver) into a
* PostScript data stream
*/
int /* O - Error status */
-pstops(int inputfd, /* I - File descriptor input stream */
+cfFilterPSToPS(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
pstops_doc_t doc; /* Document information */
pstops_page_t *pageinfo;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
int proc_pipe[2];
int pstops_pid = 0;
if(pipe(proc_pipe))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Unable to create pipe for input-page-ranges");
+ "cfFilterPSToPS: Unable to create pipe for input-page-ranges");
return (1);
}
if ((pstops_pid = fork()) == 0)
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Unable to open input data stream.");
+ "cfFilterPSToPS: Unable to open input data stream.");
}
exit (1);
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Unable to open input data stream.");
+ "cfFilterPSToPS: Unable to open input data stream.");
}
return (1);
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Unable to open output data stream.");
+ "cfFilterPSToPS: Unable to open output data stream.");
}
cupsFileClose(inputfp);
if ((len = (ssize_t)cupsFileGetLine(inputfp, line, sizeof(line))) == 0)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: The print file is empty.");
+ "cfFilterPSToPS: The print file is empty.");
/* Do not treat this an error, if a previous filter eliminated all
pages the job should get dequeued without anything printed. */
return (0);
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Skipping PJL header...");
+ "cfFilterPSToPS: Skipping PJL header...");
while (strstr(line, "ENTER LANGUAGE") == NULL && strncmp(line, "%!", 2))
if ((len = (ssize_t)cupsFileGetLine(inputfp, line, sizeof(line))) == 0)
if (errno == EINTR)
goto retry_wait;
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Error while waiting for input_page_ranges to finish - %s.",
+ "cfFilterPSToPS: Error while waiting for input_page_ranges to finish - %s.",
strerror(errno));
}
/* How did the sub-process terminate */
if (WIFEXITED(childStatus)) {
/* Via exit() anywhere or return() in the main() function */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: input-page-ranges filter (PID %d) stopped with status %d",
+ "cfFilterPSToPS: input-page-ranges filter (PID %d) stopped with status %d",
pstops_pid, WEXITSTATUS(childStatus));
} else {
/* Via signal */
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: imput-page-ranges filter (PID %d) crashed on signal %d",
+ "cfFilterPSToPS: imput-page-ranges filter (PID %d) crashed on signal %d",
pstops_pid, WTERMSIG(childStatus));
}
status=1;
} else {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: input-page-ranges-filter (PID %d) exited with no errors.",
+ "cfFilterPSToPS: input-page-ranges-filter (PID %d) exited with no errors.",
pstops_pid);
}
}
if (!doc->pages)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Unable to allocate memory for pages array");
+ "cfFilterPSToPS: Unable to allocate memory for pages array");
return (NULL);
}
if ((pageinfo = calloc(1, sizeof(pstops_page_t))) == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Unable to allocate memory for page info");
+ "cfFilterPSToPS: Unable to allocate memory for page info");
return (NULL);
}
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: %s", line);
+ "cfFilterPSToPS: %s", line);
/*
* Pull the headers out...
if (saw_pages && log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: A duplicate %%Pages: comment was seen.");
+ "cfFilterPSToPS: A duplicate %%Pages: comment was seen.");
saw_pages = 1;
if (saw_bounding_box)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: A duplicate %%BoundingBox: comment was seen.");
+ "cfFilterPSToPS: A duplicate %%BoundingBox: comment was seen.");
}
else if (strstr(line + 14, "(atend)"))
{
doc->bounding_box + 3) != 4)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: A bad %%BoundingBox: comment was seen.");
+ "cfFilterPSToPS: A bad %%BoundingBox: comment was seen.");
doc->bounding_box[0] = (int)(doc->PageLeft);
doc->bounding_box[1] = (int)(doc->PageBottom);
*/
doc->Orientation = (4 - doc->Orientation + orient) & 3;
- filterUpdatePageVars(doc->Orientation,
+ cfFilterUpdatePageVars(doc->Orientation,
&doc->PageLeft, &doc->PageRight,
&doc->PageTop, &doc->PageBottom,
&doc->PageWidth, &doc->PageLength);
if (!saw_bounding_box && log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: There wasn't a %%BoundingBox: comment in the header.");
+ "cfFilterPSToPS: There wasn't a %%BoundingBox: comment in the header.");
if (!saw_pages && log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: There wasn't a %%Pages: comment in the header.");
+ "cfFilterPSToPS: There wasn't a %%Pages: comment in the header.");
if (!saw_for)
write_text_comment(doc, "For", doc->user);
pstops_page_t *pageinfo; /* Page information */
filter_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
- filter_iscanceledfunc_t iscanceled = doc->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = doc->iscanceledfunc;
void *icd = doc->iscanceleddata;
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Before copy_comments - %s", line);
+ "cfFilterPSToPS: Before copy_comments - %s", line);
linelen = copy_comments(doc, ppd, line, linelen, linesize);
/*
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Before copy_prolog - %s", line);
+ "cfFilterPSToPS: Before copy_prolog - %s", line);
linelen = copy_prolog(doc, ppd, line, linelen, linesize);
/*
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Before copy_setup - %s", line);
+ "cfFilterPSToPS: Before copy_setup - %s", line);
linelen = copy_setup(doc, ppd, line, linelen, linesize);
/*
number = 0;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Before page loop - %s", line);
+ "cfFilterPSToPS: Before page loop - %s", line);
while (!strncmp(line, "%%Page:", 7))
{
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Job canceled");
+ "cfFilterPSToPS: Job canceled");
break;
}
if (check_range((number - 1) / doc->number_up + 1,doc->page_ranges,doc->page_set))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Copying page %d...", number);
+ "cfFilterPSToPS: Copying page %d...", number);
linelen = copy_page(doc, ppd, number, line, linelen, linesize);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Skipping page %d...", number);
+ "cfFilterPSToPS: Skipping page %d...", number);
linelen = skip_page(doc, line, linelen, linesize);
}
}
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Job canceled");
+ "cfFilterPSToPS: Job canceled");
break;
}
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Job canceled");
+ "cfFilterPSToPS: Job canceled");
break;
}
ssize_t bytes; /* Number of bytes copied */
filter_logfunc_t log = doc->logfunc;
void *ld = doc->logdata;
- filter_iscanceledfunc_t iscanceled = doc->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = doc->iscanceledfunc;
void *icd = doc->iscanceleddata;
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: This document does not conform to the Adobe Document "
+ "cfFilterPSToPS: This document does not conform to the Adobe Document "
"Structuring Conventions and may not print correctly.");
/*
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Job canceled");
+ "cfFilterPSToPS: Job canceled");
break;
}
if (!parse_text(line + 7, &ptr, label, sizeof(label)))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: There was a bad %%Page: comment in the file.");
+ "cfFilterPSToPS: There was a bad %%Page: comment in the file.");
label[0] = '\0';
number = doc->page;
}
else if (strtol(ptr, &ptr, 10) == LONG_MAX || !isspace(*ptr & 255))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: There was a bad %%Page: comment in the file.");
+ "cfFilterPSToPS: There was a bad %%Page: comment in the file.");
number = doc->page;
}
{
if (log)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: There was a bad %%PageBoundingBox: comment in the "
+ "cfFilterPSToPS: There was a bad %%PageBoundingBox: comment in the "
"file.");
memcpy(bounding_box, doc->bounding_box,
sizeof(bounding_box));
if (log)
{
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Orientation = %d", doc->Orientation);
+ "cfFilterPSToPS: Orientation = %d", doc->Orientation);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: original bounding_box = [ %d %d %d %d ]",
+ "cfFilterPSToPS: original bounding_box = [ %d %d %d %d ]",
bounding_box[0], bounding_box[1],
bounding_box[2], bounding_box[3]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: PageWidth = %.1f, PageLength = %.1f",
+ "cfFilterPSToPS: PageWidth = %.1f, PageLength = %.1f",
doc->PageWidth, doc->PageLength);
}
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: updated bounding_box = [ %d %d %d %d ]",
+ "cfFilterPSToPS: updated bounding_box = [ %d %d %d %d ]",
bounding_box[0], bounding_box[1],
bounding_box[2], bounding_box[3]);
}
line[0] = '\0';
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Early end-of-file while reading binary data: %s",
+ "cfFilterPSToPS: Early end-of-file while reading binary data: %s",
strerror(errno));
return (0);
}
linelen = (ssize_t)cupsFileGetLine(doc->inputfp, line, linesize);
else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: The %%EndProlog comment is missing.");
+ "cfFilterPSToPS: The %%EndProlog comment is missing.");
}
doc_puts(doc, "%%EndProlog\n");
linelen = (ssize_t)cupsFileGetLine(doc->inputfp, line, linesize);
else
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: The %%EndSetup comment is missing.");
+ "cfFilterPSToPS: The %%EndSetup comment is missing.");
}
if (num_options > 0)
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: Wrote %d pages...", number);
+ "cfFilterPSToPS: Wrote %d pages...", number);
fprintf(doc->outputfp, "%%%%Pages: %d\n", number);
if (doc->number_up > 1 || doc->fit_to_page)
if ((size_t)bytes > sizeof(buffer))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Buffer overflow detected, truncating.");
+ "cfFilterPSToPS: Buffer overflow detected, truncating.");
bytes = sizeof(buffer);
}
if (sscanf(line + 17, "%254s%254s", name, value) != 2)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: The %%IncludeFeature: comment is not valid.");
+ "cfFilterPSToPS: The %%IncludeFeature: comment is not valid.");
return (num_options);
}
if ((option = ppdFindOption(ppd, name + 1)) == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pstops: Unknown option \"%s\".", name + 1);
+ "cfFilterPSToPS: Unknown option \"%s\".", name + 1);
return (num_options);
}
option->section == PPD_ORDER_JCL)
{
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pstops: Option \"%s\" cannot be included via "
+ "cfFilterPSToPS: Option \"%s\" cannot be included via "
"%%%%IncludeFeature.", name + 1);
return (num_options);
}
if (!ppdFindChoice(option, value))
{
if (log) log(ld, FILTER_LOGLEVEL_WARN,
- "pstops: Unknown choice \"%s\" for option \"%s\".",
+ "cfFilterPSToPS: Unknown choice \"%s\" for option \"%s\".",
value, name + 1);
return (num_options);
}
NULL for no logging */
void *logdata, /* I - User data for logging function,
can be NULL */
- filter_iscanceledfunc_t iscanceledfunc, /* I - Function returning 1 when
+ cf_filter_iscanceledfunc_t iscanceledfunc, /* I - Function returning 1 when
job is canceled, NULL for not
supporting stop on cancel */
void *iscanceleddata) /* I - User data for is-canceled
int max_copies; /* Maximum number of copies supported */
filter_logfunc_t log = logfunc;
void *ld = logdata;
- filter_iscanceledfunc_t iscanceled = iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = iscanceledfunc;
void *icd = iscanceleddata;
doc->iscanceleddata = icd;
/* Set some common values */
- filterSetCommonOptions(ppd, num_options, options, 1,
+ cfFilterSetCommonOptions(ppd, num_options, options, 1,
&doc->Orientation, &doc->Duplex,
&doc->LanguageLevel, &doc->ColorDevice,
&doc->PageLeft, &doc->PageRight,
break;
default :
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Unsupported number-up value %d, using "
+ "cfFilterPSToPS: Unsupported number-up value %d, using "
"number-up=1.", intval);
doc->number_up = 1;
break;
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Unsupported number-up-layout value %s, using "
+ "cfFilterPSToPS: Unsupported number-up-layout value %s, using "
"number-up-layout=lrtb.", val);
doc->number_up_layout = PSTOPS_LAYOUT_LRTB;
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Unsupported page-border value %s, using "
+ "cfFilterPSToPS: Unsupported page-border value %s, using "
"page-border=none.", val);
doc->page_border = PSTOPS_BORDERNONE;
}
sizeof(doc->tempfile))) == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Unable to create temporary file: %s",
+ "cfFilterPSToPS: Unable to create temporary file: %s",
strerror(errno));
return (1);
}
}
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: slow_collate=%d, slow_duplex=%d, slow_order=%d",
+ "cfFilterPSToPS: slow_collate=%d, slow_duplex=%d, slow_order=%d",
doc->slow_collate, doc->slow_duplex, doc->slow_order);
return(0);
line[0] = '\0';
if (log)
log(ld, FILTER_LOGLEVEL_ERROR,
- "pstops: Early end-of-file while reading binary data: %s",
+ "cfFilterPSToPS: Early end-of-file while reading binary data: %s",
strerror(errno));
return (0);
}
if (log)
{
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: pagew = %.1f, pagel = %.1f", pagew, pagel);
+ "cfFilterPSToPS: pagew = %.1f, pagel = %.1f", pagew, pagel);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: bboxx = %d, bboxy = %d, bboxw = %d, bboxl = %d",
+ "cfFilterPSToPS: bboxx = %d, bboxy = %d, bboxw = %d, bboxl = %d",
bboxx, bboxy, bboxw, bboxl);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: PageLeft = %.1f, PageRight = %.1f",
+ "cfFilterPSToPS: PageLeft = %.1f, PageRight = %.1f",
doc->PageLeft, doc->PageRight);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: PageTop = %.1f, PageBottom = %.1f",
+ "cfFilterPSToPS: PageTop = %.1f, PageBottom = %.1f",
doc->PageTop, doc->PageBottom);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pstops: PageWidth = %.1f, PageLength = %.1f",
+ "cfFilterPSToPS: PageWidth = %.1f, PageLength = %.1f",
doc->PageWidth, doc->PageLength);
}
}
}
-static int parseOpts(filter_data_t *data,
- filter_out_format_t outformat,
+static int parseOpts(cf_filter_data_t *data,
+ cf_filter_out_format_t outformat,
pwgtoraster_doc_t *doc)
{
int num_options = 0;
cupsGetOption("media-col", num_options, options));
// We can directly create CUPS Raster, PWG Raster, and Apple Raster but
- // for PCLm we have to output CUPS Raster and feed it into rastertopdf()
+ // for PCLm we have to output CUPS Raster and feed it into cfFilterRasterToPDF()
cupsRasterPrepareHeader(&(doc->outheader), data, outformat,
- outformat == OUTPUT_FORMAT_PCLM ?
- OUTPUT_FORMAT_CUPS_RASTER : outformat, 0, &cspace);
+ outformat == CF_FILTER_OUT_FORMAT_PCLM ?
+ CF_FILTER_OUT_FORMAT_CUPS_RASTER : outformat, 0, &cspace);
if (doc->ppd) {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Using PPD file: %s", doc->ppd->nickname);
+ "cfFilterPWGToRaster: Using PPD file: %s", doc->ppd->nickname);
ppdMarkOptions(doc->ppd,num_options,options);
handleRequiresPageRegion(doc);
attr = ppdFindAttr(doc->ppd,"pwgtorasterRenderingIntent",NULL);
}
} else {
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: No PPD file is specified.");
+ "cfFilterPWGToRaster: No PPD file is specified.");
if (strcasecmp(doc->outheader.cupsRenderingIntent, "Perceptual") == 0) {
doc->color_profile.renderingIntent = INTENT_PERCEPTUAL;
} else if (strcasecmp(doc->outheader.cupsRenderingIntent, "Relative") == 0) {
doc->bi_level = 1;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Page size %s: %s",
+ "cfFilterPWGToRaster: Page size %s: %s",
doc->page_size_requested ? "requested" : "default",
doc->outheader.cupsPageSizeName);
BYTES_SH(bytes),
doc->color_profile.renderingIntent,0)) == 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Can't create color transform.");
+ "cfFilterPWGToRaster: Can't create color transform.");
return (1);
}
} else {
break;
default:
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Specified ColorSpace is not supported");
+ "cfFilterPWGToRaster: Specified ColorSpace is not supported");
return (1);
break;
}
conversion_function_t *convert,
filter_logfunc_t log,
void *ld,
- filter_iscanceledfunc_t iscanceled,
+ cf_filter_iscanceledfunc_t iscanceled,
void *icd)
{
int i, j;
{
// Canceled
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Job canceled on input page %d", pageNo);
+ "cfFilterPWGToRaster: Job canceled on input page %d", pageNo);
return (false);
}
{
// Done
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Job completed");
+ "cfFilterPWGToRaster: Job completed");
return (false);
}
// filter function) these values are all zero. With at least one not
// zero we consider the input not supported.
log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Input page %d is not PWG or Apple Raster", pageNo);
+ "cfFilterPWGToRaster: Input page %d is not PWG or Apple Raster", pageNo);
return (false);
}
if (log) {
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Input page %d", pageNo);
+ "cfFilterPWGToRaster: Input page %d", pageNo);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: HWResolution = [ %d %d ]",
+ "cfFilterPWGToRaster: HWResolution = [ %d %d ]",
doc->inheader.HWResolution[0], doc->inheader.HWResolution[1]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: PageSize = [ %d %d ]",
+ "cfFilterPWGToRaster: PageSize = [ %d %d ]",
doc->inheader.PageSize[0], doc->inheader.PageSize[1]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsWidth = %d", doc->inheader.cupsWidth);
+ "cfFilterPWGToRaster: cupsWidth = %d", doc->inheader.cupsWidth);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsHeight = %d", doc->inheader.cupsHeight);
+ "cfFilterPWGToRaster: cupsHeight = %d", doc->inheader.cupsHeight);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBitsPerColor = %d", doc->inheader.cupsBitsPerColor);
+ "cfFilterPWGToRaster: cupsBitsPerColor = %d", doc->inheader.cupsBitsPerColor);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBitsPerPixel = %d", doc->inheader.cupsBitsPerPixel);
+ "cfFilterPWGToRaster: cupsBitsPerPixel = %d", doc->inheader.cupsBitsPerPixel);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBytesPerLine = %d", doc->inheader.cupsBytesPerLine);
+ "cfFilterPWGToRaster: cupsBytesPerLine = %d", doc->inheader.cupsBytesPerLine);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsColorOrder = %d", doc->inheader.cupsColorOrder);
+ "cfFilterPWGToRaster: cupsColorOrder = %d", doc->inheader.cupsColorOrder);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsColorSpace = %d", doc->inheader.cupsColorSpace);
+ "cfFilterPWGToRaster: cupsColorSpace = %d", doc->inheader.cupsColorSpace);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsCompression = %d", doc->inheader.cupsCompression);
+ "cfFilterPWGToRaster: cupsCompression = %d", doc->inheader.cupsCompression);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsPageSizeName = %s", doc->inheader.cupsPageSizeName);
+ "cfFilterPWGToRaster: cupsPageSizeName = %s", doc->inheader.cupsPageSizeName);
}
if (!doc->page_size_requested)
if (!cupsRasterWriteHeader2(outras, &(doc->outheader))) {
if (log) log(ld,FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Can't write page %d header", pageNo);
+ "cfFilterPWGToRaster: Can't write page %d header", pageNo);
return (false);
}
if (log) {
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Output page %d", pageNo);
+ "cfFilterPWGToRaster: Output page %d", pageNo);
if (doc->outheader.ImagingBoundingBox[3] > 0)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Duplex = %d", doc->outheader.Duplex);
+ "cfFilterPWGToRaster: Duplex = %d", doc->outheader.Duplex);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: HWResolution = [ %d %d ]",
+ "cfFilterPWGToRaster: HWResolution = [ %d %d ]",
doc->outheader.HWResolution[0], doc->outheader.HWResolution[1]);
if (doc->outheader.ImagingBoundingBox[3] > 0)
{
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: ImagingBoundingBox = [ %d %d %d %d ]",
+ "cfFilterPWGToRaster: ImagingBoundingBox = [ %d %d %d %d ]",
doc->outheader.ImagingBoundingBox[0],
doc->outheader.ImagingBoundingBox[1],
doc->outheader.ImagingBoundingBox[2],
doc->outheader.ImagingBoundingBox[3]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Margins = [ %d %d ]",
+ "cfFilterPWGToRaster: Margins = [ %d %d ]",
doc->outheader.Margins[0], doc->outheader.Margins[1]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: ManualFeed = %d", doc->outheader.ManualFeed);
+ "cfFilterPWGToRaster: ManualFeed = %d", doc->outheader.ManualFeed);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: MediaPosition = %d", doc->outheader.MediaPosition);
+ "cfFilterPWGToRaster: MediaPosition = %d", doc->outheader.MediaPosition);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: NumCopies = %d", doc->outheader.NumCopies);
+ "cfFilterPWGToRaster: NumCopies = %d", doc->outheader.NumCopies);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Orientation = %d", doc->outheader.Orientation);
+ "cfFilterPWGToRaster: Orientation = %d", doc->outheader.Orientation);
}
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: PageSize = [ %d %d ]",
+ "cfFilterPWGToRaster: PageSize = [ %d %d ]",
doc->outheader.PageSize[0], doc->outheader.PageSize[1]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsWidth = %d", doc->outheader.cupsWidth);
+ "cfFilterPWGToRaster: cupsWidth = %d", doc->outheader.cupsWidth);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsHeight = %d", doc->outheader.cupsHeight);
+ "cfFilterPWGToRaster: cupsHeight = %d", doc->outheader.cupsHeight);
if (doc->outheader.ImagingBoundingBox[3] > 0)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsMediaType = %d", doc->outheader.cupsMediaType);
+ "cfFilterPWGToRaster: cupsMediaType = %d", doc->outheader.cupsMediaType);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBitsPerColor = %d",
+ "cfFilterPWGToRaster: cupsBitsPerColor = %d",
doc->outheader.cupsBitsPerColor);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBitsPerPixel = %d",
+ "cfFilterPWGToRaster: cupsBitsPerPixel = %d",
doc->outheader.cupsBitsPerPixel);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBytesPerLine = %d",
+ "cfFilterPWGToRaster: cupsBytesPerLine = %d",
doc->outheader.cupsBytesPerLine);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsColorOrder = %d", doc->outheader.cupsColorOrder);
+ "cfFilterPWGToRaster: cupsColorOrder = %d", doc->outheader.cupsColorOrder);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsColorSpace = %d", doc->outheader.cupsColorSpace);
+ "cfFilterPWGToRaster: cupsColorSpace = %d", doc->outheader.cupsColorSpace);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsCompression = %d", doc->outheader.cupsCompression);
+ "cfFilterPWGToRaster: cupsCompression = %d", doc->outheader.cupsCompression);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsPageSizeName = %s", doc->outheader.cupsPageSizeName);
+ "cfFilterPWGToRaster: cupsPageSizeName = %s", doc->outheader.cupsPageSizeName);
}
// write page image
if (doc->outheader.HWResolution[i] == doc->inheader.HWResolution[i])
{
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: %s resolution: %d dpi",
+ "cfFilterPWGToRaster: %s resolution: %d dpi",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i]);
continue;
}
if (doc->outheader.HWResolution[i] % doc->inheader.HWResolution[i])
{
log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: %s output resolution %d dpi is not an integer multiple of %s input resolution %d dpi",
+ "cfFilterPWGToRaster: %s output resolution %d dpi is not an integer multiple of %s input resolution %d dpi",
i == 0 ? "Horizontal" : "Vertical", doc->outheader.HWResolution[i],
i == 0 ? "horizontal" : "vertical", doc->inheader.HWResolution[i]);
return (false);
res_up_factor[i] =
doc->outheader.HWResolution[i] / doc->inheader.HWResolution[i];
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: %s input resolution: %d dpi; %s output resolution: %d dpi -> Raising by factor %d",
+ "cfFilterPWGToRaster: %s input resolution: %d dpi; %s output resolution: %d dpi -> Raising by factor %d",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i],
i == 0 ? "Horizontal" : "Vertical", doc->outheader.HWResolution[i],
res_up_factor[i]);
if (doc->inheader.HWResolution[i] % doc->outheader.HWResolution[i])
{
log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: %s input resolution %d dpi is not an integer multiple of %s output resolution %d dpi",
+ "cfFilterPWGToRaster: %s input resolution %d dpi is not an integer multiple of %s output resolution %d dpi",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i],
i == 0 ? "horizontal" : "vertical", doc->outheader.HWResolution[i]);
return (false);
res_down_factor[i] =
doc->inheader.HWResolution[i] / doc->outheader.HWResolution[i];
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: %s input resolution: %d dpi; %s output resolution: %d dpi -> Reducing by factor %d",
+ "cfFilterPWGToRaster: %s input resolution: %d dpi; %s output resolution: %d dpi -> Reducing by factor %d",
i == 0 ? "Horizontal" : "Vertical", doc->inheader.HWResolution[i],
i == 0 ? "Horizontal" : "Vertical", doc->outheader.HWResolution[i],
res_down_factor[i]);
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Unsupported input color space: Number of colors: %d; Bits per color: %d.",
+ "cfFilterPWGToRaster: Unsupported input color space: Number of colors: %d; Bits per color: %d.",
doc->inheader.cupsNumColors, doc->inheader.cupsBitsPerColor);
return false;
}
if (input_color_mode != color_mode_needed)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Need to pre-convert input from %s to %s",
+ "cfFilterPWGToRaster: Need to pre-convert input from %s to %s",
(input_color_mode == 0 ? "1-bit mono" :
(input_color_mode == 1 ? "8-bit gray" :
"8-bit RGB")),
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Input color mode: %s",
+ "cfFilterPWGToRaster: Input color mode: %s",
(input_color_mode == 0 ? "1-bit mono" :
(input_color_mode == 1 ? "8-bit gray" :
"8-bit RGB")));
doc->outheader.PageSize[1] >= 2 * doc->inheader.PageSize[1])
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Difference between input and output page dimensions too large, probably the input has a wrong page size");
+ "cfFilterPWGToRaster: Difference between input and output page dimensions too large, probably the input has a wrong page size");
goto out;
}
abs(doc->outheader.PageSize[1] - doc->inheader.PageSize[1]) > 2)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Output page dimensions are larger for borderless printing with overspray, inserting one extra pixel after each %d pixels",
+ "cfFilterPWGToRaster: Output page dimensions are larger for borderless printing with overspray, inserting one extra pixel after each %d pixels",
overspray_duplicate_after_pixels);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Output page dimensions are larger than input page dimensions due to rounding error, inserting one extra pixel after each %d pixels",
+ "cfFilterPWGToRaster: Output page dimensions are larger than input page dimensions due to rounding error, inserting one extra pixel after each %d pixels",
overspray_duplicate_after_pixels);
}
}
doc->inheader.cupsBytesPerLine)
{
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Unable to read line %d for page %d.",
+ "cfFilterPWGToRaster: Unable to read line %d for page %d.",
yin + 1, pageNo);
ret = false;
goto out;
doc->inheader.cupsBytesPerLine)
{
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Unable to read line %d for page %d.",
+ "cfFilterPWGToRaster: Unable to read line %d for page %d.",
yin + 1, pageNo);
ret = false;
goto out;
doc->inheader.cupsBytesPerLine)
{
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Unable to read line %d for page %d.",
+ "cfFilterPWGToRaster: Unable to read line %d for page %d.",
yin + 1, pageNo);
ret = false;
goto out;
break;
default:
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Specified ColorSpace is not supported");
+ "cfFilterPWGToRaster: Specified ColorSpace is not supported");
return (1);
}
return (0);
}
-int pwgtoraster(int inputfd, /* I - File descriptor input stream */
+int cfFilterPWGToRaster(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data,/* I - Job and printer data */
+ cf_filter_data_t *data,/* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters */
{
- filter_out_format_t outformat;
+ cf_filter_out_format_t outformat;
pwgtoraster_doc_t doc;
int i;
cups_raster_t *inras = NULL,
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
conversion_function_t convert;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
int ret = 0;
(void)inputseekable;
if (parameters) {
- outformat = *(filter_out_format_t *)parameters;
- if (outformat != OUTPUT_FORMAT_CUPS_RASTER &&
- outformat != OUTPUT_FORMAT_PWG_RASTER &&
- outformat != OUTPUT_FORMAT_APPLE_RASTER &&
- outformat != OUTPUT_FORMAT_PCLM)
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = *(cf_filter_out_format_t *)parameters;
+ if (outformat != CF_FILTER_OUT_FORMAT_CUPS_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PWG_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_APPLE_RASTER &&
+ outformat != CF_FILTER_OUT_FORMAT_PCLM)
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
} else
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Output format: %s",
- (outformat == OUTPUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
- (outformat == OUTPUT_FORMAT_PWG_RASTER ? "PWG Raster" :
- (outformat == OUTPUT_FORMAT_APPLE_RASTER ? "Apple Raster" :
+ "cfFilterPWGToRaster: Output format: %s",
+ (outformat == CF_FILTER_OUT_FORMAT_CUPS_RASTER ? "CUPS Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ? "PWG Raster" :
+ (outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER ? "Apple Raster" :
"PCLM"))));
cmsSetLogErrorHandler(lcmsErrorHandler);
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Unable to open input data stream.");
+ "cfFilterPWGToRaster: Unable to open input data stream.");
}
return (1);
&& doc.outheader.cupsBitsPerColor != 8
&& doc.outheader.cupsBitsPerColor != 16) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Specified color format is not supported.");
+ "cfFilterPWGToRaster: Specified color format is not supported.");
ret = 1;
goto out;
}
|| (doc.outheader.cupsBitsPerColor != 8
&& doc.outheader.cupsBitsPerColor != 16)) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Specified color format is not supported.");
+ "cfFilterPWGToRaster: Specified color format is not supported.");
ret = 1;
goto out;
}
break;
default:
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Specified ColorSpace is not supported.");
+ "cfFilterPWGToRaster: Specified ColorSpace is not supported.");
ret = 1;
goto out;
}
if (!(doc.color_profile.cm_disabled)) {
if (setColorProfile(&doc, log, ld) == 1) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Cannot set color profile.");
+ "cfFilterPWGToRaster: Cannot set color profile.");
ret = 1;
goto out;
}
*/
if ((outras = cupsRasterOpen(outputfd, (outformat ==
- OUTPUT_FORMAT_CUPS_RASTER ?
+ CF_FILTER_OUT_FORMAT_CUPS_RASTER ?
CUPS_RASTER_WRITE :
(outformat ==
- OUTPUT_FORMAT_PWG_RASTER ?
+ CF_FILTER_OUT_FORMAT_PWG_RASTER ?
CUPS_RASTER_WRITE_PWG :
(outformat ==
- OUTPUT_FORMAT_APPLE_RASTER ?
+ CF_FILTER_OUT_FORMAT_APPLE_RASTER ?
CUPS_RASTER_WRITE_APPLE :
CUPS_RASTER_WRITE))))) == 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Can't open output raster stream.");
+ "cfFilterPWGToRaster: Can't open output raster stream.");
ret = 1;
goto out;
}
if (selectConvertFunc(outras, &doc, &convert, log, ld) == 1)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "pwgtoraster: Unable to select color conversion function.");
+ "cfFilterPWGToRaster: Unable to select color conversion function.");
ret = 1;
goto out;
}
if (log) {
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Output page header");
+ "cfFilterPWGToRaster: Output page header");
if (doc.outheader.ImagingBoundingBox[3] > 0)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Duplex = %d", doc.outheader.Duplex);
+ "cfFilterPWGToRaster: Duplex = %d", doc.outheader.Duplex);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: HWResolution = [ %d %d ]",
+ "cfFilterPWGToRaster: HWResolution = [ %d %d ]",
doc.outheader.HWResolution[0], doc.outheader.HWResolution[1]);
if (doc.outheader.ImagingBoundingBox[3] > 0)
{
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: ImagingBoundingBox = [ %d %d %d %d ]",
+ "cfFilterPWGToRaster: ImagingBoundingBox = [ %d %d %d %d ]",
doc.outheader.ImagingBoundingBox[0],
doc.outheader.ImagingBoundingBox[1],
doc.outheader.ImagingBoundingBox[2],
doc.outheader.ImagingBoundingBox[3]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Margins = [ %d %d ]",
+ "cfFilterPWGToRaster: Margins = [ %d %d ]",
doc.outheader.Margins[0], doc.outheader.Margins[1]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: ManualFeed = %d", doc.outheader.ManualFeed);
+ "cfFilterPWGToRaster: ManualFeed = %d", doc.outheader.ManualFeed);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: MediaPosition = %d", doc.outheader.MediaPosition);
+ "cfFilterPWGToRaster: MediaPosition = %d", doc.outheader.MediaPosition);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: NumCopies = %d", doc.outheader.NumCopies);
+ "cfFilterPWGToRaster: NumCopies = %d", doc.outheader.NumCopies);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: Orientation = %d", doc.outheader.Orientation);
+ "cfFilterPWGToRaster: Orientation = %d", doc.outheader.Orientation);
}
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: PageSize = [ %d %d ]",
+ "cfFilterPWGToRaster: PageSize = [ %d %d ]",
doc.outheader.PageSize[0], doc.outheader.PageSize[1]);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsWidth = %d", doc.outheader.cupsWidth);
+ "cfFilterPWGToRaster: cupsWidth = %d", doc.outheader.cupsWidth);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsHeight = %d", doc.outheader.cupsHeight);
+ "cfFilterPWGToRaster: cupsHeight = %d", doc.outheader.cupsHeight);
if (doc.outheader.ImagingBoundingBox[3] > 0)
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsMediaType = %d", doc.outheader.cupsMediaType);
+ "cfFilterPWGToRaster: cupsMediaType = %d", doc.outheader.cupsMediaType);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBitsPerColor = %d",
+ "cfFilterPWGToRaster: cupsBitsPerColor = %d",
doc.outheader.cupsBitsPerColor);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBitsPerPixel = %d",
+ "cfFilterPWGToRaster: cupsBitsPerPixel = %d",
doc.outheader.cupsBitsPerPixel);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsBytesPerLine = %d",
+ "cfFilterPWGToRaster: cupsBytesPerLine = %d",
doc.outheader.cupsBytesPerLine);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsColorOrder = %d", doc.outheader.cupsColorOrder);
+ "cfFilterPWGToRaster: cupsColorOrder = %d", doc.outheader.cupsColorOrder);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsColorSpace = %d", doc.outheader.cupsColorSpace);
+ "cfFilterPWGToRaster: cupsColorSpace = %d", doc.outheader.cupsColorSpace);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsCompression = %d", doc.outheader.cupsCompression);
+ "cfFilterPWGToRaster: cupsCompression = %d", doc.outheader.cupsCompression);
log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: cupsPageSizeName = %s", doc.outheader.cupsPageSizeName);
+ "cfFilterPWGToRaster: cupsPageSizeName = %s", doc.outheader.cupsPageSizeName);
}
/*
i ++;
if (i == 0)
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "pwgtoraster: No page printed, outputting empty file.");
+ "cfFilterPWGToRaster: No page printed, outputting empty file.");
out:
int
ippRasterMatchIPPSize(
cups_page_header2_t *header, /* I - Page header to match */
- filter_data_t *data, /* I - printer-data file */
+ cf_filter_data_t *data, /* I - printer-data file */
double margins[4], /* O - Margins of media in points */
double dimensions[2], /* O - Width and Length of media in points */
int *image_fit, /* O - Imageable Area Fit */
}
int
-getPrintRenderIntent(filter_data_t *data,
+getPrintRenderIntent(cf_filter_data_t *data,
cups_page_header2_t *header)
{
const char *val;
int /* O - 0 on success,
-1 on error */
cupsRasterPrepareHeader(cups_page_header2_t *h, /* I - Raster header */
- filter_data_t *data, /* I - Job and printer data */
- filter_out_format_t final_outformat,
+ cf_filter_data_t *data, /* I - Job and printer data */
+ cf_filter_out_format_t final_outformat,
/* I - Job output format
(determines color space,
and resolution) */
- filter_out_format_t header_outformat,
+ cf_filter_out_format_t header_outformat,
/* I - This filter's output
format (determines
header format) */
double margins[4];
double dimensions[2];
- if (final_outformat == OUTPUT_FORMAT_PWG_RASTER)
+ if (final_outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER)
pwgraster = 1;
- else if (final_outformat == OUTPUT_FORMAT_APPLE_RASTER)
+ else if (final_outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER)
appleraster = 1;
- else if (final_outformat == OUTPUT_FORMAT_PCLM)
+ else if (final_outformat == CF_FILTER_OUT_FORMAT_PCLM)
pclm = 1;
else
cupsraster = 1;
- if (header_outformat == OUTPUT_FORMAT_PWG_RASTER ||
- header_outformat == OUTPUT_FORMAT_APPLE_RASTER)
+ if (header_outformat == CF_FILTER_OUT_FORMAT_PWG_RASTER ||
+ header_outformat == CF_FILTER_OUT_FORMAT_APPLE_RASTER)
cupsrasterheader = 0;
printer_attrs = data->printer_attrs;
int /* O - -1 on error, 0 on success */
cupsRasterParseIPPOptions(cups_page_header2_t *h, /* I - Raster header */
- filter_data_t *data,
+ cf_filter_data_t *data,
int pwg_raster, /* I - 1 if PWG Raster */
int set_defaults) /* I - If 1, set default
values for all fields for
/* Function for storing job-attrs in options */
-int joinJobOptionsAndAttrs(filter_data_t* data, int num_options, cups_option_t **options)
+int joinJobOptionsAndAttrs(cf_filter_data_t* data, int num_options, cups_option_t **options)
{
ipp_t *job_attrs = data->job_attrs; /* Job attributes */
ipp_attribute_t *ipp_attr; /* IPP attribute */
*/
extern int cupsRasterPrepareHeader(cups_page_header2_t *h,
- filter_data_t *data,
- filter_out_format_t
+ cf_filter_data_t *data,
+ cf_filter_out_format_t
final_outformat,
- filter_out_format_t
+ cf_filter_out_format_t
header_outformat,
int no_hig_depth,
cups_cspace_t *cspace);
cups_cspace_t *cspace,
int *high_depth);
extern int cupsRasterParseIPPOptions(cups_page_header2_t *h,
- filter_data_t *data,
+ cf_filter_data_t *data,
int pwg_raster,
int set_defaults);
-extern int joinJobOptionsAndAttrs(filter_data_t *data,
+extern int joinJobOptionsAndAttrs(cf_filter_data_t *data,
int num_options,
cups_option_t **options);
extern int ippRasterMatchIPPSize(cups_page_header2_t *header,
- filter_data_t *data,
+ cf_filter_data_t *data,
double margins[4],
double dimensions[2],
int *image_fit,
extern int getBackSideAndHeaderDuplex(ipp_t *printer_attrs,
cups_page_header2_t *header);
-extern int getPrintRenderIntent(filter_data_t *data,
+extern int getPrintRenderIntent(cf_filter_data_t *data,
cups_page_header2_t *header);
# ifdef __cplusplus
logging */
void *logdata; /* User data for logging
function, can be NULL */
- filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
+ cf_filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
job is canceled, NULL for not
supporting stop on cancel */
void *iscanceleddata; /* User data for is-canceled
render_intent(""),
color_space(CUPS_CSPACE_K),
page_width(0),page_height(0),
- outformat(OUTPUT_FORMAT_PDF)
+ outformat(CF_FILTER_OUT_FORMAT_PDF)
{
}
cups_cspace_t color_space;
PointerHolder<Buffer> page_data;
double page_width,page_height;
- filter_out_format_t outformat;
+ cf_filter_out_format_t outformat;
};
int create_pdf_file(struct pdf_info * info,
- const filter_out_format_t &outformat)
+ const cf_filter_out_format_t &outformat)
{
try {
info->pdf.emptyPDF();
break;
default:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Failed to embed ICC Profile.");
+ "cfFilterRasterToPDF: Failed to embed ICC Profile.");
return QPDFObjectHandle::newNull();
}
free(buff);
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: ICC Profile embedded in PDF.");
+ "cfFilterRasterToPDF: ICC Profile embedded in PDF.");
return ret;
}
break;
default:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Color space not supported.");
+ "cfFilterRasterToPDF: Color space not supported.");
return std::vector<QPDFObjectHandle>(num_strips, QPDFObjectHandle());
}
default:
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Color space not supported.");
+ "cfFilterRasterToPDF: Color space not supported.");
return QPDFObjectHandle();
}
} else if (doc->cm_disabled) {
default:
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Color space not supported.");
+ "cfFilterRasterToPDF: Color space not supported.");
return QPDFObjectHandle();
}
} else
int finish_page(struct pdf_info * info, rastertopdf_doc_t *doc)
{
- if (info->outformat == OUTPUT_FORMAT_PDF)
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PDF)
{
// Finish previous PDF Page
if(!info->page_data.getPointer())
{
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Unable to load image data");
+ "cfFilterRasterToPDF: Unable to load image data");
return 1;
}
// add it
info->page.getKey("/Resources").getKey("/XObject").replaceKey("/I",image);
}
- else if (info->outformat == OUTPUT_FORMAT_PCLM)
+ else if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM)
{
// Finish previous PCLm page
if (info->pclm_num_strips == 0)
{
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Unable to load strip data");
+ "cfFilterRasterToPDF: Unable to load strip data");
return 1;
}
// draw it
std::string content;
- if (info->outformat == OUTPUT_FORMAT_PDF)
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PDF)
{
content.append(QUtil::double_to_string(info->page_width) + " 0 0 " +
QUtil::double_to_string(info->page_height) + " 0 0 cm\n");
content.append("/I Do\n");
}
- else if (info->outformat == OUTPUT_FORMAT_PCLM)
+ else if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM)
{
std::string res = info->pclm_source_resolution_default;
}
QPDFObjectHandle page_contents = info->page.getKey("/Contents");
- if (info->outformat == OUTPUT_FORMAT_PDF)
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PDF)
page_contents.replaceStreamData(content, QPDFObjectHandle::newNull(),
QPDFObjectHandle::newNull());
- else if (info->outformat == OUTPUT_FORMAT_PCLM)
+ else if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM)
page_contents.getArrayItem(0).replaceStreamData(content,
QPDFObjectHandle::newNull(),
QPDFObjectHandle::newNull());
info->bpc = bpc;
info->render_intent = render_intent;
info->color_space = color_space;
- if (info->outformat == OUTPUT_FORMAT_PCLM)
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM)
{
info->pclm_num_strips =
(height / info->pclm_strip_height_preferred) +
default:
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Unable to convert PDF from profile.");
+ "cfFilterRasterToPDF: Unable to convert PDF from profile.");
doc->colorProfile = NULL;
error = 1;
}
default:
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Color space not supported.");
+ "cfFilterRasterToPDF: Color space not supported.");
error = 1;
break;
}
info->line_bytes)) {
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Page too big");
+ "cfFilterRasterToPDF: Page too big");
return 1;
}
- if (info->outformat == OUTPUT_FORMAT_PDF)
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PDF)
info->page_data =
PointerHolder<Buffer>(new Buffer(info->line_bytes * info->height));
- else if (info->outformat == OUTPUT_FORMAT_PCLM)
+ else if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM)
{
// reserve space for PCLm strips
for (size_t i = 0; i < info->pclm_num_strips; i ++)
// Convert to pdf units
info->page_width=((double)info->width/xdpi)*DEFAULT_PDF_UNIT;
info->page_height=((double)info->height/ydpi)*DEFAULT_PDF_UNIT;
- if (info->outformat == OUTPUT_FORMAT_PDF)
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PDF)
{
page.replaceKey("/Contents",QPDFObjectHandle::newStream(&info->pdf));
// data will be provided later
page.replaceKey("/MediaBox",makeRealBox(0,0,info->page_width,
info->page_height));
}
- else if (info->outformat == OUTPUT_FORMAT_PCLM)
+ else if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM)
{
page.replaceKey("/Contents",
QPDFObjectHandle::newArray(std::vector<QPDFObjectHandle>
} catch (std::bad_alloc &ex) {
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Unable to allocate page data");
+ "cfFilterRasterToPDF: Unable to allocate page data");
return 1;
} catch (...) {
return 1;
QPDFWriter output(info->pdf,NULL);
output.setOutputFile("pdf", doc->outputfp, false);
// output.setMinimumPDFVersion("1.4");
- if (info->outformat == OUTPUT_FORMAT_PCLM)
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM)
output.setPCLm(true);
output.write();
} catch (...) {
{
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Bad line %d", line_n);
+ "cfFilterRasterToPDF: Bad line %d", line_n);
return;
}
- if (info->outformat == OUTPUT_FORMAT_PCLM) {
+ if (info->outformat == CF_FILTER_OUT_FORMAT_PCLM) {
// copy line data into appropriate pclm strip
size_t strip_num = line_n / info->pclm_strip_height_preferred;
unsigned line_strip = line_n -
if (doc->colorProfile != NULL) {
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Load profile successful.");
+ "cfFilterRasterToPDF: Load profile successful.");
return 0;
}
else {
if (doc->logfunc)
doc->logfunc(doc->logdata, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Unable to load profile.");
+ "cfFilterRasterToPDF: Unable to load profile.");
return 1;
}
}
}
int /* O - Error status */
-rastertopdf(int inputfd, /* I - File descriptor input stream */
+cfFilterRasterToPDF(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (outformat) */
{
int i;
rastertopdf_doc_t doc; /* Document information */
FILE *outputfp; /* Output data stream */
- filter_out_format_t outformat; /* Output format */
+ cf_filter_out_format_t outformat; /* Output format */
int Page, empty = 1;
cf_cm_calibration_t cm_calibrate; /* Status of CUPS color management
("on" or "off") */
const char* profile_name = NULL; /* IPP Profile Name */
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
int total_attrs;
char buf[1024];
if (parameters)
{
- outformat = *(filter_out_format_t *)parameters;
- if (outformat != OUTPUT_FORMAT_PCLM)
- outformat = OUTPUT_FORMAT_PDF;
+ outformat = *(cf_filter_out_format_t *)parameters;
+ if (outformat != CF_FILTER_OUT_FORMAT_PCLM)
+ outformat = CF_FILTER_OUT_FORMAT_PDF;
}
else
- outformat = OUTPUT_FORMAT_PDF;
+ outformat = CF_FILTER_OUT_FORMAT_PDF;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: OUTFORMAT=\"%s\"",
- outformat == OUTPUT_FORMAT_PDF ? "PDF" : "PCLM");
+ "cfFilterRasterToPDF: OUTFORMAT=\"%s\"",
+ outformat == CF_FILTER_OUT_FORMAT_PDF ? "PDF" : "PCLM");
/*
* Open the output data stream specified by the outputfd...
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Unable to open output data stream.");
+ "cfFilterRasterToPDF: Unable to open output data stream.");
}
return (1);
/* support the CUPS "cm-calibration" option */
cm_calibrate = cfCmGetCupsColorCalibrateMode(data, data->options, data->num_options);
- if (outformat == OUTPUT_FORMAT_PCLM ||
+ if (outformat == CF_FILTER_OUT_FORMAT_PCLM ||
cm_calibrate == CF_CM_CALIBRATION_ENABLED)
doc.cm_disabled = 1;
else
doc.cm_disabled = cfCmIsPrinterCmDisabled(data);
- if (outformat == OUTPUT_FORMAT_PCLM && data->ppd == NULL
+ if (outformat == CF_FILTER_OUT_FORMAT_PCLM && data->ppd == NULL
&& printer_attrs == NULL )
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopdf: PCLm output: Neither a PPD file nor printer IPP attributes are supplied, PCLm output not possible.");
+ "cfFilterRasterToPDF: PCLm output: Neither a PPD file nor printer IPP attributes are supplied, PCLm output not possible.");
return 1;
}
Page = 0;
/* Get PCLm attributes from PPD */
- if (data->ppd && outformat == OUTPUT_FORMAT_PCLM)
+ if (data->ppd && outformat == CF_FILTER_OUT_FORMAT_PCLM)
{
char *attr_name = (char *)"cupsPclmStripHeightPreferred";
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: PPD PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_strip_height_preferred = atoi(attr->value);
}
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: PPD PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_strip_height_supported.clear(); // remove default value = 16
std::vector<std::string> vec = split_strings(attr->value, ",");
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: PPD PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_raster_back_side = attr->value;
}
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: PPD PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_source_resolution_supported = split_strings(attr->value, ",");
}
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: PPD PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
pdf.pclm_source_resolution_default = attr->value;
}
pdf.pclm_source_resolution_default =
pdf.pclm_source_resolution_supported[0];
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: PPD PCLm attribute \"%s\" missing, taking first item of \"cupsPclmSourceResolutionSupported\" as default resolution",
+ "cfFilterRasterToPDF: PPD PCLm attribute \"%s\" missing, taking first item of \"cupsPclmSourceResolutionSupported\" as default resolution",
attr_name);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopdf: PCLm output: PPD file does not contain printer resolution information for PCLm.");
+ "cfFilterRasterToPDF: PCLm output: PPD file does not contain printer resolution information for PCLm.");
return 1;
}
if ((attr = ppdFindAttr(data->ppd, attr_name, NULL)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: PPD PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: PPD PCLm attribute \"%s\" with value \"%s\"",
attr_name, attr->value);
std::vector<std::string> vec = split_strings(attr->value, ",");
pdf.pclm_compression_method_preferred.push_back(FLATE_DECODE);
}
}
- else if(outformat == OUTPUT_FORMAT_PCLM && printer_attrs)
+ else if(outformat == CF_FILTER_OUT_FORMAT_PCLM && printer_attrs)
{
if (log)
{
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Printer PCLm attribute \"%s\" with value %d",
+ "cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value %d",
attr_name, ippGetInteger(ipp_attr, 0));
pdf.pclm_strip_height_preferred = ippGetInteger(ipp_attr, 0);
}
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Printer PCLm attribute \"%s\"",
+ "cfFilterRasterToPDF: Printer PCLm attribute \"%s\"",
attr_name);
pdf.pclm_strip_height_supported.clear(); // remove default value = 16
for (int i = 0; i < ippGetCount(ipp_attr); i ++)
if ((ipp_attr = ippFindAttribute(printer_attrs, attr_name, IPP_TAG_ZERO)) != NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Printer PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, ippGetString(ipp_attr, 0, NULL));
pdf.pclm_raster_back_side = ippGetString(ipp_attr, 0, NULL);
}
{
ippAttributeString(ipp_attr, buf, sizeof(buf));
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Printer PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, buf);
pdf.pclm_source_resolution_supported = split_strings(buf, ",");
}
{
ippAttributeString(ipp_attr, buf, sizeof(buf));
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Printer PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, buf);
pdf.pclm_source_resolution_default = buf;
}
pdf.pclm_source_resolution_default =
pdf.pclm_source_resolution_supported[0];
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Printer PCLm attribute \"%s\" missing, taking first item of \"pclm-source-resolution-supported\" as default resolution",
+ "cfFilterRasterToPDF: Printer PCLm attribute \"%s\" missing, taking first item of \"pclm-source-resolution-supported\" as default resolution",
attr_name);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopdf: PCLm output: Printer IPP attributes do not contain printer resolution information for PCLm.");
+ "cfFilterRasterToPDF: PCLm output: Printer IPP attributes do not contain printer resolution information for PCLm.");
return 1;
}
{
ippAttributeString(ipp_attr, buf, sizeof(buf));
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Printer PCLm attribute \"%s\" with value \"%s\"",
+ "cfFilterRasterToPDF: Printer PCLm attribute \"%s\" with value \"%s\"",
attr_name, buf);
std::vector<std::string> vec = split_strings(buf, ",");
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Job canceled");
+ "cfFilterRasterToPDF: Job canceled");
break;
}
if (create_pdf_file(&pdf, outformat) != 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopdf: Unable to create PDF file");
+ "cfFilterRasterToPDF: Unable to create PDF file");
return 1;
}
}
// Write a status message with the page number
Page ++;
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "rastertopdf: Starting page %d.", Page);
+ "cfFilterRasterToPDF: Starting page %d.", Page);
// Use "profile=profile_name.icc" to embed 'profile_name.icc' into the PDF
// for testing. Forces color management to enable.
- if (outformat == OUTPUT_FORMAT_PDF &&
+ if (outformat == CF_FILTER_OUT_FORMAT_PDF &&
(profile_name = cupsGetOption("profile", data->num_options,
data->options)) != NULL) {
setProfile(profile_name, &doc);
}
if (doc.colorProfile != NULL)
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: TEST ICC Profile specified (color "
+ "cfFilterRasterToPDF: TEST ICC Profile specified (color "
"management forced ON): \n[%s]", profile_name);
// Add a new page to PDF file
header.HWResolution[1], &doc) != 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopdf: Unable to start new PDF page");
+ "cfFilterRasterToPDF: Unable to start new PDF page");
return 1;
}
&pdf, &doc) != 0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopdf: Failed to convert page bitmap");
+ "cfFilterRasterToPDF: Failed to convert page bitmap");
return 1;
}
}
if (empty)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopdf: Input is empty, outputting empty file.");
+ "cfFilterRasterToPDF: Input is empty, outputting empty file.");
cupsRasterClose(ras);
return 0;
}
logging */
void *logdata; /* User data for logging function, can
be NULL */
- filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
+ cf_filter_iscanceledfunc_t iscanceledfunc; /* Function returning 1 when
job is canceled, NULL for not
supporting stop on cancel */
void *iscanceleddata; /* User data for is-canceled
switch (ret) {
case Z_ERRNO:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "rastertops: zpipe - error in source data or output file");
+ "cfFilterRasterToPS: zpipe - error in source data or output file");
break;
case Z_STREAM_ERROR:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "rastertops: zpipe - invalid compression level");
+ "cfFilterRasterToPS: zpipe - invalid compression level");
break;
case Z_DATA_ERROR:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "rastertops: zpipe - invalid or incomplete deflate data");
+ "cfFilterRasterToPS: zpipe - invalid or incomplete deflate data");
break;
case Z_MEM_ERROR:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "rastertops: zpipe - out of memory");
+ "cfFilterRasterToPS: zpipe - out of memory");
break;
case Z_VERSION_ERROR:
if (doc->logfunc) doc->logfunc(doc->logdata, FILTER_LOGLEVEL_ERROR,
- "rastertops: zpipe - zlib version mismatch!");
+ "cfFilterRasterToPS: zpipe - zlib version mismatch!");
}
}
}
/*
- * 'rastertops()' - Filter function to convert PWG raster input
+ * 'cfFilterRasterToPS()' - Filter function to convert PWG raster input
* to PostScript
*/
int /* O - Error status */
-rastertops(int inputfd, /* I - File descriptor input stream */
+cfFilterRasterToPS(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
rastertops_doc_t doc; /* Document information */
ret; /* Return value of deflate compression */
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertops: Unable to open input data stream.");
+ "cfFilterRasterToPS: Unable to open input data stream.");
}
return (1);
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertops: Unable to open output data stream.");
+ "cfFilterRasterToPS: Unable to open output data stream.");
}
cupsFileClose(inputfp);
if (iscanceled && iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertops: Job canceled");
+ "cfFilterRasterToPS: Job canceled");
break;
}
Page ++;
if (log) log(ld, FILTER_LOGLEVEL_INFO,
- "rastertops: Starting page %d.", Page);
+ "cfFilterRasterToPS: Starting page %d.", Page);
/*
* Write the starting of the page
if (empty)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertops: Input is empty, outputting empty file.");
+ "cfFilterRasterToPS: Input is empty, outputting empty file.");
cupsRasterClose(ras);
return 0;
}
*/
int /* O - Exit status */
-rastertopwg(int inputfd, /* I - File descriptor input stream */
+cfFilterRasterToPWG(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{ /* I - Command-line arguments */
cups_raster_t *inras; /* Input raster stream */
/* Number of options */
cups_option_t *options = NULL;/* Options */
const char *val; /* Option value */
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_out_format_t output_format;
+ cf_filter_out_format_t output_format;
if (parameters)
{
- output_format = *(filter_out_format_t *)parameters;
- if (output_format == OUTPUT_FORMAT_PWG_RASTER)
+ output_format = *(cf_filter_out_format_t *)parameters;
+ if (output_format == CF_FILTER_OUT_FORMAT_PWG_RASTER)
outras = cupsRasterOpen(outputfd, CUPS_RASTER_WRITE_PWG);
- if (output_format == OUTPUT_FORMAT_APPLE_RASTER)
+ if (output_format == CF_FILTER_OUT_FORMAT_APPLE_RASTER)
outras = cupsRasterOpen(outputfd, CUPS_RASTER_WRITE_APPLE);
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Invalid output format specified. Only PWG Raster and Apple Raster/URF are supported.");
+ "cfFilterRasterToPWG: Invalid output format specified. Only PWG Raster and Apple Raster/URF are supported.");
return (1);
}
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Output format not specified.");
+ "cfFilterRasterToPWG: Output format not specified.");
return (1);
}
if (!data->ppd)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: PPD file is not specified.");
+ "cfFilterRasterToPWG: PPD file is not specified.");
}
cache = data->ppd ? data->ppd->cache : NULL;
{
/* Canceled */
log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Job canceled on input page %d", page + 1);
+ "cfFilterRasterToPWG: Job canceled on input page %d", page + 1);
}
/*
* Show page device dictionary...
*/
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Duplex = %d", inheader.Duplex);
+ "cfFilterRasterToPWG: Duplex = %d", inheader.Duplex);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: HWResolution = [ %d %d ]",
+ "cfFilterRasterToPWG: HWResolution = [ %d %d ]",
inheader.HWResolution[0], inheader.HWResolution[1]);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: ImagingBoundingBox = [ %d %d %d %d ]",
+ "cfFilterRasterToPWG: ImagingBoundingBox = [ %d %d %d %d ]",
inheader.ImagingBoundingBox[0],
inheader.ImagingBoundingBox[1],
inheader.ImagingBoundingBox[2],
inheader.ImagingBoundingBox[3]);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Margins = [ %d %d ]",
+ "cfFilterRasterToPWG: Margins = [ %d %d ]",
inheader.Margins[0], inheader.Margins[1]);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: ManualFeed = %d", inheader.ManualFeed);
+ "cfFilterRasterToPWG: ManualFeed = %d", inheader.ManualFeed);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: MediaPosition = %d", inheader.MediaPosition);
+ "cfFilterRasterToPWG: MediaPosition = %d", inheader.MediaPosition);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: NumCopies = %d", inheader.NumCopies);
+ "cfFilterRasterToPWG: NumCopies = %d", inheader.NumCopies);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Orientation = %d", inheader.Orientation);
+ "cfFilterRasterToPWG: Orientation = %d", inheader.Orientation);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: PageSize = [ %d %d ]",
+ "cfFilterRasterToPWG: PageSize = [ %d %d ]",
inheader.PageSize[0], inheader.PageSize[1]);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsWidth = %d", inheader.cupsWidth);
+ "cfFilterRasterToPWG: cupsWidth = %d", inheader.cupsWidth);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsHeight = %d", inheader.cupsHeight);
+ "cfFilterRasterToPWG: cupsHeight = %d", inheader.cupsHeight);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsMediaType = %d", inheader.cupsMediaType);
+ "cfFilterRasterToPWG: cupsMediaType = %d", inheader.cupsMediaType);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsBitsPerColor = %d",
+ "cfFilterRasterToPWG: cupsBitsPerColor = %d",
inheader.cupsBitsPerColor);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsBitsPerPixel = %d",
+ "cfFilterRasterToPWG: cupsBitsPerPixel = %d",
inheader.cupsBitsPerPixel);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsBytesPerLine = %d",
+ "cfFilterRasterToPWG: cupsBytesPerLine = %d",
inheader.cupsBytesPerLine);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsColorOrder = %d", inheader.cupsColorOrder);
+ "cfFilterRasterToPWG: cupsColorOrder = %d", inheader.cupsColorOrder);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsColorSpace = %d", inheader.cupsColorSpace);
+ "cfFilterRasterToPWG: cupsColorSpace = %d", inheader.cupsColorSpace);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: cupsCompression = %d", inheader.cupsCompression);
+ "cfFilterRasterToPWG: cupsCompression = %d", inheader.cupsCompression);
/*
* Compute the real raster size...
page ++;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: %d %d\n", page, inheader.NumCopies);
+ "cfFilterRasterToPWG: %d %d\n", page, inheader.NumCopies);
page_width = (unsigned)(inheader.cupsPageSize[0] *
inheader.HWResolution[0] / 72.0);
lineoffset = page_left * inheader.cupsBitsPerPixel / 8; /* Round down */
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: In pixels: Width: %u Height: %u Left: %u Right: %u Top: %u Bottom: %u",
+ "cfFilterRasterToPWG: In pixels: Width: %u Height: %u Left: %u Right: %u Top: %u Bottom: %u",
page_width, page_height,
page_left, page_right, page_top, page_bottom);
if (page_left > page_width || page_top > page_height ||
page_bottom > page_height || page_right > page_width)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Unsupported raster data.");
+ "cfFilterRasterToPWG: Unsupported raster data.");
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Bad bottom/left/top margin on page %d.", page);
+ "cfFilterRasterToPWG: Bad bottom/left/top margin on page %d.", page);
return (1);
}
default :
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Unsupported raster data.");
+ "cfFilterRasterToPWG: Unsupported raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported cupsColorSpace %d on page %d.",
+ "cfFilterRasterToPWG: Unsupported cupsColorSpace %d on page %d.",
inheader.cupsColorSpace, page);
return (1);
}
if (inheader.cupsColorOrder != CUPS_ORDER_CHUNKED)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Unsupported raster data.");
+ "cfFilterRasterToPWG: Unsupported raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported cupsColorOrder %d on page %d.",
+ "cfFilterRasterToPWG: Unsupported cupsColorOrder %d on page %d.",
inheader.cupsColorOrder, page);
return (1);
}
inheader.cupsBitsPerColor != 8 && inheader.cupsBitsPerColor != 16)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Unsupported raster data.");
+ "cfFilterRasterToPWG: Unsupported raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported cupsBitsPerColor %d on page %d.",
+ "cfFilterRasterToPWG: Unsupported cupsBitsPerColor %d on page %d.",
inheader.cupsBitsPerColor, page);
return (1);
}
else
{
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported print-content-optimize value.");
+ "cfFilterRasterToPWG: Unsupported print-content-optimize value.");
outheader.OutputType[0] = '\0';
}
}
else
{
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported print-quality %d.", quality);
+ "cfFilterRasterToPWG: Unsupported print-quality %d.", quality);
outheader.cupsInteger[8] = 0;
}
}
else
{
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported print-rendering-intent value.");
+ "cfFilterRasterToPWG: Unsupported print-rendering-intent value.");
outheader.cupsRenderingIntent[0] = '\0';
}
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported PageSize %.2fx%.2f.",
+ "cfFilterRasterToPWG: Unsupported PageSize %.2fx%.2f.",
inheader.cupsPageSize[0], inheader.cupsPageSize[1]);
outheader.cupsPageSizeName[0] = '\0';
}
*/
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unsupported cupsBackSide value.");
+ "cfFilterRasterToPWG: Unsupported cupsBackSide value.");
outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
outheader.cupsInteger[2] = 1; /* FeedTransform */
if (!cupsRasterWriteHeader2(outras, &outheader))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Error sending raster data.");
+ "cfFilterRasterToPWG: Error sending raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unable to write header for page %d.", page);
+ "cfFilterRasterToPWG: Unable to write header for page %d.", page);
return (1);
}
if (!cupsRasterWritePixels(outras, line, outheader.cupsBytesPerLine))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Error sending raster data.");
+ "cfFilterRasterToPWG: Error sending raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unable to write line %d for page %d.",
+ "cfFilterRasterToPWG: Unable to write line %d for page %d.",
page_top - y + 1, page);
return (1);
}
inheader.cupsBytesPerLine)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Error sending raster data.");
+ "cfFilterRasterToPWG: Error sending raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unable to read line %d for page %d.",
+ "cfFilterRasterToPWG: Unable to read line %d for page %d.",
inheader.cupsHeight - y + page_top + 1, page);
return (1);
}
if (!cupsRasterWritePixels(outras, line, outheader.cupsBytesPerLine))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Error sending raster data.");
+ "cfFilterRasterToPWG: Error sending raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unable to write line %d for page %d.",
+ "cfFilterRasterToPWG: Unable to write line %d for page %d.",
inheader.cupsHeight - y + page_top + 1, page);
return (1);
}
if (!cupsRasterWritePixels(outras, line, outheader.cupsBytesPerLine))
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "rastertopwg: Error sending raster data.");
+ "cfFilterRasterToPWG: Error sending raster data.");
if (log) log(ld,FILTER_LOGLEVEL_DEBUG,
- "rastertopwg: Unable to write line %d for page %d.",
+ "cfFilterRasterToPWG: Unable to write line %d for page %d.",
page_bottom - y + page_top + inheader.cupsHeight + 1,
page);
return (1);
#include "driver.h"
#include <sys/stat.h>
-filter_logfunc_t logfunc = cups_logfunc; /* Log function */
+filter_logfunc_t logfunc = cfCUPSLogFunc; /* Log function */
void *ld = NULL; /* Log function data */
void test_gray(int num_comps, const char *basename);
#include <string.h>
#include <ctype.h>
-filter_logfunc_t logfunc = cups_logfunc; /* Log function */
+filter_logfunc_t logfunc = cfCUPSLogFunc; /* Log function */
void *ld = NULL; /* Log function data */
*
* Contents:
*
- * texttopdf() - Main entry for text to PDF filter.
+ * cfFilterTextToPDF() - Main entry for text to PDF filter.
* WriteEpilogue() - Write the PDF file epilogue.
* WritePage() - Write a page of text.
* WriteProlog() - Write the PDF file prolog with options.
cups_page_header2_t h; /* CUPS Raster page header, to */
/* accommodate results of command */
/* line parsing for PPD-less queue */
- texttopdf_parameter_t env_vars;
+ cf_filter_texttopdf_parameter_t env_vars;
int NumKeywords;
float PageLeft, /* Left margin */
PageRight, /* Right margin */
if (!fontname)
{
// TODO: try /usr/share/fonts/*/*/%s.ttf
- if(log) log(ld, FILTER_LOGLEVEL_ERROR,"texttopdf: No viable font found.");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR,"cfFilterTextToPDF: No viable font found.");
return NULL;
}
/*
- * 'texttopdf()' - Main entry for text to PDF filter.
+ * 'cfFilterTextToPDF()' - Main entry for text to PDF filter.
*/
int /* O - Exit status */
-texttopdf(int inputfd, /* I - File descriptor input stream */
+cfFilterTextToPDF(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters (unused) */
{
texttopdf_doc_t doc;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
FILE *fp; /* Print file */
int stdoutbackupfd; /* The "real" stdout is backupped here while */
doc.pdf = NULL;
if (parameters) {
- doc.env_vars = *((texttopdf_parameter_t *)parameters);
+ doc.env_vars = *((cf_filter_texttopdf_parameter_t *)parameters);
} else {
doc.env_vars.data_dir = CUPS_DATADIR;
doc.env_vars.char_set = NULL;
}
}
- filterSetCommonOptions(data->ppd, data->num_options, data->options, 1,
+ cfFilterSetCommonOptions(data->ppd, data->num_options, data->options, 1,
&(doc.Orientation), &(doc.Duplex),
&(doc.LanguageLevel), &(doc.ColorDevice),
&(doc.PageLeft), &(doc.PageRight), &(doc.PageTop),
if (doc.PageColumns < 1)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad columns value %d", doc.PageColumns);
+ "cfFilterTextToPDF: Bad columns value %d", doc.PageColumns);
ret = 1;
goto out;
}
if (doc.CharsPerInch <= 0.0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad cpi value %f", doc.CharsPerInch);
+ "cfFilterTextToPDF: Bad cpi value %f", doc.CharsPerInch);
ret = 1;
goto out;
}
if (doc.LinesPerInch <= 0.0)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad lpi value %f", doc.LinesPerInch);
+ "cfFilterTextToPDF: Bad lpi value %f", doc.LinesPerInch);
ret = 1;
goto out;
}
if (doc.SizeLines >= INT_MAX / doc.SizeColumns / sizeof(lchar_t))
{
- if (log) log(ld, FILTER_LOGLEVEL_ERROR, "texttopdf: Bad page size");
+ if (log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToPDF: Bad page size");
ret = 1;
goto out;
}
if (!doc.Page)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: cannot allocate memory for page");
+ "cfFilterTextToPDF: cannot allocate memory for page");
ret = 1;
goto out;
}
{
free(doc.Page);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: cannot allocate memory for page");
+ "cfFilterTextToPDF: cannot allocate memory for page");
ret = 1;
goto out;
}
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Unable to open %s: %s",
+ "cfFilterTextToPDF: Unable to open %s: %s",
filename, strerror(errno));
return (1);
}
fclose(fp);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad charset file %s", filename);
+ "cfFilterTextToPDF: Bad charset file %s", filename);
return (1);
}
fclose(fp);
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad charset file %s", filename);
+ "cfFilterTextToPDF: Bad charset file %s", filename);
return (1);
}
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad font description line: %s", valptr);
+ "cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad text direction %s", valptr);
+ "cfFilterTextToPDF: Bad text direction %s", valptr);
return (1);
}
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad font description line: %s", valptr);
+ "cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
else
{
if(log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad text width %s", valptr);
+ "cfFilterTextToPDF: Bad text width %s", valptr);
return (1);
}
if (!fonts[num_fonts]) // font missing/corrupt, replace by first
{
if(log) log(ld, FILTER_LOGLEVEL_WARN,
- "texttopdf: Ignored bad font \"%s\"",valptr);
+ "cfFilterTextToPDF: Ignored bad font \"%s\"",valptr);
break;
}
fontnames[num_fonts++] = strdup(valptr);
* Can't have a font without all required values...
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad font description line: %s", valptr);
+ "cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad text direction %s", valptr);
+ "cfFilterTextToPDF: Bad text direction %s", valptr);
return (1);
}
* Can't have a font without all required values...
*/
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad font description line: %s", valptr);
+ "cfFilterTextToPDF: Bad font description line: %s", valptr);
return (1);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad text width %s", valptr);
+ "cfFilterTextToPDF: Bad text width %s", valptr);
return (1);
}
if (!fonts[num_fonts]) // font missing/corrupt, replace by first
{
if(log) log(ld, FILTER_LOGLEVEL_WARN,
- "texttopdf: Ignored bad font \"%s\"",valptr);
+ "cfFilterTextToPDF: Ignored bad font \"%s\"",valptr);
break;
}
fontnames[num_fonts++] = strdup(valptr);
else // {{{
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf: Bad charset type %s", lineptr);
+ "cfFilterTextToPDF: Bad charset type %s", lineptr);
return (1);
} // }}}
} // }}}
if (doc->NumFonts == 0) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "texttopdf:No usable font available");
+ "cfFilterTextToPDF:No usable font available");
return (1);
}
static int check_range(char *page_ranges, int even_pages,
int odd_pages, int page);
-int texttotext(int inputfd, /* I - File descriptor input stream */
+int cfFilterTextToText(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? (unused)*/
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters */
{
int i, j; /* Looping vars */
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
- filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
+ cf_filter_iscanceledfunc_t iscanceled = data->iscanceledfunc;
void *icd = data->iscanceleddata;
cups_file_t *outputfp;
if (!iscanceled || !iscanceled(icd))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "bannertopdf: Unable to open output data stream.");
+ "cfFilterBannerToPDF: Unable to open output data stream.");
}
return (1);
}
}
num_chars_per_inch = atoi(val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"texttotext: num of lines per inch = %d",num_lines_per_inch);
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"texttotext: num of chars per inch = %d",num_chars_per_inch);
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: num of lines per inch = %d",num_lines_per_inch);
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: num of chars per inch = %d",num_chars_per_inch);
/* With the "PageSize"/"PageRegion" options we only determine the number
of lines and columns of a page, we do not use the geometry defined by
if(val==NULL)
val = ppd_attr->value;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"texttotext: PageSize: %s", val);
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: PageSize: %s", val);
snprintf(buffer, sizeof(buffer), "Default%sNumLines", val);
if ((val2 = cupsGetOption(buffer + 7, num_options, options)) != NULL ||
(ipp = ippFindAttribute(job_attrs, buffer+7, IPP_TAG_ZERO))!= NULL ||
num_columns = atoi(val2);
}
if (num_lines <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"texttotext: Invalid number of lines %d, using default: 66",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of lines %d, using default: 66",
num_lines);
num_lines = 66;
}
if (num_columns <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"texttotext: Invalid number of columns %d, using default: 80",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of columns %d, using default: 80",
num_columns);
num_columns = 80;
}
num_columns = (int)((x_dim/72.0)*(num_chars_per_inch));
}
if (num_lines <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"texttotext: Invalid number of lines %d, using default: 66",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of lines %d, using default: 66",
num_lines);
num_lines = 66;
}
if (num_columns <= 0) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"texttotext: Invalid number of columns %d, using default: 80",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG,"cfFilterTextToText: Invalid number of columns %d, using default: 80",
num_columns);
num_columns = 80;
}
if (i > 0)
num_lines = i;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid number of lines %d, using default value: %d",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid number of lines %d, using default value: %d",
i, num_lines);
}
if ((val = cupsGetOption("page-width", num_options, options)) != NULL ||
if (i > 0)
num_columns = i;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid number of columns %d, using default value: %d",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid number of columns %d, using default value: %d",
i, num_columns);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Lines per page: %d; Characters per line: %d",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Lines per page: %d; Characters per line: %d",
num_lines, num_columns);
if ((val = cupsGetOption("page-left", num_options, options)) != NULL ||
val += 7;
page_left = atoi(val);
if (page_left < 0 || page_left > num_columns - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid left margin %d, setting to 0",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid left margin %d, setting to 0",
page_left);
page_left = 0;
}
val += 7;
page_right = atoi(val);
if (page_right < 0 || page_right > num_columns - page_left - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid right margin %d, setting to 0",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid right margin %d, setting to 0",
page_right);
page_right = 0;
}
val += 7;
page_top = atoi(val);
if (page_top < 0 || page_top > num_lines - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid top margin %d, setting to 0",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid top margin %d, setting to 0",
page_top);
page_top = 0;
}
val += 7;
page_bottom = atoi(val);
if (page_bottom < 0 || page_bottom > num_lines - page_top - 1) {
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid bottom margin %d, setting to 0",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid bottom margin %d, setting to 0",
page_bottom);
page_bottom = 0;
}
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Margins: Left (Columns): %d; Right (Columns): %d; Top (Lines): %d; Bottom (Lines): %d",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Margins: Left (Columns): %d; Right (Columns): %d; Top (Lines): %d; Bottom (Lines): %d",
page_left, page_right, page_top, page_bottom);
text_width = num_columns - page_left - page_right;
text_height = num_lines - page_top - page_bottom;
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Text area: Lines per page: %d; Characters per line: %d",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Text area: Lines per page: %d; Characters per line: %d",
text_height, text_width);
strcpy(encoding, "ASCII//IGNORE");
*p = toupper(*p);
}
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Output encoding: %s", encoding);
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Output encoding: %s", encoding);
if ((val = cupsGetOption("OverlongLines", num_options, options)) != NULL ||
(ipp = ippFindAttribute(job_attrs, "overlong-lines", IPP_TAG_ENUM))!=NULL ||
else if (!strcasecmp(val, "WrapAtWidth"))
overlong_lines = WRAPATWIDTH;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid value for OverlongLines: %s, using default value",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for OverlongLines: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Handling of overlong lines: %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Handling of overlong lines: %s",
(overlong_lines == TRUNCATE ? "Truncate at maximum width" :
(overlong_lines == WORDWRAP ? "Word-wrap" :
"Wrap exactly at maximum width")));
if (i > 0)
tab_width = i;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid tab width %d, using default value: %d",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid tab width %d, using default value: %d",
i, tab_width);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Tab width: %d", tab_width);
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Tab width: %d", tab_width);
if ((val = cupsGetOption("Pagination", num_options, options)) != NULL ||
(ipp = ippFindAttribute(job_attrs, "pagination", IPP_TAG_BOOLEAN))!=NULL ||
else if (is_false(val))
pagination = 0;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid value for Pagination: %s, using default value",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for Pagination: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Pagination (Print in defined pages): %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Pagination (Print in defined pages): %s",
(pagination ? "Yes" : "No"));
if ((val = cupsGetOption("SendFF", num_options, options)) != NULL ||
else if (is_false(val))
send_ff = 0;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid value for SendFF: %s, using default value",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for SendFF: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Send Form Feed character at end of page: %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Send Form Feed character at end of page: %s",
(send_ff ? "Yes" : "No"));
if ((val = cupsGetOption("NewlineCharacters", num_options, options)) !=
else if (!strcasecmp(val, "CRLF"))
newline_char = CRLF;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid value for NewlineCharacters: %s, using default value",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for NewlineCharacters: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Characters sent to make printer start a new line: %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Characters sent to make printer start a new line: %s",
(newline_char == LF ? "Line Feed (LF)" :
(newline_char == CR ? "Carriage Return (CR)" :
"Carriage Return (CR) and Line Feed (LF)")));
page_ranges = strdup(val);
}
if (page_ranges)
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Page selection: %s", page_ranges);
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Page selection: %s", page_ranges);
if ((val = cupsGetOption("page-set", num_options, options)) !=
NULL ||
even_pages = 1;
odd_pages = 1;
} else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid value for page-set: %s, using default value",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for page-set: %s, using default value",
val);
}
if (!even_pages || !odd_pages)
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Print %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Print %s",
(even_pages ? "only the even pages" :
(odd_pages ? "only the odd pages" :
"no pages")));
if (!strcasecmp(val, "reverse"))
reverse_order = 1;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid value for OutputOrder: %s, using default value",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for OutputOrder: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Print pages in reverse order: %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Print pages in reverse order: %s",
(reverse_order ? "Yes" : "No"));
if ((val = cupsGetOption("Collate", num_options, options)) != NULL ||
else if (is_false(val))
collate = 0;
else
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Invalid value for Collate: %s, using default value",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Invalid value for Collate: %s, using default value",
val);
}
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Collate copies: %s",
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Collate copies: %s",
(collate ? "Yes" : "No"));
/* Create a string to insert as the newline mark */
/* Something went wrong. */
if (errno == EINVAL)
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "texttotext: Conversion from UTF-8 to %s not available",
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Conversion from UTF-8 to %s not available",
encoding);
}else
{
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "texttotext: Error setting up conversion from UTF-8 to %s",
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Error setting up conversion from UTF-8 to %s",
encoding);
}
goto error;
/* Open the input file */
fd = inputfd;
if (fd < 0) {
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "texttotext: Unable to open input text file");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Unable to open input text file");
goto error;
}
ends with an incomplete UTF-8 character. Log
this fact. */
if (insize > 0 && incomplete_char){
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Input text file ends with incomplete UTF-8 character sequence, file possibly incomplete, but printing the successfully read part anyway");
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Input text file ends with incomplete UTF-8 character sequence, file possibly incomplete, but printing the successfully read part anyway");
}
/* Now write out the byte sequence to get into the
} else {
/* We found an illegal UTF-8 byte sequence here,
so error out at this point. */
- if(log) log(ld, FILTER_LOGLEVEL_ERROR, "texttotext: Illegal UTF-8 sequence found. Input file perhaps not UTF-8-encoded");
+ if(log) log(ld, FILTER_LOGLEVEL_ERROR, "cfFilterTextToText: Illegal UTF-8 sequence found. Input file perhaps not UTF-8-encoded");
result = -1;
break;
}
load) */
if (num_pages == 1)
{
- if(log) log(ld, FILTER_LOGLEVEL_INFO, "texttotext: 1 1");
+ if(log) log(ld, FILTER_LOGLEVEL_INFO, "cfFilterTextToText: 1 1");
}
} else if ((num_copies == 1 || !collate) && !reverse_order) {
/* Log the page output */
- if(log) log(ld, FILTER_LOGLEVEL_INFO, "texttotext: %d %d", num_pages, num_copies);
+ if(log) log(ld, FILTER_LOGLEVEL_INFO, "cfFilterTextToText: %d %d", num_pages, num_copies);
} else {
/* Save the page in the page array */
cupsArrayAdd(page_array, strdup(out_page));
close(fd);
if (iconv_close (cd) != 0)
- if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "texttotext: Error closing iconv encoding conversion session");
+ if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "cfFilterTextToText: Error closing iconv encoding conversion session");
/* Error out on an illegal UTF-8 sequence in the input file */
if (result < 0)
(reverse_order ? (page >= 1) : (page <= num_pages));
page += (reverse_order ? -1 : 1)) {
p = (char *)cupsArrayIndex(page_array, page - 1);
- if(log) log(ld, FILTER_LOGLEVEL_INFO, "texttotext: %d %d", page, (collate ? 1 : num_copies));
+ if(log) log(ld, FILTER_LOGLEVEL_INFO, "cfFilterTextToText: %d %d", page, (collate ? 1 : num_copies));
}
/* Clean up */
for (page = 0; page < num_pages; page ++) {
#include <ppd/ppd.h>
int /* O - Error status */
-universal(int inputfd, /* I - File descriptor input stream */
+cfFilterUniversal(int inputfd, /* I - File descriptor input stream */
int outputfd, /* I - File descriptor output stream */
int inputseekable, /* I - Is input stream seekable? */
- filter_data_t *data, /* I - Job and printer data */
+ cf_filter_data_t *data, /* I - Job and printer data */
void *parameters) /* I - Filter-specific parameters
(input/output format) */
{
char input_type[256];
char output_super[16];
char output_type[256];
- filter_out_format_t *outformat;
- filter_filter_in_chain_t *filter, *next;
- universal_parameter_t universal_parameters;
+ cf_filter_out_format_t *outformat;
+ cf_filter_filter_in_chain_t *filter, *next;
+ cf_filter_universal_parameter_t universal_parameters;
ppd_file_t *ppd;
ppd_cache_t *cache;
filter_logfunc_t log = data->logfunc;
void *ld = data->logdata;
int ret = 0;
- universal_parameters = *(universal_parameter_t *)parameters;
+ universal_parameters = *(cf_filter_universal_parameter_t *)parameters;
input = universal_parameters.input_format;
if (input == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "universal: No input data format supplied.");
+ "cfFilterUniversal: No input data format supplied.");
return (1);
}
final_output = universal_parameters.output_format;
if (final_output == NULL)
{
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "universal: No output data format supplied.");
+ "cfFilterUniversal: No output data format supplied.");
return (1);
}
strncpy(output, final_output, sizeof(output) - 1);
char *filter;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: \"*cupsFilter(2): ...\" lines in the PPD file:");
+ "cfFilterUniversal: \"*cupsFilter(2): ...\" lines in the PPD file:");
for (filter = (char *)cupsArrayFirst(cache->filters);
filter;
int cost;
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: %s", filter);
+ "cfFilterUniversal: %s", filter);
/* String of the "*cupsfilter:" or "*cupsfilter2:" line */
strncpy(buf, filter, sizeof(buf) - 1);
strcasecmp(in, "application/postscript") == 0))
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: --> Selecting this line");
+ "cfFilterUniversal: --> Selecting this line");
/* Take the input format of the line as output format for us */
strncpy(output, in, sizeof(output));
/* Update the minimum cost found */
if (lowest_cost == 0)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Cost value is down to zero, stopping reading further lines");
+ "cfFilterUniversal: Cost value is down to zero, stopping reading further lines");
break;
}
}
if (lowest_cost == INT_MAX && coststr)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: PPD uses \"*cupsFilter: ...\" lines, so we always convert to format given by FINAL_CONTENT_TYPE");
+ "cfFilterUniversal: PPD uses \"*cupsFilter: ...\" lines, so we always convert to format given by FINAL_CONTENT_TYPE");
break;
}
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "universal: Invalid \"*cupsFilter2: ...\" line in PPD: %s",
+ "cfFilterUniversal: Invalid \"*cupsFilter2: ...\" line in PPD: %s",
filter);
}
if (strcasecmp(output, final_output) != 0)
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Converting from %s to %s, final output will be %s",
+ "cfFilterUniversal: Converting from %s to %s, final output will be %s",
input, output, final_output);
}
else
{
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Converting from %s to %s", input, output);
+ "cfFilterUniversal: Converting from %s to %s", input, output);
}
sscanf(input, "%15[^/]/%255s", input_super, input_type);
!strcmp(output_type, "pwg-raster") ||
!strcmp(output_type, "PCLm"))
{
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
if (!strcmp(output_type, "pwg-raster") ||
(!strcmp(output_type, "vnd.cups-raster") &&
!strcmp(final_output, "image/pwg-raster")))
- *outformat = OUTPUT_FORMAT_PWG_RASTER;
+ *outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (!strcmp(output_type, "urf") ||
(!strcmp(output_type, "vnd.cups-raster") &&
!strcmp(final_output, "image/urf")))
- *outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (!strcmp(output_type, "PCLm") ||
(!strcmp(output_type, "vnd.cups-raster") &&
!strcmp(final_output, "applicationn/PCLm")))
- *outformat = OUTPUT_FORMAT_PCLM;
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = imagetoraster;
+ *outformat = CF_FILTER_OUT_FORMAT_PCLM;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterImageToRaster;
filter->parameters = outformat;
filter->name = "imagetoraster";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
if (!strcmp(output, "image/pwg-raster"))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_PWG_RASTER;
- filter->function = rastertopwg;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
+ filter->function = cfFilterRasterToPWG;
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(output, "application/PCLm"))
{
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_PCLM;
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = rastertopdf;
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_PCLM;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterRasterToPDF;
filter->parameters = outformat;
filter->name = "rastertopclm";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(output, "image/urf"))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_APPLE_RASTER;
- filter->function = rastertopwg;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
+ filter->function = cfFilterRasterToPWG;
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
}
else
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = imagetopdf;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterImageToPDF;
filter->parameters = NULL;
filter->name = "imagetopdf";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
}
else
{
if (!strcmp(input, "application/postscript"))
{
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_PDF;
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = ghostscript;
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_PDF;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterGhostscript;
filter->parameters = outformat;
filter->name = "ghostscript";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(input_super, "text") ||
(!strcmp(input_super, "application") && input_type[0] == 'x'))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- texttopdf_parameter_t* parameters =
- (texttopdf_parameter_t *) malloc(sizeof(texttopdf_parameter_t));
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ cf_filter_texttopdf_parameter_t* parameters =
+ (cf_filter_texttopdf_parameter_t *) malloc(sizeof(cf_filter_texttopdf_parameter_t));
*parameters = universal_parameters.texttopdf_params;
- filter->function = texttopdf;
+ filter->function = cfFilterTextToPDF;
filter->parameters = parameters;
filter->name = "texttopdf";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain",
+ "cfFilterUniversal: Adding %s to chain",
filter->name);
}
else if (!strcmp(input, "image/urf") ||
!strcmp(input, "image/pwg-raster") ||
!strcmp(input, "application/vnd.cups-raster"))
{
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_PDF;
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = rastertopdf;
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_PDF;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterRasterToPDF;
filter->parameters = outformat;
filter->name = "rastertopdf";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strcmp(input_type, "vnd.adobe-reader-postscript"))
{
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
if (!strcmp(output_type, "pwg-raster"))
- *outformat = OUTPUT_FORMAT_PWG_RASTER;
+ *outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if(!strcmp(output_type, "urf") ||
(!strcmp(output_type, "vnd.cups-raster") &&
!strcmp(final_output, "image/urf")))
- *outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if(!strcmp(output_type, "PCLm"))
- *outformat = OUTPUT_FORMAT_PCLM;
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = ghostscript;
+ *outformat = CF_FILTER_OUT_FORMAT_PCLM;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterGhostscript;
filter->parameters = outformat;
filter->name = "ghostscript";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
if (!strcmp(output, "image/urf"))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_APPLE_RASTER;
- filter->function = rastertopwg;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
+ filter->function = cfFilterRasterToPWG;
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain",
+ "cfFilterUniversal: Adding %s to chain",
filter->name);
}
else if (strcmp(output_type, "pwg-raster") &&
strcmp(output_type, "vnd.cups-raster") &&
strcmp(output_type, "PCLm"))
{
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_PDF;
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = rastertopdf;
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_PDF;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterRasterToPDF;
filter->parameters = outformat;
filter->name = "rastertopdf";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
}
else if (!strcmp(input, "application/vnd.cups-pdf-banner"))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = bannertopdf;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterBannerToPDF;
filter->parameters = NULL;
filter->name = "bannertopdf";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
else if (!strstr(input_type, "pdf"))
{
if (strcmp(output_type, "pdf")) {
if (strcmp(input_type, "vnd.cups-pdf"))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = pdftopdf;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterPDFToPDF;
filter->parameters = strdup(output);
filter->name = "pdftopdf";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
}
if (strcmp(output_type, "vnd.cups-pdf"))
!strcmp(output_type, "pwg-raster") ||
!strcmp(output_type, "PCLm"))
{
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
if (!strcmp(output_type, "pwg-raster"))
- *outformat = OUTPUT_FORMAT_PWG_RASTER;
+ *outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (!strcmp(output_type, "urf") ||
(!strcmp(output_type, "vnd.cups-raster") &&
!strcmp(final_output, "image/urf")))
- *outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if(!strcmp(output_type, "PCLm"))
- *outformat = OUTPUT_FORMAT_PCLM;
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = ghostscript;
+ *outformat = CF_FILTER_OUT_FORMAT_PCLM;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterGhostscript;
filter->parameters = outformat;
filter->name = "ghostscript";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain",
+ "cfFilterUniversal: Adding %s to chain",
filter->name);
if (!strcmp(output, "image/urf"))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- outformat = malloc(sizeof(filter_out_format_t));
- *outformat = OUTPUT_FORMAT_APPLE_RASTER;
- filter->function = rastertopwg;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ outformat = malloc(sizeof(cf_filter_out_format_t));
+ *outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
+ filter->function = cfFilterRasterToPWG;
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain, filter);
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain",
+ "cfFilterUniversal: Adding %s to chain",
filter->name);
}
}
else if(!strcmp(output, "application/postscript") ||
!strcmp(output, "application/vnd.cups-postscript"))
{
- filter = malloc(sizeof(filter_filter_in_chain_t));
- filter->function = pdftops;
+ filter = malloc(sizeof(cf_filter_filter_in_chain_t));
+ filter->function = cfFilterPDFToPS;
filter->parameters = NULL;
filter->name = "pdftops";
if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
- "universal: Adding %s to chain", filter->name);
+ "cfFilterUniversal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain, filter);
}
else
if (ret) {
if (log) log(ld, FILTER_LOGLEVEL_ERROR,
- "universal: Unsupported combination of input and output formats: %s -> %s",
+ "cfFilterUniversal: Unsupported combination of input and output formats: %s -> %s",
input, output);
}
else
/* Do the dirty work ... */
- ret = filterChain(inputfd, outputfd, inputseekable, data, filter_chain);
+ ret = cfFilterChain(inputfd, outputfd, inputseekable, data, filter_chain);
- for (filter = (filter_filter_in_chain_t *)cupsArrayFirst(filter_chain);
+ for (filter = (cf_filter_filter_in_chain_t *)cupsArrayFirst(filter_chain);
filter; filter = next)
{
- next = (filter_filter_in_chain_t *)cupsArrayNext(filter_chain);
+ next = (cf_filter_filter_in_chain_t *)cupsArrayNext(filter_chain);
free(filter->parameters);
free(filter);
}
#endif /* HAVE_SIGSET */
/*
- * Fire up the pdftoraster() filter function
+ * Fire up the cfFilterPDFToRaster() filter function
*/
char buf[1024];
datadir = CUPS_DATADIR;
snprintf(buf, sizeof(buf), "%s/data", datadir);
- ret = filterCUPSWrapper(argc, argv, bannertopdf, buf, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterBannerToPDF, buf, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: bannertopdf filter function failed.\n");
int havefilter, havegstoraster;
dstr_t *filelist;
list_t * arglist;
- filter_data_t temp;
- filter_data_t *data = &temp;
+ cf_filter_data_t temp;
+ cf_filter_data_t *data = &temp;
data->logdata = NULL;
- data->logfunc = cups_logfunc;
+ data->logfunc = cfCUPSLogFunc;
arglist = list_create_from_array(argc -1, (void**)&argv[1]);
if (argc == 2 && (arglist_find(arglist, "--version") || arglist_find(arglist, "--help") ||
/*
- * PostScript to PDF filter (based on ghostscript() filter function).
+ * PostScript to PDF filter (based on cfFilterGhostscript() filter function).
*/
#endif /* HAVE_SIGSET */
/*
- * Fire up the ghostscript() filter function.
+ * Fire up the cfFilterGhostscript() filter function.
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_PDF;
- ret = filterCUPSWrapper(argc, argv, ghostscript, &outformat, &JobCanceled);
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PDF;
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterGhostscript, &outformat,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: gstopdf filter failed.\n");
/*
- * PostScript/PDF to PCL-XL filter (based on ghostscript() filter function).
+ * PostScript/PDF to PCL-XL filter (based on cfFilterGhostscript() filter
+ * function).
*/
#endif /* HAVE_SIGSET */
/*
- * Fire up the ghostscript() filter function.
+ * Fire up the cfFilterGhostscript() filter function.
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_PXL;
- ret = filterCUPSWrapper(argc, argv, ghostscript, &outformat, &JobCanceled);
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PXL;
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterGhostscript, &outformat,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: gstopxl filter failed.\n");
/*
- * PostScript/PDF to Raster filter (based on ghostscript() filter function).
+ * PostScript/PDF to Raster filter (based on cfFilterGhostscript() filter
+ * function).
*/
#endif /* HAVE_SIGSET */
/*
- * Fire up the ghostscript() filter function.
+ * Fire up the cfFilterGhostscript() filter function.
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t) {
if (strcasestr(t, "pwg"))
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (strcasestr(t, "urf"))
- outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (strcasestr(t, "pclm"))
- outformat = OUTPUT_FORMAT_PCLM;
+ outformat = CF_FILTER_OUT_FORMAT_PCLM;
}
- ret = filterCUPSWrapper(argc, argv, ghostscript, &outformat, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterGhostscript, &outformat,
+ &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: gstoraster filter failed.\n");
/*
- * Image-to-PDF filter for CUPS (based on imagetopdf() filter function).
+ * Image-to-PDF filter for CUPS (based on cfFilterImageToPDF() filter function).
*
* Copyright © 2020 by Till Kamppeter
* Copyright © 2007-2018 by Apple Inc.
#endif /* HAVE_SIGSET */
/*
- * Fire up the imagetopdf() filter function
+ * Fire up the cfFilterImageToPDF() filter function
*/
- ret = filterCUPSWrapper(argc, argv, imagetopdf, NULL, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterImageToPDF, NULL, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: imagetopdf filter function failed.\n");
/*
- * Image-to-PostScript filter for CUPS (based on imagetops() filter function)
+ * Image-to-PostScript filter for CUPS (based on cfFilterImageToPS() filter function)
*
* Copyright © 2020 by Till Kamppeter
* Copyright © 2007-2018 by Apple Inc.
#endif /* HAVE_SIGSET */
/*
- * Fire up the imagetops() filter function
+ * Fire up the cfFilterImageToPS() filter function
*/
- ret = filterCUPSWrapper(argc, argv, imagetops, NULL, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterImageToPS, NULL, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: imagetops filter function failed.\n");
/*
- * Image-to-Raster filter for CUPS (based on imagetoraster() filter function).
+ * Image-to-Raster filter for CUPS (based on cfFilterImageToRaster() filter function).
*
* Copyright © 2020 by Till Kamppeter
* Copyright © 2007-2018 by Apple Inc.
#endif /* HAVE_SIGSET */
/*
- * Fire up the imagetoraster() filter function
+ * Fire up the cfFilterImageToRaster() filter function
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t) {
if (strcasestr(t, "pwg"))
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (strcasestr(t, "urf"))
- outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (strcasestr(t, "pclm"))
- outformat = OUTPUT_FORMAT_PCLM;
+ outformat = CF_FILTER_OUT_FORMAT_PCLM;
}
- ret = filterCUPSWrapper(argc, argv, imagetoraster, &outformat, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterImageToRaster, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: imagetoraster filter function failed.\n");
#endif /* HAVE_SIGSET */
/*
- * Fire up the mupdftopwg() filter function
+ * Fire up the cfFilterMuPDFToPWG() filter function
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t) {
if (strcasestr(t, "pwg"))
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (strcasestr(t, "urf"))
- outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (strcasestr(t, "pclm"))
- outformat = OUTPUT_FORMAT_PCLM;
+ outformat = CF_FILTER_OUT_FORMAT_PCLM;
}
- ret = filterCUPSWrapper(argc, argv, mupdftopwg, &outformat, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterMuPDFToPWG, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: mupdftopwg filter function failed.\n");
int ret;
/*
- * Fire up the pclmtoraster() filter function
+ * Fire up the cfFilterPCLmToRaster() filter function
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_PWG_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t) {
if (strcasestr(t, "urf"))
- outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (strcasestr(t, "cups-raster"))
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
}
- ret = filterCUPSWrapper(argc, argv, pclmtoraster, &outformat, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterPCLmToRaster, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pclmtoraster filter function failed.\n");
/*
- * Pdf to pdf filter based on pdftopdf() filter function.
+ * Pdf to pdf filter based on cfFilterPDFToPDF() filter function.
*/
signal(SIGTERM, cancel_job);
#endif /* HAVE_SIGSET */
char *t = getenv("FINAL_CONTENT_TYPE");
- ret = filterCUPSWrapper(argc, argv, pdftopdf, t, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterPDFToPDF, t, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pdftopdf filter function failed.\n");
/*
- * PDF-to-PostScript filter for CUPS (based on pdftops() filter function).
+ * PDF-to-PostScript filter for CUPS (based on cfFilterPDFToPS() filter function).
*
* Copyright © 2020 by Till Kamppeter
* Copyright © 2007-2018 by Apple Inc.
#endif /* HAVE_SIGSET */
/*
- * Fire up the pstops() filter function
+ * Fire up the cfFilterPSToPS() filter function
*/
- ret = filterCUPSWrapper(argc, argv, pdftops, NULL, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterPDFToPS, NULL, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pdftops filter function failed.\n");
#endif /* HAVE_SIGSET */
/*
- * Fire up the pdftoraster() filter function
+ * Fire up the cfFilterPDFToRaster() filter function
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t) {
if (strcasestr(t, "pwg"))
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (strcasestr(t, "cups"))
- outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
else if (strcasestr(t, "urf"))
- outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (strcasestr(t, "pclm"))
- outformat = OUTPUT_FORMAT_PCLM;
+ outformat = CF_FILTER_OUT_FORMAT_PCLM;
}
- ret = filterCUPSWrapper(argc, argv, pdftoraster, &outformat, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterPDFToRaster, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pdftoraster filter function failed.\n");
/*
- * PostScript filter for CUPS (based on pstops() filter function).
+ * PostScript filter for CUPS (based on cfFilterPSToPS() filter function).
*
* Copyright © 2020 by Till Kamppeter
* Copyright © 2007-2018 by Apple Inc.
#endif /* HAVE_SIGSET */
/*
- * Fire up the pstops() filter function
+ * Fire up the cfFilterPSToPS() filter function
*/
- ret = filterCUPSWrapper(argc, argv, pstops, NULL, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterPSToPS, NULL, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pstops filter function failed.\n");
#endif /* HAVE_SIGSET */
/*
- * Fire up the pdftoraster() filter function
+ * Fire up the cfFilterPDFToRaster() filter function
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_CUPS_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_CUPS_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t) {
if (strcasestr(t, "pwg"))
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (strcasestr(t, "urf"))
- outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
else if (strcasestr(t, "pclm"))
- outformat = OUTPUT_FORMAT_PCLM;
+ outformat = CF_FILTER_OUT_FORMAT_PCLM;
}
- ret = filterCUPSWrapper(argc, argv, pwgtoraster, &outformat, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterPWGToRaster, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: pwgtoraster filter function failed.\n");
* Log function for the library functions, standard CUPS logging to stderr...
*/
- logfunc = cups_logfunc;
+ logfunc = cfCUPSLogFunc;
ld = NULL;
/*
/*
- * Raster to pclm filter(based on rastertopdf() filter function).
+ * Raster to pclm filter(based on cfFilterRasterToPDF() filter function).
*/
#endif /* HAVE_SIGSET */
/*
- * Fire up the rastertopdf() filter function.
+ * Fire up the cfFilterRasterToPDF() filter function.
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_PCLM;
- ret = filterCUPSWrapper(argc, argv, rastertopdf, &outformat, &JobCanceled);
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PCLM;
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterRasterToPDF, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: rastertopclm filter failed.\n");
* Prototypes...
*/
-void StartPage(filter_data_t *data, ppd_file_t *ppd, cups_page_header2_t *header, int job_id,
+void StartPage(cf_filter_data_t *data, ppd_file_t *ppd, cups_page_header2_t *header, int job_id,
const char *user, const char *title, int num_options,
cups_option_t *options);
void EndPage(ppd_file_t *ppd, cups_page_header2_t *header);
*/
void
-StartPage(filter_data_t *data, /* I - filter data */
+StartPage(cf_filter_data_t *data, /* I - filter data */
ppd_file_t *ppd, /* I - PPD file */
cups_page_header2_t *header, /* I - Page header */
int job_id, /* I - Job ID */
* Log function for the library functions, standard CUPS logging to stderr...
*/
- logfunc = cups_logfunc;
+ logfunc = cfCUPSLogFunc;
ld = NULL;
/*
/*
* Check command-line...
*/
- filter_data_t temp;
- filter_data_t *data = &temp;
+ cf_filter_data_t temp;
+ cf_filter_data_t *data = &temp;
data->printer = getenv("PRINTER");
data->logdata = NULL;
- data->logfunc = cups_logfunc;
+ data->logfunc = cfCUPSLogFunc;
if (argc < 6 || argc > 7)
{
fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
/*
- * Raster to pdf filter(based on rastertopdf() filter function).
+ * Raster to pdf filter(based on cfFilterRasterToPDF() filter function).
*/
#endif /* HAVE_SIGSET */
/*
- * Fire up the rastertopdf() filter function.
+ * Fire up the cfFilterRasterToPDF() filter function.
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_PDF;
- ret = filterCUPSWrapper(argc, argv, rastertopdf, &outformat, &JobCanceled);
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PDF;
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterRasterToPDF, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: rastertopdf filter failed.\n");
#endif /* HAVE_SIGSET */
/*
- * Fire up the rastertops() filter function
+ * Fire up the cfFilterRasterToPS() filter function
*/
- ret = filterCUPSWrapper(argc, argv, rastertops, NULL, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterRasterToPS, NULL, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: rastertops filter function failed.\n");
#endif /* HAVE_SIGSET */
/*
- * Fire up the pdftoraster() filter function
+ * Fire up the cfFilterPDFToRaster() filter function
*/
- filter_out_format_t outformat = OUTPUT_FORMAT_PWG_RASTER;
+ cf_filter_out_format_t outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
char *t = getenv("FINAL_CONTENT_TYPE");
if (t) {
if (strcasestr(t, "pwg"))
- outformat = OUTPUT_FORMAT_PWG_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_PWG_RASTER;
else if (strcasestr(t, "urf"))
- outformat = OUTPUT_FORMAT_APPLE_RASTER;
+ outformat = CF_FILTER_OUT_FORMAT_APPLE_RASTER;
}
- ret = filterCUPSWrapper(argc, argv, rastertopwg, &outformat, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterRasterToPWG, &outformat, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: rastertopwg filter function failed.\n");
#endif /* HAVE_SIGSET */
/*
- * Fire up the texttopdf() filter function
+ * Fire up the cfFilterTextToPDF() filter function
*/
- texttopdf_parameter_t parameters;
+ cf_filter_texttopdf_parameter_t parameters;
char *p;
if ((p = getenv("CUPS_DATADIR")) != NULL)
else
parameters.classification = NULL;
- ret = filterCUPSWrapper(argc, argv, texttopdf, ¶meters, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterTextToPDF, ¶meters, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: texttopdf filter function failed.\n");
#endif /* HAVE_SIGSET */
/*
- * Fire up the texttotext() filter function
+ * Fire up the cfFilterTextToText() filter function
*/
- ret = filterCUPSWrapper(argc, argv, texttotext, NULL, &JobCanceled);
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterTextToText, NULL, &JobCanceled);
if (ret)
fprintf(stderr, "ERROR: texttotext filter function failed.\n");
{
int ret;
char *p;
- universal_parameter_t universal_parameters;
+ cf_filter_universal_parameter_t universal_parameters;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
else
universal_parameters.texttopdf_params.classification = NULL;
- ret = filterCUPSWrapper(argc, argv, universal, &universal_parameters,
+ ret = cfFilterCUPSWrapper(argc, argv, cfFilterUniversal, &universal_parameters,
&JobCanceled);
if (ret)