From 79e1d494ec1a5f1dd6f7a8ea72c293c456c4389a Mon Sep 17 00:00:00 2001 From: msweet Date: Wed, 28 May 2008 23:38:36 +0000 Subject: [PATCH] Merge changes from CUPS 1.4svn-r7617. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@793 a1ca3aef-8c08-0410-bb20-df032aa958be --- cgi-bin/help-index.c | 2 +- cgi-bin/help-index.h | 2 +- cups/api-array.shtml | 8 +- cups/api-filter.header | 6 +- cups/api-filter.shtml | 189 ++++++++++++++++++-- cups/api-ppd.header | 2 +- cups/api-ppd.shtml | 42 +++-- cups/array.c | 80 +++++++-- cups/backchannel.c | 17 +- cups/cups.h | 1 + cups/sidechannel.h | 6 +- doc/help/api-array.html | 112 +++++++++--- doc/help/api-filter.html | 222 +++++++++++++++++++---- doc/help/api-httpipp.html | 206 ++++++++++++++++------ doc/help/api-ppd.html | 62 +++++-- doc/help/api-raster.html | 349 ++++++++++++++++++++++++++----------- doc/help/cgi.html | 38 ++-- doc/help/options.html | 2 +- filter/raster.c | 16 +- filter/rastertolabel.c | 2 +- scheduler/main.c | 2 +- templates/header.tmpl.in | 3 +- templates/help-header.tmpl | 6 +- 23 files changed, 1048 insertions(+), 327 deletions(-) diff --git a/cgi-bin/help-index.c b/cgi-bin/help-index.c index 64f1380ac..f1d96832f 100644 --- a/cgi-bin/help-index.c +++ b/cgi-bin/help-index.c @@ -1,7 +1,7 @@ /* * "$Id: help-index.c 6649 2007-07-11 21:46:42Z mike $" * - * On-line help index routines for the Common UNIX Printing System (CUPS). + * Online help index routines for the Common UNIX Printing System (CUPS). * * Copyright 2007-2008 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. diff --git a/cgi-bin/help-index.h b/cgi-bin/help-index.h index bbee9ca13..d92abbea2 100644 --- a/cgi-bin/help-index.h +++ b/cgi-bin/help-index.h @@ -1,7 +1,7 @@ /* * "$Id: help-index.h 6649 2007-07-11 21:46:42Z mike $" * - * On-line help index definitions for the Common UNIX Printing System (CUPS). + * Online help index definitions for the Common UNIX Printing System (CUPS). * * Copyright 2007 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. diff --git a/cups/api-array.shtml b/cups/api-array.shtml index 92c540b09..ae2787fec 100644 --- a/cups/api-array.shtml +++ b/cups/api-array.shtml @@ -73,7 +73,7 @@ void *user_data;

The hash function (type -cups_ahash_func_t) returns a +cups_ahash_func_t) should return a number from 0 to (hash_size-1) that (hopefully) uniquely identifies the element and is called whenever you look up an element in the array with cupsArrayFind. The hash size is @@ -86,7 +86,7 @@ only limited by available memory, but generally should not be larger than The first function adds an element to the array, adding the new element after any elements that have the same order, while the second inserts the element before others with the same order. For unsorted arrays, -cupsArrayAdd appends the elemnt to +cupsArrayAdd appends the element to the end of the array while cupsArrayInsert inserts the element at the beginning of the array. For example, the following code @@ -139,11 +139,11 @@ future lookups will start where the last one left off:

cupsArrayFind
-
Returns the first matching element .
+
Returns the first matching element.
cupsArrayFirst
Returns the first element in the array.
cupsArrayIndex
-
Returns the Nth element in the array.
+
Returns the Nth element in the array, starting at 0.
cupsArrayLast
Returns the last element in the array.
cupsArrayNext
diff --git a/cups/api-filter.header b/cups/api-filter.header index 4b41c439b..368364ae8 100644 --- a/cups/api-filter.header +++ b/cups/api-filter.header @@ -20,8 +20,7 @@ Headers cups/backend.h
- cups/sidechannel.h
- cups/snmp.h + cups/sidechannel.h @@ -34,7 +33,8 @@ Programming: Introduction to CUPS Programming
Programming: CUPS API
Programming: PPD API
- Programming: Raster API + Programming: Raster API
+ Specifications: CUPS Design Description diff --git a/cups/api-filter.shtml b/cups/api-filter.shtml index d4583b13c..2be3b2bf6 100644 --- a/cups/api-filter.shtml +++ b/cups/api-filter.shtml @@ -16,9 +16,11 @@

Overview

-

Filters, printer drivers, port monitors, and backends use a common interface -for processing print jobs and communicating status information to the scheduler. -Each filter is run with a standard set of command-line arguments:

+

Filters (which include printer drivers and port monitors) and backends +are used to convert job files to a printable format and send that data to the +printer itself. All of these programs use a common interface for processing +print jobs and communicating status information to the scheduler. Each is run +with a standard set of command-line arguments:

@@ -38,7 +40,7 @@ Each filter is run with a standard set of command-line arguments:

The options that were provided when the job was submitted
argv[6]
-
The file to print (first filter only)
+
The file to print (first program only)

The scheduler runs one or more of these programs to print any given job. The @@ -101,7 +103,8 @@ or 1 when they encounter an error. Backends can return any of the

Environment Variables

-

The following environment variables are defined by the printing system:

+

The following environment variables are defined by the printing system +when running print filters and backends:

@@ -122,10 +125,11 @@ or 1 when they encounter an error. Backends can return any of the application/postscript).
CUPS_CACHEDIR
-
The directory where cache files can be stored.
+
The directory where cache files can be stored. Cache files can be + used to retain information between jobs or files in a job.
CUPS_DATADIR
-
The directory where data files can be found.
+
The directory where (read-only) CUPS data files can be found.
CUPS_SERVERROOT
The root directory of the server.
@@ -145,19 +149,23 @@ or 1 when they encounter an error. Backends can return any of the file for this printer.
PRINTER
-
The name of the printer.
+
The queue name of the class or printer.
RIP_CACHE
The recommended amount of memory to use for Raster Image Processors (RIPs).
+
TMPDIR
+
The directory where temporary files should be created.
+

Communicating with the Scheduler

-

Filters and backends communicate wih the scheduler by writing messages -to the standard error file. For example, the following code sets the current -printer state message to "Printing page 5":

+

Filters and backends communicate with the scheduler by writing messages +to the standard error file. The scheduler reads messages from all filters in +a job and processes the message based on its prefix. For example, the following +code sets the current printer state message to "Printing page 5":

 int page = 5;
@@ -179,7 +187,8 @@ prefix strings:

to set the marker-colors, marker-levels, marker-names, marker-types, printer-alert, and printer-alert-description - printer attributes. + printer attributes. Standard marker-types values are + listed in Table 1.
CRIT: message
Sets the printer-state-message attribute and adds the specified @@ -201,7 +210,8 @@ prefix strings:

ERROR: message
Sets the printer-state-message attribute and adds the specified - message to the current error log file using the "error" log level.
+ message to the current error log file using the "error" log level. + Use "ERROR:" messages for non-persistent processing errors.
INFO: message
Sets the printer-state-message attribute. If the current log level @@ -227,8 +237,10 @@ prefix strings:

STATE: + printer-state-reason [printer-state-reason ...]
STATE: - printer-state-reason [printer-state-reason ...]
Sets, adds, or removes printer-state-reason keywords to the - current queue. Typically this is used to indicate media, ink, and - toner conditions on a printer.
+ current queue. Typically this is used to indicate persistent media, + ink, toner, and configuration conditions or errors on a printer. + Table 2 lists the standard state keywords - + use vendor-prefixed ("com.acme.foo") keywords for custom states.
WARNING: message
Sets the printer-state-message attribute and adds the specified @@ -240,6 +252,141 @@ prefix strings:

Messages without one of these prefixes are treated as if they began with the "DEBUG:" prefix string.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1: Standard marker-types Values
marker-typeDescription
developerDeveloper unit
fuserFuser unit
fuserCleaningPadFuser cleaning pad
fuserOilFuser oil
inkInk supply
opcPhoto conductor
solidWaxWax supply
staplesStaple supply
tonerToner supply
transferUnitTransfer unit
wasteInkWaste ink tank
wasteTonerWaste toner tank
wasteWaxWaste wax tank
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 2: Standard State Keywords
KeywordDescription
connecting-to-deviceConnecting to printer but not printing yet
cover-openA cover is open on the printer
input-tray-missingAn input tray is missing from the printer
marker-supply-emptyOut of ink
marker-supply-lowLow on ink
marker-waste-almost-fullWaste tank almost full
marker-waste-fullWaste tank full
media-emptyOut of media
media-jamMedia is jammed in the printer
media-lowLow on media
pausedStop the printer
timed-outUnable to connect to printer
toner-emptyOut of toner
toner-lowLow on toner
+

Communicating with the Backend

Filters can communicate with the backend via the @@ -261,7 +408,11 @@ ssize_t bytes; bytes = cupsBackChannelRead(buffer, sizeof(buffer), 0.0);

-The +

Filters can also use select() or poll() on the +back-channel file descriptor (3 or CUPS_BC_FD) to read data only +when it is available.

+ +

The cupsSideChannelDoRequest function allows you to get out-of-band status information and do synchronization with the device. For example, the following code gets the current IEEE-1284 @@ -274,7 +425,8 @@ char data[2049]; int datalen; cups_sc_status_t status; -/* Tell cupsSideChannelDoRequest() how big our buffer is, less 1 byte for nul-termination... */ +/* Tell cupsSideChannelDoRequest() how big our buffer is, less 1 byte for + nul-termination... */ datalen = sizeof(data) - 1; /* Get the IEEE-1284 device ID, waiting for up to 1 second */ @@ -301,6 +453,9 @@ recommend writing back-channel data using a timeout of 1.0 seconds:

