[gs-cvs] rev 7963 - in branches/gs-esp-gpl-merger/contrib/pcl3:
eprn src
giles at ghostscript.com
giles at ghostscript.com
Sun May 13 09:17:02 PDT 2007
Author: giles
Date: 2007-05-13 09:17:02 -0700 (Sun, 13 May 2007)
New Revision: 7963
Modified:
branches/gs-esp-gpl-merger/contrib/pcl3/eprn/eprnparm.c
branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.c
branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.h
branches/gs-esp-gpl-merger/contrib/pcl3/src/gdevpcl3.c
Log:
Update the pcl3 output device to use the api redirectable eprintf() macros
instead of stderr. fputs() has been replaced by eprintf() for clarity; the
performance difference is not significant as used here.
Note that this patch includes an incompatible change to the eprn api, where eprn_FlagMismatchReporter no longer takes a FILE* for writing its output.
Modified: branches/gs-esp-gpl-merger/contrib/pcl3/eprn/eprnparm.c
===================================================================
--- branches/gs-esp-gpl-merger/contrib/pcl3/eprn/eprnparm.c 2007-05-13 16:13:40 UTC (rev 7962)
+++ branches/gs-esp-gpl-merger/contrib/pcl3/eprn/eprnparm.c 2007-05-13 16:17:02 UTC (rev 7963)
@@ -146,7 +146,7 @@
/* First we construct a properly NUL-terminated string */
s = (char *) malloc(in_value->size + 1);
if (s == NULL) {
- fprintf(stderr, ERRPREF
+ eprintf1(ERRPREF
"Memory allocation failure in eprn_get_int(): %s.\n",
strerror(errno));
return_error(gs_error_VMerror);
@@ -352,8 +352,7 @@
'eprn->media_overrides' should be NULL.
The function returns zero on success and a non-zero ghostscript error value
- otherwise. In the latter case, an error message will have been issued on
- stderr.
+ otherwise. In the latter case, an error message will have been issued.
******************************************************************************/
@@ -379,7 +378,7 @@
/* Open the file */
if ((f = fopen(eprn->media_file, "r")) == NULL) {
- fprintf(stderr, "%s" ERRPREF "Error opening the media configuration file\n"
+ eprintf5("%s" ERRPREF "Error opening the media configuration file\n"
"%s `%s'\n%s for reading: %s.\n",
epref, epref, eprn->media_file, epref, strerror(errno));
return_error(gs_error_invalidfileaccess);
@@ -395,7 +394,7 @@
/* Check for buffer overflow */
if ((s = strchr(buffer, '\n')) == NULL && fgetc(f) != EOF) {
- fprintf(stderr, "%s" ERRPREF "Exceeding line length %d in "
+ eprintf5("%s" ERRPREF "Exceeding line length %d in "
"media configuration file\n%s %s, line %d.\n",
epref, BUFFER_SIZE - 2 /* '\n'+'\0' */, epref, eprn->media_file, line);
cleanup();
@@ -453,7 +452,7 @@
new_list = (eprn_PageDescription *)
realloc(list, (read+1)*sizeof(eprn_PageDescription));
if (new_list == NULL) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"Memory allocation failure in eprn_read_media_data(): %s.\n",
epref, strerror(errno));
cleanup();
@@ -477,14 +476,14 @@
{
ms_MediaCode code = ms_find_code_from_name(s, eprn->flag_desc);
if (code == ms_none) {
- fprintf(stderr, "%s" ERRPREF "Unknown media name (%s) in "
+ eprintf5("%s" ERRPREF "Unknown media name (%s) in "
"media configuration file\n%s %s, line %d.\n",
epref, s, epref, eprn->media_file, line);
cleanup();
return_error(gs_error_rangecheck);
}
if (code & MS_ROTATED_FLAG) {
- fprintf(stderr, "%s" ERRPREF "Invalid substring \"" MS_ROTATED_STRING
+ eprintf5("%s" ERRPREF "Invalid substring \"" MS_ROTATED_STRING
"\" in media name (%s)\n"
"%s in media configuration file %s, line %d.\n",
epref, s, epref, eprn->media_file, line);
@@ -499,7 +498,7 @@
¤t->bottom, ¤t->right, ¤t->top, &chars_read) != 4 ||
t[chars_read] != '\0') {
if (*t != '\0') *(t-1) = ' '; /* remove NUL after media name */
- fprintf(stderr, "%s" ERRPREF
+ eprintf5("%s" ERRPREF
"Syntax error in media configuration file %s, line %d:\n%s %s\n",
epref, eprn->media_file, line, epref, buffer);
cleanup();
@@ -509,7 +508,7 @@
/* Check for sign */
if (current->left < 0 || current->bottom < 0 || current->right < 0 ||
current->top < 0) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf4("%s" ERRPREF
"Ghostscript does not support negative margins (line %d in the\n"
"%s media configuration file %s).\n",
epref, line, epref, eprn->media_file);
@@ -530,14 +529,14 @@
The user might not notice the reason without help, hence we check. */
if (ms_without_flags(current->code) == ms_CustomPageSize &&
eprn->cap->custom == NULL)
- fprintf(stderr, "%s" WARNPREF "The media configuration file %s\n"
+ eprintf6("%s" WARNPREF "The media configuration file %s\n"
"%s contains a custom page size entry in line %d, "
"but custom page sizes\n"
"%s are not supported by the %s.\n",
wpref, eprn->media_file, wpref, line, wpref, eprn->cap->name);
}
if (ferror(f)) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"Unidentified system error while reading `%s'.\n",
epref, eprn->media_file);
cleanup();
@@ -547,7 +546,7 @@
/* Was the file empty? */
if (read == 0) {
- fprintf(stderr, "%s" ERRPREF "The media configuration file %s\n"
+ eprintf3("%s" ERRPREF "The media configuration file %s\n"
"%s does not contain any media information.\n",
epref, eprn->media_file, epref);
return_error(gs_error_rangecheck);
@@ -557,7 +556,7 @@
eprn->media_overrides = (eprn_PageDescription *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), read + 1,
sizeof(eprn_PageDescription), "eprn_read_media_data");
if (eprn->media_overrides == NULL) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf1("%s" ERRPREF
"Memory allocation failure from gs_malloc() in eprn_read_media_data().\n",
epref);
free(list);
@@ -585,8 +584,7 @@
from the specified media configuration file.
The return code will be zero an success and a ghostscript error code
- otherwise. In the latter case, an error message will have been issued on
- stderr.
+ otherwise. In the latter case, an error message will have been issued.
The 'length' may be positive in which case it denotes the length of the
string 'media_file' or zero in which case the string is assumed to be
@@ -629,7 +627,7 @@
eprn->media_file = (char *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), length + 1, sizeof(char),
"eprn_set_media_data");
if (eprn->media_file == NULL) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf1("%s" ERRPREF
"Memory allocation failure from gs_malloc() in "
"eprn_set_media_data().\n",
epref);
@@ -928,9 +926,9 @@
rc = eprn_get_int(&string_value, eprn_colour_model_list, &temp); \
if (rc != 0) { \
if (rc != gs_error_VMerror) { \
- fprintf(stderr, "%s" ERRPREF "Unknown colour model: `", epref); \
- fwrite(string_value.data, sizeof(char), string_value.size, stderr); \
- fputs("'.\n", stderr); \
+ eprintf1("%s" ERRPREF "Unknown colour model: `", epref); \
+ errwrite(string_value.data, sizeof(char)*string_value.size); \
+ eprintf("'.\n"); \
} \
last_error = rc; \
param_signal_error(plist, pname, last_error); \
@@ -994,7 +992,7 @@
eprn->black_levels = temp;
}
else {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"The value for BlackLevels is outside the range permitted: %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
@@ -1011,7 +1009,7 @@
eprn->non_black_levels = temp;
}
else {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"The value for CMYLevels is outside the range permitted: %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
@@ -1025,8 +1023,8 @@
bool temp;
if ((rc = param_read_bool(plist, "CUPSAccounting", &temp)) == 0) {
if (eprn->CUPS_accounting && !temp)
- fputs(CUPS_WARNPREF WARNPREF
- "Attempt to set CUPSAccounting from true to false.\n", stderr);
+ eprintf(CUPS_WARNPREF WARNPREF
+ "Attempt to set CUPSAccounting from true to false.\n");
else eprn->CUPS_accounting = temp;
}
else if (rc < 0) last_error = rc;
@@ -1042,10 +1040,10 @@
eprn->intensity_rendering = temp;
}
else {
- fprintf(stderr, "%s" ERRPREF "Invalid method for IntensityRendering: `",
+ eprintf1("%s" ERRPREF "Invalid method for IntensityRendering: `",
epref);
- fwrite(string_value.data, sizeof(char), string_value.size, stderr);
- fputs("'.\n", stderr);
+ errwrite(string_value.data, sizeof(char)*string_value.size);
+ eprintf("'.\n");
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
}
@@ -1066,7 +1064,7 @@
eprn->default_orientation = temp;
}
else {
- fprintf(stderr,
+ eprintf2(
"%s" ERRPREF "LeadingEdge may only have values 0 to 3, not %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
@@ -1111,7 +1109,7 @@
/* Current (up to at least gs 6.50) ghostscript versions do not accept
negative MediaPosition values. */
if (eprn->media_position < 0)
- fprintf(stderr, "%s" WARNPREF
+ eprintf3("%s" WARNPREF
"Ghostscript does not accept negative values (%d) for the\n"
"%s `MediaPosition' parameter.\n",
wpref, eprn->media_position, wpref);
@@ -1145,7 +1143,7 @@
eprn->pagecount_file = (char *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), string_value.size + 1,
sizeof(char), "eprn_put_params");
if (eprn->pagecount_file == NULL) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf1( "%s" ERRPREF
"Memory allocation failure from gs_malloc() in eprn_put_params().\n",
epref);
last_error = gs_error_VMerror;
@@ -1167,7 +1165,7 @@
eprn->non_black_levels = temp;
}
else {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"The value for RGBLevels is outside the range permitted: %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
@@ -1187,7 +1185,7 @@
*/
if ((rc = param_read_int(plist, (pname = "BitsPerPixel"), &temp)) == 0) {
if (temp != dev->color_info.depth) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf3("%s" ERRPREF
"Attempt to set `BitsPerPixel' to a value (%d)\n"
"%s other than the one selected by the driver.\n",
epref, temp, epref);
Modified: branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.c
===================================================================
--- branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.c 2007-05-13 16:13:40 UTC (rev 7962)
+++ branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.c 2007-05-13 16:17:02 UTC (rev 7963)
@@ -95,6 +95,7 @@
#ifdef EPRN_TRACE
#include "gdebug.h"
#endif /* EPRN_TRACE */
+#include "gxstdio.h"
/* Special headers for this device */
#ifndef EPRN_NO_PAGECOUNTFILE
@@ -143,8 +144,8 @@
"! eprn_get_initial_matrix(): code is still ms_none.\n");
#endif
if (eprn_set_page_layout(dev) != 0)
- fputs(" Processing can't be stopped at this point although this error "
- "occurred.\n", stderr);
+ eprintf(" Processing can't be stopped at this point although this error "
+ "occurred.\n");
/* The current function has a signature without the ability to signal
an error condition. */
}
@@ -303,17 +304,17 @@
Function: print_flags
- Print a textual description of 'flags' on 'f'.
+ Print a textual description of 'flags' to the error stream.
******************************************************************************/
-static void print_flags(FILE *f, ms_MediaCode flags, const ms_Flag *user_flags)
+static void print_flags(ms_MediaCode flags, const ms_Flag *user_flags)
{
/* Non-standard flags first */
if (user_flags != NULL) {
while (user_flags->code != ms_none) {
if (user_flags->code & flags) {
- fputs(user_flags->name, f);
+ errprintf(user_flags->name);
flags &= ~user_flags->code;
}
user_flags++;
@@ -321,17 +322,17 @@
}
/* Standard substrings */
- if (flags & MS_SMALL_FLAG) fputs(MS_SMALL_STRING, f);
- if (flags & MS_BIG_FLAG ) fputs(MS_BIG_STRING, f);
- if (flags & MS_EXTRA_FLAG) fputs(MS_EXTRA_STRING, f);
+ if (flags & MS_SMALL_FLAG) eprintf(MS_SMALL_STRING);
+ if (flags & MS_BIG_FLAG ) eprintf(MS_BIG_STRING);
+ if (flags & MS_EXTRA_FLAG) eprintf(MS_EXTRA_STRING);
flags &= ~(MS_SMALL_FLAG | MS_BIG_FLAG | MS_EXTRA_FLAG);
/* Completeness check */
if (flags & ~MS_TRANSVERSE_FLAG)
- fprintf(f, "0x%04X", (unsigned int)(flags & ~MS_TRANSVERSE_FLAG));
+ eprintf1("0x%04X", (unsigned int)(flags & ~MS_TRANSVERSE_FLAG));
/* Standard qualifier */
- if (flags & MS_TRANSVERSE_FLAG) fputs("." MS_TRANSVERSE_STRING, f);
+ if (flags & MS_TRANSVERSE_FLAG) eprintf("." MS_TRANSVERSE_STRING);
return;
}
@@ -347,37 +348,37 @@
If the derived device has set a flag mismatch error reporting function, the
call will be passed to that function. Otherwise a general error message is
- written on 'err'.
+ written through the graphics library's eprintf().
******************************************************************************/
-static void eprn_flag_mismatch(FILE *err, const struct s_eprn_Device *eprn,
+static void eprn_flag_mismatch(const struct s_eprn_Device *eprn,
bool no_match)
{
- if (eprn->fmr != NULL) (*eprn->fmr)(err, eprn, no_match);
+ if (eprn->fmr != NULL) (*eprn->fmr)(eprn, no_match);
else {
const char *epref = eprn->CUPS_messages? CUPS_ERRPREF: "";
- fprintf(err, "%s" ERRPREF "The %s does not support ",
+ eprintf2("%s" ERRPREF "The %s does not support ",
epref, eprn->cap->name);
- if (eprn->desired_flags == 0) fprintf(err, "an empty set of media flags");
+ if (eprn->desired_flags == 0) eprintf("an empty set of media flags");
else {
- fputs("the \"", err);
- print_flags(err, eprn->desired_flags, eprn->flag_desc);
- fputs("\" flag(s)", err);
+ eprintf("the \"");
+ print_flags(eprn->desired_flags, eprn->flag_desc);
+ eprintf("\" flag(s)");
}
- fprintf(err, "\n%s (ignoring presence or absence of \"", epref);
+ eprintf1("\n%s (ignoring presence or absence of \"", epref);
{
ms_MediaCode optional = MS_TRANSVERSE_FLAG;
if (eprn->optional_flags != NULL) {
const ms_MediaCode *of = eprn->optional_flags;
while (*of != ms_none) optional |= *of++;
}
- print_flags(err, optional, eprn->flag_desc);
+ print_flags(optional, eprn->flag_desc);
}
- fputs("\") for ", err);
- if (no_match) fputs("any", err); else fputs("this", err);
- fputs(" page size.\n", err);
+ eprintf("\") for ");
+ if (no_match) eprintf("any"); else eprintf("this");
+ eprintf(" page size.\n");
}
return;
@@ -483,7 +484,7 @@
the media flags, or the page descriptions have been changed.
The function returns zero on success and a non-zero value otherwise.
- In the latter case, an error message has been issued on stderr. This can only
+ In the latter case, an error message has been issued. This can only
occur if the media size is not supported with the flags requested.
On success, the following variables in the device structure are consistent:
@@ -615,21 +616,21 @@
/* No discrete match */
if (best_cmatch == NULL) {
/* No match at all. */
- fprintf(stderr, "%s" ERRPREF
+ eprintf3("%s" ERRPREF
"This document requests a page size of %.0f x %.0f bp.\n",
epref, dev->MediaSize[0], dev->MediaSize[1]);
if (eprn->cap->custom == NULL) {
/* The printer does not support custom page sizes */
if (eprn->media_overrides != NULL)
- fprintf(stderr,
+ eprintf1(
"%s The media configuration file does not contain an entry for "
" this size.\n", epref);
else
- fprintf(stderr, "%s This size is not supported by the %s.\n",
+ eprintf2("%s This size is not supported by the %s.\n",
epref, eprn->cap->name);
}
else
- fprintf(stderr,
+ eprintf3(
"%s This size is not supported as a discrete size and it exceeds "
"the\n"
"%s custom page size limits for the %s.\n",
@@ -637,7 +638,7 @@
return -1;
}
if (eprn->media_overrides != NULL && best_cdmatch == NULL) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf6("%s" ERRPREF
"This document requests a page size of %.0f x %.0f bp\n"
"%s but there is no entry for this size in the "
"media configuration file\n"
@@ -692,7 +693,7 @@
}
/* If we've found a match, 'code' is no longer 'ms_none'. */
if (eprn->code == ms_none) {
- eprn_flag_mismatch(stderr, eprn, no_match);
+ eprn_flag_mismatch(eprn, no_match);
return -1;
}
@@ -762,7 +763,7 @@
rc = gdev_prn_open((gx_device *)dev);
if (rc < 0) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"Failure of gdev_prn_open(), code is %d.\n",
epref, rc);
return rc;
@@ -944,13 +945,13 @@
&eprn->black_levels, &eprn->non_black_levels) != 0) {
gs_param_string str;
- fprintf(stderr, "%s" ERRPREF "The requested combination of colour model (",
+ eprintf1("%s" ERRPREF "The requested combination of colour model (",
epref);
str.size = 0;
if (eprn_get_string(eprn->colour_model, eprn_colour_model_list, &str) != 0)
assert(0); /* Bug. No harm on NDEBUG because I've just set the size. */
- fwrite(str.data, str.size, sizeof(str.data[0]), stderr);
- fprintf(stderr, "),\n"
+ errwrite(str.data, str.size * sizeof(str.data[0]));
+ eprintf7("),\n"
"%s resolution (%gx%g ppi) and intensity levels (%d, %d) is\n"
"%s not supported by the %s.\n",
epref, device->HWResolution[0], device->HWResolution[1],
@@ -1022,9 +1023,8 @@
updating the file. */
else {
/* pcf_getcount() has issued an error message. */
- fputs(
- " No further attempts will be made to access the page count file.\n",
- stderr);
+ eprintf(
+ " No further attempts will be made to access the page count file.\n");
gs_free(gs_lib_ctx_get_non_gc_memory_t(), eprn->pagecount_file, strlen(eprn->pagecount_file) + 1,
sizeof(char), "eprn_open_device");
eprn->pagecount_file = NULL;
@@ -1060,7 +1060,7 @@
}
}
if (eprn->scan_line.str == NULL) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf1("%s" ERRPREF
"Memory allocation failure from gs_malloc() in eprn_open_device().\n",
epref);
return_error(gs_error_VMerror);
@@ -1156,7 +1156,7 @@
accounting, this seems unfair.
*/
if (rc == 0 && eprn->CUPS_accounting)
- fprintf(stderr, "PAGE: %ld %d\n", dev->ShowpageCount, num_copies);
+ eprintf2("PAGE: %ld %d\n", dev->ShowpageCount, num_copies);
/* The arguments are the number of the page, starting at 1, and the number
of copies of that page. */
@@ -1166,9 +1166,8 @@
assert(num_copies > 0); /* because of signed/unsigned */
if (pcf_inccount(eprn->pagecount_file, num_copies) != 0) {
/* pcf_inccount() has issued an error message. */
- fputs(
- " No further attempts will be made to access the page count file.\n",
- stderr);
+ eprintf(
+ " No further attempts will be made to access the page count file.\n");
gs_free(gs_lib_ctx_get_non_gc_memory_t(), eprn->pagecount_file, strlen(eprn->pagecount_file) + 1,
sizeof(char), "eprn_output_page");
eprn->pagecount_file = NULL;
Modified: branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.h
===================================================================
--- branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.h 2007-05-13 16:13:40 UTC (rev 7962)
+++ branches/gs-esp-gpl-merger/contrib/pcl3/eprn/gdeveprn.h 2007-05-13 16:17:02 UTC (rev 7963)
@@ -396,8 +396,8 @@
struct s_eprn_Device;
/* The preceding statement is needed in order to establish a forward
declaration for "struct s_eprn_Device" at file scope. */
-typedef void (*eprn_FlagMismatchReporter)(FILE *f,
- const struct s_eprn_Device *dev, bool no_match);
+typedef void (*eprn_FlagMismatchReporter)(const struct s_eprn_Device *dev,
+ bool no_match);
/* A function of this kind will be called if the requested media flags cannot
be satisfied by the printer although the size itself is supported for some
(unspecified) set of flags. The parameter 'no_match' indicates whether the
@@ -406,7 +406,7 @@
capabilities). The requested set of media selection flags is available in
'dev->eprn.desired_flags' and 'dev->eprn.optional_flags' (MS_ROTATED_FLAG
will never be set).
- The function must write an error message on 'f'.
+ The function must write an error message.
*/
/*****************************************************************************/
Modified: branches/gs-esp-gpl-merger/contrib/pcl3/src/gdevpcl3.c
===================================================================
--- branches/gs-esp-gpl-merger/contrib/pcl3/src/gdevpcl3.c 2007-05-13 16:13:40 UTC (rev 7962)
+++ branches/gs-esp-gpl-merger/contrib/pcl3/src/gdevpcl3.c 2007-05-13 16:17:02 UTC (rev 7963)
@@ -338,7 +338,7 @@
/* First we construct a properly NUL-terminated string */
s = (char *) malloc(in_value->size + 1);
if (s == NULL) {
- fprintf(stderr, ERRPREF
+ eprintf1(ERRPREF
"Memory allocation failure in get_int_for_string(): %s.\n",
strerror(errno));
return_error(gs_error_VMerror);
@@ -434,25 +434,25 @@
const char *epref = eprn->CUPS_messages? CUPS_ERRPREF: "";
if (eprn->desired_flags == 0) {
- fprintf(stderr,
+ eprint2(
"%s" ERRPREF "The %s does not support the requested media properties.\n",
epref, eprn->cap->name);
}
else if (eprn->desired_flags == MS_BIG_FLAG) {
- fprintf(stderr, "%s" ERRPREF "The %s does not support banner printing",
+ eprintf2("%s" ERRPREF "The %s does not support banner printing",
epref, eprn->cap->name);
- if (!no_match) fputs(" for this size", stderr);
- fputs(".\n", stderr);
+ if (!no_match) eprintf(" for this size");
+ eprintf(".\n");
}
else if (eprn->desired_flags == PCL_CARD_FLAG) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"The %s does not support a `Card' variant for ",
epref, eprn->cap->name);
- if (no_match) fputs("any", stderr); else fputs("this", stderr);
- fputs(" size.\n", stderr);
+ if (no_match) eprintf("any"); else eprintf("this");
+ eprintf(" size.\n");
}
else {
- fprintf(stderr,
+ eprintf1(
"%s" ERRPREF "Banner printing on postcards?? You must be joking!\n",
epref);
}
@@ -699,8 +699,8 @@
be copied to '*s'.
The function returns a negative ghostscript error code on error and zero
- otherwise. In the former case an error message will have been issued on
- stderr, using 'epref' as a prefix for the message.
+ otherwise. In the former case an error message will have been issued,
+ using 'epref' as a prefix for the message.
******************************************************************************/
@@ -728,7 +728,7 @@
if (s->str == NULL) {
s->length = 0;
- fprintf(stderr, "%s" ERRPREF
+ eprintf1("%s" ERRPREF
"Memory allocation failure from gs_malloc().\n", epref);
rc = gs_error_VMerror;
param_signal_error(plist, pname, rc);
@@ -760,8 +760,7 @@
copied.
The function returns a negative ghostscript error code on error and zero
- otherwise. In the former case an error message will have been issued on
- stderr.
+ otherwise. In the former case an error message will have been issued.
******************************************************************************/
@@ -785,7 +784,7 @@
"fetch_cstring");
if (*s == NULL) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf1("%s" ERRPREF
"Memory allocation failure from gs_malloc().\n", epref);
rc = gs_error_VMerror;
param_signal_error(plist, pname, rc);
@@ -907,9 +906,9 @@
eprn_init_device((eprn_Device *)dev, &pcl3_printers[dev->printer].desc);
}
else {
- fprintf(stderr, "%s" ERRPREF "Unknown subdevice name: `", epref);
- fwrite(string_value.data, sizeof(char), string_value.size, stderr);
- fputs("'.\n", stderr);
+ eprintf1("%s" ERRPREF "Unknown subdevice name: `", epref);
+ errwrite(string_value.data, sizeof(char)*string_value.size);
+ eprintf("'.\n");
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
}
@@ -925,8 +924,8 @@
== 0) {
if (temp != pcl_cm_none && temp != pcl_cm_rl && temp != pcl_cm_tiff &&
temp != pcl_cm_delta && temp != pcl_cm_crdr) {
- fprintf(stderr,
- "%s" ERRPREF "Unsupported compression method: %d.\n", epref, temp);
+ eprintf2("%s" ERRPREF "Unsupported compression method: %d.\n",
+ epref, temp);
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
}
@@ -934,7 +933,7 @@
if (temp == pcl_cm_crdr && (dev->printer == HPDeskJet ||
dev->printer == HPDeskJetPlus || dev->printer == HPDJ500)) {
/* This I know to be the case for the DJ 500. The others are guessed. */
- fprintf(stderr,
+ eprintf2(
"%s" ERRPREF "The %s does not support compression method 9.\n",
epref, dev->eprn.cap->name);
last_error = gs_error_rangecheck;
@@ -956,7 +955,7 @@
if (1 <= temp && temp <= 5 && (dev->printer != HPDJ500C || temp <= 3))
requested.depletion = temp;
else {
- fprintf(stderr, "%s" ERRPREF "Invalid value for depletion: %d.\n",
+ eprintf2("%s" ERRPREF "Invalid value for depletion: %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
@@ -978,7 +977,7 @@
Hence I'm giving an error message only in those cases where HP
explicitly states that the printer does not support the command.
*/
- fprintf(stderr,
+ eprintf2(
"%s" ERRPREF "The %s does not support setting a dry time.\n",
epref, dev->eprn.cap->name);
last_error = gs_error_rangecheck;
@@ -987,8 +986,8 @@
else data->dry_time = temp;
}
else {
- fprintf(stderr,
- "%s" ERRPREF "Invalid value for the dry time: %d.\n", epref, temp);
+ eprintf2("%s" ERRPREF "Invalid value for the dry time: %d.\n",
+ epref, temp);
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
}
@@ -1008,7 +1007,7 @@
dev->Duplex_set = 0; /* force to "null" */
}
else {
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"You can use a non-trivial value for DuplexCapability\n"
"%s only for unspec and unspecold.\n", epref, epref);
last_error = gs_error_rangecheck;
@@ -1016,9 +1015,9 @@
}
}
else {
- fprintf(stderr, "%s" ERRPREF "Invalid duplex capability: `", epref);
- fwrite(string_value.data, sizeof(char), string_value.size, stderr);
- fputs("'.\n", stderr);
+ eprintf1("%s" ERRPREF "Invalid duplex capability: `", epref);
+ errwrite(string_value.data, sizeof(char)*string_value.size);
+ eprintf("'.\n");
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
}
@@ -1037,12 +1036,12 @@
if ((rc = param_read_bool(plist, (pname = "Duplex"), &temp)) == 0 &&
temp && dev->duplex_capability == Duplex_none) {
if (dev->printer == pcl3_generic_new || dev->printer == pcl3_generic_old)
- fprintf(stderr, "%s" ERRPREF
+ eprintf3("%s" ERRPREF
"The '%s' device does not support duplex printing unless\n"
"%s 'DuplexCapability' is not 'none'.\n",
epref, find_subdevice_name(dev->printer), epref);
else
- fprintf(stderr, "%s" ERRPREF
+ eprintf2("%s" ERRPREF
"The %s does not support duplex printing.\n",
epref, dev->eprn.cap->name);
last_error = gs_error_rangecheck;
@@ -1071,9 +1070,9 @@
rc = get_int_for_string(&string_value, media_type_list, &temp);
if (rc != 0) {
if (rc != gs_error_VMerror) {
- fprintf(stderr, "%s" ERRPREF "Unknown medium: `", epref);
- fwrite(string_value.data, sizeof(char), string_value.size, stderr);
- fputs("'.\n", stderr);
+ eprintf1("%s" ERRPREF "Unknown medium: `", epref);
+ errwrite(string_value.data, sizeof(char)*string_value.size);
+ eprintf("'.\n");
}
last_error = rc;
param_signal_error(plist, pname, last_error);
@@ -1081,7 +1080,7 @@
else {
new_quality = true;
if (temp < 0 || 6 < temp)
- fprintf(stderr, "%s" WARNPREF "Unknown media type code: %d.\n",
+ eprintf2("%s" WARNPREF "Unknown media type code: %d.\n",
wpref, temp);
pcl3_set_mediatype(data, temp);
}
@@ -1107,7 +1106,7 @@
if (pcl_has_CRD(data->level))
data->level = (temp? pcl_level_3plus_CRD_only: pcl_level_3plus_S68);
else if (temp == true) {
- fprintf(stderr, "%s" ERRPREF
+ eprintf1("%s" ERRPREF
"OnlyCRD may be set only for group-3 devices.\n", epref);
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
@@ -1140,9 +1139,9 @@
rc = get_int_for_string(&string_value, print_quality_list, &temp);
if (rc != 0) {
if (rc != gs_error_VMerror) {
- fprintf(stderr, "%s" ERRPREF "Unknown print quality: `", epref);
- fwrite(string_value.data, sizeof(char), string_value.size, stderr);
- fputs("'.\n", stderr);
+ eprintf1("%s" ERRPREF "Unknown print quality: `", epref);
+ errwrite(string_value.data, sizeof(char)*string_value.size);
+ eprintf("'.\n");
}
last_error = rc;
param_signal_error(plist, pname, last_error);
@@ -1150,7 +1149,7 @@
else {
new_quality = true;
if (temp < -1 || 1 < temp)
- fprintf(stderr, "%s" WARNPREF "Unknown print quality: %d.\n",
+ eprintf2("%s" WARNPREF "Unknown print quality: %d.\n",
wpref, temp);
pcl3_set_printquality(data, temp);
}
@@ -1165,7 +1164,7 @@
== 0) {
if (0 <= temp && temp <= 2) requested.quality = temp;
else {
- fprintf(stderr,
+ eprintf2(
"%s" ERRPREF "Invalid value for raster graphics quality: %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
@@ -1186,7 +1185,7 @@
if ((rc = param_read_int(plist, (pname = "SendNULs"), &temp)) == 0) {
if (data->NULs_to_send >= 0) data->NULs_to_send = temp;
else {
- fprintf(stderr,
+ eprintf2(
"%s" ERRPREF "Invalid value for SendNULs parameter: %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
@@ -1202,7 +1201,7 @@
(rc = param_read_int(plist, pname, &temp)) == 0) {
if (0 <= temp && temp <= 2) requested.shingling = temp;
else {
- fprintf(stderr, "%s" ERRPREF "Invalid value for shingling: %d.\n",
+ eprintf2("%s" ERRPREF "Invalid value for shingling: %d.\n",
epref, temp);
last_error = gs_error_rangecheck;
param_signal_error(plist, pname, last_error);
@@ -1280,7 +1279,7 @@
/* Check on rendering parameters */
if ((dev->eprn.black_levels > 2 || dev->eprn.non_black_levels > 2) &&
dev->file_data.print_quality == -1)
- fprintf(stderr,
+ eprintf2(
"%s" WARNPREF "More than 2 intensity levels and draft quality\n"
"%s are unlikely to work in combination.\n", wpref, wpref);
@@ -1311,18 +1310,18 @@
*/
char buffer[50];
- fprintf(stderr, "%s" ERRPREF
+ eprint2("%s" ERRPREF
"The current configuration for this driver has identified the\n"
"%s page setup requested by the document as being for `",
epref, epref);
if (ms_find_name_from_code(buffer, sizeof(buffer),
- dev->eprn.code, flag_description) == 0) fputs(buffer, stderr);
- else fputs("UNKNOWN", stderr); /* should never happen */
- fprintf(stderr, "' (%.0f x %.0f bp).\n"
+ dev->eprn.code, flag_description) == 0) eprintf(buffer);
+ else eprintf("UNKNOWN"); /* should never happen */
+ eprintf3("' (%.0f x %.0f bp).\n"
"%s The driver does not know how to do this in PCL.\n",
dev->MediaSize[0], dev->MediaSize[1], epref);
if (dev->eprn.media_file != NULL)
- fprintf(stderr,
+ eprintf2(
"%s You should therefore not include such an entry in the\n"
"%s media configuration file.\n", epref, epref);
return_error(gs_error_rangecheck);
@@ -1473,7 +1472,7 @@
pcl_cm_is_differential(dev->file_data.compression) &&
rd.previous == NULL) {
free(lengths); free(rd.next); free(rd.previous);
- fprintf(stderr, "%s" ERRPREF "Memory allocation failure from malloc().\n",
+ eprintf1("%s" ERRPREF "Memory allocation failure from malloc().\n",
epref);
return_error(gs_error_VMerror);
}
@@ -1514,7 +1513,7 @@
free(lengths); free(rd.next); free(rd.previous);
for (j = 0; j < 2; j++) free(rd.workspace[j]);
- fprintf(stderr, "%s" ERRPREF "Memory allocation failure from malloc().\n",
+ eprintf1("%s" ERRPREF "Memory allocation failure from malloc().\n",
epref);
return_error(gs_error_VMerror);
}
More information about the gs-cvs
mailing list