~ubuntu-branches/ubuntu/oneiric/cups/oneiric-proposed

« back to all changes in this revision

Viewing changes to cups/api-array.shtml

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Till Kamppeter, Martin Pitt
  • Date: 2011-08-07 12:53:12 UTC
  • mfrom: (1.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20110807125312-s323cyb3oqaxaemo
Tags: 1.5.0-1
[ Till Kamppeter ]
* New upstream release
* debian/patches/usb-backend-no-segfault-on-bad-device-id.patch,
  debian/patches/usb-backend-accept-old-usblp-uris.patch,
  debian/patches/use-ps2write-ghostscript-device-for-pdftops-filter.patch:
  Removed, included upstream.
* debian/patches/poppler-based-pdftops-fixes.patch,
  debian/patches/do-not-emit-ps-level-3-with-poppler.patch: Replaced patch
  by a new one only containing the parts which remain after removing the
  parts included upstream.
* debian/patches/pidfile.patch,
  debian/patches/ppd-poll-with-client-conf.patch,
  debian/patches/cups-avahi.patch,
  debian/patches/drop_unnecessary_dependencies.patch,
  debian/patches/do-not-broadcast-with-hostnames.patch,
  debian/patches/ppdc-dynamic-linking.patch,
  debian/patches/pstops-based-workflow-only-for-printing-ps-on-a-ps-printer.patch:
  Manually regenerated to adapt to upstream changes.
* debian/patches/manpage-translations.patch,
  debian/patches/rootbackends-worldreadable.patch,
  debian/patches/no-conffile-timestamp.patch,
  debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch,
  debian/patches/cups-snmp-oids-device-id-hp-ricoh.patch,
  debian/patches/configure-default-browse-protocols.patch,
  debian/patches/logfiles_adm_readable.patch,
  debian/patches/confdirperms.patch,
  debian/patches/printer-filtering.patch,
  debian/patches/show-compile-command-lines.patch,
  debian/patches/log-debug-history-nearly-unlimited.patch:
  Refreshed using quilt.
* debian/patches/default-ripcache-size-auto.patch: Dropped, as once,
  Ghostscript 9.04 is ignoring the cache size value as it crashes easily
  otherwise (Ghostscript upstream bug #691586) and second, CUPS defaults to
  more reasonable 128 MB (now only used for imagetops).
* debian/patches/support-gzipped-charmaps.patch: Dropped, as the SBCS and
  VBCS character maps are not used any more by CUPS.
* debian/rules: Enable threads in the ./configure command line, as otherwise
  CUPS 1.5.0 does not build at all.
* debian/local/filters/pdf-filters/filter/pdftoijs.cxx,
  debian/local/filters/pdf-filters/filter/pdftoraster.cxx,
  debian/local/filters/pdf-filters/pdftoopvp/pdftoopvp.cxx,
  debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx: Under CUPS 1.5.x.
  all programs using the PPD API of CUPS need to explicitly include
  "<cups/ppd.h>". Updated the PDF filter add-on package.
* debian/local/filters/pdf-filters/addtocups: Make the addition of the
  pdftopdf and pdftoopvp directories also work with CUPS 1.5.x.
* debian/local/filters/pdf-filters/addtocups,
  debian/local/filters/pdf-filters/removefromcups: Added a symbolic link
  cups/i18n.h, so that texttopdf builds.
* debian/cups-client.install: Install the new ipptool and its sample
  files and manpages.
* debian/cups-client.install: Commented out lines for dropped man page
  translations: ipptool, lppasswd, client.conf, ipptoolfile, cupsenable,
  lpadmin, lpinfo, cupsreject, cupsdisable, cupsaccept
* debian/cups-common.install, debian/rules: The /usr/share/cups/charmaps
  directory got removed from CUPS.
* debian/libcups2-dev.install: cups/i18n.h got renamed to
  cups/language-private.h. Install this as /usr/include/cups/i18n.h.
* debian/libcups2.symbols, debian/libcupsmime1.symbols: Updated.
* debian/cups.lintian-overrides, debian/cups.postinst, debian/cups.prerm,
  debian/cups.templates, debian/local/apparmor-profile: The "scsi"
  CUPS backend got dropped upstream, removed its treatment from these files.

[ Martin Pitt ]
* Add Serbian (Cyrillic) debconf translations, thanks Zlatan Todoric.
  (Closes: #635105)
* Add Serbian (Latin) debconf translations, thanks Zlatan Todoric.
  (Closes: #635108)
* debian/local/apparmor-profile: Allow access to serial printers on USB
  adapters. (LP: #677432)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!--
2
 
  "$Id: api-array.shtml 9728 2011-04-28 21:21:24Z mike $"
 
2
  "$Id: api-array.shtml 9727 2011-04-28 21:20:12Z mike $"
3
3
 
4
4
  Array API introduction for CUPS.
5
5
 
31
31
<h3><a name='MANAGING_ARRAYS'>Managing Arrays</a></h3>
32
32
 
33
33
<p>Arrays are created using either the
34
 
<a href='#cupsArrayNew'><code>cupsArrayNew</code></a> or
35
 
<a href='#cupsArrayNew2'><code>cupsArrayNew2</code></a> functions. The
 
34
<a href='#cupsArrayNew'><code>cupsArrayNew</code></a>,
 
35
<a href='#cupsArrayNew2'><code>cupsArrayNew2</code></a>, or
 
36
<a href='#cupsArrayNew2'><code>cupsArrayNew3</code></a> functions. The
36
37
first function creates a new array with the specified callback function
37
38
and user data pointer:</p>
38
39
 
69
70
static int hash_func(void *element, void *user_data);
70
71
 
71
72
void *user_data;
72
 
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew2'>cupsArrayNew2</a>(compare_func, user_data, hash_func, HASH_SIZE);
 
73
<a href='#cups_array_t'>cups_array_t</a> *hash_array = <a href='#cupsArrayNew2'>cupsArrayNew2</a>(compare_func, user_data, hash_func, HASH_SIZE);
73
74
</pre>
74
75
 
75
76
<p>The hash function (type
80
81
only limited by available memory, but generally should not be larger than
81
82
16384 to realize any performance improvement.</p>
82
83
 
 
84
<p>The <a href='#cupsArrayNew3'><code>cupsArrayNew3</code></a> function adds
 
85
copy and free callbacks to support basic memory management of elements:</p>
 
86
 
 
87
<pre class='example'>
 
88
#include &lt;cups/array.h&gt;
 
89
 
 
90
#define HASH_SIZE 512 /* Size of hash table */
 
91
 
 
92
static int compare_func(void *first, void *second, void *user_data);
 
93
static void *copy_func(void *element, void *user_data);
 
94
static void free_func(void *element, void *user_data);
 
95
static int hash_func(void *element, void *user_data);
 
96
 
 
97
void *user_data;
 
98
<a href='#cups_array_t'>cups_array_t</a> *array = <a href='#cupsArrayNew3'>cupsArrayNew3</a>(compare_func, user_data, NULL, 0, copy_func, free_func);
 
99
 
 
100
<a href='#cups_array_t'>cups_array_t</a> *hash_array = <a href='#cupsArrayNew3'>cupsArrayNew3</a>(compare_func, user_data, hash_func, HASH_SIZE, copy_func, free_func);
 
101
</pre>
 
102
 
83
103
<p>Once you have created the array, you add elements using the
84
104
<a href='#cupsArrayAdd'><code>cupsArrayAdd</code></a>
85
105
<a href='#cupsArrayInsert'><code>cupsArrayInsert</code></a> functions.
128
148
<p>Finally, you free the memory used by the array using the
129
149
<a href='#cupsArrayDelete'><code>cupsArrayDelete</code></a> function. All
130
150
of the memory for the array and hash table (if any) is freed, however <em>CUPS
131
 
does not free the elements</em> - if necessary, you must allocate and free the
132
 
elements yourself.</p>
 
151
does not free the elements unless you provide copy and free functions</em>.</p>
133
152
 
134
153
<h3><a name='FINDING_AND_ENUMERATING'>Finding and Enumerating Elements</a></h3>
135
154