summaryrefslogtreecommitdiff
path: root/src/foomatic
diff options
context:
space:
mode:
Diffstat (limited to 'src/foomatic')
-rw-r--r--src/foomatic/.cvsignore12
-rw-r--r--src/foomatic/Makefile.am101
-rw-r--r--src/foomatic/foomatic-generator.in671
-rw-r--r--src/foomatic/foomatic-printermap294
-rw-r--r--src/foomatic/foomatic-templates/Brightness.xml24
-rw-r--r--src/foomatic/foomatic-templates/Color.xml21
-rw-r--r--src/foomatic/foomatic-templates/Contrast.xml24
-rw-r--r--src/foomatic/foomatic-templates/Cyan.xml24
-rw-r--r--src/foomatic/foomatic-templates/Density.xml24
-rw-r--r--src/foomatic/foomatic-templates/Dither.xml21
-rw-r--r--src/foomatic/foomatic-templates/Gamma.xml24
-rw-r--r--src/foomatic/foomatic-templates/ImageType.xml63
-rw-r--r--src/foomatic/foomatic-templates/InkType.xml21
-rw-r--r--src/foomatic/foomatic-templates/InputSlot.xml20
-rw-r--r--src/foomatic/foomatic-templates/Magenta.xml24
-rw-r--r--src/foomatic/foomatic-templates/MediaType.xml21
-rw-r--r--src/foomatic/foomatic-templates/Model.xml21
-rw-r--r--src/foomatic/foomatic-templates/PageSize.xml21
-rw-r--r--src/foomatic/foomatic-templates/Quality.xml21
-rw-r--r--src/foomatic/foomatic-templates/Resolution.xml21
-rw-r--r--src/foomatic/foomatic-templates/Saturation.xml24
-rw-r--r--src/foomatic/foomatic-templates/Yellow.xml24
-rw-r--r--src/foomatic/foomatic-templates/gimp-print.xml26
-rw-r--r--src/foomatic/gimp-print-version.c44
-rw-r--r--src/foomatic/paper_sizes.c46
-rw-r--r--src/foomatic/printer_options.c119
-rw-r--r--src/foomatic/printers.c45
-rw-r--r--src/foomatic/stp_limits.c98
28 files changed, 1899 insertions, 0 deletions
diff --git a/src/foomatic/.cvsignore b/src/foomatic/.cvsignore
new file mode 100644
index 0000000..2f604f5
--- /dev/null
+++ b/src/foomatic/.cvsignore
@@ -0,0 +1,12 @@
+Makefile.in
+Makefile
+.deps
+.libs
+printer_options
+foomatic-db
+foomatic-generator
+paper_sizes
+gimp-print-version
+stp_limits
+foomatic-stamp
+printers
diff --git a/src/foomatic/Makefile.am b/src/foomatic/Makefile.am
new file mode 100644
index 0000000..3c876ba
--- /dev/null
+++ b/src/foomatic/Makefile.am
@@ -0,0 +1,101 @@
+## $Id: Makefile.am,v 1.16 2001/11/19 12:40:46 rlk Exp $
+## Copyright (C) 2000 Roger Leigh
+##
+## This program 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, or (at your option)
+## any later version.
+##
+## This program 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 program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = 1.4 gnu
+
+@SET_MAKE@
+
+MAINT_CHARSET = latin1
+
+
+## Variables
+
+AM_CFLAGS = $(GNUCFLAGS)
+INCLUDES = @INCLUDES@ $(LIBGIMPPRINT_CFLAGS) -I$(top_srcdir)/src/main
+LIBS = @LIBS@ ../../lib/libprintut.la $(INTLLIBS) ../../lib/libprintut.la
+
+
+## Programs
+
+FOOMATIC_NOINST_BIN = printer_options paper_sizes gimp-print-version \
+ stp_limits printers
+
+noinst_PROGRAMS = @FOOMATIC_NOINST_BIN@
+
+EXTRA_PROGRAMS = printer_options gimp-print-version paper_sizes \
+ stp_limits printers
+
+printer_options_SOURCES = printer_options.c
+printer_options_LDADD = $(LIBGIMPPRINT_LIBS)
+printer_options_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+
+gimp_print_version_SOURCES = gimp-print-version.c
+gimp_print_version_LDADD = $(LIBGIMPPRINT_LIBS)
+gimp_print_version_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+
+paper_sizes_SOURCES = paper_sizes.c
+paper_sizes_LDADD = $(LIBGIMPPRINT_LIBS)
+paper_sizes_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+
+stp_limits_SOURCES = stp_limits.c
+stp_limits_LDADD = $(LIBGIMPPRINT_LIBS)
+stp_limits_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+
+printers_SOURCES = printers.c
+printers_LDADD = $(LIBGIMPPRINT_LIBS)
+printers_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+
+
+## Rules
+
+if BUILD_FOOMATIC
+INSTALL_DATA_LOCAL_DEPS = foomatic-data
+else
+INSTALL_DATA_LOCAL_DEPS =
+endif
+
+all-local: $(INSTALL_DATA_LOCAL_DEPS)
+
+install-data-local: $(INSTALL_DATA_LOCAL_DEPS)
+ if test -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
+ foomatic-kitload -k foomatic-db ; \
+ fi
+
+clean-local:
+ -$(RM) -r foomatic-db
+
+foomatic-data: foomatic-stamp
+
+foomatic-stamp: foomatic-generator foomatic-printermap $(EXTRA_PROGRAMS)
+ -$(RM) -r foomatic-db
+ ./foomatic-generator
+ touch foomatic-stamp
+
+$(LIBGIMPPRINT_LIBS):
+ cd ../main ; \
+ $(MAKE)
+
+
+## Clean
+
+CLEANFILES = $(noinst_PROGRAMS)
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = foomatic-printermap foomatic-templates/*.xml
+
diff --git a/src/foomatic/foomatic-generator.in b/src/foomatic/foomatic-generator.in
new file mode 100644
index 0000000..57950aa
--- /dev/null
+++ b/src/foomatic/foomatic-generator.in
@@ -0,0 +1,671 @@
+#!@PERL@
+
+# Wherever we put it...
+my $mapfile;
+# $mapfile = "../main/printers.xml";
+$mapfile = "foomatic-printermap";
+
+
+# The following substitutions happen to the template XML files:
+# @@STPVER@@ - the version number (ie '4.1.5')
+# @@DRVNAME@@ - driver name (ie gimp-print)
+# @@STPRINTERS@@ - <printers>...</printers> clause for the driver
+# @@OPTCONSTRAINTS@@ - <constraints>...</constraints> object for the option
+# @@ENUMVALS@@ - <enum_vals>...</enum_vals> section for the enum option
+# @@MINVAL@@ - minimum value for numeric setting
+# @@MAXVAL@@ - maximum value for numeric setting
+# @@DEFVAL@@ - default value for numeric setting
+
+# For some things, there are option-specific root-around-n-writer
+# functions. So we have a dispatch table:
+#
+# function arguments are: ('StpDriverOptionName')
+
+my $funcs = { 'InputSlot' => { 'OPTCONSTRAINTS' => \&build_cons,
+ 'ENUMVALS' => \&build_ev, },
+ 'InkType' => { 'OPTCONSTRAINTS' => \&build_cons,
+ 'ENUMVALS' => \&build_ev },
+ 'MediaType' => { 'OPTCONSTRAINTS' => \&build_cons,
+ 'ENUMVALS' => \&build_ev },
+ 'Model' => { 'OPTCONSTRAINTS' => \&build_model_cons,
+ 'ENUMVALS' => \&build_model_ev },
+ 'PageSize' => { 'OPTCONSTRAINTS' => \&build_cons,
+ 'ENUMVALS' => \&build_ev },
+ 'Quality' => { 'OPTCONSTRAINTS' => \&build_cons,
+ 'ENUMVALS' => \&build_ev },
+ 'Dither' => { 'OPTCONSTRAINTS' => \&build_cons,
+ 'ENUMVALS' => \&build_ev },
+ 'Color' => { 'OPTCONSTRAINTS' => \&build_cons,
+ 'ENUMVALS' => \&build_ev },
+ 'Resolution' => { 'OPTCONSTRAINTS' => \&build_resolution_cons,
+ 'ENUMVALS' => \&build_resolution_ev },
+ };
+
+my $drivervals = { 'PageSize' => \&optmap_pagesize,
+ 'Color' => \&optmap_color
+ };
+
+my $debug = 0;
+
+# Foomatic name => Gimp-print name
+%argnamemap = ('Quality' => 'Resolution');
+
+%colormap = ('Grayscale' => 0,
+ 'Color' => 1,
+ 'BlackAndWhite' => 2);
+
+use Data::Dumper;
+
+open PIPE, "./printer_options|" or die "Cannot run printer_options: $!\n";
+print STDERR "Loading options from ./printer_options...";
+while(<PIPE>) {
+ next if m!^#!;
+ eval $_;
+}
+close PIPE or die "Cannot run printer_options: $!\n";
+print STDERR "done.\n";
+
+open PIPE, "./stp_limits|" or die "Cannot run stp_limits: $!\n";
+print STDERR "Loading options from ./stp_limits...";
+while(<PIPE>) {
+ next if m!^#!;
+ eval $_;
+}
+close PIPE or die "Cannot run stp_limits: $!\n";
+print STDERR "done.\n";
+
+open PIPE, "./printers|" or die "Cannot run printers: $!\n";
+print STDERR "Loading options from ./printers...";
+while(<PIPE>) {
+ next if m!^#!;
+ eval $_;
+}
+close PIPE or die "Cannot run printers: $!\n";
+print STDERR "done.\n";
+
+# OK, now %stpdata is a big honking thing, and %defaults is in there, too.
+
+# Invert, to build %bar{$optionname} = [ choice1, choice2 ];
+my ($a, $otmp, $vtmp);
+for $a (keys(%stpdata)) {
+ for $otmp (keys %{$stpdata{$a}}) {
+ for $vtmp (keys (%{$stpdata{$a}{$otmp}})) {
+ if (!$seen_evchoice{$otmp}{$vtmp}++) {
+ push (@{$ev_choices{$otmp}}, [ $vtmp,
+ $stpdata{$a}{$otmp}{$vtmp}]);
+ }
+ }
+ }
+}
+
+
+# Step 1: construct a map from Model= values to Foomatic model id's
+# this map is %mapstp. The inverse from model to Model is %mapdb
+#
+# Foomatic is supposed to be a superset, so
+
+open PRINTERS, $mapfile or die "Cannot open mapfile $mapfile: $!\n";
+for (<PRINTERS>) {
+ if (m!^#\s*gptofoo\s+([^\s]+)\s+([^\s]+)!) {
+ push (@{$mapstp{$1}}, $2);
+ $mapfoo{$2} = $1; # do we need?
+ }
+}
+
+$missing_drivers = 0;
+
+# Are we missing any stp printers?
+for (keys(%stpdata)) {
+ if (!defined($mapstp{$_})) {
+ $missing_drivers = 1;
+ warn "No foomatic printer IDs for gimp-print printer $_.\n";
+ }
+}
+
+if ($missing_drivers) {
+ die "Cannot continue\n";
+}
+
+# Figure out version etc
+open PIPE, "./gimp-print-version|" or die "Cannot run gimp-print-version: $!\n";
+my $stpvers = <PIPE>;
+close PIPE or die "Cannot run gimp-print-version: $!\n";
+chomp $stpvers;
+print STDERR "Using drivername gimp-print\n";
+
+# Build <printers> clause...
+my @printerlist = ();
+push (@printerlist, " <printers>\n");
+my $p1;
+for $p1 (keys(%mapstp)) {
+ push (@printerlist, " <!-- gimp-print driver: $p1 -->\n");
+ for (@{$mapstp{$p1}}) {
+ push(@printerlist, " <printer><id>$_</id></printer>\n");
+ }
+}
+push (@printerlist, " </printers>\n");
+
+my $generalsubs = { 'STPVER' => $stpvers,
+ 'DRVNAME' => "gimp-print",
+ 'STPRINTERS' => join('', @printerlist) };
+
+my @numericsubs = ('MINVAL', 'MAXVAL', 'DEFVAL');
+
+opendir TDIR, "foomatic-templates" or die "Cannot open templates directory: $!\n";
+
+# OK, make the db heirarchy alongside the templates one...
+mkdir 'foomatic-db', 0755 or die "Cannot create directory foomatic-db: $!\n"
+ unless -d 'foomatic-db';
+mkdir 'foomatic-db/opt', 0755 or die "Cannot create directory foomatic-db/opt: $!\n"
+ unless -d 'foomatic-db/opt';
+mkdir 'foomatic-db/driver', 0755 or die "Cannot create directory foomatic-db/driver: $!\n"
+ unless -d 'foomatic-db/driver';
+
+# Now do stuff, already. Do the substitution into each file...
+my $tmpl;
+while ($tmpl=readdir(TDIR)) {
+ next if ($tmpl !~ m!.+\.xml$!);
+
+ my $fooopt = $tmpl;
+ $fooopt =~ s!\.xml$!!;
+ my $stpopt = $argnamemap{$fooopt};
+ $stpopt = $fooopt if ! defined ($stpopt);
+
+# print STDERR "Argnamemap '$fooopt' => '$stpopt'\n";
+
+ open TMPL, "foomatic-templates/$tmpl";
+ my @datafile = <TMPL>;
+ close TMPL;
+
+ print STDERR "Processing $tmpl...";
+
+ my $template = join('',@datafile);
+
+ # First, do the generic substitutions.
+
+ my ($substr);
+ for $substr (keys(%$generalsubs)) {
+ my $substitution = $generalsubs->{$substr};
+ $template =~ s!\@\@$substr\@\@!$substitution!g;
+ }
+
+ # Now do the numeric substitutions
+
+ for $substr (@numericsubs) {
+ my $substitution = $stp_values{$substr}{$stpopt};
+ $template =~ s!\@\@$substr\@\@!$substitution!g;
+ }
+
+ # Now do special-purpose substitutions
+
+ for $substr (keys(%{$funcs->{$fooopt}})) {
+ my $substitution = &{$funcs->{$fooopt}{$substr}}($stpopt);
+ if (defined($substitution)) {
+ $template =~ s!\@\@$substr\@\@!$substitution!g;
+ }
+ }
+
+ # Any more?
+ grep (m!\@\@([^\@]+)\@\@!g
+ && do { warn " Unknown substitution $1 in $tmpl!\n"; },
+ split("\n",$template));
+
+ # Finally, write out the new file
+
+ # Options are under opt/
+ my $dbfilename = lc("foomatic-db/opt/gimp-print-$tmpl");
+
+ # Special case the actual driver file under driver/
+ $dbfilename = "foomatic-db/driver/gimp-print.xml"
+ if ($tmpl eq 'gimp-print.xml');
+
+ open NEWF, "> $dbfilename" or die "Cannot create $dbfilename: $!";
+ print STDERR "writing $dbfilename...";
+ print NEWF $template;
+ print STDERR "done.\n";
+ close NEWF;
+
+}
+
+
+
+sub get_ev_shortname {
+ my ($val) = @_;
+ $val =~ s/ //g;
+ $val =~ s/\///g;
+ $val =~ s/\://g;
+ return $val;
+}
+
+sub get_ev_key {
+ my ($val, $drv) = @_;
+ return ("ev/$drv-" . get_ev_shortname($val));
+}
+
+sub build_ev {
+ my ($stpopt) = @_;
+ my $drvname = $generalsubs->{'DRVNAME'};
+
+ my @vals = ();
+
+ # OK, now for each enum_val
+ my $ev;
+ for $ev (@{$ev_choices{$stpopt}}) {
+ # Put in the basic choice info: ev names, etc
+ my $ev_longname = @$ev[1];
+ my $ev_shortname = @$ev[0];
+ my $ev_id = get_ev_key($ev_shortname, $drvname);
+ my $ev_driverval;
+
+ # Either call a per-option function to get the driverval, or
+ # just use the string choice name.
+ if (defined($drivervals->{$stpopt})) {
+ $ev_driverval = &{$drivervals->{$stpopt}}($ev_shortname);
+ die "Undefined driverval for option $stpopt value $ev_shortname!\n"
+ if (! defined($ev));
+ } else {
+ $ev_driverval = $ev_shortname;
+ }
+ push (@vals,
+ " <enum_val id='$ev_id'>\n",
+ " <ev_longname><en>$ev_longname</en></ev_longname>\n",
+ " <ev_shortname><en>$ev_shortname</en></ev_shortname>\n",
+ " <ev_driverval>$ev_driverval</ev_driverval>\n",
+ " <constraints>\n",
+ " <!-- Assume the option doesn't apply... -->\n",
+ " <constraint sense='false'>\n",
+ " <driver>$drvname</driver>\n",
+ " </constraint>\n");
+
+ # Build constraints for this particular ev
+ my $stpprn;
+ for $stpprn (keys(%stpdata)) {
+ my $fooprn;
+ for $fooprn (@{$mapstp{$stpprn}}) {
+ if ($stpdata{$stpprn}{$stpopt}{$ev_shortname}) {
+ # OK, this choice applies to this enum
+ push (@vals,
+ " <constraint sense='true'>\n",
+ " <!-- $fooprn == $stpprn -->\n",
+ " <driver>$drvname</driver>\n",
+ " <printer>$fooprn</printer>\n",
+ " </constraint>\n");
+ }
+ }
+ }
+
+ push (@vals,
+ " </constraints>\n",
+ " </enum_val>\n");
+ }
+
+ return join('',
+ "<enum_vals>\n",
+ @vals,
+ " </enum_vals>\n");
+}
+
+sub build_cons {
+
+ my ($stpopt) = @_;
+
+ my $drvname = $generalsubs->{'DRVNAME'};
+
+ my @PNCONS = ();
+
+ # For each stp printer...
+ my $stpname;
+ for $stpname (keys(%stpdata)) {
+
+ if (0) {
+ print STDERR " Processing gimp-print printer $stpname...\n";
+ print STDERR
+ " There are no foomatic printers mapped to $stpname!?\n"
+ if !$mapstp{$stpname};
+ print STDERR " \%stpdata key is {$stpname}{$stpopt}\n";
+ }
+
+ # Add to this printer to argument constraints?
+ if ($stpdata{$stpname}{$stpopt}) {
+
+ # What's the default value?
+ my $stpdef = $defaults{$stpname}{$stpopt};
+
+ # If there's no default, then this option doesn't apply to
+ # this printer.
+ if (defined($stpdef)) {
+
+ my $foodefval = get_ev_key($stpdef, $drvname);
+
+ if (0) {
+ print STDERR
+ " Default for $stpname/$stpopt is $stpdef aka $foodefval\n";
+ }
+
+ my $fooname;
+ for $fooname (@{$mapstp{$stpname}}) {
+
+ if (0) {
+ print STDERR
+ " Printer $fooname takes option $stpopt.\n";
+ }
+
+ push (@PNCONS,
+ " <constraint sense='true'>\n",
+ " <driver>gimp-print</driver>\n",
+ " <printer>$fooname</printer><!-- gimp-print name: $stpname -->\n",
+ " <arg_defval>$foodefval</arg_defval>\n",
+ " </constraint>\n");
+ }
+ }
+ }
+
+ }
+
+ return join('',
+ "<constraints>\n",
+ @PNCONS,
+ " </constraints>\n");
+}
+
+sub optmap_pagesize {
+ my ($value) = @_;
+
+ if (!defined $pagemap) {
+ open PUTIL, "./paper_sizes |" or die "Cannot run paper_sizes: $!\n";
+ while (<PUTIL>) {
+ chomp;
+ $_ =~ m!^\s*(.+\S)\s+([0-9]+)\s+([0-9]+)\s*$!;
+ my ($name, $width, $height) = ($1, $2, $3);
+ if ($width >= 0 and $height >= 0) {
+ $pagemap->{$name} = "$width $height";
+# print STDERR "PageSize '$name' driverval '$width $height'\n";
+ }
+ }
+ close PUTIL;
+ }
+
+ return $pagemap->{$value}
+}
+
+sub optmap_color {
+ my ($value) = @_;
+ if (defined $colormap{$value}) {
+ return $colormap{$value};
+ } else {
+ die "Cannot map output type '$value'\n";
+ }
+}
+
+sub build_model_cons {
+ my ($stpopt) = @_;
+ my $drvname = $generalsubs->{'DRVNAME'};
+
+
+ # OK, this is funky. For each stp model, we have a choice. That
+ # choice is valid for only the foo printers that correspond. For
+ # any given foo printer, there is *exactly one* available choice.
+ # The defval is the one available choice. Backends and
+ # applications do not show choices with only one option; they just
+ # select that option. So we don't bother to make pretty option
+ # names or anything.
+ #
+ # See also build_model_ev()
+
+ my @PNCONS = ();
+
+ # For each stp printer...
+ my $stpname;
+ for $stpname (keys(%mapstp)) {
+
+ # For each possible foo name
+ my $fooname;
+ for $fooname (@{$mapstp{$stpname}}) {
+
+ # What's the default value?
+ my $foodefval = get_ev_key($stpname, $drvname);
+
+ push (@PNCONS,
+ " <constraint sense='true'>\n",
+ " <driver>$drvname</driver>\n",
+ " <printer>$fooname</printer>\n",
+ " <arg_defval>$foodefval</arg_defval>\n",
+ " </constraint>\n");
+ }
+ }
+
+ return join('',
+ "<constraints>\n",
+ @PNCONS,
+ " </constraints>\n");
+
+
+}
+
+# See build_model_cons, above.
+sub build_model_ev {
+ my ($stpopt) = @_;
+ my $drvname = $generalsubs->{'DRVNAME'};
+
+ my @vals = ();
+
+ # OK, now for each enum_val
+ my $ev;
+ for $ev (keys(%mapstp)) {
+ # Put in the basic choice info: ev names, etc
+ my $ev_shortname = $ev;
+ my $ev_longname = $printer_name{$ev};
+ my $ev_shortname = get_ev_shortname($ev);
+ my $ev_id = get_ev_key($ev, $drvname);
+ my $ev_driverval = $ev;
+
+ push (@vals,
+ " <enum_val id='$ev_id'>\n",
+ " <ev_longname><en>$ev_longname</en></ev_longname>\n",
+ " <ev_shortname><en>$ev_shortname</en></ev_shortname>\n",
+ " <ev_driverval>$ev_driverval</ev_driverval>\n",
+ " <constraints>\n",
+ " <!-- Assume the option doesn't apply... -->\n",
+ " <constraint sense='false'>\n",
+ " <driver>$drvname</driver>\n",
+ " </constraint>\n",
+ " <!-- ...except to these: -->\n",
+ );
+
+ # This stp Model value applies only to mapped foo printers
+ my $fooprn;
+ for $fooprn (@{$mapstp{$ev}}) {
+
+ # OK, this choice applies to this enum
+ push (@vals,
+ " <constraint sense='true'>\n",
+ " <!-- Model $ev for $fooprn -->\n",
+ " <driver>$drvname</driver>\n",
+ " <printer>$fooprn</printer>\n",
+ " </constraint>\n");
+ }
+
+ push (@vals,
+ " </constraints>\n",
+ " </enum_val>\n");
+ }
+
+ return join('',
+ "<enum_vals>\n",
+ @vals,
+ " </enum_vals>\n");
+}
+
+
+# Stuff for Resolution.
+#
+# printer_options gives us Quality information. We examine this to
+# determine what to do for the gs resolution argument:
+#
+# - Is this a 180/360/720 printer or a 150/300/600 printer?
+#
+# - What are the legal resolutions? Sort of parse and compute these
+# from the Resolution values.
+#
+# The driverval is "x y", and gets passedin a /HWResolution ps clause
+
+sub compute_resolutions {
+ my ($stpname) = @_;
+
+ if (!defined($rescache{$stpname})) {
+
+ my @reslist = ();
+ my %hash;
+ my $defval;
+
+ my $qual;
+ for $qual (keys(%{$stpdata{$stpname}{'Resolution'}})) {
+ $qual =~ m!(\d+)\s*(x\s*(\d+))?!;
+ my ($x, $y) = ($1, $3);
+ $y = $x if !defined($y);
+
+ my $r = {'x' => $x,
+ 'y' => $y,
+ 'driverval' => "$x $y",
+ 'ev_key' => get_ev_key("res-$x-$y", "gimp-print")
+ };
+ push (@reslist, $r);
+
+ # Default?
+ $defval = get_ev_key("res-$x-$y", "gimp-print")
+ if ($qual eq $defaults{$stpname}{'Resolution'});
+
+ # Note that this resolution value exists
+ $resolutions{"$x $y"} = { 'x' => $x,
+ 'y' => $y };
+
+ # Note that this printer takes this resolution
+ $hash{$x}{$y} = 1;
+
+ }
+
+ $rescache{$stpname}{'list'} = \@reslist;
+ $rescache{$stpname}{'defval'} = $defval;
+ $rescache{$stpname}{'takesit'} = \%hash;
+
+ die "No default gsResolution found for printer $stpname!?\n"
+ if ! defined($defval);
+ }
+
+ return $rescache{$stpname};
+}
+
+sub do_all_res {
+ my $n;
+ for $n (keys(%mapstp)) {
+ compute_resolutions($n);
+ }
+}
+
+sub build_resolution_ev {
+ my ($stpopt) = @_;
+ my $drvname = $generalsubs->{'DRVNAME'};
+
+ my @vals = ();
+
+ do_all_res();
+
+ # OK, now for each possible resolution...
+ my $ev;
+ for $ev (keys(%resolutions)) {
+
+ my ($x, $y) = ($resolutions{$ev}{'x'}, $resolutions{$ev}{'y'});
+
+ # Put in the basic choice info: ev names, etc
+ my $ev_longname = "$x x $y DPI";
+ my $ev_shortname = get_ev_shortname($ev_longname);
+ my $ev_id = get_ev_key("res-$x-$y", $drvname);
+ my $ev_driverval = "$x $y";
+
+ push (@vals,
+ " <enum_val id='$ev_id'>\n",
+ " <ev_longname><en>$ev_longname</en></ev_longname>\n",
+ " <ev_shortname><en>$ev_shortname</en></ev_shortname>\n",
+ " <ev_driverval>$ev_driverval</ev_driverval>\n",
+ " <constraints>\n",
+ " <!-- Assume the option doesn't apply... -->\n",
+ " <constraint sense='false'>\n",
+ " <driver>$drvname</driver>\n",
+ " </constraint>\n",
+ " <!-- ...except to these: -->\n",
+ );
+
+ # Now, for each printer, put in a constraint if this
+ # resolution makes sense or not...
+ my $stpprn;
+ for $stpprn (keys(%mapstp)) {
+
+ my $resobj = compute_resolutions($stpprn);
+ my $takesit = $resobj->{'takesit'}{$x}{$y};
+
+ if ($takesit) {
+ my $fooprn;
+ for $fooprn (@{$mapstp{$stpprn}}) {
+
+# print STDERR "Printer $fooprn $stpprn uses ${x}x$y\n";
+
+ # OK, this choice applies to this enum
+ push (@vals,
+ " <constraint sense='true'>\n",
+ " <driver>$drvname</driver>\n",
+ " <printer>$fooprn</printer><!-- stpname: $stpprn -->\n",
+ " </constraint>\n");
+ }
+ }
+
+ }
+
+ push (@vals,
+ " </constraints>\n",
+ " </enum_val>\n");
+ }
+
+ return join('',
+ "<enum_vals>\n",
+ @vals,
+ " </enum_vals>\n");
+}
+
+sub build_resolution_cons {
+ my ($stpopt) = @_;
+ my $drvname = $generalsubs->{'DRVNAME'};
+
+ my @PNCONS = ();
+
+ # For each stp printer...
+ my $stpname;
+ for $stpname (keys(%mapstp)) {
+
+ # Get some resolution info
+ my $r = compute_resolutions($stpname);
+
+ # For each possible foo name
+ my $fooname;
+ for $fooname (@{$mapstp{$stpname}}) {
+
+ # What's the default value?
+ my $foodefval = $r->{'defval'};
+
+ push (@PNCONS,
+ " <constraint sense='true'>\n",
+ " <driver>$drvname</driver>\n",
+ " <printer>$fooname</printer><!-- stpname: $stpname -->\n",
+ " <arg_defval>$foodefval</arg_defval>\n",
+ " </constraint>\n");
+ }
+ }
+
+ return join('',
+ "<constraints>\n",
+ @PNCONS,
+ " </constraints>\n");
+}
+
+
+exit(0);
+
diff --git a/src/foomatic/foomatic-printermap b/src/foomatic/foomatic-printermap
new file mode 100644
index 0000000..55d5faf
--- /dev/null
+++ b/src/foomatic/foomatic-printermap
@@ -0,0 +1,294 @@
+#gptofoo bjc-30 printer/423826
+#gptofoo bjc-50 printer/551346
+#gptofoo bjc-55 printer/551282
+#gptofoo bjc-80 printer/96512
+#gptofoo bjc-85 printer/551410
+#gptofoo bjc-210 printer/58752
+#gptofoo bjc-240 printer/58816
+#gptofoo bjc-250 printer/60384
+#gptofoo bjc-1000 printer/139017
+#gptofoo bjc-2000 printer/89152
+#gptofoo bjc-3000 printer/129472
+#gptofoo bjc-4300 printer/60544
+#gptofoo bjc-4400 printer/62240
+#gptofoo bjc-6000 printer/71392
+#gptofoo bjc-6100 printer/317225
+#gptofoo bjc-6200 printer/413673
+#gptofoo bjc-6500 printer/272681
+#gptofoo bjc-7000 printer/60672
+#gptofoo bjc-7100 printer/114656
+#gptofoo bjc-8200 printer/123776
+#gptofoo bjc-s400 printer/602258
+#gptofoo bjc-s450 printer/479986
+#gptofoo bjc-s800 printer/Canon-S800
+#gptofoo bjc-s4500 printer/602386
+#gptofoo escp2-c20sx printer/Epson-Stylus_C20SX
+#gptofoo escp2-c20ux printer/Epson-Stylus_C20UX
+#gptofoo escp2-c40sx printer/Epson-Stylus_C40SX
+#gptofoo escp2-c40ux printer/Epson-Stylus_C40UX
+#gptofoo escp2-c60 printer/Epson-Stylus_C60
+#gptofoo escp2-c70 printer/Epson-Stylus_C70
+#gptofoo escp2-c80 printer/Epson-Stylus_C80
+#gptofoo escp2 printer/61184
+#gptofoo escp2-pro printer/25824
+#gptofoo escp2-pro-xl printer/65856
+#gptofoo escp2-400 printer/62912
+#gptofoo escp2-440 printer/75296
+#gptofoo escp2-460 printer/73472
+#gptofoo escp2-480 printer/317321
+#gptofoo escp2-500 printer/214153
+#gptofoo escp2-580 printer/607474
+#gptofoo escp2-600 printer/26016
+#gptofoo escp2-640 printer/66016
+#gptofoo escp2-660 printer/244361
+#gptofoo escp2-670 printer/266313
+#gptofoo escp2-680 printer/517810
+#gptofoo escp2-740 printer/62112
+#gptofoo escp2-760 printer/96288
+#gptofoo escp2-777 printer/464242
+#gptofoo escp2-800 printer/61344
+#gptofoo escp2-850 printer/63840
+#gptofoo escp2-860 printer/80896
+#gptofoo escp2-880 printer/317801
+#gptofoo escp2-83 printer/Epson-Stylus_Color_8_3
+#gptofoo escp2-900 printer/92192
+#gptofoo escp2-980 printer/317865
+#gptofoo escp2-1160 printer/317481
+#gptofoo escp2-1500 printer/317385
+#gptofoo escp2-1520 printer/20672
+#gptofoo escp2-3000 printer/208969
+#gptofoo escp2-photo printer/83520
+#gptofoo escp2-700 printer/71424
+#gptofoo escp2-ex printer/75808
+#gptofoo escp2-720 printer/317545
+#gptofoo escp2-750 printer/60128
+#gptofoo escp2-780 printer/Epson-Stylus_Photo_780
+#gptofoo escp2-785 printer/Epson-Stylus_Photo_785
+#gptofoo escp2-790 printer/Epson-Stylus_Photo_790
+#gptofoo escp2-810 printer/Epson-Stylus_Photo_810
+#gptofoo escp2-820 printer/Epson-Stylus_Photo_820
+#gptofoo escp2-870 printer/284105
+#gptofoo escp2-875 printer/Epson-Stylus_Photo_875
+#gptofoo escp2-890 printer/Epson-Stylus_Photo_890
+#gptofoo escp2-895 printer/Epson-Stylus_Photo_895
+#gptofoo escp2-1200 printer/167008
+#gptofoo escp2-1270 printer/284169
+#gptofoo escp2-1280 printer/Epson-Stylus_Photo_1280
+#gptofoo escp2-1290 printer/Epson-Stylus_Photo_1290
+#gptofoo escp2-2000 printer/317609
+#gptofoo escp2-5000 printer/Epson-Stylus_Pro_5000
+#gptofoo escp2-5500 printer/Epson-Stylus_Pro_5500
+#gptofoo escp2-7000 printer/Epson-Stylus_Pro_7000
+#gptofoo escp2-7500 printer/Epson-Stylus_Pro_7500
+#gptofoo escp2-9000 printer/Epson-Stylus_Pro_9000
+#gptofoo escp2-9500 printer/Epson-Stylus_Pro_9500
+#gptofoo escp2-10000 printer/Epson-Stylus_Pro_10000
+#gptofoo escp2-scan2000 printer/Epson-Stylus_Scan_2000
+#gptofoo escp2-scan2500 printer/516274
+#gptofoo pcl-340 printer/153056
+#gptofoo pcl-400 printer/63040
+#gptofoo pcl-500 printer/58363
+#gptofoo pcl-501 printer/79840
+#gptofoo pcl-520 printer/129184
+#gptofoo pcl-540 printer/99616
+#gptofoo pcl-550 printer/58464
+#gptofoo pcl-560 printer/22624
+#gptofoo pcl-600 printer/64576
+#gptofoo pcl-601 printer/206505
+#gptofoo pcl-601 printer/219977
+#gptofoo pcl-601 printer/174249
+#gptofoo pcl-601 printer/64192
+#gptofoo pcl-601 printer/60928
+#gptofoo pcl-601 printer/68512
+#gptofoo pcl-601 printer/624114
+#gptofoo pcl-601 printer/75520
+#gptofoo pcl-601 printer/HP-DeskJet_640C
+#gptofoo pcl-601 printer/448242
+#gptofoo pcl-690 printer/60960
+#gptofoo pcl-690 printer/249705
+#gptofoo pcl-690 printer/HP-DeskJet_693C
+#gptofoo pcl-690 printer/70560
+#gptofoo pcl-690 printer/HP-DeskJet_695C
+#gptofoo pcl-690 printer/68672
+#gptofoo pcl-750 printer/HP-DesignJet_750
+#gptofoo pcl-750 printer/122496
+#gptofoo pcl-810 printer/156105
+#gptofoo pcl-810 printer/HP-DeskJet_830C
+#gptofoo pcl-810 printer/250601
+#gptofoo pcl-812 printer/161705
+#gptofoo pcl-812 printer/293641
+#gptofoo pcl-840 printer/133664
+#gptofoo pcl-842 printer/133152
+#gptofoo pcl-845 printer/HP-DeskJet_845C
+#gptofoo pcl-850 printer/61024
+#gptofoo pcl-855 printer/60992
+#gptofoo pcl-870 printer/60256
+#gptofoo pcl-890 printer/226985
+#gptofoo pcl-895 printer/72000
+#gptofoo pcl-900 printer/175232
+#gptofoo pcl-900 printer/108320
+#gptofoo pcl-900 printer/273833
+#gptofoo pcl-900 printer/HP-DeskJet_952C
+#gptofoo pcl-900 printer/186729
+#gptofoo pcl-900 printer/530418
+#gptofoo pcl-1100 printer/22720
+#gptofoo pcl-1120 printer/76896
+#gptofoo pcl-1200 printer/63712
+#gptofoo pcl-1220 printer/290953
+#gptofoo pcl-1600 printer/61120
+#gptofoo pcl-1600 printer/61152
+#gptofoo pcl-2000 printer/65984
+#gptofoo pcl-2500 printer/64512
+#gptofoo pcl-P1000 printer/131424
+#gptofoo pcl-P1100 printer/259689
+#gptofoo pcl-2 printer/114592
+#gptofoo pcl-2 printer/234953
+#gptofoo pcl-2 printer/48064
+#gptofoo pcl-2 printer/195529
+#gptofoo pcl-2 printer/316361
+#gptofoo pcl-2 printer/547378
+#gptofoo pcl-2 printer/110624
+#gptofoo pcl-2 printer/63200
+#gptofoo pcl-2 printer/487986
+#gptofoo pcl-2 printer/552146
+#gptofoo pcl-2 printer/114816
+#gptofoo pcl-2 printer/108896
+#gptofoo pcl-2 printer/178185
+#gptofoo pcl-2 printer/63904
+#gptofoo pcl-2 printer/204617
+#gptofoo pcl-2 printer/74592
+#gptofoo pcl-2 printer/231689
+#gptofoo pcl-2 printer/195593
+#gptofoo pcl-2 printer/365417
+#gptofoo pcl-2 printer/94016
+#gptofoo pcl-2 printer/144320
+#gptofoo pcl-2 printer/123968
+#gptofoo pcl-2 printer/81408
+#gptofoo pcl-2 printer/211017
+#gptofoo pcl-2 printer/81568
+#gptofoo pcl-2 printer/160288
+#gptofoo pcl-2 printer/23104
+#gptofoo pcl-2 printer/74176
+#gptofoo pcl-2 printer/34016
+#gptofoo pcl-2 printer/70720
+#gptofoo pcl-2 printer/117472
+#gptofoo pcl-2 printer/61824
+#gptofoo pcl-2 printer/61728
+#gptofoo pcl-2 printer/61888
+#gptofoo pcl-2 printer/70016
+#gptofoo pcl-2 printer/194601
+#gptofoo pcl-2 printer/196201
+#gptofoo pcl-2 printer/65280
+#gptofoo pcl-2 printer/312329
+#gptofoo pcl-2 printer/312393
+#gptofoo pcl-2 printer/80160
+#gptofoo pcl-3 printer/65696
+#gptofoo pcl-3 printer/48064
+#gptofoo pcl-3 printer/141417
+#gptofoo pcl-3 printer/257577
+#gptofoo pcl-3 printer/135401
+#gptofoo pcl-3 printer/67456
+#gptofoo pcl-3 printer/373513
+#gptofoo pcl-3 printer/619666
+#gptofoo pcl-3 printer/69472
+#gptofoo pcl-3 printer/78144
+#gptofoo pcl-3 printer/86176
+#gptofoo pcl-3 printer/487986
+#gptofoo pcl-3 printer/114816
+#gptofoo pcl-3 printer/65312
+#gptofoo pcl-3 printer/96480
+#gptofoo pcl-3 printer/23168
+#gptofoo pcl-4 printer/190793
+#gptofoo pcl-4 printer/63584
+#gptofoo pcl-4 printer/63552
+#gptofoo pcl-4 printer/539634
+#gptofoo pcl-4 printer/63456
+#gptofoo pcl-4 printer/73216
+#gptofoo pcl-4 printer/99840
+#gptofoo pcl-4 printer/185225
+#gptofoo pcl-4 printer/78336
+#gptofoo pcl-4 printer/165408
+#gptofoo pcl-4 printer/165536
+#gptofoo pcl-4 printer/121952
+#gptofoo pcl-4 printer/63008
+#gptofoo pcl-4 printer/56672
+#gptofoo pcl-4 printer/158569
+#gptofoo pcl-4 printer/633554
+#gptofoo pcl-4 printer/76224
+#gptofoo pcl-4 printer/116256
+#gptofoo pcl-4 printer/491506
+#gptofoo pcl-4 printer/75104
+#gptofoo pcl-4 printer/69120
+#gptofoo pcl-4 printer/69088
+#gptofoo pcl-4 printer/230377
+#gptofoo pcl-4 printer/439570
+#gptofoo pcl-4 printer/191689
+#gptofoo pcl-4 printer/128576
+#gptofoo pcl-4 printer/311113
+#gptofoo pcl-4 printer/619538
+#gptofoo pcl-4 printer/59584
+#gptofoo pcl-4 printer/63648
+#gptofoo pcl-4 printer/66496
+#gptofoo pcl-4 printer/76064
+#gptofoo pcl-4 printer/76096
+#gptofoo pcl-4 printer/66528
+#gptofoo pcl-4 printer/61856
+#gptofoo pcl-4 printer/129376
+#gptofoo pcl-4 printer/63616
+#gptofoo pcl-4 printer/194697
+#gptofoo pcl-4 printer/64032
+#gptofoo pcl-4 printer/62976
+#gptofoo pcl-4 printer/77088
+#gptofoo pcl-4 printer/188457
+#gptofoo pcl-4 printer/421586
+#gptofoo pcl-4 printer/490898
+#gptofoo pcl-4 printer/32672
+#gptofoo pcl-4 printer/210153
+#gptofoo pcl-4 printer/32768
+#gptofoo pcl-4 printer/42048
+#gptofoo pcl-4 printer/87552
+#gptofoo pcl-4 printer/77152
+#gptofoo pcl-4 printer/70752
+#gptofoo pcl-4 printer/113888
+#gptofoo pcl-4l printer/257577
+#gptofoo pcl-4l printer/59776
+#gptofoo pcl-4l printer/82496
+#gptofoo pcl-4v printer/439378
+#gptofoo pcl-5 printer/63520
+#gptofoo pcl-4 printer/62720
+#gptofoo pcl-5 printer/75168
+#gptofoo pcl-5si printer/605074
+#gptofoo pcl-6 printer/551474
+#gptofoo pcl-6 printer/77248
+#gptofoo pcl-6 printer/77216
+#gptofoo pcl-6 printer/234281
+#gptofoo pcl-6 printer/642674
+#gptofoo pcl-6 printer/102080
+#gptofoo pcl-6 printer/334409
+#gptofoo pcl-6 printer/32736
+#gptofoo pcl-6 printer/32832
+#gptofoo pcl-6 printer/212905
+#gptofoo pcl-6 printer/581554
+#gptofoo pcl-6 printer/23232
+#gptofoo pcl-6 printer/62368
+#gptofoo pcl-6 printer/64096
+#gptofoo pcl-6 printer/474610
+#gptofoo pcl-6 printer/609714
+#gptofoo pcl-6 printer/100576
+#gptofoo pcl-6 printer/62304
+#gptofoo pcl-6 printer/247625
+#gptofoo pcl-6 printer/543058
+#gptofoo pcl-6 printer/287337
+#gptofoo pcl-6 printer/62816
+#gptofoo pcl-6 printer/71680
+#gptofoo pcl-6 printer/HP-LaserJet_1200
+#gptofoo pcl-6 printer/HP-LaserJet_1220
+#gptofoo pcl-6 printer/HP-LaserJet_2200
+#gptofoo pcl-6 printer/HP-LaserJet_3200m
+#gptofoo pcl-6 printer/HP-LaserJet_4100
+#gptofoo pcl-6 printer/HP-LaserJet_8150
+#gptofoo pcl-6 printer/HP-LaserJet_9000
+#gptofoo lexmark-4076 printer/Lexmark-4076
+#gptofoo lexmark-z42 printer/593266
+#gptofoo lexmark-z43 printer/Lexmark-Z43
+#gptofoo lexmark-z52 printer/328553
diff --git a/src/foomatic/foomatic-templates/Brightness.xml b/src/foomatic/foomatic-templates/Brightness.xml
new file mode 100644
index 0000000..dade025
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Brightness.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-brightness">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>StpBrightness</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>StpBrightness</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Brightness %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/Color.xml b/src/foomatic/foomatic-templates/Color.xml
new file mode 100644
index 0000000..4645b92
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Color.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-color">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Output Type</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>OutputType</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Color %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/Contrast.xml b/src/foomatic/foomatic-templates/Contrast.xml
new file mode 100644
index 0000000..aa5d31a
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Contrast.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-contrast">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Contrast Level</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Contrast</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Contrast %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/Cyan.xml b/src/foomatic/foomatic-templates/Cyan.xml
new file mode 100644
index 0000000..04c9fe0
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Cyan.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-cyan">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Cyan Level</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Cyan</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Cyan %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/Density.xml b/src/foomatic/foomatic-templates/Density.xml
new file mode 100644
index 0000000..364e880
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Density.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-density">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Density</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Density</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Density %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/Dither.xml b/src/foomatic/foomatic-templates/Dither.xml
new file mode 100644
index 0000000..e94694c
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Dither.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-dither">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Dither Algorithm</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Dither</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Dither(%s)&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/Gamma.xml b/src/foomatic/foomatic-templates/Gamma.xml
new file mode 100644
index 0000000..b0cd4e4
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Gamma.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-gamma">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>StpGamma</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>StpGamma</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Gamma %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/ImageType.xml b/src/foomatic/foomatic-templates/ImageType.xml
new file mode 100644
index 0000000..998fad0
--- /dev/null
+++ b/src/foomatic/foomatic-templates/ImageType.xml
@@ -0,0 +1,63 @@
+<option type="enum" id="opt/@@DRVNAME@@-imagetype">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Image Type</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>ImageType</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/ImageType %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DRVNAME@@-LineArt</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="@@DRVNAME@@-LineArt">
+ <ev_longname>
+ <en>Line art</en>
+ </ev_longname>
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <ev_shortname>
+ <en>LineArt</en>
+ <!-- Until someone tells me how to learn the user locale in
+ backends, the shortname must be monolingual in <en>! -->
+ </ev_shortname>
+ <ev_driverval>0</ev_driverval>
+ </enum_val>
+ <enum_val id="@@DRVNAME@@-SolidColors">
+ <ev_longname>
+ <en>Primarily solid colors or smooth gradients</en>
+ </ev_longname>
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <ev_shortname>
+ <en>Solids</en>
+ <!-- Until someone tells me how to learn the user locale in
+ backends, the shortname must be monolingual in <en>! -->
+ </ev_shortname>
+ <ev_driverval>1</ev_driverval>
+ </enum_val>
+ <enum_val id="@@DRVNAME@@-Photographs">
+ <ev_longname>
+ <en>Continuous-tone photographs</en>
+ </ev_longname>
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <ev_shortname>
+ <en>Photographs</en>
+ <!-- Until someone tells me how to learn the user locale in
+ backends, the shortname must be monolingual in <en>! -->
+ </ev_shortname>
+ <ev_driverval>2</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/src/foomatic/foomatic-templates/InkType.xml b/src/foomatic/foomatic-templates/InkType.xml
new file mode 100644
index 0000000..25f6d17
--- /dev/null
+++ b/src/foomatic/foomatic-templates/InkType.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-inktype">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Ink Type</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>InkType</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/InkType(%s)&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/InputSlot.xml b/src/foomatic/foomatic-templates/InputSlot.xml
new file mode 100644
index 0000000..bd03051
--- /dev/null
+++ b/src/foomatic/foomatic-templates/InputSlot.xml
@@ -0,0 +1,20 @@
+<option type="enum" id="opt/@@DRVNAME@@-inputslot">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Input Slot</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>InputSlot</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/InputSlot(%s)&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/Magenta.xml b/src/foomatic/foomatic-templates/Magenta.xml
new file mode 100644
index 0000000..15da1b9
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Magenta.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-magenta">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Magenta Level</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Magenta</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Magenta %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/MediaType.xml b/src/foomatic/foomatic-templates/MediaType.xml
new file mode 100644
index 0000000..a5e1ec8
--- /dev/null
+++ b/src/foomatic/foomatic-templates/MediaType.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-mediatype">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Media Type</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>MediaType</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/stpMediaType(%s)&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/Model.xml b/src/foomatic/foomatic-templates/Model.xml
new file mode 100644
index 0000000..98e081a
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Model.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-model">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Printer Model</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Model</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>10</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto> -sModel=%s</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/PageSize.xml b/src/foomatic/foomatic-templates/PageSize.xml
new file mode 100644
index 0000000..137e2e6
--- /dev/null
+++ b/src/foomatic/foomatic-templates/PageSize.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-pagesize">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Page Size</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>PageSize</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>Z</arg_spot>
+ <arg_required />
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/PageSize[%s]/ImagingBBox null&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/Quality.xml b/src/foomatic/foomatic-templates/Quality.xml
new file mode 100644
index 0000000..e3ba47b
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Quality.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-quality">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Quality</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Quality</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>Z</arg_spot>
+ <arg_required />
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Quality(%s)&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/Resolution.xml b/src/foomatic/foomatic-templates/Resolution.xml
new file mode 100644
index 0000000..f45a7f5
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Resolution.xml
@@ -0,0 +1,21 @@
+<option type="enum" id="opt/@@DRVNAME@@-resolution">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Ghostscript Resolution</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>GSResolution</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/HWResolution[%s]&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+
+ @@OPTCONSTRAINTS@@
+ @@ENUMVALS@@
+
+</option>
diff --git a/src/foomatic/foomatic-templates/Saturation.xml b/src/foomatic/foomatic-templates/Saturation.xml
new file mode 100644
index 0000000..781deea
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Saturation.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-saturation">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>StpSaturation</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>StpSaturation</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Saturation %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/Yellow.xml b/src/foomatic/foomatic-templates/Yellow.xml
new file mode 100644
index 0000000..7d93002
--- /dev/null
+++ b/src/foomatic/foomatic-templates/Yellow.xml
@@ -0,0 +1,24 @@
+<option type="float" id="opt/@@DRVNAME@@-yellow">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname>
+ <en>Yellow Level</en>
+ </arg_longname>
+ <arg_shortname>
+ <en>Yellow</en><!-- backends only know <en> shortnames! -->
+ </arg_shortname>
+ <arg_execution>
+ <arg_order>100</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_postscript />
+ <arg_proto>&lt;&lt;/Yellow %s&gt;&gt;setpagedevice</arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>@@DRVNAME@@</driver>
+ <arg_defval>@@DEFVAL@@</arg_defval>
+ </constraint>
+ </constraints>
+ <arg_max>@@MAXVAL@@</arg_max>
+ <arg_min>@@MINVAL@@</arg_min>
+</option>
diff --git a/src/foomatic/foomatic-templates/gimp-print.xml b/src/foomatic/foomatic-templates/gimp-print.xml
new file mode 100644
index 0000000..e6be537
--- /dev/null
+++ b/src/foomatic/foomatic-templates/gimp-print.xml
@@ -0,0 +1,26 @@
+<driver id="driver/@@DRVNAME@@">
+ <name>@@DRVNAME@@</name>
+ <url>http://gimp-print.sourceforge.net/</url>
+ <execution>
+ <ghostscript />
+ <prototype>gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=stp %A%Z -sOutputFile=- -</prototype>
+ </execution>
+ <comments>
+ <en>STP supports a wide variety of Epson Stylus, HP DeskJet and LaserJet,
+ and Canon BubbleJet printers, with the primary goal being
+ uncompromising quality. Epson Stylus printers in particular are
+ supported in all resolutions and modes, and the latest printers are
+ capable of producing prints that rival photographic prints in
+ quality. This package also offers much faster printing for high
+ quality text and presentation graphics when required.
+ &lt;p&gt;
+ The execution information currently here corresponds to driver version
+ @@STPVER@@.
+ &lt;p&gt;
+ To get a pre-patched/pre-compiled GNU-GhostScript 5.50 with this driver
+ (version 4.0.4) download sources and binaries of
+ &lt;a href="ftp://ftp2.easysw.com/pub/ghostscript/"&gt;ESP
+ GhostScript&lt;/a&gt;.</en>
+ </comments>
+ @@STPRINTERS@@
+</driver> \ No newline at end of file
diff --git a/src/foomatic/gimp-print-version.c b/src/foomatic/gimp-print-version.c
new file mode 100644
index 0000000..1b10dd0
--- /dev/null
+++ b/src/foomatic/gimp-print-version.c
@@ -0,0 +1,44 @@
+/*
+ * "$Id: gimp-print-version.c,v 1.2 2001/09/02 13:30:26 rlk Exp $"
+ *
+ * Dump the per-printer options for Grant Taylor's *-omatic database
+ *
+ * Copyright 2000 Robert Krawitz (rlk@alum.mit.edu)
+ *
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#ifdef INCLUDE_GIMP_PRINT_H
+#include INCLUDE_GIMP_PRINT_H
+#else
+#include <gimp-print/gimp-print.h>
+#endif
+#include "../../lib/libprintut.h"
+
+int
+main(int argc, char **argv)
+{
+#ifdef VERSION
+ printf("%s\n", VERSION);
+ return 0;
+#else
+ fprintf(stderr, "VERSION not defined!\n");
+ return 1;
+#endif
+}
diff --git a/src/foomatic/paper_sizes.c b/src/foomatic/paper_sizes.c
new file mode 100644
index 0000000..2165875
--- /dev/null
+++ b/src/foomatic/paper_sizes.c
@@ -0,0 +1,46 @@
+/*
+ * "$Id: paper_sizes.c,v 1.4 2001/09/02 13:30:26 rlk Exp $"
+ *
+ * Dump the per-printer options for Grant Taylor's *-omatic database
+ *
+ * Copyright 2000 Robert Krawitz (rlk@alum.mit.edu)
+ *
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#ifdef INCLUDE_GIMP_PRINT_H
+#include INCLUDE_GIMP_PRINT_H
+#else
+#include <gimp-print/gimp-print.h>
+#endif
+#include "../../lib/libprintut.h"
+
+int
+main(int argc, char **argv)
+{
+ int i;
+ for (i = 0; i < stp_known_papersizes(); i++)
+ {
+ const stp_papersize_t p = stp_get_papersize_by_index(i);
+ printf("%s %d %d\n", stp_papersize_get_name(p),
+ stp_papersize_get_width(p),
+ stp_papersize_get_height(p));
+ }
+ return 0;
+}
diff --git a/src/foomatic/printer_options.c b/src/foomatic/printer_options.c
new file mode 100644
index 0000000..462fb3a
--- /dev/null
+++ b/src/foomatic/printer_options.c
@@ -0,0 +1,119 @@
+/*
+ * "$Id: printer_options.c,v 1.9 2001/09/02 13:30:26 rlk Exp $"
+ *
+ * Dump the per-printer options for Grant Taylor's *-omatic database
+ *
+ * Copyright 2000 Robert Krawitz (rlk@alum.mit.edu)
+ *
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#ifdef INCLUDE_GIMP_PRINT_H
+#include INCLUDE_GIMP_PRINT_H
+#else
+#include <gimp-print/gimp-print.h>
+#endif
+#include "../../lib/libprintut.h"
+
+const char *params[] =
+{
+ "PageSize",
+ "Resolution",
+ "InkType",
+ "MediaType",
+ "InputSlot"
+};
+
+int nparams = sizeof(params) / sizeof(const char *);
+
+int
+main(int argc, char **argv)
+{
+ int i, j, k;
+ for (i = 0; i < stp_known_printers(); i++)
+ {
+ const stp_printer_t p = stp_get_printer_by_index(i);
+ const stp_vars_t pv = stp_printer_get_printvars(p);
+ stp_param_t *retval;
+ const char *retval1;
+ int count;
+ int tcount = 0;
+ printf("# Printer model %s, long name `%s'\n",
+ stp_printer_get_driver(p), stp_printer_get_long_name(p));
+ for (k = 0; k < nparams; k++)
+ {
+ retval1 = (*stp_printer_get_printfuncs(p)->default_parameters)
+ (p, NULL, params[k]);
+ if (retval1)
+ printf("$defaults{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), params[k], retval1);
+ retval = (*stp_printer_get_printfuncs(p)->parameters)(p, NULL, params[k], &count);
+ if (count > 0)
+ {
+ for (j = 0; j < count; j++)
+ {
+ printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), params[k], retval[j].name,
+ retval[j].text);
+ free((void *)retval[j].name);
+ free((void *)retval[j].text);
+ }
+ free(retval);
+ }
+ tcount += count;
+ }
+ if (tcount > 0)
+ {
+ printf("$defaults{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Dither",
+ stp_dither_algorithm_name(0));
+ for (k = 0; k < stp_dither_algorithm_count(); k++)
+ printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Dither",
+ stp_dither_algorithm_name(k),
+ stp_dither_algorithm_text(k));
+ if (stp_get_output_type(pv) == OUTPUT_COLOR)
+ {
+ printf("$defaults{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Color", "Color");
+ printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Color", "Color",
+ "Color");
+ printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Color", "Grayscale",
+ "Gray Scale");
+ printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Color", "BlackAndWhite",
+ "Black and White");
+ }
+ else
+ {
+ printf("$defaults{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Color", "Grayscale");
+ printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Color", "Grayscale",
+ "Grayscale");
+ printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
+ stp_printer_get_driver(p), "Color", "BlackAndWhite",
+ "Black and White");
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/foomatic/printers.c b/src/foomatic/printers.c
new file mode 100644
index 0000000..6e7ab31
--- /dev/null
+++ b/src/foomatic/printers.c
@@ -0,0 +1,45 @@
+/*
+ * "$Id: printers.c,v 1.2 2001/09/02 13:30:26 rlk Exp $"
+ *
+ * Dump the per-printer options for Grant Taylor's *-omatic database
+ *
+ * Copyright 2000 Robert Krawitz (rlk@alum.mit.edu)
+ *
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#ifdef INCLUDE_GIMP_PRINT_H
+#include INCLUDE_GIMP_PRINT_H
+#else
+#include <gimp-print/gimp-print.h>
+#endif
+#include "../../lib/libprintut.h"
+
+int
+main(int argc, char **argv)
+{
+ int i;
+ for (i = 0; i < stp_known_printers(); i++)
+ {
+ const stp_papersize_t p = stp_get_printer_by_index(i);
+ printf("$printer_name{'%s'} = '%s';\n", stp_printer_get_driver(p),
+ stp_printer_get_long_name(p));
+ }
+ return 0;
+}
diff --git a/src/foomatic/stp_limits.c b/src/foomatic/stp_limits.c
new file mode 100644
index 0000000..6015774
--- /dev/null
+++ b/src/foomatic/stp_limits.c
@@ -0,0 +1,98 @@
+/*
+ * "$Id: stp_limits.c,v 1.2 2001/09/02 13:30:26 rlk Exp $"
+ *
+ * Dump the per-printer options for Grant Taylor's *-omatic database
+ *
+ * Copyright 2000 Robert Krawitz (rlk@alum.mit.edu)
+ *
+ * This program 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 program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#ifdef INCLUDE_GIMP_PRINT_H
+#include INCLUDE_GIMP_PRINT_H
+#else
+#include <gimp-print/gimp-print.h>
+#endif
+#include "../../lib/libprintut.h"
+
+int
+main(int argc, char **argv)
+{
+ const stp_vars_t minimum = stp_minimum_settings();
+ const stp_vars_t maximum = stp_maximum_settings();
+ const stp_vars_t defvars = stp_default_settings();
+
+ printf("$stp_values{'MINVAL'}{'Brightness'} = %.3f\n",
+ stp_get_brightness(minimum));
+ printf("$stp_values{'MAXVAL'}{'Brightness'} = %.3f\n",
+ stp_get_brightness(maximum));
+ printf("$stp_values{'DEFVAL'}{'Brightness'} = %.3f\n",
+ stp_get_brightness(defvars));
+
+ printf("$stp_values{'MINVAL'}{'Contrast'} = %.3f\n",
+ stp_get_contrast(minimum));
+ printf("$stp_values{'MAXVAL'}{'Contrast'} = %.3f\n",
+ stp_get_contrast(maximum));
+ printf("$stp_values{'DEFVAL'}{'Contrast'} = %.3f\n",
+ stp_get_contrast(defvars));
+
+ printf("$stp_values{'MINVAL'}{'Density'} = %.3f\n",
+ stp_get_density(minimum));
+ printf("$stp_values{'MAXVAL'}{'Density'} = %.3f\n",
+ stp_get_density(maximum));
+ printf("$stp_values{'DEFVAL'}{'Density'} = %.3f\n",
+ stp_get_density(defvars));
+
+ printf("$stp_values{'MINVAL'}{'Gamma'} = %.3f\n",
+ stp_get_gamma(minimum));
+ printf("$stp_values{'MAXVAL'}{'Gamma'} = %.3f\n",
+ stp_get_gamma(maximum));
+ printf("$stp_values{'DEFVAL'}{'Gamma'} = %.3f\n",
+ stp_get_gamma(defvars));
+
+ printf("$stp_values{'MINVAL'}{'Cyan'} = %.3f\n",
+ stp_get_cyan(minimum));
+ printf("$stp_values{'MAXVAL'}{'Cyan'} = %.3f\n",
+ stp_get_cyan(maximum));
+ printf("$stp_values{'DEFVAL'}{'Cyan'} = %.3f\n",
+ stp_get_cyan(defvars));
+
+ printf("$stp_values{'MINVAL'}{'Magenta'} = %.3f\n",
+ stp_get_magenta(minimum));
+ printf("$stp_values{'MAXVAL'}{'Magenta'} = %.3f\n",
+ stp_get_magenta(maximum));
+ printf("$stp_values{'DEFVAL'}{'Magenta'} = %.3f\n",
+ stp_get_magenta(defvars));
+
+ printf("$stp_values{'MINVAL'}{'Yellow'} = %.3f\n",
+ stp_get_yellow(minimum));
+ printf("$stp_values{'MAXVAL'}{'Yellow'} = %.3f\n",
+ stp_get_yellow(maximum));
+ printf("$stp_values{'DEFVAL'}{'Yellow'} = %.3f\n",
+ stp_get_yellow(defvars));
+
+ printf("$stp_values{'MINVAL'}{'Saturation'} = %.3f\n",
+ stp_get_saturation(minimum));
+ printf("$stp_values{'MAXVAL'}{'Saturation'} = %.3f\n",
+ stp_get_saturation(maximum));
+ printf("$stp_values{'DEFVAL'}{'Saturation'} = %.3f\n",
+ stp_get_saturation(defvars));
+
+ return 0;
+}