From bdd6c45b5e42206a5add7bf770196531dd8ad811 Mon Sep 17 00:00:00 2001 From: msweet Date: Wed, 21 May 2008 01:15:17 +0000 Subject: [PATCH] Merge changes from CUPS 1.4svn-r7607. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@784 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES.txt | 14 +- configure.in | 2 +- cups/mark.c | 7 +- doc/Makefile | 2 + doc/help/ref-ppdcfile.html | 2402 ++++++++++++++++++++++++++++++++++++ driver/Makefile | 28 +- man/Makefile | 1 + man/cupsctl.man | 4 +- man/cupstestdsc.man | 2 +- man/drv.man.in | 40 + man/ppdc.man | 25 +- man/ppdcfile.man | 29 +- man/ppdhtml.man | 16 +- man/ppdi.man | 16 +- man/ppdmerge.man | 12 +- man/ppdpo.man | 11 +- man/rastertoescpx.man | 12 +- man/rastertopclx.man | 14 +- man/subscriptions.conf.man | 4 +- ppdc/Dependencies | 69 +- ppdc/Makefile | 64 +- ppdc/libcupsppdc.exp | 158 --- ppdc/ppdc-attr.cxx | 12 +- ppdc/ppdc-driver.cxx | 65 +- ppdc/ppdc-source.cxx | 638 ++++++++-- ppdc/ppdc.cxx | 183 ++- ppdc/ppdc.h | 21 +- ppdc/ppdpo.cxx | 14 +- scheduler/dirsvc.c | 6 +- scheduler/ipp.c | 2 +- systemv/cupstestppd.c | 6 +- 31 files changed, 3404 insertions(+), 475 deletions(-) create mode 100644 doc/help/ref-ppdcfile.html create mode 100644 man/drv.man.in diff --git a/CHANGES.txt b/CHANGES.txt index 99155aed7..4f447198b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,20 @@ -CHANGES.txt - 2008-05-19 +CHANGES.txt - 2008-05-20 ------------------------ CHANGES IN CUPS V1.4b1 + - The PPD compiler now supports localizable attributes + (STR #2738) + - The ppdpo utility now includes cupsIPPReasons values in + the message catalogs it generates (STR #2754) + - The PPD compiler now supports conditional directives + (STR #2636) + - The ppdc utility now supports a "-t" option to test PPD + files (STR #2739) + - The ppdc utility now supports a "-m" option to use the + ModelName value as the output filename. + - The ppdc utility now supports a FileName directive to + set an alternate output filename (STR #2740) - The side-channel API now supports SNMP queries for the standard network backends. - Added a PageLogFormat directive to the cupsd.conf file to diff --git a/configure.in b/configure.in index ec142509d..769c53cb9 100644 --- a/configure.in +++ b/configure.in @@ -68,7 +68,7 @@ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config init/org.cups.cups-lpd.plist man/client.conf.man man/cups-deviced.man man/cups-driverd.man man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man - man/cupsd.conf.man man/lpoptions.man + man/cupsd.conf.man man/drv.man man/lpoptions.man templates/header.tmpl $LANGFILES) diff --git a/cups/mark.c b/cups/mark.c index c0fdc911d..7b018e609 100644 --- a/cups/mark.c +++ b/cups/mark.c @@ -507,11 +507,14 @@ ppdFindChoice(ppd_option_t *o, /* I - Pointer to option */ ppd_choice_t *c; /* Current choice */ - if (o == NULL || choice == NULL) + if (!o || !choice) return (NULL); + if (choice[0] == '{' || !strncasecmp(choice, "Custom.", 7)) + choice = "Custom"; + for (i = o->num_choices, c = o->choices; i > 0; i --, c ++) - if (strcasecmp(c->choice, choice) == 0) + if (!strcasecmp(c->choice, choice)) return (c); return (NULL); diff --git a/doc/Makefile b/doc/Makefile index 5b032def2..e87eb5c34 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -73,6 +73,7 @@ HELPFILES = \ help/man-cupsenable.html \ help/man-cupstestdsc.html \ help/man-cupstestppd.html \ + help/man-drv.html \ help/man-filter.html \ help/man-lp.html \ help/man-lpadmin.html \ @@ -99,6 +100,7 @@ HELPFILES = \ help/ref-error_log.html \ help/ref-mailto-conf.html \ help/ref-page_log.html \ + help/ref-ppdcfile.html \ help/ref-printers-conf.html \ help/ref-snmp-conf.html \ help/ref-subscriptions-conf.html \ diff --git a/doc/help/ref-ppdcfile.html b/doc/help/ref-ppdcfile.html new file mode 100644 index 000000000..b25a3b6bf --- /dev/null +++ b/doc/help/ref-ppdcfile.html @@ -0,0 +1,2402 @@ + + + + PPD Compiler Driver Information File Reference + + + +

The CUPS PPD compiler reads meta files that contain descriptions +of one or more PPD files to be generated by +ppdc(1) or the corresponding driver interface +program drv(1). The source file format is plain +ASCII text that can be edited using your favorite text editor.

+ +

Directives may be placed anywhere on a line and are followed by +zero or more values.

+ +

Comments are supported using the C (/* ... */) and C++ (// ...) comment +mechanisms.

+ +

Directives that accept expressions look for sequences of the form:

+ +
+ +
NAME
+
Evaluates to 1 if NAME is defined, otherwise 0.
+ +
number
+ +
Evaluates to the specified integer; the number can be preceded by + a leading sign (+/-) followed by a decimal number (1234), octal number + (01234), or hexidecimal number (0x1234) using the same rules as C and + C++.
+ +
(NAME NAME ... number number ...)
+
Evaluates to the bitwise OR of each named #define constant or + number.
+ +
(NAME == OTHERNAME)
+
(NAME == number)
+
Evaluates to 1 if NAME is equal to the other named constant or + number, otherwise 0.
+ +
(NAME != OTHERNAME)
+
(NAME != number)
+
Evaluates to 1 if NAME is not equal to the other named constant or + number, otherwise 0.
+ +
(NAME < OTHERNAME)
+
(NAME < number)
+
Evaluates to 1 if NAME is less than to the other named constant or + number, otherwise 0.
+ +
(NAME <= OTHERNAME)
+
(NAME <= number)
+
Evaluates to 1 if NAME is less than or equal to the other named + constant or number, otherwise 0.
+ +
(NAME > OTHERNAME)
+
(NAME > number)
+
Evaluates to 1 if NAME is greater than to the other named constant + or number, otherwise 0.
+ +
(NAME >= OTHERNAME)
+
(NAME >= number)
+
Evaluates to 1 if NAME is greater than or equal to the other named + constant or number, otherwise 0.
+ +
+ +

Printer driver information can be grouped and shared using +curley braces ({ ... }); PPD files are written when a close +brace or end-of-file is seen and a PCFileName +directive has been defined.

+ + +

#define

+ +

Syntax

+ +
+#define name expression
+
+ +

Examples

+ +
+#define FOO 100
+#define BAR "Bar, Inc."
+
+ +

Description

+ +

The #define directive assigns a value to a name +which can be later referenced using $name. The name is +case-insensitive and can be any sequence of letters, numbers, +and the underscore. The value can be any valid expression.

+ +

See Also

+ +

#include

+ + +

#elif

+ +

Syntax

+ +
+#elif expression
+
+ +

Examples

+ +
+#if HAVE_FOO
+...
+#elif (HAVE_BAR >= 999)
+...
+#else
+...
+#endif 
+
+ +

Description

+ +

The #elif directive allows portions of a driver information file +to be used conditionally. #elif directives must appear after a +corresponding #if directive.

+ +

See Also

+ +

#else, +#endif, +#if

+ + +

#else

+ +

Syntax

+ +
+#else
+
+ +

Examples

+ +
+#if HAVE_FOO
+...
+#elif (HAVE_BAR >= 999)
+...
+#else
+...
+#endif 
+
+ +

Description

+ +

The #else directive allows portions of a driver information file +to be used conditionally when the corresponding +#if and #elif +expressions are non-zero.

+ +

See Also

+ +

#elif, +#endif, +#if

+ + +

#endif

+ +

Syntax

+ +
+#endif
+
+ +

Examples

+ +
+#if HAVE_FOO
+...
+#elif (HAVE_BAR >= 999)
+...
+#else
+...
+#endif 
+
+ +

Description

+ +

The #endif directive ends a conditional block of a driver +information file. It must appear after all of the +#if, #elif, +and #else directives for the current +conditional block.

+ +

See Also

+ +

#elif, +#else, +#if

+ + +

#font

+ +

Syntax

+ +
+#font name encoding "version" charset status
+
+ +

Examples

+ +
+#font Courier Standard "(1.05)" Standard ROM
+#font Symbol Special "(001.005)" Special ROM
+#font Barcode-Foo Special "(1.0)" Special Disk
+#font Unicode-Foo Expert "(2.0)" Adobe-Identity ROM
+
+ +

Description

+ +

The #font directive defines a "base font" for all +printer drivers. The name is the PostScript font name.

+ +

The encoding is the default encoding of the font, usually +Standard, Expert, or Special, as +defined in the Adobe PPD file specification.

+ +

The version is the PostScript string definition that +corresponds to the font version number.

+ +

The charset defines the available characters in the font, +usually Standard or Special, as defined in the +Adobe PPD file specification.

+ +

The status is the installation status of the font and must be +either the word ROM or Disk. + +

Base fonts differ from fonts defined using the Font directive in that they are not +automatically associated with all drivers - you must use the +special Font * directive to include them in a +driver.

+ +

Currently the #font directive is used mainly for +defining the standard raster fonts in the +<font.defs> include file.

+ +

See Also

+ +

#include, +Font

+ + +

#if

+ +

Syntax

+ +
+#if name or expression
+
+ +

Examples

+ +
+#if HAVE_FOO
+...
+#elif (HAVE_BAR >= 999)
+...
+#else
+...
+#endif 
+
+ +

Description

+ +

The #if directive allows portions of a driver information file +to be used conditionally. When followed by a name, the data that follows is +used only when the name is defined, otherwise the data is ignored. +#if directives can be nested up to 100 times.

+ +

See Also

+ +

#elif, +#else, +#endif

+ + +

#include

+ +

Syntax

+ +
+#include <filename>
+#include "filename"
+
+ +

Examples

+ +
+#include <font.defs>
+#include "myfile.h"
+
+ +

Description

+ +

The #include directive reads the named driver +information file. If the filename is included inside angle +brackets (<filename>), then the PPD compiler will +look for the file in all of the include directories it knows +about. Otherwise, the file is opened in the current directory +relative to the current driver information file, and if that +fails then it looks in the include directories for the file.

+ +

The #include directive can be nested to as many +files as are allowed by the host operating system, typically at +least 100 files.

+ +

See Also

+ +

#define, +#font, +#media

+ + +

#media

+ +

Syntax

+ +
+#media name width length
+#media "name/text" width length
+
+ +

Examples

+ +
+#media "Letter/Letter - 8.5x11in" 8.5in 11in
+#media "A4/A4 - 210x297mm" 210mm 297mm
+#media "w936h1368/Super B/A3 - 13x19in" 936 1368
+#media Photo 4in 6in
+
+ +

Description

+ +

The #media directive defines a named media size for +inclusion in a driver. The name with optional user text defines +the name for the media size and is used with the MediaSize directive to associate +the media size with the driver. The name may only contain +letters, numbers, and the underscore and may not exceed 40 +characters in length. The user text, if supplied, may not exceed +80 characters in length.

+ +

The width and length define the dimensions of the media. Each +number is optionally followed by one of the following unit +suffixes:

+ + + +

Points are assumed if no units are specified. + +

See Also

+ +

#include, +CustomMedia, +MediaSize

+ + +

#po

+ +

Syntax

+ +
+#po locale filename
+
+ +

Examples

+ +
+#po es "es.po"
+#po fr_CA "mydriver-fr_CA.po"
+
+ +

Description

+ +

The #po directive defines a message catalog to use for the +given POSIX language abbreviation. Multiple #po directives can be +specified to list multiple catalogs. The filename can be an absolute path or +relative to the driver information file. GNU gettext and Mac OS X .strings +files are supported.

+ + +

Attribute

+ +

Syntax

+ +
+Attribute name "" value
+Attribute name keyword value
+Attribute name "keyword/text" value
+
+ +

Examples

+ +
+Attribute cupsInkChannels "" 1
+Attribute cupsAllDither 600dpi "1.0"
+Attribute fooProfile "Photo/Photographic Profile" "photopro.icc"
+
+ +

Description

+ +

The Attribute directive creates a PPD attribute. The +name is any combination of letters, numbers, and the underscore +and can be up to 40 characters in length.

+ +

The selector can be the empty string (""), a keyword +consisting of up to 40 letters, numbers, and the underscore, or +a string composed of a keyword and user text of up to 80 +characters.

+ +

The value is any string or number; the string may contain +multiple lines, however no one line may exceed 255 +characters.

+ +

See Also

+ +

LocAttribute

+ + +

Choice

+ +

Syntax

+ +
+Choice name "code"
+Choice "name/text" "code"
+
+ +

Examples

+ +
+Choice None "<</MediaType (None)>>setpagedevice"
+Choice "False/No" "<</cupsCompression 0>>setpagedevice"
+
+ +

Description

+ +

The Choice directive adds a single choice to the +current option. The name is any combination of letters, numbers, +and the underscore and can be up to 40 characters in length.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

The code is any string and may contain multiple lines, +however no one line may exceed 255 characters.

+ +

See Also

+ +

ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

ColorDevice

+ +

Syntax

+ +
+ColorDevice boolean-value
+
+ +

Examples

+ +
+ColorDevice no
+ColorDevice yes
+
+ +

Description

+ +

The ColorDevice directive tells the application if +the printer supports color. It is typically used in conjunction +with the ColorModel directive +to provide color printing support.

+ +

See Also

+ +

ColorModel

+ + +

DeprecatedColorModel

+ +

Syntax

+ +
+ColorModel name colorspace colororder compression
+ColorModel "name/text" colorspace colororder compression
+
+ +

Examples

+ +
+ColorModel Gray/Grayscale w chunky 0
+ColorModel RGB/Color rgb chunky 0
+ColorModel CMYK cmyk chunky 0
+
+ +

Description

+ +

The ColorModel directive is a convenience directive +which creates a ColorModel option and choice for the current +printer driver. The name is any combination of letters, numbers, +and the underscore and can be up to 40 characters in length.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

The colorspace argument is one of the standard colorspace +keywords defined later in this appendix in the section titled, +"Colorspace Keywords".

+ +

The colororder argument is one of the standard color order +keywords defined later in this appendix in the section titled, +"Color Order Keywords".

+ +

The compression argument is any number and is assigned to the +cupsCompression attribute in the PostScript page device +dictionary.

+ +

See Also

+ +

Choice, +ColorDevice, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

DeprecatedColorProfile

+ +

Syntax

+ +
+ColorProfile resolution/mediatype gamma density matrix
+
+ +

Examples

+ +
+ColorProfile -/- 1.7 1.0
+     1.0    0.0    0.0
+     0.0    1.0    0.0
+     0.0    0.0    1.0
+
+ColorProfile 360dpi/- 1.6 1.0
+     1.0   -0.05  -0.3
+    -0.35   1.0   -0.15
+    -0.095 -0.238  0.95
+
+ColorProfile 720dpi/Special 1.5 1.0
+     1.0    0.0   -0.38
+    -0.4    1.0    0.0
+     0.0   -0.38   0.9
+
+ +

Description

+ +

The ColorProfile directive defines a CMY +transform-based color profile. The resolution and mediatype +arguments specify the Resolution and MediaType +choices which use the profile; the hyphen (-) is used to +specify that any resolution or mediatype can be used with the +profile.

+ +

The gamma argument specifies the gamma correction to apply to +the color values (P = pg) and is a real number +greater than 0. Values larger than 1 cause a general lightening +of the print while values smaller than 1 cause a general +darkening of the print. A value of 1 disables gamma +correction.

+ +

The density argument specifies the linear density correction +to apply to the color values (P = d * pg) and is a +real number greater than 0 and less than or equal to 1. A value +1 of disables density correction while lower values produce +proportionately lighter output.

+ +

The matrix argument specifies a 3x3 linear transformation +matrix in row-major order. The matrix is applied only to the CMY +component of a RGB to CMYK transformation and is not used when +printing in grayscale or CMYK mode unless the printer only +supports printing with 3 colors.

+ +

See Also

+ +

SimpleColorProfile

+ + +

Copyright

+ +

Syntax

+ +
+Copyright "text"
+
+ +

Examples

+ +
+Copyright "Copyright 2008 by Foo Enterprises"
+
+Copyright
+"This software is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+MA 02111 USA"
+
+ +

Description

+ +

The Copyright directive adds text comments to the +top of a PPD file, typically for use in copyright notices. The +text argument can contain multiple lines of text, but no line +may exceed 255 characters.

+ + +

CustomMedia

+ +

Syntax

+ +
+CustomMedia name width length left bottom right top
+    "size-code" "region-code"
+
+CustomMedia "name/text" width length left bottom right top
+    "size-code" "region-code"
+
+ +

Examples

+ +
+CustomMedia Letter 8.5in 11in 0.25in 0.46in 0.25in 0.04in
+    "<</PageSize[612 792]/ImagingBBox null/ManualFeed false>>
+     setpagedevice"
+    "<</PageSize[612 792]/ImagingBBox null/ManualFeed true>>
+     setpagedevice"
+
+CustomMedia "A4/A4 - 210x297mm" 210mm 297mm 12 12 12 12
+    "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+    "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+
+ +

Description

+ +

The CustomMedia directive adds a custom media size to +the driver. The name is any combination of letters, numbers, +and the underscore and can be up to 40 characters in length.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

The width and length arguments specify the dimensions of the +media as defined for the #media +directive.

+ +

The left, bottom, right, and top arguments specify the +printable margins of the media.

+ +

The size-code and region-code arguments specify the +PostScript commands to run for the PageSize and +PageRegion options, respectively. The commands can +contain multiple lines, however no line may be more than 255 +characters in length.

+ +

See Also

+ +

#media, +MediaSize

+ + +

Cutter

+ +

Syntax

+ +
+Cutter boolean-value
+
+ +

Examples

+ +
+Cutter yes
+Cutter no
+
+ +

Description

+ +

The Cutter directive specifies whether the printer +has a built-in media cutter. When a cutter is present, the +printer's PPD file will contain a CutMedia option that +allows the user to control whether the media is cut at the end +of the job.

+ +

See Also

+ +

Choice, +ColorModel, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

DeprecatedDarkness

+ +

Syntax

+ +
+Darkness temperature name
+Darkness temperature "name/text"
+
+ +

Examples

+ +
+Darkness 0 Light
+Darkness 2 "Normal/Standard"
+
+ +

Description

+ +

The Darkness directive defines a choice for the +cupsDarkness option which sets the +cupsCompression attribute in the PostScript page device +dictionary. It is used with the CUPS rastertolabel +sample driver to control the print head temperature and +therefore the darkness of the print.

+ +

The temperature argument specifies a temperature value for +the Dymo driver from 0 (lowest) to 3 (highest), with 2 +representing the normal setting.

+ +

The name is any combination of letters, numbers, and the +underscore and can be up to 40 characters in length.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

DriverType

+ +

Syntax

+ +
+DriverType type
+
+ +

Examples

+ +
+DriverType custom
+DriverType escp
+DriverType pcl
+DriverType ps
+
+ +

Description

+ +

The DriverType directive tells the PPD compiler +which DDK filters to include in the PPD file. The following +types are supported:

+ + + +

See Also

+ +

Filter, +ModelNumber

+ + +

Duplex

+ +

Syntax

+ +
+Duplex type
+
+ +

Examples

+ +
+Duplex none
+Duplex normal
+Duplex flip
+
+ +

Description

+ +

The Duplex directive determines whether double-sided printing +is supported in the current driver. The type argument specifies the type +of duplexing that is supported:

+ + + +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

FileName

+ +

Syntax

+ +
+FileName "filename"
+
+ +

Examples

+ +
+FileName "Acme Laser Printer 2000"
+FileName "Acme Ink Waster 1000"
+
+ +

Description

+ +

The FileName attribute specifies the "long" name of the +PPD file for the current driver.

+ +

See Also

+ +

Manufacturer, +ModelName, +PCFileName, +Version

+ + +

Filter

+ +

Syntax

+ +
+Filter mime-type cost program
+
+ +

Examples

+ +
+Filter application/vnd.cups-raster 50 rastertofoo
+Filter application/vnd.hp-HPGL 25 /usr/foo/filter/hpgltofoo
+
+ +

Description

+ +

The Filter directive adds a filter for the current +driver. The mime-type argument is a valid MIME media type name +as defined in a CUPS mime.types file.

+ +

The cost argument specifies the relative cost of the filter. +In general, use a number representing the average percentage of +CPU time that is used when printing the specified MIME media +type.

+ +

The program argument specifies the program to run; if the +program is not an absolute filename, then CUPS will look for the +program in the CUPS filter directory.

+ +

See Also

+ +

DriverType

+ + +

DeprecatedFinishing

+ +

Syntax

+ +
+Finishing name
+Finishing "name/text"
+
+ +

Examples

+ +
+Finishing None
+Finishing "Glossy/Photo Overcoat"
+
+ +

Description

+ +

The Finishing directive adds a choice to the +cupsFinishing option. The name is any combination of +letters, numbers, and the underscore and can be up to 40 +characters in length. The name is stored in the +OutputType attribute in the PostScript page device +dictionary.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Group, +InputSlot, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

Font

+ +

Syntax

+ +
+Font name encoding "version" charset status
+Font *
+
+ +

Examples

+ +
+Font *
+Font Courier Standard "(1.05)" Standard ROM
+Font Symbol Special "(001.005)" Special ROM
+Font Barcode-Foo Special "(1.0)" Special Disk
+Font Unicode-Foo Expert "(2.0)" Adobe-Identity ROM
+
+ +

Description

+ +

The Font directive defines a "device font" for the +current printer driver. The name is the PostScript font +name.

+ +

The encoding is the default encoding of the font, usually +Standard, Expert, or Special, as +defined in the Adobe PPD file specification.

+ +

The version is the PostScript string definition that +corresponds to the font version number.

+ +

The charset defines the available characters in the font, +usually Standard or Special, as defined in the +Adobe PPD file specification.

+ +

The status is the installation status of the font and must be +either the word ROM or Disk.

+ +

Device fonts differ from fonts defined using the #font directive in that they are +automatically associated with the current driver. Fonts defined +using #font may be imported into the current driver +using the Font * form of this directive.

+ +

See Also

+ +

#font

+ + +

Group

+ +

Syntax

+ +
+Group name
+Group "name/text"
+
+ +

Examples

+ +
+Group General
+Group "InstallableOptions/Options Installed"
+Group "Special/Vendor Options"
+
+ +

Description

+ +

The Group directive specifies the group for new +Option directives. The name is any combination of +letters, numbers, and the underscore and can be up to 40 +characters in length. The names General and +InstallableOptions are predefined for the standard +Adobe UI keywords and for installable options, respectively.

+ +

If provided, the text can be any string up to 40 characters +in length. If no text is provided, the name is used.

+ +
+ + + +
Note: + +

Because of certain API binary compatibility issues, + CUPS limits the length of PPD group translation strings + (text) to 40 characters, while the PPD specification + allows for up to 80 characters.

+ +
+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +InputSlot, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

HWMargins

+ +

Syntax

+ +
+HWMargins left bottom right top
+
+ +

Examples

+ +
+HWMargins 18 36 18 36
+HWMargins 0.25in 0.5in 0.25in 0.5in
+HWMargins 0.6cm 1.2cm 0.6cm 1.2cm
+
+ +

Description

+ +

The HWMargins directive specifies the current +margins for MediaSize that +follow. The left, bottom, right, and top margin values specify +the printable margins.

+ +

See Also

+ +

MediaSize

+ + +

InputSlot

+ +

Syntax

+ +
+InputSlot position name
+InputSlot position "name/text"
+
+ +

Examples

+ +
+InputSlot 0 Auto
+InputSlot 1 "Upper/Tray 1"
+
+ +

Description

+ +

The InputSlot directive adds a new choice to the +InputSlot option. The position argument is a number +from 0 to 232-1 specifying the value that is placed +in the MediaPosition attribute in the PostScript page +device dictionary.

+ +

The name is any combination of letters, numbers, and the +underscore and can be up to 40 characters in length.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +Installable, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

Installable

+ +

Syntax

+ +
+Installable name
+Installable "name/text"
+
+ +

Examples

+ +
+Installable EnvTray
+Installable "Option1/Duplexer Installed"
+
+ +

Description

+ +

The Installable directive adds a new boolean option +to the InstallableOptions group with a default value of +False. The name is any combination of letters, numbers, +and the underscore and can be up to 40 characters in length.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ + +

LocAttribute

+ +

Syntax

+ +
+LocAttribute name "keyword/text" value
+
+ +

Examples

+ +
+LocAttribute fooProfile "Photo/Photographic Profile" "photopro.icc"
+
+ +

Description

+ +

The LocAttribute directive creates a localized PPD +attribute. The name is any combination of letters, numbers, and the +underscore and can be up to 40 characters in length.

+ +

The selector can be the empty string (""), a keyword +consisting of up to 40 letters, numbers, and the underscore, or +a string composed of a keyword and user text of up to 80 +characters.

+ +

The value is any string or number; the string may contain +multiple lines, however no one line may exceed 255 +characters.

+ +

See Also

+ +

Attribute

+ + +

ManualCopies

+ +

Syntax

+ +
+ManualCopies boolean-value
+
+ +

Examples

+ +
+ManualCopies no
+ManualCopies yes
+
+ +

Description

+ +

The ManualCopies directive specifies whether copies +need to be produced by the RIP filters. The default is +no.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +MediaType, +Option, +Resolution, +UIConstraints

+ + +

Manufacturer

+ +

Syntax

+ +
+Manufacturer "name"
+
+ +

Examples

+ +
+Manufacturer "Foo"
+Manufacturer "HP"
+
+ +

Description

+ +

The Manufacturer directive specifies the +manufacturer name for the current driver. The name argument must +conform to the manufacturer name requirements in the Adobe PPD +file specification.

+ +

See Also

+ +

FileName, +ModelName, +PCFileName, +Version

+ + +

MaxSize

+ +

Syntax

+ +
+MaxSize width length
+
+ +

Examples

+ +
+MaxSize 36in 100ft
+MaxSize 300cm 30m
+
+ +

Description

+ +

The MaxSize directive specifies the maximum width +and length that is supported for custom page sizes.

+ +

See Also

+ +

MinSize, +VariablePaperSize

+ + +

MediaSize

+ +

Syntax

+ +
+MediaSize name
+
+ +

Examples

+ +
+MediaSize Letter
+MediaSize A4
+
+ +

Description

+ +

The MediaSize directive adds the named size to the +current printer driver using the current margins defined with +the HWMargins directive. The +name argument must match a media size defined using the #media directive.

+ +

See Also

+ +

#media, +HWMargins

+ + +

MediaType

+ +

Syntax

+ +
+MediaType type name
+MediaType type "name/text"
+
+ +

Examples

+ +
+MediaType 0 Auto
+MediaType 1 "Plain/Plain Paper"
+
+ +

Description

+ +

The MediaType directive adds a new choice to the +MediaType option. The type argument is a number +from 0 to 232-1 specifying the value that is placed +in the cupsMediaType attribute in the PostScript page +device dictionary.

+ +

The name is any combination of letters, numbers, and the +underscore and can be up to 40 characters in length. The name is +placed in the MediaType attribute in the PostScript +page device dictionary.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +Option, +Resolution, +UIConstraints

+ + +

MinSize

+ +

Syntax

+ +
+MinSize width length
+
+ +

Examples

+ +
+MinSize 4in 8in
+MinSize 10cm 20cm
+
+ +

Description

+ +

The MinSize directive specifies the minimum width +and length that is supported for custom page sizes.

+ +

See Also

+ +

MaxSize, +VariablePaperSize

+ + +

ModelName

+ +

Syntax

+ +
+ModelName "name"
+
+ +

Examples

+ +
+ModelName "Foo Laser Printer 2000"
+ModelName "Colorific 123"
+
+ +

Description

+ +

The ModelName directive sets the printer name for +the ModelName, NickName, and +ShortNickName attributes for the printer driver. The +name is any string of letters, numbers, spaces, and the +characters ".", "/", "-", and "+" and should not begin with the +manufacturer name since the PPD compiler will add this +automatically for you. The maximum length of the name string is +31 characters to conform to the Adobe limits on the length of +ShortNickName.

+ +

See Also

+ +

FileName, +Manufacturer, +PCFileName, +Version

+ + +

ModelNumber

+ +

Syntax

+ +
+ModelNumber expression
+
+ +

Examples

+ +
+ModelNumber 123
+ModelNumber ($PCL_PAPER_SIZE $PCL_PJL)
+
+ +

Description

+ +

The ModelNumber directive sets the +cupsModelNumber attribute for the printer driver, which +is often used by the printer driver filter to tailor its output +for the current device. The number is any integer or bitwise OR +of integers and constants that is appropriate for the printer +driver filters.

+ +

A complete list of printer driver model number constants is +available later in this appendix in the section titled, "Printer Driver ModelNumber +Constants".

+ +

See Also

+ +

DriverType, +Filter

+ + +

Option

+ +

Syntax

+ +
+Option name type section order
+Option "name/text" type section order
+
+ +

Examples

+ +
+Option Punch Boolean AnySetup 10
+Option "fooFinish/Finishing Option" PickOne DocumentSetup 10 
+
+ +

Description

+ +

The Option directive creates a new option in the +current group, by default the General group. The name +is any combination of letters, numbers, and the underscore and +can be up to 40 characters in length.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

The type argument is one of the following keywords:

+ + + +

The section argument is one of the following keywords:

+ + + +

The order argument is a real number greater than or equal to +0.0 and is used to sort the printer commands from many options +before sending them to the printer or RIP filter.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Resolution, +UIConstraints

+ + +

PCFileName

+ +

Syntax

+ +
+PCFileName "filename.ppd"
+
+ +

Examples

+ +
+PCFileName "foljt2k1.ppd"
+PCFileName "deskjet.ppd"
+
+ +

Description

+ +

The PCFileName attribute specifies the name of the +PPD file for the current driver. The filename argument must +conform to the Adobe PPD file specification and can be no more +than 8 filename characters plus the extension ".ppd".

+ +

See Also

+ +

FileName, +Manufacturer, +ModelName, +Version

+ + +

DeprecatedResolution

+ +

Syntax

+ +
+Resolution colorspace bits-per-color row-count row-feed row-step name
+Resolution colorspace bits-per-color row-count row-feed row-step "name/text"
+
+ +

Examples

+ +
+Resolution - 8 0 0 0 300dpi
+Resolution k 8 0 0 0 "600x300dpi/600 DPI Grayscale"
+
+ +

Description

+ +

The Resolution directive creates a new +Resolution option choice which sets the +HWResolution, cupsBitsPerColor, +cupsRowCount, cupsRowFeed, +cupsRowStep, and optionally the cupsColorSpace +page device dictionary attributes. The colorspace argument +specifies a colorspace to use for the specified resolution and +can be the hyphen (-) character to make no change to +the selected color model or any keyword listed in the section +titled, "Colorspace Keywords", to +force the named colorspace.

+ +

The bits-per-color argument specifies the number of bits per +color to generate when RIP'ing a job. The values 1, 2, 4, and 8 +are currently supported by CUPS.

+ +

The row-count, row-feed, and row-step argument specify the +driver-dependent values for the cupsRowCount, +cupsRowFeed, and cupsRowStep attributes, +respectively. Most drivers leave these attributes set to 0, but +any number from 0 to 232-1 is allowed.

+ +

The name argument must conform to the resolution naming +conventions in the Adobe PPD file specification, either +HHHdpi for symmetric resolutions or HHHxVVVdpi +for asymmetric resolutions. The HHH and VVV in +the examples represent the horizontal and vertical resolutions +which must be positive integer values.

+ +

If provided, the text can be any string up to 80 characters +in length. If no text is provided, the name is used.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Option, +UIConstraints

+ + +

DeprecatedSimpleColorProfile

+ +

Syntax

+ +
+SimpleColorProfile resolution/mediatype density
+    yellow-density red-density gamma
+    red-adjust green-adjust blue-adjust
+
+ +

Examples

+ +
+SimpleColorProfile -/- 100 100 200 1.0 0 0 0
+
+SimpleColorProfile 360dpi/- 100 95 150 1.2 5 10 15
+
+SimpleColorProfile 720dpi/Glossy 100 90 120 1.5 -5 5 10
+
+ +

Description

+ +

The SimpleColorProfile directive creates a +matrix-based ColorProfile +using values chosen with the cupsprofile(1) utility. +The resolution and mediatype arguments specify the +Resolution and MediaType choices which use the +profile; the hyphen (-) is used to specify that any +resolution or mediatype can be used with the profile.

+ +

The density argument specifies the linear density correction +to apply to the color values (P = d * 0.01 * pg) and +is an integer greater than 0 and less than or equal to 100. A +value 100 of disables density correction while lower values +produce proportionately lighter output. The density value +adjusts all color channels equally in all color modes.

+ +

The yellow-density argument specifies the density of the +yellow channel when printing in grayscale or RGB mode and is an +integer greater than 0 and less then or equal to 100. A value of +100 disables yellow density correction while lower values +produce proportionately lighter output.

+ +

The red-density argument specifies the two-color density +limit (e.g. C + M, C + Y, M + Y) when printing in grayscale or +RGB mode and is an integer greater than 0 and less then or equal +to 200. A value of 200 disables two-color density correction +while lower values produce proportionately lighter output.

+ +

The gamma argument specifies the gamma correction to apply to +the color values (P = pg) and is a real number +greater than 0. Values larger than 1 cause a general lightening +of the print while values smaller than 1 cause a general +darkening of the print. A value of 1 disables gamma +correction.

+ +

The red-adjust, green-adjust, blue-adjust arguments specify +the percentage of color to add or remove. Positive red-adjust +values add magenta and negative values add yellow. Positive +green-adjust values add cyan and negative values add yellow. +Positive blue-adjust values add cyan and negative values add +magenta. Values of 0 disable color adjustments.

+ +

See Also

+ +

ColorProfile

+ + +

Throughput

+ +

Syntax

+ +
+Throughput pages-per-minute
+
+ +

Examples

+ +
+Throughput 1
+Throughput 10
+
+ +

Description

+ +

The Througput directive sets the Troughput +attribute for the current printer driver. The pages-per-minute +argument is a positive integer representing the peak number of +pages per minute that the printer is capable of producing. Use a +value of 1 for printers that produce less than 1 page per +minute.

+ + +

UIConstraints

+ +

Syntax

+ +
+UIConstraints "*Option1 *Option2"
+UIConstraints "*Option1 Choice1 *Option2"
+UIConstraints "*Option1 *Option2 Choice2"
+UIConstraints "*Option1 Choice1 *Option2 Choice2"
+
+ +

Examples

+ +
+UIConstraints "*Finishing *MediaType"
+UIConstraints "*Option1 False *Duplex"
+UIConstraints "*Duplex *MediaType Transparency"
+UIConstraints "*Resolution 600dpi *ColorModel RGB"
+
+ +

Description

+ +

The UIConstraints directive adds a constraint +between two options. Constraints inform the application when a +user has chosen incompatible options. Each option name is +preceded by the asterisk (*). If no choice is given for +an option, then all choices except False and +None will conflict with the other option and choice(s). +Since the PPD compiler automatically adds reciprocal constraints +(option A conflicts with option B, so therefore option B +conflicts with option A), you need only specify the constraint +once.

+ +

See Also

+ +

Choice, +ColorModel, +Cutter, +Darkness, +Duplex, +Finishing, +Group, +InputSlot, +Installable, +MediaType, +Option, +Resolution

+ + +

VariablePaperSize

+ +

Syntax

+ +
+VariablePaperSize boolean-value
+
+ +

Examples

+ +
+VariablePaperSize yes
+VariablePaperSize no
+
+ +

Description

+ +

The VariablePaperSize directive specifies whether +the current printer supports variable (custom) page sizes. When +yes is specified, the PPD compiler will include the +standard PPD attributes required to support custom page +sizes.

+ +

See Also

+ +

MaxSize, +MinSize

+ + +

Version

+ +

Syntax

+ +
+Version number
+
+ +

Examples

+ +
+Version 1.0
+Version 3.7
+
+ +

Description

+ +

The Version directive sets the FileVersion +attribute in the PPD file and is also used for the +NickName attribute. The number argument is a positive +real number.

+ +

See Also

+ +

Manufacturer, +ModelName, +PCFileName

+ + +

Standard Include Files

+ +

Table B-1 shows the standard include +files which are provided with the DDK.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table B-1, +Standard Include Files
Include FileDescription
<font.defs>Defines all of the + standard fonts which are included with ESP Ghostscript + and the Apple PDF RIP.
<epson.h>Defines all of the + CUPS ESC/P sample driver constants.
<escp.h>Defines all of the + DDK ESC/P driver constants.
<hp.h>Defines all of the + CUPS HP-PCL sample driver constants.
<label.h>Defines all of the + CUPS label sample driver constants.
<media.defs>Defines all of the + standard media sizes listed in Appendix B of the Adobe + PostScript Printer Description File Format + Specification.
<pcl.h>Defines all of the + DDK HP-PCL driver constants.
<raster.defs>Defines all of the CUPS + raster format constants.
+ +

Printer Driver ModelNumber Constants

+ +

The CUPS DDK and sample drivers use the +cupsModelNumber attribute in the PPD file to tailor +their output to the printer. The following sections describe the +constants for each driver.

+ +

The CUPS ESC/P Sample Driver (epson)

+ +

The epson driver supports Epson and Okidata +dot-matrix, Epson Stylus Color, and Epson Stylus Photo printers. +Table B-2 lists the constants for the ModelNumber directive. +ModelNumber values should be inserted by referencing +only one of these constants.

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table B-2, epson driver +constants
ConstantDescription
EPSON_9PINEpson and Okidata 9-pin + dot-matrix printers
EPSON_24PINEpson and Okidata 24-pin + dot-matrix printers
EPSON_COLOROlder Epson Stylus Color + printers that use the ESC . graphics command
EPSON_PHOTOOlder Epson Stylus Photo + printers that use the ESC . graphics command
EPSON_ICOLORNewer Epson Stylus Color + printers that use the ESC i graphics command
EPSON_IPHOTONewer Epson Stylus Photo + printers that use the ESC i graphics command
+ +

The CUPS HP-PCL Sample Driver (hp)

+ +

The hp driver supports HP LaserJet and DeskJet +printers. Table B-3 lists the constants +for the ModelNumber +directive. ModelNumber values should be inserted by +referencing only one of these constants.

+ +
+ + + + + + + + + + + + + + + + + +
Table B-3, hp driver +constants
ConstantDescription
HP_LASERJETHP LaserJet printers supporting + PCL 3, 4, or 5
HP_DESKJETHP DeskJet printers + supporting PCL 3 and using the simple color graphics + command (ESC * r # U)
HP_DESKJET2HP DeskJet printers + supporting PCL3GUI and using the configure raster graphics + command (ESC * g # W)
+ +

The CUPS Label Sample Driver (label)

+ +

The label driver supports the Dymo Labelwriter, Zebra CPCL, Zebra EPL, and Zebra ZPL, and Intellitech PCL label printers. Table B-4 +lists the constants for the ModelNumber directive. +ModelNumber values should be inserted by referencing +only one of these constants.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table B-4, label driver +constants
ConstantDescription
DYMO_3x0Format output for the + Dymo Labelwriter 300, 330, or 330 Turbo.
INTELLITECH_PCLFormat output for the Intellitech PCL printers.
ZEBRA_CPCLFormat output for the Zebra CPCL printers.
ZEBRA_EPL_LINEFormat output for the Zebra EPL line mode (EPL 1) printers.
ZEBRA_EPL_PAGEFormat output for the Zebra EPL page mode (EPL 2) printers.
ZEBRA_ZPLFormat output for the Zebra ZPL printers.
+ +

The DDK ESC/P Driver (escp)

+ +

The escp driver supports all Epson inkjet printers. +Table B-6 lists the constants for the ModelNumber directive. +ModelNumber values should be specified as the bitwise +OR of one or more of these constants.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table B-6, escp driver +constants
ConstantDescription
ESCP_MICROWEAVEUse microweave command?
ESCP_STAGGERAre color jets staggered?
ESCP_ESCKUse print mode command?
ESCP_EXT_UNITSUse extended unit commands?
ESCP_EXT_MARGINSUse extended margin command?
ESCP_USBSend USB packet mode escape
ESCP_PAGE_SIZEUse page size command
ESCP_RASTER_ESCIUse ESC i graphics command
ESCP_REMOTEUse remote mode commands
ESCP_REMOTE_ACUse auto-cutter command
ESCP_REMOTE_COUse cutter-operation command
ESCP_REMOTE_EXUse media-position command
ESCP_REMOTE_MSUse media-size command
ESCP_REMOTE_MTUse media-type command
ESCP_REMOTE_PCUse paper-check command
ESCP_REMOTE_PHUse paper-thickness command
ESCP_REMOTE_PPUse paper-path command
ESCP_REMOTE_SN0Use feed-sequence-0 command
ESCP_REMOTE_SN1Use platten-gap command
ESCP_REMOTE_SN2Use feed-sequence-2 command
ESCP_REMOTE_SN6Use eject-delay command
ESCP_REMOTE_FPUse print-position command
+ +

The DDK HP-PCL Driver (pcl)

+ +

The pcl driver supports all HP LaserJet, DeskJet, +and DesignJet printers. Table B-5 lists +the constants for the ModelNumber directive. +ModelNumber values should be specified as the bitwise +OR of one or more of these constants.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table B-5, pcl driver +constants
ConstantDescription
PCL_PAPER_SIZEUse paper size command (ESC & l # A)
PCL_INKJETUse inkjet commands
PCL_RASTER_END_COLORUse new end-raster command (ESC * r C)
PCL_RASTER_CIDUse configure-image-data command (ESC * v # W)
PCL_RASTER_CRDUse configure-raster-data command (ESC * g # W)
PCL_RASTER_SIMPLEUse simple-raster-color command (ESC * r # U)
PCL_RASTER_RGB24Use 24-bit RGB mode
PCL_PJLUse PJL commands
PCL_PJL_PAPERWIDTHUse PJL PAPERWIDTH/LENGTH commands
PCL_PJL_HPGL2Use PJL ENTER HPGL2 command
PCL_PJL_PCL3GUIUse PJL ENTER PCL3GUI command
PCL_PJL_RESOLUTIONUse PJL SET RESOLUTION command
+ +

Color Keywords

+ +

The PPD compiler defines two types of color keywords: +colorspace and color order. The following sections list the +supported keywords for each type.

+ +

Colorspace Keywords

+ +

The following colorspace keywords are recognized:

+ + + +

Color Order Keywords

+ +

The following color order keywords are recognized:

+ + + + + diff --git a/driver/Makefile b/driver/Makefile index accaacc13..81d58ff25 100644 --- a/driver/Makefile +++ b/driver/Makefile @@ -87,7 +87,7 @@ clean: $(RM) $(OBJS) core $(RM) *.bck core.* $(RM) $(TARGETS) - $(RM) -r images + $(RM) -r test $(RM) libcupsdriver.so libcupsdriver.sl libcupsdriver.dylib $(RM) -r 32bit 64bit @@ -276,17 +276,25 @@ rastertopclx: rastertopclx.o pcl-common.o $(LIBCUPSDRIVER) \ $(LINKCUPSIMAGE) $(LIBS) +# +# test, make a common test subdirectory for the other test programs. +# + +test: + if test ! -d test; then \ + rm -rf test; \ + mkdir test; \ + fi + + # # testcmyk, test cmyk separation functions. # -testcmyk: testcmyk.o libcupsdriver.a ../cups/libcups.a +testcmyk: test testcmyk.o libcupsdriver.a ../cups/libcups.a echo Linking $@... $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcmyk.o libcupsdriver.a \ ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) - if test ! -d test; then \ - mkdir test; \ - fi echo Running CMYK API tests... ./testcmyk > test/testcmyk.log @@ -295,13 +303,10 @@ testcmyk: testcmyk.o libcupsdriver.a ../cups/libcups.a # testdither, test dithering functions. # -testdither: testdither.o libcupsdriver.a ../cups/libcups.a +testdither: test testdither.o libcupsdriver.a ../cups/libcups.a echo Linking $@... $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testdither.o libcupsdriver.a \ ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) - if test ! -d test; then \ - mkdir test; \ - fi echo Running dither API tests... ./testdither > test/0-255.pgm 2>test/0-255.log ./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log @@ -317,13 +322,10 @@ testdither: testdither.o libcupsdriver.a ../cups/libcups.a # testrgb, test RGB separation functions. # -testrgb: testrgb.o libcupsdriver.a ../cups/libcups.a +testrgb: test testrgb.o libcupsdriver.a ../cups/libcups.a echo Linking $@... $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testrgb.o libcupsdriver.a \ ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) - if test ! -d test; then \ - mkdir test; \ - fi echo Running RGB API tests... ./testrgb > test/testrgb.log 2>&1 || echo "RGB tests failed!" diff --git a/man/Makefile b/man/Makefile index c65314403..72477b7cd 100644 --- a/man/Makefile +++ b/man/Makefile @@ -49,6 +49,7 @@ MAN5 = classes.conf.$(MAN5EXT) \ MAN7 = backend.$(MAN7EXT) \ commandtoescpx.$(MAN7EXT) \ commandtopclx.$(MAN7EXT) \ + drv.$(MAN7EXT) \ filter.$(MAN7EXT) \ rastertoescpx.$(MAN7EXT) \ rastertopclx.$(MAN7EXT) diff --git a/man/cupsctl.man b/man/cupsctl.man index f9a3d8c28..f88fee99c 100644 --- a/man/cupsctl.man +++ b/man/cupsctl.man @@ -1,5 +1,5 @@ .\" -.\" "$Id: cupsctl.man 5969 2006-09-19 20:09:24Z mike $" +.\" "$Id$" .\" .\" cupsctl man page for the Common UNIX Printing System (CUPS). .\" @@ -101,5 +101,5 @@ http://localhost:631/help .SH COPYRIGHT Copyright 2007 by Apple Inc. .\" -.\" End of "$Id: cupsctl.man 5969 2006-09-19 20:09:24Z mike $". +.\" End of "$Id$". .\" diff --git a/man/cupstestdsc.man b/man/cupstestdsc.man index ed723b9ec..fb9d245fd 100644 --- a/man/cupstestdsc.man +++ b/man/cupstestdsc.man @@ -1,5 +1,5 @@ .\" -.\" "$Id: cupstestdsc.man 5099 2006-02-13 02:46:10Z mike $" +.\" "$Id$" .\" .\" cupstestdsc man page for the Common UNIX Printing System (CUPS). .\" diff --git a/man/drv.man.in b/man/drv.man.in new file mode 100644 index 000000000..6e553adbd --- /dev/null +++ b/man/drv.man.in @@ -0,0 +1,40 @@ +.\" +.\" "$Id$" +.\" +.\" drv man page for the Common UNIX Printing System. +.\" +.\" Copyright 2008 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/". +.\" +.TH ppdc 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." +.SH NAME +drv \- cups driver interface for ppd compiler files +.SH SYNOPSIS +.B drv list +.br +.B drv cat +.I drv:///filename.drv/pcfilename +.SH DESCRIPTION +\fIdrv\fR lists and compiles PPDC source files installed in the +@CUPS_DATADIR@/drv and (on Mac OS X) /Library/Printers/PPDs.drv +directories on behalf of the scheduler, \fIcupsd(8)\fR. +.PP +The first form of the command lists all of the PPD files that can be produced +by the driver information files in the two directories. +.PP +The second form of the command compiles the requested PPD and sends it to the +standard output. +.SH SEE ALSO +ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5) +.br +http://localhost:631/help +.SH COPYRIGHT +Copyright 2008 by Apple Inc. +.\" +.\" End of "$Id$". +.\" diff --git a/man/ppdc.man b/man/ppdc.man index ecf6181d7..f352cfd6a 100644 --- a/man/ppdc.man +++ b/man/ppdc.man @@ -1,9 +1,9 @@ .\" -.\" "$Id: ppdc.man 343 2007-07-13 19:52:48Z mike $" +.\" "$Id$" .\" -.\" ppdc man page for the CUPS Driver Development Kit. +.\" ppdc man page for the Common UNIX Printing System. .\" -.\" 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 @@ -12,7 +12,7 @@ .\" 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/". .\" -.TH ppdc 1 "CUPS Driver Development Kit" "14 February 2007" "Apple Inc." +.TH ppdc 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME ppdc \- cups ppd compiler .SH SYNOPSIS @@ -27,7 +27,7 @@ ppdc \- cups ppd compiler .I output-directory ] [ -l .I language(s) -] [ -v ] [ -z ] [ --cr ] [ --crlf ] [ --lf ] +] [-m] [-t] [ -v ] [ -z ] [ --cr ] [ --crlf ] [ --lf ] .I source-file .SH DESCRIPTION \fIppdc\fR compiles PPDC source files into one or more PPD @@ -54,6 +54,12 @@ localizing the PPD file(s). The default language is "en" files with German, UK English, Spanish (Spain, Mexico, and US), French (France and Canada), and Italian languages in each file. .PP +The \fI-m\fR option specifies that the output filename should be +based on the ModelName value instead of FileName or PCFilenName. +.PP +The \fI-t\fR option specifies that PPD files should be tested instead +of generated. +.PP The \fI-v\fR option provides more verbose output, basically a running status of which files are being loaded or written. .PP @@ -64,10 +70,11 @@ The \fI--cr\fR, \fI--crlf\fR, and \fI--lf\fR options specify the line ending to use - carriage return, carriage return and line feed, or line feed. The default is to use the line feed character alone. .SH SEE ALSO -cupsprofile(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5), -CUPS Driver Developer Kit Manual +ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5) +.br +http://localhost:631/help .SH COPYRIGHT -Copyright 2007 by Apple Inc. +Copyright 2007-2008 by Apple Inc. .\" -.\" End of "$Id: ppdc.man 343 2007-07-13 19:52:48Z mike $". +.\" End of "$Id$". .\" diff --git a/man/ppdcfile.man b/man/ppdcfile.man index f2b052f3b..d032cb670 100644 --- a/man/ppdcfile.man +++ b/man/ppdcfile.man @@ -1,9 +1,9 @@ .\" -.\" "$Id: ppdcfile.man 343 2007-07-13 19:52:48Z mike $" +.\" "$Id$" .\" -.\" ppdcfile man page for the CUPS Driver Development Kit. +.\" ppdcfile man page for the Common UNIX Printing System. .\" -.\" 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 @@ -12,14 +12,14 @@ .\" 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/". .\" -.TH ppdcfile 5 "CUPS Driver Development Kit" "14 February 2007" "Apple Inc." +.TH ppdcfile 5 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME ppdcfile \- cups ppd compiler source file format .SH DESCRIPTION The CUPS PPD compiler reads meta files that contain descriptions of one or more PPD files to be generated by \fIppdc\fR. This man page provides a quick reference to the supported keywords and -should be used in conjuction with the CUPS Driver Development Kit +should be used in conjuction with the Common UNIX Printing System Developers Manual. .PP The source file format is plain ASCII text that can be edited @@ -37,8 +37,16 @@ directives and the values they accept: .TP 5 \fB#define\fR name value .TP 5 +\fB#elif\fR {name | value} +.TP 5 +\fB#else\fR +.TP 5 +\fB#endif\fR +.TP 5 \fB#font\fR name encoding "version" charset status .TP 5 +\fB#if\fR {name | value} +.TP 5 \fB#include\fR .TP 5 \fB#include\fR "filename" @@ -107,6 +115,8 @@ directives and the values they accept: .TP 5 \fBInstallable\fR "name/text" .TP 5 +\fBLocAttribute\fR name "keyword/text" value +.TP 5 \fBManualCopies\fR boolean-value .TP 5 \fBManufacturer\fR "name" @@ -151,12 +161,11 @@ directives and the values they accept: .TP 5 \fBVersion\fR number .SH SEE ALSO -cupsprofile(1), ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), -CUPS Driver Developer Kit Manual, +ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1) .br -http://localhost:631/help/ref-ppdc.html +http://localhost:631/help .SH COPYRIGHT -Copyright 2007 by Apple Inc. +Copyright 2007-2008 by Apple Inc. .\" -.\" End of "$Id: ppdcfile.man 343 2007-07-13 19:52:48Z mike $". +.\" End of "$Id$". .\" diff --git a/man/ppdhtml.man b/man/ppdhtml.man index 3bdcd1a45..2d20f07cb 100644 --- a/man/ppdhtml.man +++ b/man/ppdhtml.man @@ -1,9 +1,9 @@ .\" -.\" "$Id: ppdhtml.man 343 2007-07-13 19:52:48Z mike $" +.\" "$Id$" .\" -.\" ppdhtml man page for the CUPS Driver Development Kit. +.\" ppdhtml man page for the Common UNIX Printing System. .\" -.\" 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 @@ -12,7 +12,7 @@ .\" 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/". .\" -.TH ppdhtml 1 "CUPS Driver Development Kit" "14 February 2007" "Apple Inc." +.TH ppdhtml 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME ppdhtml \- cups html summary generator .SH SYNOPSIS @@ -30,9 +30,11 @@ The \fI-I\fR option specifies an alternate include directory; multiple \fI-I\fR options can be supplied to add additional directories. .SH SEE ALSO -cupsprofile(1), ppdc(1), ppdcfile(5), ppdi(1), ppdmerge(1), ppdpo(1), CUPS Driver Developer Kit Manual. +ppdc(1), ppdcfile(5), ppdi(1), ppdmerge(1), ppdpo(1) +.br +http://localhost:631/help .SH COPYRIGHT -Copyright 2007 by Apple Inc. +Copyright 2007-2008 by Apple Inc. .\" -.\" End of "$Id: ppdhtml.man 343 2007-07-13 19:52:48Z mike $". +.\" End of "$Id$". .\" diff --git a/man/ppdi.man b/man/ppdi.man index 39b4cc5c7..526b9437c 100644 --- a/man/ppdi.man +++ b/man/ppdi.man @@ -1,9 +1,9 @@ .\" -.\" "$Id: ppdi.man 343 2007-07-13 19:52:48Z mike $" +.\" "$Id$" .\" -.\" ppdi man page for the CUPS Driver Development Kit. +.\" ppdi man page for the Common UNIX Printing System. .\" -.\" 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 @@ -12,7 +12,7 @@ .\" 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/". .\" -.TH ppdi 1 "CUPS Driver Development Kit" "14 February 2007" "Apple Inc." +.TH ppdi 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME ppdi \- import ppd files .SH SYNOPSIS @@ -36,9 +36,11 @@ file does not exist, a new source file is created. Otherwise the existing file is merged with the new PPD file(s) on the command-line. If no source file is specified, the filename "ppdi.drv" is used. .SH SEE ALSO -cupsprofile(1), ppdc(1), ppdhtml(1), ppdmerge(1), ppdpo(1), ppdcfile(5), CUPS Driver Developer Kit Manual. +ppdc(1), ppdhtml(1), ppdmerge(1), ppdpo(1), ppdcfile(5) +.br +http://localhost:631/help .SH COPYRIGHT -Copyright 2007 by Apple Inc. +Copyright 2007-2008 by Apple Inc. .\" -.\" End of "$Id: ppdi.man 343 2007-07-13 19:52:48Z mike $". +.\" End of "$Id$". .\" diff --git a/man/ppdmerge.man b/man/ppdmerge.man index 12473b833..132c40ebc 100644 --- a/man/ppdmerge.man +++ b/man/ppdmerge.man @@ -1,9 +1,9 @@ .\" .\" "$Id$" .\" -.\" ppdmerge man page for the CUPS Driver Development Kit. +.\" ppdmerge man page for the Common UNIX Printing System. .\" -.\" 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 @@ -12,7 +12,7 @@ .\" 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/". .\" -.TH ppdmerge 1 "CUPS Driver Development Kit" "14 February 2007" "Apple Inc." +.TH ppdmerge 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME ppdmerge \- merge ppd files .SH SYNOPSIS @@ -37,11 +37,11 @@ already exists, the new same device. Merging of different device PPDs will yield unpredictable results. .SH SEE ALSO -cupsprofile(1), ppdc(1), ppdhtml(1), ppdi(1), ppdpo(1), ppdcfile(5), +cupsprofile(1), ppdc(1), ppdhtml(1), ppdi(1), ppdpo(1), ppdcfile(5) .br -CUPS Driver Developer Kit Manual. +http://localhost:631/help .SH COPYRIGHT -Copyright 2007 by Apple Inc. +Copyright 2007-2008 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/ppdpo.man b/man/ppdpo.man index dc84e846b..4f3f4867f 100644 --- a/man/ppdpo.man +++ b/man/ppdpo.man @@ -1,7 +1,7 @@ .\" -.\" "$Id: ppdpo.man 343 2007-07-13 19:52:48Z mike $" +.\" "$Id$" .\" -.\" ppdpo man page for the CUPS Driver Development Kit. +.\" ppdpo man page for the Common UNIX Printing System. .\" .\" Copyright 2007-2008 by Apple Inc. .\" Copyright 1997-2007 by Easy Software Products. @@ -12,7 +12,7 @@ .\" 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/". .\" -.TH ppdpo 1 "Common UNIX Printing System" "27 March 2008" "Apple Inc." +.TH ppdpo 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME ppdpo \- ppd message catalog generator .SH SYNOPSIS @@ -36,10 +36,11 @@ The \fI-o\fR option specifies the output file. The supported extensions are ".po" or ".po.gz" for GNU gettext format message catalogs and ".strings" for Mac OS X strings files. .SH SEE ALSO -ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdcfile(5), +ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdcfile(5) +.br http://localhost:631/help .SH COPYRIGHT Copyright 2007-2008 by Apple Inc. .\" -.\" End of "$Id: ppdpo.man 343 2007-07-13 19:52:48Z mike $". +.\" End of "$Id$". .\" diff --git a/man/rastertoescpx.man b/man/rastertoescpx.man index 683edeaaf..0cd04f703 100644 --- a/man/rastertoescpx.man +++ b/man/rastertoescpx.man @@ -1,9 +1,9 @@ .\" .\" "$Id$" .\" -.\" rastertoescpx man page for the CUPS Driver Development Kit. +.\" rastertoescpx man page for the Common UNIX Printing System. .\" -.\" 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 @@ -12,7 +12,7 @@ .\" 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/". .\" -.TH rastertoescpx 1 "CUPS Driver Development Kit" "14 February 2007" "Apple Inc." +.TH rastertoescpx 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME rastertoescpx \- enhanced esc/p raster driver for cups .SH SYNOPSIS @@ -25,9 +25,11 @@ jobid user title copies options [ ESC/P2. It is used to support printing to a variety of EPSON and EPSON-compatible printers and plotters. .SH SEE ALSO -cupsprofile(1), ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5), CUPS Driver Developer Kit Manual. +ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5) +.br +http://localhost:631/help .SH COPYRIGHT -Copyright 2007 by Apple Inc. +Copyright 2007-2008 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/rastertopclx.man b/man/rastertopclx.man index dec7add2e..2f53f0b6a 100644 --- a/man/rastertopclx.man +++ b/man/rastertopclx.man @@ -1,9 +1,9 @@ .\" .\" "$Id$" .\" -.\" rastertopclx man page for the CUPS Driver Development Kit. +.\" rastertopclx man page for the Common UNIX Printing System. .\" -.\" 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 @@ -12,7 +12,7 @@ .\" 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/". .\" -.TH rastertopclx 1 "CUPS Driver Development Kit" "14 February 2007" "Apple Inc." +.TH rastertopclx 1 "Common UNIX Printing System" "20 May 2008" "Apple Inc." .SH NAME rastertopclx \- enhanced pcl raster driver for cups .SH SYNOPSIS @@ -21,13 +21,15 @@ jobid user title copies options [ .I filename.ras ] .SH DESCRIPTION -\fIrastertopclx\fR converts a CUPS raster stream to HP-PCL. It is +\fIrastertopclx\fR converts a CUPS raster stream to HP-PCL and HP-RTL. It is used to support printing to a variety of HP and HP-compatible printers and plotters. .SH SEE ALSO -cupsprofile(1), ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5), CUPS Driver Developer Kit Manual. +ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5) +.br +http://localhost:631/help .SH COPYRIGHT -Copyright 2007 by Apple Inc. +Copyright 2007-2008 by Apple Inc. .\" .\" End of "$Id$". .\" diff --git a/man/subscriptions.conf.man b/man/subscriptions.conf.man index 93cae9dbb..a760a47b7 100644 --- a/man/subscriptions.conf.man +++ b/man/subscriptions.conf.man @@ -1,5 +1,5 @@ .\" -.\" "$Id: subscriptions.conf.man 5099 2006-02-13 02:46:10Z mike $" +.\" "$Id$" .\" .\" subscriptions.conf man page for the Common UNIX Printing System (CUPS). .\" @@ -85,5 +85,5 @@ http://localhost:631/help .SH COPYRIGHT Copyright 2007 by Apple Inc. .\" -.\" End of "$Id: subscriptions.conf.man 5099 2006-02-13 02:46:10Z mike $". +.\" End of "$Id$". .\" diff --git a/ppdc/Dependencies b/ppdc/Dependencies index c18234b41..b5f4d4bac 100644 --- a/ppdc/Dependencies +++ b/ppdc/Dependencies @@ -1,3 +1,68 @@ # DO NOT DELETE -# DO NOT DELETE -# DO NOT DELETE + +ppdc-array.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-array.o: ../cups/versioning.h +ppdc-attr.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-attr.o: ../cups/versioning.h +ppdc-catalog.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-catalog.o: ../cups/versioning.h ../cups/globals.h ../cups/string.h +ppdc-catalog.o: ../cups/http-private.h ../cups/http.h ../cups/md5.h +ppdc-catalog.o: ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h +ppdc-catalog.o: ../cups/ppd.h ../cups/array.h ../cups/file.h +ppdc-catalog.o: ../cups/language.h ../cups/i18n.h ../cups/transcode.h +ppdc-choice.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-choice.o: ../cups/versioning.h +ppdc-constraint.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-constraint.o: ../cups/versioning.h +ppdc-driver.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-driver.o: ../cups/versioning.h ../cups/cups.h ../cups/ipp.h +ppdc-driver.o: ../cups/http.h ../cups/string.h ../cups/ppd.h ../cups/array.h +ppdc-driver.o: ../cups/file.h ../cups/language.h +ppdc-file.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-file.o: ../cups/versioning.h +ppdc-filter.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-filter.o: ../cups/versioning.h +ppdc-font.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-font.o: ../cups/versioning.h +ppdc-group.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-group.o: ../cups/versioning.h +ppdc-import.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-import.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h +ppdc-import.o: ../cups/file.h +ppdc-mediasize.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-mediasize.o: ../cups/versioning.h +ppdc-message.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-message.o: ../cups/versioning.h +ppdc-option.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-option.o: ../cups/versioning.h +ppdc-profile.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-profile.o: ../cups/versioning.h +ppdc-shared.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-shared.o: ../cups/versioning.h +ppdc-source.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-source.o: ../cups/versioning.h ../cups/globals.h ../cups/string.h +ppdc-source.o: ../cups/http-private.h ../cups/http.h ../cups/md5.h +ppdc-source.o: ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h +ppdc-source.o: ../cups/ppd.h ../cups/array.h ../cups/file.h +ppdc-source.o: ../cups/language.h ../cups/i18n.h ../cups/transcode.h +ppdc-source.o: ../cups/raster.h ../cups/cups.h ../data/epson.h ../data/escp.h +ppdc-source.o: ../data/hp.h ../data/label.h ../data/pcl.h +ppdc-string.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-string.o: ../cups/versioning.h +ppdc-variable.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc-variable.o: ../cups/versioning.h +drv.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +drv.o: ../cups/versioning.h ../cups/cups.h ../cups/ipp.h ../cups/http.h +drv.o: ../cups/string.h ../cups/ppd.h ../cups/array.h ../cups/file.h +drv.o: ../cups/language.h ../cups/dir.h +ppdc.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdc.o: ../cups/versioning.h +ppdhtml.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdhtml.o: ../cups/versioning.h +ppdi.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdi.o: ../cups/versioning.h +ppdmerge.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h +ppdmerge.o: ../cups/string.h ../cups/ppd.h ../cups/array.h ../cups/file.h +ppdmerge.o: ../cups/language.h ../cups/array.h ../cups/string.h ../config.h +ppdpo.o: ppdc.h ../cups/string.h ../config.h ../cups/file.h +ppdpo.o: ../cups/versioning.h diff --git a/ppdc/Makefile b/ppdc/Makefile index aed8208dd..bc3c05268 100644 --- a/ppdc/Makefile +++ b/ppdc/Makefile @@ -44,12 +44,8 @@ LIBOBJS = \ ppdc-source.o \ ppdc-string.o \ ppdc-variable.o -LIB32OBJS = $(LIBOBJS:.o=.32.o) -LIB64OBJS = $(LIBOBJS:.o=.64.o) OBJS = \ $(LIBOBJS) \ - $(LIB32OBJS) \ - $(LIB64OBJS) \ drv.o \ ppdc.o \ ppdhtml.o \ @@ -58,8 +54,6 @@ OBJS = \ ppdpo.o LIBTARGETS = \ $(LIBCUPSPPDC) \ - $(LIB32CUPSPPDC) \ - $(LIB64CUPSPPDC) \ libcupsppdc.a \ ppdc-static TARGETS = \ @@ -97,7 +91,6 @@ clean: $(RM) -r ppd $(RM) test.drv $(RM) libcupsppdc.so libcupsppdc.sl libcupsppdc.dylib - $(RM) -r 32bit 64bit # @@ -105,13 +98,7 @@ clean: # depend: - touch Dependencies.tmp - makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1 - $(RM) Dependencies - cp Dependencies.tmp Dependencies - sed -E -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies - sed -E -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies - $(RM) Dependencies.tmp + makedepend -Y -I.. -fDependencies $(OBJS:.o=.cxx) >/dev/null 2>&1 # @@ -191,18 +178,6 @@ installstatic: $(INSTALL_LIB) libcupsppdc.a $(LIBDIR) $(RANLIB) $(LIBDIR)/libcupsppdc.a -install32bit: - echo Installing libraries in $(LIB32DIR)... - $(INSTALL_DIR) -m 755 $(LIB32DIR) - $(INSTALL_LIB) 32bit/libcupsppdc.so.1 $(LIB32DIR)/libcupsppdc.so.1 - $(LN) libcupsppdc.so.1 $(LIB32DIR)/libcupsppdc.so - -install64bit: - echo Installing libraries in $(LIB64DIR)... - $(INSTALL_DIR) -m 755 $(LIB64DIR) - $(INSTALL_LIB) 64bit/libcupsppdc.so.1 $(LIB64DIR)/libcupsppdc.so.1 - $(LN) libcupsppdc.so.1 $(LIB64DIR)/libcupsppdc.so - # # Uninstall... @@ -233,16 +208,6 @@ uninstall: $(RM) $(INCLUDEDIR)/cups/ppdc.h -$(RMDIR) $(INCLUDEDIR)/cups -uninstall32bit: - $(RM) $(LIB32DIR)/libcupsppdc.so - $(RM) $(LIB32DIR)/libcupsppdc.so.1 - -$(RMDIR) $(LIB32DIR) - -uninstall64bit: - $(RM) $(LIB64DIR)/libcupsppdc.so - $(RM) $(LIB64DIR)/libcupsppdc.so.1 - -$(RMDIR) $(LIB64DIR) - # # Automatic API help files... @@ -338,41 +303,16 @@ libcupsppdc.so.1 libcupsppdc.sl.1: $(LIBOBJS) $(LN) $@ `basename $@ .1` -# -# 32bit/libcupsppdc.so.1 -# - -32bit/libcupsppdc.so.1: $(LIB32OBJS) - echo Linking 32-bit $@... - -mkdir 32bit - $(DSOXX) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBS) - $(RM) 32bit/libcupsppdc.so - $(LN) libcupsppdc.so.1 32bit/libcupsppdc.so - - -# -# 64bit/libcupsppdc.so.1 -# - -64bit/libcupsppdc.so.1: $(LIB64OBJS) - echo Linking 64-bit $@... - -mkdir 64bit - $(DSOXX) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBS) - $(RM) 64bit/libcupsppdc.so - $(LN) libcupsppdc.so.1 64bit/libcupsppdc.so - - # # libcupsppdc.1.dylib # -libcupsppdc.1.dylib: $(LIBOBJS) libcupsppdc.exp +libcupsppdc.1.dylib: $(LIBOBJS) echo Linking $@... $(DSOXX) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \ -install_name $(libdir)/$@ \ -current_version 1.0.0 \ -compatibility_version 1.0.0 \ - -exported_symbols_list libcupsppdc.exp \ $(LIBOBJS) $(LIBS) $(RM) libcupsppdc.dylib $(LN) $@ libcupsppdc.dylib diff --git a/ppdc/libcupsppdc.exp b/ppdc/libcupsppdc.exp index 999f7d8e4..e69de29bb 100644 --- a/ppdc/libcupsppdc.exp +++ b/ppdc/libcupsppdc.exp @@ -1,158 +0,0 @@ -__ZN10ppdcChoiceC1EPKcS1_S1_ -__ZN10ppdcChoiceC2EPKcS1_S1_ -__ZN10ppdcChoiceD0Ev -__ZN10ppdcChoiceD1Ev -__ZN10ppdcChoiceD2Ev -__ZN10ppdcDriver10find_groupEPKc -__ZN10ppdcDriver11find_optionEPKc -__ZN10ppdcDriver11set_versionEPKc -__ZN10ppdcDriver14set_model_nameEPKc -__ZN10ppdcDriver14write_ppd_fileEP12_cups_file_sP11ppdcCatalogP9ppdcArrayP10ppdcSource14ppdcLineEnding -__ZN10ppdcDriver16set_default_fontEP8ppdcFont -__ZN10ppdcDriver16set_default_sizeEP13ppdcMediaSize -__ZN10ppdcDriver16set_manufacturerEPKc -__ZN10ppdcDriver16set_pc_file_nameEPKc -__ZN10ppdcDriver20set_custom_size_codeEPKc -__ZN10ppdcDriver9find_attrEPKcS1_ -__ZN10ppdcDriverC1EPS_ -__ZN10ppdcDriverC2EPS_ -__ZN10ppdcDriverD0Ev -__ZN10ppdcDriverD1Ev -__ZN10ppdcDriverD2Ev -__ZN10ppdcFilterC1EPKcS1_i -__ZN10ppdcFilterC2EPKcS1_i -__ZN10ppdcFilterD0Ev -__ZN10ppdcFilterD1Ev -__ZN10ppdcFilterD2Ev -__ZN10ppdcOption11find_choiceEPKc -__ZN10ppdcOption13set_defchoiceEP10ppdcChoice -__ZN10ppdcOptionC1E11ppdcOptTypePKcS2_14ppdcOptSectionf -__ZN10ppdcOptionC1EPS_ -__ZN10ppdcOptionC2E11ppdcOptTypePKcS2_14ppdcOptSectionf -__ZN10ppdcOptionC2EPS_ -__ZN10ppdcOptionD0Ev -__ZN10ppdcOptionD1Ev -__ZN10ppdcOptionD2Ev -__ZN10ppdcShared3getEv -__ZN10ppdcShared7releaseEv -__ZN10ppdcSharedC1Ev -__ZN10ppdcSharedC2Ev -__ZN10ppdcSharedD0Ev -__ZN10ppdcSharedD1Ev -__ZN10ppdcSharedD2Ev -__ZN10ppdcSource10get_choiceEP8ppdcFile -__ZN10ppdcSource10get_duplexEP8ppdcFileP10ppdcDriver -__ZN10ppdcSource10get_filterEP8ppdcFile -__ZN10ppdcSource10get_optionEP8ppdcFileP10ppdcDriverP9ppdcGroup -__ZN10ppdcSource10import_ppdEPKc -__ZN10ppdcSource10write_fileEPKc -__ZN10ppdcSource11add_includeEPKc -__ZN10ppdcSource11find_driverEPKc -__ZN10ppdcSource11get_booleanEP8ppdcFile -__ZN10ppdcSource11get_genericEP8ppdcFilePKcS3_S3_ -__ZN10ppdcSource11get_integerEP8ppdcFile -__ZN10ppdcSource11get_integerEPKc -__ZN10ppdcSource12find_includeEPKcS1_Pci -__ZN10ppdcSource12get_variableEP8ppdcFile -__ZN10ppdcSource12set_variableEPKcS1_ -__ZN10ppdcSource13find_variableEPKc -__ZN10ppdcSource14get_constraintEP8ppdcFile -__ZN10ppdcSource14get_resolutionEP8ppdcFile -__ZN10ppdcSource15get_color_modelEP8ppdcFile -__ZN10ppdcSource15get_color_orderEPKc -__ZN10ppdcSource15get_color_spaceEPKc -__ZN10ppdcSource15get_custom_sizeEP8ppdcFile -__ZN10ppdcSource15get_installableEP8ppdcFile -__ZN10ppdcSource15get_measurementEP8ppdcFile -__ZN10ppdcSource17get_color_profileEP8ppdcFile -__ZN10ppdcSource18get_simple_profileEP8ppdcFile -__ZN10ppdcSource6get_poEP8ppdcFile -__ZN10ppdcSource6quotefEP12_cups_file_sPKcz -__ZN10ppdcSource7find_poEPKc -__ZN10ppdcSource8get_attrEP8ppdcFile -__ZN10ppdcSource8get_fontEP8ppdcFile -__ZN10ppdcSource8get_sizeEP8ppdcFile -__ZN10ppdcSource9find_sizeEPKc -__ZN10ppdcSource9get_floatEP8ppdcFile -__ZN10ppdcSource9get_groupEP8ppdcFileP10ppdcDriver -__ZN10ppdcSource9get_tokenEP8ppdcFilePci -__ZN10ppdcSource9read_fileEPKc -__ZN10ppdcSource9scan_fileEP8ppdcFileP10ppdcDriverb -__ZN10ppdcSourceC1EPKc -__ZN10ppdcSourceC2EPKc -__ZN10ppdcSourceD0Ev -__ZN10ppdcSourceD1Ev -__ZN10ppdcSourceD2Ev -__ZN10ppdcStringC1EPKc -__ZN10ppdcStringC2EPKc -__ZN10ppdcStringD0Ev -__ZN10ppdcStringD1Ev -__ZN10ppdcStringD2Ev -__ZN11ppdcCatalog11add_messageEPKc -__ZN11ppdcCatalog12find_messageEPKc -__ZN11ppdcCatalog13load_messagesEPKc -__ZN11ppdcCatalog13save_messagesEPKc -__ZN11ppdcCatalogC1EPKcS1_ -__ZN11ppdcCatalogC2EPKcS1_ -__ZN11ppdcCatalogD0Ev -__ZN11ppdcCatalogD1Ev -__ZN11ppdcCatalogD2Ev -__ZN11ppdcMessageC1EPKcS1_ -__ZN11ppdcMessageC2EPKcS1_ -__ZN11ppdcMessageD0Ev -__ZN11ppdcMessageD1Ev -__ZN11ppdcMessageD2Ev -__ZN11ppdcProfileC1EPKcS1_ffPKf -__ZN11ppdcProfileC2EPKcS1_ffPKf -__ZN11ppdcProfileD0Ev -__ZN11ppdcProfileD1Ev -__ZN11ppdcProfileD2Ev -__ZN12ppdcVariable9set_valueEPKc -__ZN12ppdcVariableC1EPKcS1_ -__ZN12ppdcVariableC2EPKcS1_ -__ZN12ppdcVariableD0Ev -__ZN12ppdcVariableD1Ev -__ZN12ppdcVariableD2Ev -__ZN13ppdcMediaSizeC1EPKcS1_ffffffS1_S1_ -__ZN13ppdcMediaSizeC2EPKcS1_ffffffS1_S1_ -__ZN13ppdcMediaSizeD0Ev -__ZN13ppdcMediaSizeD1Ev -__ZN13ppdcMediaSizeD2Ev -__ZN14ppdcConstraintC1EPKcS1_S1_S1_ -__ZN14ppdcConstraintC2EPKcS1_S1_S1_ -__ZN14ppdcConstraintD0Ev -__ZN14ppdcConstraintD1Ev -__ZN14ppdcConstraintD2Ev -__ZN8ppdcAttrC1EPKcS1_S1_S1_ -__ZN8ppdcAttrC2EPKcS1_S1_S1_ -__ZN8ppdcAttrD0Ev -__ZN8ppdcAttrD1Ev -__ZN8ppdcAttrD2Ev -__ZN8ppdcFile3getEv -__ZN8ppdcFile4peekEv -__ZN8ppdcFileC1EPKc -__ZN8ppdcFileC2EPKc -__ZN8ppdcFileD1Ev -__ZN8ppdcFileD2Ev -__ZN8ppdcFontC1EPKcS1_S1_S1_14ppdcFontStatus -__ZN8ppdcFontC2EPKcS1_S1_S1_14ppdcFontStatus -__ZN8ppdcFontD0Ev -__ZN8ppdcFontD1Ev -__ZN8ppdcFontD2Ev -__ZN9ppdcArray3addEP10ppdcShared -__ZN9ppdcArray4nextEv -__ZN9ppdcArray5firstEv -__ZN9ppdcArray6removeEP10ppdcShared -__ZN9ppdcArrayC1EPS_ -__ZN9ppdcArrayC2EPS_ -__ZN9ppdcArrayD0Ev -__ZN9ppdcArrayD1Ev -__ZN9ppdcArrayD2Ev -__ZN9ppdcGroup11find_optionEPKc -__ZN9ppdcGroupC1EPKcS1_ -__ZN9ppdcGroupC1EPS_ -__ZN9ppdcGroupC2EPKcS1_ -__ZN9ppdcGroupC2EPS_ -__ZN9ppdcGroupD0Ev -__ZN9ppdcGroupD1Ev -__ZN9ppdcGroupD2Ev diff --git a/ppdc/ppdc-attr.cxx b/ppdc/ppdc-attr.cxx index 094e38706..e532531d6 100644 --- a/ppdc/ppdc-attr.cxx +++ b/ppdc/ppdc-attr.cxx @@ -32,13 +32,15 @@ ppdcAttr::ppdcAttr(const char *n, // I - Name const char *s, // I - Spec string const char *t, // I - Human-readable text - const char *v) // I - Value + const char *v, // I - Value + bool loc) // I - Localize this attribute? : ppdcShared() { - name = new ppdcString(n); - selector = new ppdcString(s); - text = new ppdcString(t); - value = new ppdcString(v); + name = new ppdcString(n); + selector = new ppdcString(s); + text = new ppdcString(t); + value = new ppdcString(v); + localizable = loc; } diff --git a/ppdc/ppdc-driver.cxx b/ppdc/ppdc-driver.cxx index d59b275a1..a369ed686 100644 --- a/ppdc/ppdc-driver.cxx +++ b/ppdc/ppdc-driver.cxx @@ -3,7 +3,7 @@ // // PPD file compiler definitions for the CUPS PPD Compiler. // -// Copyright 2007 by Apple Inc. +// Copyright 2007-2008 by Apple Inc. // Copyright 2002-2006 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -20,6 +20,7 @@ // ppdcDriver::find_group() - Find a group. // ppdcDriver::find_option() - Find an option. // ppdcDriver::set_default_size() - Set the default size name. +// ppdcDriver::set_file_name() - Set the full filename. // ppdcDriver::set_manufacturer() - Set the manufacturer name. // ppdcDriver::set_model_name() - Set the model name. // ppdcDriver::set_pc_file_name() - Set the PC filename. @@ -62,6 +63,7 @@ ppdcDriver::ppdcDriver(ppdcDriver *d) // I - Printer driver template copyright = new ppdcArray(d->copyright); manufacturer = d->manufacturer; model_name = 0; + file_name = 0; pc_file_name = 0; type = d->type; version = d->version; @@ -101,6 +103,7 @@ ppdcDriver::ppdcDriver(ppdcDriver *d) // I - Printer driver template copyright = new ppdcArray(); manufacturer = 0; model_name = 0; + file_name = 0; pc_file_name = 0; version = 0; type = PPDC_DRIVER_CUSTOM; @@ -143,6 +146,8 @@ ppdcDriver::~ppdcDriver() manufacturer->release(); if (model_name) model_name->release(); + if (file_name) + file_name->release(); if (pc_file_name) pc_file_name->release(); if (version) @@ -228,8 +233,8 @@ ppdcDriver::find_option(const char *n) // I - Option name // void -ppdcDriver::set_custom_size_code(const char *c) - // I - CustomPageSize code +ppdcDriver::set_custom_size_code( + const char *c) // I - CustomPageSize code { if (custom_size_code) custom_size_code->release(); @@ -243,8 +248,8 @@ ppdcDriver::set_custom_size_code(const char *c) // void -ppdcDriver::set_default_font(ppdcFont *f) - // I - Font +ppdcDriver::set_default_font( + ppdcFont *f) // I - Font { if (default_font) default_font->release(); @@ -264,8 +269,8 @@ ppdcDriver::set_default_font(ppdcFont *f) // void -ppdcDriver::set_default_size(ppdcMediaSize *m) - // I - Media size +ppdcDriver::set_default_size( + ppdcMediaSize *m) // I - Media size { if (default_size) default_size->release(); @@ -280,13 +285,27 @@ ppdcDriver::set_default_size(ppdcMediaSize *m) } +// +// 'ppdcDriver::set_file_name()' - Set the full filename. +// + +void +ppdcDriver::set_file_name(const char *f)// I - Filename +{ + if (file_name) + file_name->release(); + + file_name = new ppdcString(f); +} + + // // 'ppdcDriver::set_manufacturer()' - Set the manufacturer name. // void -ppdcDriver::set_manufacturer(const char *m) - // I - Model name +ppdcDriver::set_manufacturer( + const char *m) // I - Model name { if (manufacturer) manufacturer->release(); @@ -300,8 +319,8 @@ ppdcDriver::set_manufacturer(const char *m) // void -ppdcDriver::set_model_name(const char *m) - // I - Model name +ppdcDriver::set_model_name( + const char *m) // I - Model name { if (model_name) model_name->release(); @@ -315,8 +334,8 @@ ppdcDriver::set_model_name(const char *m) // void -ppdcDriver::set_pc_file_name(const char *f) - // I - Filename +ppdcDriver::set_pc_file_name( + const char *f) // I - Filename { if (pc_file_name) pc_file_name->release(); @@ -418,11 +437,7 @@ ppdcDriver::write_ppd_file( cupsFilePrintf(fp, "*Product: \"%s\"%s", a->value->value, lf); } else - { - cupsFilePrintf(fp, "*Product: \"(ESP Ghostscript)\"%s", lf); - cupsFilePrintf(fp, "*Product: \"(GPL Ghostscript)\"%s", lf); - cupsFilePrintf(fp, "*Product: \"(GNU Ghostscript)\"%s", lf); - } + cupsFilePrintf(fp, "*Product: \"(%s)\"%s", model_name->value, lf); cupsFilePrintf(fp, "*Manufacturer: \"%s\"%s", catalog->find_message(manufacturer->value), lf); @@ -476,12 +491,7 @@ ppdcDriver::write_ppd_file( cupsFilePrintf(fp, "*PSVersion: \"%s\"%s", a->value->value, lf); } else - { - cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 705\"%s", lf); - cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 707\"%s", lf); - cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 815\"%s", lf); - cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 853\"%s", lf); - } + cupsFilePrintf(fp, "*PSVersion: \"(3010.000) 0\"%s", lf); if ((a = find_attr("LanguageLevel", NULL)) != NULL) cupsFilePrintf(fp, "*LanguageLevel: \"%s\"%s", a->value->value, lf); @@ -1152,10 +1162,12 @@ ppdcDriver::write_ppd_file( strncmp(a->name->value, "ParamCustom", 11)) continue; - if (strcmp(a->name->value, "APCustomColorMatchingName") && + if (!a->localizable && + strcmp(a->name->value, "APCustomColorMatchingName") && strcmp(a->name->value, "APPrinterPreset") && strcmp(a->name->value, "cupsICCProfile") && strcmp(a->name->value, "cupsIPPReason") && + strcmp(a->name->value, "cupsMarkerName") && strncmp(a->name->value, "Custom", 6) && strncmp(a->name->value, "ParamCustom", 11)) continue; @@ -1164,7 +1176,8 @@ ppdcDriver::write_ppd_file( a->name->value, a->selector->value, locatalog->find_message(a->text && a->text->value ? a->text->value : a->name->value), - !strcmp(a->name->value, "cupsIPPReason") ? + ((a->localizable && a->value->value[0]) || + !strcmp(a->name->value, "cupsIPPReason")) ? locatalog->find_message(a->value->value) : "", lf); } diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx index e397f0abb..ac64a1a30 100644 --- a/ppdc/ppdc-source.cxx +++ b/ppdc/ppdc-source.cxx @@ -93,12 +93,15 @@ const char *ppdcSource::driver_types[] = ppdcSource::ppdcSource(const char *f) // I - File to read { - filename = new ppdcString(f); - base_fonts = new ppdcArray(); - drivers = new ppdcArray(); - po_files = new ppdcArray(); - sizes = new ppdcArray(); - vars = new ppdcArray(); + filename = new ppdcString(f); + base_fonts = new ppdcArray(); + drivers = new ppdcArray(); + po_files = new ppdcArray(); + sizes = new ppdcArray(); + vars = new ppdcArray(); + cond_state = PPDC_COND_NORMAL; + cond_current = cond_stack; + cond_stack[0] = PPDC_COND_NORMAL; if (f) read_file(f); @@ -295,7 +298,8 @@ ppdcSource::find_variable(const char *n)// I - Variable name // ppdcAttr * // O - Attribute -ppdcSource::get_attr(ppdcFile *fp) // I - File to read +ppdcSource::get_attr(ppdcFile *fp, // I - File to read + bool loc) // I - Localize this attribute? { char name[1024], // Name string selector[1024], // Selector string @@ -308,15 +312,16 @@ ppdcSource::get_attr(ppdcFile *fp) // I - File to read // Attribute name selector value if (!get_token(fp, name, sizeof(name))) { - fprintf(stderr, "ppdc: Expected name after Attribute on line %d of %s!\n", - fp->line, fp->filename); + fprintf(stderr, "ppdc: Expected name after %sAttribute on line %d of %s!\n", + loc ? "Loc" : "", fp->line, fp->filename); return (0); } if (!get_token(fp, selector, sizeof(selector))) { - fprintf(stderr, "ppdc: Expected selector after Attribute on line %d of %s!\n", - fp->line, fp->filename); + fprintf(stderr, + "ppdc: Expected selector after %sAttribute on line %d of %s!\n", + loc ? "Loc" : "", fp->line, fp->filename); return (0); } @@ -325,14 +330,15 @@ ppdcSource::get_attr(ppdcFile *fp) // I - File to read if (!get_token(fp, value, sizeof(value))) { - fprintf(stderr, "ppdc: Expected value after Attribute on line %d of %s!\n", - fp->line, fp->filename); + fprintf(stderr, + "ppdc: Expected value after %sAttribute on line %d of %s!\n", + loc ? "Loc" : "", fp->line, fp->filename); return (0); } // printf("name=\"%s\", selector=\"%s\", value=\"%s\"\n", name, selector, value); - return (new ppdcAttr(name, selector, text, value)); + return (new ppdcAttr(name, selector, text, value, loc)); } @@ -778,6 +784,9 @@ ppdcSource::get_duplex(ppdcFile *fp, // I - File to read from return; } + if (cond_state) + return; + if (!strcasecmp(temp, "none") || !strcasecmp(temp, "false") || !strcasecmp(temp, "no") || !strcasecmp(temp, "off")) { @@ -1130,7 +1139,6 @@ ppdcSource::get_group(ppdcFile *fp, // I - File to read { // Nope, add a new one... g = new ppdcGroup(name, text); - d->add_group(g); } return (g); @@ -1180,19 +1188,31 @@ ppdcSource::get_installable(ppdcFile *fp) // 'ppdcSource::get_integer()' - Get an integer value from a string. // +#define PPDC_XX -1 // Bad +#define PPDC_EQ 0 // == +#define PPDC_NE 1 // != +#define PPDC_LT 2 // < +#define PPDC_LE 3 // <= +#define PPDC_GT 4 // > +#define PPDC_GE 5 // >= + int // O - Integer value ppdcSource::get_integer(const char *v) // I - Value string { - long val; // Value - long temp; // Temporary value - char *newv; // New value string pointer + long val; // Value + long temp, // Temporary value + temp2; // Second temporary value + char *newv, // New value string pointer + ch; // Temporary character + ppdcVariable *var; // #define variable + int compop; // Comparison operator // Parse the value string... if (!v) return (-1); - if (isdigit(*v) || *v == '-' || *v == '+') + if (isdigit(*v & 255) || *v == '-' || *v == '+') { // Return a simple integer value val = strtol(v, (char **)&v, 0); @@ -1203,29 +1223,187 @@ ppdcSource::get_integer(const char *v) // I - Value string } else if (*v == '(') { - // Return the bitwise OR of each integer in parenthesis... + // Evaluate and expression in any of the following formats: + // + // (number number ... number) Bitwise OR of all numbers + // (NAME == value) 1 if equal, 0 otherwise + // (NAME != value) 1 if not equal, 0 otherwise + // (NAME < value) 1 if less than, 0 otherwise + // (NAME <= value) 1 if less than or equal, 0 otherwise + // (NAME > value) 1 if greater than, 0 otherwise + // (NAME >= value) 1 if greater than or equal, 0 otherwise + v ++; val = 0; while (*v && *v != ')') { - temp = strtol(v, &newv, 0); + // Skip leading whitespace... + while (*v && isspace(*v & 255)); + v ++; + + if (!*v || *v == ')') + break; + + if (isdigit(*v & 255) || *v == '-' || *v == '+') + { + // Bitwise OR a number... + temp = strtol(v, &newv, 0); + + if (!*newv || newv == v || !(isspace(*newv) || *newv == ')') || + temp == LONG_MIN) + return (-1); + } + else + { + // NAME logicop value + for (newv = (char *)v + 1; + *newv && (isalnum(*newv & 255) || *newv == '_'); + newv ++); + + ch = *newv; + *newv = '\0'; + + if ((var = find_variable(v)) != NULL) + { + if (!var->value || !var->value->value || !var->value->value[0]) + temp = 0; + else if (isdigit(var->value->value[0] & 255) || + var->value->value[0] == '-' || + var->value->value[0] == '+') + temp = strtol(var->value->value, NULL, 0); + else + temp = 1; + } + else + temp = 0; + + *newv = ch; + while (isspace(*newv & 255)) + newv ++; + + if (strncmp(newv, "==", 2)) + { + compop = PPDC_EQ; + newv += 2; + } + else if (strncmp(newv, "!=", 2)) + { + compop = PPDC_NE; + newv += 2; + } + else if (strncmp(newv, "<=", 2)) + { + compop = PPDC_LE; + newv += 2; + } + else if (*newv == '<') + { + compop = PPDC_LT; + newv ++; + } + else if (strncmp(newv, ">=", 2)) + { + compop = PPDC_GE; + newv += 2; + } + else if (*newv == '>') + { + compop = PPDC_GT; + newv ++; + } + else + compop = PPDC_XX; + + if (compop != PPDC_XX) + { + while (isspace(*newv & 255)) + newv ++; + + if (*newv == ')' || !*newv) + return (-1); + + if (isdigit(*v & 255) || *v == '-' || *v == '+') + { + // Get the second number... + temp2 = strtol(newv, &newv, 0); + if (!*newv || newv == v || !(isspace(*newv) || *newv == ')') || + temp == LONG_MIN) + return (-1); + } + else + { + // Lookup the second name... + for (v = newv, newv ++; + *newv && (isalnum(*newv & 255) || *newv == '_'); + newv ++); - if (!*newv || newv == v || !(isspace(*newv) || *newv == ')') || - temp == LONG_MIN) - return (-1); + ch = *newv; + *newv = '\0'; + + if ((var = find_variable(v)) != NULL) + { + if (!var->value || !var->value->value || !var->value->value[0]) + temp2 = 0; + else if (isdigit(var->value->value[0] & 255) || + var->value->value[0] == '-' || + var->value->value[0] == '+') + temp2 = strtol(var->value->value, NULL, 0); + else + temp2 = 1; + } + else + temp2 = 0; + + *newv = ch; + } + + // Do the comparison... + switch (compop) + { + case PPDC_EQ : + temp = temp == temp2; + break; + case PPDC_NE : + temp = temp != temp2; + break; + case PPDC_LT : + temp = temp < temp2; + break; + case PPDC_LE : + temp = temp <= temp2; + break; + case PPDC_GT : + temp = temp > temp2; + break; + case PPDC_GE : + temp = temp >= temp2; + break; + } + } + } val |= temp; v = newv; } - if (*v == ')') + if (*v == ')' && !v[1]) return ((int)val); else return (-1); } + else if ((var = find_variable(v)) != NULL) + { + // NAME by itself returns 1 if the #define variable is not blank and + // not "0"... + return (var->value->value && var->value->value[0] && + strcmp(var->value->value, "0")); + } else + { + // Anything else is an error... return (-1); + } } @@ -1374,13 +1552,13 @@ ppdcSource::get_option(ppdcFile *fp, // I - File to read { // Nope, add a new one... o = new ppdcOption(ot, name, text, section, order); - g->add_option(o); } else if (o->type != ot) { // printf("o=%p, o->type=%d, o->name=%s, ot=%d, name=%s\n", // o, o->type, o->name->value, ot, name); - fprintf(stderr, "ppdc: Option already defined with a different type on line %d of %s!\n", + fprintf(stderr, + "ppdc: Option redefined with a different type on line %d of %s!\n", fp->line, fp->filename); return (NULL); } @@ -2111,6 +2289,9 @@ ppdcSource::read_file(const char *f) // I - File to read ppdcFile *fp = new ppdcFile(f); scan_file(fp); delete fp; + + if (cond_current != cond_stack) + fprintf(stderr, "ppdc: Missing #endif at end of \"%s\"!\n", f); } @@ -2155,6 +2336,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read // Loop until EOF or } o = 0; g = general; + while (get_token(fp, temp, sizeof(temp))) { if (temp[0] == '*') @@ -2183,6 +2365,113 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read // Open a new child... scan_file(fp, d); } + else if (!strcasecmp(temp, "#if")) + { + if ((cond_current - cond_stack) >= 100) + { + fprintf(stderr, "ppdc: Too many nested #if's on line %d of %s!\n", + fp->line, fp->filename); + break; + } + + cond_current ++; + if (get_integer(fp)) + *cond_current = PPDC_COND_SATISFIED; + else + { + *cond_current = PPDC_COND_SKIP; + cond_state |= PPDC_COND_SKIP; + } + } + else if (!strcasecmp(temp, "#elif")) + { + if (cond_current == cond_stack) + { + fprintf(stderr, "ppdc: Missing #if on line %d of %s!\n", fp->line, + fp->filename); + break; + } + + if (*cond_current & PPDC_COND_SATISFIED) + { + get_integer(fp); + *cond_current |= PPDC_COND_SKIP; + } + else if (get_integer(fp)) + { + *cond_current |= PPDC_COND_SATISFIED; + *cond_current &= ~PPDC_COND_SKIP; + } + else + *cond_current |= PPDC_COND_SKIP; + + // Update the current state + int *cond_temp = cond_current; // Temporary stack pointer + + cond_state = PPDC_COND_NORMAL; + while (cond_temp > cond_stack) + if (*cond_temp & PPDC_COND_SKIP) + { + cond_state = PPDC_COND_SKIP; + break; + } + else + cond_temp --; + } + else if (!strcasecmp(temp, "#else")) + { + if (cond_current == cond_stack) + { + fprintf(stderr, "ppdc: Missing #if on line %d of %s!\n", fp->line, + fp->filename); + break; + } + + if (*cond_current & PPDC_COND_SATISFIED) + *cond_current |= PPDC_COND_SKIP; + else + { + *cond_current |= PPDC_COND_SATISFIED; + *cond_current &= ~PPDC_COND_SKIP; + } + + // Update the current state + int *cond_temp = cond_current; // Temporary stack pointer + + cond_state = PPDC_COND_NORMAL; + while (cond_temp > cond_stack) + if (*cond_temp & PPDC_COND_SKIP) + { + cond_state = PPDC_COND_SKIP; + break; + } + else + cond_temp --; + } + else if (!strcasecmp(temp, "#endif")) + { + if (cond_current == cond_stack) + { + fprintf(stderr, "ppdc: Missing #if on line %d of %s!\n", fp->line, + fp->filename); + break; + } + + cond_current --; + + // Update the current state + int *cond_temp = cond_current; // Temporary stack pointer + + cond_state = PPDC_COND_NORMAL; + while (cond_temp > cond_stack) + if (*cond_temp & PPDC_COND_SKIP) + { + cond_state = PPDC_COND_SKIP; + break; + } + else + cond_temp --; + } else if (!strcasecmp(temp, "#define")) { // Get the variable... @@ -2196,6 +2485,8 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read inctemp[1024], // Initial filename incname[1024]; // Include filename ppdcFile *incfile; // Include file + int *old_current = cond_current; + // Previous current stack // Get the include name... @@ -2206,13 +2497,16 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read break; } + if (cond_state) + continue; + // Figure out the current directory... strlcpy(basedir, fp->filename, sizeof(basedir)); if ((baseptr = strrchr(basedir, '/')) != NULL) - *baseptr = '\0'; + *baseptr = '\0'; else - strcpy(basedir, "."); + strcpy(basedir, "."); // Find the include file... if (find_include(inctemp, basedir, incname, sizeof(incname))) @@ -2221,13 +2515,16 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read incfile = new ppdcFile(incname); scan_file(incfile, d, true); delete incfile; + + if (cond_current != old_current) + fprintf(stderr, "ppdc: Missing #endif at end of \"%s\"!\n", incname); } else { - // Can't find it! + // Can't find it! fprintf(stderr, - "ppdc: Unable to find include file \"%s\" on line %d of %s!\n", - inctemp, fp->line, fp->filename); + "ppdc: Unable to find include file \"%s\" on line %d of %s!\n", + inctemp, fp->line, fp->filename); break; } } @@ -2239,7 +2536,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read // Get a media size... m = get_size(fp); if (m) - sizes->add(m); + { + if (cond_state) + m->release(); + else + sizes->add(m); + } } else if (!strcasecmp(temp, "#po")) { @@ -2249,21 +2551,43 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read // Get a message catalog... cat = get_po(fp); if (cat) - po_files->add(cat); + { + if (cond_state) + cat->release(); + else + po_files->add(cat); + } } - else if (!strcasecmp(temp, "Attribute")) + else if (!strcasecmp(temp, "Attribute") || + !strcasecmp(temp, "LocAttribute")) { ppdcAttr *a; // Attribute // Get an attribute... - a = get_attr(fp); + a = get_attr(fp, !strcasecmp(temp, "LocAttribute")); if (a) - d->add_attr(a); + { + if (cond_state) + a->release(); + else + d->add_attr(a); + } } else if (!strcasecmp(temp, "Choice")) { // Get a choice... + c = get_choice(fp); + if (!c) + break; + + if (cond_state) + { + c->release(); + continue; + } + + // Add it to the current option... if (!o) { fprintf(stderr, "ppdc: Choice found on line %d of %s with no Option!\n", @@ -2271,11 +2595,6 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read break; } - c = get_choice(fp); - if (!c) - break; - - // Add it to the current option... o->add_choice(c); if (isdefault) @@ -2284,7 +2603,10 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else if (!strcasecmp(temp, "ColorDevice")) { // ColorDevice boolean - d->color_device = get_boolean(fp); + if (cond_state) + get_boolean(fp); + else + d->color_device = get_boolean(fp); } else if (!strcasecmp(temp, "ColorModel")) { @@ -2293,6 +2615,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!c) continue; + if (cond_state) + { + c->release(); + continue; + } + // Add the choice to the ColorModel option... if ((o = d->find_option("ColorModel")) == NULL) { @@ -2318,7 +2646,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read p = get_color_profile(fp); if (p) - d->profiles->add(p); + { + if (cond_state) + p->release(); + else + d->profiles->add(p); + } } else if (!strcasecmp(temp, "Copyright")) { @@ -2337,6 +2670,9 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read break; } + if (cond_state) + continue; + // Break it up into individual lines... for (copyptr = copytemp; copyptr; copyptr = copyend) { @@ -2353,6 +2689,13 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read // Get a custom media size... m = get_custom_size(fp); + + if (cond_state) + { + m->release(); + continue; + } + if (m) d->sizes->add(m); @@ -2366,7 +2709,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read have_cutter = get_boolean(fp); - if (have_cutter <= 0) + if (have_cutter <= 0 || cond_state) continue; if ((o = d->find_option("CutMedia")) == NULL) @@ -2393,6 +2736,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!c) continue; + if (cond_state) + { + c->release(); + continue; + } + // Add the choice to the cupsDarkness option... if ((o = d->find_option("cupsDarkness")) == NULL) { @@ -2422,6 +2771,9 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read continue; } + if (cond_state) + continue; + for (i = 0; i < (int)(sizeof(driver_types) / sizeof(driver_types[0])); i ++) if (!strcasecmp(temp, driver_types[i])) break; @@ -2444,7 +2796,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read // Get the filter value... f = get_filter(fp); if (f) - d->filters->add(f); + { + if (cond_state) + f->release(); + else + d->filters->add(f); + } } else if (!strcasecmp(temp, "Finishing")) { @@ -2453,6 +2810,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!c) continue; + if (cond_state) + { + c->release(); + continue; + } + // Add the choice to the cupsFinishing option... if ((o = d->find_option("cupsFinishing")) == NULL) { @@ -2479,21 +2842,40 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read f = get_font(fp); if (f) { - if (!strcasecmp(temp, "#font")) - base_fonts->add(f); - else - d->add_font(f); + if (cond_state) + f->release(); + else + { + if (!strcasecmp(temp, "#font")) + base_fonts->add(f); + else + d->add_font(f); - if (isdefault) - d->set_default_font(f); + if (isdefault) + d->set_default_font(f); + } } } else if (!strcasecmp(temp, "Group")) { // Get a group... - g = get_group(fp, d); - if (!g) + ppdcGroup *tempg = get_group(fp, d); + + if (!tempg) break; + + if (cond_state) + { + if (!d->find_group(tempg->name->value)) + tempg->release(); + } + else + { + if (!d->find_group(tempg->name->value)) + d->add_group(tempg); + + g = tempg; + } } else if (!strcasecmp(temp, "HWMargins")) { @@ -2510,6 +2892,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!c) continue; + if (cond_state) + { + c->release(); + continue; + } + // Add the choice to the InputSlot option... if ((o = d->find_option("InputSlot")) == NULL) { @@ -2535,14 +2923,21 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read // Add it as needed... if (o) { - install->add_option(o); + if (cond_state) + o->release(); + else + install->add_option(o); + o = NULL; } } else if (!strcasecmp(temp, "ManualCopies")) { // ManualCopies boolean - d->manual_copies = get_boolean(fp); + if (cond_state) + get_boolean(fp); + else + d->manual_copies = get_boolean(fp); } else if (!strcasecmp(temp, "Manufacturer")) { @@ -2557,13 +2952,22 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read break; } - d->set_manufacturer(name); + if (!cond_state) + d->set_manufacturer(name); } else if (!strcasecmp(temp, "MaxSize")) { // MaxSize width length - d->max_width = get_measurement(fp); - d->max_length = get_measurement(fp); + if (cond_state) + { + get_measurement(fp); + get_measurement(fp); + } + else + { + d->max_width = get_measurement(fp); + d->max_length = get_measurement(fp); + } } else if (!strcasecmp(temp, "MediaSize")) { @@ -2575,11 +2979,15 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (get_token(fp, name, sizeof(name)) == NULL) { - fprintf(stderr, "ppdc: Expected name after MediaSize on line %d of %s!\n", + fprintf(stderr, + "ppdc: Expected name after MediaSize on line %d of %s!\n", fp->line, fp->filename); break; } + if (cond_state) + continue; + m = find_size(name); if (!m) @@ -2606,6 +3014,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!c) continue; + if (cond_state) + { + c->release(); + continue; + } + // Add the choice to the MediaType option... if ((o = d->find_option("MediaType")) == NULL) { @@ -2626,8 +3040,16 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else if (!strcasecmp(temp, "MinSize")) { // MinSize width length - d->min_width = get_measurement(fp); - d->min_length = get_measurement(fp); + if (cond_state) + { + get_measurement(fp); + get_measurement(fp); + } + else + { + d->min_width = get_measurement(fp); + d->min_length = get_measurement(fp); + } } else if (!strcasecmp(temp, "ModelName")) { @@ -2642,34 +3064,71 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read break; } - d->set_model_name(name); + if (!cond_state) + d->set_model_name(name); } else if (!strcasecmp(temp, "ModelNumber")) { // ModelNumber number - d->model_number = get_integer(fp); + if (cond_state) + get_integer(fp); + else + d->model_number = get_integer(fp); } else if (!strcasecmp(temp, "Option")) { // Get an option... - o = get_option(fp, d, g); - if (!o) + ppdcOption *tempo = get_option(fp, d, g); + + if (!tempo) break; + + if (cond_state) + { + if (!g->find_option(tempo->name->value)) + tempo->release(); + } + else + { + if (!g->find_option(tempo->name->value)) + g->add_option(tempo); + + o = tempo; + } + } + else if (!strcasecmp(temp, "FileName")) + { + // FileName name + char name[256]; // Filename string + + + if (!get_token(fp, name, sizeof(name))) + { + fprintf(stderr, + "ppdc: Expected name after FileName on line %d of %s!\n", + fp->line, fp->filename); + break; + } + + if (!cond_state) + d->set_file_name(name); } else if (!strcasecmp(temp, "PCFileName")) { // PCFileName name - char name[256]; // Model name string + char name[256]; // PC filename string if (!get_token(fp, name, sizeof(name))) { - fprintf(stderr, "ppdc: Expected name after PCFileName on line %d of %s!\n", + fprintf(stderr, + "ppdc: Expected name after PCFileName on line %d of %s!\n", fp->line, fp->filename); break; } - d->set_pc_file_name(name); + if (!cond_state) + d->set_pc_file_name(name); } else if (!strcasecmp(temp, "Resolution")) { @@ -2678,11 +3137,18 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!c) continue; + if (cond_state) + { + c->release(); + continue; + } + // Add the choice to the Resolution option... if ((o = d->find_option("Resolution")) == NULL) { // Create the Resolution option... - o = new ppdcOption(PPDC_PICKONE, "Resolution", NULL, PPDC_SECTION_ANY, 10.0f); + o = new ppdcOption(PPDC_PICKONE, "Resolution", NULL, PPDC_SECTION_ANY, + 10.0f); g = general; g->add_option(o); } @@ -2703,12 +3169,20 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read p = get_simple_profile(fp); if (p) - d->profiles->add(p); + { + if (cond_state) + p->release(); + else + d->profiles->add(p); + } } else if (!strcasecmp(temp, "Throughput")) { // Throughput number - d->throughput = get_integer(fp); + if (cond_state) + get_integer(fp); + else + d->throughput = get_integer(fp); } else if (!strcasecmp(temp, "UIConstraints")) { @@ -2718,12 +3192,20 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read con = get_constraint(fp); if (con) - d->constraints->add(con); + { + if (cond_state) + con->release(); + else + d->constraints->add(con); + } } else if (!strcasecmp(temp, "VariablePaperSize")) { // VariablePaperSize boolean - d->variable_paper_size = get_boolean(fp); + if (cond_state) + get_boolean(fp); + else + d->variable_paper_size = get_boolean(fp); } else if (!strcasecmp(temp, "Version")) { @@ -2733,12 +3215,14 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!get_token(fp, name, sizeof(name))) { - fprintf(stderr, "ppdc: Expected string after Version on line %d of %s!\n", + fprintf(stderr, + "ppdc: Expected string after Version on line %d of %s!\n", fp->line, fp->filename); break; } - d->set_version(name); + if (!cond_state) + d->set_version(name); } else { @@ -2871,6 +3355,8 @@ ppdcSource::write_file(const char *f) // I - File to write quotef(fp, " Manufacturer \"%s\"\n", d->manufacturer->value); if (d->model_name->value) quotef(fp, " ModelName \"%s\"\n", d->model_name->value); + if (d->file_name->value) + quotef(fp, " FileName \"%s\"\n", d->file_name->value); if (d->pc_file_name->value) quotef(fp, " PCFileName \"%s\"\n", d->pc_file_name->value); if (d->version->value) diff --git a/ppdc/ppdc.cxx b/ppdc/ppdc.cxx index 02852cabf..c4d6be1e0 100644 --- a/ppdc/ppdc.cxx +++ b/ppdc/ppdc.cxx @@ -23,6 +23,7 @@ // #include "ppdc.h" +#include #include #include @@ -50,23 +51,28 @@ main(int argc, // I - Number of command-line arguments cups_file_t *fp; // PPD file char *opt, // Current option *value, // Value in option + *outname, // Output filename pcfilename[1024], // Lowercase pcfilename filename[1024]; // PPD filename - int verbose; // Verbosity - ppdcArray *locales; // List of locales - int comp; // Compress + int comp, // Compress + do_test, // Test PPD files + use_model_name, // Use ModelName for filename + verbose; // Verbosity ppdcLineEnding le; // Line ending to use + ppdcArray *locales; // List of locales // Scan the command-line... - catalog = NULL; - outdir = "ppd"; - src = new ppdcSource(); - verbose = 0; - locales = NULL; - comp = 0; - le = PPDC_LFONLY; + catalog = NULL; + comp = 0; + do_test = 0; + le = PPDC_LFONLY; + locales = NULL; + outdir = "ppd"; + src = new ppdcSource(); + use_model_name = 0; + verbose = 0; for (i = 1; i < argc; i ++) if (argv[i][0] == '-') @@ -74,6 +80,32 @@ main(int argc, // I - Number of command-line arguments for (opt = argv[i] + 1; *opt; opt ++) switch (*opt) { + case 'D' : // Define variable + i ++; + if (i >= argc) + usage(); + + if ((value = strchr(argv[i], '=')) != NULL) + { + *value++ = '\0'; + + src->set_variable(argv[i], value); + } + else + src->set_variable(argv[i], "1"); + break; + + case 'I' : // Include directory... + i ++; + if (i >= argc) + usage(); + + if (verbose > 1) + printf("ppdc: Adding include directory \"%s\"...\n", argv[i]); + + ppdcSource::add_include(argv[i]); + break; + case 'c' : // Message catalog... i ++; if (i >= argc) @@ -154,30 +186,12 @@ main(int argc, // I - Number of command-line arguments } break; - case 'D' : // Define variable - i ++; - if (i >= argc) - usage(); - - if ((value = strchr(argv[i], '=')) != NULL) - { - *value++ = '\0'; - - src->set_variable(argv[i], value); - } - else - src->set_variable(argv[i], "1"); - break; - - case 'I' : // Include directory... - i ++; - if (i >= argc) - usage(); - - if (verbose > 1) - printf("ppdc: Adding include directory \"%s\"...\n", argv[i]); + case 'm' : // Use ModelName for filename + use_model_name = 1; + break; - ppdcSource::add_include(argv[i]); + case 't' : // Test PPDs instead of generating them + do_test = 1; break; case 'v' : // Be verbose... @@ -241,39 +255,92 @@ main(int argc, // I - Number of command-line arguments d; d = (ppdcDriver *)src->drivers->next()) { - // Write the PPD file for this driver... - if (strstr(d->pc_file_name->value, ".PPD")) + if (do_test) { - // Convert PCFileName to lowercase... - for (j = 0; - d->pc_file_name->value[j] && j < (int)(sizeof(pcfilename) - 1); - j ++) - pcfilename[j] = tolower(d->pc_file_name->value[j]); + // Test the PPD file for this driver... + int pid, // Process ID + fds[2]; // Pipe file descriptors + + + if (pipe(fds)) + { + fprintf(stderr, "ppdc: Unable to create output pipes: %s\n", + strerror(errno)); + return (1); + } + + if ((pid = fork()) == 0) + { + // Child process comes here... + close(0); + dup(fds[0]); + + close(fds[0]); + close(fds[1]); + + execlp("cupstestppd", "cupstestppd", "-", (char *)0); + + fprintf(stderr, "ppdc: Unable to execute cupstestppd: %s\n", + strerror(errno)); + return (errno); + } + else if (pid < 0) + { + fprintf(stderr, "ppdc: Unable to execute cupstestppd: %s\n", + strerror(errno)); + return (errno); + } - pcfilename[j] = '\0'; + close(fds[0]); + fp = cupsFileOpenFd(fds[1], "w"); } else { - // Leave PCFileName as-is... - strlcpy(pcfilename, d->pc_file_name->value, sizeof(pcfilename)); - } + // Write the PPD file for this driver... + if (use_model_name) + outname = d->model_name->value; + else if (d->file_name) + outname = d->file_name->value; + else + outname = d->pc_file_name->value; + + if (strstr(outname, ".PPD")) + { + // Convert PCFileName to lowercase... + for (j = 0; + outname[j] && j < (int)(sizeof(pcfilename) - 1); + j ++) + pcfilename[j] = tolower(outname[j] & 255); - // Open the PPD file for writing... - if (comp) - snprintf(filename, sizeof(filename), "%s/%s.gz", outdir, pcfilename); - else - snprintf(filename, sizeof(filename), "%s/%s", outdir, pcfilename); + pcfilename[j] = '\0'; + } + else + { + // Leave PCFileName as-is... + strlcpy(pcfilename, outname, sizeof(pcfilename)); + } - fp = cupsFileOpen(filename, comp ? "w9" : "w"); - if (!fp) - { - fprintf(stderr, "ppdc: Unable to create PPD file \"%s\" - %s.\n", - filename, strerror(errno)); - return (1); + // Open the PPD file for writing... + if (comp) + snprintf(filename, sizeof(filename), "%s/%s.gz", outdir, pcfilename); + else + snprintf(filename, sizeof(filename), "%s/%s", outdir, pcfilename); + + fp = cupsFileOpen(filename, comp ? "w9" : "w"); + if (!fp) + { + fprintf(stderr, "ppdc: Unable to create PPD file \"%s\" - %s.\n", + filename, strerror(errno)); + return (1); + } + + if (verbose) + printf("ppdc: Writing %s...\n", filename); } - if (verbose) - printf("ppdc: Writing %s...\n", filename); + /* + * Write the PPD file... + */ if (d->write_ppd_file(fp, catalog, locales, src, le)) { @@ -313,6 +380,8 @@ usage(void) puts(" -c catalog.po Load the specified message catalog."); puts(" -d output-dir Specify the output directory."); puts(" -l lang[,lang,...] Specify the output language(s) (locale)."); + puts(" -m Use the ModelName value as the filename."); + puts(" -t Test PPDs instead of generating them."); puts(" -v Be verbose (more v's for more verbosity)."); puts(" -z Compress PPD files using GNU zip."); puts(" --cr End lines with CR (Mac OS 9)."); diff --git a/ppdc/ppdc.h b/ppdc/ppdc.h index ab67a36c3..40bb9f5b0 100644 --- a/ppdc/ppdc.h +++ b/ppdc/ppdc.h @@ -3,7 +3,7 @@ // // Definitions for the CUPS PPD Compiler. // -// Copyright 2007 by Apple Inc. +// Copyright 2007-2008 by Apple Inc. // Copyright 2002-2007 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -73,6 +73,13 @@ enum ppdcLineEnding //// Line endings PPDC_CRLF // CR + LF }; +enum ppdcCondFlags //// Condition flags +{ + PPDC_COND_NORMAL = 0, // Normal state + PPDC_COND_SKIP = 1, // Skip state + PPDC_COND_SATISFIED = 2 // At least one condition satisfied +}; + // // Printer description data... @@ -173,8 +180,10 @@ class ppdcAttr //// Attribute *selector, // Selector string *text, // Text string *value; // Value string + bool localizable; // Should this attribute be localized? - ppdcAttr(const char *n, const char *s, const char *t, const char *v); + ppdcAttr(const char *n, const char *s, const char *t, const char *v, + bool loc = false); ~ppdcAttr(); }; @@ -323,6 +332,7 @@ class ppdcDriver //// Printer Driver Data ppdcArray *copyright; // Copyright strings ppdcString *manufacturer, // Manufacturer *model_name, // Name of printer model + *file_name, // Output filename for PPD *pc_file_name, // 8 character PC filename for PPD *version; // Version number int model_number, // Model number for driver @@ -370,6 +380,7 @@ class ppdcDriver //// Printer Driver Data void set_custom_size_code(const char *c); void set_default_font(ppdcFont *f); void set_default_size(ppdcMediaSize *m); + void set_file_name(const char *f); void set_manufacturer(const char *m); void set_model_name(const char *m); void set_pc_file_name(const char *f); @@ -423,6 +434,10 @@ class ppdcSource //// Source File *po_files, // Message catalogs *sizes, // Predefined media sizes *vars; // Defined variables + int cond_state, // Cummulative conditional state + *cond_current, // Current #if state + cond_stack[101]; // #if state stack + ppdcSource(const char *f = 0); ~ppdcSource(); @@ -434,7 +449,7 @@ class ppdcSource //// Source File ppdcCatalog *find_po(const char *l); ppdcMediaSize *find_size(const char *s); ppdcVariable *find_variable(const char *n); - ppdcAttr *get_attr(ppdcFile *fp); + ppdcAttr *get_attr(ppdcFile *fp, bool loc = false); int get_boolean(ppdcFile *fp); ppdcChoice *get_choice(ppdcFile *fp); ppdcChoice *get_color_model(ppdcFile *fp); diff --git a/ppdc/ppdpo.cxx b/ppdc/ppdpo.cxx index 0ee273eb9..cbd227014 100644 --- a/ppdc/ppdpo.cxx +++ b/ppdc/ppdpo.cxx @@ -3,7 +3,7 @@ // // PPD file message catalog program for the CUPS PPD Compiler. // -// Copyright 2007 by Apple Inc. +// Copyright 2007-2008 by Apple Inc. // Copyright 2002-2005 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -198,13 +198,21 @@ add_ui_strings(ppdcDriver *d, // I - Driver data a; a = (ppdcAttr *)d->attrs->next()) if (a->text->value && a->text->value[0] && - (!strncmp(a->name->value, "Custom", 6) || + (a->localizable || + !strncmp(a->name->value, "Custom", 6) || !strncmp(a->name->value, "ParamCustom", 11) || !strcmp(a->name->value, "APCustomColorMatchingName") || !strcmp(a->name->value, "APPrinterPreset") || !strcmp(a->name->value, "cupsICCProfile") || - !strcmp(a->name->value, "cupsIPPReason"))) + !strcmp(a->name->value, "cupsIPPReason") || + !strcmp(a->name->value, "cupsMarkerName"))) + { catalog->add_message(a->text->value); + + if ((a->localizable && a->value->value[0]) || + !strcmp(a->name->value, "cupsIPPReason")) + catalog->add_message(a->value->value); + } else if (!strncmp(a->name->value, "Custom", 6) || !strncmp(a->name->value, "ParamCustom", 11)) catalog->add_message(a->name->value); diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c index ea54dbfba..9b7b285c4 100644 --- a/scheduler/dirsvc.c +++ b/scheduler/dirsvc.c @@ -224,7 +224,7 @@ cupsdDeregisterPrinter( #endif /* HAVE_LIBSLP */ #ifdef HAVE_DNSSD - if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDPort) + if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) dnssdDeregisterPrinter(p); #endif /* HAVE_DNSSD */ } @@ -636,7 +636,7 @@ cupsdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ #endif /* HAVE_LIBSLP */ #ifdef HAVE_DNSSD - if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDPort) + if ((BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDRef) dnssdRegisterPrinter(p); #endif /* HAVE_DNSSD */ } @@ -1407,6 +1407,8 @@ cupsdStopBrowsing(void) cupsArrayDelete(DNSSDPrinters); DNSSDPrinters = NULL; + + DNSSDPort = 0; } #endif /* HAVE_DNSSD */ diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 2a223570e..32e4dc2ad 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -10793,7 +10793,7 @@ user_allowed(cupsd_printer_t *p, /* I - Printer or class */ for (i = 0; i < p->num_users; i ++) { - if (p->users[i][0] == '@') + if (p->users[i][0] == '@' || p->users[i][0] == '#') { /* * Check group membership... diff --git a/systemv/cupstestppd.c b/systemv/cupstestppd.c index ac4e67de5..3e9b87416 100644 --- a/systemv/cupstestppd.c +++ b/systemv/cupstestppd.c @@ -250,10 +250,10 @@ main(int argc, /* I - Number of command-line args */ * Read from stdin... */ - if (verbose >= 0) - printf("(stdin):"); - ppd = ppdOpen(stdin); + + if (verbose >= 0) + printf("%s:", (ppd && ppd->pcfilename) ? ppd->pcfilename : "(stdin)"); } else { -- 2.39.2