char buffer[8192]; ssize_t bytes; +/* Obtain data from printer/device */ +... + /* Use a timeout of 1.0 seconds to give filters a chance to read */ cupsBackChannelWrite(buffer, bytes, 1.0); diff --git a/cups/api-ppd.header b/cups/api-ppd.header index dfcb26a4c..60f6ff0d2 100644 --- a/cups/api-ppd.header +++ b/cups/api-ppd.header @@ -30,7 +30,7 @@ See Also Programming: Introduction to CUPS Programming
Programming: CUPS API
- Reference: CUPS PPD Specification + Specifications: CUPS PPD Extensions diff --git a/cups/api-ppd.shtml b/cups/api-ppd.shtml index c1c2402d3..c411c6844 100644 --- a/cups/api-ppd.shtml +++ b/cups/api-ppd.shtml @@ -3,7 +3,7 @@ PPD API introduction for the Common UNIX Printing System (CUPS). - Copyright 2007 by Apple Inc. + Copyright 2007-2008 by Apple Inc. Copyright 1997-2006 by Easy Software Products, all rights reserved. These coded instructions, statements, and computer programs are the @@ -17,10 +17,19 @@

The CUPS PPD API provides read-only access the data in PostScript Printer Description ("PPD") files which are used for all printers with a driver. With -it you can display printer options to users, mark option choices and check for -conflicting choices, and output marked choices in PostScript output. The -ppd_file_t structure contains all of -the information in a PPD file.

