Upgrading to CUPS 2.2.1

This commit is contained in:
Noha Elarief
2017-02-03 13:21:52 -08:00
parent 52519bfb65
commit 130bd3bb59
163 changed files with 45518 additions and 11949 deletions

View File

@@ -1,61 +1,68 @@
error.o: error.c ../cups/raster-private.h ../cups/raster.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/ppd.h \
../cups/array.h ../cups/language.h ../cups/pwg.h \
../cups/debug-private.h ../cups/string-private.h ../config.h
interpret.o: interpret.c ../cups/raster-private.h ../cups/raster.h \
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h ../cups/ppd.h \
../cups/debug-private.h ../cups/string-private.h ../config.h
../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
../cups/debug-private.h ../cups/string-private.h ../config.h \
../cups/ppd.h
raster.o: raster.c ../cups/raster-private.h ../cups/raster.h \
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h ../cups/ppd.h \
../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
../cups/debug-private.h ../cups/string-private.h ../config.h
commandtops.o: commandtops.c ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/sidechannel.h
../cups/versioning.h ../cups/array-private.h ../cups/array.h \
../cups/ipp-private.h ../cups/ipp.h ../cups/http.h \
../cups/http-private.h ../cups/language.h ../cups/md5-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/cups.h ../cups/file.h ../cups/pwg.h ../cups/thread-private.h \
../cups/ppd.h ../cups/raster.h ../cups/sidechannel.h
gziptoany.o: gziptoany.c ../cups/cups-private.h ../cups/string-private.h \
../config.h ../cups/debug-private.h ../cups/versioning.h \
../cups/ipp-private.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/http-private.h ../cups/md5-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/language.h \
../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
../cups/ipp.h ../cups/http.h ../cups/http-private.h ../cups/language.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/pwg-private.h ../cups/cups.h ../cups/file.h ../cups/pwg.h \
../cups/thread-private.h
common.o: common.c common.h ../cups/string-private.h ../config.h \
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h ../cups/ppd.h
../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
../cups/ppd.h ../cups/raster.h
pstops.o: pstops.c common.h ../cups/string-private.h ../config.h \
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h ../cups/ppd.h \
../cups/language-private.h ../cups/transcode.h
../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
../cups/ppd.h ../cups/raster.h ../cups/language-private.h \
../cups/transcode.h
rasterbench.o: rasterbench.c ../config.h ../cups/raster.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/ppd.h
../cups/array.h ../cups/language.h ../cups/pwg.h
rastertoepson.o: rastertoepson.c ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/ppd.h ../cups/string-private.h ../config.h \
../cups/language-private.h ../cups/transcode.h ../cups/raster.h
../cups/language.h ../cups/pwg.h ../cups/ppd.h ../cups/raster.h \
../cups/string-private.h ../config.h ../cups/language-private.h \
../cups/transcode.h
rastertohp.o: rastertohp.c ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/ppd.h ../cups/string-private.h ../config.h \
../cups/language-private.h ../cups/transcode.h ../cups/raster.h
../cups/language.h ../cups/pwg.h ../cups/ppd.h ../cups/raster.h \
../cups/string-private.h ../config.h ../cups/language-private.h \
../cups/transcode.h
rastertolabel.o: rastertolabel.c ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/ppd.h ../cups/string-private.h ../config.h \
../cups/language-private.h ../cups/transcode.h ../cups/raster.h
../cups/language.h ../cups/pwg.h ../cups/ppd.h ../cups/raster.h \
../cups/string-private.h ../config.h ../cups/language-private.h \
../cups/transcode.h
rastertopwg.o: rastertopwg.c ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/raster.h
../cups/versioning.h ../cups/array-private.h ../cups/array.h \
../cups/ipp-private.h ../cups/ipp.h ../cups/http.h \
../cups/http-private.h ../cups/language.h ../cups/md5-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
../cups/cups.h ../cups/file.h ../cups/pwg.h ../cups/thread-private.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h
testraster.o: testraster.c ../cups/raster-private.h ../cups/raster.h \
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h ../cups/ppd.h \
../cups/debug-private.h ../cups/string-private.h ../config.h
../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
../cups/debug-private.h ../cups/string-private.h ../config.h \
../cups/ppd.h

View File

@@ -1,18 +1,16 @@
#
# "$Id: Makefile 7871 2008-08-27 21:12:43Z mike $"
# Filter makefile for CUPS.
#
# Filter makefile for CUPS.
# Copyright 2007-2012 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products.
#
# Copyright 2007-2012 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products.
# These coded instructions, statements, and computer programs are the
# property of Apple Inc. and are protected by Federal copyright
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
# which should have been included with this file. If this file is
# file is missing or damaged, see the license at "http://www.cups.org/".
#
# These coded instructions, statements, and computer programs are the
# property of Apple Inc. and are protected by Federal copyright
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
# which should have been included with this file. If this file is
# file is missing or damaged, see the license at "http://www.cups.org/".
#
# This file is subject to the Apple OS-Developed Software exception.
# This file is subject to the Apple OS-Developed Software exception.
#
include ../Makedefs
@@ -110,6 +108,7 @@ install-exec:
$(INSTALL_DIR) $(SYMROOT); \
for file in $(FILTERS); do \
cp $$file $(SYMROOT); \
dsymutil $(SYMROOT)/$$file; \
done \
fi
@@ -139,6 +138,7 @@ install-libs: $(INSTALLSTATIC)
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
cp $(LIBCUPSIMAGE) $(SYMROOT); \
dsymutil $(SYMROOT)/$(LIBCUPSIMAGE); \
fi
installstatic:
@@ -209,38 +209,6 @@ apihelp:
--intro spec-ppd.shtml \
>../doc/help/spec-ppd.html
framedhelp:
echo Generating CUPS API help files...
mxmldoc --section "Programming" --title "Raster API" \
--framed ../cups/api-raster \
--css ../doc/cups-printable.css \
--header api-raster.header --intro api-raster.shtml \
../cups/raster.h interpret.c raster.c
mxmldoc --section "Programming" \
--title "Developing PostScript Printer Drivers" \
--framed ../cups/postscript-driver \
--css ../doc/cups-printable.css \
--header postscript-driver.header \
--intro postscript-driver.shtml
mxmldoc --section "Programming" \
--title "Introduction to the PPD Compiler" \
--framed ../cups/ppd-compiler \
--css ../doc/cups-printable.css \
--header ppd-compiler.header \
--intro ppd-compiler.shtml
mxmldoc --section "Programming" \
--title "Developing Raster Printer Drivers" \
--framed ../cups/raster-driver \
--css ../doc/cups-printable.css \
--header raster-driver.header \
--intro raster-driver.shtml
mxmldoc --section "Specifications" \
--title "CUPS PPD Extensions" \
--framed ../cups/spec-ppd \
--css ../doc/cups-printable.css \
--header spec-ppd.header \
--intro spec-ppd.shtml \
#
# commandtops
@@ -365,6 +333,12 @@ rastertopwg: rastertopwg.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ rastertopwg.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
rastertopwg-static: rastertopwg.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ rastertopwg.o libcupsimage.a \
../cups/$(LIBCUPSSTATIC) $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) \
$(SSLLIBS) $(DNSSDLIBS) $(LIBGSSAPI)
#
# testraster
@@ -393,8 +367,3 @@ rasterbench: rasterbench.o libcupsimage.a
#
include Dependencies
#
# End of "$Id: Makefile 7871 2008-08-27 21:12:43Z mike $".
#

View File

@@ -1,6 +1,4 @@
<!--
"$Id$"
Raster API documentation for CUPS.
Copyright 2008-2010 by Apple Inc.

View File

@@ -1,6 +1,4 @@
<!--
"$Id$"
Raster API introduction for CUPS.
Copyright 2007-2013 by Apple Inc.
@@ -22,7 +20,7 @@ avoid incompatibilities with newer versions of CUPS.</p>
<p>Two kinds of CUPS filters use the CUPS raster API - raster image processor
(RIP) filters such as <code>pstoraster</code> and <code>cgpdftoraster</code>
(OS X) that produce CUPS raster files and printer driver filters that
(macOS) that produce CUPS raster files and printer driver filters that
convert CUPS raster files into a format usable by the printer. Printer
driver filters are by far the most common.</p>
@@ -142,7 +140,7 @@ the memory used to read the raster file:</p>
<ul class="code">
<li><a href="#cupsRasterReadHeader" title="Read a raster page header and store it in a version 1 page header structure.">cupsRasterReadHeader</a> <span class="info">Deprecated in CUPS 1.2/OS X 10.5</span></li>
<li><a href="#cupsRasterReadHeader" title="Read a raster page header and store it in a version 1 page header structure.">cupsRasterReadHeader</a> <span class="info">Deprecated in CUPS 1.2/macOS 10.5</span></li>
<li><a href="#cupsRasterReadHeader2" title="Read a raster page header and store it in a version 2 page header structure.">cupsRasterReadHeader2</a></li>
<li><a href="#cupsRasterReadPixels" title="Read raster pixels.">cupsRasterReadPixels</a></li>
@@ -153,7 +151,7 @@ the memory used to read the raster file:</p>
<ul class="code">
<li><a href="#cupsRasterInterpretPPD" title="Interpret PPD commands to create a page header.">cupsRasterInterpretPPD</a></li>
<li><a href="#cupsRasterWriteHeader" title="Write a raster page header from a version 1 page header structure.">cupsRasterWriteHeader</a> <span class="info">Deprecated in CUPS 1.2/OS X 10.5</span></li>
<li><a href="#cupsRasterWriteHeader" title="Write a raster page header from a version 1 page header structure.">cupsRasterWriteHeader</a> <span class="info">Deprecated in CUPS 1.2/macOS 10.5</span></li>
<li><a href="#cupsRasterWriteHeader2" title="Write a raster page header from a version 2 page header structure.">cupsRasterWriteHeader2</a></li>
<li><a href="#cupsRasterWritePixels" title="Write raster pixels.">cupsRasterWritePixels</a></li>

View File

@@ -1,26 +1,13 @@
/*
* "$Id: commandtops.c 3794 2012-04-23 22:44:16Z msweet $"
* PostScript command filter for CUPS.
*
* PostScript command filter for CUPS.
* Copyright 2008-2014 by Apple Inc.
*
* Copyright 2008-2012 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
*
* Contents:
*
* main() - Process a CUPS command file.
* auto_configure() - Automatically configure the printer using
* PostScript query commands and/or SNMP lookups.
* begin_ps() - Send the standard PostScript prolog.
* end_ps() - Send the standard PostScript trailer.
* print_self_test_page() - Print a self-test page.
* report_levels() - Report supply levels.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
/*
@@ -309,9 +296,7 @@ auto_configure(ppd_file_t *ppd, /* I - PPD file */
bufptr = buffer;
buffer[0] = '\0';
while ((bytes = cupsBackChannelRead(bufptr,
sizeof(buffer) - (bufptr - buffer) - 1,
10.0)) > 0)
while ((bytes = cupsBackChannelRead(bufptr, sizeof(buffer) - (size_t)(bufptr - buffer) - 1, 10.0)) > 0)
{
/*
* No newline at the end? Go on reading ...
@@ -531,8 +516,3 @@ report_levels(ppd_file_t *ppd, /* I - PPD file */
end_ps(ppd);
}
/*
* End of "$Id: commandtops.c 3794 2012-04-23 22:44:16Z msweet $".
*/

View File