+it you can obtain the data necessary to display printer options to users, mark +option choices and check for conflicting choices, and output marked choices in +PostScript output. The ppd_file_t +structure contains all of the information in a PPD file.

+ +
Note: + +

The CUPS PPD API uses the terms "option" and "choice" instead of the Adobe +terms "MainKeyword" and "OptionKeyword" to refer to specific printer options and +features. CUPS also treats option ("MainKeyword") and choice ("OptionKeyword") +values as case-insensitive strings, so option "InputSlot" and choice "Upper" +are equivalent to "inputslot" and "upper", respectively.

+

Loading a PPD File

@@ -48,6 +57,9 @@ by the structure:

ppdClose(ppd); +

Once closed, pointers to the ppd_file_t +structure and any data in it will no longer be valid.

+

Options and Groups

PPD files support multiple options, which are stored in arrays of @@ -61,7 +73,7 @@ then it is put in an automatically-generated "General" group. Groups can also have sub-groups, however CUPS currently ignores sub-groups because of past abuses of this functionality.

-

Options are selected by marking them using one of three functions. The +

Option choices are selected by marking them using one of three functions. The first is ppdMarkDefaults which selects all of the default options in the PPD file:

@@ -75,14 +87,14 @@ selects all of the default options in the PPD file:

The second is ppdMarkOption which selects a single option choice in the PPD file. For example, the following -code selects the manual feed media source:

+code selects the upper paper tray:

 #include <cups/ppd.h>
 
 ppd_file_t *ppd;
 
-ppdMarkOption(ppd, "InputSlot", "ManualFeed");
+ppdMarkOption(ppd, "InputSlot", "Upper");
 

The last function is @@ -103,6 +115,7 @@ int num_options = cupsParseOptions(argv[5], 0, &options); ppdMarkDefaults(ppd); cupsMarkOptions(ppd, num_options, options); +cupsFreeOptions(num_options, options);

Constraints

@@ -112,7 +125,8 @@ constraints, between different options. Constraints are stored in an array of ppd_const_t structures which specify the options and choices that conflict with each other. The ppdConflicts function tells you -how many of the selected options are incompatible.

+how many of the selected options are incompatible. Since constraints are +normally specified in pairs, the returned value is typically an even number.

Page Sizes

@@ -164,13 +178,17 @@ in points. Custom page size names can also be specified in inches ppd_size_t *size = ppdPageSize(ppd, "Custom.12.7x34.5cm"); +

If the PPD does not support variable page sizes, the +ppdPageSize function will return +NULL.

+

Attributes

Every PPD file is composed of one or more attributes. Most of these attributes are used to define groups, options, choices, and page sizes, -however several informations attributes are available which you may need -to access in your program or filter. Attributes normally look like one of -the following examples in a PPD file:

+however several informational attributes may be present which you can access +in your program or filter. Attributes normally look like one of the following +examples in a PPD file:

 *name: "value"
diff --git a/cups/array.c b/cups/array.c
index 9d9790bd5..19f97819d 100644
--- a/cups/array.c
+++ b/cups/array.c
@@ -99,8 +99,8 @@ static int	cups_array_find(cups_array_t *a, void *e, int prev, int *rdiff);
  * 'cupsArrayAdd()' - Add an element to the array.
  *
  * When adding an element to a sorted array, non-unique elements are
- * appended at the end of the run.  For unsorted arrays, the element
- * is inserted at the end of the array.
+ * appended at the end of the run of identical elements.  For unsorted arrays,
+ * the element is appended to the end of the array.
  *
  * @since CUPS 1.2@
  */