@@ -1,29 +1,16 @@
/*
* "$Id: common.c 6649 2007-07-11 21:46:42Z mike $"
* Common filter routines for CUPS.
*
* Common filter routines for CUPS.
* Copyright 2007-2014 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* SetCommonOptions() - Set common filter options for media size,
* etc.
* UpdatePageVars() - Update the page variables for the orientation.
* WriteComment() - Write a DSC comment.
* WriteCommon() - Write common procedures...
* WriteLabelProlog() - Write the prolog with the classification
* and page label.
* WriteLabels() - Write the actual page labels.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -481,7 +468,7 @@ WriteTextComment(const char *name, /* I - Comment name ("Title", etc.) */
*/
printf("%%%%%s: (", name);
len = 5 + strlen(name);
len = 5 + (int)strlen(name);
while (*value)
{
@@ -528,8 +515,3 @@ WriteTextComment(const char *name, /* I - Comment name ("Title", etc.) */
puts(")");
}
/*
* End of "$Id: common.c 6649 2007-07-11 21:46:42Z mike $".
*/

View File

@@ -1,18 +1,16 @@
/*
* "$Id: common.h 6649 2007-07-11 21:46:42Z mike $"
* Common filter definitions for CUPS.
*
* Common filter definitions for CUPS.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -71,8 +69,3 @@ extern void WriteTextComment(const char *name, const char *value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/*
* End of "$Id: common.h 6649 2007-07-11 21:46:42Z mike $".
*/

View File

@@ -1,27 +1,16 @@
/*
* "$Id: error.c 7460 2008-04-16 02:19:54Z mike $"
* Raster error handling for CUPS.
*
* Raster error handling for CUPS.
* Copyright 2007-2015 by Apple Inc.
* Copyright 2007 by Easy Software Products.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* _cupsRasterAddError() - Add an error message to the error buffer.
* _cupsRasterClearError() - Clear the error buffer.
* cupsRasterErrorString() - Return the last error from a raster function.
* get_error_buffer() - Return a pointer to thread local storage.
* raster_init() - Initialize error buffer once.
* raster_destructor() - Free memory allocated by get_error_buffer().
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -62,9 +51,11 @@ _cupsRasterAddError(const char *f, /* I - Printf-style error message */
/* Error buffer */
va_list ap; /* Pointer to additional arguments */
char s[2048]; /* Message string */
size_t bytes; /* Bytes in message string */
ssize_t bytes; /* Bytes in message string */
DEBUG_printf(("_cupsRasterAddError(f=\"%s\", ...)", f));
va_start(ap, f);
bytes = vsnprintf(s, sizeof(s), f, ap);
va_end(ap);
@@ -72,12 +63,14 @@ _cupsRasterAddError(const char *f, /* I - Printf-style error message */
if (bytes <= 0)
return;
DEBUG_printf(("1_cupsRasterAddError: %s", s));
bytes ++;
if (bytes >= sizeof(s))
if ((size_t)bytes >= sizeof(s))
return;
if (bytes > (size_t)(buf->end - buf->current))
if (bytes > (ssize_t)(buf->end - buf->current))
{
/*
* Allocate more memory...
@@ -87,7 +80,7 @@ _cupsRasterAddError(const char *f, /* I - Printf-style error message */
size_t size; /* Size of buffer */
size = buf->end - buf->start + 2 * bytes + 1024;
size = (size_t)(buf->end - buf->start + 2 * bytes + 1024);
if (buf->start)
temp = realloc(buf->start, size);
@@ -110,7 +103,7 @@ _cupsRasterAddError(const char *f, /* I - Printf-style error message */
* Append the message to the end of the current string...
*/
memcpy(buf->current, s, bytes);
memcpy(buf->current, s, (size_t)bytes);
buf->current += bytes - 1;
}
@@ -138,7 +131,7 @@ _cupsRasterClearError(void)
*
* If there are no recent errors, NULL is returned.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/macOS 10.5@
*/
const char * /* O - Last error */
@@ -167,8 +160,7 @@ cupsRasterErrorString(void)
* Local globals...
*/
static pthread_key_t raster_key = -1;
/* Thread local storage key */
static pthread_key_t raster_key = 0; /* Thread local storage key */
static pthread_once_t raster_key_once = PTHREAD_ONCE_INIT;
/* One-time initialization object */
@@ -195,7 +187,7 @@ get_error_buffer(void)
* Initialize the global data exactly once...
*/
DEBUG_puts("get_error_buffer()");
DEBUG_puts("3get_error_buffer()");
pthread_once(&raster_key_once, raster_init);
@@ -206,7 +198,7 @@ get_error_buffer(void)
if ((buf = (_cups_raster_error_t *)pthread_getspecific(raster_key))
== NULL)
{
DEBUG_puts("get_error_buffer: allocating memory for thread...");
DEBUG_puts("4get_error_buffer: allocating memory for thread.");
/*
* No, allocate memory as set the pointer for the key...
@@ -215,7 +207,7 @@ get_error_buffer(void)
buf = calloc(1, sizeof(_cups_raster_error_t));
pthread_setspecific(raster_key, buf);
DEBUG_printf((" buf=%p\n", buf));
DEBUG_printf(("4get_error_buffer: buf=%p", (void *)buf));
}
/*
@@ -235,8 +227,7 @@ raster_init(void)
{
pthread_key_create(&raster_key, raster_destructor);
DEBUG_printf(("raster_init(): raster_key=%x(%u)\n", (unsigned)raster_key,
(unsigned)raster_key));
DEBUG_printf(("3raster_init(): raster_key=%x(%u)", (unsigned)raster_key, (unsigned)raster_key));
}
@@ -251,7 +242,7 @@ raster_destructor(void *value) /* I - Data to free */
/* Error buffer */
DEBUG_printf(("raster_destructor(value=%p)\n", value));
DEBUG_printf(("3raster_destructor(value=%p)", value));
if (buf->start)
free(buf->start);
@@ -279,8 +270,3 @@ get_error_buffer(void)
return (&buf);
}
#endif /* HAVE_PTHREAD_H */
/*
* End of "$Id: error.c 7460 2008-04-16 02:19:54Z mike $".
*/

View File

@@ -1,22 +1,16 @@
/*
* "$Id: gziptoany.c 6649 2007-07-11 21:46:42Z mike $"
* GZIP/raw pre-filter for CUPS.
*
* GZIP/raw pre-filter for CUPS.
* Copyright 2007-2015 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Copy (and uncompress) files to stdout.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -36,7 +30,7 @@ main(int argc, /* I - Number of command-line arguments */
{
cups_file_t *fp; /* File */
char buffer[8192]; /* Data buffer */
int bytes; /* Number of bytes read/written */
ssize_t bytes; /* Number of bytes read/written */
int copies; /* Number of copies */
@@ -44,7 +38,7 @@ main(int argc, /* I - Number of command-line arguments */
* Check command-line...
*/
if (argc != 7)
if (argc < 6 || argc > 7)
{
_cupsLangPrintf(stderr,
_("Usage: %s job-id user title copies options [file]"),
@@ -66,8 +60,14 @@ main(int argc, /* I - Number of command-line arguments */
* Open the file...
*/
if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
if (argc == 6)
{
copies = 1;
fp = cupsFileStdin();
}
else if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
{
fprintf(stderr, "DEBUG: Unable to open \"%s\".\n", argv[6]);
_cupsLangPrintError("ERROR", _("Unable to open print file"));
return (1);
}
@@ -84,12 +84,13 @@ main(int argc, /* I - Number of command-line arguments */
cupsFileRewind(fp);
while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
if (write(1, buffer, bytes) < bytes)
if (write(1, buffer, (size_t)bytes) < bytes)
{
_cupsLangPrintFilter(stderr, "ERROR",
_("Unable to write uncompressed print data: %s"),
strerror(errno));
cupsFileClose(fp);
if (argc == 7)
cupsFileClose(fp);
return (1);
}
@@ -101,12 +102,8 @@ main(int argc, /* I - Number of command-line arguments */
* Close the file and return...
*/
cupsFileClose(fp);
if (argc == 7)
cupsFileClose(fp);
return (0);
}
/*
* End of "$Id: gziptoany.c 6649 2007-07-11 21:46:42Z mike $".
*/

View File

@@ -1,39 +1,16 @@
/*
* "$Id: interpret.c 7852 2008-08-21 04:19:45Z mike $"
* PPD command interpreter for CUPS.
*
* PPD command interpreter for CUPS.
* Copyright 2007-2015 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* cupsRasterInterpretPPD() - Interpret PPD commands to create a page header.
* _cupsRasterExecPS() - Execute PostScript code to initialize a page
* header.
* cleartomark_stack() - Clear to the last mark ([) on the stack.
* copy_stack() - Copy the top N stack objects.
* delete_stack() - Free memory used by a stack.
* error_object() - Add an object's value to the current error
* message.
* error_stack() - Add a stack to the current error message.
* index_stack() - Copy the Nth value on the stack.
* new_stack() - Create a new stack.
* pop_stock() - Pop the top object off the stack.
* push_stack() - Push an object on the stack.
* roll_stack() - Rotate stack objects.
* scan_ps() - Scan a string for the next PS object.
* setpagedevice() - Simulate the PostScript setpagedevice operator.
* DEBUG_object() - Print an object value.
* DEBUG_stack() - Print a stack.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -41,6 +18,7 @@
*/
#include <cups/raster-private.h>
#include <cups/ppd.h>
/*
@@ -112,8 +90,8 @@ static int setpagedevice(_cups_ps_stack_t *st,
cups_page_header2_t *h,
int *preferred_bits);
#ifdef DEBUG
static void DEBUG_object(_cups_ps_obj_t *obj);
static void DEBUG_stack(_cups_ps_stack_t *st);
static void DEBUG_object(const char *prefix, _cups_ps_obj_t *obj);
static void DEBUG_stack(const char *prefix, _cups_ps_stack_t *st);
#endif /* DEBUG */
@@ -144,7 +122,7 @@ static void DEBUG_stack(_cups_ps_stack_t *st);
* @code pop@, @code roll@, @code setpagedevice@, and @code stopped@ operators
* are supported.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/macOS 10.5@
*/
int /* O - 0 on success, -1 on failure */
@@ -162,7 +140,8 @@ cupsRasterInterpretPPD(
float left, /* Left position */
bottom, /* Bottom position */
right, /* Right position */
top; /* Top position */
top, /* Top position */
temp1, temp2; /* Temporary variables for swapping */
int preferred_bits; /* Preferred bits per color */
@@ -189,7 +168,7 @@ cupsRasterInterpretPPD(
h->PageSize[1] = 792;
h->HWResolution[0] = 100;
h->HWResolution[1] = 100;
h->cupsBitsPerColor = 1;
h->cupsBitsPerColor = 1;
h->cupsColorOrder = CUPS_ORDER_CHUNKED;
h->cupsColorSpace = CUPS_CSPACE_K;
h->cupsBorderlessScalingFactor = 1.0f;
@@ -200,11 +179,11 @@ cupsRasterInterpretPPD(
h->cupsImagingBBox[2] = 612.0f;
h->cupsImagingBBox[3] = 792.0f;
strcpy(h->cupsPageSizeName, "Letter");
strlcpy(h->cupsPageSizeName, "Letter", sizeof(h->cupsPageSizeName));
#ifdef __APPLE__
/*
* cupsInteger0 is also used for the total page count on OS X; set an
* cupsInteger0 is also used for the total page count on macOS; set an
* uncommon default value so we can tell if the driver is using cupsInteger0.
*/
@@ -301,6 +280,67 @@ cupsRasterInterpretPPD(
top = 792.0f;
}
/*
* Handle orientation...
*/
switch (h->Orientation)
{
case CUPS_ORIENT_0 :
default :
/* Do nothing */
break;
case CUPS_ORIENT_90 :
temp1 = h->cupsPageSize[0];
h->cupsPageSize[0] = h->cupsPageSize[1];
h->cupsPageSize[1] = temp1;
temp1 = left;
temp2 = right;
left = h->cupsPageSize[0] - top;
right = h->cupsPageSize[0] - bottom;
bottom = h->cupsPageSize[1] - temp1;
top = h->cupsPageSize[1] - temp2;
break;
case CUPS_ORIENT_180 :
temp1 = left;
temp2 = bottom;
left = h->cupsPageSize[0] - right;
right = h->cupsPageSize[0] - temp1;
bottom = h->cupsPageSize[1] - top;
top = h->cupsPageSize[1] - temp2;
break;
case CUPS_ORIENT_270 :
temp1 = h->cupsPageSize[0];
h->cupsPageSize[0] = h->cupsPageSize[1];
h->cupsPageSize[1] = temp1;
temp1 = left;
temp2 = right;
left = bottom;
right = top;
bottom = h->cupsPageSize[1] - temp2;
top = h->cupsPageSize[1] - temp1;
break;
}
if (left > right)
{
temp1 = left;
left = right;
right = temp1;
}
if (bottom > top)
{
temp1 = bottom;
bottom = top;
top = temp1;
}
h->PageSize[0] = (unsigned)(h->cupsPageSize[0] *
h->cupsBorderlessScalingFactor);
h->PageSize[1] = (unsigned)(h->cupsPageSize[1] *
@@ -352,9 +392,9 @@ cupsRasterInterpretPPD(
* Compute the bitmap parameters...
*/
h->cupsWidth = (int)((right - left) * h->cupsBorderlessScalingFactor *
h->cupsWidth = (unsigned)((right - left) * h->cupsBorderlessScalingFactor *
h->HWResolution[0] / 72.0f + 0.5f);
h->cupsHeight = (int)((top - bottom) * h->cupsBorderlessScalingFactor *
h->cupsHeight = (unsigned)((top - bottom) * h->cupsBorderlessScalingFactor *
h->HWResolution[1] / 72.0f + 0.5f);
switch (h->cupsColorSpace)
@@ -470,6 +510,7 @@ _cupsRasterExecPS(
int *preferred_bits,/* O - Preferred bits per color */
const char *code) /* I - PS code to execute */
{
int error = 0; /* Error condition? */
_cups_ps_stack_t *st; /* PostScript value stack */
_cups_ps_obj_t *obj; /* Object from top of stack */
char *codecopy, /* Copy of code */
@@ -477,7 +518,7 @@ _cupsRasterExecPS(
DEBUG_printf(("_cupsRasterExecPS(h=%p, preferred_bits=%p, code=\"%s\")\n",
h, preferred_bits, code ? code : "(null)"));
h, preferred_bits, code));
/*
* Copy the PostScript code and create a stack...
@@ -505,8 +546,8 @@ _cupsRasterExecPS(
while ((obj = scan_ps(st, &codeptr)) != NULL)
{
#ifdef DEBUG
DEBUG_printf(("_cupsRasterExecPS: Stack (%d objects)\n", st->num_objs));
DEBUG_object(obj);
DEBUG_printf(("_cupsRasterExecPS: Stack (%d objects)", st->num_objs));
DEBUG_object("_cupsRasterExecPS", obj);
#endif /* DEBUG */
switch (obj->type)
@@ -519,11 +560,11 @@ _cupsRasterExecPS(
pop_stack(st);
if (cleartomark_stack(st))
_cupsRasterAddError("cleartomark: Stack underflow!\n");
_cupsRasterAddError("cleartomark: Stack underflow.\n");
#ifdef DEBUG
DEBUG_puts(" dup: ");
DEBUG_stack(st);
DEBUG_puts("1_cupsRasterExecPS: dup");
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
@@ -535,7 +576,7 @@ _cupsRasterExecPS(
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: copy");
DEBUG_stack(st);
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
}
break;
@@ -546,7 +587,7 @@ _cupsRasterExecPS(
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: dup");
DEBUG_stack(st);
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
@@ -558,7 +599,7 @@ _cupsRasterExecPS(
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: index");
DEBUG_stack(st);
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
}
break;
@@ -569,7 +610,7 @@ _cupsRasterExecPS(
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: pop");
DEBUG_stack(st);
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
@@ -588,7 +629,7 @@ _cupsRasterExecPS(
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: roll");
DEBUG_stack(st);
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
}
}
@@ -600,7 +641,7 @@ _cupsRasterExecPS(
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: setpagedevice");
DEBUG_stack(st);
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
break;
@@ -611,13 +652,13 @@ _cupsRasterExecPS(
break;
case CUPS_PS_OTHER :
_cupsRasterAddError("Unknown operator \"%s\"!\n", obj->value.other);
DEBUG_printf(("_cupsRasterExecPS: Unknown operator \"%s\"!\n",
obj->value.other));
_cupsRasterAddError("Unknown operator \"%s\".\n", obj->value.other);
error = 1;
DEBUG_printf(("_cupsRasterExecPS: Unknown operator \"%s\".", obj->value.other));
break;
}
if (obj && obj->type == CUPS_PS_OTHER)
if (error)
break;
}
@@ -632,8 +673,8 @@ _cupsRasterExecPS(
error_stack(st, "Stack not empty:");
#ifdef DEBUG
DEBUG_puts("_cupsRasterExecPS: Stack not empty:");
DEBUG_stack(st);
DEBUG_puts("_cupsRasterExecPS: Stack not empty");
DEBUG_stack("_cupsRasterExecPS", st);
#endif /* DEBUG */
delete_stack(st);
@@ -904,7 +945,7 @@ push_stack(_cups_ps_stack_t *st, /* I - Stack */
st->alloc_objs += 32;
if ((temp = realloc(st->objs, st->alloc_objs *
if ((temp = realloc(st->objs, (size_t)st->alloc_objs *
sizeof(_cups_ps_obj_t))) == NULL)
return (NULL);
@@ -934,7 +975,7 @@ roll_stack(_cups_ps_stack_t *st, /* I - Stack */
int n; /* Index into array */
DEBUG_printf((" roll_stack(st=%p, s=%d, c=%d)\n", st, s, c));
DEBUG_printf(("3roll_stack(st=%p, s=%d, c=%d)", st, s, c));
/*
* Range check input...
@@ -965,12 +1006,12 @@ roll_stack(_cups_ps_stack_t *st, /* I - Stack */
s = -s;
if ((temp = calloc(s, sizeof(_cups_ps_obj_t))) == NULL)
if ((temp = calloc((size_t)s, sizeof(_cups_ps_obj_t))) == NULL)
return (-1);
memcpy(temp, st->objs + n, s * sizeof(_cups_ps_obj_t));
memmove(st->objs + n, st->objs + n + s, (c - s) * sizeof(_cups_ps_obj_t));
memcpy(st->objs + n + c - s, temp, s * sizeof(_cups_ps_obj_t));
memcpy(temp, st->objs + n, (size_t)s * sizeof(_cups_ps_obj_t));
memmove(st->objs + n, st->objs + n + s, (size_t)(c - s) * sizeof(_cups_ps_obj_t));
memcpy(st->objs + n + c - s, temp, (size_t)s * sizeof(_cups_ps_obj_t));
}
else
{
@@ -978,13 +1019,12 @@ roll_stack(_cups_ps_stack_t *st, /* I - Stack */
* Shift up...
*/
if ((temp = calloc(s, sizeof(_cups_ps_obj_t))) == NULL)
if ((temp = calloc((size_t)s, sizeof(_cups_ps_obj_t))) == NULL)
return (-1);
memcpy(temp, st->objs + n + c - s, s * sizeof(_cups_ps_obj_t));
memmove(st->objs + n + s, st->objs + n,
(c - s) * sizeof(_cups_ps_obj_t));
memcpy(st->objs + n, temp, s * sizeof(_cups_ps_obj_t));
memcpy(temp, st->objs + n + c - s, (size_t)s * sizeof(_cups_ps_obj_t));
memmove(st->objs + n + s, st->objs + n, (size_t)(c - s) * sizeof(_cups_ps_obj_t));
memcpy(st->objs + n, temp, (size_t)s * sizeof(_cups_ps_obj_t));
}
free(temp);
@@ -1103,7 +1143,7 @@ scan_ps(_cups_ps_stack_t *st, /* I - Stack */
ch = (ch << 3) + *cur - '0';
}
*valptr++ = ch;
*valptr++ = (char)ch;
}
else if (*cur == '\r')
{
@@ -1180,7 +1220,7 @@ scan_ps(_cups_ps_stack_t *st, /* I - Stack */
ch |= tolower(*cur) - 'a' + 10;
}
*valptr++ = ch;
*valptr++ = (char)ch;
}
if (*cur != '>')
@@ -1393,7 +1433,7 @@ setpagedevice(
* Now pull /name and value pairs from the dictionary...
*/
DEBUG_puts("setpagedevice: Dictionary:");
DEBUG_puts("3setpagedevice: Dictionary:");
for (obj ++; obj < end; obj ++)
{
@@ -1408,8 +1448,8 @@ setpagedevice(
obj ++;
#ifdef DEBUG
DEBUG_printf(("setpagedevice: /%s ", name));
DEBUG_object(obj);
DEBUG_printf(("4setpagedevice: /%s ", name));
DEBUG_object("setpagedevice", obj);
#endif /* DEBUG */
/*
@@ -1559,7 +1599,7 @@ setpagedevice(
* Ignore unknown name+value...
*/
DEBUG_printf((" Unknown name (\"%s\") or value...\n", name));
DEBUG_printf(("4setpagedevice: Unknown name (\"%s\") or value...\n", name));
while (obj[1].type != CUPS_PS_NAME && obj < end)
obj ++;
@@ -1576,91 +1616,92 @@ setpagedevice(
*/
static void
DEBUG_object(_cups_ps_obj_t *obj) /* I - Object to print */
DEBUG_object(const char *prefix, /* I - Prefix string */
_cups_ps_obj_t *obj) /* I - Object to print */
{
switch (obj->type)
{
case CUPS_PS_NAME :
DEBUG_printf(("/%s\n", obj->value.name));
DEBUG_printf(("4%s: /%s\n", prefix, obj->value.name));
break;
case CUPS_PS_NUMBER :
DEBUG_printf(("%g\n", obj->value.number));
DEBUG_printf(("4%s: %g\n", prefix, obj->value.number));
break;
case CUPS_PS_STRING :
DEBUG_printf(("(%s)\n", obj->value.string));
DEBUG_printf(("4%s: (%s)\n", prefix, obj->value.string));
break;
case CUPS_PS_BOOLEAN :
if (obj->value.boolean)
DEBUG_puts("true");
DEBUG_printf(("4%s: true", prefix));
else
DEBUG_puts("false");
DEBUG_printf(("4%s: false", prefix));
break;
case CUPS_PS_NULL :
DEBUG_puts("null");
DEBUG_printf(("4%s: null", prefix));
break;
case CUPS_PS_START_ARRAY :
DEBUG_puts("[");
DEBUG_printf(("4%s: [", prefix));
break;
case CUPS_PS_END_ARRAY :
DEBUG_puts("]");
DEBUG_printf(("4%s: ]", prefix));
break;
case CUPS_PS_START_DICT :
DEBUG_puts("<<");
DEBUG_printf(("4%s: <<", prefix));
break;
case CUPS_PS_END_DICT :
DEBUG_puts(">>");
DEBUG_printf(("4%s: >>", prefix));
break;
case CUPS_PS_START_PROC :
DEBUG_puts("{");
DEBUG_printf(("4%s: {", prefix));
break;
case CUPS_PS_END_PROC :
DEBUG_puts("}");
DEBUG_printf(("4%s: }", prefix));
break;
case CUPS_PS_CLEARTOMARK :
DEBUG_puts("--cleartomark--");
DEBUG_printf(("4%s: --cleartomark--", prefix));
break;
case CUPS_PS_COPY :
DEBUG_puts("--copy--");
DEBUG_printf(("4%s: --copy--", prefix));
break;
case CUPS_PS_DUP :
DEBUG_puts("--dup--");
DEBUG_printf(("4%s: --dup--", prefix));
break;
case CUPS_PS_INDEX :
DEBUG_puts("--index--");
DEBUG_printf(("4%s: --index--", prefix));
break;
case CUPS_PS_POP :
DEBUG_puts("--pop--");
DEBUG_printf(("4%s: --pop--", prefix));
break;
case CUPS_PS_ROLL :
DEBUG_puts("--roll--");
DEBUG_printf(("4%s: --roll--", prefix));
break;
case CUPS_PS_SETPAGEDEVICE :
DEBUG_puts("--setpagedevice--");
DEBUG_printf(("4%s: --setpagedevice--", prefix));
break;
case CUPS_PS_STOPPED :
DEBUG_puts("--stopped--");
DEBUG_printf(("4%s: --stopped--", prefix));
break;
case CUPS_PS_OTHER :
DEBUG_printf(("--%s--\n", obj->value.other));
DEBUG_printf(("4%s: --%s--", prefix, obj->value.other));
break;
}
}
@@ -1671,18 +1712,14 @@ DEBUG_object(_cups_ps_obj_t *obj) /* I - Object to print */
*/
static void
DEBUG_stack(_cups_ps_stack_t *st) /* I - Stack */
DEBUG_stack(const char *prefix, /* I - Prefix string */
_cups_ps_stack_t *st) /* I - Stack */
{
int c; /* Looping var */
_cups_ps_obj_t *obj; /* Current object on stack */
for (obj = st->objs, c = st->num_objs; c > 0; c --, obj ++)
DEBUG_object(obj);
DEBUG_object(prefix, obj);
}
#endif /* DEBUG */
/*
* End of "$Id: interpret.c 7852 2008-08-21 04:19:45Z mike $".
*/

View File

@@ -1,6 +1,4 @@
<!--
"$Id$"
PostScript printer driver documentation for CUPS.
Copyright 2007-2012 by Apple Inc.
@@ -15,7 +13,7 @@
<h1 class='title'>Developing PostScript Printer Drivers</h1>
<p>This document describes how to develop printer drivers for PostScript printers. Topics include: <a href='#BASICS'>printer driver basics</a>, <a href='#CREATE'>creating new PPD files</a>, <a href='#IMPORT'>importing existing PPD files</a>, <a href='#FILTERS'>using custom filters</a>, <a href='#COLOR'>implementing color management</a>, and <a href='#MACOSX'>adding OS X features</a>.</p>
<p>This document describes how to develop printer drivers for PostScript printers. Topics include: <a href='#BASICS'>printer driver basics</a>, <a href='#CREATE'>creating new PPD files</a>, <a href='#IMPORT'>importing existing PPD files</a>, <a href='#FILTERS'>using custom filters</a>, <a href='#COLOR'>implementing color management</a>, and <a href='#MACOSX'>adding macOS features</a>.</p>
<div class='summary'><table summary='General Information'>
<tbody>

View File

@@ -264,9 +264,9 @@ information file.</P>
<p>The options used for profile selection can be customized using the <tt>cupsICCQualifier2</tt> and <tt>cupsICCQualifier3</tt> attributes.</p>
<h2 class='title'><a name='MACOSX'>Adding OS X Features</a></h2>
<h2 class='title'><a name='MACOSX'>Adding macOS Features</a></h2>
<p>OS X printer drivers can provide <a href='spec-ppd.html#MACOSX'>additional attributes</a> to specify additional option panes in the print dialog, an image of the printer, a help book, and option presets for the driver software:</p>
<p>macOS printer drivers can provide <a href='spec-ppd.html#MACOSX'>additional attributes</a> to specify additional option panes in the print dialog, an image of the printer, a help book, and option presets for the driver software:</p>
<pre class='example'>
<a href='ref-ppdcfile.html#Attribute'>Attribute</a> APDialogExtension "" /Library/Printers/Vendor/filename.plugin

View File

@@ -1,6 +1,4 @@
<!--
"$Id$"
PPD compiler documentation for CUPS.
Copyright 2007-2012 by Apple Inc.

View File

@@ -205,7 +205,7 @@ follows:</P>
<LI>Bits per color. In the example file, we define 8 bits per color, for
a continuous-tone grayscale output. All versions of CUPS support 1 and
8 bits per color. CUPS 1.2 and higher (OS X 10.5 and higher) also
8 bits per color. CUPS 1.2 and higher (macOS 10.5 and higher) also
supports 16 bits per color.</LI>
<LI>Rows per band. In the example file, we define 0 rows per band to

View File

@@ -1,51 +1,16 @@
/*
* "$Id: pstops.c 7977 2008-09-23 23:44:33Z mike $"
* PostScript filter for CUPS.
*
* PostScript filter for CUPS.
* Copyright 2007-2015 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Main entry.
* add_page() - Add a page to the pages array.
* cancel_job() - Flag the job as canceled.
* check_range() - Check to see if the current page is selected for
* printing.
* copy_bytes() - Copy bytes from the input file to stdout.
* copy_comments() - Copy all of the comments section.
* copy_dsc() - Copy a DSC-conforming document.
* copy_non_dsc() - Copy a document that does not conform to the DSC.
* copy_page() - Copy a page description.
* copy_prolog() - Copy the document prolog section.
* copy_setup() - Copy the document setup section.
* copy_trailer() - Copy the document trailer.
* do_prolog() - Send the necessary document prolog commands.
* do_setup() - Send the necessary document setup commands.
* doc_printf() - Send a formatted string to stdout and/or the temp
* file.
* doc_puts() - Send a nul-terminated string to stdout and/or the
* temp file.
* doc_write() - Send data to stdout and/or the temp file.
* end_nup() - End processing for N-up printing.
* include_feature() - Include a printer option/feature command.
* parse_text() - Parse a text value in a comment.
* set_pstops_options() - Set pstops options.
* skip_page() - Skip past a page that won't be printed.
* start_nup() - Start processing for N-up printing.
* write_label_prolog() - Write the prolog with the classification and page
* label.
* write_labels() - Write the actual page labels.
* write_options() - Write options provided via %%IncludeFeature.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -236,7 +201,7 @@ main(int argc, /* I - Number of command-line args */
int num_options; /* Number of print options */
cups_option_t *options; /* Print options */
char line[8192]; /* Line buffer */
size_t len; /* Length of line buffer */
ssize_t len; /* Length of line buffer */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -297,7 +262,12 @@ main(int argc, /* I - Number of command-line args */
if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
{
_cupsLangPrintError("ERROR", _("Unable to open print file"));
if (!JobCanceled)
{
fprintf(stderr, "DEBUG: Unable to open \"%s\".\n", argv[6]);
_cupsLangPrintError("ERROR", _("Unable to open print file"));
}
return (1);
}
}
@@ -306,7 +276,7 @@ main(int argc, /* I - Number of command-line args */
* Read the first line to see if we have DSC comments...
*/
if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
if ((len = (ssize_t)cupsFileGetLine(fp, line, sizeof(line))) == 0)
{
fputs("DEBUG: The print file is empty.\n", stderr);
return (1);
@@ -355,13 +325,13 @@ main(int argc, /* I - Number of command-line args */
fputs("DEBUG: Skipping PJL header...\n", stderr);
while (strstr(line, "ENTER LANGUAGE") == NULL && strncmp(line, "%!", 2))
if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
if ((len = (ssize_t)cupsFileGetLine(fp, line, sizeof(line))) == 0)
break;
if (!strncmp(line, "%!", 2))
break;
if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
if ((len = (ssize_t)cupsFileGetLine(fp, line, sizeof(line))) == 0)
break;
}
@@ -511,11 +481,11 @@ check_range(pstops_doc_t *doc, /* I - Document information */
{
lower = 1;
range ++;
upper = strtol(range, (char **)&range, 10);
upper = (int)strtol(range, (char **)&range, 10);
}
else
{
lower = strtol(range, (char **)&range, 10);
lower = (int)strtol(range, (char **)&range, 10);
if (*range == '-')
{
@@ -523,7 +493,7 @@ check_range(pstops_doc_t *doc, /* I - Document information */
if (!isdigit(*range & 255))
upper = 65535;
else
upper = strtol(range, (char **)&range, 10);
upper = (int)strtol(range, (char **)&range, 10);
}
else
upper = lower;
@@ -569,14 +539,14 @@ copy_bytes(cups_file_t *fp, /* I - File to read from */
if (nleft > sizeof(buffer) || length == 0)
nbytes = sizeof(buffer);
else
nbytes = nleft;
nbytes = (ssize_t)nleft;
if ((nbytes = cupsFileRead(fp, buffer, nbytes)) < 1)
if ((nbytes = cupsFileRead(fp, buffer, (size_t)nbytes)) < 1)
return;
nleft -= nbytes;
nleft -= (size_t)nbytes;
fwrite(buffer, 1, nbytes, stdout);
fwrite(buffer, 1, (size_t)nbytes, stdout);
}
}
@@ -741,13 +711,13 @@ copy_comments(cups_file_t *fp, /* I - File to read from */
}
else if (!strcmp(line, "%%EndComments"))
{
linelen = cupsFileGetLine(fp, line, linesize);
linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
break;
}
else if (strncmp(line, "%!", 2) && strncmp(line, "%cups", 5))
doc_printf(doc, "%s\n", line);
if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
@@ -860,9 +830,9 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
while (strncmp(line, "%%Page:", 7) && strncmp(line, "%%Trailer", 9))
{
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
@@ -905,7 +875,7 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
doc_puts(doc, "showpage\n");
end_nup(doc, doc->number_up);
pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
pageinfo->length = (ssize_t)(cupsFileTell(doc->temp) - pageinfo->offset);
}
if (doc->slow_duplex && (doc->page & 1))
@@ -929,7 +899,7 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
doc_puts(doc, "showpage\n");
end_nup(doc, doc->number_up);
pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
pageinfo->length = (ssize_t)(cupsFileTell(doc->temp) - pageinfo->offset);
}
/*
@@ -1006,7 +976,7 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
if (!number)
{
pageinfo = (pstops_page_t *)cupsArrayFirst(doc->pages);
copy_bytes(doc->temp, 0, pageinfo->offset);
copy_bytes(doc->temp, 0, (size_t)pageinfo->offset);
}
/*
@@ -1041,7 +1011,7 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */
pageinfo->bounding_box[2], pageinfo->bounding_box[3]);
}
copy_bytes(doc->temp, pageinfo->offset, pageinfo->length);
copy_bytes(doc->temp, pageinfo->offset, (size_t)pageinfo->length);
pageinfo = doc->slow_order ? (pstops_page_t *)cupsArrayPrev(doc->pages) :
(pstops_page_t *)cupsArrayNext(doc->pages);
@@ -1079,11 +1049,13 @@ copy_non_dsc(cups_file_t *fp, /* I - File to read from */
ssize_t linelen, /* I - Length of initial line */
size_t linesize) /* I - Size of line buffer */
{
int copy; /* Current copy */
char buffer[8192]; /* Copy buffer */
int bytes; /* Number of bytes copied */
int copy; /* Current copy */
char buffer[8192]; /* Copy buffer */
ssize_t bytes; /* Number of bytes copied */
(void)linesize;
/*
* First let the user know that they are attempting to print a file
* that may not print correctly...
@@ -1175,17 +1147,17 @@ copy_non_dsc(cups_file_t *fp, /* I - File to read from */
puts("%%EndPageSetup");
puts("%%BeginDocument: nondsc");
fwrite(line, linelen, 1, stdout);
fwrite(line, (size_t)linelen, 1, stdout);
if (doc->temp)
cupsFileWrite(doc->temp, line, linelen);
cupsFileWrite(doc->temp, line, (size_t)linelen);
while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
{
fwrite(buffer, 1, bytes, stdout);
fwrite(buffer, 1, (size_t)bytes, stdout);
if (doc->temp)
cupsFileWrite(doc->temp, buffer, bytes);
cupsFileWrite(doc->temp, buffer, (size_t)bytes);
}
puts("%%EndDocument");
@@ -1303,7 +1275,8 @@ copy_page(cups_file_t *fp, /* I - File to read from */
if (doc->ap_input_slot || doc->ap_manual_feed)
{
if (doc->page == 1)
if ((doc->page == 1 && (!doc->slow_order || !Duplex)) ||
(doc->page == 2 && doc->slow_order && Duplex))
{
/*
* First page/sheet gets AP_FIRSTPAGE_* options...
@@ -1366,7 +1339,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */
memcpy(bounding_box, doc->bounding_box, sizeof(bounding_box));
while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (!strncmp(line, "%%PageBoundingBox:", 18))
{
@@ -1399,24 +1372,24 @@ copy_page(cups_file_t *fp, /* I - File to read from */
switch (Orientation)
{
case 1 : /* Landscape */
bounding_box[0] = PageLength - temp_bbox[3];
bounding_box[0] = (int)(PageLength - temp_bbox[3]);
bounding_box[1] = temp_bbox[0];
bounding_box[2] = PageLength - temp_bbox[1];
bounding_box[2] = (int)(PageLength - temp_bbox[1]);
bounding_box[3] = temp_bbox[2];
break;
case 2 : /* Reverse Portrait */
bounding_box[0] = PageWidth - temp_bbox[2];
bounding_box[1] = PageLength - temp_bbox[3];
bounding_box[2] = PageWidth - temp_bbox[0];
bounding_box[3] = PageLength - temp_bbox[1];
bounding_box[0] = (int)(PageWidth - temp_bbox[2]);
bounding_box[1] = (int)(PageLength - temp_bbox[3]);
bounding_box[2] = (int)(PageWidth - temp_bbox[0]);
bounding_box[3] = (int)(PageLength - temp_bbox[1]);
break;
case 3 : /* Reverse Landscape */
bounding_box[0] = temp_bbox[1];
bounding_box[1] = PageWidth - temp_bbox[2];
bounding_box[1] = (int)(PageWidth - temp_bbox[2]);
bounding_box[2] = temp_bbox[3];
bounding_box[3] = PageWidth - temp_bbox[0];
bounding_box[3] = (int)(PageWidth - temp_bbox[0]);
break;
}
@@ -1549,7 +1522,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */
{
int feature = 0; /* In a Begin/EndFeature block? */
while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (!strncmp(line, "%%EndPageSetup", 14))
break;
@@ -1581,7 +1554,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */
break;
if (!feature || (doc->number_up == 1 && !doc->fit_to_page))
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
}
/*
@@ -1589,7 +1562,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */
*/
if (linelen > 0 && !strncmp(line, "%%EndPageSetup", 14))
linelen = cupsFileGetLine(fp, line, linesize);
linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
}
if (first_page)
@@ -1638,14 +1611,14 @@ copy_page(cups_file_t *fp, /* I - File to read from */
else if (!strncmp(line, "%%BeginDocument", 15) ||
!strncmp(line, "%ADO_BeginApplication", 21))
{
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
level ++;
}
else if ((!strncmp(line, "%%EndDocument", 13) ||
!strncmp(line, "%ADO_EndApplication", 19)) && level > 0)
{
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
level --;
}
@@ -1660,16 +1633,16 @@ copy_page(cups_file_t *fp, /* I - File to read from */
int bytes; /* Bytes of data */
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
bytes = atoi(strchr(line, ':') + 1);
while (bytes > 0)
{
if (bytes > linesize)
if ((size_t)bytes > linesize)
linelen = cupsFileRead(fp, line, linesize);
else
linelen = cupsFileRead(fp, line, bytes);
linelen = cupsFileRead(fp, line, (size_t)bytes);
if (linelen < 1)
{
@@ -1678,15 +1651,15 @@ copy_page(cups_file_t *fp, /* I - File to read from */
return (0);
}
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
bytes -= linelen;
}
}
else
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
}
while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0);
while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0);
/*
* Finish up this page and return...
@@ -1694,7 +1667,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */
end_nup(doc, number);
pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
pageinfo->length = (ssize_t)(cupsFileTell(doc->temp) - pageinfo->offset);
return (linelen);
}
@@ -1720,9 +1693,9 @@ copy_prolog(cups_file_t *fp, /* I - File to read from */
if (!strncmp(line, "%%BeginSetup", 12) || !strncmp(line, "%%Page:", 7))
break;
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
@@ -1732,18 +1705,18 @@ copy_prolog(cups_file_t *fp, /* I - File to read from */
if (!strncmp(line, "%%BeginProlog", 13))
{
while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (!strncmp(line, "%%EndProlog", 11) ||
!strncmp(line, "%%BeginSetup", 12) ||
!strncmp(line, "%%Page:", 7))
break;
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
}
if (!strncmp(line, "%%EndProlog", 11))
linelen = cupsFileGetLine(fp, line, linesize);
linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
else
fputs("DEBUG: The %%EndProlog comment is missing.\n", stderr);
}
@@ -1778,9 +1751,9 @@ copy_setup(cups_file_t *fp, /* I - File to read from */
if (!strncmp(line, "%%Page:", 7))
break;
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
@@ -1807,14 +1780,14 @@ copy_setup(cups_file_t *fp, /* I - File to read from */
num_options = include_feature(ppd, line, num_options, &options);
}
else if (strncmp(line, "%%BeginSetup", 12))
doc_write(doc, line, linelen);
doc_write(doc, line, (size_t)linelen);
if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
if (!strncmp(line, "%%EndSetup", 10))
linelen = cupsFileGetLine(fp, line, linesize);
linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
else
fputs("DEBUG: The %%EndSetup comment is missing.\n", stderr);
}
@@ -1851,6 +1824,8 @@ copy_trailer(cups_file_t *fp, /* I - File to read from */
* Write the trailer comments...
*/
(void)ppd;
puts("%%Trailer");
while (linelen > 0)
@@ -1860,9 +1835,9 @@ copy_trailer(cups_file_t *fp, /* I - File to read from */
else if (strncmp(line, "%%Trailer", 9) &&
strncmp(line, "%%Pages:", 8) &&
strncmp(line, "%%BoundingBox:", 14))
fwrite(line, 1, linelen, stdout);
fwrite(line, 1, (size_t)linelen, stdout);
linelen = cupsFileGetLine(fp, line, linesize);
linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
}
fprintf(stderr, "DEBUG: Wrote %d pages...\n", number);
@@ -2044,21 +2019,21 @@ doc_printf(pstops_doc_t *doc, /* I - Document information */
{
va_list ap; /* Pointer to arguments */
char buffer[1024]; /* Output buffer */
size_t bytes; /* Number of bytes to write */
ssize_t bytes; /* Number of bytes to write */
va_start(ap, format);
bytes = vsnprintf(buffer, sizeof(buffer), format, ap);
va_end(ap);
if (bytes > sizeof(buffer))
if ((size_t)bytes > sizeof(buffer))
{
_cupsLangPrintFilter(stderr, "ERROR",
_("Buffer overflow detected, aborting."));
exit(1);
}
doc_write(doc, buffer, bytes);
doc_write(doc, buffer, (size_t)bytes);
}
@@ -2704,7 +2679,7 @@ skip_page(cups_file_t *fp, /* I - File to read from */
level = 0;
while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (level == 0 &&
(!strncmp(line, "%%Page:", 7) || !strncmp(line, "%%Trailer", 9)))
@@ -2723,17 +2698,16 @@ skip_page(cups_file_t *fp, /* I - File to read from */
* Skip binary data...
*/
int bytes; /* Bytes of data */
ssize_t bytes; /* Bytes of data */
bytes = atoi(strchr(line, ':') + 1);
while (bytes > 0)
{
if (bytes > linesize)
linelen = cupsFileRead(fp, line, linesize);
if ((size_t)bytes > linesize)
linelen = (ssize_t)cupsFileRead(fp, line, linesize);
else
linelen = cupsFileRead(fp, line, bytes);
linelen = (ssize_t)cupsFileRead(fp, line, (size_t)bytes);
if (linelen < 1)
{
@@ -2763,15 +2737,15 @@ start_nup(pstops_doc_t *doc, /* I - Document information */
{
int pos; /* Position on page */
int x, y; /* Relative position of subpage */
float w, l, /* Width and length of subpage */
double w, l, /* Width and length of subpage */
tx, ty; /* Translation values for subpage */
float pagew, /* Printable width of page */
double pagew, /* Printable width of page */
pagel; /* Printable height of page */
int bboxx, /* BoundingBox X origin */
bboxy, /* BoundingBox Y origin */
bboxw, /* BoundingBox width */
bboxl; /* BoundingBox height */
float margin = 0; /* Current margin for border */
double margin = 0; /* Current margin for border */
if (doc->number_up > 1)
@@ -2792,8 +2766,8 @@ start_nup(pstops_doc_t *doc, /* I - Document information */
{
bboxx = 0;
bboxy = 0;
bboxw = PageWidth;
bboxl = PageLength;
bboxw = (int)PageWidth;
bboxl = (int)PageLength;
}
fprintf(stderr, "DEBUG: pagew = %.1f, pagel = %.1f\n", pagew, pagel);
@@ -3124,7 +3098,7 @@ start_nup(pstops_doc_t *doc, /* I - Document information */
if (doc->page_border && show_border)
{
int rects; /* Number of border rectangles */
float fscale; /* Scaling value for points */
double fscale; /* Scaling value for points */
rects = (doc->page_border & PSTOPS_BORDERDOUBLE) ? 2 : 1;
@@ -3364,7 +3338,7 @@ write_options(
{
int i; /* Looping var */
ppd_option_t *option; /* PPD option */
int min_order; /* Minimum OrderDependency value */
float min_order; /* Minimum OrderDependency value */
char *doc_setup, /* DocumentSetup commands to send */
*any_setup; /* AnySetup commands to send */
@@ -3426,8 +3400,3 @@ write_options(
doc_puts(doc, "userdict/setpagedevice{pop}bind put\n");
}
}
/*
* End of "$Id: pstops.c 7977 2008-09-23 23:44:33Z mike $".
*/

View File

@@ -1,6 +1,4 @@
<!--
"$Id$"
Raster printer driver documentation for CUPS.
Copyright 2007-2012 by Apple Inc.
@@ -15,7 +13,7 @@
<h1 class='title'>Developing Raster Printer Drivers</h1>
<p>This document describes how to develop printer drivers for raster printers. Topics include: <a href='#BASICS'>printer driver basics</a>, <a href='#CREATE'>creating new PPD files</a>, <a href='#FILTERS'>using filters</a>, <a href='#COLOR'>implementing color management</a>, and <a href='#MACOSX'>adding OS X features</a>.</p>
<p>This document describes how to develop printer drivers for raster printers. Topics include: <a href='#BASICS'>printer driver basics</a>, <a href='#CREATE'>creating new PPD files</a>, <a href='#FILTERS'>using filters</a>, <a href='#COLOR'>implementing color management</a>, and <a href='#MACOSX'>adding macOS features</a>.</p>
<div class='summary'><table summary='General Information'>
<tbody>

View File

@@ -172,9 +172,9 @@
<p>The options used for profile selection can be customized using the <tt>cupsICCQualifier2</tt> and <tt>cupsICCQualifier3</tt> attributes.</p>
<h3><span class='info'>Since OS X 10.5</span>Custom Color Matching Support</h3>
<h3><span class='info'>Since macOS 10.5</span>Custom Color Matching Support</h3>
<p>OS X printer drivers that are based on an existing standard RGB colorspace can tell the system to use the corresponding colorspace instead of an arbitrary ICC color profile when doing color management. The <a href='#APCustom'><tt>APSupportsCustomColorMatching</tt></a> and <tt>APDefaultCustomColorMatchingProfile</tt> attributes can be used to enable this mode:</p>
<p>macOS printer drivers that are based on an existing standard RGB colorspace can tell the system to use the corresponding colorspace instead of an arbitrary ICC color profile when doing color management. The <a href='#APCustom'><tt>APSupportsCustomColorMatching</tt></a> and <tt>APDefaultCustomColorMatchingProfile</tt> attributes can be used to enable this mode:</p>
<pre class='example'>
<a href='ref-ppdcfile.html#Attribute'>Attribute</a> APSupportsCustomColorMatching "" true
@@ -182,9 +182,9 @@
</pre>
<h2 class='title'><a name='MACOSX'>Adding OS X Features</a></h2>
<h2 class='title'><a name='MACOSX'>Adding macOS Features</a></h2>
<p>OS X printer drivers can provide <a href='spec-ppd.html#MACOSX'>additional attributes</a> to specify additional option panes in the print dialog, an image of the printer, a help book, and option presets for the driver software:</p>
<p>macOS printer drivers can provide <a href='spec-ppd.html#MACOSX'>additional attributes</a> to specify additional option panes in the print dialog, an image of the printer, a help book, and option presets for the driver software:</p>
<pre class='example'>
<a href='ref-ppdcfile.html#Attribute'>Attribute</a> APDialogExtension "" /Library/Printers/Vendor/filename.plugin

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,16 @@
/*
* "$Id: rasterbench.c 7376 2008-03-19 21:07:45Z mike $"
* Raster benchmark program for CUPS.
*
* Raster benchmark program for CUPS.
* Copyright 2007-2016 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Benchmark the raster read/write functions.
* compute_median() - Compute the median time for a test.
* read_test() - Benchmark the raster read functions.
* write_test() - Benchmark the raster write functions.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -28,6 +19,7 @@
#include <config.h>
#include <cups/raster.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <signal.h>
@@ -181,7 +173,7 @@ get_time(void)
static void
read_test(int fd) /* I - File descriptor to read from */
{
int y; /* Looping var */
unsigned y; /* Looping var */
cups_raster_t *r; /* Raster stream */
cups_page_header2_t header; /* Page header */
unsigned char buffer[8 * TEST_WIDTH];
@@ -263,8 +255,8 @@ static void
write_test(int fd, /* I - File descriptor to write to */
cups_mode_t mode) /* I - Write mode */
{
int page, x, y; /* Looping vars */
int count; /* Number of bytes to set */
unsigned page, x, y; /* Looping vars */
unsigned count; /* Number of bytes to set */
cups_raster_t *r; /* Raster stream */
cups_page_header2_t header; /* Page header */
unsigned char data[32][8 * TEST_WIDTH];
@@ -295,7 +287,7 @@ write_test(int fd, /* I - File descriptor to write to */
break;
}
data[y][x] = CUPS_RAND();
data[y][x] = (unsigned char)CUPS_RAND();
}
}
@@ -348,8 +340,3 @@ write_test(int fd, /* I - File descriptor to write to */
cupsRasterClose(r);
}
/*
* End of "$Id: rasterbench.c 7376 2008-03-19 21:07:45Z mike $".
*/

View File

@@ -1,28 +1,16 @@
/*
* "$Id: rastertoepson.c 7450 2008-04-14 19:39:02Z mike $"
* EPSON ESC/P and ESC/P2 filter for CUPS.
*
* EPSON ESC/P and ESC/P2 filter for CUPS.
* Copyright 2007-2015 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* Setup() - Prepare the printer for printing.
* StartPage() - Start a page of graphics.
* EndPage() - Finish a page of graphics.
* Shutdown() - Shutdown the printer.
* CompressData() - Compress a line of graphics.
* OutputLine() - Output a line of graphics.
* main() - Main entry and processing of driver.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -66,17 +54,17 @@ unsigned char *Planes[6], /* Output buffers */
*CompBuffer, /* Compression buffer */
*LineBuffers[2]; /* Line bitmap buffers */
int Model, /* Model number */
NumPlanes, /* Number of color planes */
EjectPage, /* Eject the page when done? */
Shingling, /* Shingle output? */
Canceled; /* Has the current job been canceled? */
unsigned NumPlanes, /* Number of color planes */
Feed, /* Number of lines to skip */
EjectPage; /* Eject the page when done? */
int DotBit, /* Bit in buffers */
DotBit, /* Bit in buffers */
DotBytes, /* # bytes in a dot column */
DotColumns, /* # columns in 1/60 inch */
LineCount, /* # of lines processed */
EvenOffset, /* Offset into 'even' buffers */
OddOffset, /* Offset into 'odd' buffers */
Shingling, /* Shingle output? */
Canceled; /* Has the current job been canceled? */
OddOffset; /* Offset into 'odd' buffers */
/*
@@ -89,8 +77,8 @@ void EndPage(const cups_page_header2_t *header);
void Shutdown(void);
void CancelJob(int sig);
void CompressData(const unsigned char *line, int length, int plane,
int type, int xstep, int ystep);
void CompressData(const unsigned char *line, unsigned length, unsigned plane,
unsigned type, unsigned xstep, unsigned ystep);
void OutputLine(const cups_page_header2_t *header);
void OutputRows(const cups_page_header2_t *header, int row);
@@ -125,10 +113,34 @@ StartPage(
const ppd_file_t *ppd, /* I - PPD file */
const cups_page_header2_t *header) /* I - Page header */
{
int n, t; /* Numbers */
int plane; /* Looping var */
int n, t; /* Numbers */
unsigned plane; /* Looping var */
/*
* Show page device dictionary...
*/
fprintf(stderr, "DEBUG: StartPage...\n");
fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], header->HWResolution[1]);
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], header->Margins[1]);
fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], header->PageSize[1]);
fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor);
fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel);
fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine);
fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder);
fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace);
fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
/*
* Send a reset sequence.
*/
@@ -211,27 +223,26 @@ StartPage(
if (Model < EPSON_ICOLOR)
{
pwrite("\033(U\001\000", 5); /* Resolution/units */
putchar(3600 / header->HWResolution[1]);
putchar((int)(3600 / header->HWResolution[1]));
}
else
{
pwrite("\033(U\005\000", 5);
putchar(1440 / header->HWResolution[1]);
putchar(1440 / header->HWResolution[1]);
putchar(1440 / header->HWResolution[0]);
putchar((int)(1440 / header->HWResolution[1]));
putchar((int)(1440 / header->HWResolution[1]));
putchar((int)(1440 / header->HWResolution[0]));
putchar(0xa0); /* n/1440ths... */
putchar(0x05);
}
n = header->PageSize[1] * header->HWResolution[1] / 72.0;
n = (int)(header->PageSize[1] * header->HWResolution[1] / 72.0);
pwrite("\033(C\002\000", 5); /* Page length */
putchar(n);
putchar(n >> 8);
if (ppd)
t = (ppd->sizes[1].length - ppd->sizes[1].top) *
header->HWResolution[1] / 72.0;
t = (int)((ppd->sizes[1].length - ppd->sizes[1].top) * header->HWResolution[1] / 72.0);
else
t = 0;
@@ -274,7 +285,7 @@ StartPage(
* Allocate memory for a line/row of graphics...
*/
if ((Planes[0] = malloc(header->cupsBytesPerLine)) == NULL)
if ((Planes[0] = malloc(header->cupsBytesPerLine + NumPlanes)) == NULL)
{
fputs("ERROR: Unable to allocate memory\n", stderr);
exit(1);
@@ -285,7 +296,7 @@ StartPage(
if (header->cupsCompression || DotBytes)
{
if ((CompBuffer = calloc(2, header->cupsWidth)) == NULL)
if ((CompBuffer = calloc(2, header->cupsWidth + 1)) == NULL)
{
fputs("ERROR: Unable to allocate memory\n", stderr);
exit(1);
@@ -296,8 +307,7 @@ StartPage(
if (DotBytes)
{
if ((LineBuffers[0] = calloc(DotBytes,
header->cupsWidth * (Shingling + 1))) == NULL)
if ((LineBuffers[0] = calloc((size_t)DotBytes, header->cupsWidth * (size_t)(Shingling + 1))) == NULL)
{
fputs("ERROR: Unable to allocate memory\n", stderr);
exit(1);
@@ -398,11 +408,11 @@ CancelJob(int sig) /* I - Signal */
void
CompressData(const unsigned char *line, /* I - Data to compress */
int length,/* I - Number of bytes */
int plane, /* I - Color plane */
int type, /* I - Type of compression */
int xstep, /* I - X resolution */
int ystep) /* I - Y resolution */
unsigned length,/* I - Number of bytes */
unsigned plane, /* I - Color plane */
unsigned type, /* I - Type of compression */
unsigned xstep, /* I - X resolution */
unsigned ystep) /* I - Y resolution */
{
const unsigned char *line_ptr, /* Current byte pointer */
*line_end, /* End-of-line byte pointer */
@@ -509,7 +519,7 @@ CompressData(const unsigned char *line, /* I - Data to compress */
count ++;
}
*comp_ptr++ = 257 - count;
*comp_ptr++ = (unsigned char)(257 - count);
*comp_ptr++ = *line_ptr++;
}
else
@@ -530,9 +540,9 @@ CompressData(const unsigned char *line, /* I - Data to compress */
count ++;
}
*comp_ptr++ = count - 1;
*comp_ptr++ = (unsigned char)(count - 1);
memcpy(comp_ptr, start, count);
memcpy(comp_ptr, start, (size_t)count);
comp_ptr += count;
}
}
@@ -572,12 +582,12 @@ CompressData(const unsigned char *line, /* I - Data to compress */
length *= 8;
printf("\033."); /* Raster graphics */
putchar(type);
putchar(ystep);
putchar(xstep);
putchar((int)type);
putchar((int)ystep);
putchar((int)xstep);
putchar(1);
putchar(length);
putchar(length >> 8);
putchar((int)length);
putchar((int)(length >> 8));
}
else
{
@@ -587,15 +597,15 @@ CompressData(const unsigned char *line, /* I - Data to compress */
printf("\033i");
putchar(ctable[plane]);
putchar(type);
putchar((int)type);
putchar(1);
putchar(length & 255);
putchar(length >> 8);
putchar((int)length);
putchar((int)(length >> 8));
putchar(1);
putchar(0);
}
pwrite(line_ptr, line_end - line_ptr);
pwrite(line_ptr, (size_t)(line_end - line_ptr));
fflush(stdout);
}
@@ -610,11 +620,11 @@ OutputLine(
{
if (header->cupsRowCount)
{
int width;
unsigned width;
unsigned char *tempptr,
*evenptr,
*oddptr;
register int x;
unsigned int x;
unsigned char bit;
const unsigned char *pixel;
unsigned char *temp;
@@ -667,13 +677,19 @@ OutputLine(
}
for (width = header->cupsWidth, tempptr = CompBuffer;
width > 0;
width > 1;
width -= 2, tempptr += 2, oddptr += DotBytes * 2,
evenptr += DotBytes * 2)
{
evenptr[0] = tempptr[0];
oddptr[0] = tempptr[1];
}
if (width == 1)
{
evenptr[0] = tempptr[0];
oddptr[0] = tempptr[1];
}
}
else
{
@@ -724,10 +740,9 @@ OutputLine(
}
else
{
int plane; /* Current plane */
int bytes; /* Bytes per plane */
int xstep, ystep; /* X & Y resolutions */
unsigned plane; /* Current plane */
unsigned bytes; /* Bytes per plane */
unsigned xstep, ystep; /* X & Y resolutions */
/*
* Write a single line of bitmap data as needed...
@@ -744,7 +759,7 @@ OutputLine(
*/
if (!Planes[plane][0] &&
memcmp(Planes[plane], Planes[plane] + 1, bytes - 1) == 0)
memcmp(Planes[plane], Planes[plane] + 1, (size_t)bytes - 1) == 0)
continue;
/*
@@ -754,14 +769,13 @@ OutputLine(
if (Feed > 0)
{
pwrite("\033(v\002\000", 5); /* Relative vertical position */
putchar(Feed);
putchar(Feed >> 8);
putchar((int)Feed);
putchar((int)(Feed >> 8));
Feed = 0;
}
CompressData(Planes[plane], bytes, plane, header->cupsCompression, xstep,
ystep);
CompressData(Planes[plane], bytes, plane, header->cupsCompression, xstep, ystep);
}
Feed ++;
@@ -778,8 +792,8 @@ OutputRows(
const cups_page_header2_t *header, /* I - Page image header */
int row) /* I - Row number (0 or 1) */
{
unsigned i, n; /* Looping vars */
int dot_count, /* Number of bytes to print */
unsigned i, n, /* Looping vars */
dot_count, /* Number of bytes to print */
dot_min; /* Minimum number of bytes */
unsigned char *dot_ptr, /* Pointer to print data */
*ptr; /* Current data */
@@ -788,8 +802,7 @@ OutputRows(
dot_min = DotBytes * DotColumns;
if (LineBuffers[row][0] != 0 ||
memcmp(LineBuffers[row], LineBuffers[row] + 1,
header->cupsWidth * DotBytes - 1))
memcmp(LineBuffers[row], LineBuffers[row] + 1, header->cupsWidth * DotBytes - 1))
{
/*
* Skip leading space...
@@ -826,8 +839,8 @@ OutputRows(
{
putchar(0x1b);
putchar('$');
putchar(i & 255);
putchar(i >> 8);
putchar((int)(i & 255));
putchar((int)(i >> 8));
}
/*
@@ -867,9 +880,9 @@ OutputRows(
break;
}
n = (unsigned)dot_count / DotBytes;
putchar(n & 255);
putchar(n / 256);
n = dot_count / DotBytes;
putchar((int)(n & 255));
putchar((int)(n / 256));
/*
* Write the graphics data...
@@ -888,6 +901,9 @@ OutputRows(
putchar(0);
}
if (dot_count & 1)
putchar(*ptr);
/*
* Move the head back and print the odd bytes...
*/
@@ -898,8 +914,8 @@ OutputRows(
{
putchar(0x1b);
putchar('$');
putchar(i & 255);
putchar(i >> 8);
putchar((int)(i & 255));
putchar((int)(i >> 8));
}
if (header->HWResolution[0] == 120)
@@ -908,14 +924,17 @@ OutputRows(
printf("\033*\003"); /* Select bit image */
n = (unsigned)dot_count / DotBytes;
putchar(n & 255);
putchar(n / 256);
putchar((int)(n & 255));
putchar((int)(n / 256));
for (n = dot_count / 2, ptr = dot_ptr + 1; n > 0; n --, ptr += 2)
{
putchar(0);
putchar(*ptr);
}
if (dot_count & 1)
putchar(0);
}
else
pwrite(dot_ptr, dot_count);
@@ -958,7 +977,7 @@ main(int argc, /* I - Number of command-line arguments */
cups_page_header2_t header; /* Page header from file */
ppd_file_t *ppd; /* PPD file */
int page; /* Current page */
int y; /* Current line */
unsigned y; /* Current line */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@@ -1090,9 +1109,9 @@ main(int argc, /* I - Number of command-line arguments */
if ((y & 127) == 0)
{
_cupsLangPrintFilter(stderr, "INFO",
_("Printing page %d, %d%% complete."),
_("Printing page %d, %u%% complete."),
page, 100 * y / header.cupsHeight);
fprintf(stderr, "ATTR: job-media-progress=%d\n",
fprintf(stderr, "ATTR: job-media-progress=%u\n",
100 * y / header.cupsHeight);
}
@@ -1150,8 +1169,3 @@ main(int argc, /* I - Number of command-line arguments */
else
return (0);
}
/*
* End of "$Id: rastertoepson.c 7450 2008-04-14 19:39:02Z mike $".
*/

View File

@@ -1,29 +1,16 @@
/*
* "$Id: rastertohp.c 7834 2008-08-04 21:02:09Z mike $"
* Hewlett-Packard Page Control Language filter for CUPS.
*
* Hewlett-Packard Page Control Language filter for CUPS.
* Copyright 2007-2015 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* Setup() - Prepare the printer for printing.
* StartPage() - Start a page of graphics.
* EndPage() - Finish a page of graphics.
* Shutdown() - Shutdown the printer.
* CancelJob() - Cancel the current job...
* CompressData() - Compress a line of graphics.
* OutputLine() - Output a line of graphics.
* main() - Main entry and processing of driver.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -47,10 +34,10 @@
unsigned char *Planes[4], /* Output buffers */
*CompBuffer, /* Compression buffer */
*BitBuffer; /* Buffer for output bits */
int NumPlanes, /* Number of color planes */
unsigned NumPlanes, /* Number of color planes */
ColorBits, /* Number of bits per color */
Feed, /* Number of lines to skip */
Duplex, /* Current duplex mode */
Feed; /* Number of lines to skip */
int Duplex, /* Current duplex mode */
Page, /* Current page number */
Canceled; /* Has the current job been canceled? */
@@ -65,7 +52,7 @@ void EndPage(void);
void Shutdown(void);
void CancelJob(int sig);
void CompressData(unsigned char *line, int length, int plane, int type);
void CompressData(unsigned char *line, unsigned length, unsigned plane, unsigned type);
void OutputLine(cups_page_header2_t *header);
@@ -93,7 +80,7 @@ void
StartPage(ppd_file_t *ppd, /* I - PPD file */
cups_page_header2_t *header) /* I - Page header */
{
int plane; /* Looping var */
unsigned plane; /* Looping var */
/*
@@ -101,39 +88,15 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
*/
fprintf(stderr, "DEBUG: StartPage...\n");
fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor);
fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType);
fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType);
fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance);
fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia);
fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate);
fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia);
fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0],
header->HWResolution[1]);
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n",
header->ImagingBoundingBox[0], header->ImagingBoundingBox[1],
header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet);
fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog);
fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge);
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0],
header->Margins[1]);
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], header->HWResolution[1]);
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], header->Margins[1]);
fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight);
fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint);
fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint);
fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp);
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0],
header->PageSize[1]);
fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations);
fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch);
fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble);
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], header->PageSize[1]);
fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
@@ -287,33 +250,33 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
printf("\033*g26W");
putchar(2); /* Format 2 */
putchar(NumPlanes); /* Output planes */
putchar((int)NumPlanes); /* Output planes */
putchar(header->HWResolution[0] >> 8); /* Black resolution */
putchar(header->HWResolution[0]);
putchar(header->HWResolution[1] >> 8);
putchar(header->HWResolution[1]);
putchar((int)(header->HWResolution[0] >> 8));/* Black resolution */
putchar((int)header->HWResolution[0]);
putchar((int)(header->HWResolution[1] >> 8));
putchar((int)header->HWResolution[1]);
putchar(0);
putchar(1 << ColorBits); /* # of black levels */
putchar(header->HWResolution[0] >> 8); /* Cyan resolution */
putchar(header->HWResolution[0]);
putchar(header->HWResolution[1] >> 8);
putchar(header->HWResolution[1]);
putchar((int)(header->HWResolution[0] >> 8));/* Cyan resolution */
putchar((int)header->HWResolution[0]);
putchar((int)(header->HWResolution[1] >> 8));
putchar((int)header->HWResolution[1]);
putchar(0);
putchar(1 << ColorBits); /* # of cyan levels */
putchar(header->HWResolution[0] >> 8); /* Magenta resolution */
putchar(header->HWResolution[0]);
putchar(header->HWResolution[1] >> 8);
putchar(header->HWResolution[1]);
putchar((int)(header->HWResolution[0] >> 8));/* Magenta resolution */
putchar((int)header->HWResolution[0]);
putchar((int)(header->HWResolution[1] >> 8));
putchar((int)header->HWResolution[1]);
putchar(0);
putchar(1 << ColorBits); /* # of magenta levels */
putchar(header->HWResolution[0] >> 8); /* Yellow resolution */
putchar(header->HWResolution[0]);
putchar(header->HWResolution[1] >> 8);
putchar(header->HWResolution[1]);
putchar((int)(header->HWResolution[0] >> 8));/* Yellow resolution */
putchar((int)header->HWResolution[0]);
putchar((int)(header->HWResolution[1] >> 8));
putchar((int)header->HWResolution[1]);
putchar(0);
putchar(1 << ColorBits); /* # of yellow levels */
@@ -321,7 +284,7 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
}
else
{
printf("\033*t%dR", header->HWResolution[0]);
printf("\033*t%uR", header->HWResolution[0]);
/* Set resolution */
if (header->cupsColorSpace == CUPS_CSPACE_KCMY)
@@ -341,8 +304,8 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
* Set size and position of graphics...
*/
printf("\033*r%dS", header->cupsWidth); /* Set width */
printf("\033*r%dT", header->cupsHeight); /* Set height */
printf("\033*r%uS", header->cupsWidth); /* Set width */
printf("\033*r%uT", header->cupsHeight); /* Set height */
printf("\033&a0H"); /* Set horizontal position */
@@ -356,7 +319,7 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
printf("\033*r1A"); /* Start graphics */
if (header->cupsCompression)
printf("\033*b%dM", /* Set compression */
printf("\033*b%uM", /* Set compression */
header->cupsCompression);
Feed = 0; /* No blank lines yet */
@@ -365,7 +328,7 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
* Allocate memory for a line of graphics...
*/
if ((Planes[0] = malloc(header->cupsBytesPerLine)) == NULL)
if ((Planes[0] = malloc(header->cupsBytesPerLine + NumPlanes)) == NULL)
{
fputs("ERROR: Unable to allocate memory\n", stderr);
exit(1);
@@ -380,7 +343,7 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
BitBuffer = NULL;
if (header->cupsCompression)
CompBuffer = malloc(header->cupsBytesPerLine * 2);
CompBuffer = malloc(header->cupsBytesPerLine * 2 + 2);
else
CompBuffer = NULL;
}
@@ -463,15 +426,15 @@ CancelJob(int sig) /* I - Signal */
void
CompressData(unsigned char *line, /* I - Data to compress */
int length, /* I - Number of bytes */
int plane, /* I - Color plane */
int type) /* I - Type of compression */
unsigned length, /* I - Number of bytes */
unsigned plane, /* I - Color plane */
unsigned type) /* I - Type of compression */
{
unsigned char *line_ptr, /* Current byte pointer */
*line_end, /* End-of-line byte pointer */
*comp_ptr, /* Pointer into compression buffer */
*start; /* Start of compression sequence */
int count; /* Count of bytes for output */
unsigned count; /* Count of bytes for output */
switch (type)
@@ -501,7 +464,7 @@ CompressData(unsigned char *line, /* I - Data to compress */
count < 256;
count ++);
comp_ptr[0] = count - 1;
comp_ptr[0] = (unsigned char)(count - 1);
comp_ptr[1] = line_ptr[0];
}
@@ -546,7 +509,7 @@ CompressData(unsigned char *line, /* I - Data to compress */
count ++;
}
*comp_ptr++ = 257 - count;
*comp_ptr++ = (unsigned char)(257 - count);
*comp_ptr++ = *line_ptr++;
}
else
@@ -567,7 +530,7 @@ CompressData(unsigned char *line, /* I - Data to compress */
count ++;
}
*comp_ptr++ = count - 1;
*comp_ptr++ = (unsigned char)(count - 1);
memcpy(comp_ptr, start, count);
comp_ptr += count;
@@ -584,7 +547,7 @@ CompressData(unsigned char *line, /* I - Data to compress */
*/
printf("\033*b%d%c", (int)(line_end - line_ptr), plane);
fwrite(line_ptr, line_end - line_ptr, 1, stdout);
fwrite(line_ptr, (size_t)(line_end - line_ptr), 1, stdout);
}
@@ -595,7 +558,7 @@ CompressData(unsigned char *line, /* I - Data to compress */
void
OutputLine(cups_page_header2_t *header) /* I - Page header */
{
int plane, /* Current plane */
unsigned plane, /* Current plane */
bytes, /* Bytes to write */
count; /* Bytes to convert */
unsigned char bit, /* Current plane data */
@@ -644,15 +607,15 @@ OutputLine(cups_page_header2_t *header) /* I - Page header */
{
bit = plane_ptr[0];
bit0 = ((bit & 64) << 1) | ((bit & 16) << 2) | ((bit & 4) << 3) | ((bit & 1) << 4);
bit1 = (bit & 128) | ((bit & 32) << 1) | ((bit & 8) << 2) | ((bit & 2) << 3);
bit0 = (unsigned char)(((bit & 64) << 1) | ((bit & 16) << 2) | ((bit & 4) << 3) | ((bit & 1) << 4));
bit1 = (unsigned char)((bit & 128) | ((bit & 32) << 1) | ((bit & 8) << 2) | ((bit & 2) << 3));
if (count > 1)
{
bit = plane_ptr[1];
bit0 |= (bit & 1) | ((bit & 4) >> 1) | ((bit & 16) >> 2) | ((bit & 64) >> 3);
bit1 |= ((bit & 2) >> 1) | ((bit & 8) >> 2) | ((bit & 32) >> 3) | ((bit & 128) >> 4);
bit0 |= (unsigned char)((bit & 1) | ((bit & 4) >> 1) | ((bit & 16) >> 2) | ((bit & 64) >> 3));
bit1 |= (unsigned char)(((bit & 2) >> 1) | ((bit & 8) >> 2) | ((bit & 32) >> 3) | ((bit & 128) >> 4));
}
bit_ptr[0] = bit0;
@@ -683,7 +646,7 @@ main(int argc, /* I - Number of command-line arguments */
int fd; /* File descriptor */
cups_raster_t *ras; /* Raster stream for printing */
cups_page_header2_t header; /* Page header from file */
int y; /* Current line */
unsigned y; /* Current line */
ppd_file_t *ppd; /* PPD file */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
@@ -814,9 +777,9 @@ main(int argc, /* I - Number of command-line arguments */
if ((y & 127) == 0)
{
_cupsLangPrintFilter(stderr, "INFO",
_("Printing page %d, %d%% complete."),
_("Printing page %d, %u%% complete."),
Page, 100 * y / header.cupsHeight);
fprintf(stderr, "ATTR: job-media-progress=%d\n",
fprintf(stderr, "ATTR: job-media-progress=%u\n",
100 * y / header.cupsHeight);
}
@@ -879,8 +842,3 @@ main(int argc, /* I - Number of command-line arguments */
else
return (0);
}
/*
* End of "$Id: rastertohp.c 7834 2008-08-04 21:02:09Z mike $".
*/

View File

@@ -1,29 +1,16 @@
/*
* "$Id: rastertolabel.c 7720 2008-07-11 22:46:21Z mike $"
* Label printer filter for CUPS.
*
* Label printer filter for CUPS.
* Copyright 2007-2015 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* Setup() - Prepare the printer for printing.
* StartPage() - Start a page of graphics.
* EndPage() - Finish a page of graphics.
* CancelJob() - Cancel the current job...
* OutputLine() - Output a line of graphics.
* PCLCompress() - Output a PCL (mode 3) compressed line.
* ZPLCompress() - Output a run-length compression sequence.
* main() - Main entry and processing of driver.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -78,10 +65,10 @@
unsigned char *Buffer; /* Output buffer */
unsigned char *CompBuffer; /* Compression buffer */
unsigned char *LastBuffer; /* Last buffer */
unsigned Feed; /* Number of lines to skip */
int LastSet; /* Number of repeat characters */
int ModelNumber, /* cupsModelNumber attribute */
Page, /* Current page */
Feed, /* Number of lines to skip */
Canceled; /* Non-zero if job is canceled */
@@ -93,9 +80,9 @@ void Setup(ppd_file_t *ppd);
void StartPage(ppd_file_t *ppd, cups_page_header2_t *header);
void EndPage(ppd_file_t *ppd, cups_page_header2_t *header);
void CancelJob(int sig);
void OutputLine(ppd_file_t *ppd, cups_page_header2_t *header, int y);
void PCLCompress(unsigned char *line, int length);
void ZPLCompress(char repeat_char, int repeat_count);
void OutputLine(ppd_file_t *ppd, cups_page_header2_t *header, unsigned y);
void PCLCompress(unsigned char *line, unsigned length);
void ZPLCompress(unsigned char repeat_char, unsigned repeat_count);
/*
@@ -169,7 +156,7 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
cups_page_header2_t *header) /* I - Page header */
{
ppd_choice_t *choice; /* Marked choice */
int length; /* Actual label length */
unsigned length; /* Actual label length */
/*
@@ -177,39 +164,15 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
*/
fprintf(stderr, "DEBUG: StartPage...\n");
fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor);
fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType);
fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType);
fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance);
fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia);
fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate);
fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia);
fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0],
header->HWResolution[1]);
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n",
header->ImagingBoundingBox[0], header->ImagingBoundingBox[1],
header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet);
fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog);
fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge);
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0],
header->Margins[1]);
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], header->HWResolution[1]);
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], header->Margins[1]);
fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight);
fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint);
fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint);
fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp);
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0],
header->PageSize[1]);
fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations);
fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch);
fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble);
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], header->PageSize[1]);
fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
@@ -219,9 +182,6 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder);
fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace);
fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount);
fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed);
fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep);
switch (ModelNumber)
{
@@ -289,7 +249,7 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
if ((choice = ppdFindMarkedChoice(ppd, "zePrintRate")) != NULL &&
strcmp(choice->choice, "Default"))
{
float val = atof(choice->choice);
double val = atof(choice->choice);
if (val >= 3.0)
printf("S%.0f\n", val);
@@ -302,13 +262,13 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
*/
if (header->cupsCompression > 0 && header->cupsCompression <= 100)
printf("D%d\n", 15 * header->cupsCompression / 100);
printf("D%u\n", 15 * header->cupsCompression / 100);
/*
* Set label size...
*/
printf("q%d\n", (header->cupsWidth + 7) & ~7);
printf("q%u\n", (header->cupsWidth + 7) & ~7U);
break;
case ZEBRA_ZPL :
@@ -317,13 +277,13 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
*/
if (header->cupsCompression > 0 && header->cupsCompression <= 100)
printf("~SD%02d\n", 30 * header->cupsCompression / 100);
printf("~SD%02u\n", 30 * header->cupsCompression / 100);
/*
* Start bitmap graphics...
*/
printf("~DGR:CUPS.GRF,%d,%d,\n",
printf("~DGR:CUPS.GRF,%u,%u,\n",
header->cupsHeight * header->cupsBytesPerLine,
header->cupsBytesPerLine);
@@ -344,8 +304,8 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
printf("! 0 %u %u %u %u\r\n", header->HWResolution[0],
header->HWResolution[1], header->cupsHeight,
header->NumCopies);
printf("PAGE-WIDTH %d\r\n", header->cupsWidth);
printf("PAGE-HEIGHT %d\r\n", header->cupsWidth);
printf("PAGE-WIDTH %u\r\n", header->cupsWidth);
printf("PAGE-HEIGHT %u\r\n", header->cupsWidth);
break;
case INTELLITECH_PCL :
@@ -391,14 +351,15 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
break;
default : /* Custom size */
printf("\033!f%dZ", header->PageSize[1] * 300 / 72);
printf("\033!f%uZ", header->PageSize[1] * 300 / 72);
break;
}
printf("\033&l%dP", /* Set page length */
printf("\033&l%uP", /* Set page length */
header->PageSize[1] / 12);
printf("\033&l0E"); /* Set top margin to 0 */
printf("\033&l%dX", header->NumCopies);
if (header->NumCopies)
printf("\033&l%uX", header->NumCopies);
/* Set number copies */
printf("\033&l0L"); /* Turn off perforation skip */
@@ -409,11 +370,11 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
if (Page == 1)
{
if (header->cupsRowFeed) /* inPrintRate */
printf("\033!p%dS", header->cupsRowFeed);
printf("\033!p%uS", header->cupsRowFeed);
if (header->cupsCompression != ~0)
if (header->cupsCompression != ~0U)
/* inPrintDensity */
printf("\033&d%dA", 30 * header->cupsCompression / 100 - 15);
printf("\033&d%uA", 30 * header->cupsCompression / 100 - 15);
if ((choice = ppdFindMarkedChoice(ppd, "inPrintMode")) != NULL)
{
@@ -424,14 +385,14 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
fputs("\033!p1M", stdout);
if (header->cupsRowCount) /* inTearInterval */
printf("\033!n%dT", header->cupsRowCount);
printf("\033!n%uT", header->cupsRowCount);
}
else
{
fputs("\033!p2M", stdout);
if (header->cupsRowStep) /* inCutInterval */
printf("\033!n%dC", header->cupsRowStep);
printf("\033!n%uC", header->cupsRowStep);
}
}
}
@@ -440,12 +401,12 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
* Setup graphics...
*/
printf("\033*t%dR", header->HWResolution[0]);
printf("\033*t%uR", header->HWResolution[0]);
/* Set resolution */
printf("\033*r%dS", header->cupsWidth);
printf("\033*r%uS", header->cupsWidth);
/* Set width */
printf("\033*r%dT", header->cupsHeight);
printf("\033*r%uT", header->cupsHeight);
/* Set height */
printf("\033&a0H"); /* Set horizontal position */
@@ -508,6 +469,13 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */
*/
puts("P1");
/*
* Cut the label as needed...
*/
if (header->CutMedia)
puts("C");
break;
case ZEBRA_ZPL :
@@ -567,7 +535,7 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */
*/
if (header->cupsRowStep != 200)
printf("^LT%u\n", header->cupsRowStep);
printf("^LT%d\n", header->cupsRowStep);
/*
* Set media type...
@@ -641,11 +609,11 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */
puts("^XZ");
/*
* Free compression buffers...
*/
* Cut the label as needed...
*/
free(CompBuffer);
free(LastBuffer);
if (header->CutMedia)
puts("^CN1");
break;
case ZEBRA_CPCL :
@@ -714,6 +682,18 @@ EndPage(ppd_file_t *ppd, /* I - PPD file */
*/
free(Buffer);
if (CompBuffer)
{
free(CompBuffer);
CompBuffer = NULL;
}
if (LastBuffer)
{
free(LastBuffer);
LastBuffer = NULL;
}
}
@@ -741,17 +721,19 @@ CancelJob(int sig) /* I - Signal */
void
OutputLine(ppd_file_t *ppd, /* I - PPD file */
cups_page_header2_t *header, /* I - Page header */
int y) /* I - Line number */
unsigned y) /* I - Line number */
{
int i; /* Looping var */
unsigned i; /* Looping var */
unsigned char *ptr; /* Pointer into buffer */
unsigned char *compptr; /* Pointer into compression buffer */
char repeat_char; /* Repeated character */
int repeat_count; /* Number of repeated characters */
static const char *hex = "0123456789ABCDEF";
unsigned char repeat_char; /* Repeated character */
unsigned repeat_count; /* Number of repeated characters */
static const unsigned char *hex = (const unsigned char *)"0123456789ABCDEF";
/* Hex digits */
(void)ppd;
switch (ModelNumber)
{
case DYMO_3x0 :
@@ -777,17 +759,6 @@ OutputLine(ppd_file_t *ppd, /* I - PPD file */
putchar(0x16);
fwrite(Buffer, header->cupsBytesPerLine, 1, stdout);
fflush(stdout);
#ifdef __sgi
/*
* This hack works around a bug in the IRIX serial port driver when
* run at high baud rates (e.g. 115200 baud)... This results in
* slightly slower label printing, but at least the labels come
* out properly.
*/
sginap(1);
#endif /* __sgi */
}
else
Feed ++;
@@ -919,14 +890,14 @@ OutputLine(ppd_file_t *ppd, /* I - PPD file */
void
PCLCompress(unsigned char *line, /* I - Line to compress */
int length) /* I - Length of line */
unsigned length) /* I - Length of line */
{
unsigned char *line_ptr, /* Current byte pointer */
*line_end, /* End-of-line byte pointer */
*comp_ptr, /* Pointer into compression buffer */
*start, /* Start of compression sequence */
*seed; /* Seed buffer pointer */
int count, /* Count of bytes for output */
unsigned count, /* Count of bytes for output */
offset; /* Offset of bytes for output */
@@ -956,7 +927,7 @@ PCLCompress(unsigned char *line, /* I - Line to compress */
offset = 0;
if ((count = line_end - line_ptr) > 8)
if ((count = (unsigned)(line_end - line_ptr)) > 8)
count = 8;
line_ptr += count;
@@ -977,7 +948,7 @@ PCLCompress(unsigned char *line, /* I - Line to compress */
if (line_ptr == line_end)
break;
offset = line_ptr - start;
offset = (unsigned)(line_ptr - start);
/*
* Find up to 8 non-matching bytes...
@@ -1006,7 +977,7 @@ PCLCompress(unsigned char *line, /* I - Line to compress */
* Output multi-byte offset...
*/
*comp_ptr++ = ((count - 1) << 5) | 31;
*comp_ptr++ = (unsigned char)(((count - 1) << 5) | 31);
offset -= 31;
while (offset >= 255)
@@ -1015,7 +986,7 @@ PCLCompress(unsigned char *line, /* I - Line to compress */
offset -= 255;
}
*comp_ptr++ = offset;
*comp_ptr++ = (unsigned char)offset;
}
else
{
@@ -1023,7 +994,7 @@ PCLCompress(unsigned char *line, /* I - Line to compress */
* Output single-byte offset...
*/
*comp_ptr++ = ((count - 1) << 5) | offset;
*comp_ptr++ = (unsigned char)(((count - 1) << 5) | offset);
}
memcpy(comp_ptr, start, count);
@@ -1035,7 +1006,7 @@ PCLCompress(unsigned char *line, /* I - Line to compress */
*/
printf("\033*b%dW", (int)(comp_ptr - CompBuffer));
fwrite(CompBuffer, comp_ptr - CompBuffer, 1, stdout);
fwrite(CompBuffer, (size_t)(comp_ptr - CompBuffer), 1, stdout);
/*
* Save this line as a "seed" buffer for the next...
@@ -1051,8 +1022,8 @@ PCLCompress(unsigned char *line, /* I - Line to compress */
*/
void
ZPLCompress(char repeat_char, /* I - Character to repeat */
int repeat_count) /* I - Number of repeated characters */
ZPLCompress(unsigned char repeat_char, /* I - Character to repeat */
unsigned repeat_count) /* I - Number of repeated characters */
{
if (repeat_count > 1)
{
@@ -1073,7 +1044,7 @@ ZPLCompress(char repeat_char, /* I - Character to repeat */
if (repeat_count >= 20)
{
putchar('f' + repeat_count / 20);
putchar((int)('f' + repeat_count / 20));
repeat_count %= 20;
}
@@ -1082,14 +1053,14 @@ ZPLCompress(char repeat_char, /* I - Character to repeat */
*/
if (repeat_count > 0)
putchar('F' + repeat_count);
putchar((int)('F' + repeat_count));
}
/*
* Then the character to be repeated...
*/
putchar(repeat_char);
putchar((int)repeat_char);
}
@@ -1104,7 +1075,7 @@ main(int argc, /* I - Number of command-line arguments */
int fd; /* File descriptor */
cups_raster_t *ras; /* Raster stream for printing */
cups_page_header2_t header; /* Page header from file */
int y; /* Current line */
unsigned y; /* Current line */
ppd_file_t *ppd; /* PPD file */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
@@ -1246,9 +1217,9 @@ main(int argc, /* I - Number of command-line arguments */
if ((y & 15) == 0)
{
_cupsLangPrintFilter(stderr, "INFO",
_("Printing page %d, %d%% complete."),
_("Printing page %d, %u%% complete."),
Page, 100 * y / header.cupsHeight);
fprintf(stderr, "ATTR: job-media-progress=%d\n",
fprintf(stderr, "ATTR: job-media-progress=%u\n",
100 * y / header.cupsHeight);
}
@@ -1305,8 +1276,3 @@ main(int argc, /* I - Number of command-line arguments */
else
return (0);
}
/*
* End of "$Id: rastertolabel.c 7720 2008-07-11 22:46:21Z mike $".
*/

View File

@@ -1,21 +1,15 @@
/*
* "$Id: rastertopwg.c 3427 2011-09-20 18:40:57Z msweet $"
* CUPS raster to PWG raster format filter for CUPS.
*
* CUPS raster to PWG raster format filter for CUPS.
* Copyright 2011, 2014-2016 Apple Inc.
*
* Copyright 2011 Apple Inc.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright law.
* Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright law.
* Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Main entry for filter.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -23,6 +17,7 @@
*/
#include <cups/cups-private.h>
#include <cups/ppd-private.h>
#include <cups/raster.h>
#include <unistd.h>
#include <fcntl.h>
@@ -41,9 +36,9 @@ main(int argc, /* I - Number of command-line args */
*outras; /* Output raster stream */
cups_page_header2_t inheader, /* Input raster page header */
outheader; /* Output raster page header */
int y; /* Current line */
unsigned y; /* Current line */
unsigned char *line; /* Line buffer */
int page = 0, /* Current page */
unsigned page = 0, /* Current page */
page_width, /* Actual page width */
page_height, /* Actual page height */
page_top, /* Top margin */
@@ -55,8 +50,8 @@ main(int argc, /* I - Number of command-line args */
ppd_file_t *ppd; /* PPD file */
ppd_attr_t *back; /* cupsBackSize attribute */
_ppd_cache_t *cache; /* PPD cache */
_pwg_size_t *pwg_size; /* PWG media size */
_pwg_media_t *pwg_media; /* PWG media name */
pwg_size_t *pwg_size; /* PWG media size */
pwg_media_t *pwg_media; /* PWG media name */
int num_options; /* Number of options */
cups_option_t *options = NULL;/* Options */
const char *val; /* Option value */
@@ -93,6 +88,29 @@ main(int argc, /* I - Number of command-line args */
while (cupsRasterReadHeader2(inras, &inheader))
{
/*
* Show page device dictionary...
*/
fprintf(stderr, "DEBUG: Duplex = %d\n", inheader.Duplex);
fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", inheader.HWResolution[0], inheader.HWResolution[1]);
fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", inheader.ImagingBoundingBox[0], inheader.ImagingBoundingBox[1], inheader.ImagingBoundingBox[2], inheader.ImagingBoundingBox[3]);
fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", inheader.Margins[0], inheader.Margins[1]);
fprintf(stderr, "DEBUG: ManualFeed = %d\n", inheader.ManualFeed);
fprintf(stderr, "DEBUG: MediaPosition = %d\n", inheader.MediaPosition);
fprintf(stderr, "DEBUG: NumCopies = %d\n", inheader.NumCopies);
fprintf(stderr, "DEBUG: Orientation = %d\n", inheader.Orientation);
fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", inheader.PageSize[0], inheader.PageSize[1]);
fprintf(stderr, "DEBUG: cupsWidth = %d\n", inheader.cupsWidth);
fprintf(stderr, "DEBUG: cupsHeight = %d\n", inheader.cupsHeight);
fprintf(stderr, "DEBUG: cupsMediaType = %d\n", inheader.cupsMediaType);
fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", inheader.cupsBitsPerColor);
fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", inheader.cupsBitsPerPixel);
fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", inheader.cupsBytesPerLine);
fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", inheader.cupsColorOrder);
fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", inheader.cupsColorSpace);
fprintf(stderr, "DEBUG: cupsCompression = %d\n", inheader.cupsCompression);
/*
* Compute the real raster size...
*/
@@ -101,18 +119,21 @@ main(int argc, /* I - Number of command-line args */
fprintf(stderr, "PAGE: %d %d\n", page, inheader.NumCopies);
page_width = (int)(inheader.cupsPageSize[0] * inheader.HWResolution[0] /
72.0);
page_height = (int)(inheader.cupsPageSize[1] * inheader.HWResolution[1] /
72.0);
page_left = (int)(inheader.cupsImagingBBox[0] *
inheader.HWResolution[0] / 72.0);
page_bottom = (int)(inheader.cupsImagingBBox[1] *
inheader.HWResolution[1] / 72.0);
page_width = (unsigned)(inheader.cupsPageSize[0] * inheader.HWResolution[0] / 72.0);
page_height = (unsigned)(inheader.cupsPageSize[1] * inheader.HWResolution[1] / 72.0);
page_left = (unsigned)(inheader.cupsImagingBBox[0] * inheader.HWResolution[0] / 72.0);
page_bottom = (unsigned)(inheader.cupsImagingBBox[1] * inheader.HWResolution[1] / 72.0);
page_top = page_height - page_bottom - inheader.cupsHeight;
linesize = (page_width * inheader.cupsBitsPerPixel + 7) / 8;
lineoffset = page_left * inheader.cupsBitsPerPixel / 8; /* Round down */
if (page_left > page_width || page_top > page_height || page_bottom > page_height)
{
_cupsLangPrintFilter(stderr, "ERROR", _("Unsupported raster data."));
fprintf(stderr, "DEBUG: Bad bottom/left/top margin on page %d.\n", page);
return (1);
}
switch (inheader.cupsColorSpace)
{
case CUPS_CSPACE_W :
@@ -192,14 +213,14 @@ main(int argc, /* I - Number of command-line args */
sizeof(outheader.OutputType));
else
{
fprintf(stderr, "DEBUG: Unsupported print-content-type \"%s\".\n", val);
fputs("DEBUG: Unsupported print-content-optimize value.\n", stderr);
outheader.OutputType[0] = '\0';
}
}
if ((val = cupsGetOption("print-quality", num_options, options)) != NULL)
{
int quality = atoi(val); /* print-quality value */
unsigned quality = (unsigned)atoi(val); /* print-quality value */
if (quality >= IPP_QUALITY_DRAFT && quality <= IPP_QUALITY_HIGH)
outheader.cupsInteger[8] = quality;
@@ -233,8 +254,7 @@ main(int argc, /* I - Number of command-line args */
sizeof(outheader.cupsRenderingIntent));
else
{
fprintf(stderr, "DEBUG: Unsupported print-rendering-intent \"%s\".\n",
val);
fputs("DEBUG: Unsupported print-rendering-intent value.\n", stderr);
outheader.cupsRenderingIntent[0] = '\0';
}
}
@@ -247,10 +267,8 @@ main(int argc, /* I - Number of command-line args */
}
else
{
pwg_media = _pwgMediaForSize((int)(2540.0 * inheader.cupsPageSize[0] /
72.0),
(int)(2540.0 * inheader.cupsPageSize[1] /
72.0));
pwg_media = pwgMediaForSize((int)(2540.0 * inheader.cupsPageSize[0] / 72.0),
(int)(2540.0 * inheader.cupsPageSize[1] / 72.0));
if (pwg_media)
strlcpy(outheader.cupsPageSizeName, pwg_media->pwg,
@@ -270,7 +288,7 @@ main(int argc, /* I - Number of command-line args */
{
if (inheader.Tumble)
{
outheader.cupsInteger[1] = -1;/* CrossFeedTransform */
outheader.cupsInteger[1] = ~0U;/* CrossFeedTransform */
outheader.cupsInteger[2] = 1; /* FeedTransform */
outheader.cupsInteger[3] = page_width - page_left -
@@ -286,7 +304,7 @@ main(int argc, /* I - Number of command-line args */
else
{
outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
outheader.cupsInteger[2] = -1;/* FeedTransform */
outheader.cupsInteger[2] = ~0U;/* FeedTransform */
outheader.cupsInteger[3] = page_left;
/* ImageBoxLeft */
@@ -302,8 +320,8 @@ main(int argc, /* I - Number of command-line args */
{
if (inheader.Tumble)
{
outheader.cupsInteger[1] = -1;/* CrossFeedTransform */
outheader.cupsInteger[2] = -1;/* FeedTransform */
outheader.cupsInteger[1] = ~0U;/* CrossFeedTransform */
outheader.cupsInteger[2] = ~0U;/* FeedTransform */
outheader.cupsInteger[3] = page_width - page_left -
inheader.cupsWidth;
@@ -334,8 +352,8 @@ main(int argc, /* I - Number of command-line args */
{
if (inheader.Tumble)
{
outheader.cupsInteger[1] = -1;/* CrossFeedTransform */
outheader.cupsInteger[2] = -1;/* FeedTransform */
outheader.cupsInteger[1] = ~0U;/* CrossFeedTransform */
outheader.cupsInteger[2] = ~0U;/* FeedTransform */
outheader.cupsInteger[3] = page_width - page_left -
inheader.cupsWidth;
@@ -368,7 +386,7 @@ main(int argc, /* I - Number of command-line args */
* Unsupported value...
*/
fprintf(stderr, "DEBUG: Unsupported cupsBackSide \"%s\".\n", back->value);
fputs("DEBUG: Unsupported cupsBackSide value.\n", stderr);
outheader.cupsInteger[1] = 1; /* CrossFeedTransform */
outheader.cupsInteger[2] = 1; /* FeedTransform */
@@ -409,6 +427,9 @@ main(int argc, /* I - Number of command-line args */
* Copy raster data...
*/
if (linesize < inheader.cupsBytesPerLine)
linesize = inheader.cupsBytesPerLine;
line = malloc(linesize);
memset(line, white, linesize);
@@ -423,7 +444,14 @@ main(int argc, /* I - Number of command-line args */
for (y = inheader.cupsHeight; y > 0; y --)
{
cupsRasterReadPixels(inras, line + lineoffset, inheader.cupsBytesPerLine);
if (cupsRasterReadPixels(inras, line + lineoffset, inheader.cupsBytesPerLine) != inheader.cupsBytesPerLine)
{
_cupsLangPrintFilter(stderr, "ERROR", _("Error reading raster data."));
fprintf(stderr, "DEBUG: Unable to read line %d for page %d.\n",
inheader.cupsHeight - y + page_top + 1, page);
return (1);
}
if (!cupsRasterWritePixels(outras, line, outheader.cupsBytesPerLine))
{
_cupsLangPrintFilter(stderr, "ERROR", _("Error sending raster data."));
@@ -454,8 +482,3 @@ main(int argc, /* I - Number of command-line args */
return (0);
}
/*
* End of "$Id: rastertopwg.c 3427 2011-09-20 18:40:57Z msweet $".
*/

View File

@@ -1,6 +1,4 @@
<!--
"$Id$"
PPD extension documentation for CUPS.
Copyright 2007-2011 by Apple Inc.

View File

@@ -30,11 +30,11 @@ LINE-END = CR / LF / CR LF
<p>CUPS supports several methods of auto-configuration via PPD keywords.</p>
<h3><span class='info'>OS X 10.5</span><a name='APAutoSetupTool'>APAutoSetupTool</a></h3>
<h3><span class='info'>macOS 10.5</span><a name='APAutoSetupTool'>APAutoSetupTool</a></h3>
<p class='summary'>*APAutoSetupTool: "/LibraryPrinters/vendor/filename"</p>
<p>This OS X keyword defines a program that sets the default option choices. It is run when a printer is added from the <var>Add Printer</var> window or the <var>Nearby Printers</var> list in the <var>Print</var> dialog.</p>
<p>This macOS keyword defines a program that sets the default option choices. It is run when a printer is added from the <var>Add Printer</var> window or the <var>Nearby Printers</var> list in the <var>Print</var> dialog.</p>
<p>The program is provided with two arguments: the printer's device URI and the PPD file to be used for the printer. The program must write an updated PPD file to stdout.</p>
@@ -45,7 +45,7 @@ LINE-END = CR / LF / CR LF
*APAutoSetupTool: "/Library/Printers/vendor/Tools/autosetuptool"
</pre>
<h3><span class='info'>OS X 10.2/CUPS 1.4</span><a name='QUERYKEYWORD'>?MainKeyword</a></h3>
<h3><span class='info'>macOS 10.2/CUPS 1.4</span><a name='QUERYKEYWORD'>?MainKeyword</a></h3>
<p class='summary'>*?<i>MainKeyword</i>: "<br>
PostScript query code that writes a message using the = operator...<br>
@@ -74,7 +74,7 @@ LINE-END = CR / LF / CR LF
*CloseUI: OptionDuplex
</pre>
<h3><span class='info'>OS X 10.4/CUPS 1.5</span><a name='OID'>OIDMainKeyword</a></h3>
<h3><span class='info'>macOS 10.4/CUPS 1.5</span><a name='OID'>OIDMainKeyword</a></h3>
<p class='summary'>*?OID<i>MainKeyword</i>: ".n.n.n..."<br>
*OID<i>MainKeyword</i> <i>OptionKeyword1</i>: "value"<br>
@@ -97,7 +97,7 @@ LINE-END = CR / LF / CR LF
<h2 class='title'><a name='PROFILES'>Color Profiles</a></h2>
<p>CUPS supports three types of color profiles. The first type is based on sRGB and is used by the standard CUPS raster filters and GPL Ghostscript. The second type is based on ICC profiles and is used by the Quartz-based filters on MacOS X. The final type is based on well-known colorspaces such as sRGB and Adobe RGB.</p>
<p>CUPS supports three types of color profiles. The first type is based on sRGB and is used by the standard CUPS raster filters and GPL Ghostscript. The second type is based on ICC profiles and is used by the Quartz-based filters on macOS. The final type is based on well-known colorspaces such as sRGB and Adobe RGB.</p>
<blockquote><b>Note:</b>
@@ -109,7 +109,7 @@ LINE-END = CR / LF / CR LF
<p class='summary'>*cupsColorProfile Resolution/MediaType: "density gamma m00 m01 m02 m10 m11 m12 m20 m21 m22"</p>
<p>This string keyword specifies an sRGB-based color profile consisting of gamma and density controls and a 3x3 CMY color transform matrix. <em>This keyword is not supported on OS X.</em></p>
<p>This string keyword specifies an sRGB-based color profile consisting of gamma and density controls and a 3x3 CMY color transform matrix. <em>This keyword is not supported on macOS.</em></p>
<p>The <i>Resolution</i> and <i>MediaType</i> values may be "-" to act as a wildcard. Otherwise they must match one of the <tt>Resolution</tt> or <tt>MediaType</tt> option keywords defined in the PPD file.</p>
@@ -142,7 +142,7 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
</pre>
<h3><span class='info'>OS X 10.3/CUPS 1.2</span><a name='cupsICCProfile'>cupsICCProfile</a></h3>
<h3><span class='info'>macOS 10.3/CUPS 1.2</span><a name='cupsICCProfile'>cupsICCProfile</a></h3>
<p class='summary'>*cupsICCProfile ColorModel.MediaType.Resolution/Description: "filename"</p>
@@ -181,22 +181,22 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
*cupsICCQualifier3: Resolution
</pre>
<h3><span class='info'>OS X 10.4</span><a name='APCustom'>Custom Color Matching Support</a></h3>
<h3><span class='info'>macOS 10.4</span><a name='APCustom'>Custom Color Matching Support</a></h3>
<p class='summary'>*<a href='#APSupportsCustomColorMatching'>APSupportsCustomColorMatching</a>: true<br>
*<a href='#APCustomColorMatchingName'>APCustomColorMatchingName</a> name/text: ""<br>
*<a href='#APCustomColorMatchingProfile'>APCustomColorMatchingProfile</a>: profile<br>
*<a href='#APDefaultCustomColorMatchingProfile'>APDefaultCustomColorMatchingProfile</a>: profile</p>
<p>These keywords tell the OS X raster filters that the printer driver provides its own custom color matching and that generic color profiles should be used when generating 1-, 3-, and 4-component raster data as requested by the driver. The <tt>APCustomColorMatchingProfile</tt> and <tt>APDefaultColorMatchingProfile</tt> keywords specify alternate color profiles (sRGB or AdobeRGB) to use for 3-color (RGB) raster data.</p>
<p>These keywords tell the macOS raster filters that the printer driver provides its own custom color matching and that generic color profiles should be used when generating 1-, 3-, and 4-component raster data as requested by the driver. The <tt>APCustomColorMatchingProfile</tt> and <tt>APDefaultColorMatchingProfile</tt> keywords specify alternate color profiles (sRGB or AdobeRGB) to use for 3-color (RGB) raster data.</p>
<blockquote><b>Note:</b>
<p>Prior to OS X 10.6, the default RGB color space was Apple's "GenericRGB". The new default in OS X 10.6 and later is "sRGB". For more information, see <a href="http://support.apple.com/kb/HT3712">"OS X v10.6: About gamma 2.2"</a> on Apple's support site.</p>
<p>Prior to macOS 10.6, the default RGB color space was Apple's "GenericRGB". The new default in macOS 10.6 and later is "sRGB". For more information, see <a href="http://support.apple.com/kb/HT3712">"macOS v10.6: About gamma 2.2"</a> on Apple's support site.</p>
</blockquote>
<h4><span class='info'>OS X 10.5</span><a name='APCustomColorMatchingName'>APCustomColorMatchingName</a></h4>
<h4><span class='info'>macOS 10.5</span><a name='APCustomColorMatchingName'>APCustomColorMatchingName</a></h4>
<p class='summary'>*APCustomColorMatchingName name/text: ""</p>
@@ -210,7 +210,7 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
*fr.APCustomColorMatchingName name/La AcmeColor(tm): ""
</pre>
<h4><span class='info'>OS X 10.5</span><a name='APCustomColorMatchingProfile'>APCustomColorMatchingProfile</a></h4>
<h4><span class='info'>macOS 10.5</span><a name='APCustomColorMatchingProfile'>APCustomColorMatchingProfile</a></h4>
<p class='summary'>*APCustomColorMatchingProfile: name</p>
@@ -232,7 +232,7 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
*APCustomColorMatchingProfile: AdobeRGB
</pre>
<h4><span class='info'>OS X 10.5</span><a name='APDefaultCustomColorMatchingProfile'>APDefaultCustomColorMatchingProfile</a></h4>
<h4><span class='info'>macOS 10.5</span><a name='APDefaultCustomColorMatchingProfile'>APDefaultCustomColorMatchingProfile</a></h4>
<p class='summary'>*APDefaultCustomColorMatchingProfile: name</p>
@@ -246,7 +246,7 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
*APDefaultCustomColorMatchingProfile: sRGB
</pre>
<h4><span class='info'>OS X 10.4</span><a name='APSupportsCustomColorMatching'>APSupportsCustomColorMatching</a></h4>
<h4><span class='info'>macOS 10.4</span><a name='APSupportsCustomColorMatching'>APSupportsCustomColorMatching</a></h4>
<p class='summary'>*APSupportsCustomColorMatching: boolean</p>
@@ -282,7 +282,7 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
</blockquote>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsUIConstraints'>cupsUIConstraints</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsUIConstraints'>cupsUIConstraints</a></h3>
<p class='summary'>*cupsUIConstraints resolver: "*Keyword1 *Keyword2 ..."<br>
*cupsUIConstraints resolver: "*Keyword1 OptionKeyword1 *Keyword2 ..."<br>
@@ -312,7 +312,7 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
*cupsUIConstraints photo: "*OutputMode Photo *MediaType Transparency *Resolution 1200dpi"
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsUIResolver'>cupsUIResolver</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsUIResolver'>cupsUIResolver</a></h3>
<p class='summary'>*cupsUIResolver resolver: "*Keyword1 OptionKeyword1 *Keyword2 OptionKeyword2 ..."</p>
@@ -414,7 +414,7 @@ f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
</pre>
<h2 class='title'><a name='OPTIONS'><span class="info">CUPS 1.3/OS X 10.6</span>Custom Options</a></h2>
<h2 class='title'><a name='OPTIONS'><span class="info">CUPS 1.3/macOS 10.6</span>Custom Options</a></h2>
<p>CUPS supports custom options using an extension of the <tt>CustomPageSize</tt> and <tt>ParamCustomPageSize</tt> syntax:</p>
@@ -872,7 +872,7 @@ PRE B {
<p>The CUPS media keywords allow drivers to specify alternate custom page
size limits based on up to two options.</p>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsMediaQualifier2'>cupsMediaQualifier2</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsMediaQualifier2'>cupsMediaQualifier2</a></h3>
<p class='summary'>*cupsMediaQualifier2: MainKeyword</p>
@@ -891,7 +891,7 @@ custom page size limits.</p>
*cupsMinSize ..Photo: "300 300"
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsMediaQualifier3'>cupsMediaQualifier3</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsMediaQualifier3'>cupsMediaQualifier3</a></h3>
<p class='summary'>*cupsMediaQualifier3: MainKeyword</p>
@@ -910,7 +910,7 @@ custom page size limits.</p>
*cupsMinSize ..Photo: "300 300"
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsMinSize'>cupsMinSize</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsMinSize'>cupsMinSize</a></h3>
<p class='summary'>*cupsMinSize .Qualifier2.Qualifier3: "width length"<br>
*cupsMinSize .Qualifier2.: "width length"<br>
@@ -933,7 +933,7 @@ are used to identify options to use for matching.</p>
*cupsMinSize ..Photo: "300 300"
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsMaxSize'>cupsMaxSize</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsMaxSize'>cupsMaxSize</a></h3>
<p class='summary'>*cupsMaxSize .Qualifier2.Qualifier3: "width length"<br>
*cupsMaxSize .Qualifier2.: "width length"<br>
@@ -957,11 +957,11 @@ are used to identify options to use for matching.</p>
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsPageSizeCategory'>cupsPageSizeCategory</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsPageSizeCategory'>cupsPageSizeCategory</a></h3>
<p class="summary">*cupsPageSizeCategory name/text: "name name2 ... nameN"</p>
<p>This keyword lists related paper size names that should be grouped together in the Print or Page Setup dialogs. The "name" portion of the keyword specifies the root/default size for the grouping. On OS X the grouped paper sizes are shown in a submenu of the main paper size. When omitted, sizes with the same dimensions are automatically grouped together, for example "Letter" and "Letter.Borderless".</p>
<p>This keyword lists related paper size names that should be grouped together in the Print or Page Setup dialogs. The "name" portion of the keyword specifies the root/default size for the grouping. On macOS the grouped paper sizes are shown in a submenu of the main paper size. When omitted, sizes with the same dimensions are automatically grouped together, for example "Letter" and "Letter.Borderless".</p>
<p>Example:</p>
@@ -974,7 +974,7 @@ are used to identify options to use for matching.</p>
<h2 class='title'><a name='ATTRIBUTES'>General Attributes</a></h2>
<h3><span class='info'>CUPS 1.3/OS X 10.5</span><a name='cupsBackSide'>cupsBackSide</a></h3>
<h3><span class='info'>CUPS 1.3/macOS 10.5</span><a name='cupsBackSide'>cupsBackSide</a></h3>
<p class='summary'>*cupsBackSide: keyword</p>
@@ -1050,7 +1050,7 @@ will be ignored.</p>
</table>
</div>
<p><em>* - Not supported in OS X 10.5.x and earlier</em></p>
<p><em>* - Not supported in macOS 10.5.x and earlier</em></p>
<div class='figure'><table summary='Back side images'>
<caption>Figure 1: Back side images</caption>
@@ -1070,7 +1070,7 @@ will be ignored.</p>
<p>Also see the related <a href='#APDuplexRequiresFlippedMargin'><tt>APDuplexRequiresFlippedMargin</tt></a>
keyword.</p>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsCommands'>cupsCommands</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsCommands'>cupsCommands</a></h3>
<p class='summary'>*cupsCommands: "name name2 ... nameN"</p>
@@ -1086,7 +1086,7 @@ by whitespace.</p>
</pre>
<h3><span class='info'>CUPS 1.3/OS X 10.5</span><a name='cupsEvenDuplex'>cupsEvenDuplex</a></h3>
<h3><span class='info'>CUPS 1.3/macOS 10.5</span><a name='cupsEvenDuplex'>cupsEvenDuplex</a></h3>
<p class='summary'>*cupsEvenDuplex: boolean</p>
@@ -1164,21 +1164,21 @@ the special filter program "-" may be specified.</p>
<p class='summary'>*cupsFlipDuplex: boolean</p>
<p>Due to implementation differences between OS X and Ghostscript,
<p>Due to implementation differences between macOS and Ghostscript,
the <tt>cupsFlipDuplex</tt> keyword is deprecated. Instead, use
the <a href='#cupsBackSide'><tt>cupsBackSide</tt></a> keyword to specify
the coordinate system (pixel layout) of the page data on the back side of
duplex pages.</p>
<p>The value <code>true</code> maps to a <tt>cupsBackSide</tt> value
of <code>Rotated</code> on OS X and <code>Flipped</code> with
of <code>Rotated</code> on macOS and <code>Flipped</code> with
Ghostscript.</p>
<p>The default value is <code>false</code>.</p>
<blockquote><b>Note:</b>
<p>OS X drivers that previously used
<p>macOS drivers that previously used
<tt>cupsFlipDuplex</tt> may wish to provide both the old and
new keywords for maximum compatibility, for example:</p>
@@ -1195,7 +1195,7 @@ Ghostscript can use:</p>
*cupsFlipDuplex: true
</pre></blockquote>
<h3><span class='info'>CUPS 1.3/OS X 10.5</span><a name='cupsIPPFinishings'>cupsIPPFinishings</a></h3>
<h3><span class='info'>CUPS 1.3/macOS 10.5</span><a name='cupsIPPFinishings'>cupsIPPFinishings</a></h3>
<p class='summary'>*cupsIPPFinishings number/text: "*Option Choice ..."</p>
@@ -1211,7 +1211,7 @@ values to PPD options and choices.</p>
*cupsIPPFinishings 21/staple-bottom-left: "*StapleLocation SingleLandscape"
</pre>
<h3><span class='info'>CUPS 1.3/OS X 10.5</span><a name='cupsIPPReason'>cupsIPPReason</a></h3>
<h3><span class='info'>CUPS 1.3/macOS 10.5</span><a name='cupsIPPReason'>cupsIPPReason</a></h3>
<p class='summary'>*cupsIPPReason reason/Reason Text: "optional URIs"</p>
@@ -1264,7 +1264,50 @@ http://www.vendor.com/help"
*cupsIPPSupplies: False
</pre>
<h3><span class='info'>CUPS 1.2/OS X 10.5</span><a name='cupsLanguages'>cupsLanguages</a></h3>
<h3><span class='info'>CUPS 1.7/macOS 10.9</span><a name='cupsJobAccountId'>cupsJobAccountId</a></h3>
<p class='summary'>*cupsJobAccountId: boolean</p>
<p>This keyword defines whether the printer accepts the job-account-id IPP attribute.</p>
<p>Example:</p>
<pre class='command'>
<em>*% Specify the printer accepts the job-account-id IPP attribute.</em>
*cupsJobAccountId: True
</pre>
<h3><span class='info'>CUPS 1.7/macOS 10.9</span><a name='cupsJobAccountingUserId'>cupsJobAccountingUserId</a></h3>
<p class='summary'>*cupsJobAccountingUserId: boolean</p>
<p>This keyword defines whether the printer accepts the job-accounting-user-id IPP attribute.</p>
<p>Example:</p>
<pre class='command'>
<em>*% Specify the printer accepts the job-accounting-user-id IPP attribute.</em>
*cupsJobAccountingUserId: True
</pre>
<h3><span class='info'>CUPS 1.7/macOS 10.9</span><a name='cupsJobPassword'>cupsJobPassword</a></h3>
<p class='summary'>*cupsJobPassword: "format"</p>
<p>This keyword defines the format of the job-password IPP attribute, if supported by the printer. Currently the only supported format is "1111" indicating a 4-digit PIN code.</p>
<p>Example:</p>
<pre class='command'>
<em>*% Specify the printer supports 4-digit PIN codes.</em>
*cupsJobPassword: "1111"
</pre>
<h3><span class='info'>CUPS 1.2/macOS 10.5</span><a name='cupsLanguages'>cupsLanguages</a></h3>
<p class='summary'>*cupsLanguages: "locale list"</p>
@@ -1279,6 +1322,21 @@ list of locale names ("en", "en_US", "fr_CA", etc.)</p>
*cupsLanguages: "en_CA en_UK en_US fr_CA fr_FR"
</pre>
<h3><span class='info'>CUPS 1.7/macOS 10.9</span><a name='cupsMandatory'>cupsMandatory</a></h3>
<p class='summary'>*cupsMandatory: "attribute1 attribute2 ... attributeN"</p>
<p>This keyword defines a list of IPP attributes that must be provided when submitting a print job creation request.</p>
<p>Example:</p>
<pre class='command'>
<em>*% Specify that the user must supply a job-password</em>
*cupsMandatory: "job-password job-password-encryption"
</pre>
<h3><a name='cupsManualCopies'>cupsManualCopies</a></h3>
<p class='summary'>*cupsManualCopies: boolean</p>
@@ -1294,7 +1352,7 @@ hardware. The default value is <code>false</code>.</p>
*cupsManualCopies: true
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsMarkerName'>cupsMarkerName</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsMarkerName'>cupsMarkerName</a></h3>
<p class='summary'>*cupsMarkerName/Name Text: ""</p>
@@ -1308,7 +1366,7 @@ generated by the driver to human readable text.</p>
*cupsMarkerName cyanToner/Cyan Toner: ""
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsMarkerNotice'>cupsMarkerNotice</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsMarkerNotice'>cupsMarkerNotice</a></h3>
<p class='summary'>*cupsMarkerNotice: "disclaimer text"</p>
@@ -1322,7 +1380,7 @@ are approximate".</p>
*cupsMarkerNotice: "Supply levels are approximate."
</pre>
<h3><span class='info'>CUPS 1.6/OS X 10.8</span><a name='cupsMaxCopies'>cupsMaxCopies</a></h3>
<h3><span class='info'>CUPS 1.6/macOS 10.8</span><a name='cupsMaxCopies'>cupsMaxCopies</a></h3>
<p class='summary'>*cupsMaxCopies: integer</p>
@@ -1351,7 +1409,7 @@ the output for a specific model of printer.</p>
</pre>
<h3><span class='info'>CUPS 1.3/OS X 10.5</span><a name='cupsPJLCharset'>cupsPJLCharset</a></h3>
<h3><span class='info'>CUPS 1.3/macOS 10.5</span><a name='cupsPJLCharset'>cupsPJLCharset</a></h3>
<p class='summary'>*cupsPJLCharset: "ISO character set name"</p>
@@ -1366,7 +1424,7 @@ assumed.</p>
*cupsPJLCharset: "UTF-8"
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsPJLDisplay'>cupsPJLDisplay</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsPJLDisplay'>cupsPJLDisplay</a></h3>
<p class='summary'>*cupsPJLDisplay: "what"</p>
@@ -1385,7 +1443,7 @@ to use "@PJL RDYMSG DISPLAY". The default is "job".</p>
*cupsPJLDisplay: "none"
</pre>
<h3><span class='info'>CUPS 1.2/OS X 10.5</span><a name='cupsPortMonitor'>cupsPortMonitor</a></h3>
<h3><span class='info'>CUPS 1.2/macOS 10.5</span><a name='cupsPortMonitor'>cupsPortMonitor</a></h3>
<p class='summary'>*cupsPortMonitor urischeme/Descriptive Text: "port monitor"</p>
@@ -1417,7 +1475,7 @@ to disable the port monitor for the given URI scheme.</p>
*cupsPortMonitor usb/USB Status Monitor: "epson-usb"
</pre>
<h3><span class='info'>CUPS 1.3/OS X 10.5</span><a name='cupsPreFilter'>cupsPreFilter</a></h3>
<h3><span class='info'>CUPS 1.3/macOS 10.5</span><a name='cupsPreFilter'>cupsPreFilter</a></h3>
<p class='summary'>*cupsPreFilter: "source/type cost program"</p>
@@ -1476,7 +1534,7 @@ before the filter that accepts the given MIME type.</p>
*cupsSingleFile: True
</pre>
<h3><span class='info'>CUPS 1.4/OS X 10.6</span><a name='cupsSNMPSupplies'>cupsSNMPSupplies</a></h3>
<h3><span class='info'>CUPS 1.4/macOS 10.6</span><a name='cupsSNMPSupplies'>cupsSNMPSupplies</a></h3>
<p class='summary'>*cupsSNMPSupplies: boolean</p>
@@ -1507,11 +1565,11 @@ PPD file extensions was used. Currently it must be the string
</pre>
<h3><span class="info">CUPS 1.6/OS X 10.8</span><a name="JCLToPDFInterpreter">JCLToPDFInterpreter</a></h3>
<h3><span class="info">CUPS 1.6/macOS 10.8</span><a name="JCLToPDFInterpreter">JCLToPDFInterpreter</a></h3>
<p class="summary">*JCLToPDFInterpreter: "JCL"</p>
<p>This keyword provfides the JCL command to insert a PDF job file into a printer-ready data stream. The JCL command is added after the <tt>JCLBegin</tt> value and any commands for JCL options in the PPD file.</p>
<p>This keyword provides the JCL command to insert a PDF job file into a printer-ready data stream. The JCL command is added after the <tt>JCLBegin</tt> value and any commands for JCL options in the PPD file.</p>
<p>Example:</p>
@@ -1521,9 +1579,9 @@ PPD file extensions was used. Currently it must be the string
</pre>
<h2 class='title'><a name='MACOSX'>OS X Attributes</a></h2>
<h2 class='title'><a name='MACOSX'>macOS Attributes</a></h2>
<h3><span class='info'>OS X 10.3</span><a name='APDialogExtension'>APDialogExtension</a></h3>
<h3><span class='info'>macOS 10.3</span><a name='APDialogExtension'>APDialogExtension</a></h3>
<p class='summary'>*APDialogExtension: "/Library/Printers/vendor/filename.plugin"</p>
@@ -1535,7 +1593,7 @@ plug-ins.</p>
<blockquote><b>Note:</b>
<p>Starting with OS X 10.5, each plug-in must be compiled "4-way fat"
<p>Starting with macOS 10.5, each plug-in must be compiled "4-way fat"
(32-bit and 64-bit for both PowerPC and Intel) with garbage collection enabled
in order to be usable with all applications.</p>
@@ -1549,7 +1607,7 @@ in order to be usable with all applications.</p>
*APDialogExtension: "/Library/Printers/vendor/options.plugin"
</pre>
<h3><span class='info'>OS X 10.4</span><a name='APDuplexRequiresFlippedMargin'>APDuplexRequiresFlippedMargin</a></h3>
<h3><span class='info'>macOS 10.4</span><a name='APDuplexRequiresFlippedMargin'>APDuplexRequiresFlippedMargin</a></h3>
<p class='summary'>*APDuplexRequiresFlippedMargin: boolean</p>
@@ -1646,7 +1704,7 @@ looking up IPP reason codes for this printer driver. The
*APHelpBook: "file:///Library/Printers/vendor/Help.bundle"
</pre>
<h3><span class='info'>OS X 10.6</span><a name='APICADriver'>APICADriver</a></h3>
<h3><span class='info'>macOS 10.6</span><a name='APICADriver'>APICADriver</a></h3>
<p class='summary'>*APICADriver: boolean</p>
@@ -1660,7 +1718,7 @@ Architecture (ICA) driver for scanning. The default is <tt>False</tt>.</p>
*APScanAppBundleID: "com.apple.ImageCaptureApp"
</pre>
<h3><span class='info'>OS X 10.3</span><a name='APPrinterIconPath'>APPrinterIconPath</a></h3>
<h3><span class='info'>macOS 10.3</span><a name='APPrinterIconPath'>APPrinterIconPath</a></h3>
<p class='summary'>*APPrinterIconPath: "/Library/Printers/vendor/filename.icns"</p>
@@ -1674,7 +1732,7 @@ displaying the printer. The file must be in the Apple icon format.</p>
*APPrinterIconPath: "/Library/Printers/vendor/Icons/filename.icns"
</pre>
<h3><span class='info'>OS X 10.4</span><a name='APPrinterLowInkTool'>APPrinterLowInkTool</a></h3>
<h3><span class='info'>macOS 10.4</span><a name='APPrinterLowInkTool'>APPrinterLowInkTool</a></h3>
<p class='summary'>*APPrinterLowInkTool: "/Library/Printers/vendor/program"</p>
@@ -1691,7 +1749,7 @@ Technical Note TN2144</a> for more information.</p>
*APPrinterLowInkTool: "/Library/Printers/vendor/Tools/lowinktool"
</pre>
<h3><span class='info'>OS X 10.5</span><a name='APPrinterPreset'>APPrinterPreset</a></h3>
<h3><span class='info'>macOS 10.5</span><a name='APPrinterPreset'>APPrinterPreset</a></h3>
<p class='summary'>*APPrinterPreset name/text: "*Option Choice ..."</p>
@@ -1761,7 +1819,7 @@ choice (*MainKeyword OptionKeyword) or a preset identifier and value
*fr.APPrinterPreset Photo_on_Photo_Paper/Photo sur papier photographique: ""
</pre>
<h3><span class='info'>OS X 10.3</span><a name='APPrinterUtilityPath'>APPrinterUtilityPath</a></h3>
<h3><span class='info'>macOS 10.3</span><a name='APPrinterUtilityPath'>APPrinterUtilityPath</a></h3>
<p class='summary'>*APPrinterPrinterUtilityPath: "/Library/Printers/vendor/filename.app"</p>
@@ -1776,7 +1834,7 @@ information.</p>
*APPrinterPrinterUtilityPath: "/Library/Printers/vendor/Tools/utility.app"
</pre>
<h3><span class='info'>OS X 10.6</span><a name='APScannerOnly'>APScannerOnly</a></h3>
<h3><span class='info'>macOS 10.6</span><a name='APScannerOnly'>APScannerOnly</a></h3>
<p class='summary'>*APScannerOnly: boolean</p>
@@ -1790,7 +1848,7 @@ capabilities. The default is <tt>False</tt>.</p>
*APScannerOnly: True
</pre>
<h3><span class='info'>OS X 10.3</span><a name='APScanAppBundleID'>APScanAppBundleID</a></h3>
<h3><span class='info'>macOS 10.3</span><a name='APScanAppBundleID'>APScanAppBundleID</a></h3>
<p class='summary'>*APScanAppBundleID: "bundle ID"</p>
@@ -1807,6 +1865,18 @@ the device.</p>
<h2 class='title'><a name='HISTORY'>Change History</a></h2>
<h3>Changes in CUPS 1.7</h3>
<ul>
<li>Added <a href="#cupsJobAccountId"><tt>cupsJobAccountId</tt></a>,
<a href="#cupsJobAccountingUserId"><tt>cupsJobAccountingUserId</tt></a>,
<a href="#cupsJobPassword"><tt>cupsJobPassword</tt></a>,
<a href="#cupsMandatory"><tt>cupsMandatory</tt></a> keywords.</li>
</ul>
<h3>Changes in CUPS 1.6</h3>
<ul>
@@ -1881,7 +1951,7 @@ the device.</p>
<ul>
<li>Added missing OS X <tt>AP</tt> keywords.</li>
<li>Added missing macOS <tt>AP</tt> keywords.</li>
<li>Added section on auto-configuration including the
<tt>OID<i>MainKeyword</i></tt> and <tt>?<i>MainKeyword</i></tt>

View File

@@ -1,27 +1,16 @@
/*
* "$Id: testraster.c 7376 2008-03-19 21:07:45Z mike $"
* Raster test program routines for CUPS.
*
* Raster test program routines for CUPS.
* Copyright 2007-2016 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Test the raster functions.
* do_ppd_tests() - Test the default option commands in a PPD file.
* do_ps_tests() - Test standard PostScript commands.
* do_ras_file() - Test reading of a raster file.
* do_raster_tests() - Test reading and writing of raster data.
* print_changes() - Print differences in the page header.
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
@@ -29,6 +18,8 @@
*/
#include <cups/raster-private.h>
#include <cups/ppd.h>
#include <math.h>
/*
@@ -172,13 +163,12 @@ static cups_page_header2_t setpagedevice_header =
1, /* cupsRowFeed */
1, /* cupsRowStep */
0, /* cupsNumColors */
1.001, /* cupsBorderlessScalingFactor */
{ 612.0, 792.1 }, /* cupsPageSize */
{ 0.0, 0.0, 0.0, 0.0 }, /* cupsImagingBBox */
1.001f, /* cupsBorderlessScalingFactor */
{ 612.0f, 792.1f }, /* cupsPageSize */
{ 0.0f, 0.0f, 0.0f, 0.0f }, /* cupsImagingBBox */
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
/* cupsInteger[16] */
{ 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1, 12.1, 13.1,
14.1, 15.1, 16.1 }, /* cupsReal[16] */
{ 1.1f, 2.1f, 3.1f, 4.1f, 5.1f, 6.1f, 7.1f, 8.1f, 9.1f, 10.1f, 11.1f, 12.1f, 13.1f, 14.1f, 15.1f, 16.1f }, /* cupsReal[16] */
{ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
"14", "15", "16" }, /* cupsString[16] */
"Marker Type", /* cupsMarkerType */
@@ -505,6 +495,8 @@ do_ras_file(const char *filename) /* I - Filename */
free(data);
}
printf("EOF at %ld\n", (long)lseek(fd, SEEK_CUR, 0));
cupsRasterClose(ras);
close(fd);
@@ -519,7 +511,7 @@ do_ras_file(const char *filename) /* I - Filename */
static int /* O - Number of errors */
do_raster_tests(cups_mode_t mode) /* O - Write mode */
{
int page, x, y; /* Looping vars */
unsigned page, x, y; /* Looping vars */
FILE *fp; /* Raster file */
cups_raster_t *r; /* Raster stream */
cups_page_header2_t header, /* Page header */
@@ -610,7 +602,7 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */
else
{
for (x = 0; x < header.cupsBytesPerLine; x ++)
data[x] = x;
data[x] = (unsigned char)x;
for (y = 0; y < 64; y ++)
if (!cupsRasterWritePixels(r, data, header.cupsBytesPerLine))
@@ -636,7 +628,7 @@ do_raster_tests(cups_mode_t mode) /* O - Write mode */
else
{
for (x = 0; x < header.cupsBytesPerLine; x ++)
data[x] = x / 4;
data[x] = (unsigned char)(x / 4);
for (y = 0; y < 64; y ++)
if (!cupsRasterWritePixels(r, data, header.cupsBytesPerLine))
@@ -1020,22 +1012,21 @@ print_changes(
printf(" cupsNumColors %d, expected %d\n", header->cupsNumColors,
expected->cupsNumColors);
if (header->cupsBorderlessScalingFactor !=
expected->cupsBorderlessScalingFactor)
if (fabs(header->cupsBorderlessScalingFactor - expected->cupsBorderlessScalingFactor) > 0.001)
printf(" cupsBorderlessScalingFactor %g, expected %g\n",
header->cupsBorderlessScalingFactor,
expected->cupsBorderlessScalingFactor);
if (header->cupsPageSize[0] != expected->cupsPageSize[0] ||
header->cupsPageSize[1] != expected->cupsPageSize[1])
if (fabs(header->cupsPageSize[0] - expected->cupsPageSize[0]) > 0.001 ||
fabs(header->cupsPageSize[1] - expected->cupsPageSize[1]) > 0.001)
printf(" cupsPageSize [%g %g], expected [%g %g]\n",
header->cupsPageSize[0], header->cupsPageSize[1],
expected->cupsPageSize[0], expected->cupsPageSize[1]);
if (header->cupsImagingBBox[0] != expected->cupsImagingBBox[0] ||
header->cupsImagingBBox[1] != expected->cupsImagingBBox[1] ||
header->cupsImagingBBox[2] != expected->cupsImagingBBox[2] ||
header->cupsImagingBBox[3] != expected->cupsImagingBBox[3])
if (fabs(header->cupsImagingBBox[0] - expected->cupsImagingBBox[0]) > 0.001 ||
fabs(header->cupsImagingBBox[1] - expected->cupsImagingBBox[1]) > 0.001 ||
fabs(header->cupsImagingBBox[2] - expected->cupsImagingBBox[2]) > 0.001 ||
fabs(header->cupsImagingBBox[3] - expected->cupsImagingBBox[3]) > 0.001)
printf(" cupsImagingBBox [%g %g %g %g], expected [%g %g %g %g]\n",
header->cupsImagingBBox[0], header->cupsImagingBBox[1],
header->cupsImagingBBox[2], header->cupsImagingBBox[3],
@@ -1048,7 +1039,7 @@ print_changes(
expected->cupsInteger[i]);
for (i = 0; i < 16; i ++)
if (header->cupsReal[i] != expected->cupsReal[i])
if (fabs(header->cupsReal[i] - expected->cupsReal[i]) > 0.001)
printf(" cupsReal%d %g, expected %g\n", i, header->cupsReal[i],
expected->cupsReal[i]);
@@ -1071,8 +1062,3 @@ print_changes(
header->cupsPageSizeName,
expected->cupsPageSizeName);
}
/*
* End of "$Id: testraster.c 7376 2008-03-19 21:07:45Z mike $".
*/