@@ -132,6 +132,10 @@ cupsArrayAdd(cups_array_t *a,		/* I - Array */
 /*
  * 'cupsArrayClear()' - Clear the array.
  *
+ * This function is equivalent to removing all elements in the array.
+ * The caller is responsible for freeing the memory used by the
+ * elements themselves.
+ *
  * @since CUPS 1.2@
  */
 
@@ -185,6 +189,9 @@ cupsArrayCount(cups_array_t *a)		/* I - Array */
 /*
  * 'cupsArrayCurrent()' - Return the current element in the array.
  *
+ * The current element is undefined until you call @link cupsArrayFind@,
+ * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
+ *
  * @since CUPS 1.2@
  */
 
@@ -212,6 +219,9 @@ cupsArrayCurrent(cups_array_t *a)	/* I - Array */
 /*
  * 'cupsArrayDelete()' - Free all memory used by the array.
  *
+ * The caller is responsible for freeing the memory used by the
+ * elements themselves.
+ *
  * @since CUPS 1.2@
  */
 
@@ -407,7 +417,7 @@ cupsArrayFind(cups_array_t *a,		/* I - Array */
  * @since CUPS 1.2@
  */
 
-void *					/* O - First element or @code NULL@ */
+void *					/* O - First element or @code NULL@ if the array is empty */
 cupsArrayFirst(cups_array_t *a)		/* I - Array */
 {
  /*
@@ -430,10 +440,13 @@ cupsArrayFirst(cups_array_t *a)		/* I - Array */
 /*
  * 'cupsArrayGetIndex()' - Get the index of the current element.
  *
+ * The current element is undefined until you call @link cupsArrayFind@,
+ * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
+ *
  * @since CUPS 1.3@
  */
 
-int					/* O - Index of the current element */
+int					/* O - Index of the current element, starting at 0 */
 cupsArrayGetIndex(cups_array_t *a)	/* I - Array */
 {
   if (!a)
@@ -449,7 +462,7 @@ cupsArrayGetIndex(cups_array_t *a)	/* I - Array */
  * @since CUPS 1.3@
  */
 
-int					/* O - Index of the last inserted element */
+int					/* O - Index of the last inserted element, starting at 0 */
 cupsArrayGetInsert(cups_array_t *a)	/* I - Array */
 {
   if (!a)
@@ -482,8 +495,8 @@ cupsArrayIndex(cups_array_t *a,		/* I - Array */
  * 'cupsArrayInsert()' - Insert an element in the array.
  *
  * When inserting an element in a sorted array, non-unique elements are
- * inserted at the beginning of the run.  For unsorted arrays, the element
- * is inserted at the beginning of the array.
+ * inserted at the beginning of the run of identical elements.  For unsorted
+ * arrays, the element is inserted at the beginning of the array.
  *
  * @since CUPS 1.2@
  */
@@ -518,7 +531,7 @@ cupsArrayInsert(cups_array_t *a,	/* I - Array */
  * @since CUPS 1.2@
  */
 
-void *					/* O - Last element or @code NULL@ */
+void *					/* O - Last element or @code NULL@ if the array is empty */
 cupsArrayLast(cups_array_t *a)		/* I - Array */
 {
  /*
@@ -541,12 +554,17 @@ cupsArrayLast(cups_array_t *a)		/* I - Array */
 /*
  * 'cupsArrayNew()' - Create a new array.
  *
+ * The comparison function ("f") is used to create a sorted array. The function
+ * receives pointers to two elements and the user data pointer ("d") - the user
+ * data pointer argument can safely be omitted when not required so functions
+ * like @code strcmp@ can be used for sorted string arrays.
+ *
  * @since CUPS 1.2@
  */
 
 cups_array_t *				/* O - Array */
-cupsArrayNew(cups_array_func_t f,	/* I - Comparison function */
-             void              *d)	/* I - User data */
+cupsArrayNew(cups_array_func_t f,	/* I - Comparison function or @code NULL@ for an unsorted array */
+             void              *d)	/* I - User data pointer or @code NULL@ */
 {
   return (cupsArrayNew2(f, d, 0, 0));
 }
@@ -555,14 +573,22 @@ cupsArrayNew(cups_array_func_t f,	/* I - Comparison function */
 /*
  * 'cupsArrayNew2()' - Create a new array with hash.
  *
+ * The comparison function ("f") is used to create a sorted array. The function
+ * receives pointers to two elements and the user data pointer ("d") - the user
+ * data pointer argument can safely be omitted when not required so functions
+ * like @code strcmp@ can be used for sorted string arrays.
+ *
+ * The hash function ("h") is used to implement cached lookups with the
+ * specified hash size ("hsize").
+ *
  * @since CUPS 1.3@
  */
 
 cups_array_t *				/* O - Array */
-cupsArrayNew2(cups_array_func_t  f,	/* I - Comparison function */
-              void               *d,	/* I - User data */
-              cups_ahash_func_t  h,	/* I - Hash function*/
-	      int                hsize)	/* I - Hash size */
+cupsArrayNew2(cups_array_func_t  f,	/* I - Comparison function or @code NULL@ for an unsorted array */
+              void               *d,	/* I - User data or @code NULL@ */
+              cups_ahash_func_t  h,	/* I - Hash function or @code NULL@ for unhashed lookups */
+	      int                hsize)	/* I - Hash size (>= 0) */
 {
   cups_array_t	*a;			/* Array  */
 
@@ -604,6 +630,12 @@ cupsArrayNew2(cups_array_func_t  f,	/* I - Comparison function */
 /*
  * 'cupsArrayNext()' - Get the next element in the array.
  *
+ * This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) + 1)".
+ *
+ * The next element is undefined until you call @link cupsArrayFind@,
+ * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+ * to set the current element.
+ *
  * @since CUPS 1.2@
  */
 
@@ -631,6 +663,12 @@ cupsArrayNext(cups_array_t *a)		/* I - Array */
 /*
  * 'cupsArrayPrev()' - Get the previous element in the array.
  *
+ * This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) - 1)".
+ *
+ * The previous element is undefined until you call @link cupsArrayFind@,
+ * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+ * to set the current element.
+ *
  * @since CUPS 1.2@
  */
 
@@ -658,6 +696,12 @@ cupsArrayPrev(cups_array_t *a)		/* I - Array */
 /*
  * 'cupsArrayRemove()' - Remove an element from the array.
  *
+ * If more than one element matches "e", only the first matching element is
+ * removed.
+ *
+ * The caller is responsible for freeing the memory used by the
+ * removed element.
+ *
  * @since CUPS 1.2@
  */
 
@@ -718,7 +762,7 @@ cupsArrayRemove(cups_array_t *a,	/* I - Array */
 
 
 /*
- * 'cupsArrayRestore()' - Reset the current element to the last cupsArraySave.
+ * 'cupsArrayRestore()' - Reset the current element to the last @link cupsArraySave@.
  *
  * @since CUPS 1.2@
  */
@@ -743,7 +787,11 @@ cupsArrayRestore(cups_array_t *a)	/* I - Array */
 
 
 /*
- * 'cupsArraySave()' - Mark the current element for a later cupsArrayRestore.
+ * 'cupsArraySave()' - Mark the current element for a later @link cupsArrayRestore@.
+ *
+ * The current element is undefined until you call @link cupsArrayFind@,
+ * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+ * to set the current element.
  *
  * The save/restore stack is guaranteed to be at least 32 elements deep.
  *
diff --git a/cups/backchannel.c b/cups/backchannel.c
index 9b702172f..4eb1947ed 100644
--- a/cups/backchannel.c
+++ b/cups/backchannel.c
@@ -3,7 +3,7 @@
  *
  *   Backchannel functions for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -46,18 +46,17 @@ static void	cups_setup(fd_set *set, struct timeval *tval,
 /*
  * 'cupsBackChannelRead()' - Read data from the backchannel.
  *
- * Reads up to "bytes" bytes from the backchannel. The "timeout"
- * parameter controls how many seconds to wait for the data - use
- * 0.0 to return immediately if there is no data, -1.0 to wait
- * for data indefinitely.
+ * Reads up to "bytes" bytes from the backchannel/backend. The "timeout"
+ * parameter controls how many seconds to wait for the data - use 0.0 to
+ * return immediately if there is no data, -1.0 to wait for data indefinitely.
  *
  * @since CUPS 1.2@
  */
 
 ssize_t					/* O - Bytes read or -1 on error */
-cupsBackChannelRead(char   *buffer,	/* I - Buffer to read */
+cupsBackChannelRead(char   *buffer,	/* I - Buffer to read into */
                     size_t bytes,	/* I - Bytes to read */
-		    double timeout)	/* I - Timeout in seconds */
+		    double timeout)	/* I - Timeout in seconds, typically 0.0 to poll */
 {
   fd_set	input;			/* Input set */
   struct timeval tval;			/* Timeout value */
@@ -97,7 +96,7 @@ cupsBackChannelRead(char   *buffer,	/* I - Buffer to read */
 /*
  * 'cupsBackChannelWrite()' - Write data to the backchannel.
  *
- * Writes "bytes" bytes to the backchannel. The "timeout" parameter
+ * Writes "bytes" bytes to the backchannel/filter. The "timeout" parameter
  * controls how many seconds to wait for the data to be written - use
  * 0.0 to return immediately if the data cannot be written, -1.0 to wait
  * indefinitely.
@@ -109,7 +108,7 @@ ssize_t					/* O - Bytes written or -1 on error */
 cupsBackChannelWrite(
     const char *buffer,			/* I - Buffer to write */
     size_t     bytes,			/* I - Bytes to write */
-    double     timeout)			/* I - Timeout in seconds */
+    double     timeout)			/* I - Timeout in seconds, typically 1.0 */
 {
   fd_set	output;			/* Output set */
   struct timeval tval;			/* Timeout value */
diff --git a/cups/cups.h b/cups/cups.h
index 4321a459e..6ef70f647 100644
--- a/cups/cups.h
+++ b/cups/cups.h
@@ -64,6 +64,7 @@ extern "C" {
 #  define CUPS_VERSION_MINOR	4
 #  define CUPS_VERSION_PATCH	-1
 
+#  define CUPS_BC_FD		3	/* Back-channel file descriptor for select/poll */
 #  define CUPS_DATE_ANY		(time_t)-1
 #  define CUPS_EXCLUDE_NONE	(const char *)0
 #  define CUPS_FORMAT_AUTO	"application/octet-stream"
diff --git a/cups/sidechannel.h b/cups/sidechannel.h
index 741dca946..3a8692c1c 100644
--- a/cups/sidechannel.h
+++ b/cups/sidechannel.h
@@ -45,7 +45,7 @@ extern "C" {
  * Enumerations...
  */
 
-enum cups_sc_bidi_e			/**** Bidirectional capabilities ****/
+enum cups_sc_bidi_e			/**** Bidirectional capability values ****/
 {
   CUPS_SC_BIDI_NOT_SUPPORTED = 0,	/* Bidirectional I/O is not supported */
   CUPS_SC_BIDI_SUPPORTED = 1		/* Bidirectional I/O is supported */
@@ -68,8 +68,8 @@ typedef enum cups_sc_command_e cups_sc_command_t;
 
 enum cups_sc_state_e			/**** Printer state bits ****/
 {
-  CUPS_SC_STATE_OFFLINE = 0,		/* Device is off-line */
-  CUPS_SC_STATE_ONLINE = 1,		/* Device is on-line */
+  CUPS_SC_STATE_OFFLINE = 0,		/* Device is offline */
+  CUPS_SC_STATE_ONLINE = 1,		/* Device is online */
   CUPS_SC_STATE_BUSY = 2,		/* Device is busy */
   CUPS_SC_STATE_ERROR = 4,		/* Other error condition */
   CUPS_SC_STATE_MEDIA_LOW = 16,		/* Paper low condition */
diff --git a/doc/help/api-array.html b/doc/help/api-array.html
index e29419d39..f08a706a7 100644
--- a/doc/help/api-array.html
+++ b/doc/help/api-array.html
@@ -312,8 +312,8 @@ div.contents ul.subcontents li {
 
  • cupsArrayNext
  • cupsArrayPrev
  • cupsArrayRemove
  • -
  • cupsArrayRestore
  • -
  • cupsArraySave
  • +
  • cupsArraySave.">cupsArrayRestore
  • +
  • cupsArrayRestore.">cupsArraySave
  • cupsArrayUserData
  • Data Types
      @@ -397,7 +397,7 @@ void *user_data;
  • The hash function (type -cups_ahash_func_t) returns a +cups_ahash_func_t) should return a number from 0 to (hash_size-1) that (hopefully) uniquely identifies the element and is called whenever you look up an element in the array with cupsArrayFind. The hash size is @@ -410,7 +410,7 @@ only limited by available memory, but generally should not be larger than The first function adds an element to the array, adding the new element after any elements that have the same order, while the second inserts the element before others with the same order. For unsorted arrays, -cupsArrayAdd appends the elemnt to +cupsArrayAdd appends the element to the end of the array while cupsArrayInsert inserts the element at the beginning of the array. For example, the following code @@ -463,11 +463,11 @@ future lookups will start where the last one left off:

    cupsArrayFind
    -
    Returns the first matching element .
    +
    Returns the first matching element.
    cupsArrayFirst
    Returns the first element in the array.
    cupsArrayIndex
    -
    Returns the Nth element in the array.
    +
    Returns the Nth element in the array, starting at 0.
    cupsArrayLast
    Returns the last element in the array.
    cupsArrayNext
    @@ -518,8 +518,8 @@ int cupsArrayAdd (

    1 on success, 0 on failure

    Discussion

    When adding an element to a sorted array, non-unique elements are -appended at the end of the run. For unsorted arrays, the element -is inserted at the end of the array. +appended at the end of the run of identical elements. For unsorted arrays, +the element is appended to the end of the array.

     CUPS 1.2 cupsArrayClear

    @@ -533,6 +533,12 @@ void cupsArrayClear (
    a
    Array
    +

    Discussion

    +

    This function is equivalent to removing all elements in the array. +The caller is responsible for freeing the memory used by the +elements themselves. + +

     CUPS 1.2 cupsArrayCount

    Get the number of elements in the array.

    @@ -559,6 +565,11 @@ void *cupsArrayCurrent (

    Return Value

    Element

    +

    Discussion

    +

    The current element is undefined until you call cupsArrayFind, +cupsArrayFirst, or cupsArrayIndex, or cupsArrayLast. + +

     CUPS 1.2 cupsArrayDelete

    Free all memory used by the array.

    @@ -570,6 +581,11 @@ void cupsArrayDelete (

    a
    Array
    +

    Discussion

    +

    The caller is responsible for freeing the memory used by the +elements themselves. + +

     CUPS 1.2 cupsArrayDup

    Duplicate the array.

    @@ -611,7 +627,7 @@ void *cupsArrayFirst (

    Array

    Return Value

    -

    First element or NULL

    +

    First element or NULL if the array is empty

     CUPS 1.3 cupsArrayGetIndex

    Get the index of the current element.

    @@ -624,7 +640,12 @@ int cupsArrayGetIndex (

    Array

    Return Value

    -

    Index of the current element

    +

    Index of the current element, starting at 0

    +

    Discussion

    +

    The current element is undefined until you call cupsArrayFind, +cupsArrayFirst, or cupsArrayIndex, or cupsArrayLast. + +

     CUPS 1.3 cupsArrayGetInsert

    Get the index of the last inserted element.

    @@ -637,7 +658,7 @@ int cupsArrayGetInsert (

    Array

    Return Value

    -

    Index of the last inserted element

    +

    Index of the last inserted element, starting at 0

     CUPS 1.2 cupsArrayIndex

    Get the N-th element in the array.

    @@ -672,8 +693,8 @@ int cupsArrayInsert (

    0 on failure, 1 on success

    Discussion

    When inserting an element in a sorted array, non-unique elements are -inserted at the beginning of the run. For unsorted arrays, the element -is inserted at the beginning of the array. +inserted at the beginning of the run of identical elements. For unsorted +arrays, the element is inserted at the beginning of the array.

     CUPS 1.2 cupsArrayLast

    @@ -688,7 +709,7 @@ void *cupsArrayLast (
    Array

    Return Value

    -

    Last element or NULL

    +

    Last element or NULL if the array is empty

     CUPS 1.2 cupsArrayNew

    Create a new array.

    @@ -699,12 +720,19 @@ void *cupsArrayLast (

    Parameters

    f
    -
    Comparison function
    +
    Comparison function or NULL for an unsorted array
    d
    -
    User data
    +
    User data pointer or NULL

    Return Value

    Array

    +

    Discussion

    +

    The comparison function ("f") is used to create a sorted array. The function +receives pointers to two elements and the user data pointer ("d") - the user +data pointer argument can safely be omitted when not required so functions +like strcmp can be used for sorted string arrays. + +

     CUPS 1.3 cupsArrayNew2

    Create a new array with hash.

    @@ -717,16 +745,26 @@ void *cupsArrayLast (

    Parameters

    f
    -
    Comparison function
    +
    Comparison function or NULL for an unsorted array
    d
    -
    User data
    +
    User data or NULL
    h
    -
    Hash function
    +
    Hash function or NULL for unhashed lookups
    hsize
    -
    Hash size
    +
    Hash size (>= 0)

    Return Value

    Array

    +

    Discussion

    +

    The comparison function ("f") is used to create a sorted array. The function +receives pointers to two elements and the user data pointer ("d") - the user +data pointer argument can safely be omitted when not required so functions +like strcmp can be used for sorted string arrays.
    +
    +The hash function ("h") is used to implement cached lookups with the +specified hash size ("hsize"). + +

     CUPS 1.2 cupsArrayNext

    Get the next element in the array.

    @@ -740,6 +778,14 @@ void *cupsArrayNext (

    Return Value

    Next element or NULL

    +

    Discussion

    +

    This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) + 1)".
    +
    +The next element is undefined until you call cupsArrayFind, +cupsArrayFirst, or cupsArrayIndex, or cupsArrayLast +to set the current element. + +

     CUPS 1.2 cupsArrayPrev

    Get the previous element in the array.

    @@ -753,6 +799,14 @@ void *cupsArrayPrev (

    Return Value

    Previous element or NULL

    +

    Discussion

    +

    This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) - 1)".
    +
    +The previous element is undefined until you call cupsArrayFind, +cupsArrayFirst, or cupsArrayIndex, or cupsArrayLast +to set the current element. + +

     CUPS 1.2 cupsArrayRemove

    Remove an element from the array.

    @@ -769,8 +823,16 @@ int cupsArrayRemove (

    Return Value

    1 on success, 0 on failure

    +

    Discussion

    +

    If more than one element matches "e", only the first matching element is +removed.
    +
    +The caller is responsible for freeing the memory used by the +removed element. + +

     CUPS 1.2 cupsArrayRestore

    -

    Reset the current element to the last cupsArraySave.

    +

    Reset the current element to the last cupsArraySave.

    void *cupsArrayRestore (
        cups_array_t *a
    @@ -783,7 +845,7 @@ void *cupsArrayRestore (

    Return Value

    New current element

     CUPS 1.2 cupsArraySave

    -

    Mark the current element for a later cupsArrayRestore.

    +

    Mark the current element for a later cupsArrayRestore.

    int cupsArraySave (
        cups_array_t *a
    @@ -796,7 +858,11 @@ int cupsArraySave (

    Return Value

    1 on success, 0 on failure

    Discussion

    -

    The save/restore stack is guaranteed to be at least 32 elements deep. +

    The current element is undefined until you call cupsArrayFind, +cupsArrayFirst, or cupsArrayIndex, or cupsArrayLast +to set the current element.
    +
    +The save/restore stack is guaranteed to be at least 32 elements deep.

     CUPS 1.2 cupsArrayUserData

    diff --git a/doc/help/api-filter.html b/doc/help/api-filter.html index 279d18014..b645ec353 100644 --- a/doc/help/api-filter.html +++ b/doc/help/api-filter.html @@ -253,7 +253,7 @@ div.contents ul.subcontents li {