diff options
Diffstat (limited to 'src')
109 files changed, 6323 insertions, 22408 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 0f471da..fc635f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.19 2005/11/21 11:16:22 rleigh Exp $ +## $Id: Makefile.am,v 1.20 2006/09/18 02:31:57 rlk Exp $ ## Copyright (C) 2000 Roger Leigh ## ## This program is free software; you can redistribute it and/or modify @@ -23,10 +23,8 @@ include $(top_srcdir)/scripts/global.mk SUBDIRS = \ main \ - gutenprintui \ gutenprintui2 \ escputil \ - gimp \ gimp2 \ cups \ foomatic \ diff --git a/src/Makefile.in b/src/Makefile.in index 1ce3791..77e3e94 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -41,13 +41,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -116,27 +115,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -144,13 +129,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -255,16 +233,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -293,12 +267,11 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la SUBDIRS = \ main \ - gutenprintui \ gutenprintui2 \ escputil \ - gimp \ gimp2 \ cups \ foomatic \ diff --git a/src/cups/Makefile.am b/src/cups/Makefile.am index 04d870c..0331e80 100644 --- a/src/cups/Makefile.am +++ b/src/cups/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.87.8.3 2007/12/15 20:35:36 rlk Exp $ +## $Id: Makefile.am,v 1.96 2008/04/06 01:10:52 rlk Exp $ ## Copyright (C) 2000 Roger Leigh ## ## This program is free software; you can redistribute it and/or modify @@ -34,7 +34,6 @@ pkgdatadir = $(cups_conf_datadir) pkglibdir = $(cups_conf_serverbin) pkgsysconfdir = $(cups_conf_serverroot) -cupsexec_backenddir = $(pkglibdir)/backend cupsexec_driverdir = $(pkglibdir)/driver cupsexec_filterdir = $(pkglibdir)/filter if CUPS_PPDS_AT_TOP_LEVEL @@ -67,8 +66,7 @@ endif if BUILD_CUPS bin_PROGRAMS = cups-calibrate sbin_PROGRAMS = cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ -sbin_SCRIPTS = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ -cupsexec_backend_PROGRAMS = epson canon +sbin_SCRIPTS = cups-genppdupdate cupsexec_filter_PROGRAMS = rastertogutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ commandtoepson commandtocanon TESTS= test-ppds test-rastertogutenprint @@ -88,12 +86,6 @@ commandtocanon_LDADD = $(CUPS_LIBS) commandtoepson_SOURCES = commandtoepson.c commandtoepson_LDADD = $(CUPS_LIBS) -canon_SOURCES = canon.c -canon_LDADD = $(CUPS_LIBS) - -epson_SOURCES = epson.c -epson_LDADD = $(CUPS_LIBS) - cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = genppd.c cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_CFLAGS = -DALL_LINGUAS='"@ALL_LINGUAS@"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS) cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS) @@ -108,11 +100,6 @@ rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GUTENPRINT_LIBS) rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDFLAGS = $(STATIC_LDOPTS) -cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdconfig.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdconfig -cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdupdate.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdupdate - ## Data if BUILD_CUPS @@ -165,7 +152,6 @@ install-data-hook: -@echo 'These messages are harmless and should be ignored.' -rmdir $(DESTDIR)$(cups_modeldir) -rmdir $(DESTDIR)$(pkgdatadir) - -rmdir $(DESTDIR)$(cupsexec_backenddir) -rmdir $(DESTDIR)$(cupsexec_driverdir) -rmdir $(DESTDIR)$(cupsexec_filterdir) -rmdir $(DESTDIR)$(bindir) @@ -181,7 +167,7 @@ all-local: $(INSTALL_DATA_LOCAL_DEPS) ppd: ppd-stamp -ppd-stamp: cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml +ppd-stamp: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml $(MAKE) ppd-stamp-phony touch ppd-stamp @@ -229,7 +215,7 @@ clean-local: ## Clean CLEANFILES = ppd-stamp -DISTCLEANFILES = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ +DISTCLEANFILES = cups-genppdupdate MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = \ diff --git a/src/cups/Makefile.in b/src/cups/Makefile.in index dc0a6d7..fd5895c 100644 --- a/src/cups/Makefile.in +++ b/src/cups/Makefile.in @@ -38,53 +38,43 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/cups-genppdconfig.in $(srcdir)/cups-genppdupdate.in \ + $(srcdir)/cups-genppdupdate.in \ $(srcdir)/test-rastertogutenprint.in \ $(top_srcdir)/scripts/global.mk COPYING @BUILD_CUPS_1_2_TRUE@cupsexec_driver_PROGRAMS = gutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT) @BUILD_CUPS_TRUE@bin_PROGRAMS = cups-calibrate$(EXEEXT) @BUILD_CUPS_TRUE@sbin_PROGRAMS = cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT) -@BUILD_CUPS_TRUE@cupsexec_backend_PROGRAMS = epson$(EXEEXT) \ -@BUILD_CUPS_TRUE@ canon$(EXEEXT) @BUILD_CUPS_TRUE@cupsexec_filter_PROGRAMS = rastertogutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT) \ @BUILD_CUPS_TRUE@ commandtoepson$(EXEEXT) \ @BUILD_CUPS_TRUE@ commandtocanon$(EXEEXT) subdir = src/cups ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = cups-genppdconfig cups-genppdupdate \ - test-rastertogutenprint +CONFIG_CLEAN_FILES = cups-genppdupdate test-rastertogutenprint am__installdirs = "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(cupsexec_backenddir)" \ "$(DESTDIR)$(cupsexec_driverdir)" \ "$(DESTDIR)$(cupsexec_filterdir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgdatadir)" \ "$(DESTDIR)$(pkgsysconfdir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -cupsexec_backendPROGRAMS_INSTALL = $(INSTALL_PROGRAM) cupsexec_driverPROGRAMS_INSTALL = $(INSTALL_PROGRAM) cupsexec_filterPROGRAMS_INSTALL = $(INSTALL_PROGRAM) sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) $(cupsexec_backend_PROGRAMS) \ - $(cupsexec_driver_PROGRAMS) $(cupsexec_filter_PROGRAMS) \ - $(sbin_PROGRAMS) -am_canon_OBJECTS = canon.$(OBJEXT) -canon_OBJECTS = $(am_canon_OBJECTS) -am__DEPENDENCIES_1 = -canon_DEPENDENCIES = $(am__DEPENDENCIES_1) +PROGRAMS = $(bin_PROGRAMS) $(cupsexec_driver_PROGRAMS) \ + $(cupsexec_filter_PROGRAMS) $(sbin_PROGRAMS) am_commandtocanon_OBJECTS = commandtocanon.$(OBJEXT) commandtocanon_OBJECTS = $(am_commandtocanon_OBJECTS) +am__DEPENDENCIES_1 = commandtocanon_DEPENDENCIES = $(am__DEPENDENCIES_1) am_commandtoepson_OBJECTS = commandtoepson.$(OBJEXT) commandtoepson_OBJECTS = $(am_commandtoepson_OBJECTS) @@ -103,9 +93,6 @@ cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LINK = \ $(CFLAGS) \ $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDFLAGS) \ $(LDFLAGS) -o $@ -am_epson_OBJECTS = epson.$(OBJEXT) -epson_OBJECTS = $(am_epson_OBJECTS) -epson_DEPENDENCIES = $(am__DEPENDENCIES_1) am_gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS = gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@-genppd.$(OBJEXT) gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS = $(am_gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_DEPENDENCIES = \ @@ -141,16 +128,14 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(canon_SOURCES) $(commandtocanon_SOURCES) \ - $(commandtoepson_SOURCES) $(cups_calibrate_SOURCES) \ +SOURCES = $(commandtocanon_SOURCES) $(commandtoepson_SOURCES) \ + $(cups_calibrate_SOURCES) \ $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \ - $(epson_SOURCES) \ $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \ $(rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) -DIST_SOURCES = $(canon_SOURCES) $(commandtocanon_SOURCES) \ - $(commandtoepson_SOURCES) $(cups_calibrate_SOURCES) \ +DIST_SOURCES = $(commandtocanon_SOURCES) $(commandtoepson_SOURCES) \ + $(cups_calibrate_SOURCES) \ $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \ - $(epson_SOURCES) \ $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) \ $(rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -215,27 +200,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -243,13 +214,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -354,16 +318,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -392,9 +352,9 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la empty = pkgsysconfdir = $(cups_conf_serverroot) -cupsexec_backenddir = $(pkglibdir)/backend cupsexec_driverdir = $(pkglibdir)/driver cupsexec_filterdir = $(pkglibdir)/filter @CUPS_PPDS_AT_TOP_LEVEL_FALSE@cups_modeldir = $(pkgdatadir)/model/gutenprint/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/ @@ -406,7 +366,7 @@ STP_ENV = STP_MODULE_PATH=$(top_builddir)/src/main/.libs:$(top_builddir)/src/mai @BUILD_TRANSLATED_CUPS_PPDS_TRUE@LINGUAS = $(ALL_LINGUAS) @BUILD_TRANSLATED_CUPS_PPDS_TRUE@TRANSLATE_PPDS = -DCUPS_TRANSLATED_PPDS @BUILD_SIMPLIFIED_CUPS_PPDS_TRUE@BUILD_SIMPLE_PPDS = -DGENERATE_SIMPLIFIED_PPDS -@BUILD_CUPS_TRUE@sbin_SCRIPTS = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ +@BUILD_CUPS_TRUE@sbin_SCRIPTS = cups-genppdupdate @BUILD_CUPS_TRUE@TESTS = test-ppds test-rastertogutenprint @BUILD_CUPS_TRUE@noinst_SCRIPTS = test-rastertogutenprint @BUILD_GENPPD_STATIC_TRUE@STATIC_LDOPTS = -static -export-dynamic @@ -416,10 +376,6 @@ commandtocanon_SOURCES = commandtocanon.c commandtocanon_LDADD = $(CUPS_LIBS) commandtoepson_SOURCES = commandtoepson.c commandtoepson_LDADD = $(CUPS_LIBS) -canon_SOURCES = canon.c -canon_LDADD = $(CUPS_LIBS) -epson_SOURCES = epson.c -epson_LDADD = $(CUPS_LIBS) cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = genppd.c cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_CFLAGS = -DALL_LINGUAS='"@ALL_LINGUAS@"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS) cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS) @@ -438,7 +394,7 @@ pkgsysconf_DATA = $(CUPS_CONF) @BUILD_CUPS_PPDS_TRUE@INSTALL_DATA_LOCAL_DEPS = ppd-stamp @USE_NLS_TRUE@PPD_NLS_1 = ppd-nls CLEANFILES = ppd-stamp -DISTCLEANFILES = cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ +DISTCLEANFILES = cups-genppdupdate MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = \ COPYING \ @@ -481,8 +437,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -cups-genppdconfig: $(top_builddir)/config.status $(srcdir)/cups-genppdconfig.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ cups-genppdupdate: $(top_builddir)/config.status $(srcdir)/cups-genppdupdate.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test-rastertogutenprint: $(top_builddir)/config.status $(srcdir)/test-rastertogutenprint.in @@ -515,34 +469,6 @@ clean-binPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -install-cupsexec_backendPROGRAMS: $(cupsexec_backend_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(cupsexec_backenddir)" || $(MKDIR_P) "$(DESTDIR)$(cupsexec_backenddir)" - @list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(cupsexec_backendPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(cupsexec_backenddir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(cupsexec_backendPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(cupsexec_backenddir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-cupsexec_backendPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(cupsexec_backenddir)/$$f'"; \ - rm -f "$(DESTDIR)$(cupsexec_backenddir)/$$f"; \ - done - -clean-cupsexec_backendPROGRAMS: - @list='$(cupsexec_backend_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done install-cupsexec_driverPROGRAMS: $(cupsexec_driver_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(cupsexec_driverdir)" || $(MKDIR_P) "$(DESTDIR)$(cupsexec_driverdir)" @@ -627,9 +553,6 @@ clean-sbinPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -canon$(EXEEXT): $(canon_OBJECTS) $(canon_DEPENDENCIES) - @rm -f canon$(EXEEXT) - $(LINK) $(canon_OBJECTS) $(canon_LDADD) $(LIBS) commandtocanon$(EXEEXT): $(commandtocanon_OBJECTS) $(commandtocanon_DEPENDENCIES) @rm -f commandtocanon$(EXEEXT) $(LINK) $(commandtocanon_OBJECTS) $(commandtocanon_LDADD) $(LIBS) @@ -642,9 +565,6 @@ cups-calibrate$(EXEEXT): $(cups_calibrate_OBJECTS) $(cups_calibrate_DEPENDENCIES cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT): $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_DEPENDENCIES) @rm -f cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT) $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LINK) $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD) $(LIBS) -epson$(EXEEXT): $(epson_OBJECTS) $(epson_DEPENDENCIES) - @rm -f epson$(EXEEXT) - $(LINK) $(epson_OBJECTS) $(epson_LDADD) $(LIBS) gutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT): $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_DEPENDENCIES) @rm -f gutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@$(EXEEXT) $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LINK) $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_OBJECTS) $(gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD) $(LIBS) @@ -677,12 +597,10 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtocanon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commandtoepson.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cups-calibrate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@-genppd.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epson.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@-genppd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rastertoprinter.Po@am__quote@ @@ -930,7 +848,7 @@ check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA) all-local installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cupsexec_backenddir)" "$(DESTDIR)$(cupsexec_driverdir)" "$(DESTDIR)$(cupsexec_filterdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgsysconfdir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cupsexec_driverdir)" "$(DESTDIR)$(cupsexec_filterdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgsysconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -962,10 +880,9 @@ maintainer-clean-generic: -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-binPROGRAMS clean-cupsexec_backendPROGRAMS \ - clean-cupsexec_driverPROGRAMS clean-cupsexec_filterPROGRAMS \ - clean-generic clean-libtool clean-local clean-sbinPROGRAMS \ - mostlyclean-am +clean-am: clean-binPROGRAMS clean-cupsexec_driverPROGRAMS \ + clean-cupsexec_filterPROGRAMS clean-generic clean-libtool \ + clean-local clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -990,8 +907,7 @@ install-data-am: install-data-local install-pkgdataDATA \ install-dvi: install-dvi-am -install-exec-am: install-binPROGRAMS install-cupsexec_backendPROGRAMS \ - install-cupsexec_driverPROGRAMS \ +install-exec-am: install-binPROGRAMS install-cupsexec_driverPROGRAMS \ install-cupsexec_filterPROGRAMS install-sbinPROGRAMS \ install-sbinSCRIPTS @@ -1025,8 +941,7 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_backendPROGRAMS \ - uninstall-cupsexec_driverPROGRAMS \ +uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_driverPROGRAMS \ uninstall-cupsexec_filterPROGRAMS uninstall-local \ uninstall-pkgdataDATA uninstall-pkgsysconfDATA \ uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS @@ -1034,13 +949,12 @@ uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_backendPROGRAMS \ .MAKE: install-am install-data-am install-strip .PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ - clean clean-binPROGRAMS clean-cupsexec_backendPROGRAMS \ - clean-cupsexec_driverPROGRAMS clean-cupsexec_filterPROGRAMS \ - clean-generic clean-libtool clean-local clean-sbinPROGRAMS \ - ctags dist-hook distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-cupsexec_backendPROGRAMS \ + clean clean-binPROGRAMS clean-cupsexec_driverPROGRAMS \ + clean-cupsexec_filterPROGRAMS clean-generic clean-libtool \ + clean-local clean-sbinPROGRAMS ctags dist-hook distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS \ install-cupsexec_driverPROGRAMS \ install-cupsexec_filterPROGRAMS install-data install-data-am \ install-data-hook install-data-local install-dvi \ @@ -1053,7 +967,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-cupsexec_backendPROGRAMS \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-cupsexec_backendPROGRAMS \ uninstall-cupsexec_driverPROGRAMS \ uninstall-cupsexec_filterPROGRAMS uninstall-local \ uninstall-pkgdataDATA uninstall-pkgsysconfDATA \ @@ -1076,11 +989,6 @@ $(top_builddir)/src/gutenprintui2/libgutenprintui2.la: cd $(top_builddir)/src/gutenprintui2; \ $(MAKE) -cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdconfig.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdconfig -cups-genppdupdate.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@: $(top_builddir)/config.status cups-genppdupdate.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/cups-genppdupdate - install-data-local: $(INSTALL_DATA_LOCAL_DEPS) if test -n "$(CUPS_PKG)" -a -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \ $(mkdir_p) $(DESTDIR)$(cups_modeldir); \ @@ -1110,7 +1018,6 @@ install-data-hook: -@echo 'These messages are harmless and should be ignored.' -rmdir $(DESTDIR)$(cups_modeldir) -rmdir $(DESTDIR)$(pkgdatadir) - -rmdir $(DESTDIR)$(cupsexec_backenddir) -rmdir $(DESTDIR)$(cupsexec_driverdir) -rmdir $(DESTDIR)$(cupsexec_filterdir) -rmdir $(DESTDIR)$(bindir) @@ -1126,7 +1033,7 @@ all-local: $(INSTALL_DATA_LOCAL_DEPS) ppd: ppd-stamp -ppd-stamp: cups-genppdconfig.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml +ppd-stamp: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/main/printers.xml $(top_srcdir)/src/main/papers.xml $(MAKE) ppd-stamp-phony touch ppd-stamp diff --git a/src/cups/canon.c b/src/cups/canon.c deleted file mode 100644 index 25c235e..0000000 --- a/src/cups/canon.c +++ /dev/null @@ -1,810 +0,0 @@ -/* - * CANON backend for the Common UNIX Printing System. - * - * - * Contents: - * - * main() - Send a file to the specified parallel port. - * list_devices() - List all parallel devices. - */ - -/* - * Include necessary headers. - */ - -#include <cups/cups.h> -#include <stdlib.h> -#include <errno.h> -#include <signal.h> -#include <ctype.h> - -#if defined(WIN32) || defined(__EMX__) -# include <io.h> -#else -# include <unistd.h> -# include <fcntl.h> -# include <termios.h> -#endif /* WIN32 || __EMX__ */ - -#if defined(WIN32) || defined(__EMX__) -# include <winsock.h> -#else -# include <sys/socket.h> -# include <netinet/in.h> -# include <arpa/inet.h> -# include <netdb.h> -#endif /* WIN32 || __EMX__ */ - -#ifdef __linux -# include <sys/param.h> -# include <sys/types.h> -# include <sys/stat.h> -# include <dirent.h> -# include <unistd.h> -#endif /* __linux */ - -#ifdef __sgi -# include <invent.h> -# ifndef INV_EPP_ECP_PLP -# define INV_EPP_ECP_PLP 6 /* From 6.3/6.4/6.5 sys/invent.h */ -# define INV_ASO_SERIAL 14 /* serial portion of SGI ASO board */ -# define INV_IOC3_DMA 16 /* DMA mode IOC3 serial */ -# define INV_IOC3_PIO 17 /* PIO mode IOC3 serial */ -# define INV_ISA_DMA 19 /* DMA mode ISA serial -- O2 */ -# endif /* !INV_EPP_ECP_PLP */ -#endif /* __sgi */ - - -/* - * Local functions... - */ - -void list_devices(void); - - -/* - * 'main()' - Send a file to the specified parallel port. - * - * Usage: - * - * printer-uri job-id user title copies options [file] - */ - -int /* O - Exit status */ -main(int argc, /* I - Number of command-line arguments (6 or 7) */ - char *argv[]) /* I - Command-line arguments */ -{ - char method[1024], /* Method in URI */ - hostname[1024], /* Hostname */ - username[1024], /* Username info (not used) */ - resource[1024], /* Resource info (device and options) */ - *options; /* Pointer to options */ - int port; /* Port number (not used) */ - int copies; /* Number of copies to print */ - int fd_out, /* Parallel/USB device or socket */ - fd_in, /* Print file */ - error, /* Last error */ - backchannel; /* Read backchannel data? */ - struct sockaddr_in addr; /* Socket address */ - struct hostent *hostaddr; /* Host address */ - int wbytes; /* Number of bytes written */ - int nbytes, /* Number of bytes read */ - tbytes; /* Total number of bytes written */ - char buffer[8192], /* Output buffer */ - *bufptr; /* Pointer into buffer */ - struct timeval timeout; /* Timeout for select() */ - fd_set input; /* Input set for select() */ - struct termios opts; /* Parallel port options */ -#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) - struct sigaction action; /* Actions for POSIX signals */ -#endif /* HAVE_SIGACTION && !HAVE_SIGSET */ - - - if (argc == 1) - { - list_devices(); - return (0); - } - else if (argc < 6 || argc > 7) - { - fputs("Usage: canon job-id user title copies options [file]\n", stderr); - return (1); - } - - /* - * If we have 7 arguments, print the file named on the command-line. - * Otherwise, send stdin instead... - */ - - if (argc == 6) - { - fd_in = fileno(stdin); - copies = 1; - } - else - { - /* - * Try to open the print file... - */ - - if ((fd_in = open(argv[6], O_RDONLY)) < 0) - { - perror("ERROR: unable to open print file"); - return (1); - } - - copies = atoi(argv[4]); - } - - /* - * Extract the device name and options from the URI... - */ - - httpSeparate(argv[0], method, username, hostname, &port, resource); - - /* - * See if there are any options... - */ - - if ((options = strchr(resource, '?')) != NULL) - { - /* - * Yup, terminate the device name string and move to the first - * character of the options... - */ - - *options++ = '\0'; - } - - if (hostname[0]) - { - /* - * Lookup the IP address... - */ - - if ((hostaddr = gethostbyname(hostname)) == NULL) - { - fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s", - hostname, strerror(errno)); - return (1); - } - - if (port == 0) - port = 9100; /* Default for CANON NIC */ - - fprintf(stderr, "INFO: Attempting to connect to printer %s on port %d\n", - hostname, port); - - memset(&addr, 0, sizeof(addr)); - memcpy(&(addr.sin_addr), hostaddr->h_addr, hostaddr->h_length); - addr.sin_family = hostaddr->h_addrtype; - addr.sin_port = htons(port); - - /* - * Try to connect... - */ - - for (;;) - { - if ((fd_out = socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - perror("ERROR: Unable to create socket"); - return (1); - } - - if (connect(fd_out, (struct sockaddr *)&addr, sizeof(addr)) < 0) - { - error = errno; - close(fd_out); - fd_out = -1; - - if (error == ECONNREFUSED) - { - fprintf(stderr, "INFO: Network printer \'%s\' is busy; will retry in 30 seconds...\n", - hostname); - sleep(30); - } - else - { - perror("ERROR: Unable to connect to printer"); - sleep(30); - } - } - else - break; - } - - fputs("INFO: Connected to printer, sending print job...\n", stderr); - } - else - { - /* - * Open the parallel or USB port device... - */ - - do - { - if ((fd_out = open(resource, O_RDWR | O_EXCL)) == -1) - { - if (errno == EBUSY) - { - fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr); - sleep(30); - } - else - { - perror("ERROR: Unable to open parallel port device file"); - return (1); - } - } - } - while (fd_out < 0); - - /* - * Set any options provided... - */ - - tcgetattr(fd_out, &opts); - - opts.c_cflag |= CREAD; /* Enable reading */ - opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */ - - /**** No options supported yet ****/ - - tcsetattr(fd_out, TCSANOW, &opts); - } - - /* - * Now that we are "connected" to the port, ignore SIGTERM so that we - * can finish out any page data the driver sends (e.g. to eject the - * current page... - */ - -#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */ - sigset(SIGTERM, SIG_IGN); -#elif defined(HAVE_SIGACTION) - memset(&action, 0, sizeof(action)); - - sigemptyset(&action.sa_mask); - action.sa_handler = SIG_IGN; - sigaction(SIGTERM, &action, NULL); -#else - signal(SIGTERM, SIG_IGN); -#endif /* HAVE_SIGSET */ - - /* - * Finally, send the print file... - */ - - backchannel = 1; - - while (copies > 0) - { - copies --; - - if (fd_in != fileno(stdin)) - { - fputs("PAGE: 1 1\n", stderr); - lseek(fd_in, 0, SEEK_SET); - } - - tbytes = 0; - while ((nbytes = read(fd_in, buffer, sizeof(buffer))) > 0) - { - /* - * Write the print data to the printer... - */ - - tbytes += nbytes; - bufptr = buffer; - - while (nbytes > 0) - { - if ((wbytes = write(fd_out, bufptr, nbytes)) < 0) - { - perror("ERROR: Unable to send print file to printer"); - break; - } - - nbytes -= wbytes; - bufptr += wbytes; - } - - if (nbytes > 0) - break; - - /* - * Check for possible data coming back from the printer... - */ - - if (!backchannel) - continue; - - timeout.tv_sec = 0; - timeout.tv_usec = 0; - FD_ZERO(&input); - FD_SET(fd_out, &input); - if (select(fd_out + 1, &input, NULL, NULL, &timeout) > 0) - { - /* - * Grab the data coming back and spit it out to stderr... - */ - - if ((nbytes = read(fd_out, buffer, sizeof(buffer) - 1)) < 0) - { - fprintf(stderr, "ERROR: Back-channel read error - %s!\n", - strerror(errno)); - backchannel = 0; - continue; - } - - /* - * Some devices report themselves permanently ready to read... - */ - - if (nbytes == 0) - continue; - - buffer[nbytes] = '\0'; - if (strncmp(buffer, "@BDC ", 5) != 0) - fprintf(stderr, "WARNING: Received %d bytes of unknown back-channel data!\n", - nbytes); - else - { - /* - * Skip initial report line... - */ - - for (bufptr = buffer; *bufptr && *bufptr != '\n'; bufptr ++); - - if (*bufptr == '\n') - bufptr ++; - - /* - * Get status data... - */ - - strcpy(buffer, bufptr); - for (bufptr = buffer; *bufptr && *bufptr != ';'; bufptr ++); - *bufptr = '\0'; - - if (strncmp(buffer, "IQ:", 3) == 0) - { - /* - * Report ink level... - */ - - int i; - int levels[6]; - - buffer[12] = '\0'; /* Limit to 6 inks */ - for (i = 0, bufptr = buffer; i < 6; i ++, bufptr += 2) - { - if (isalpha(bufptr[0])) - levels[i] = (tolower(bufptr[0]) - 'a' + 10) << 16; - else - levels[i] = (bufptr[0] - '0') << 16; - - if (isalpha(bufptr[1])) - levels[i] |= tolower(bufptr[1]) - 'a' + 10; - else - levels[i] |= bufptr[1] - '0'; - } - - switch (i) - { - case 1 : - case 2 : - fprintf(stderr, "K=%d\n", levels[0]); - break; - case 3 : - fprintf(stderr, "C=%d M=%d Y=%d\n", levels[0], levels[1], - levels[2]); - break; - case 4 : - case 5 : - fprintf(stderr, "K=%d C=%d M=%d Y=%d\n", levels[0], - levels[1], levels[2], levels[3]); - break; - case 6 : - fprintf(stderr, "K=%d C=%d M=%d Y=%d LC=%d LM=%d\n", - levels[0], levels[1], levels[2], levels[3], - levels[4], levels[5]); - break; - } - } - else - fprintf(stderr, "INFO: %s\n", buffer); - } - } - else if (argc > 6) - fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes); - } - } - - /* - * Close the socket connection or parallel/USB device and input file and - * return... - */ - - close(fd_out); - if (fd_in != fileno(stdin)) - close(fd_in); - - return (0); -} - - -/* - * 'list_devices()' - List all parallel devices. - */ - -void -list_devices(void) -{ -#ifdef __linux - int i; /* Looping var */ - int fd; /* File descriptor */ - char device[255]; /* Device filename */ - FILE *probe; /* /proc/parport/n/autoprobe file */ - DIR *dirprobe; /* scan /sys/bus/usb/drivers/usblp */ - char line[1024], /* Line from file */ - *delim, /* Delimiter in file */ - make[IPP_MAX_NAME], /* Make from file */ - model[IPP_MAX_NAME]; /* Model from file */ - - - /* - * Probe for parallel devices... - */ - - for (i = 0; i < 4; i ++) - { - sprintf(device, "/proc/sys/dev/parport/parport%d/autoprobe", i); - probe = fopen(device, "r"); - if ( probe == NULL ) /* older kernel versions */ - { - sprintf(device, "/proc/parport/%d/autoprobe", i); - probe = fopen(device, "r"); - } - if ( probe != NULL ) - { - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - - while (fgets(line, sizeof(line), probe) != NULL) - { - /* - * Strip trailing ; and/or newline. - */ - - if ((delim = strrchr(line, ';')) != NULL) - *delim = '\0'; - else if ((delim = strrchr(line, '\n')) != NULL) - *delim = '\0'; - - /* - * Look for MODEL and MANUFACTURER lines... - */ - - if (strncmp(line, "MODEL:", 6) == 0 && - strncmp(line, "MODEL:Unknown", 13) != 0) - strncpy(model, line + 6, sizeof(model) - 1); - else if (strncmp(line, "MANUFACTURER:", 13) == 0 && - strncmp(line, "MANUFACTURER:Unknown", 20) != 0) - strncpy(make, line + 13, sizeof(make) - 1); - } - - fclose(probe); - - if (strcasecmp(make, "CANON") == 0) - printf("direct canon:/dev/lp%d \"%s %s\" \"Gutenprint Parallel Port #%d\"\n", - i, make, model, i + 1); - } - else - { - sprintf(device, "/dev/lp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct canon:%s \"CANON\" \"Gutenprint Parallel Port #%d\"\n", device, i + 1); - } - } - } - - /* - * Probe for USB devices... - */ - - if ((dirprobe = opendir("/sys/class/usb")) != NULL) /* SYSFS in kernel 2.6 */ - { - struct dirent *dirent; /* directory entries */ - struct stat statbuf; /* file stat */ - char entry[MAXPATHLEN]; /* pathname to usb entries */ - char link[MAXPATHLEN]; /* linkname of usb entries */ - char *cptr; /* multi used character pointer */ - FILE *file; /* read printer specific info from */ - - i = 0; - /* scan the directory entries */ - while((dirent = readdir(dirprobe)) != 0) - { - /* skip "." and ".." */ - if (dirent->d_name[0] != 'l' || dirent->d_name[1] != 'p') - continue; - - /* generate path to work with */ - snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/device", dirent->d_name); - - /* look, if we have a pointer */ - if(lstat(entry, &statbuf) < 0) - { - perror(entry); - continue; - } - - if (S_ISLNK(statbuf.st_mode)) - { - /* get the path to the link */ - if (readlink(entry, link, MAXPATHLEN) < 0) - continue; - - /* find right occurance of '/' */ - if ((cptr = strrchr(link, '/')) == NULL) - { - continue; - } - - /* - * and truncate path: cut away everything after the '/', - * because parallel directory contains the information we need - */ - *cptr = '\0'; - - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - /* read manufacturer */ - snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/manufacturer", - dirent->d_name, link); - - if ((file = fopen(entry, "r")) == NULL) - { - /* skip this entry, there is no file "manufacturer" */ - continue; - } - /* read data in */ - fread(make, sizeof(make)-1, sizeof(char), file); - fclose(file); - - /* beautify "make" - strip newline away */ - if ((cptr = strrchr(make, '\n')) != NULL) - { - *cptr = '\0'; - } - - /* next entry, if manufacturer is not CANON */ - if (strcasecmp(make, "CANON") != 0) - continue; - - /* read product name */ - snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/product", - dirent->d_name, link); - - if ((file = fopen(entry, "r")) == NULL) - { - /* skip this entry, there is no file "product" */ - continue; - } - /* read data in */ - fread(model, sizeof(model)-1, sizeof(char), file); - fclose(file); - - /* beautify "model" - strip away newline */ - if ((cptr = strrchr(model, '\n')) != NULL) - { - *cptr = '\0'; - } - sprintf(device, "/dev/usb/%s", dirent->d_name); - if (access(device, 0)) - { - sprintf(device, "/dev/usb/usb%s", dirent->d_name); - - if (access(device, 0)) - sprintf(device, "/dev/usb%s", dirent->d_name); - } - - printf("direct canon:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n", - device, make, model, ++i); - } - } - closedir(dirprobe); - } - else if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL) - { - i = 0; - - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - - while (fgets(line, sizeof(line), probe) != NULL) - { - /* - * Strip trailing newline. - */ - - if ((delim = strrchr(line, '\n')) != NULL) - *delim = '\0'; - - /* - * See if it is a printer device ("P: ...") - */ - - if (strncmp(line, "S:", 2) == 0) - { - /* - * String attribute... - */ - - if (strncmp(line, "S: Manufacturer=", 17) == 0) - { - strncpy(make, line + 17, sizeof(make) - 1); - if (strcmp(make, "Hewlett-Packard") == 0) - strcpy(make, "HP"); - } - else if (strncmp(line, "S: Product=", 12) == 0) - strncpy(model, line + 12, sizeof(model) - 1); - } - else if (strncmp(line, "I:", 2) == 0 && - strstr(line, "Driver=printer") != NULL && - make[0] && model[0]) - { - /* - * We were processing a printer device; send the info out... - */ - - if (strcmp(make, "CANON") == 0) - { - sprintf(device, "/dev/usb/lp%d", i); - if (access(device, 0)) - { - sprintf(device, "/dev/usb/usblp%d", i); - - if (access(device, 0)) - sprintf(device, "/dev/usblp%d", i); - } - - printf("direct canon:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n", - device, make, model, i + 1); - } - - i ++; - - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - } - } - - fclose(probe); - } - else - { - for (i = 0; i < 8; i ++) - { - sprintf(device, "/dev/usb/lp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct canon:%s \"CANON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1); - } - - sprintf(device, "/dev/usb/usblp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct canon:%s \"CANON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1); - } - - sprintf(device, "/dev/usblp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct canon:%s \"CANON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1); - } - } - } -#elif defined(__sgi) - int i, j, n; /* Looping vars */ - char device[255]; /* Device filename */ - inventory_t *inv; /* Hardware inventory info */ - - - /* - * IRIX maintains a hardware inventory of most devices... - */ - - setinvent(); - - while ((inv = getinvent()) != NULL) - { - if (inv->inv_class == INV_PARALLEL && inv->inv_type == INV_EPP_ECP_PLP) - { - /* - * Standard parallel port... - */ - - puts("direct canon:/dev/plpbi \"CANON\" \"Gutenprint Onboard Parallel Port\""); - } - } - - endinvent(); -#elif defined(__sun) - int i, j, n; /* Looping vars */ - char device[255]; /* Device filename */ - - - /* - * Standard parallel ports... - */ - - for (i = 0; i < 10; i ++) - { - sprintf(device, "/dev/ecpp%d", i); - if (access(device, 0) == 0) - printf("direct canon:%s \"CANON\" \"Gutenprint Sun IEEE-1284 Parallel Port #%d\"\n", - device, i + 1); - } - - for (i = 0; i < 3; i ++) - { - sprintf(device, "/dev/lp%d", i); - - if (access(device, 0) == 0) - printf("direct canon:%s \"CANON\" \"Gutenprint PC Parallel Port #%d\"\n", - device, i + 1); - } -#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD) - int i; /* Looping var */ - int fd; /* File descriptor */ - char device[255]; /* Device filename */ - - - /* - * Probe for parallel devices... - */ - - for (i = 0; i < 3; i ++) - { - sprintf(device, "/dev/lpt%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct canon:%s \"CANON\" \"Gutenprint Parallel Port #%d (interrupt-driven)\"\n", device, i + 1); - } - - sprintf(device, "/dev/lpa%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct canon:%s \"CANON\" \"Gutenprint Parallel Port #%d (polled)\"\n", device, i + 1); - } - } - - /* - * Probe for USB devices... - */ - - for (i = 0; i < 3; i ++) - { - sprintf(device, "/dev/ulpt%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct canon:%s \"CANON\" \"Gutenprint USB Port #%d\"\n", device, i + 1); - } - } -#endif -} - - -/* - */ diff --git a/src/cups/command.types b/src/cups/command.types index de77a08..6b5f181 100644 --- a/src/cups/command.types +++ b/src/cups/command.types @@ -1,5 +1,5 @@ # -# "$Id: command.types,v 1.1.78.1 2007/12/23 17:30:03 easysw Exp $" +# "$Id: command.types,v 1.2 2007/12/23 17:31:51 easysw Exp $" # # MIME types file for the CUPS drivers. # @@ -24,5 +24,5 @@ application/vnd.cups-command string(0,'#CUPS-COMMAND') # -# End of "$Id: command.types,v 1.1.78.1 2007/12/23 17:30:03 easysw Exp $". +# End of "$Id: command.types,v 1.2 2007/12/23 17:31:51 easysw Exp $". # diff --git a/src/cups/commandtoepson.c b/src/cups/commandtoepson.c index 1d0a4e3..b907a2d 100644 --- a/src/cups/commandtoepson.c +++ b/src/cups/commandtoepson.c @@ -1,5 +1,5 @@ /* - * "$Id: commandtoepson.c,v 1.2.68.1 2007/12/23 17:30:04 easysw Exp $" + * "$Id: commandtoepson.c,v 1.3 2007/12/23 17:31:51 easysw Exp $" * * EPSON ESC/P2 command filter for the Common UNIX Printing System. * @@ -229,5 +229,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: commandtoepson.c,v 1.2.68.1 2007/12/23 17:30:04 easysw Exp $". + * End of "$Id: commandtoepson.c,v 1.3 2007/12/23 17:31:51 easysw Exp $". */ diff --git a/src/cups/cups-calibrate.c b/src/cups/cups-calibrate.c index 50c4eb7..28070b1 100644 --- a/src/cups/cups-calibrate.c +++ b/src/cups/cups-calibrate.c @@ -1,5 +1,5 @@ /* - * "$Id: cups-calibrate.c,v 1.5.18.1 2007/12/23 17:30:04 easysw Exp $" + * "$Id: cups-calibrate.c,v 1.6 2007/12/23 17:31:51 easysw Exp $" * * Super simple color calibration program for the Common UNIX * Printing System. diff --git a/src/cups/cups-genppdconfig.in b/src/cups/cups-genppdconfig.in deleted file mode 100644 index aa80920..0000000 --- a/src/cups/cups-genppdconfig.in +++ /dev/null @@ -1,480 +0,0 @@ -#! @PERL@ -w -# $Id: cups-genppdconfig.in,v 1.13.8.1 2007/05/29 01:47:26 rlk Exp $ -# A user-friendly dialog-based wrapper for cups-genppd(8). -# Copyright (C) 2002 Roger Leigh <rleigh@debian.org> -# -# 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. - -use strict; -use File::Basename; -use File::Find; -use File::Temp qw(tempfile unlink0); -use IO::Handle; -use Getopt::Std; -use POSIX; - -sub init_data(); -sub init_defaults(); -sub main_menu(); -sub display_help; -sub choose_printers; -sub choose_languages; -sub choose_location; -sub create_ppds; -sub create_dir($); -sub dialog_read($$); -sub dialog_read_list (\%\@$$); - -my $DIALOG = "@DIALOG@"; # version of dialog to call -my $BACKTITLE = "Gutenprint CUPS PPD creation"; # dialog screen title -my %printers; # master list of printers -my %languages; # master list of languages -my @used_printers; # printer PPDs on system -my @used_languages; # languages used on system -my @chosen_printers = (); # chosen printers -my @chosen_languages = (); # chosen languages -my $version = "@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@"; -my $chosen_location = "@cups_conf_datadir@/model/gutenprint/$version"; - # chosen PPD prefix -my $silent = 0; # no dialog - - -# Set chosen_location from command-line. -our $opt_d; -our $opt_u; -getopts('d:u'); -if ($opt_d) { - $chosen_location = create_dir($opt_d); -} - -# Initialise everything -init_data(); -init_defaults(); - -# Run non-interactively if `-u' was specified. -if ( $opt_u ) { - $silent = 1; - create_ppds; - exit 0; -} - -# Can we use dialog? -die "dialog(1) is not available, but is required for interactive use." - if ! -x $DIALOG; - -while (my $option = main_menu()) { # Display main menu and run selection - if ($option eq "Help") { - display_help(); - } elsif ($option eq "Printers") { - choose_printers(); - } elsif ($option eq "Languages") { - choose_languages(); - } elsif ($option eq "Directory") { - choose_location(); - } elsif ($option eq "Create") { - create_ppds(); - } elsif ($option eq "Exit") { - exit 0; - } else { - die "Invalid menu option: $option"; - } -} - -exit 0; - - -# -# init_data() - Populate master printer and language hashes. -# -sub init_data() { - my $model; - my $desc; - my $lang; -# Get printer drivers and descriptions, then store in a hash. - open GENPPD, "cups-genppd.$version -M -v |" or die "can't fork cups-genppd.$version: $!"; - while (<GENPPD>) { - ($model, $desc) = /([\w-]+)\W+(.*)/; - chomp ($model); - chomp ($desc); - $printers{$model} = $desc; - } - close GENPPD or die "can't close cups-genppd.$version pipe: $!"; -# Get available languages, then store in hash. - open GENPPD, "cups-genppd.$version -L |" or die "can't fork cups-genppd.$version: $!"; - while (<GENPPD>) { - $lang = $_; - chomp ($lang); - $languages{$lang} = "(No description)"; - } - $languages{"en"} = "US English"; - close GENPPD or die "can't close cups-genppd.$version pipe: $!"; -# Set defaults - @chosen_languages = ("en"); -} - - -# -# init_defaults() - Get defaults from PPD files and directories. -# -sub init_defaults() { - # Find all PPD files that we could regenerate - my %found_ppds; - if (-d $chosen_location) { - find({wanted => \&find_printers}, $chosen_location); - foreach (@used_printers) { - my $tmp; - $tmp = basename($_); - chomp ($tmp); - $tmp =~ s/(^.*)\.ppd.*/$1/; - $found_ppds{$tmp} = "" if $printers{$tmp}; - } - } - @chosen_printers = (); - foreach (sort keys %found_ppds) { - push @chosen_printers, $_; - } - - # Find all language directories that could be used - my %found_langs; - if (-d $chosen_location) { - find({wanted => \&find_languages}, $chosen_location); - foreach (@used_languages) { - my $tmp; - $tmp = basename($_); - chomp ($tmp); - $found_langs{$tmp} = "" if $languages{$tmp}; - } - } - @chosen_languages = (); - foreach (sort keys %found_langs) { - push @chosen_languages, $_; - } - if (! @chosen_languages) { - push @chosen_languages, "en"; - } -} - - -# -# find-*() - callbacks for File::Find::find(). -# -sub find_printers { - my ($dev,$ino,$mode,$nlink,$uid,$gid); - - (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && - -f _ && - /^.*\.ppd.*\z/s && push @used_printers, $_; -} - -sub find_languages { - my ($dev,$ino,$mode,$nlink,$uid,$gid); - - (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && - -d _ && push @used_languages, $_; -} - - -# string -# main_menu() - Display main menu. -# Return string containing selection. -# -sub main_menu() { - my $option; - my @menu_options; - my $menu_desc = << "END"; -Generate Gutenprint PPD files for use with CUPS. This program is a user-friendly interface for cups-genppd(8). - -Current PPD directory: $chosen_location - -Hint: if the cursor keys cause problems, you may have more luck with +/- and TAB. -END - @menu_options = ( - [ "Help", "Display help text" ], - [ "Directory", "Choose PPD location" ], - [ "Printers", "Choose printers" ], - [ "Languages", "Choose languages" ], - [ "Create", "Create PPDs" ], - [ "Exit", "Exit the program" ] - ); - my $dialog_options; - for my $i ( 0 .. $#menu_options) { - for my $j ( 0 .. $#{$menu_options[$i]}) { - $dialog_options .= "\"$menu_options[$i][$j]\" "; - } - } - while (defined($option = dialog_read("cups-genppdconfig", "--no-cancel --default-item Printers --menu \"$menu_desc\" 20 70 6 $dialog_options"))) { - chomp ($option); - return $option; - } -} - - -# -# display_help() - Display help text. -# -sub display_help { - my $help_text = <<"END"; -cups-genppdconfig is a program to generate PPD files which enable the -Gutenprint printer drivers to be used with CUPS, the Common UNIX -Printing System. A PPD file is a PostScript Printer Description, -which describes the capabilities of a printer. For each printer model -that you wish to use, you will have to generate the corresponding PPD -file. - -There are three steps to generating the PPDs: - - -[0. Directory] - -The default base directory to create PPD files in is -@cups_conf_datadir@/model/gutenprint, and this is displayed on the -main menu. Choose the "Directory" option to change this, but in -almost every case the default should be used. Don\'t alter the default -unless you know what you are doing. - - -1. Printers - -Choose the "Printers" menu option. The dialog box shows a complete -list of all the printers supported by Gutenprint. Use the up and down -cursor keys to move between the printers and SPACE to select the -models you want. Next, press ENTER to confirm the selections. - -If no printers are chosen, then a PPD file will be created for *every* -model. - - -2. Languages - -PPD files can be produced in several languages. Choose the -"Languages" menu option and, as for the "Printers" menu, select the -languages that you wish to use and press ENTER to confirm the -selections. - -Since a PPD file can only be translated into one language, selecting -multiple languages is posible, but of limited usefulness (for each -printer, a separate PPD file for each language will be produced). - - -3. Save the selections - -Choose the "Save" menu option to generate the PPD files you requested. -The files will be created in the default CUPS data directory -\$cups_prefix/share/model/gutenprint. Translations will be saved in -subdirectories named according to the locale/language. - - -Note that unselecting already selected entries in the Printer and -Language Selection dialogs will *not* remove these from the -filesystem; it will simply not cause them to be generated when you -choose "Save". To remove a printer, delete the PPD file from each -language directory it appears in. To remove a language, delete the -directory named with the corresponding language code, and all its -contents. - -Once you have finished, choose the "Exit" menu option, to leave the -program. Note that your selections will be lost, so make sure you -saved your selections first, if you wanted to keep them. -END - my($HELPFILE, $helpfilename) = tempfile("cups-genppdconfig-helpXXXXXX", - UNLINK => 1) - or die "can't open temporary help file"; - print $HELPFILE "$help_text"; - $HELPFILE->flush(); - dialog_read("Help", "--textbox $helpfilename 18 76"); - unlink0($HELPFILE, $helpfilename) or die "Error unlinking help file $helpfilename safely: $!"; - close($HELPFILE) or die "can't close help file $helpfilename: $!"; - return; -} - - -# -# choose_printers() - Select printers from master list. -# Default none (so create all printers). -# -sub choose_printers { - my $title = "Printer selection"; - my $options = "--checklist \"Choose the printer models you wish to use with CUPS.\" 18 54 11"; - dialog_read_list(%printers, @chosen_printers, $title, $options); -} - - -# -# choose_languages() - Select languages from master list. -# Default is US English (en). -# -sub choose_languages { - my $title = "Language selection"; - my $options = "--checklist \"Choose the languages you wish to use with CUPS.\" 18 54 11"; - dialog_read_list(%languages, @chosen_languages, $title, $options); -} - - -# -# choosen_location() - Select PPD prefix directory and create it if -# not present. -# -sub choose_location { - my $location; - $location = dialog_read("Location selection", - "--inputbox \"Choose a directory to create the PPD files in.\" 8 61 $chosen_location"); - if (!defined($location)) { - $location = ""; - } - $chosen_location = create_dir($location); # make sure directory exists - init_defaults; # use new location to get default selections -} - - -# -# create_dir($dir) - Create named directory. -# $dir will have excess `/'s pruned. -# -sub create_dir ($) { - my $location = $_[0]; - my $dir; - my $count = 0; - if ($location =~ m/^\//) { - $dir = "/"; - } - foreach (split /\//, $location) { - if ($_ eq "") { - next; - } - if ($count == 1) { - $dir .= "/"; - } - $count = 1; - $dir .= $_; - if (!-d $dir) # directory does not exist, so create it - { - mkdir $dir || die "can't create directory \`$dir\': $!"; - } - } - return $dir; -} - - -# -# create_ppds() - Create PPD files. -# -sub create_ppds { - create_dir($chosen_location); # make the destination directory - my $total = scalar(@chosen_printers); - my $printers; - my $count; - my $language; - my $percent; - my $file; - if (!@chosen_printers) { # calculate total files for guage - $total = scalar(keys(%printers)); - } - $total = $total * scalar(@chosen_languages); - if (@chosen_printers) { # construct printer list for dialog - foreach (@chosen_printers) { - $printers .= "$_ "; - } - } else { - $printers = ""; - } - if (! $silent) { - open DIALOG, "| $DIALOG --sleep 2 --backtitle \"$BACKTITLE\" --title \"Creating PPD files\" --guage \"Language: \nPPD files: \" 10 72 0" - or die "can't fork dialog: $!"; - } - $count = 0; - foreach $language (@chosen_languages) { # loop through languages - open GENPPD, - "LC_ALL=$language LANG=$language LANGUAGE=$language cups-genppd.$version -v -p $chosen_location/$language $printers 2>&1 |" - or die "can't fork cups-genppd: $!"; - $file = ""; - while ( defined($file = <GENPPD>)) { # dump genppd stats into guage - chomp($file); - $count++; - $percent = int (($count/$total)*100); - if ($percent > 100) { - $percent = 100; - } - if (! $silent) { - print DIALOG "$percent\n"; - print DIALOG "XXX\nLanguage: $language\nPPD files: $count/$total\n\n$file\nXXX\n"; - DIALOG->flush(); - } else { - print "$file\n"; - STDOUT->flush(); - } - } - close GENPPD or die "can't close cups-genppd pipe: $!"; - } - if (! $silent) { - print DIALOG "100\nXXX\nLanguage: \nPPD files: $total/$total\n\nCompleted\nXXX\n"; - close DIALOG or die "can't close dialog pipe"; - } -} - - -# scalar -# dialog($title, $command) - Create a dialog. -# Returns dialog results. -sub dialog_read ($$) { - my($title, $command) = @_; - my $result = ""; # must not be undefined, just empty - my $status; - my $line; - open DIALOG, "$DIALOG --backtitle \"$BACKTITLE\" --title \"$title\" $command 2>&1 |"; - while (defined($line = <DIALOG>)) { - $result .= $line; - } - close DIALOG or ($! == 0) or die "can't close dialog pipe: $!"; - if ($? >> 8) - { - return undef; - } - return $result; -} - - -# -# dialog_read_list(%masterlist -# @chosenlist -# $title -# $dialog) - Construct list dialog, entries from %masterlist, -# defaults from @chosenlist. -# -sub dialog_read_list (\%\@$$) { - my $masterlist = $_[0]; - my $list = $_[1]; - my $title = $_[2]; - my $dialogoptions = $_[3]; - my $tmplist; - my $dialoglist = ""; - my $item; - my $selected; -# Make a list for use with dialog. - foreach $item (sort keys %$masterlist) { - $selected = "off"; - foreach (@$list) { - if ($item eq $_) { - $selected = "on"; - last; - } - } - $dialoglist .= "$item \"$masterlist->{$item}\" $selected "; - } - $tmplist = dialog_read("$title", "$dialogoptions $dialoglist"); - if (defined($tmplist)) { - $tmplist =~ s/\"//g; - @$list=split(/ /, $tmplist); - } -} diff --git a/src/cups/cups-genppdupdate.in b/src/cups/cups-genppdupdate.in index 119c350..9892ce0 100644 --- a/src/cups/cups-genppdupdate.in +++ b/src/cups/cups-genppdupdate.in @@ -1,5 +1,5 @@ #! @PERL@ -w -# $Id: cups-genppdupdate.in,v 1.25.8.4 2007/12/29 20:42:25 rlk Exp $ +# $Id: cups-genppdupdate.in,v 1.42 2008/04/12 01:20:33 rlk Exp $ # Update CUPS PPDs for Gutenprint queues. # Copyright (C) 2002-2003 Roger Leigh (rleigh@debian.org) # @@ -25,12 +25,10 @@ use File::Copy qw(mv); sub parse_options (); sub update_ppd ($); # Original PPD filename -sub get_ppd_contents ($$$$$); # Return contents of desired PPD +sub get_ppd_fh ($$$$$); # Return contents of desired PPD sub find_ppd ($$$$); # Gutenprint Filename, driver, language (e.g. en, sv), # region (e.g. GB, DE) -sub get_default_types (*); # Source PPD FH -sub get_defaults (*); # Source PPD FH -sub get_options (*\%); # Source PPD FH, default_types hash ref +sub get_ppd_data (*$$$$$); # Source PPD FH our $opt_d; # Debug mode our $opt_h; # Help @@ -42,18 +40,20 @@ our $opt_P; # PPD generator location our $opt_v; # Verbose mode our $opt_N; # Don't update PPD file options our $opt_o; # Output directory +our $opt_r; # Gutenprint version +our $opt_i; # Interactive +our $opt_f; # Force upgrade my $debug = 0; my $verbose = 0; # Verbose output -if ($debug) { - $verbose = 1; -} +my $interactive = 0; my $quiet = 0; # No output my $no_action = 0; # Don't output files my $reset_defaults = 0; # Reset options to default settings my $version = "@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@"; my $micro_version = "@GUTENPRINT_VERSION@"; my $use_static_ppd = "@BUILD_CUPS_PPDS@"; +my $file_version = '"@VERSION@"$'; my $ppd_dir = "@cups_conf_serverroot@/ppd"; # Location of in-use CUPS PPDs my $ppd_root_dir = "@cups_conf_datadir@/model"; @@ -61,14 +61,17 @@ my $ppd_base_dir = "$ppd_root_dir/gutenprint/$version"; # Available PPDs my $ppd_out_dir = ""; # By default output into source directory my $gzext = ".gz"; my $updated_ppd_count = 0; +my $skipped_ppd_count = 0; +my $failed_ppd_count = 0; my $exit_after_parse_args = 0; my $serverdir = "@cups_conf_serverbin@"; my $driver_bin = "$serverdir/driver/gutenprint.$version"; -my $driver_version = `$driver_bin VERSION`; -chomp $driver_version; - -$Getopt::Std::STANDARD_HELP_VERSION = 1; +my $driver_version = ""; +if (-x $driver_bin) { + $driver_version = `$driver_bin VERSION`; + chomp $driver_version; +} $Getopt::Std::STANDARD_HELP_VERSION = 1; @@ -109,14 +112,15 @@ umask 0177; # Find all in-use Gutenprint PPD files... +# For case-insensitive filesystems, use only one of .ppd and .PPD +# (bug 1929738). -my @ppdglob; if (@ARGV) { my $f; foreach $f (@ARGV) { if (-f $f and ($f =~ /\.ppd$/i or $f =~ /\//)) { if (-f $f) { - push @ppdglob, $f; + push @ppd_files, $f; } else { print STDERR "Cannot find file $f\n"; } @@ -124,71 +128,58 @@ if (@ARGV) { -f "$ppd_dir/$f.ppd" or -f "$ppd_dir/$f.PPD") { if (-f "$ppd_dir/$f") { - push @ppdglob, "$ppd_dir/$f"; - } - if (-f "$ppd_dir/$f.ppd") { - push @ppdglob, "$ppd_dir/$f.ppd"; - } - if (-f "$ppd_dir/$f.PPD") { - push @ppdglob, "$ppd_dir/$f.PPD"; + push @ppd_files, "$ppd_dir/$f"; + } elsif (-f "$ppd_dir/$f.ppd") { + push @ppd_files, "$ppd_dir/$f.ppd"; + } elsif (-f "$ppd_dir/$f.PPD") { + push @ppd_files, "$ppd_dir/$f.PPD"; } } else { print STDERR "Cannot find file $ppd_dir/$f, $ppd_dir/$f.ppd, or $ppd_dir/$f.PPD\n"; } } } else { - @ppdglob = glob("$ppd_dir/*.{ppd,PPD}"); -} -my $ppdlist = join ' ', @ppdglob; -if (@ppdglob) { - open PPDFILES, '-|', 'egrep', '-i', '-l', 'Gutenprint|Gimp-Print', @ppdglob or die "can't grep $ppdlist: $!"; - while (<PPDFILES>) { - chomp; - push @ppd_files, $_; - } - if (@ppd_files) { - open PPDFILES, '-|', 'egrep', '-i', '-L', 'Foomatic', @ppd_files or die "can't grep $ppdlist: $!"; - @ppd_files = (); - while (<PPDFILES>) { - chomp; - push @ppd_files, $_; + my @ppdtmp = glob("$ppd_dir/*.{ppd,PPD}"); + my (%ppd_map); + map { $ppd_map{$_} = 1 } @ppd_files; + foreach my $f (@ppdtmp) { + if ($f =~ /\.PPD$/) { + my ($g) = $f; + $g =~ s/\.PPD$/.ppd/; + if (! $ppd_map{$g}) { + push @ppd_files, $f; + } + } else { + push @ppd_files, $f; } - close PPDFILES or ($! == 0) or die "can't close grep pipe: $!"; } } - -# Exit if there are not files to update... - -if (!@ppd_files) { - print STDOUT "No Gutenprint PPD files to update.\n"; - exit (0); -} - # Update each of the Gutenprint PPDs, where possible... foreach (@ppd_files) { - $updated_ppd_count += update_ppd($_); - + my ($status) = update_ppd($_); + last if ($status == -2); + $failed_ppd_count++ if ($status == 0); + $updated_ppd_count++ if ($status == 1); + $skipped_ppd_count++ if ($status == -1); } if (!$quiet || $verbose) { - if ($updated_ppd_count > 0) { - my $plural = ""; - if ($updated_ppd_count != 1) { - $plural = "s"; - } + if (!@ppd_files) { + print STDOUT "No Gutenprint PPD files to update.\n"; + } elsif ($updated_ppd_count > 0) { + my $plural = $updated_ppd_count == 1 ? "" : "s"; print STDOUT "Updated $updated_ppd_count PPD file${plural}. Restart cupsd for the changes to take effect.\n"; - exit (0); } else { - if ($no_action) { - print STDOUT "Did not update any PPD files\n"; - } else { + if ($failed_ppd_count > 0) { print STDOUT "Failed to update any PPD files\n"; + } else { + print STDOUT "Did not update any PPD files\n"; } - exit (0); } } +exit ($failed_ppd_count > 0); sub HELP_MESSAGE($;$$$) { my ($fh) = @_; @@ -204,6 +195,9 @@ sub HELP_MESSAGE($;$$$) { print $fh " -v Verbose messages.\n"; print $fh " -N Reset options to defaults.\n"; print $fh " -o out_dir Output PPD files to out_dir.\n"; + print $fh " -r version Use PPD files for Gutenprint major.minor version.\n"; + print $fh " -f Ignore new PPD file safety checks.\n"; + print $fh " -i Prompt (interactively) for each PPD file.\n"; exit(0); } @@ -222,7 +216,7 @@ sub help() { } sub parse_options () { - if (!getopts('d:hnqs:vNo:p:P:')) { + if (!getopts('d:hnqs:vNo:p:P:r:if')) { help(); } if ($opt_n) { @@ -231,9 +225,57 @@ sub parse_options () { if ($opt_d) { $debug = $opt_d; } + if ($opt_v) { + $verbose = 1; + $quiet = 0; + } + if ($opt_q) { + $verbose = 0; + $quiet = 1; + } + if ($opt_N) { + $reset_defaults = 1; + } + if ($opt_o) { + if (-d $opt_o) { + $ppd_out_dir = "$opt_o"; + } + else { + die "$opt_o: invalid directory: $!\n"; + } + } + if ($opt_r) { + if ($version ne $opt_r) { + $version = $opt_r; + if ($opt_s) { + if (-d $opt_s) { + $ppd_base_dir = "$opt_s"; + $driver_bin = ""; + } else { + die "$opt_s: invalid directory: $!\n"; + } + } else { + $ppd_base_dir = "$ppd_root_dir/gutenprint/$version"; + $driver_bin = "$serverdir/driver/gutenprint.$version"; + } + $driver_version = ""; + # If user specifies version, we're not going to be able to check + # for an exact match. + $file_version = "\"$version"; + if (-x $driver_bin) { + $driver_version = `$driver_bin VERSION`; + chomp $driver_version; + $file_version = "\"$driver_version\"\$"; + } elsif (! -d $ppd_base_dir && ! -l $ppd_base_dir) { + die "Gutenprint $version does not appear to be installed!\n"; + } + } + } if ($opt_s) { if (-d $opt_s) { $ppd_base_dir = "$opt_s"; + $driver_bin = ""; + $driver_version = ""; } else { die "$opt_s: invalid directory: $!\n"; @@ -255,40 +297,27 @@ sub parse_options () { die "$opt_P: invalid executable: $!\n"; } } - if ($opt_v) { - $verbose = 1; - $quiet = 0; - } - if ($opt_q) { - $verbose = 0; - $quiet = 1; - } - if ($opt_N) { - $reset_defaults = 1; - } - if ($opt_o) { - if (-d $opt_o) { - $ppd_out_dir = "$opt_o"; - } - else { - die "$opt_o: invalid directory: $!\n"; - } - } if ($opt_h) { help(); } + if ($opt_i) { + $interactive = 1; + } if ($exit_after_parse_args) { exit(0); } + if ($verbose && $driver_version ne "") { + print STDOUT "Updating PPD files from Gutenprint $driver_version\n"; + } } -sub get_ppd_contents($$$$$) { +sub get_ppd_fh($$$$$) { my ($ppd_source_filename, $filename, $driver, $locale, $region) = @_; my $source_data; my ($new_ppd_filename); - if ($use_static_ppd eq "no" && $driver_version eq "@VERSION@") { + if ($use_static_ppd eq "no" && $driver_version ne "") { my ($simplified); if ($filename =~ m,.*/([^/]*)(.sim)(.ppd)?(.gz)?$,) { $simplified = "simple"; @@ -309,14 +338,8 @@ sub get_ppd_contents($$$$$) { if ($debug & 8) { print "Trying $driver_bin cat $url for $driver, $simplified, $locale, $region\n"; } - if (open PPD, "$driver_bin cat $url 2>/dev/null |") { - while (<PPD>) { - $source_data .= $_; - } - close PPD; - if ($source_data) { - return ( $new_ppd_filename, $source_data ); - } + if (open PPD, "$driver_bin cat $url |") { + return ($new_ppd_filename, \*PPD); } } # Otherwise fall through and try to find a static PPD @@ -329,7 +352,7 @@ sub get_ppd_contents($$$$$) { # There wasn't a valid source PPD file, so give up. print STDERR "$ppd_source_filename: no valid candidate for replacement. Skipping\n"; print STDERR "$ppd_source_filename: please upgrade this PPD manually\n"; - return ("", 0); + return ("", undef); } if ($debug & 1) { print "Candidate PPD: $new_ppd_filename\n"; @@ -339,20 +362,13 @@ sub get_ppd_contents($$$$$) { if ($new_ppd_filename =~ m/.gz$/) { # Decompress input buffer open GZIN, "gunzip -c $new_ppd_filename |" or die "$_: can't open for decompression: $!"; - while (<GZIN>) { - $source_data .= $_; - } - close GZIN; + return ($new_ppd_filename, \*GZIN); } else { open SOURCE, $new_ppd_filename or die "$new_ppd_filename: can't open source file: $!"; binmode SOURCE; - my $source_size = (stat(SOURCE))[7]; - read (SOURCE, $source_data, $source_size) - or die "$new_ppd_filename: error reading source: $!"; - close SOURCE or die "$new_ppd_filename: can't close file: $!"; + return ($new_ppd_filename, \*SOURCE); } - return ( $new_ppd_filename, $source_data ); } # Update the named PPD file. @@ -365,7 +381,7 @@ sub update_ppd ($) { } open ORIG, $_ or die "$_: can't open PPD file: $!"; - seek (ORIG, 0, 0) or die "can't seek to start of PPD file"; + seek (ORIG, 0, 0) or die "can't seek to start of PPD file: $!"; my @orig_metadata = stat(ORIG); if ($debug & 1) { print "Source Filename: $ppd_source_filename\n"; @@ -381,28 +397,29 @@ sub update_ppd ($) { if (/\*StpLocale:/) { ($locale) = m/^\*StpLocale:\s\"*(.*)\"$/; $valid = 1; - } - if (/\*LanguageVersion/) { + } elsif (/\*LanguageVersion/) { ($lingo) = m/^\*LanguageVersion:\s*(.*)$/; - } - if (/^\*StpDriverName:/ ) { + } elsif (/^\*StpDriverName:/ ) { ($driver) = m/^\*StpDriverName:\s*\"(.*)\"$/; $valid = 1; - } - if (/\*%End of / && $driver eq "") { + } elsif (/\*%End of / && $driver eq "") { ($driver) = m/^\*%End of\s*(.*).ppd$/; - } - if (/^\*StpPPDLocation:/ ) { + } elsif (/^\*StpPPDLocation:/ ) { ($filename) = m/^\*StpPPDLocation:\s*\"(.*)\"$/; $valid = 1; - } - if (/^\*%Gutenprint Filename:/) { + } elsif (/^\*%Gutenprint Filename:/) { $valid = 1; } + if ($filename and $driver and $lingo and $locale) { + last; + } + if (! $valid && /^\*OpenUI/) { + last; + } } if (! $valid) { - print STDERR "$ppd_source_filename: this PPD file cannot be upgraded automatically (only files based on Gutenprint 5.0.0 and newer can be)\n"; - return 0; +# print STDERR "Skipping $ppd_source_filename: not a Gutenprint PPD file\n"; + return -1; } if ($debug & 2) { print "Gutenprint Filename: $filename\n"; @@ -432,44 +449,49 @@ sub update_ppd ($) { # Read in the new PPD, decompressing it if needed... - my ($new_ppd_filename, $source_data) = - get_ppd_contents($ppd_source_filename, $filename, - $driver, $locale, $region); + my ($new_ppd_filename, $source_fd) = + get_ppd_fh($ppd_source_filename, $filename, $driver, $locale, $region); - if (! $source_data) { + if (! defined $source_fd) { print "Unable to retrieve PPD file!\n"; return 0; } - # Save new PPD in a temporary file, for processing... - - my($tmpfile, $tmpfilename) = tmpnam(); - unlink $tmpfilename or warn "can't unlink temporary file $tmpfile: $!\n"; - print $tmpfile $source_data; - - - + if ($interactive) { + print "Update PPD $ppd_source_filename from $new_ppd_filename [nyq]? "; + my $input = readline(*STDIN); + if ($input =~ /^q/i) { + close $source_fd; + print "Skipping all...\n"; + return -2; + } elsif (! ($input =~ /^y/i)) { + close $source_fd; + print "Skipping...\n"; + return -1; + } + } # Extract the default values from the original PPD... - my %orig_default_types = get_default_types(ORIG); - my %new_default_types = get_default_types($tmpfile); - my %defaults = get_defaults(ORIG); - my %options = get_options($tmpfile, %new_default_types); - my %resolution_map = get_resolution_map($tmpfile); + seek(ORIG, 0, 0); + my ($odt, $oopt, $ores, $odef) = get_ppd_data(ORIG, 1, 0, 0, 1, 0); + my ($ndt, $nopt, $nres, $ndef, $source_data) = get_ppd_data($source_fd, 1, 1, 1, 1, 1); # Close original and temporary files... - if (! close ORIG) { - print "$_: can't close file: $!\n"; - return 0; - } - if (! close $tmpfile) { - print "can't close temporary file $tmpfile: $!\n"; + close ORIG; + if (! close $source_fd) { + print "Unable to retrieve new PPD file: $!\n"; return 0; } + my %orig_default_types = %$odt; + my %new_default_types = %$ndt; + my %defaults = %$odef; + my %new_defaults = %$ndef; + my %options = %$nopt; + my %resolution_map = %$nres; if ($debug & 4) { print "Options (Old->New Default Type):\n"; @@ -524,7 +546,7 @@ sub update_ppd ($) { } } return 0; - } + } if (! $reset_defaults) { # Update source buffer with old defaults... @@ -533,22 +555,31 @@ sub update_ppd ($) { default_loop: foreach my $default_option (sort keys %defaults) { my $option; + my $default_option_value = $defaults{$default_option}; ($option = $default_option) =~ s/Default//; # Strip off `Default' # Check method is valid my $orig_method = $orig_default_types{$option}; my $new_method = $new_default_types{$option}; + my $new_default = $new_defaults{$default_option}; if ((!defined($orig_method) || !defined($new_method)) || $orig_method ne $new_method) { next; } + if (defined($new_default) && + $default_option_value eq $new_default) { + if ($verbose) { + print "$ppd_source_filename: Preserve *$default_option ($default_option_value)\n"; + } + next; + } if ($new_method eq "PickOne") { # Check the old setting is valid foreach my $opt (@{$options{$option}}) { - my $def_option = $defaults{$default_option}; + my $def_option = $default_option_value; if (($def_option eq $opt) || ($option eq "Resolution" && - (defined $resolution_map{$defaults{$default_option}}) && - ($def_option = $resolution_map{$defaults{$default_option}}) eq $opt)) { # Valid option + (defined $resolution_map{$default_option_value}) && + ($def_option = $resolution_map{$default_option_value}) eq $opt)) { # Valid option # Set the option in the new PPD $source_data =~ s/\*($default_option).*/*$1:$def_option/m; if ($verbose) { @@ -557,7 +588,7 @@ default_loop: next default_loop; } } - warn "Warning: $ppd_source_filename: Invalid option: *$default_option: $defaults{$default_option}. Using default setting.\n"; + warn "Warning: $ppd_source_filename: Invalid option: *$default_option: $defaults{$default_option}. Using default setting $new_defaults{$default_option}.\n"; next; } warn "Warning: $ppd_source_filename: PPD OpenUI method $new_default_types{$default_option} not understood.\n"; @@ -568,12 +599,12 @@ default_loop: my $tmpnew = "${ppd_dest_filename}.new"; if (! open NEWPPD, "> $tmpnew") { - warn "Can't open $tmpnew for writing: $!\n"; + warn "Can't create $tmpnew: $!\n"; return 0; } print NEWPPD $source_data; if (! close NEWPPD) { - warn "Can't close ${tmpnew}.new for writing: $!\n"; + warn "Can't write to $tmpnew: $!\n"; unlink $tmpnew; return 0; } @@ -601,13 +632,13 @@ default_loop: sub find_ppd ($$$$) { my($gutenprintfilename, $drivername, $lang, $region) = @_; my $file; # filename to return - my ($key) = '^\\*FileVersion:[ ]*"@VERSION@"$'; + my ($key) = '^\\*FileVersion:[ ]*' . "$file_version"; my ($lingo, $suffix, $base, $basedir); my ($current_best_file, $current_best_time); my ($stored_name, $stored_dir, $simplified); $stored_name = $gutenprintfilename; - $stored_name =~ s,.*/([^/]*)(.sim)?(.ppd)?(.gz)?$,$1,; - if ($gutenprintfilename =~ m,.*/([^/]*)(.sim)(.ppd)?(.gz)?$,) { + $stored_name =~ s,.*/([^/]+\.[0-9]+\.[0-9]+)(\.sim)?(\.ppd)?(\.gz)?$,$1,; + if ($gutenprintfilename =~ m,.*/([^/]*)(\.sim)(\.ppd)?(\.gz)?$,) { $simplified = ".sim"; } else { $simplified = ""; @@ -617,23 +648,38 @@ sub find_ppd ($$$$) { $current_best_file = ""; $current_best_time = 0; + my (@basedirs); + if ($opt_s) { + @basedirs = ($opt_s); + } else { + @basedirs = ($ppd_base_dir, $stored_dir, $ppd_root_dir); + } + + my (@lingos); + if ($region ne "") { + push @lingos, "${lang}_${region}/"; + } + push @lingos, "$lang/"; + if ($lang ne "C") { + push @lingos, "C/"; + } + push @lingos, "en/", ""; + my (@bases); + push @bases, "stp-${drivername}.$version${simplified}"; + push @bases, "${drivername}.$version${simplified}"; + if ($stored_name ne "${drivername}.$version${simplified}" and + $stored_name ne "stp-${drivername}.$version${simplified}") { + push @bases, $stored_name; + } + push @bases, $drivername; # All possible candidates, in order of usefulness and gzippedness - foreach $lingo ("${lang}_${region}/", - "$lang/", - "en/", - "C/", - "") { + foreach $lingo (@lingos) { foreach $suffix (".ppd$gzext", ".ppd") { - foreach $base ("${drivername}.$version${simplified}", - "stp-${drivername}.$version${simplified}", - $stored_name, - $drivername) { - foreach $basedir ($ppd_base_dir, - $stored_dir, - $ppd_root_dir) { - if (! $basedir || ! $base) { next; } + foreach $base (@bases) { + foreach $basedir (@basedirs) { + if ($basedir eq "" || $base eq "") { next; } my ($fn) = "$basedir/$lingo$base$suffix"; if ($debug & 8) { print "Trying $fn for $gutenprintfilename, $lang, $region\n"; @@ -641,16 +687,19 @@ sub find_ppd ($$$$) { # Check that it is a regular file, owned by root.root, not writable # by other, and is readable by root. i.e. the file is secure. my @sb = stat $fn or next; - if (S_ISREG($sb[2]) && ($sb[4] == 0)) { + if ($debug & 8) { + print " Candidate $fn for $gutenprintfilename, $lang, $region\n"; + } + if ($opt_f || (S_ISREG($sb[2]) && ($sb[4] == 0))) { # Check that the file is a valid Gutenprint PPD file # of the correct version. - my $file_version; + my $new_file_version; if ($fn =~ m/\.gz$/) { - $file_version = `gunzip -c $fn | grep '$key'`; + $new_file_version = `gunzip -c $fn | grep '$key'`; } else { - $file_version = `cat $fn | grep '$key'`; + $new_file_version = `cat $fn | grep '$key'`; } - if ($file_version ne "") { + if ($new_file_version ne "") { if ($debug & 8) { print " Format valid: time $sb[9] best $current_best_time prev $current_best_file cur $fn!\n"; } @@ -682,93 +731,52 @@ sub find_ppd ($$$$) { return undef; } -# Return the default options from the given PPD filename -sub get_default_types(*) { - my $fh = $_[0]; - my %default_types; - - # Read each line of the original PPD file, and store all OpenUI - # names and their types in a hash... - seek ($fh, 0, 0) or die "can't seek to start of PPD file"; - while (<$fh>) { - if ( m/^\*OpenUI/ ) { - chomp; - my ($key, $value) = /^\*OpenUI\s\*([[:alnum:]]+).*:\s([[:alnum:]]+)/; - if ($key && $value) { - $default_types{$key}=$value; - } - } - } - return %default_types; -} - - -# Return the default options from the given PPD filename -sub get_resolution_map(*) { - my $fh = $_[0]; - my %resolution_map; - - # Read each line of the original PPD file, and store all OpenUI - # names and their types in a hash... - seek ($fh, 0, 0) or die "can't seek to start of PPD file"; - while (<$fh>) { - if ( m/^\*StpResolutionMap:/ ) { - chomp; - my ($junk, $new, $old) = split; - $resolution_map{$old} = $new; - } - } - return %resolution_map; -} - - -# Return the default options from the given PPD filename -sub get_defaults(*) { - my $fh = $_[0]; - my %defaults; - - # Read each line of the original PPD file, and store all default - # names and their values in a hash... - seek ($fh, 0, 0) or die "can't seek to start of PPD file"; - while (<$fh>) { - if ( m/^\*Default/ ) { - chomp; - my($key, $value) = /^\*([[:alnum:]]+):\s*([[:alnum:]]+)/; - if ($key && $value) { - $defaults{$key}=$value; - } - } - } - return %defaults; -} - - -# Return the available options from the given PPD filename -sub get_options(*\%) { - my $fh = $_[0]; - my $validopts = $_[1]; - my %options; - - # For each valid option name, grab each valid option for that name - # and store in a hash of arrays... - - foreach (sort keys %$validopts) { - my $tmp = $_; - my @optionlist; - - seek ($fh, 0, 0) or die "can't seek to start of PPD file"; +# Return default type, options, resolutions, and default values. +# More efficient since it takes only one pass over the data. +sub get_ppd_data(*$$$$$) { + my ($fh, $types, $opts, $resolutions, $defaults, $data) = @_; + my (%options, %defaults, %resolution_map, %default_types); + my $cur_opt = ""; + my (@optionlist); + my ($source_data) = ""; + if ($reset_defaults) { + $types = 0; + $opts = 0; + $resolutions = 0; + $defaults = 0; + } + + if ($resolutions || $types || $opts || $defaults || $data) { while (<$fh>) { - if ( m/^\*$tmp/ ) { - chomp; - my ($value) = /^\*$tmp\s*([[:alnum:]]+)[\/:]/; - if ($value) { + $source_data .= $_ if ($data); + chomp; + if (($types || $opts) && m/^\*OpenUI/) { + my ($key, $value) = /^\*OpenUI\s\*([[:alnum:]]+).*:\s([[:alnum:]]+)/; + if ($key && $value) { + $default_types{$key}=$value; + $cur_opt = $key; + } + } elsif ($opts && m/^\*CloseUI/) { + if ($cur_opt ne "") { + $options{$cur_opt} = [ @optionlist ]; + $cur_opt = ""; + } + @optionlist = (); + } elsif ($opts && m/^\*$cur_opt/) { + my ($value) = /^\*$cur_opt\s*([[:alnum:]]+)[\/:]/; + if (defined $value && $value) { push @optionlist, $value; } + } elsif ($resolutions && m/^\*StpResolutionMap:/) { + my ($junk, $new, $old) = split; + $resolution_map{$old} = $new; + } elsif ($defaults && m/^\*Default/) { + my($key, $value) = /^\*([[:alnum:]]+):\s*([[:alnum:]]+)/; + if ($key && $value) { + $defaults{$key}=$value; + } } } - if (@optionlist) { - $options{$tmp} = [ @optionlist ]; - } } - return %options; + return (\%default_types, \%options, \%resolution_map, \%defaults, $source_data); } diff --git a/src/cups/epson.c b/src/cups/epson.c deleted file mode 100644 index f3e326c..0000000 --- a/src/cups/epson.c +++ /dev/null @@ -1,879 +0,0 @@ -/* - * "$Id: epson.c,v 1.7.8.2 2007/12/23 17:30:04 easysw Exp $" - * - * EPSON backend for the Common UNIX Printing System. - * - * Copyright 1993-2000 by Easy Software Products. - * - * 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. - * - * Contents: - * - * main() - Send a file to the specified parallel port. - * list_devices() - List all parallel devices. - */ - -/* - * Include necessary headers. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <cups/cups.h> -#include <stdlib.h> -#include <errno.h> -#include <signal.h> -#include <ctype.h> -#ifdef HAVE_TIME_H -# include <time.h> -#endif - -#if defined(WIN32) || defined(__EMX__) -# include <io.h> -#else -# include <unistd.h> -# include <fcntl.h> -# include <termios.h> -#endif /* WIN32 || __EMX__ */ - -#if defined(WIN32) || defined(__EMX__) -# include <winsock.h> -#else -# include <sys/socket.h> -# include <netinet/in.h> -# include <arpa/inet.h> -# include <netdb.h> -#endif /* WIN32 || __EMX__ */ - -#ifdef __linux -# include <sys/param.h> -# include <sys/types.h> -# include <sys/stat.h> -# include <dirent.h> -# include <unistd.h> -#endif /* __linux */ - -#ifdef __sgi -# include <invent.h> -# ifndef INV_EPP_ECP_PLP -# define INV_EPP_ECP_PLP 6 /* From 6.3/6.4/6.5 sys/invent.h */ -# define INV_ASO_SERIAL 14 /* serial portion of SGI ASO board */ -# define INV_IOC3_DMA 16 /* DMA mode IOC3 serial */ -# define INV_IOC3_PIO 17 /* PIO mode IOC3 serial */ -# define INV_ISA_DMA 19 /* DMA mode ISA serial -- O2 */ -# endif /* !INV_EPP_ECP_PLP */ -#endif /* __sgi */ - - -/* - * Local functions... - */ - -void list_devices(void); -void read_backchannel(int fd_out); - -/* - * 'main()' - Send a file to the specified parallel port. - * - * Usage: - * - * printer-uri job-id user title copies options [file] - */ - -int /* O - Exit status */ -main(int argc, /* I - Number of command-line arguments (6 or 7) */ - char *argv[]) /* I - Command-line arguments */ -{ - char method[1024], /* Method in URI */ - hostname[1024], /* Hostname */ - username[1024], /* Username info (not used) */ - resource[1024], /* Resource info (device and options) */ - *options; /* Pointer to options */ - int port; /* Port number (not used) */ - int copies; /* Number of copies to print */ - int fd_out, /* Parallel/USB device or socket */ - fd_in, /* Print file */ - error; /* Last error */ - struct sockaddr_in addr; /* Socket address */ - struct hostent *hostaddr; /* Host address */ - int wbytes; /* Number of bytes written */ - int nbytes, /* Number of bytes read */ - tbytes; /* Total number of bytes written */ - char buffer[8192], /* Output buffer */ - *bufptr; /* Pointer into buffer */ - struct termios opts; /* Parallel port options */ -#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) - struct sigaction action; /* Actions for POSIX signals */ -#endif /* HAVE_SIGACTION && !HAVE_SIGSET */ - - - if (argc == 1) - { - list_devices(); - return (0); - } - else if (argc < 6 || argc > 7) - { - fputs("Usage: epson job-id user title copies options [file]\n", stderr); - return (1); - } - - /* - * If we have 7 arguments, print the file named on the command-line. - * Otherwise, send stdin instead... - */ - - if (argc == 6) - { - fd_in = fileno(stdin); - copies = 1; - } - else - { - /* - * Try to open the print file... - */ - - if ((fd_in = open(argv[6], O_RDONLY)) < 0) - { - perror("ERROR: unable to open print file"); - return (1); - } - - copies = atoi(argv[4]); - } - - /* - * Extract the device name and options from the URI... - */ - - httpSeparate(argv[0], method, username, hostname, &port, resource); - - /* - * See if there are any options... - */ - - if ((options = strchr(resource, '?')) != NULL) - { - /* - * Yup, terminate the device name string and move to the first - * character of the options... - */ - - *options++ = '\0'; - } - - if (hostname[0]) - { - /* - * Lookup the IP address... - */ - - if ((hostaddr = gethostbyname(hostname)) == NULL) - { - fprintf(stderr, "ERROR: Unable to locate printer \'%s\' - %s", - hostname, strerror(errno)); - return (1); - } - - if (port == 0) - port = 9100; /* Default for EPSON NIC */ - - fprintf(stderr, "INFO: Attempting to connect to printer %s on port %d\n", - hostname, port); - - memset(&addr, 0, sizeof(addr)); - memcpy(&(addr.sin_addr), hostaddr->h_addr, hostaddr->h_length); - addr.sin_family = hostaddr->h_addrtype; - addr.sin_port = htons(port); - - /* - * Try to connect... - */ - - for (;;) - { - if ((fd_out = socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - perror("ERROR: Unable to create socket"); - return (1); - } - - if (connect(fd_out, (struct sockaddr *)&addr, sizeof(addr)) < 0) - { - error = errno; - close(fd_out); - fd_out = -1; - - if (error == ECONNREFUSED) - { - fprintf(stderr, "INFO: Network printer \'%s\' is busy; will retry in 30 seconds...\n", - hostname); - sleep(30); - } - else - { - perror("ERROR: Unable to connect to printer"); - sleep(30); - } - } - else - break; - } - - fputs("INFO: Connected to printer, sending print job...\n", stderr); - } - else - { - /* - * Open the parallel or USB port device... - */ - - do - { - if ((fd_out = open(resource, O_RDWR | O_EXCL | O_NONBLOCK)) == -1) - { - if (errno == EBUSY) - { - fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr); - sleep(30); - } - else - { - perror("ERROR: Unable to open parallel port device file"); - return (1); - } - } - } - while (fd_out < 0); - - /* - * Set any options provided... - */ - - tcgetattr(fd_out, &opts); - - opts.c_cflag |= CREAD; /* Enable reading */ - opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */ - - /**** No options supported yet ****/ - - tcsetattr(fd_out, TCSANOW, &opts); - } - - /* - * Set nonblocking I/O, if possible (might already be set). - */ - fcntl(fd_out, F_SETFL, - O_NONBLOCK | fcntl(fd_out, F_GETFL)); - - /* - * Now that we are "connected" to the port, ignore SIGTERM so that we - * can finish out any page data the driver sends (e.g. to eject the - * current page... - */ - -#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */ - sigset(SIGTERM, SIG_IGN); -#elif defined(HAVE_SIGACTION) - memset(&action, 0, sizeof(action)); - - sigemptyset(&action.sa_mask); - action.sa_handler = SIG_IGN; - sigaction(SIGTERM, &action, NULL); -#else - signal(SIGTERM, SIG_IGN); -#endif /* HAVE_SIGSET */ - - /* - * Finally, send the print file... - */ - - while (copies > 0) - { - copies --; - - if (fd_in != fileno(stdin)) - { - fputs("PAGE: 1 1\n", stderr); - lseek(fd_in, 0, SEEK_SET); - } - - tbytes = 0; - while ((nbytes = read(fd_in, buffer, sizeof(buffer))) > 0) - { - /* - * Write the print data to the printer... - */ - - tbytes += nbytes; - bufptr = buffer; - - while (nbytes > 0) - { - if ((wbytes = write(fd_out, bufptr, nbytes)) < 0 && - (errno == EAGAIN || errno == EINTR)) - { - /* Write would block, so sleep 0.002s and retry... */ - - /* - * Check for possible data coming back from the printer... - */ -#if defined(HAVE_TIME_H) && defined(HAVE_NANOSLEEP) - struct timespec sleeptime; -#elif defined(HAVE_UNISTD_H) && defined(HAVE_USLEEP) -#else - struct timeval timeout; -#endif - read_backchannel(fd_out); -#if defined(HAVE_TIME_H) && defined(HAVE_NANOSLEEP) - sleeptime.tv_sec = 0; - sleeptime.tv_nsec = 2000000; - nanosleep(&sleeptime, &sleeptime); -#elif defined(HAVE_UNISTD_H) && defined(HAVE_USLEEP) - usleep(200000); -#else - timeout.tv_sec = 0; - timeout.tv_usec = 2000; - select(1, NULL, NULL, NULL, &timeout); -#endif - continue; - } - else if (wbytes < 0) /* write error */ - break; - - nbytes -= wbytes; - bufptr += wbytes; - } - - if (nbytes > 0) - { - perror("ERROR: Unable to send print file to printer"); - break; - } - - if (argc > 6) - fprintf(stderr, "INFO: Sending print file, %u bytes...\n", tbytes); - - } - } - - /* - * Close the socket connection or parallel/USB device and input file and - * return... - */ - - close(fd_out); - if (fd_in != fileno(stdin)) - close(fd_in); - - return (0); -} - - -/* - * 'read_backchannel()' - read data sent back from printer. - */ -void -read_backchannel(int fd_out) -{ - static int backchannel = 1; /* Read backchannel data? */ - int nbytes; /* Number of bytes read */ - int ninks = 0; /* Number of inks */ - char buffer[8192], /* Output buffer */ - *bufptr; /* Pointer into buffer */ - - - if (!backchannel) - return; - - if ((nbytes = read(fd_out, buffer, sizeof(buffer) - 1)) < 0 && errno != EAGAIN) - { - fprintf(stderr, "ERROR: Back-channel read error - %s!\n", - strerror(errno)); - backchannel = 0; - return; - } - - /* - * Some devices report themselves permanently ready to read... - */ - - /*fprintf(stderr, "Backchannel read: %d bytes\n", nbytes);*/ - - if (nbytes <= 0) - return; - - buffer[nbytes] = '\0'; - if (strncmp(buffer, "@BDC ", 5) != 0) - fprintf(stderr, "WARNING: Received %d bytes of unknown back-channel data!\n", - nbytes); - else - { - - /* - * Get status data... - */ - - bufptr = strstr(&buffer[0], "IQ:"); - /*fprintf(stderr, "READBACK: %20s\n", bufptr);*/ - - if (bufptr) - { - /* - * Report ink level... - */ - - int i; - int levels[7]; - - bufptr += 3; - - for (i = 0; i < 7 && bufptr < &buffer[sizeof(buffer)-1]; - i ++, bufptr += 2) - { - int j, inkend = 0; - - if (!bufptr[0] || bufptr[0] == ';') - break; - - for (j = 0; j < 2; j++) - { - if (bufptr[j] >= '0' && bufptr[j] <= '9') - bufptr[j] -= '0'; - else if (bufptr[j] >= 'A' && bufptr[j] <= 'F') - bufptr[j] = bufptr[j] - 'A' + 10; - else if (bufptr[j] >= 'a' && bufptr[j] <= 'f') - bufptr[j] = bufptr[j] - 'a' + 10; - else - { - inkend = 1; - break; - } - } - levels[i] = (bufptr[0] << 4) + bufptr[1]; - - if (inkend) - break; - - ninks++; - } - - switch (ninks) - { - case 1 : - case 2 : - fprintf(stderr, "K=%d\n", levels[0]); - break; - case 3 : - fprintf(stderr, "C=%d M=%d Y=%d\n", levels[0], levels[1], - levels[2]); - break; - case 4 : - case 5 : - fprintf(stderr, "K=%d C=%d M=%d Y=%d\n", levels[0], - levels[1], levels[2], levels[3]); - break; - case 6 : - fprintf(stderr, "K=%d C=%d M=%d Y=%d LC=%d LM=%d\n", - levels[0], levels[1], levels[2], levels[3], - levels[4], levels[5]); - break; - case 7 : - fprintf(stderr, "K=%d C=%d M=%d Y=%d LC=%d LM=%d GY=%d\n", - levels[0], levels[1], levels[2], levels[3], - levels[4], levels[5], levels[6]); - } - } - else - fprintf(stderr, "INFO: %s\n", buffer); - } -} - -/* - * 'list_devices()' - List all parallel devices. - */ - -void -list_devices(void) -{ -#ifdef __linux - int i; /* Looping var */ - int fd; /* File descriptor */ - char device[255]; /* Device filename */ - FILE *probe; /* /proc/parport/n/autoprobe file */ - DIR *dirprobe; /* scan /sys/bus/usb/drivers/usblp */ - char line[1024], /* Line from file */ - *delim, /* Delimiter in file */ - make[IPP_MAX_NAME], /* Make from file */ - model[IPP_MAX_NAME]; /* Model from file */ - - - /* - * Probe for parallel devices... - */ - - for (i = 0; i < 4; i ++) - { - sprintf(device, "/proc/sys/dev/parport/parport%d/autoprobe", i); - probe = fopen(device, "r"); - if ( probe == NULL ) /* older kernel versions */ - { - sprintf(device, "/proc/parport/%d/autoprobe", i); - probe = fopen(device, "r"); - } - if ( probe != NULL ) - { - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - - while (fgets(line, sizeof(line), probe) != NULL) - { - /* - * Strip trailing ; and/or newline. - */ - - if ((delim = strrchr(line, ';')) != NULL) - *delim = '\0'; - else if ((delim = strrchr(line, '\n')) != NULL) - *delim = '\0'; - - /* - * Look for MODEL and MANUFACTURER lines... - */ - - if (strncmp(line, "MODEL:", 6) == 0 && - strncmp(line, "MODEL:Unknown", 13) != 0) - strncpy(model, line + 6, sizeof(model) - 1); - else if (strncmp(line, "MANUFACTURER:", 13) == 0 && - strncmp(line, "MANUFACTURER:Unknown", 20) != 0) - strncpy(make, line + 13, sizeof(make) - 1); - } - - fclose(probe); - - if (strcasecmp(make, "EPSON") == 0) - printf("direct epson:/dev/lp%d \"%s %s\" \"Gutenprint Parallel Port #%d\"\n", - i, make, model, i + 1); - } - else - { - sprintf(device, "/dev/lp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct epson:%s \"EPSON\" \"Gutenprint Parallel Port #%d\"\n", device, i + 1); - } - } - } - - /* - * Probe for USB devices... - */ - - if ((dirprobe = opendir("/sys/class/usb")) != NULL) /* SYSFS in kernel 2.6 */ - { - struct dirent *dirent; /* directory entries */ - struct stat statbuf; /* file stat */ - char entry[MAXPATHLEN]; /* pathname to usb entries */ - char link[MAXPATHLEN]; /* linkname of usb entries */ - char *cptr; /* multi used character pointer */ - FILE *file; /* read printer specific info from */ - - i = 0; - /* scan the directory entries */ - while((dirent = readdir(dirprobe)) != 0) - { - /* skip "." and ".." */ - if (dirent->d_name[0] != 'l' || dirent->d_name[1] != 'p') - continue; - - /* generate path to work with */ - snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/device", dirent->d_name); - - /* look, if we have a pointer */ - if(lstat(entry, &statbuf) < 0) - { - perror(entry); - continue; - } - - if (S_ISLNK(statbuf.st_mode)) - { - /* get the path to the link */ - if (readlink(entry, link, MAXPATHLEN) < 0) - continue; - - /* find right occurance of '/' */ - if ((cptr = strrchr(link, '/')) == NULL) - { - continue; - } - - /* - * and truncate path: cut away everything after the '/', - * because parallel directory contains the information we need - */ - *cptr = '\0'; - - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - /* read manufacturer */ - snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/manufacturer", - dirent->d_name, link); - - if ((file = fopen(entry, "r")) == NULL) - { - /* skip this entry, there is no file "manufacturer" */ - continue; - } - /* read data in */ - fread(make, sizeof(make)-1, sizeof(char), file); - fclose(file); - - /* beautify "make" - strip newline away */ - if ((cptr = strrchr(make, '\n')) != NULL) - { - *cptr = '\0'; - } - - /* next entry, if manufacturer is not EPSON */ - if (strcasecmp(make, "EPSON") != 0) - continue; - - /* read product name */ - snprintf(entry, MAXPATHLEN, "/sys/class/usb/%s/%s/product", - dirent->d_name, link); - - if ((file = fopen(entry, "r")) == NULL) - { - /* skip this entry, there is no file "product" */ - continue; - } - /* read data in */ - fread(model, sizeof(model)-1, sizeof(char), file); - fclose(file); - - /* beautify "model" - strip away newline */ - if ((cptr = strrchr(model, '\n')) != NULL) - { - *cptr = '\0'; - } - sprintf(device, "/dev/usb/%s", dirent->d_name); - if (access(device, 0)) - { - sprintf(device, "/dev/usb/usb%s", dirent->d_name); - - if (access(device, 0)) - sprintf(device, "/dev/usb%s", dirent->d_name); - } - - printf("direct epson:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n", - device, make, model, ++i); - } - } - closedir(dirprobe); - } - else if ((probe = fopen("/proc/bus/usb/devices", "r")) != NULL) - { - i = 0; - - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - - while (fgets(line, sizeof(line), probe) != NULL) - { - /* - * Strip trailing newline. - */ - - if ((delim = strrchr(line, '\n')) != NULL) - *delim = '\0'; - - /* - * See if it is a printer device ("P: ...") - */ - - if (strncmp(line, "S:", 2) == 0) - { - /* - * String attribute... - */ - - if (strncmp(line, "S: Manufacturer=", 17) == 0) - { - strncpy(make, line + 17, sizeof(make) - 1); - if (strcmp(make, "Hewlett-Packard") == 0) - strcpy(make, "HP"); - } - else if (strncmp(line, "S: Product=", 12) == 0) - strncpy(model, line + 12, sizeof(model) - 1); - } - else if (strncmp(line, "I:", 2) == 0 && - strstr(line, "Driver=printer") != NULL && - make[0] && model[0]) - { - /* - * We were processing a printer device; send the info out... - */ - - if (strcmp(make, "EPSON") == 0) - { - sprintf(device, "/dev/usb/lp%d", i); - if (access(device, 0)) - { - sprintf(device, "/dev/usb/usblp%d", i); - - if (access(device, 0)) - sprintf(device, "/dev/usblp%d", i); - } - - printf("direct epson:%s \"%s %s\" \"Gutenprint USB Printer #%d\"\n", - device, make, model, i + 1); - } - - i ++; - - memset(make, 0, sizeof(make)); - memset(model, 0, sizeof(model)); - } - } - - fclose(probe); - } - else - { - for (i = 0; i < 8; i ++) - { - sprintf(device, "/dev/usb/lp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct epson:%s \"EPSON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1); - } - - sprintf(device, "/dev/usb/usblp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct epson:%s \"EPSON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1); - } - - sprintf(device, "/dev/usblp%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct epson:%s \"EPSON\" \"Gutenprint USB Printer #%d\"\n", device, i + 1); - } - } - } -#elif defined(__sgi) - int i, j, n; /* Looping vars */ - char device[255]; /* Device filename */ - inventory_t *inv; /* Hardware inventory info */ - - - /* - * IRIX maintains a hardware inventory of most devices... - */ - - setinvent(); - - while ((inv = getinvent()) != NULL) - { - if (inv->inv_class == INV_PARALLEL && inv->inv_type == INV_EPP_ECP_PLP) - { - /* - * Standard parallel port... - */ - - puts("direct epson:/dev/plpbi \"EPSON\" \"Gutenprint Onboard Parallel Port\""); - } - } - - endinvent(); -#elif defined(__sun) - int i, j, n; /* Looping vars */ - char device[255]; /* Device filename */ - - - /* - * Standard parallel ports... - */ - - for (i = 0; i < 10; i ++) - { - sprintf(device, "/dev/ecpp%d", i); - if (access(device, 0) == 0) - printf("direct epson:%s \"EPSON\" \"Gutenprint Sun IEEE-1284 Parallel Port #%d\"\n", - device, i + 1); - } - - for (i = 0; i < 3; i ++) - { - sprintf(device, "/dev/lp%d", i); - - if (access(device, 0) == 0) - printf("direct epson:%s \"EPSON\" \"Gutenprint PC Parallel Port #%d\"\n", - device, i + 1); - } -#elif defined(FreeBSD) || defined(OpenBSD) || defined(NetBSD) - int i; /* Looping var */ - int fd; /* File descriptor */ - char device[255]; /* Device filename */ - - - /* - * Probe for parallel devices... - */ - - for (i = 0; i < 3; i ++) - { - sprintf(device, "/dev/lpt%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct epson:%s \"EPSON\" \"Gutenprint Parallel Port #%d (interrupt-driven)\"\n", device, i + 1); - } - - sprintf(device, "/dev/lpa%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct epson:%s \"EPSON\" \"Gutenprint Parallel Port #%d (polled)\"\n", device, i + 1); - } - } - - /* - * Probe for USB devices... - */ - - for (i = 0; i < 3; i ++) - { - sprintf(device, "/dev/ulpt%d", i); - if ((fd = open(device, O_RDWR)) >= 0) - { - close(fd); - printf("direct epson:%s \"EPSON\" \"Gutenprint USB Port #%d\"\n", device, i + 1); - } - } -#endif -} - - -/* - * End of "$Id: epson.c,v 1.7.8.2 2007/12/23 17:30:04 easysw Exp $". - */ diff --git a/src/cups/genppd.c b/src/cups/genppd.c index 3ba6953..8df934f 100644 --- a/src/cups/genppd.c +++ b/src/cups/genppd.c @@ -1,5 +1,5 @@ /* - * "$Id: genppd.c,v 1.119.2.5 2007/12/23 17:30:05 easysw Exp $" + * "$Id: genppd.c,v 1.142 2008/04/06 21:16:08 rlk Exp $" * * PPD file generation program for the CUPS drivers. * @@ -293,6 +293,12 @@ cat_ppd(int argc, char **argv) /* I - Driver URI */ return (1); } + if (strcmp(scheme, "gutenprint." GUTENPRINT_RELEASE_VERSION) != 0) + { + fprintf(stderr, "ERROR: Gutenprint version mismatch!\n"); + return(1); + } + s = strchr(resource + 1, '/'); if (s) { @@ -1107,7 +1113,6 @@ write_ppd( gzputs(fp, "*PSVersion: \"(2017.000) 550\"\n"); else { - gzputs(fp, "*PSVersion: \"(3010.000) 550\"\n"); gzputs(fp, "*PSVersion: \"(3010.000) 651\"\n"); gzputs(fp, "*PSVersion: \"(3010.000) 652\"\n"); gzputs(fp, "*PSVersion: \"(3010.000) 653\"\n"); @@ -1526,6 +1531,7 @@ write_ppd( stp_clear_string_parameter(v, "Resolution"); stp_describe_parameter(v, "Quality", &desc1); stp_set_string_parameter(v, "Quality", desc1.deflt.str); + stp_parameter_description_destroy(&desc1); stp_describe_resolution(v, &xdpi, &ydpi); stp_clear_string_parameter(v, "Quality"); tmp_xdpi = xdpi; @@ -1924,5 +1930,5 @@ write_ppd( /* - * End of "$Id: genppd.c,v 1.119.2.5 2007/12/23 17:30:05 easysw Exp $". + * End of "$Id: genppd.c,v 1.142 2008/04/06 21:16:08 rlk Exp $". */ diff --git a/src/cups/rastertoprinter.c b/src/cups/rastertoprinter.c index 2f636ea..9c25137 100644 --- a/src/cups/rastertoprinter.c +++ b/src/cups/rastertoprinter.c @@ -1,5 +1,5 @@ /* - * "$Id: rastertoprinter.c,v 1.105.2.6 2008/01/02 01:38:09 rlk Exp $" + * "$Id: rastertoprinter.c,v 1.120 2008/01/02 01:39:06 rlk Exp $" * * Gutenprint based raster filter for the Common UNIX Printing System. * @@ -1389,5 +1389,5 @@ Image_width(stp_image_t *image) /* I - Image */ /* - * End of "$Id: rastertoprinter.c,v 1.105.2.6 2008/01/02 01:38:09 rlk Exp $". + * End of "$Id: rastertoprinter.c,v 1.120 2008/01/02 01:39:06 rlk Exp $". */ diff --git a/src/escputil/Makefile.in b/src/escputil/Makefile.in index c4c7077..0aeaade 100644 --- a/src/escputil/Makefile.in +++ b/src/escputil/Makefile.in @@ -43,13 +43,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src/escputil ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -127,27 +126,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -155,13 +140,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -266,16 +244,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -304,6 +278,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la escputil_SOURCES = d4lib.c escputil.c d4lib.h escputil_LDADD = $(GUTENPRINT_LIBS) $(LIBREADLINE_DEPS) MAINTAINERCLEANFILES = Makefile.in diff --git a/src/escputil/d4lib.c b/src/escputil/d4lib.c index ee36227..46e508a 100644 --- a/src/escputil/d4lib.c +++ b/src/escputil/d4lib.c @@ -311,6 +311,7 @@ static int printError(unsigned char errorNb) msg++; } fprintf(stderr,"Unknown IEEE 1284.4 error number %d\n",errorNb); + return 0; return 1; /* non recoverable error */ } diff --git a/src/escputil/escputil.c b/src/escputil/escputil.c index a28cd07..4ebdab3 100644 --- a/src/escputil/escputil.c +++ b/src/escputil/escputil.c @@ -1,5 +1,5 @@ /* - * "$Id: escputil.c,v 1.87.8.3 2007/12/29 20:42:25 rlk Exp $" + * "$Id: escputil.c,v 1.92 2007/12/26 18:13:02 rlk Exp $" * * Printer maintenance utility for EPSON Stylus (R) printers * diff --git a/src/foomatic/Makefile.in b/src/foomatic/Makefile.in index 872d850..d854d6a 100644 --- a/src/foomatic/Makefile.in +++ b/src/foomatic/Makefile.in @@ -48,13 +48,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src/foomatic ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -145,27 +144,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -173,13 +158,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -284,16 +262,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -322,6 +296,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la DISTDIRS = foomatic-templates-ijs LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) @BUILD_FOOMATIC_3_TRUE@BUILD_FOOMATIC = 1 diff --git a/src/foomatic/foomatic-printermap b/src/foomatic/foomatic-printermap index d2efaa9..cbe6867 100644 --- a/src/foomatic/foomatic-printermap +++ b/src/foomatic/foomatic-printermap @@ -105,6 +105,7 @@ #gptofoo bjc-PIXMA-iP5000 printer/Canon-PIXMA-iP5000 #gptofoo bjc-PIXMA-iP5200 printer/Canon-PIXMA-iP5200 #gptofoo bjc-PIXMA-iP5300 printer/Canon-PIXMA-iP5300 +#gptofoo bjc-PIXMA-iP6000D printer/Canon-PIXMA-iP6000D #gptofoo bjc-PIXMA-iP6700 printer/Canon-PIXMA-iP6700 #gptofoo bjc-PIXMA-iP8500 printer/Canon-PIXMA-iP8500 #gptofoo bjc-PIXMA-iX5000 printer/Canon-PIXMA-iX5000 @@ -113,6 +114,7 @@ #gptofoo bjc-MULTIPASS-MP170 printer/Canon-MULTIPASS-MP170 #gptofoo bjc-MULTIPASS-MP180 printer/Canon-MULTIPASS-MP180 #gptofoo bjc-MULTIPASS-MP500 printer/Canon-MULTIPASS-MP500 +#gptofoo bjc-MULTIPASS-MP520 printer/Canon-MULTIPASS-MP520 #gptofoo bjc-MULTIPASS-MP610 printer/Canon-MULTIPASS-MP610 #gptofoo bjc-MULTIPASS-MP700 printer/Canon-MULTIPASS-MP700 #gptofoo bjc-MULTIPASS-MP710 printer/Canon-MULTIPASS-MP710 @@ -163,6 +165,11 @@ #gptofoo escp2-e100 printer/Epson-E_100 #gptofoo escp2-e150 printer/Epson-E_150 #gptofoo escp2-e200 printer/Epson-E_200 +#gptofoo escp2-e300 printer/Epson-E_300 +#gptofoo escp2-e500 printer/Epson-E_500 +#gptofoo escp2-e520 printer/Epson-E_520 +#gptofoo escp2-e700 printer/Epson-E_700 +#gptofoo escp2-e720 printer/Epson-E_720 #gptofoo escp2-mc10000 printer/Epson-MC_10000 #gptofoo escp2-mc2000 printer/Epson-MC_2000 #gptofoo escp2-mc5000 printer/Epson-MC_5000 @@ -233,14 +240,21 @@ #gptofoo escp2-pxv780 printer/Epson-PX_V780 #gptofoo escp2-picmate printer/Epson-PictureMate #gptofoo escp2-picmated printer/Epson-PictureMate_Deluxe +#gptofoo escp2-picmatedash printer/Epson-PictureMate_Dash #gptofoo escp2-picmateflash printer/Epson-PictureMate_Flash #gptofoo escp2-picmatepal printer/Epson-PictureMate_Pal #gptofoo escp2-picmatesnap printer/Epson-PictureMate_Snap +#gptofoo escp2-picmate100 printer/Epson-PictureMate_100 #gptofoo escp2-picmate200 printer/Epson-PictureMate_200 #gptofoo escp2-picmate210 printer/Epson-PictureMate_210 #gptofoo escp2-picmate240 printer/Epson-PictureMate_240 #gptofoo escp2-picmate250 printer/Epson-PictureMate_250 +#gptofoo escp2-picmate260 printer/Epson-PictureMate_260 +#gptofoo escp2-picmate270 printer/Epson-PictureMate_270 #gptofoo escp2-picmate280 printer/Epson-PictureMate_280 +#gptofoo escp2-picmate290 printer/Epson-PictureMate_290 +#gptofoo escp2-picmate500 printer/Epson-PictureMate_500 +#gptofoo escp2-picmate2005 printer/Epson-PictureMate_2005 #gptofoo escp2-c20 printer/Epson-Stylus_C20 #gptofoo escp2-c20sx printer/Epson-Stylus_C20SX #gptofoo escp2-c20ux printer/Epson-Stylus_C20UX @@ -354,13 +368,21 @@ #gptofoo escp2-pro printer/Epson-Stylus_Color_PRO #gptofoo escp2-d68 printer/Epson-Stylus_D68 #gptofoo escp2-d88 printer/Epson-Stylus_D88 +#gptofoo escp2-d92 printer/Epson-Stylus_D92 #gptofoo escp2-d120 printer/Epson-Stylus_D120 #gptofoo escp2-dx3800 printer/Epson-Stylus_DX3800 #gptofoo escp2-dx3850 printer/Epson-Stylus_DX3850 #gptofoo escp2-dx4050 printer/Epson-Stylus_DX4050 #gptofoo escp2-dx4200 printer/Epson-Stylus_DX4200 #gptofoo escp2-dx4250 printer/Epson-Stylus_DX4250 +#gptofoo escp2-dx4400 printer/Epson-Stylus_DX4400 +#gptofoo escp2-dx4450 printer/Epson-Stylus_DX4450 #gptofoo escp2-dx4800 printer/Epson-Stylus_DX4800 +#gptofoo escp2-dx7000f printer/Epson-Stylus_DX7000F +#gptofoo escp2-dx7400 printer/Epson-Stylus_DX7400 +#gptofoo escp2-dx7450 printer/Epson-Stylus_DX7450 +#gptofoo escp2-dx8400 printer/Epson-Stylus_DX8400 +#gptofoo escp2-dx8450 printer/Epson-Stylus_DX8450 #gptofoo escp2-photo printer/Epson-Stylus_Photo #gptofoo escp2-1200 printer/Epson-Stylus_Photo_1200 #gptofoo escp2-1270 printer/Epson-Stylus_Photo_1270 @@ -405,6 +427,8 @@ #gptofoo escp2-r260 printer/Epson-Stylus_Photo_R260 #gptofoo escp2-r265 printer/Epson-Stylus_Photo_R265 #gptofoo escp2-r270 printer/Epson-Stylus_Photo_R270 +#gptofoo escp2-r280 printer/Epson-Stylus_Photo_R280 +#gptofoo escp2-r285 printer/Epson-Stylus_Photo_R285 #gptofoo escp2-r300 printer/Epson-Stylus_Photo_R300 #gptofoo escp2-r310 printer/Epson-Stylus_Photo_R310 #gptofoo escp2-r320 printer/Epson-Stylus_Photo_R320 @@ -422,12 +446,15 @@ #gptofoo escp2-rx510 printer/Epson-Stylus_Photo_RX510 #gptofoo escp2-rx560 printer/Epson-Stylus_Photo_RX560 #gptofoo escp2-rx580 printer/Epson-Stylus_Photo_RX580 +#gptofoo escp2-rx585 printer/Epson-Stylus_Photo_RX585 #gptofoo escp2-rx590 printer/Epson-Stylus_Photo_RX590 #gptofoo escp2-rx595 printer/Epson-Stylus_Photo_RX595 #gptofoo escp2-rx600 printer/Epson-Stylus_Photo_RX600 #gptofoo escp2-rx620 printer/Epson-Stylus_Photo_RX620 #gptofoo escp2-rx630 printer/Epson-Stylus_Photo_RX630 #gptofoo escp2-rx640 printer/Epson-Stylus_Photo_RX640 +#gptofoo escp2-rx680 printer/Epson-Stylus_Photo_RX680 +#gptofoo escp2-rx685 printer/Epson-Stylus_Photo_RX685 #gptofoo escp2-rx700 printer/Epson-Stylus_Photo_RX700 #gptofoo escp2-10000 printer/Epson-Stylus_Pro_10000 #gptofoo escp2-5000 printer/Epson-Stylus_Pro_5000 @@ -453,6 +480,11 @@ #gptofoo pcl-g_5c printer/Generic-PCL_5c_Printer #gptofoo pcl-g_5e printer/Generic-PCL_5e_Printer #gptofoo pcl-g_6 printer/Generic-PCL_6_PCL_XL_Printer +#gptofoo pcl-g_4_l printer/Generic-PCL_4_LF_Printer +#gptofoo pcl-g_5_l printer/Generic-PCL_5_LF_Printer +#gptofoo pcl-g_5c_l printer/Generic-PCL_5c_LF_Printer +#gptofoo pcl-g_5e_l printer/Generic-PCL_5e_LF_Printer +#gptofoo pcl-g_6_l printer/Generic-PCL_6_PCL_XL_LF_Printer #gptofoo pcl-2000 printer/HP-2000C #gptofoo pcl-2500 printer/HP-2500C #gptofoo hp-2500cm printer/HP-2500CM diff --git a/src/foomatic/gutenprint-version.c b/src/foomatic/gutenprint-version.c index 16c248a..d9910b2 100644 --- a/src/foomatic/gutenprint-version.c +++ b/src/foomatic/gutenprint-version.c @@ -1,5 +1,5 @@ /* - * "$Id: gutenprint-version.c,v 1.2.18.1 2007/03/04 23:57:48 tillkamppeter Exp $" + * "$Id: gutenprint-version.c,v 1.3 2007/03/05 00:04:00 tillkamppeter Exp $" * * Dump the per-printer options for the OpenPrinting database * diff --git a/src/foomatic/paper_sizes.c b/src/foomatic/paper_sizes.c index 7b12fe1..26f4f02 100644 --- a/src/foomatic/paper_sizes.c +++ b/src/foomatic/paper_sizes.c @@ -1,5 +1,5 @@ /* - * "$Id: paper_sizes.c,v 1.8.18.1 2007/03/04 23:57:48 tillkamppeter Exp $" + * "$Id: paper_sizes.c,v 1.9 2007/03/05 00:04:00 tillkamppeter Exp $" * * Dump the per-printer options for the OpenPrinting database * diff --git a/src/foomatic/printer_margins.c b/src/foomatic/printer_margins.c index 11c50ad..66af0d8 100644 --- a/src/foomatic/printer_margins.c +++ b/src/foomatic/printer_margins.c @@ -1,5 +1,5 @@ /* - * "$Id: printer_margins.c,v 1.17.8.2 2007/05/29 01:47:27 rlk Exp $" + * "$Id: printer_margins.c,v 1.21 2007/05/06 19:38:10 rlk Exp $" * * Dump the per-printer margins for the OpenPrinting database * diff --git a/src/foomatic/printer_options.c b/src/foomatic/printer_options.c index 6848354..a5b4c45 100644 --- a/src/foomatic/printer_options.c +++ b/src/foomatic/printer_options.c @@ -1,5 +1,5 @@ /* - * "$Id: printer_options.c,v 1.50.8.2 2007/05/29 01:47:27 rlk Exp $" + * "$Id: printer_options.c,v 1.52 2007/05/06 19:38:10 rlk Exp $" * * Dump the per-printer options for the OpenPrinting database * diff --git a/src/foomatic/printers.c b/src/foomatic/printers.c index 9eb34ce..24643e7 100644 --- a/src/foomatic/printers.c +++ b/src/foomatic/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c,v 1.10.18.1 2007/03/04 23:57:48 tillkamppeter Exp $" + * "$Id: printers.c,v 1.11 2007/03/05 00:04:00 tillkamppeter Exp $" * * Dump the per-printer options for the OpenPrinting database * diff --git a/src/ghost/Makefile.in b/src/ghost/Makefile.in index d9a27df..d3d2c88 100644 --- a/src/ghost/Makefile.in +++ b/src/ghost/Makefile.in @@ -43,13 +43,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src/ghost ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -137,27 +136,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -165,13 +150,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -276,16 +254,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -314,6 +288,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la MAINTAINERCLEANFILES = Makefile.in LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) @IJS_CFLAGS@ @BUILD_GHOSTSCRIPT_TRUE@ijsgutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = ijsgutenprint.c diff --git a/src/ghost/ijsgutenprint.c b/src/ghost/ijsgutenprint.c index 3056037..bdd8fed 100644 --- a/src/ghost/ijsgutenprint.c +++ b/src/ghost/ijsgutenprint.c @@ -1,5 +1,5 @@ /* - * $Id: ijsgutenprint.c,v 1.18.8.1 2007/12/15 20:35:39 rlk Exp $ + * $Id: ijsgutenprint.c,v 1.20 2008/04/22 23:59:50 rlk Exp $ * * IJS server for Gutenprint. * @@ -95,13 +95,13 @@ static const char DeviceCMYK[] = "DeviceCMYK"; static const char *version_id; static int version_is_ok = 1; -static const char *version_mismatch = N_("\ -ijsgutenprint: the version of Gutenprint software installed (%s)\n\ - does not match the PPD file (%s). If you have upgraded your version\n\ - of Gutenprint recently, you must reinstall all printer queues.\n\ - Please refer to your vendor's documentation or the ``foomatic-ppdfile''\n\ - command for instructions.\n\ -ERROR: ijsgutenprint: the version of Gutenprint software installed (%s) does not match the PPD file (%s).\n"); +#define VERSION_MISMATCH "\ +ERROR: ijsgutenprint: the version of Gutenprint software installed (%s)\n\ +ERROR: ijsgutenprint: does not match the PPD file (%s). If you have upgraded your version\n\ +ERROR: ijsgutenprint: of Gutenprint recently, you must reinstall all printer queues.\n\ +ERROR: ijsgutenprint: Please refer to your vendor's documentation or the ``foomatic-ppdfile''\n\ +ERROR: ijsgutenprint: command for instructions.\n\ +ERROR: ijsgutenprint: the version of Gutenprint software installed (%s) does not match the PPD file (%s).\n" const char *gutenprint_ppd_version = NULL; static int ppd_mode = 0; /* Use PPD-style margins */ @@ -188,7 +188,7 @@ image_init(IMAGE *img, IjsPageHeader *ph) } else { - fprintf(stderr, _("ERROR: ijsgutenprint: Bad color space: bps %d channels %d space %s\n"), + fprintf(stderr, "ERROR: ijsgutenprint: Bad color space: bps %d channels %d space %s\n", img->bps, img->n_chan, ph->cs); /* unsupported */ return -1; @@ -196,7 +196,7 @@ image_init(IMAGE *img, IjsPageHeader *ph) if (img->row_buf == NULL) { - STP_DEBUG(fprintf(stderr, _("ERROR: ijsgutenprint: No row buffer\n"))); + fprintf(stderr, "ERROR: ijsgutenprint: No row buffer\n"); return -1; } @@ -223,7 +223,7 @@ get_float(const char *str, const char *name, double *pval) *pval = new_value; else { - fprintf(stderr, _("ERROR: ijsgutenprint: Unable to parse parameter %s=%s (expect a number)\n"), + fprintf(stderr, "ERROR: ijsgutenprint: Unable to parse parameter %s=%s (expect a number)\n", name, str); status = -1; } @@ -243,7 +243,7 @@ get_int(const char *str, const char *name, int *pval) *pval = new_value; else { - fprintf(stderr, _("ERROR: ijsgutenprint: Unable to parse parameter %s=%s (expect a number)\n"), + fprintf(stderr, "ERROR: ijsgutenprint: Unable to parse parameter %s=%s (expect a number)\n", name, str); status = -1; } @@ -495,9 +495,9 @@ gutenprint_get_cb (void *get_cb_data, if (!printer) { if (strlen(stp_get_driver(v)) == 0) - fprintf(stderr, _("ERROR: ijsgutenprint: Printer must be specified with -sDeviceModel\n")); + fprintf(stderr, "ERROR: ijsgutenprint: Printer must be specified with -sDeviceModel\n"); else - fprintf(stderr, _("ERROR: ijsgutenprint: Printer %s is not a known model\n"), + fprintf(stderr, "ERROR: ijsgutenprint: Printer %s is not a known model\n", stp_get_driver(v)); return IJS_EUNKPARAM; } @@ -653,7 +653,7 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, } else { - fprintf(stderr, _("ijsgutenprint: unknown DeviceModel %s\n"), vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: unknown DeviceModel %s\n", vbuf); code = IJS_ERANGE; } } @@ -697,7 +697,7 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, stp_set_height(img->v, b - t); } else - fprintf(stderr, _("ERROR: ijsgutenprint: cannot parse TopLeft %s\n"), vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: cannot parse TopLeft %s\n", vbuf); } else if (strcmp(key, "PaperSize") == 0) { @@ -720,7 +720,7 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, STP_DEBUG(fprintf(stderr, "ijsgutenprint: No matching paper size found\n")); } else - fprintf(stderr, _("ERROR: ijsgutenprint: cannot parse PaperSize %s\n"), vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: cannot parse PaperSize %s\n", vbuf); } /* @@ -744,7 +744,7 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, ppd_mode = 1; if (strcmp(vbuf, version_id) != 0) { - fprintf(stderr, gettext(version_mismatch), + fprintf(stderr, VERSION_MISMATCH, version_id, vbuf, version_id, vbuf); version_is_ok = 0; gutenprint_ppd_version = c_strdup(vbuf); @@ -792,28 +792,28 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, stp_curve_destroy(curve); } else - fprintf(stderr, _("ERROR: ijsgutenprint: cannot parse curve %s\n"), vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: cannot parse curve %s\n", vbuf); break; case STP_PARAMETER_TYPE_DOUBLE: code = get_float(vbuf, xkey, &z); if (code == 0) stp_set_float_parameter(img->v, xkey, z); else - fprintf(stderr, _("ERROR: ijsgutenprint: cannot parse %s float %s\n"), xkey, vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: cannot parse %s float %s\n", xkey, vbuf); break; case STP_PARAMETER_TYPE_INT: code = get_int(vbuf, xkey, &i); if (code == 0) stp_set_int_parameter(img->v, xkey, i); else - fprintf(stderr, _("ERROR: ijsgutenprint: cannot parse %s int %s\n"), xkey, vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: cannot parse %s int %s\n", xkey, vbuf); break; case STP_PARAMETER_TYPE_DIMENSION: code = get_int(vbuf, xkey, &i); if (code == 0) stp_set_dimension_parameter(img->v, xkey, i); else - fprintf(stderr, _("ERROR: ijsgutenprint: cannot parse %s dimension %s\n"), xkey, vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: cannot parse %s dimension %s\n", xkey, vbuf); break; case STP_PARAMETER_TYPE_BOOLEAN: if (strcmp(vbuf, "False") == 0 || @@ -827,7 +827,7 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, strcmp(vbuf, "0") == 0) stp_set_boolean_parameter(img->v, xkey, 1); else - fprintf(stderr, _("ERROR: ijsgutenprint: cannot parse %s boolean %s\n"), xkey, vbuf); + fprintf(stderr, "ERROR: ijsgutenprint: cannot parse %s boolean %s\n", xkey, vbuf); break; default: if (strncmp(xkey, "Enable", strlen("Enable")) == 0) @@ -838,7 +838,7 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, stp_set_string_parameter(img->v, xkey, vbuf); } else - fprintf(stderr, _("ERROR: ijsgutenprint: Bad parameter %s %d\n"), key, desc.p_type); + fprintf(stderr, "ERROR: ijsgutenprint: Bad parameter %s %d\n", key, desc.p_type); } stp_parameter_description_destroy(&desc); } @@ -864,7 +864,7 @@ gutenprint_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId jobid, pl->value_size = value_size; } else - fprintf(stderr, _("ERROR: ijsgutenprint: bad key code %d\n"), code); + fprintf(stderr, "ERROR: ijsgutenprint: bad key code %d\n", code); return code; } @@ -1305,7 +1305,7 @@ main (int argc, char **argv) status = image_init(&img, &ph); if (status) { - fprintf(stderr, _("ERROR: ijsgutenprint: image_init failed %d\n"), status); + fprintf(stderr, "ERROR: ijsgutenprint: image_init failed %d\n", status); break; } @@ -1316,7 +1316,7 @@ main (int argc, char **argv) f = fdopen(img.fd - 1, "wb"); if (!f) { - fprintf(stderr, _("ERROR: ijsgutenprint: Unable to open file descriptor: %s\n"), + fprintf(stderr, "ERROR: ijsgutenprint: Unable to open file descriptor: %s\n", strerror(errno)); status = -1; break; @@ -1328,7 +1328,7 @@ main (int argc, char **argv) if (!f) { status = -1; - fprintf(stderr, _("ERROR: ijsgutenprint: Unable to open %s: %s\n"), img.filename, + fprintf(stderr, "ERROR: ijsgutenprint: Unable to open %s: %s\n", img.filename, strerror(errno)); break; } @@ -1341,7 +1341,7 @@ main (int argc, char **argv) printer = stp_get_printer(img.v); if (printer == NULL) { - fprintf(stderr, _("ERROR: ijsgutenprint: Unknown printer %s\n"), + fprintf(stderr, "ERROR: ijsgutenprint: Unknown printer %s\n", stp_get_driver(img.v)); status = -1; break; @@ -1496,7 +1496,7 @@ main (int argc, char **argv) print_messages_as_errors = 1; if (!version_is_ok) { - fprintf(stderr, gettext(version_mismatch), version_id, + fprintf(stderr, VERSION_MISMATCH, version_id, gutenprint_ppd_version, version_id, gutenprint_ppd_version); status = IJS_ERANGE; break; @@ -1513,7 +1513,7 @@ main (int argc, char **argv) } else { - fprintf(stderr, _("ERROR: ijsgutenprint: Bad parameters; cannot continue!\n")); + fprintf(stderr, "ERROR: ijsgutenprint: Bad parameters; cannot continue!\n"); status = IJS_ERANGE; break; } @@ -1531,7 +1531,7 @@ main (int argc, char **argv) status = image_next_row(&img); if (status) { - fprintf(stderr, _("ERROR: ijsgutenprint: Get next row failed at %.0f\n"), + fprintf(stderr, "ERROR: ijsgutenprint: Get next row failed at %.0f\n", img.bytes_left); break; } @@ -1542,7 +1542,7 @@ main (int argc, char **argv) } if (status > 0) { - fprintf(stderr, "Ending job after page %d\n", page); + fprintf(stderr, "INFO: ijsgutenprint Ready to print.\n"); stp_end_job(old_v, &si); } else diff --git a/src/gimp/Makefile.am b/src/gimp/Makefile.am deleted file mode 100644 index 3d0e8c0..0000000 --- a/src/gimp/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -## $Id: Makefile.am,v 1.36 2005/11/21 11:16:23 rleigh 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. - -@SET_MAKE@ - -include $(top_srcdir)/scripts/global.mk - - -## Variables - -LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) $(GIMP_CFLAGS) - - -## Programs - -if BUILD_GIMP -gimp_plug_in_PROGRAMS = print -endif - -print_SOURCES = \ - print-image-gimp.c \ - print-intl.h \ - print.c \ - print_gimp.h - -print_LDADD = $(GIMP_LIBS) $(GUTENPRINTUI_LIBS) -print_DEPENDENCIES = $(GUTENPRINTUI_LIBS) $(GUTENPRINT_LIBS) - - -## Clean - -MAINTAINERCLEANFILES = Makefile.in diff --git a/src/gimp/Makefile.in b/src/gimp/Makefile.in deleted file mode 100644 index e25eb5b..0000000 --- a/src/gimp/Makefile.in +++ /dev/null @@ -1,616 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Variables - -#export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main -#export STP_DATA_PATH = $(top_srcdir)/src/main - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/scripts/global.mk -@BUILD_GIMP_TRUE@gimp_plug_in_PROGRAMS = print$(EXEEXT) -subdir = src/gimp -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(gimp_plug_indir)" -gimp_plug_inPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(gimp_plug_in_PROGRAMS) -am_print_OBJECTS = print-image-gimp.$(OBJEXT) print.$(OBJEXT) -print_OBJECTS = $(am_print_OBJECTS) -am__DEPENDENCIES_1 = -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(print_SOURCES) -DIST_SOURCES = $(print_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_CUPS_PPDS = @BUILD_CUPS_PPDS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONVERT = @CONVERT@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CUPS_CFLAGS = @CUPS_CFLAGS@ -CUPS_CONFIG = @CUPS_CONFIG@ -CUPS_LIBS = @CUPS_LIBS@ -CUPS_PPD_PS_LEVEL = @CUPS_PPD_PS_LEVEL@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DB2HTML = @DB2HTML@ -DB2PDF = @DB2PDF@ -DB2PS = @DB2PS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DIALOG = @DIALOG@ -DOXYGEN = @DOXYGEN@ -DVIPDF = @DVIPDF@ -DVIPS = @DVIPS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FIND = @FIND@ -FOOMATIC_CONFIGURE = @FOOMATIC_CONFIGURE@ -FOOMATIC_KITLOAD = @FOOMATIC_KITLOAD@ -FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ -GENPPD_LIBS = @GENPPD_LIBS@ -GIMP2_CFLAGS = @GIMP2_CFLAGS@ -GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ -GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GNUCFLAGS = @GNUCFLAGS@ -GREP = @GREP@ -GTK2_CFLAGS = @GTK2_CFLAGS@ -GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ -GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ -GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ -GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ -GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ -GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ -GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la -GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ -GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ -GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ -GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ -GUTENPRINT_INTERFACE_AGE = @GUTENPRINT_INTERFACE_AGE@ -GUTENPRINT_LIBDEPS = @GUTENPRINT_LIBDEPS@ - -# Libraries -GUTENPRINT_LIBS = $(top_builddir)/src/main/libgutenprint.la -GUTENPRINT_MAJOR_VERSION = @GUTENPRINT_MAJOR_VERSION@ -GUTENPRINT_MICRO_VERSION = @GUTENPRINT_MICRO_VERSION@ -GUTENPRINT_MINOR_VERSION = @GUTENPRINT_MINOR_VERSION@ -GUTENPRINT_VERSION = @GUTENPRINT_VERSION@ -IJS_CFLAGS = @IJS_CFLAGS@ -IJS_CONFIG = @IJS_CONFIG@ -IJS_LIBS = @IJS_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE_DEPS = @LIBREADLINE_DEPS@ -LIBS = $(INTLLIBS) @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LN_S = @LN_S@ -LTALLOCA = @LTALLOCA@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PLUG_IN_PATH = @PLUG_IN_PATH@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -RELEASE_DATE = @RELEASE_DATE@ -RM = @RM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -TEST = @TEST@ -TEXI2HTML = @TEXI2HTML@ -TRUE = @TRUE@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -WHICH_PPDS = @WHICH_PPDS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -cups_bindir = @cups_bindir@ -cups_conf_datadir = @cups_conf_datadir@ -cups_conf_serverbin = @cups_conf_serverbin@ -cups_conf_serverroot = @cups_conf_serverroot@ -cups_exec_prefix = @cups_exec_prefix@ -cups_prefix = @cups_prefix@ -cups_sbindir = @cups_sbindir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ -gutenprint_cflags = @gutenprint_cflags@ -gutenprint_libdeps = @gutenprint_libdeps@ -gutenprint_libs = @gutenprint_libs@ -gutenprintui2_cflags = @gutenprintui2_cflags@ -gutenprintui2_libdeps = @gutenprintui2_libdeps@ -gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) -LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) $(GIMP_CFLAGS) -print_SOURCES = \ - print-image-gimp.c \ - print-intl.h \ - print.c \ - print_gimp.h - -print_LDADD = $(GIMP_LIBS) $(GUTENPRINTUI_LIBS) -print_DEPENDENCIES = $(GUTENPRINTUI_LIBS) $(GUTENPRINT_LIBS) -MAINTAINERCLEANFILES = Makefile.in -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/scripts/global.mk $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/gimp/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/gimp/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-gimp_plug_inPROGRAMS: $(gimp_plug_in_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(gimp_plug_indir)" || $(MKDIR_P) "$(DESTDIR)$(gimp_plug_indir)" - @list='$(gimp_plug_in_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(gimp_plug_inPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(gimp_plug_indir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(gimp_plug_inPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(gimp_plug_indir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-gimp_plug_inPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(gimp_plug_in_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(gimp_plug_indir)/$$f'"; \ - rm -f "$(DESTDIR)$(gimp_plug_indir)/$$f"; \ - done - -clean-gimp_plug_inPROGRAMS: - @list='$(gimp_plug_in_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -print$(EXEEXT): $(print_OBJECTS) $(print_DEPENDENCIES) - @rm -f print$(EXEEXT) - $(LINK) $(print_OBJECTS) $(print_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-image-gimp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(gimp_plug_indir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-gimp_plug_inPROGRAMS clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-gimp_plug_inPROGRAMS - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-gimp_plug_inPROGRAMS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-gimp_plug_inPROGRAMS clean-libtool ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am \ - install-gimp_plug_inPROGRAMS install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-gimp_plug_inPROGRAMS - - -@SET_MAKE@ - -# Rules - -$(top_builddir)/src/main/libgutenprint.la: - cd $(top_builddir)/src/main; \ - $(MAKE) - -$(top_builddir)/src/gutenprintui/libgutenprintui.la: - cd $(top_builddir)/src/gutenprintui; \ - $(MAKE) - -$(top_builddir)/src/gutenprintui2/libgutenprintui2.la: - cd $(top_builddir)/src/gutenprintui2; \ - $(MAKE) -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/gimp/print-image-gimp.c b/src/gimp/print-image-gimp.c deleted file mode 100644 index d630931..0000000 --- a/src/gimp/print-image-gimp.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * "$Id: print-image-gimp.c,v 1.13 2004/05/09 16:06:09 rleigh Exp $" - * - * Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com) and - * Robert Krawitz (rlk@alum.mit.edu) - * Copyright 2000 Charles Briscoe-Smith <cpbs@debian.org> - * - * 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 <string.h> - -#include "print_gimp.h" - -#include "print-intl.h" - - -/* - * "Image" ADT - * - * This file defines an abstract data type called "Image". An Image wraps - * a Gimp drawable (or some other application-level image representation) - * for presentation to the low-level printer drivers (which do CMYK - * separation, dithering and weaving). The Image ADT has the ability - * to perform any combination of flips and rotations on the image, - * and then deliver individual rows to the driver code. - * - * Stuff which might be useful to do in this layer: - * - * - Scaling, optionally with interpolation/filtering. - * - * - Colour-adjustment. - * - * - Multiple-image composition. - * - * Also useful might be to break off a thin application-dependent - * sublayer leaving this layer (which does the interesting stuff) - * application-independent. - */ - - -/* Concrete type to represent image */ -typedef struct -{ - GimpDrawable *drawable; - GimpPixelRgn rgn; - - /* - * Transformations we can impose on the image. The transformations - * are considered to be performed in the order given here. - */ - - /* 1: Transpose the x and y axes (flip image over its leading diagonal) */ - int columns; /* Set if returning columns instead of rows. */ - - /* 2: Translate (ox,oy) to the origin */ - int ox, oy; /* Origin of image */ - - /* 3: Flip vertically about the x axis */ - int increment; /* +1 or -1 for offset of row n+1 from row n. */ - - /* 4: Crop to width w, height h */ - int w, h; /* Width and height of output image */ - - /* 5: Flip horizontally about the vertical centre-line of the image */ - int mirror; /* Set if mirroring rows end-for-end. */ - - gint32 image_ID; - gint32 ncolors; - gint32 real_bpp; - GimpImageBaseType base_type; - guchar *cmap; - guchar *alpha_table; - guchar *tmp; - gint last_printed_percent; - gint initialized; -} Gimp_Image_t; - -static const char *Image_get_appname(stp_image_t *image); -static void Image_conclude(stp_image_t *image); -static stp_image_status_t Image_get_row(stp_image_t *image, - unsigned char *data, - size_t byte_limit, int row); -static int Image_height(stp_image_t *image); -static int Image_width(stp_image_t *image); -static void Image_reset(stp_image_t *image); -static void Image_init(stp_image_t *image); - -static void Image_transpose(stpui_image_t *image); -static void Image_hflip(stpui_image_t *image); -static void Image_vflip(stpui_image_t *image); -static void Image_rotate_ccw(stpui_image_t *image); -static void Image_rotate_cw(stpui_image_t *image); -static void Image_rotate_180(stpui_image_t *image); -static void Image_crop(stpui_image_t *image, int, int, int, int); - -static stpui_image_t theImage = -{ - { - Image_init, - Image_reset, - Image_width, - Image_height, - Image_get_row, - Image_get_appname, - Image_conclude, - NULL, - }, - Image_transpose, - Image_hflip, - Image_vflip, - Image_rotate_ccw, - Image_rotate_cw, - Image_rotate_180, - Image_crop -}; - -static void -compute_alpha_table(Gimp_Image_t *image) -{ - unsigned val, alpha; - image->alpha_table = stp_malloc(65536 * sizeof(unsigned char)); - for (val = 0; val < 256; val++) - for (alpha = 0; alpha < 256; alpha++) - image->alpha_table[(val * 256) + alpha] = - val * alpha / 255 + 255 - alpha; -} - -static inline unsigned char -alpha_lookup(Gimp_Image_t *image, int val, int alpha) -{ - return image->alpha_table[(val * 256) + alpha]; -} - -stpui_image_t * -Image_GimpDrawable_new(GimpDrawable *drawable, gint32 image_ID) -{ - Gimp_Image_t *im = stp_malloc(sizeof(Gimp_Image_t)); - memset(im, 0, sizeof(Gimp_Image_t)); - im->drawable = drawable; - gimp_pixel_rgn_init(&(im->rgn), drawable, 0, 0, - drawable->width, drawable->height, FALSE, FALSE); - im->image_ID = image_ID; - im->base_type = gimp_image_base_type(image_ID); - im->initialized = 0; - theImage.im.rep = im; - theImage.im.reset(&(theImage.im)); - switch (im->base_type) - { - case GIMP_INDEXED: - im->cmap = gimp_image_get_cmap(image_ID, &(im->ncolors)); - im->real_bpp = 3; - break; - case GIMP_GRAY: - im->real_bpp = 1; - break; - case GIMP_RGB: - im->real_bpp = 3; - break; - } - if (im->drawable->bpp == 2 || im->drawable->bpp == 4) - compute_alpha_table(im); - return &theImage; -} - -static void -Image_init(stp_image_t *image) -{ - /* Nothing to do. */ -} - -static void -Image_reset(stp_image_t *image) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); - im->columns = FALSE; - im->ox = 0; - im->oy = 0; - im->increment = 1; - im->w = im->drawable->width; - im->h = im->drawable->height; - im->mirror = FALSE; -} - -static int -Image_width(stp_image_t *image) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); - return im->w; -} - -static int -Image_height(stp_image_t *image) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); - return im->h; -} - -static stp_image_status_t -Image_get_row(stp_image_t *image, unsigned char *data, size_t byte_limit, - int row) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); - int last_printed_percent; - guchar *inter; - if (!im->initialized) - { - gimp_progress_init(_("Printing...")); - switch (im->base_type) - { - case GIMP_INDEXED: - im->tmp = stp_malloc(im->drawable->bpp * im->w); - break; - case GIMP_GRAY: - if (im->drawable->bpp == 2) - im->tmp = stp_malloc(im->drawable->bpp * im->w); - break; - case GIMP_RGB: - if (im->drawable->bpp == 4) - im->tmp = stp_malloc(im->drawable->bpp * im->w); - break; - } - im->initialized = 1; - } - if (im->tmp) - inter = im->tmp; - else - inter = data; - if (im->columns) - gimp_pixel_rgn_get_col(&(im->rgn), inter, - im->oy + row * im->increment, im->ox, im->w); - else - gimp_pixel_rgn_get_row(&(im->rgn), inter, - im->ox, im->oy + row * im->increment, im->w); - if (im->cmap) - { - int i; - if (im->alpha_table) - { - for (i = 0; i < im->w; i++) - { - int j; - for (j = 0; j < 3; j++) - { - gint32 tval = im->cmap[(3 * inter[2 * i]) + j]; - data[(3 * i) + j] = alpha_lookup(im, tval, - inter[(2 * i) + 1]); - } - - } - } - else - { - for (i = 0; i < im->w; i++) - { - data[(3 * i) + 0] = im->cmap[(3 * inter[i]) + 0]; - data[(3 * i) + 1] = im->cmap[(3 * inter[i]) + 1]; - data[(3 * i) + 2] = im->cmap[(3 * inter[i]) + 2]; - } - } - } - else if (im->alpha_table) - { - int i; - for (i = 0; i < im->w; i++) - { - int j; - for (j = 0; j < im->real_bpp; j++) - { - gint32 tval = inter[(i * im->drawable->bpp) + j]; - data[(i * im->real_bpp) + j] = - alpha_lookup(im, tval, - inter[((i + 1) * im->drawable->bpp) - 1]); - } - - } - } - if (im->mirror) - { - /* Flip row -- probably inefficiently */ - int f; - int l; - int b = im->real_bpp; - for (f = 0, l = im->w - 1; f < l; f++, l--) - { - int c; - unsigned char tmp; - for (c = 0; c < b; c++) - { - tmp = data[f*b+c]; - data[f*b+c] = data[l*b+c]; - data[l*b+c] = tmp; - } - } - } - last_printed_percent = row * 100 / im->h; - if (last_printed_percent > im->last_printed_percent) - { - gimp_progress_update((double) row / (double) im->h); - im->last_printed_percent = last_printed_percent; - } - return STP_IMAGE_STATUS_OK; -} - -static void -Image_transpose(stpui_image_t *image) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); - int tmp; - - if (im->mirror) im->ox += im->w - 1; - - im->columns = !im->columns; - - tmp = im->ox; - im->ox = im->oy; - im->oy = tmp; - - tmp = im->mirror; - im->mirror = im->increment < 0; - im->increment = tmp ? -1 : 1; - - tmp = im->w; - im->w = im->h; - im->h = tmp; - - if (im->mirror) im->ox -= im->w - 1; -} - -static void -Image_hflip(stpui_image_t *image) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); - im->mirror = !im->mirror; -} - -static void -Image_vflip(stpui_image_t *image) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); - im->oy += (im->h-1) * im->increment; - im->increment = -im->increment; -} - -/* - * Image_crop: - * - * Crop the given number of pixels off the LEFT, TOP, RIGHT and BOTTOM - * of the image. - */ - -static void -Image_crop(stpui_image_t *image, int left, int top, int right, int bottom) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->im.rep); - int xmax = (im->columns ? im->drawable->height : im->drawable->width) - 1; - int ymax = (im->columns ? im->drawable->width : im->drawable->height) - 1; - - int nx = im->ox + im->mirror ? right : left; - int ny = im->oy + top * (im->increment); - - int nw = im->w - left - right; - int nh = im->h - top - bottom; - - int wmax, hmax; - - if (nx < 0) nx = 0; - else if (nx > xmax) nx = xmax; - - if (ny < 0) ny = 0; - else if (ny > ymax) ny = ymax; - - wmax = xmax - nx + 1; - hmax = im->increment ? ny + 1 : ymax - ny + 1; - - if (nw < 1) nw = 1; - else if (nw > wmax) nw = wmax; - - if (nh < 1) nh = 1; - else if (nh > hmax) nh = hmax; - - im->ox = nx; - im->oy = ny; - im->w = nw; - im->h = nh; -} - -static void -Image_rotate_ccw(stpui_image_t *image) -{ - Image_transpose(image); - Image_vflip(image); -} - -static void -Image_rotate_cw(stpui_image_t *image) -{ - Image_transpose(image); - Image_hflip(image); -} - -static void -Image_rotate_180(stpui_image_t *image) -{ - Image_vflip(image); - Image_hflip(image); -} - -static void -Image_conclude(stp_image_t *image) -{ - Gimp_Image_t *im = (Gimp_Image_t *) (image->rep); - gimp_progress_update(1); - if (im->alpha_table) - stp_free(im->alpha_table); - if (im->tmp) - stp_free(im->tmp); -} - -static const char * -Image_get_appname(stp_image_t *image) -{ - static char pluginname[] = "Print plug-in V" VERSION " - " RELEASE_DATE - " for GIMP"; - return pluginname; -} - -/* - * End of "$Id: print-image-gimp.c,v 1.13 2004/05/09 16:06:09 rleigh Exp $". - */ diff --git a/src/gimp/print-intl.h b/src/gimp/print-intl.h deleted file mode 100644 index 4599852..0000000 --- a/src/gimp/print-intl.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * "$Id: print-intl.h,v 1.6 2004/09/17 18:38:13 rleigh Exp $" - * - * I18N header file for the GIMP Print plugin. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com), - * Robert Krawitz (rlk@alum.mit.edu) and Michael Natterer (mitch@gimp.org) - * - * 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. - */ - -#ifndef GIMP_PRINT_INTL_H -#define GIMP_PRINT_INTL_H - -#include <glib.h> -#include <gutenprint/gutenprint-intl.h> - -#define INIT_LOCALE(domain) \ -do \ -{ \ - gtk_set_locale (); \ - setlocale (LC_NUMERIC, "C"); \ - bindtextdomain (domain, PACKAGE_LOCALE_DIR); \ - textdomain (domain); \ -} while (0) - -#endif /* GIMP_PRINT_INTL_H */ diff --git a/src/gimp/print.c b/src/gimp/print.c deleted file mode 100644 index e5ee0fd..0000000 --- a/src/gimp/print.c +++ /dev/null @@ -1,458 +0,0 @@ -/* - * "$Id: print.c,v 1.66 2006/05/04 11:30:08 rlk Exp $" - * - * Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com) and - * 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 <gutenprintui/gutenprintui.h> -#include "print_gimp.h" - -#include <sys/types.h> -#include <signal.h> -#include <ctype.h> -#include <sys/wait.h> - -#include <unistd.h> -#include <stdio.h> -#include <string.h> - -#include "print-intl.h" - -/* - * Local functions... - */ - -static void query (void); -static void run (char *, int, GimpParam *, int *, GimpParam **); -static int do_print_dialog (char *proc_name, gint32 image_ID); - -/* - * Work around GIMP library not being const-safe. This is a very ugly - * hack, but the excessive warnings generated can mask more serious - * problems. - */ - -#define BAD_CONST_CHAR char * - -/* - * Globals... - */ - -GimpPlugInInfo PLUG_IN_INFO = /* Plug-in information */ -{ - NULL, /* init_proc */ - NULL, /* quit_proc */ - query, /* query_proc */ - run, /* run_proc */ -}; - -static stpui_plist_t gimp_vars; - -/* - * 'main()' - Main entry - just call gimp_main()... - */ - -MAIN() - -/* - * 'query()' - Respond to a plug-in query... - */ - -static void -query (void) -{ - static /* const */ GimpParamDef args[] = - { - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "run_mode", (BAD_CONST_CHAR) "Interactive, non-interactive" }, - { GIMP_PDB_IMAGE, (BAD_CONST_CHAR) "image", (BAD_CONST_CHAR) "Input image" }, - { GIMP_PDB_DRAWABLE, (BAD_CONST_CHAR) "drawable", (BAD_CONST_CHAR) "Input drawable" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "output_to", (BAD_CONST_CHAR) "Print command or filename (| to pipe to command)" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "driver", (BAD_CONST_CHAR) "Printer driver short name" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "ppd_file", (BAD_CONST_CHAR) "PPD file" }, - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "output_type", (BAD_CONST_CHAR) "Output type (0 = gray, 1 = color)" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "resolution", (BAD_CONST_CHAR) "Resolution (\"300\", \"720\", etc.)" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "media_size", (BAD_CONST_CHAR) "Media size (\"Letter\", \"A4\", etc.)" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "media_type", (BAD_CONST_CHAR) "Media type (\"Plain\", \"Glossy\", etc.)" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "media_source", (BAD_CONST_CHAR) "Media source (\"Tray1\", \"Manual\", etc.)" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "brightness", (BAD_CONST_CHAR) "Brightness (0-400%)" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "scaling", (BAD_CONST_CHAR) "Output scaling (0-100%, -PPI)" }, - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "orientation", (BAD_CONST_CHAR) "Output orientation (-1 = auto, 0 = portrait, 1 = landscape)" }, - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "left", (BAD_CONST_CHAR) "Left offset (points, -1 = centered)" }, - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "top", (BAD_CONST_CHAR) "Top offset (points, -1 = centered)" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "gamma", (BAD_CONST_CHAR) "Output gamma (0.1 - 3.0)" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "contrast", (BAD_CONST_CHAR) "Contrast" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "cyan", (BAD_CONST_CHAR) "Cyan level" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "magenta", (BAD_CONST_CHAR) "Magenta level" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "yellow", (BAD_CONST_CHAR) "Yellow level" }, - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "linear", (BAD_CONST_CHAR) "Linear output (0 = normal, 1 = linear)" }, - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "image_type", (BAD_CONST_CHAR) "Image type (0 = line art, 1 = solid tones, 2 = continuous tone, 3 = monochrome)"}, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "saturation", (BAD_CONST_CHAR) "Saturation (0-1000%)" }, - { GIMP_PDB_FLOAT, (BAD_CONST_CHAR) "density", (BAD_CONST_CHAR) "Density (0-200%)" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "ink_type", (BAD_CONST_CHAR) "Type of ink or cartridge" }, - { GIMP_PDB_STRING, (BAD_CONST_CHAR) "dither_algorithm", (BAD_CONST_CHAR) "Dither algorithm" }, - { GIMP_PDB_INT32, (BAD_CONST_CHAR) "unit", (BAD_CONST_CHAR) "Unit 0=Inches 1=Metric" }, - }; - static gint nargs = sizeof(args) / sizeof(args[0]); - - static const gchar *blurb = "This plug-in prints images from The GIMP."; - static const gchar *help = "Prints images to PostScript, PCL, or ESC/P2 printers."; - static const gchar *auth = "Michael Sweet <mike@easysw.com> and Robert Krawitz <rlk@alum.mit.edu>"; - static const gchar *copy = "Copyright 1997-2000 by Michael Sweet and Robert Krawitz"; - static const gchar *types = "RGB*,GRAY*,INDEXED*"; - - gimp_plugin_domain_register ((BAD_CONST_CHAR) PACKAGE, (BAD_CONST_CHAR) PACKAGE_LOCALE_DIR); - - gimp_install_procedure ((BAD_CONST_CHAR) "file_print_gimp", - (BAD_CONST_CHAR) blurb, - (BAD_CONST_CHAR) help, - (BAD_CONST_CHAR) auth, - (BAD_CONST_CHAR) copy, - (BAD_CONST_CHAR) VERSION " - " RELEASE_DATE, - /* Do not translate the "<Image>" */ - (BAD_CONST_CHAR) N_("<Image>/File/Print..."), - (BAD_CONST_CHAR) types, - GIMP_PLUGIN, - nargs, 0, - args, NULL); -} - -static guchar *gimp_thumbnail_data = NULL; - -static guchar * -stpui_get_thumbnail_data_function(void *image_ID, gint *width, gint *height, - gint *bpp, gint page) -{ - if (gimp_thumbnail_data) - g_free(gimp_thumbnail_data); - gimp_thumbnail_data = - gimp_image_get_thumbnail_data((gint) image_ID, width, height, bpp); - return gimp_thumbnail_data; -} - -/* - * 'run()' - Run the plug-in... - */ - -volatile int SDEBUG = 1; - -static void -run (char *name, /* I - Name of print program. */ - int nparams, /* I - Number of parameters passed in */ - GimpParam *param, /* I - Parameter values */ - int *nreturn_vals, /* O - Number of return values */ - GimpParam **return_vals) /* O - Return values */ -{ - GimpDrawable *drawable; /* Drawable for image */ - GimpRunModeType run_mode; /* Current run mode */ - GimpParam *values; /* Return values */ - gint32 drawable_ID; /* drawable ID */ - GimpExportReturnType export = GIMP_EXPORT_CANCEL; /* return value of gimp_export_image() */ - gdouble xres, yres; - char *image_filename; - char *image_basename; - stpui_image_t *image; - gint32 image_ID; - gint32 base_type; - if (getenv("STP_DEBUG_STARTUP")) - while (SDEBUG) - ; - - /* - * Initialise libgutenprint - */ - - stp_init(); - -#ifdef INIT_I18N_UI - INIT_I18N_UI(); -#else - /* - * With GCC and glib 1.2, there will be a warning here about braces in - * expressions. Getting rid of it causes more problems than it solves. - * In particular, turning on -ansi on the command line causes a number of - * other useful things, such as strcasecmp, popen, and snprintf to go away - */ - INIT_LOCALE (PACKAGE); -#endif - - stpui_printer_initialize(&gimp_vars); - /* - * Initialize parameter data... - */ - - run_mode = (GimpRunModeType)param[0].data.d_int32; - - values = g_new (GimpParam, 1); - - values[0].type = GIMP_PDB_STATUS; - values[0].data.d_status = GIMP_PDB_SUCCESS; - - *nreturn_vals = 1; - *return_vals = values; - - image_ID = param[1].data.d_int32; - drawable_ID = param[2].data.d_int32; - - image_filename = gimp_image_get_filename (image_ID); - if (image_filename) - { - image_basename = image_filename; - if (strchr(image_filename, '/')) - image_basename = strrchr(image_filename, '/') + 1; - stpui_set_image_filename(image_basename); - g_free(image_filename); - } - else - stpui_set_image_filename("Untitled"); - - /* eventually export the image */ - switch (run_mode) - { - case GIMP_RUN_INTERACTIVE: - case GIMP_RUN_WITH_LAST_VALS: - gimp_ui_init ("print", TRUE); - export = gimp_export_image (&image_ID, &drawable_ID, "Print", - (GIMP_EXPORT_CAN_HANDLE_RGB | - GIMP_EXPORT_CAN_HANDLE_GRAY | - GIMP_EXPORT_CAN_HANDLE_INDEXED | - GIMP_EXPORT_CAN_HANDLE_ALPHA)); - if (export == GIMP_EXPORT_CANCEL) - { - *nreturn_vals = 1; - values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - return; - } - break; - default: - break; - } - - /* - * Get drawable... - */ - - drawable = gimp_drawable_get (drawable_ID); - stpui_set_image_dimensions(drawable->width, drawable->height); - gimp_image_get_resolution (image_ID, &xres, &yres); - stpui_set_image_resolution(xres, yres); - stpui_set_image_channel_depth(8); - base_type = gimp_image_base_type(image_ID); - switch (base_type) - { - case GIMP_INDEXED: - case GIMP_RGB: - stpui_set_image_type("RGB"); - break; - case GIMP_GRAY: - stpui_set_image_type("Whitescale"); - break; - default: - break; - } - - image = Image_GimpDrawable_new(drawable, image_ID); - stp_set_float_parameter(gimp_vars.v, "AppGamma", gimp_gamma()); - - /* - * See how we will run - */ - - switch (run_mode) - { - case GIMP_RUN_INTERACTIVE: - /* - * Get information from the dialog... - */ - - if (!do_print_dialog (name, image_ID)) - goto cleanup; - stpui_plist_copy(&gimp_vars, stpui_get_current_printer()); - break; - - case GIMP_RUN_NONINTERACTIVE: - /* - * Make sure all the arguments are present... - */ - if (nparams < 11) - values[0].data.d_status = GIMP_PDB_CALLING_ERROR; - else - { -#if 0 - /* What do we do with old output_to? Probably best ignore it. */ - stpui_plist_set_output_to(&gimp_vars, param[3].data.d_string); -#endif - stp_set_driver(gimp_vars.v, param[4].data.d_string); - stp_set_file_parameter(gimp_vars.v, "PPDFile", param[5].data.d_string); - switch (param[6].data.d_int32) - { - case 0: - default: - stp_set_string_parameter(gimp_vars.v, "PrintingMode", "BW"); - case 1: - stp_set_string_parameter(gimp_vars.v, "PrintingMode", "Color"); - } - stp_set_string_parameter(gimp_vars.v, "Resolution", param[7].data.d_string); - stp_set_string_parameter(gimp_vars.v, "PageSize", param[8].data.d_string); - stp_set_string_parameter(gimp_vars.v, "MediaType", param[9].data.d_string); - stp_set_string_parameter(gimp_vars.v, "InputSlot", param[10].data.d_string); - - if (nparams > 11) - stp_set_float_parameter(gimp_vars.v, "Brightness", param[11].data.d_float); - - if (nparams > 12) - gimp_vars.scaling = param[12].data.d_float; - - if (nparams > 13) - gimp_vars.orientation = param[13].data.d_int32; - - if (nparams > 14) - stp_set_left(gimp_vars.v, param[14].data.d_int32); - - if (nparams > 15) - stp_set_top(gimp_vars.v, param[15].data.d_int32); - - if (nparams > 16) - stp_set_float_parameter(gimp_vars.v, "Gamma", param[16].data.d_float); - - if (nparams > 17) - stp_set_float_parameter(gimp_vars.v, "Contrast", param[17].data.d_float); - - if (nparams > 18) - stp_set_float_parameter(gimp_vars.v, "Cyan", param[18].data.d_float); - - if (nparams > 19) - stp_set_float_parameter(gimp_vars.v, "Magenta", param[19].data.d_float); - - if (nparams > 20) - stp_set_float_parameter(gimp_vars.v, "Yellow", param[20].data.d_float); - - if (nparams > 21) - stp_set_string_parameter(gimp_vars.v, "ImageOptimization", param[21].data.d_string); - - if (nparams > 22) - stp_set_float_parameter(gimp_vars.v, "Saturation", param[23].data.d_float); - - if (nparams > 23) - stp_set_float_parameter(gimp_vars.v, "Density", param[24].data.d_float); - - if (nparams > 24) - stp_set_string_parameter(gimp_vars.v, "InkType", param[25].data.d_string); - - if (nparams > 25) - stp_set_string_parameter(gimp_vars.v, "DitherAlgorithm", - param[26].data.d_string); - - if (nparams > 26) - gimp_vars.unit = param[27].data.d_int32; - } - - break; - - case GIMP_RUN_WITH_LAST_VALS: - values[0].data.d_status = GIMP_PDB_CALLING_ERROR; - break; - - default: - values[0].data.d_status = GIMP_PDB_CALLING_ERROR; - break; - } - - if (gimp_thumbnail_data) - g_free(gimp_thumbnail_data); - - /* - * Print the image... - */ - if (values[0].data.d_status == GIMP_PDB_SUCCESS) - { - /* - * Set the tile cache size... - */ - - if (drawable->height > drawable->width) - gimp_tile_cache_ntiles ((drawable->height + gimp_tile_width () - 1) / - gimp_tile_width () + 1); - else - gimp_tile_cache_ntiles ((drawable->width + gimp_tile_width () - 1) / - gimp_tile_width () + 1); - - if (! stpui_print(&gimp_vars, image)) - values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - - /* - * Store data... - * FIXME! This is broken! - */ - -#if 0 - if (run_mode == GIMP_RUN_INTERACTIVE) - gimp_set_data (PLUG_IN_NAME, vars, sizeof (vars)); -#endif - } - - /* - * Detach from the drawable... - */ - gimp_drawable_detach (drawable); - - cleanup: - if (export == GIMP_EXPORT_EXPORT) - gimp_image_delete (image_ID); - stp_vars_destroy(gimp_vars.v); -} - -/* - * 'do_print_dialog()' - Pop up the print dialog... - */ - -static void -gimp_writefunc(void *file, const char *buf, size_t bytes) -{ - FILE *prn = (FILE *)file; - fwrite(buf, 1, bytes, prn); -} - -static void -gimp_errfunc(void *file, const char *buf, size_t bytes) -{ - char formatbuf[32]; - snprintf(formatbuf, 31, "%%%ds", bytes); - g_message(formatbuf, buf); -} - -static gint -do_print_dialog (gchar *proc_name, gint32 image_ID) -{ - /* - * Generate the filename for the current user... - */ - char *filename = gimp_personal_rc_file ((BAD_CONST_CHAR) "printrc"); - stpui_set_printrc_file(filename); - g_free(filename); - if (! getenv("STP_PRINT_MESSAGES_TO_STDERR")) - stpui_set_errfunc(gimp_errfunc); - stpui_set_thumbnail_func(stpui_get_thumbnail_data_function); - stpui_set_thumbnail_data((void *) image_ID); - return stpui_do_print_dialog(); -} diff --git a/src/gimp/print_gimp.h b/src/gimp/print_gimp.h deleted file mode 100644 index 9ef3140..0000000 --- a/src/gimp/print_gimp.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * "$Id: print_gimp.h,v 1.44 2004/09/17 18:38:13 rleigh Exp $" - * - * Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com), - * Robert Krawitz (rlk@alum.mit.edu). and Steve Miller (smiller@rni.net - * - * 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. - * - * - * Revision History: - * - * See ChangeLog - */ - -#ifndef __PRINT_GIMP_H__ -#define __PRINT_GIMP_H__ - -#ifdef __GNUC__ -#define inline __inline__ -#endif - -#include <gtk/gtk.h> -#include <libgimp/gimp.h> -#include <libgimp/gimpui.h> - -#include <gutenprint/gutenprint.h> -#include <gutenprintui/gutenprintui.h> - -/* How to create an Image wrapping a Gimp drawable */ -extern stpui_image_t *Image_GimpDrawable_new(GimpDrawable *drawable, gint32); - -#endif /* __PRINT_GIMP_H__ */ diff --git a/src/gimp2/Makefile.in b/src/gimp2/Makefile.in index 18a85fc..5a45632 100644 --- a/src/gimp2/Makefile.in +++ b/src/gimp2/Makefile.in @@ -44,13 +44,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src/gimp2 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -131,27 +130,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -159,13 +144,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -270,16 +248,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -308,6 +282,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) $(GIMP2_CFLAGS) COMMON_PRINT_SOURCES = \ print-image-gimp.c \ diff --git a/src/gutenprintui/Makefile.am b/src/gutenprintui/Makefile.am deleted file mode 100644 index 074ba93..0000000 --- a/src/gutenprintui/Makefile.am +++ /dev/null @@ -1,75 +0,0 @@ -## $Id: Makefile.am,v 1.5.10.1 2007/12/02 02:40:39 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. - -@SET_MAKE@ - -include $(top_srcdir)/scripts/global.mk - - -## Variables - -m4datadir = $(datadir)/aclocal -pkgconfigdatadir = $(libdir)/pkgconfig - - -## Programs - -if BUILD_LIBGUTENPRINTUI -lib_LTLIBRARIES = libgutenprintui.la -endif - -libgutenprintui_la_SOURCES = \ - printrcy.y \ - printrcl.l \ - printrc.h \ - plist.c \ - panel.c \ - ui-utils.c \ - print-image-thumbnail.c \ - gutenprintui-internal.h - -libgutenprintui_la_LIBADD = $(GUTENPRINTUI_LIBDEPS) -# Uncommment to build an unversioned library (version in soname) -libgutenprintui_la_CFLAGS = $(AM_CFLAGS) $(GUTENPRINT_CFLAGS) $(GTK_CFLAGS) -#libgutenprintui_la_LDFLAGS = -release $(GUTENPRINT_VERSION) \ -# -rpath $(libdir) -no-undefined -# Uncomment to build a versioned library -libgutenprintui_la_LDFLAGS = \ - -version-info $(GUTENPRINTUI_CURRENT_INTERFACE):$(GUTENPRINTUI_INTERFACE_AGE):$(GUTENPRINTUI_BINARY_AGE) \ - -rpath $(libdir) -no-undefined - -AM_LFLAGS = -i -AM_YFLAGS = -d - -printrcy.o: printrcl.o -plist.o: printrcy.o - -## Data - -if BUILD_LIBGUTENPRINTUI -pkgconfigdata_DATA = gutenprintui.pc -endif - - -## Rules - - -## Clean - -MAINTAINERCLEANFILES = Makefile.in printrcl.c printrcy.c printrcy.h diff --git a/src/gutenprintui/Makefile.in b/src/gutenprintui/Makefile.in deleted file mode 100644 index 72d00db..0000000 --- a/src/gutenprintui/Makefile.in +++ /dev/null @@ -1,743 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Variables - -#export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main -#export STP_DATA_PATH = $(top_srcdir)/src/main - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/gutenprintui.pc.in $(top_srcdir)/scripts/global.mk \ - printrcl.c printrcy.c printrcy.h -subdir = src/gutenprintui -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = gutenprintui.pc -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(pkgconfigdatadir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = -libgutenprintui_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_libgutenprintui_la_OBJECTS = libgutenprintui_la-printrcy.lo \ - libgutenprintui_la-printrcl.lo libgutenprintui_la-plist.lo \ - libgutenprintui_la-panel.lo libgutenprintui_la-ui-utils.lo \ - libgutenprintui_la-print-image-thumbnail.lo -libgutenprintui_la_OBJECTS = $(am_libgutenprintui_la_OBJECTS) -libgutenprintui_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libgutenprintui_la_CFLAGS) $(CFLAGS) \ - $(libgutenprintui_la_LDFLAGS) $(LDFLAGS) -o $@ -@BUILD_LIBGUTENPRINTUI_TRUE@am_libgutenprintui_la_rpath = -rpath \ -@BUILD_LIBGUTENPRINTUI_TRUE@ $(libdir) -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ || -LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS) -YLWRAP = $(top_srcdir)/scripts/ylwrap -@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ || -YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) -LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS) -SOURCES = $(libgutenprintui_la_SOURCES) -DIST_SOURCES = $(libgutenprintui_la_SOURCES) -pkgconfigdataDATA_INSTALL = $(INSTALL_DATA) -DATA = $(pkgconfigdata_DATA) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_CUPS_PPDS = @BUILD_CUPS_PPDS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONVERT = @CONVERT@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CUPS_CFLAGS = @CUPS_CFLAGS@ -CUPS_CONFIG = @CUPS_CONFIG@ -CUPS_LIBS = @CUPS_LIBS@ -CUPS_PPD_PS_LEVEL = @CUPS_PPD_PS_LEVEL@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DB2HTML = @DB2HTML@ -DB2PDF = @DB2PDF@ -DB2PS = @DB2PS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DIALOG = @DIALOG@ -DOXYGEN = @DOXYGEN@ -DVIPDF = @DVIPDF@ -DVIPS = @DVIPS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FIND = @FIND@ -FOOMATIC_CONFIGURE = @FOOMATIC_CONFIGURE@ -FOOMATIC_KITLOAD = @FOOMATIC_KITLOAD@ -FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ -GENPPD_LIBS = @GENPPD_LIBS@ -GIMP2_CFLAGS = @GIMP2_CFLAGS@ -GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ -GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GNUCFLAGS = @GNUCFLAGS@ -GREP = @GREP@ -GTK2_CFLAGS = @GTK2_CFLAGS@ -GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ -GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ -GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ -GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ -GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ -GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ -GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la -GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ -GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ -GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ -GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ -GUTENPRINT_INTERFACE_AGE = @GUTENPRINT_INTERFACE_AGE@ -GUTENPRINT_LIBDEPS = @GUTENPRINT_LIBDEPS@ - -# Libraries -GUTENPRINT_LIBS = $(top_builddir)/src/main/libgutenprint.la -GUTENPRINT_MAJOR_VERSION = @GUTENPRINT_MAJOR_VERSION@ -GUTENPRINT_MICRO_VERSION = @GUTENPRINT_MICRO_VERSION@ -GUTENPRINT_MINOR_VERSION = @GUTENPRINT_MINOR_VERSION@ -GUTENPRINT_VERSION = @GUTENPRINT_VERSION@ -IJS_CFLAGS = @IJS_CFLAGS@ -IJS_CONFIG = @IJS_CONFIG@ -IJS_LIBS = @IJS_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBREADLINE_DEPS = @LIBREADLINE_DEPS@ -LIBS = $(INTLLIBS) @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LN_S = @LN_S@ -LTALLOCA = @LTALLOCA@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PLUG_IN_PATH = @PLUG_IN_PATH@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -RELEASE_DATE = @RELEASE_DATE@ -RM = @RM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -TEST = @TEST@ -TEXI2HTML = @TEXI2HTML@ -TRUE = @TRUE@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -WHICH_PPDS = @WHICH_PPDS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -cups_bindir = @cups_bindir@ -cups_conf_datadir = @cups_conf_datadir@ -cups_conf_serverbin = @cups_conf_serverbin@ -cups_conf_serverroot = @cups_conf_serverroot@ -cups_exec_prefix = @cups_exec_prefix@ -cups_prefix = @cups_prefix@ -cups_sbindir = @cups_sbindir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ -gutenprint_cflags = @gutenprint_cflags@ -gutenprint_libdeps = @gutenprint_libdeps@ -gutenprint_libs = @gutenprint_libs@ -gutenprintui2_cflags = @gutenprintui2_cflags@ -gutenprintui2_libdeps = @gutenprintui2_libdeps@ -gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) -m4datadir = $(datadir)/aclocal -pkgconfigdatadir = $(libdir)/pkgconfig -@BUILD_LIBGUTENPRINTUI_TRUE@lib_LTLIBRARIES = libgutenprintui.la -libgutenprintui_la_SOURCES = \ - printrcy.y \ - printrcl.l \ - printrc.h \ - plist.c \ - panel.c \ - ui-utils.c \ - print-image-thumbnail.c \ - gutenprintui-internal.h - -libgutenprintui_la_LIBADD = $(GUTENPRINTUI_LIBDEPS) -# Uncommment to build an unversioned library (version in soname) -libgutenprintui_la_CFLAGS = $(AM_CFLAGS) $(GUTENPRINT_CFLAGS) $(GTK_CFLAGS) -#libgutenprintui_la_LDFLAGS = -release $(GUTENPRINT_VERSION) \ -# -rpath $(libdir) -no-undefined -# Uncomment to build a versioned library -libgutenprintui_la_LDFLAGS = \ - -version-info $(GUTENPRINTUI_CURRENT_INTERFACE):$(GUTENPRINTUI_INTERFACE_AGE):$(GUTENPRINTUI_BINARY_AGE) \ - -rpath $(libdir) -no-undefined - -AM_LFLAGS = -i -AM_YFLAGS = -d -@BUILD_LIBGUTENPRINTUI_TRUE@pkgconfigdata_DATA = gutenprintui.pc -MAINTAINERCLEANFILES = Makefile.in printrcl.c printrcy.c printrcy.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .l .lo .o .obj .y -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/scripts/global.mk $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/gutenprintui/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/gutenprintui/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -gutenprintui.pc: $(top_builddir)/config.status $(srcdir)/gutenprintui.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -printrcy.h: printrcy.c - @if test ! -f $@; then \ - rm -f printrcy.c; \ - $(MAKE) $(AM_MAKEFLAGS) printrcy.c; \ - else :; fi -libgutenprintui.la: $(libgutenprintui_la_OBJECTS) $(libgutenprintui_la_DEPENDENCIES) - $(libgutenprintui_la_LINK) $(am_libgutenprintui_la_rpath) $(libgutenprintui_la_OBJECTS) $(libgutenprintui_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgutenprintui_la-panel.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgutenprintui_la-plist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgutenprintui_la-print-image-thumbnail.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgutenprintui_la-printrcl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgutenprintui_la-printrcy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgutenprintui_la-ui-utils.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libgutenprintui_la-printrcy.lo: printrcy.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -MT libgutenprintui_la-printrcy.lo -MD -MP -MF $(DEPDIR)/libgutenprintui_la-printrcy.Tpo -c -o libgutenprintui_la-printrcy.lo `test -f 'printrcy.c' || echo '$(srcdir)/'`printrcy.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgutenprintui_la-printrcy.Tpo $(DEPDIR)/libgutenprintui_la-printrcy.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='printrcy.c' object='libgutenprintui_la-printrcy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -c -o libgutenprintui_la-printrcy.lo `test -f 'printrcy.c' || echo '$(srcdir)/'`printrcy.c - -libgutenprintui_la-printrcl.lo: printrcl.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -MT libgutenprintui_la-printrcl.lo -MD -MP -MF $(DEPDIR)/libgutenprintui_la-printrcl.Tpo -c -o libgutenprintui_la-printrcl.lo `test -f 'printrcl.c' || echo '$(srcdir)/'`printrcl.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgutenprintui_la-printrcl.Tpo $(DEPDIR)/libgutenprintui_la-printrcl.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='printrcl.c' object='libgutenprintui_la-printrcl.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -c -o libgutenprintui_la-printrcl.lo `test -f 'printrcl.c' || echo '$(srcdir)/'`printrcl.c - -libgutenprintui_la-plist.lo: plist.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -MT libgutenprintui_la-plist.lo -MD -MP -MF $(DEPDIR)/libgutenprintui_la-plist.Tpo -c -o libgutenprintui_la-plist.lo `test -f 'plist.c' || echo '$(srcdir)/'`plist.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgutenprintui_la-plist.Tpo $(DEPDIR)/libgutenprintui_la-plist.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='plist.c' object='libgutenprintui_la-plist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -c -o libgutenprintui_la-plist.lo `test -f 'plist.c' || echo '$(srcdir)/'`plist.c - -libgutenprintui_la-panel.lo: panel.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -MT libgutenprintui_la-panel.lo -MD -MP -MF $(DEPDIR)/libgutenprintui_la-panel.Tpo -c -o libgutenprintui_la-panel.lo `test -f 'panel.c' || echo '$(srcdir)/'`panel.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgutenprintui_la-panel.Tpo $(DEPDIR)/libgutenprintui_la-panel.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='panel.c' object='libgutenprintui_la-panel.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -c -o libgutenprintui_la-panel.lo `test -f 'panel.c' || echo '$(srcdir)/'`panel.c - -libgutenprintui_la-ui-utils.lo: ui-utils.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -MT libgutenprintui_la-ui-utils.lo -MD -MP -MF $(DEPDIR)/libgutenprintui_la-ui-utils.Tpo -c -o libgutenprintui_la-ui-utils.lo `test -f 'ui-utils.c' || echo '$(srcdir)/'`ui-utils.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgutenprintui_la-ui-utils.Tpo $(DEPDIR)/libgutenprintui_la-ui-utils.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ui-utils.c' object='libgutenprintui_la-ui-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -c -o libgutenprintui_la-ui-utils.lo `test -f 'ui-utils.c' || echo '$(srcdir)/'`ui-utils.c - -libgutenprintui_la-print-image-thumbnail.lo: print-image-thumbnail.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -MT libgutenprintui_la-print-image-thumbnail.lo -MD -MP -MF $(DEPDIR)/libgutenprintui_la-print-image-thumbnail.Tpo -c -o libgutenprintui_la-print-image-thumbnail.lo `test -f 'print-image-thumbnail.c' || echo '$(srcdir)/'`print-image-thumbnail.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgutenprintui_la-print-image-thumbnail.Tpo $(DEPDIR)/libgutenprintui_la-print-image-thumbnail.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='print-image-thumbnail.c' object='libgutenprintui_la-print-image-thumbnail.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgutenprintui_la_CFLAGS) $(CFLAGS) -c -o libgutenprintui_la-print-image-thumbnail.lo `test -f 'print-image-thumbnail.c' || echo '$(srcdir)/'`print-image-thumbnail.c - -.l.c: - $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) - -.y.c: - $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-pkgconfigdataDATA: $(pkgconfigdata_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgconfigdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdatadir)" - @list='$(pkgconfigdata_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(pkgconfigdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdatadir)/$$f'"; \ - $(pkgconfigdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdatadir)/$$f"; \ - done - -uninstall-pkgconfigdataDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfigdata_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pkgconfigdatadir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkgconfigdatadir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(DATA) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdatadir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -rm -f printrcl.c - -rm -f printrcy.c - -rm -f printrcy.h - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgconfigdataDATA - -install-dvi: install-dvi-am - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgconfigdataDATA - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-man install-pdf install-pdf-am \ - install-pkgconfigdataDATA install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-libLTLIBRARIES uninstall-pkgconfigdataDATA - - -@SET_MAKE@ - -# Rules - -$(top_builddir)/src/main/libgutenprint.la: - cd $(top_builddir)/src/main; \ - $(MAKE) - -$(top_builddir)/src/gutenprintui/libgutenprintui.la: - cd $(top_builddir)/src/gutenprintui; \ - $(MAKE) - -$(top_builddir)/src/gutenprintui2/libgutenprintui2.la: - cd $(top_builddir)/src/gutenprintui2; \ - $(MAKE) - -printrcy.o: printrcl.o -plist.o: printrcy.o -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/gutenprintui/gutenprintui-internal.h b/src/gutenprintui/gutenprintui-internal.h deleted file mode 100644 index 7c4547d..0000000 --- a/src/gutenprintui/gutenprintui-internal.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * "$Id: gutenprintui-internal.h,v 1.2.12.1 2007/03/02 12:01:17 rlk Exp $" - * - * Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com), - * Robert Krawitz (rlk@alum.mit.edu). and Steve Miller (smiller@rni.net - * - * 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. - * - * - * Revision History: - * - * See ChangeLog - */ - -#ifndef __GIMP_PRINT_UI_INTERNAL_H__ -#define __GIMP_PRINT_UI_INTERNAL_H__ - -#ifdef __GNUC__ -#define inline __inline__ -#endif - -#include <sys/types.h> -#include <gtk/gtk.h> - -#include <gutenprint/gutenprint.h> - -typedef struct -{ - GtkWidget *checkbox; - int current; - int deflt; -} boolean_option_t; - -typedef struct -{ - gint callback_id; - char *default_val; - stp_string_list_t *params; - GtkWidget *combo; - GtkWidget *label; -} list_option_t; - -typedef struct -{ - GtkObject *adjustment; - gfloat upper; - gfloat lower; - gfloat deflt; - gfloat scale; -} float_option_t; - -typedef struct -{ - GtkWidget *label; - GtkWidget *button; - GtkWidget *dialog; - GtkWidget *gamma_curve; - const char *help_text; - stp_curve_t *current; - const stp_curve_t *deflt; - gboolean is_visible; -} curve_option_t; - -typedef struct -{ - const stp_parameter_t *fast_desc; - int is_active; - int is_enabled; - GtkWidget *checkbox; - union { - list_option_t list; - float_option_t flt; - curve_option_t curve; - boolean_option_t bool; - } info; -} option_t; - -typedef struct -{ - const char *name; - const char *help; - gdouble scale; - GtkWidget *checkbox; - const char *format; -} unit_t; - -typedef struct -{ - const char *name; - const char *help; - const char *value; - GtkWidget *button; -} radio_group_t; - -typedef struct -{ - unsigned char *base_addr; - const char *output_type; - int bpp; - off_t offset; - off_t limit; -} priv_t; - -#define PLUG_IN_VERSION VERSION " - " RELEASE_DATE -#define PLUG_IN_NAME "Print" - -#define INVALID_TOP 1 -#define INVALID_LEFT 2 - -#define SCALE_ENTRY_LABEL(adj) \ - GTK_LABEL (gtk_object_get_data (GTK_OBJECT(adj), "label")) - -#define SCALE_ENTRY_SCALE(adj) \ - GTK_HSCALE (gtk_object_get_data (GTK_OBJECT(adj), "scale")) -#define SCALE_ENTRY_SCALE_ADJ(adj) \ - gtk_range_get_adjustment \ - (GTK_RANGE (gtk_object_get_data (GTK_OBJECT (adj), "scale"))) - -#define SCALE_ENTRY_SPINBUTTON(adj) \ - GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT (adj), "spinbutton")) -#define SCALE_ENTRY_SPINBUTTON_ADJ(adj) \ - gtk_spin_button_get_adjustment \ - (GTK_SPIN_BUTTON (gtk_object_get_data (GTK_OBJECT (adj), "spinbutton"))) - -extern gint stpui_plist_count; /* Number of system printers */ -extern gint stpui_plist_current; /* Current system printer */ -extern stpui_plist_t *stpui_plist; /* System printers */ -extern char *stpui_printrc_current_printer; -extern int stpui_show_all_paper_sizes; -extern stp_string_list_t *stpui_system_print_queues; - -/* - * Function prototypes - */ - -extern stpui_plist_t *stpui_plist_create(const char *name, const char *driver); -extern const char *stpui_combo_get_name(GtkWidget *combo, - const stp_string_list_t *options); -extern void stpui_table_attach_aligned(GtkTable *table, gint column, - gint row, const gchar *label_text, - gfloat xalign, gfloat yalign, - GtkWidget *widget, gint colspan, - gboolean left_align); - -extern GtkWidget *stpui_create_entry(GtkWidget *table, int hpos, int vpos, - const char *text, const char *help, - GtkSignalFunc callback); -extern GSList *stpui_create_radio_button(radio_group_t *radio, GSList *group, - GtkWidget *table, int hpos, int vpos, - GtkSignalFunc callback); -extern void stpui_set_adjustment_tooltip (GtkObject *adj, const gchar *tip); -extern void stpui_create_new_combo(option_t *option, GtkWidget *table, - int hpos, int vpos, gboolean is_optional); -extern void stpui_help_init (void); -extern void stpui_help_free (void); -extern void stpui_enable_help (void); -extern void stpui_disable_help (void); -extern void stpui_set_help_data (GtkWidget *widget, const gchar *tooltip); - -extern GtkWidget *stpui_dialog_new(const gchar *title, - const gchar *wmclass_name, - GtkWindowPosition position, - gint allow_shrink, - gint allow_grow, - gint auto_shrink, - /* specify action area buttons as va_list: - * const gchar *label, - * GtkSignalFunc callback, - * gpointer data, - * GtkObject *slot_object, - * GtkWidget **widget_ptr, - * gboolean default_action, - * gboolean connect_delete, - */ - ...); - -extern GtkWidget *stpui_option_menu_new(gboolean menu_only, - /* specify menu items as va_list: - * const gchar *label, - * GtkSignalFunc callback, - * gpointer data, - * gpointer user_data, - * GtkWidget **widget_ptr, - * gboolean active - */ - ...); - -extern GtkObject *stpui_scale_entry_new(GtkTable *table, - gint column, - gint row, - const gchar *text, - gint scale_usize, - gint spinbutton_usize, - gfloat value, - gfloat lower, - gfloat upper, - gfloat step_increment, - gfloat page_increment, - guint digits, - gboolean constrain, - gfloat unconstrained_lower, - gfloat unconstrained_upper, - const gchar *tooltip); - -extern void stpui_create_scale_entry(option_t *option, - GtkTable *table, - gint column, - gint row, - const gchar *text, - gint scale_usize, - gint spinbutton_usize, - gfloat value, - gfloat lower, - gfloat upper, - gfloat step_increment, - gfloat page_increment, - guint digits, - gboolean constrain, - gfloat unconstrained_lower, - gfloat unconstrained_upper, - const gchar *tooltip, - gboolean is_optional); - - -/* Thumbnails -- keep it simple! */ - -stp_image_t *stpui_image_thumbnail_new(const guchar *data, gint w, gint h, - gint bpp); - -#endif /* __GIMP_PRINT_UI_INTERNAL_H__ */ diff --git a/src/gutenprintui/gutenprintui.pc.in b/src/gutenprintui/gutenprintui.pc.in deleted file mode 100644 index 42e350e..0000000 --- a/src/gutenprintui/gutenprintui.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: Gutenprint UI (GTK+-1.2 version) -Description: Gutenprint Top Quality Printer Drivers - GTK+-1.2 User Interface -Requires: gutenprint -Version: @VERSION@ -Libs: -L${libdir} @GUTENPRINTUI_LIBS@ -Libs.private: @gutenprintui_libdeps@ -Cflags: -I${includedir} @gutenprintui_cflags@ diff --git a/src/gutenprintui/panel.c b/src/gutenprintui/panel.c deleted file mode 100644 index eed8a65..0000000 --- a/src/gutenprintui/panel.c +++ /dev/null @@ -1,5225 +0,0 @@ -/* - * "$Id: panel.c,v 1.9.6.2 2007/12/15 20:35:39 rlk Exp $" - * - * Main window code for Print plug-in for the GIMP. - * - * Copyright 1997-2003 Michael Sweet (mike@easysw.com), - * Robert Krawitz (rlk@alum.mit.edu), Steve Miller (smiller@rni.net) - * and Michael Natterer (mitch@gimp.org) - * - * 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 - -#define MAX_PREVIEW_PPI (400) -#define INCH 72 -#define FINCH ((gdouble) INCH) -#define ROUNDUP(x, y) (((x) + ((y) - 1)) / (y)) -#define SCALE(x, y) (((x) + (1.0 / (2.0 * (y)))) * (y)) - -#include <gutenprint/gutenprint-intl-internal.h> -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" - -#include <string.h> -#include <stdio.h> - -#define MAXIMUM_PARAMETER_LEVEL STP_PARAMETER_LEVEL_ADVANCED4 - -/* - * Constants for GUI. - */ -static int preview_size_vert = 360; -static int preview_size_horiz = 300; -static const int minimum_image_percent = 5.0; -static const int thumbnail_hintw = 128; -static const int thumbnail_hinth = 128; - -#define MOVE_CONSTRAIN 0 -#define MOVE_HORIZONTAL 1 -#define MOVE_VERTICAL 2 -#define MOVE_ANY (MOVE_HORIZONTAL | MOVE_VERTICAL) -#define MOVE_GRID 4 - -/* - * Main window widgets - */ - -static GtkWidget *main_vbox; -static GtkWidget *main_hbox; -static GtkWidget *right_vbox; -static GtkWidget *notebook; - -static GtkWidget *output_color_vbox; -static GtkWidget *cyan_button; -static GtkWidget *magenta_button; -static GtkWidget *yellow_button; -static GtkWidget *black_button; -static GtkWidget *red_button; -static GtkWidget *green_button; -static GtkWidget *blue_button; - -static GtkWidget *print_dialog; /* Print dialog window */ - -static GtkWidget *recenter_button; -static GtkWidget *recenter_vertical_button; -static GtkWidget *recenter_horizontal_button; - -static GtkWidget *left_entry; -/* -static GtkWidget *right_entry; -*/ -static GtkWidget *right_border_entry; -static GtkWidget *top_entry; -/* -static GtkWidget *bottom_entry; -*/ -static GtkWidget *bottom_border_entry; -static GtkWidget *width_entry; -static GtkWidget *height_entry; -static GtkWidget *units_hbox; -static GtkWidget *units_label; - -static GtkWidget *custom_size_width; -static GtkWidget *custom_size_height; -static GtkWidget *show_all_paper_sizes_button; -static GtkWidget *auto_paper_size_button; - -static GtkWidget *orientation_menu; /* Orientation menu */ - -static GtkWidget *scaling_percent; /* Scale by percent */ -static GtkWidget *scaling_ppi; /* Scale by pixels-per-inch */ -static GtkWidget *scaling_image; /* Scale to the image */ -static GtkObject *scaling_adjustment; /* Adjustment object for scaling */ - -static GtkWidget *setup_dialog; /* Setup dialog window */ -static GtkWidget *printer_driver; /* Printer driver widget */ -static GtkWidget *printer_model_label; /* Printer model name */ -static GtkWidget *printer_crawler; /* Scrolled Window for menu */ -static GtkWidget *printer_combo; /* Combo for menu */ -static GtkWidget *manufacturer_clist; /* Manufacturer widget */ -static GtkWidget *manufacturer_crawler; /* Scrolled Window for menu */ -static gint plist_callback_id = -1; -static GtkWidget *ppd_file; /* PPD file entry */ -static GtkWidget *ppd_box; -static GtkWidget *ppd_label; /* PPD file entry */ -static GtkWidget *ppd_button; /* PPD file browse button */ -static GtkWidget *ppd_browser; /* File selection dialog for PPDs */ -static GtkWidget *ppd_model_label; /* PPD file entry */ -static GtkWidget *ppd_model; /* PPD file entry */ -static GtkWidget *new_printer_dialog; /* New printer dialog window */ -static GtkWidget *new_printer_entry; /* New printer text entry */ -static GtkWidget *file_button; /* PPD file browse button */ -static GtkWidget *file_entry; /* FSD for print files */ -static GtkWidget *file_browser; /* FSD for print files */ -static GtkWidget *standard_cmd_entry; /* FSD for print files */ -static GtkWidget *custom_command_entry; /* FSD for print files */ -static GtkWidget *queue_combo; /* FSD for print files */ -static gint queue_callback_id = -1; - -static GtkWidget *adjust_color_button; -static GtkWidget *about_dialog; - -static GtkWidget *page_size_table; -static GtkWidget *printer_features_table; -static GtkWidget *color_adjustment_table; - -static GtkWidget *copy_count_spin_button; - -static gboolean preview_valid = FALSE; -static gboolean frame_valid = FALSE; -static gboolean need_exposure = FALSE; -static gboolean suppress_scaling_adjustment = FALSE; -static gboolean suppress_scaling_callback = FALSE; -static gboolean thumbnail_update_pending = FALSE; -static gboolean thumbnail_needs_rebuild = FALSE; -/* - * These are semaphores, not true booleans. - */ -static gint suppress_preview_update = 0; -static gint suppress_preview_reset = 0; - -static GtkDrawingArea *preview = NULL; /* Preview drawing area widget */ -static GtkDrawingArea *swatch = NULL; -static gint mouse_x, mouse_y; /* Last mouse position */ -static gint orig_top, orig_left; /* Original mouse position at start */ -static gint buttons_pressed = 0; -static gint preview_active = 0; -static gint buttons_mask = 0; -static gint move_constraint = 0; -static gint mouse_button = -1; /* Button being dragged with */ -static gint preview_thumbnail_w, preview_thumbnail_h; -static gint preview_x, preview_y, preview_w, preview_h; - -static gint physical_orientation = -2; /* Actual orientation */ - -static gint paper_width, paper_height; /* Physical width */ -static gint printable_width, printable_height; /* Size of printable area */ -static gint print_width, print_height; /* Printed area of image */ -static gint left, right, top, bottom; /* Imageable region */ -static gint image_width, image_height; /* Image size (possibly rotated) */ -static gint image_true_width, image_true_height; /* Original image */ -static gdouble image_xres, image_yres; /* Original image resolution */ -static gint do_update_thumbnail = 0; -static gint saveme = 0; /* True if printrc should be saved */ -static gint runme = 0; /* True if print should proceed */ -static gint exit_after_file_ok = 0; /* True if we should exit after file browser complete */ -static gint auto_paper_size = 0; /* True if we're using auto paper size now */ - - - -static void scaling_update (GtkAdjustment *adjustment); -static void scaling_callback (GtkWidget *widget); -static void plist_callback (GtkWidget *widget, gpointer data); -static void queue_callback (GtkWidget *widget, gpointer data); -static void custom_media_size_callback(GtkWidget *widget, gpointer data); -static void show_all_paper_sizes_callback(GtkWidget *widget, gpointer data); -static void auto_paper_size_callback(GtkWidget *widget, gpointer data); -static void combo_callback (GtkWidget *widget, gpointer data); -static void output_type_callback (GtkWidget *widget, gpointer data); -static void unit_callback (GtkWidget *widget, gpointer data); -static void orientation_callback (GtkWidget *widget, gpointer data); -static void ppd_file_callback (GtkWidget *widget, gpointer data); -static void printandsave_callback (void); -static void about_callback (void); -static void print_callback (void); -static void save_callback (void); -static void setup_callback (GtkWidget *widget); - -static void setup_update (void); -static void setup_open_callback (void); -static void setup_ok_callback (void); -static void setup_cancel_callback (void); -static void new_printer_open_callback (void); -static void new_printer_ok_callback (void); -static void ppd_browse_callback (void); -static void ppd_ok_callback (void); -static void file_browse_callback (void); -static void file_ok_callback (void); -static void file_cancel_callback (void); -static void build_printer_driver_clist(void); -static void print_driver_callback (GtkWidget *widget, - gint row, - gint column, - GdkEventButton *event, - gpointer data); -static void manufacturer_callback (GtkWidget *widget, - gint row, - gint column, - GdkEventButton *event, - gpointer data); -static void command_type_callback (GtkWidget *widget, gpointer data); - -static void do_preview_thumbnail (void); -static void invalidate_preview_thumbnail (void); -static void invalidate_frame (void); - -static GtkWidget *color_adjust_dialog; - -static void preview_update (void); -static void preview_expose (void); -static void preview_button_callback (GtkWidget *widget, - GdkEventButton *bevent, - gpointer data); -static void preview_motion_callback (GtkWidget *widget, - GdkEventMotion *mevent, - gpointer data); -static void position_callback (GtkWidget *widget); -static void position_button_callback (GtkWidget *widget, - gpointer data); -static void copy_count_callback (GtkAdjustment *widget, - gpointer data); -static void plist_build_combo(GtkWidget *combo, - GtkWidget *label, - stp_string_list_t *items, - int active, - const gchar *cur_item, - const gchar *def_value, - GtkSignalFunc callback, - gint *callback_id, - int (*check_func)(const char *string), - gpointer data); -static void initialize_thumbnail(void); -static void set_color_defaults (void); -static void set_printer_defaults (void); -static void redraw_color_swatch (void); -static void color_update (GtkAdjustment *adjustment); -static void dimension_update (GtkAdjustment *adjustment); -static void set_controls_active (GtkObject *checkbutton, gpointer optno); -static void update_adjusted_thumbnail (gboolean regenerate_image); - -static void set_media_size(const gchar *new_media_size); -static const stp_printer_t *tmp_printer = NULL; - -static option_t *current_options = NULL; -static int current_option_count = 0; - -static unit_t units[] = - { - { N_("Inch"), N_("Set the base unit of measurement to inches"), - 72.0, NULL, "%.2f" }, - { N_("cm"), N_("Set the base unit of measurement to centimetres"), - 72.0 / 2.54, NULL, "%.2f" }, - { N_("Points"), N_("Set the base unit of measurement to points (1/72\")"), - 1.0, NULL, "%.0f" }, - { N_("mm"), N_("Set the base unit of measurement to millimetres"), - 72.0 / 25.4, NULL, "%.1f" }, - { N_("Pica"), N_("Set the base unit of measurement to picas (1/12\")"), - 72.0 / 12.0, NULL, "%.1f" }, - }; -static const gint unit_count = sizeof(units) / sizeof(unit_t); - -static radio_group_t output_types[] = - { - { N_("Color"), N_("Color output"), "Color", NULL }, - { N_("Grayscale"), - N_("Print in shades of gray using black ink"), "BW", NULL } - }; - -static const gint output_type_count = (sizeof(output_types) / - sizeof(radio_group_t)); - -/* - * The order of these entries must match the order in command_t in - * gutenprintui.h - */ -static radio_group_t command_options[] = - { - { N_("Standard Command"), N_("Use standard print command"), "Standard", NULL }, - { N_("Custom Command"), N_("Use custom print command"), "Custom", NULL }, - { N_("File"), N_("Print to a file"), "File", NULL } - }; - -static const gint command_options_count = (sizeof(command_options) / - sizeof(radio_group_t)); - -static gdouble preview_ppi = 10; - -static stp_string_list_t *printer_list = 0; -static stpui_plist_t *pv; -static const char *manufacturer = 0; - -static gint thumbnail_w, thumbnail_h, thumbnail_bpp; -static guchar *thumbnail_data; -static guchar *adjusted_thumbnail_data; -static guchar *preview_thumbnail_data; - -static void -set_gtk_curve_values(GtkWidget *gcurve, const stp_curve_t *seed) -{ - if (stp_curve_get_gamma(seed)) - { - gtk_curve_set_gamma(GTK_CURVE(gcurve), stp_curve_get_gamma(seed)); - } - else - { - stp_curve_t *copy = stp_curve_create_copy(seed); - const float *fdata; - size_t count; - stp_curve_resample(copy, 256); - fdata = stp_curve_get_float_data(copy, &count); - gtk_curve_set_vector(GTK_CURVE(gcurve), count, (float *) fdata); - stp_curve_destroy(copy); - } -} - -static void -set_stp_curve_values(GtkWidget *widget, option_t *opt) -{ - int i; - double lo, hi; - gfloat vector[256]; - GtkWidget *gcurve = GTK_WIDGET(widget); - stp_curve_t *curve = stp_curve_create_copy(opt->info.curve.deflt); - gtk_curve_get_vector(GTK_CURVE(gcurve), 256, vector); - stp_curve_get_bounds(opt->info.curve.deflt, &lo, &hi); - for (i = 0; i < 256; i++) - { - if (vector[i] > hi) - vector[i] = hi; - else if (vector[i] < lo) - vector[i] = lo; - } - switch (GTK_CURVE(gcurve)->curve_type) - { - case GTK_CURVE_TYPE_SPLINE: - stp_curve_set_interpolation_type(curve, STP_CURVE_TYPE_SPLINE); - break; - default: - stp_curve_set_interpolation_type(curve, STP_CURVE_TYPE_LINEAR); - break; - } - stp_curve_set_float_data(curve, 256, vector); - stp_set_curve_parameter(pv->v, opt->fast_desc->name, curve); - stp_curve_destroy(curve); -} - -static int -open_curve_editor(GtkObject *button, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - if (opt->info.curve.is_visible == FALSE) - { - GtkWidget *gcurve = - GTK_WIDGET(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve); - const stp_curve_t *seed = - stp_get_curve_parameter(pv->v, opt->fast_desc->name); - stp_curve_t *nseed = NULL; - if (!seed) - seed = opt->info.curve.deflt; - if (seed) - nseed = stp_curve_create_copy(seed); - gtk_widget_set_sensitive(GTK_WIDGET(opt->checkbox), FALSE); - gtk_widget_show(GTK_WIDGET(opt->info.curve.dialog)); - set_gtk_curve_values(gcurve, seed); - opt->info.curve.is_visible = TRUE; - if (opt->info.curve.current) - stp_curve_destroy(opt->info.curve.current); - opt->info.curve.current = nseed; - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(FALSE); - } -/* gtk_window_activate_focus(GTK_WINDOW(opt->info.curve.dialog)); */ - return 1; -} - -static int -set_default_curve_callback(GtkObject *button, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - GtkWidget *gcurve = - GTK_WIDGET(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve); - const stp_curve_t *seed = opt->info.curve.deflt; - set_gtk_curve_values(gcurve, seed); - set_stp_curve_values(gcurve, opt); - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); - return 1; -} - -static int -set_previous_curve_callback(GtkObject *button, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - GtkWidget *gcurve = - GTK_WIDGET(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve); - const stp_curve_t *seed = opt->info.curve.current; - if (!seed) - seed = opt->info.curve.deflt; - set_gtk_curve_values(gcurve, seed); - set_stp_curve_values(gcurve, opt); - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); - return 1; -} - -static int -set_curve_callback(GtkObject *button, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - GtkWidget *gcurve = - GTK_WIDGET(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve); - gtk_widget_hide(opt->info.curve.dialog); - gtk_widget_set_sensitive(GTK_WIDGET(opt->checkbox), TRUE); - opt->info.curve.is_visible = FALSE; - set_stp_curve_values(gcurve, opt); - if (opt->info.curve.current) - stp_curve_destroy(opt->info.curve.current); - opt->info.curve.current = NULL; - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); - return 1; -} - -static gint -curve_draw_callback(GtkWidget *widget, GdkEvent *event, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - switch (event->type) - { - case GDK_BUTTON_RELEASE: - set_stp_curve_values(widget, opt); - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); - break; - default: - break; - } - return 1; -} - -static gint -curve_type_changed(GtkWidget *widget, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - set_stp_curve_values(widget, opt); - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); - return 1; -} - -static int -cancel_curve_callback(GtkObject *button, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - if (opt->info.curve.is_visible) - { - stp_set_curve_parameter(pv->v, opt->fast_desc->name, - opt->info.curve.current); - stp_curve_destroy(opt->info.curve.current); - opt->info.curve.current = NULL; - gtk_widget_hide(opt->info.curve.dialog); - gtk_widget_set_sensitive(GTK_WIDGET(opt->checkbox), TRUE); - opt->info.curve.is_visible = FALSE; - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); - } - return 1; -} - -static void -stpui_create_curve(option_t *opt, - GtkTable *table, - gint column, - gint row, - const gchar *text, - const stp_curve_t *deflt, - gboolean is_optional) -{ - double lower, upper; - opt->checkbox = gtk_check_button_new(); - gtk_table_attach(GTK_TABLE(table), opt->checkbox, - column, column + 1, row, row + 1, - GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); - if (is_optional) - gtk_widget_show(opt->checkbox); - else - gtk_widget_hide(opt->checkbox); - - opt->info.curve.label = gtk_label_new(text); - gtk_misc_set_alignment (GTK_MISC (opt->info.curve.label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (table), opt->info.curve.label, - column + 1, column + 2, row, row + 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (opt->info.curve.label); - - opt->info.curve.button = gtk_button_new_with_label(_("Edit Curve...")); - gtk_signal_connect(GTK_OBJECT(opt->info.curve.button), "clicked", - GTK_SIGNAL_FUNC(open_curve_editor), opt); - gtk_table_attach (GTK_TABLE (table), opt->info.curve.button, - column + 2, column + 3, row, row + 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show(opt->info.curve.button); - - opt->info.curve.dialog = - stpui_dialog_new(gettext(opt->fast_desc->text), gettext(opt->fast_desc->text), - GTK_WIN_POS_MOUSE, FALSE, TRUE, FALSE, - _("Set Default"), set_default_curve_callback, - opt, NULL, NULL, FALSE, FALSE, - _("Restore Previous"), set_previous_curve_callback, - opt, NULL, NULL, FALSE, FALSE, - _("OK"), set_curve_callback, - opt, NULL, NULL, FALSE, FALSE, - _("Cancel"), cancel_curve_callback, - opt, NULL, NULL, FALSE, FALSE, - NULL); - opt->info.curve.gamma_curve = gtk_gamma_curve_new(); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(opt->info.curve.dialog)->vbox), - opt->info.curve.gamma_curve, TRUE, TRUE, 0); - stp_curve_get_bounds(opt->info.curve.deflt, &lower, &upper); - gtk_curve_set_range(GTK_CURVE(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve), - 0.0, 1.0, lower, upper); - gtk_widget_set_usize - (GTK_WIDGET(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve), 256, 256); - gtk_widget_show(opt->info.curve.gamma_curve); - - gtk_signal_connect - (GTK_OBJECT(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve), - "curve-type-changed", GTK_SIGNAL_FUNC(curve_type_changed), opt); - gtk_signal_connect - (GTK_OBJECT(GTK_GAMMA_CURVE(opt->info.curve.gamma_curve)->curve), - "event", GTK_SIGNAL_FUNC(curve_draw_callback), opt); - - if (opt->fast_desc->help) - { - stpui_set_help_data (opt->info.curve.label, opt->fast_desc->help); - stpui_set_help_data (opt->info.curve.button, opt->fast_desc->help); - stpui_set_help_data (opt->info.curve.gamma_curve, opt->fast_desc->help); - } -} - -static int -checkbox_callback(GtkObject *button, gpointer xopt) -{ - option_t *opt = (option_t *)xopt; - GtkWidget *checkbox = GTK_WIDGET(opt->info.bool.checkbox); - opt->info.bool.current = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)); - stp_set_boolean_parameter(pv->v, opt->fast_desc->name, - opt->info.bool.current); - invalidate_frame(); - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); - preview_update(); - return 1; -} - -static int -print_mode_is_color(const stp_vars_t *v) -{ - const char *printing_mode = stp_get_string_parameter(v, "PrintingMode"); - if (!printing_mode) - { - int answer = 1; - stp_parameter_t desc; - stp_describe_parameter(v, "PrintingMode", &desc); - if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST && - strcmp(desc.deflt.str, "BW") == 0) - answer = 0; - stp_parameter_description_destroy(&desc); - return answer; - } - if (strcmp(printing_mode, "BW") == 0) - return 0; - else - return 1; -} - -static void -set_current_printer(void) -{ - pv = &(stpui_plist[stpui_plist_current]); - if (print_mode_is_color(pv->v)) - stp_set_string_parameter(pv->v, "PrintingMode", "Color"); - else - stp_set_string_parameter(pv->v, "PrintingMode", "BW"); -} - - -static void -stpui_create_boolean(option_t *opt, - GtkTable *table, - gint column, - gint row, - const gchar *text, - int deflt, - gboolean is_optional) -{ - opt->checkbox = gtk_check_button_new(); - gtk_table_attach(GTK_TABLE(table), opt->checkbox, - column, column + 1, row, row + 1, - GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); - if (is_optional) - gtk_widget_show(opt->checkbox); - else - gtk_widget_hide(opt->checkbox); - - opt->info.bool.checkbox = - gtk_toggle_button_new_with_label(gettext(opt->fast_desc->text)); - gtk_table_attach(GTK_TABLE(table), opt->info.bool.checkbox, - column + 1, column + 3, row, row + 1, - GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show(opt->info.bool.checkbox); - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(opt->info.bool.checkbox), - stp_get_boolean_parameter(pv->v, opt->fast_desc->name)); - gtk_signal_connect(GTK_OBJECT(opt->info.bool.checkbox), "toggled", - GTK_SIGNAL_FUNC(checkbox_callback), opt); -} - -static void -build_queue_combo(void) -{ - plist_build_combo(queue_combo, - NULL, - stpui_system_print_queues, - 1, - stpui_plist_get_queue_name(pv), - NULL, - queue_callback, - &queue_callback_id, - NULL, - NULL); -} - -static void -build_printer_combo(void) -{ - int i; - if (printer_list) - stp_string_list_destroy(printer_list); - printer_list = stp_string_list_create(); - for (i = 0; i < stpui_plist_count; i++) - stp_string_list_add_string(printer_list, - stpui_plist[i].name, stpui_plist[i].name); - plist_build_combo(printer_combo, - NULL, - printer_list, - 1, - stp_string_list_param(printer_list, stpui_plist_current)->name, - NULL, - plist_callback, - &plist_callback_id, - NULL, - NULL); -} - -static int -check_page_size(const char *paper_size) -{ - const stp_papersize_t *ps = stp_get_papersize_by_name(paper_size); - if (ps && (ps->paper_unit == PAPERSIZE_ENGLISH_STANDARD || - ps->paper_unit == PAPERSIZE_METRIC_STANDARD)) - return 1; - else - return 0; -} - -static void -build_page_size_combo(option_t *option) -{ - /* - * Some printers don't support any "standard" page sizes. If the number - * of page sizes is small, just display all of them. - */ - if (stpui_show_all_paper_sizes || - stp_string_list_count(option->info.list.params) < 10) - plist_build_combo(option->info.list.combo, option->info.list.label, - option->info.list.params, option->is_active, - stp_get_string_parameter(pv->v, option->fast_desc->name), - option->info.list.default_val, combo_callback, - &(option->info.list.callback_id), NULL, option); - else - plist_build_combo(option->info.list.combo, option->info.list.label, - option->info.list.params, option->is_active, - stp_get_string_parameter(pv->v, option->fast_desc->name), - option->info.list.default_val, combo_callback, - &(option->info.list.callback_id), - check_page_size, option); -} - -static void -build_a_combo(option_t *option) -{ - const gchar *new_value; - stp_parameter_activity_t active; - if (option->fast_desc && - option->fast_desc->p_type == STP_PARAMETER_TYPE_STRING_LIST) - { - const gchar *val = stp_get_string_parameter(pv->v, - option->fast_desc->name); - if (option->info.list.params == NULL || ! option->is_active || - stp_string_list_count(option->info.list.params) == 0) - stp_set_string_parameter(pv->v, option->fast_desc->name, NULL); - else if (!val || strlen(val) == 0 || - ! stp_string_list_is_present(option->info.list.params, val)) - stp_set_string_parameter(pv->v, option->fast_desc->name, - option->info.list.default_val); - if (strcmp(option->fast_desc->name, "PageSize") == 0) - build_page_size_combo(option); - else - plist_build_combo(option->info.list.combo, option->info.list.label, - option->info.list.params, - option->is_active, - stp_get_string_parameter(pv->v, - option->fast_desc->name), - option->info.list.default_val, combo_callback, - &(option->info.list.callback_id), NULL, option); - if (strcmp(option->fast_desc->name, "PageSize") == 0) - set_media_size - (stp_get_string_parameter(pv->v, option->fast_desc->name)); - } - else - plist_build_combo(option->info.list.combo, option->info.list.label, - NULL, 0, "", "", combo_callback, - &(option->info.list.callback_id), NULL, option); - new_value = - stpui_combo_get_name(option->info.list.combo, option->info.list.params); - active = stp_get_string_parameter_active(pv->v, option->fast_desc->name); - stp_set_string_parameter(pv->v, option->fast_desc->name, new_value); - stp_set_string_parameter_active(pv->v, option->fast_desc->name, active); -} - -static void -populate_options(const stp_vars_t *v) -{ - stp_parameter_list_t params = stp_get_parameter_list(v); - int i; - int idx; - if (current_options) - { - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_STRING_LIST: - if (opt->info.list.combo) - { - gtk_widget_destroy(opt->info.list.combo); - gtk_widget_destroy(opt->info.list.label); - if (opt->info.list.params) - stp_string_list_destroy(opt->info.list.params); - g_free(opt->info.list.default_val); - } - break; - case STP_PARAMETER_TYPE_DOUBLE: - case STP_PARAMETER_TYPE_DIMENSION: - if (opt->info.flt.adjustment) - { - gtk_widget_destroy - (GTK_WIDGET - (SCALE_ENTRY_SCALE(opt->info.flt.adjustment))); - gtk_widget_destroy - (GTK_WIDGET - (SCALE_ENTRY_LABEL(opt->info.flt.adjustment))); - gtk_widget_destroy - (GTK_WIDGET - (SCALE_ENTRY_SPINBUTTON(opt->info.flt.adjustment))); - } - break; - case STP_PARAMETER_TYPE_CURVE: - gtk_widget_destroy(GTK_WIDGET(opt->info.curve.label)); - gtk_widget_destroy(GTK_WIDGET(opt->info.curve.button)); - gtk_widget_destroy(GTK_WIDGET(opt->info.curve.dialog)); - if (opt->info.curve.current) - stp_curve_destroy(opt->info.curve.current); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - gtk_widget_destroy(GTK_WIDGET(opt->info.bool.checkbox)); - break; - default: - break; - } - if (opt->checkbox) - gtk_widget_destroy(GTK_WIDGET(opt->checkbox)); - } - g_free(current_options); - } - current_option_count = stp_parameter_list_count(params); - current_options = g_malloc(sizeof(option_t) * current_option_count); - - for (idx = 0, i = 0; i < current_option_count; i++) - { - stp_parameter_t desc; - const stp_parameter_t *param = stp_parameter_list_param(params, i); - if (!param->read_only && - (param->p_class == STP_PARAMETER_CLASS_OUTPUT || - param->p_class == STP_PARAMETER_CLASS_FEATURE || - (param->p_class == STP_PARAMETER_CLASS_CORE && - strcmp(param->name, "PageSize") == 0))) - { - option_t *opt = &(current_options[idx]); - opt->fast_desc = stp_parameter_list_param(params, i); - stp_describe_parameter(v, opt->fast_desc->name, &desc); - opt->checkbox = NULL; - opt->is_active = 0; - opt->is_enabled = 0; - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_STRING_LIST: - opt->info.list.callback_id = -1; - opt->info.list.default_val = g_strdup(desc.deflt.str); - if (desc.bounds.str) - opt->info.list.params = - stp_string_list_create_copy(desc.bounds.str); - else - opt->info.list.params = NULL; - opt->info.list.combo = NULL; - opt->info.list.label = NULL; - opt->is_active = desc.is_active; - break; - case STP_PARAMETER_TYPE_DOUBLE: - opt->info.flt.adjustment = NULL; - opt->info.flt.upper = desc.bounds.dbl.upper; - opt->info.flt.lower = desc.bounds.dbl.lower; - opt->info.flt.deflt = desc.deflt.dbl; - opt->info.flt.scale = 1.0; - opt->is_active = desc.is_active; - break; - case STP_PARAMETER_TYPE_DIMENSION: - opt->info.flt.adjustment = NULL; - opt->info.flt.upper = desc.bounds.dimension.upper; - opt->info.flt.lower = desc.bounds.dimension.lower; - opt->info.flt.deflt = desc.deflt.dimension; - opt->info.flt.scale = 1.0; - opt->is_active = desc.is_active; - break; - case STP_PARAMETER_TYPE_CURVE: - opt->info.curve.label = NULL; - opt->info.curve.button = NULL; - opt->info.curve.dialog = NULL; - opt->info.curve.gamma_curve = NULL; - opt->info.curve.current = NULL; - opt->info.curve.deflt = desc.deflt.curve; - opt->info.curve.is_visible = FALSE; - opt->is_active = desc.is_active; - break; - case STP_PARAMETER_TYPE_BOOLEAN: - opt->info.bool.checkbox = NULL; - opt->info.bool.current = 0; - opt->info.bool.deflt = desc.deflt.boolean; - opt->is_active = desc.is_active; - default: - break; - } - idx++; - stp_parameter_description_destroy(&desc); - } - } - current_option_count = idx; - stp_parameter_list_destroy(params); -} - -static void -destroy_something(GtkWidget *widget, gpointer data) -{ - gtk_widget_destroy(widget); -} - -static void -populate_option_table(GtkWidget *table, int p_class) -{ - int i, j; - int current_pos = 0; - GtkWidget *previous_sep = NULL; - int counts[STP_PARAMETER_LEVEL_INVALID][STP_PARAMETER_TYPE_INVALID]; - int vpos[STP_PARAMETER_LEVEL_INVALID][STP_PARAMETER_TYPE_INVALID]; - for (i = 0; i < STP_PARAMETER_LEVEL_INVALID; i++) - for (j = 0; j < STP_PARAMETER_TYPE_INVALID; j++) - { - vpos[i][j] = 0; - counts[i][j] = 0; - } - - - gtk_container_foreach(GTK_CONTAINER(table), destroy_something, NULL); - - /* First scan the options to figure out where to start */ - for (i = 0; i < current_option_count; i++) - { - const stp_parameter_t *desc = current_options[i].fast_desc; - /* - * Specialize the core parameters (page size is the only one we want) - * Yuck. - */ - if (!desc->read_only && desc->p_class == p_class && - (desc->p_class != STP_PARAMETER_CLASS_CORE || - strcmp(desc->name, "PageSize") == 0)) - { - switch (desc->p_type) - { - case STP_PARAMETER_TYPE_STRING_LIST: - case STP_PARAMETER_TYPE_DIMENSION: - case STP_PARAMETER_TYPE_DOUBLE: - case STP_PARAMETER_TYPE_CURVE: - case STP_PARAMETER_TYPE_BOOLEAN: - counts[desc->p_level][desc->p_type]++; - break; - default: - break; - } - } - } - - /* Now, figure out where we're going to put the options */ - for (i = 0; i <= MAXIMUM_PARAMETER_LEVEL + 1; i++) - { - int level_count = 0; - if (i <= MAXIMUM_PARAMETER_LEVEL) - for (j = 0; j < STP_PARAMETER_TYPE_INVALID; j++) - level_count += counts[i][j]; - if (level_count > 0 && current_pos > 0) - { - GtkWidget *sep = gtk_hseparator_new(); - gtk_table_attach (GTK_TABLE(table), sep, 0, 4, - current_pos, current_pos + 1, - GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); - if (previous_sep) - gtk_widget_show(previous_sep); - previous_sep = sep; - current_pos++; - } - if (i <= MAXIMUM_PARAMETER_LEVEL) - for (j = 0; j < STP_PARAMETER_TYPE_INVALID; j++) - { - vpos[i][j] = current_pos; - current_pos += counts[i][j]; - } - } - - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - const stp_curve_t *xcurve; - const stp_parameter_t *desc = opt->fast_desc; - if (!desc->read_only && desc->p_class == p_class && - (desc->p_class != STP_PARAMETER_CLASS_CORE || - strcmp(desc->name, "PageSize") == 0)) - { - gdouble unit_scaler; - gdouble minor_increment; - gint digits; - switch (desc->p_type) - { - case STP_PARAMETER_TYPE_STRING_LIST: - stpui_create_new_combo(opt, table, 0, - vpos[desc->p_level][desc->p_type]++, - !(desc->is_mandatory)); - if (desc->p_level > MAXIMUM_PARAMETER_LEVEL) - stp_set_string_parameter_active(pv->v, desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_DOUBLE: - stpui_create_scale_entry(opt, GTK_TABLE(table), 0, - vpos[desc->p_level][desc->p_type]++, - gettext(desc->text), 200, 0, - opt->info.flt.deflt, - opt->info.flt.lower, - opt->info.flt.upper, - .001, .01, 3, TRUE, 0, 0, NULL, - !(desc->is_mandatory)); - stpui_set_adjustment_tooltip(opt->info.flt.adjustment, - gettext(desc->help)); - gtk_signal_connect(GTK_OBJECT(opt->info.flt.adjustment), - "value_changed", - GTK_SIGNAL_FUNC(color_update), opt); - if (desc->p_level > MAXIMUM_PARAMETER_LEVEL) - stp_set_float_parameter_active(pv->v, desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_DIMENSION: - unit_scaler = units[pv->unit].scale; - if (unit_scaler > 100) - { - digits = 3; - minor_increment = .001; - } - else if (unit_scaler > 10) - { - digits = 2; - minor_increment = .01; - } - else if (unit_scaler > 1) - { - digits = 1; - minor_increment = .1; - } - else - { - digits = 0; - minor_increment = 1; - } - stpui_create_scale_entry(opt, GTK_TABLE(table), 0, - vpos[desc->p_level][desc->p_type]++, - gettext(desc->text), 200, 0, - opt->info.flt.deflt / unit_scaler, - opt->info.flt.lower / unit_scaler, - opt->info.flt.upper / unit_scaler, - minor_increment, minor_increment * 10, - digits, TRUE, 0, 0, NULL, - !(desc->is_mandatory)); - stpui_set_adjustment_tooltip(opt->info.flt.adjustment, - gettext(desc->help)); - gtk_signal_connect(GTK_OBJECT(opt->info.flt.adjustment), - "value_changed", - GTK_SIGNAL_FUNC(dimension_update), opt); - if (desc->p_level > MAXIMUM_PARAMETER_LEVEL) - stp_set_dimension_parameter_active(pv->v, desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_CURVE: - xcurve = stp_get_curve_parameter(pv->v, opt->fast_desc->name); - if (xcurve) - opt->info.curve.current = stp_curve_create_copy(xcurve); - else - opt->info.curve.current = NULL; - stpui_create_curve(opt, GTK_TABLE(table), 0, - vpos[desc->p_level][desc->p_type]++, - gettext(desc->text), opt->info.curve.deflt, - !(desc->is_mandatory)); - if (desc->p_level > MAXIMUM_PARAMETER_LEVEL) - stp_set_curve_parameter_active(pv->v, desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - opt->info.bool.current = - stp_get_boolean_parameter(pv->v, opt->fast_desc->name); - stpui_create_boolean(opt, GTK_TABLE(table), 0, - vpos[desc->p_level][desc->p_type]++, - gettext(desc->text), opt->info.bool.deflt, - !(desc->is_mandatory)); - if (desc->p_level > MAXIMUM_PARAMETER_LEVEL) - stp_set_boolean_parameter_active(pv->v, desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_INT: - stp_set_int_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_RAW: - stp_set_raw_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_FILE: - if (strcmp(opt->fast_desc->name, "PPDFile") != 0) - stp_set_file_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - default: - break; - } - if (opt->checkbox) - gtk_signal_connect - (GTK_OBJECT(opt->checkbox), "toggled", - GTK_SIGNAL_FUNC(set_controls_active), opt); - } - } -} - -static void -set_options_active(const char *omit) -{ - int i; - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - const stp_parameter_t *desc = opt->fast_desc; - GtkObject *adj; - if (omit && strcmp(omit, opt->fast_desc->name) == 0) - continue; - switch (desc->p_type) - { - case STP_PARAMETER_TYPE_STRING_LIST: - build_a_combo(opt); - break; - case STP_PARAMETER_TYPE_DOUBLE: - case STP_PARAMETER_TYPE_DIMENSION: - adj = opt->info.flt.adjustment; - if (adj) - { - if (opt->is_active && desc->p_level <= MAXIMUM_PARAMETER_LEVEL) - { - gtk_widget_show(GTK_WIDGET(SCALE_ENTRY_LABEL(adj))); - gtk_widget_show(GTK_WIDGET(SCALE_ENTRY_SCALE(adj))); - gtk_widget_show(GTK_WIDGET(SCALE_ENTRY_SPINBUTTON(adj))); - } - else - { - gtk_widget_hide(GTK_WIDGET(SCALE_ENTRY_LABEL(adj))); - gtk_widget_hide(GTK_WIDGET(SCALE_ENTRY_SCALE(adj))); - gtk_widget_hide(GTK_WIDGET(SCALE_ENTRY_SPINBUTTON(adj))); - } - } - break; - case STP_PARAMETER_TYPE_CURVE: - if (opt->is_active && desc->p_level <= MAXIMUM_PARAMETER_LEVEL) - { - gtk_widget_show(GTK_WIDGET(opt->info.curve.label)); - gtk_widget_show(GTK_WIDGET(opt->info.curve.button)); - } - else - { - gtk_widget_hide(GTK_WIDGET(opt->info.curve.label)); - gtk_widget_hide(GTK_WIDGET(opt->info.curve.button)); - gtk_widget_hide(GTK_WIDGET(opt->info.curve.dialog)); - } - case STP_PARAMETER_TYPE_BOOLEAN: - if (opt->is_active && desc->p_level <= MAXIMUM_PARAMETER_LEVEL) - { - gtk_widget_show(GTK_WIDGET(opt->info.bool.checkbox)); - } - else - { - gtk_widget_hide(GTK_WIDGET(opt->info.bool.checkbox)); - } - break; - default: - break; - } - if (opt->checkbox) - { - if (!(opt->is_active) || desc->p_level > MAXIMUM_PARAMETER_LEVEL) - gtk_widget_hide(GTK_WIDGET(opt->checkbox)); - else if (!(desc->is_mandatory)) - gtk_widget_show(GTK_WIDGET(opt->checkbox)); - } - } -} - -static void -color_button_callback(GtkWidget *widget, gpointer data) -{ - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); -} - -static void -create_top_level_structure(void) -{ - gchar *plug_in_name; - /* - * Create the main dialog - */ - - plug_in_name = g_strdup_printf (_("%s -- Print v%s"), - stpui_get_image_filename(), - VERSION " - " RELEASE_DATE); - - print_dialog = - stpui_dialog_new (plug_in_name, "print", - GTK_WIN_POS_MOUSE, - FALSE, TRUE, FALSE, - - _("About"), about_callback, - NULL, NULL, NULL, FALSE, FALSE, - _("Print and\nSave Settings"), printandsave_callback, - NULL, NULL, NULL, FALSE, FALSE, - _("Save\nSettings"), save_callback, - NULL, NULL, NULL, FALSE, FALSE, - _("Print"), print_callback, - NULL, NULL, NULL, FALSE, FALSE, - _("Cancel"), gtk_widget_destroy, - NULL, 1, NULL, FALSE, TRUE, - - NULL); - - g_free (plug_in_name); - - gtk_signal_connect (GTK_OBJECT (print_dialog), "destroy", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - /* - * Top-level containers - */ - - main_vbox = gtk_vbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (print_dialog)->vbox), main_vbox, - TRUE, TRUE, 0); - gtk_widget_show (main_vbox); - - main_hbox = gtk_hbox_new (FALSE, 4); - gtk_box_pack_start (GTK_BOX (main_vbox), main_hbox, TRUE, TRUE, 0); - gtk_widget_show (main_hbox); - - right_vbox = gtk_vbox_new (FALSE, 2); - gtk_box_pack_end (GTK_BOX (main_hbox), right_vbox, FALSE, FALSE, 0); - gtk_widget_show (right_vbox); - - notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX (right_vbox), notebook, TRUE, TRUE, 0); - gtk_widget_show (notebook); -} - -static gint -drawing_area_resize_callback(GtkWidget *widget, GdkEventConfigure *event) -{ - preview_size_vert = event->height - 1; - preview_size_horiz = event->width - 1; - invalidate_preview_thumbnail(); - invalidate_frame(); - preview_update(); - return 1; -} - -static void -create_preview (void) -{ - GtkWidget *frame; - GtkWidget *event_box; - - frame = gtk_frame_new (_("Preview")); - gtk_box_pack_start (GTK_BOX (main_hbox), frame, TRUE, TRUE, 0); - gtk_widget_show (frame); - - preview = (GtkDrawingArea *) gtk_drawing_area_new (); - gtk_drawing_area_size(preview, preview_size_horiz + 1, preview_size_vert +1); - gtk_signal_connect(GTK_OBJECT(preview), "configure_event", - GTK_SIGNAL_FUNC(drawing_area_resize_callback), NULL); - event_box = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (event_box), GTK_WIDGET (preview)); - gtk_container_add (GTK_CONTAINER (frame), event_box); - gtk_widget_show (event_box); - - gtk_signal_connect (GTK_OBJECT (preview), "expose_event", - GTK_SIGNAL_FUNC (preview_expose), NULL); - gtk_signal_connect (GTK_OBJECT (preview), "button_press_event", - GTK_SIGNAL_FUNC (preview_button_callback), NULL); - gtk_signal_connect (GTK_OBJECT (preview), "button_release_event", - GTK_SIGNAL_FUNC (preview_button_callback), NULL); - gtk_signal_connect (GTK_OBJECT (preview), "motion_notify_event", - GTK_SIGNAL_FUNC (preview_motion_callback), NULL); - gtk_widget_show (GTK_WIDGET (preview)); - - stpui_set_help_data - (event_box, - _("Position the image on the page.\n" - "Click and drag with the primary button to position the image.\n" - "Click and drag with the second button to move the image with finer precision; " - "each unit of motion moves the image one point (1/72\")\n" - "Click and drag with the third (middle) button to move the image in units of " - "the image size.\n" - "Holding down the shift key while clicking and dragging constrains the image to " - "only horizontal or vertical motion.\n" - "If you click another button while dragging the mouse, the image will return " - "to its original position.")); - - gtk_widget_set_events (GTK_WIDGET (preview), - GDK_EXPOSURE_MASK | GDK_BUTTON_MOTION_MASK | - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); -} - -static GtkWidget * -create_positioning_entry(GtkWidget *table, int hpos, int vpos, - const char *text, const char *help) -{ - return stpui_create_entry - (table, hpos, vpos, text, help, GTK_SIGNAL_FUNC(position_callback)); -} - -static GtkWidget * -create_positioning_button(GtkWidget *box, int invalid, - const char *text, const char *help) -{ - GtkWidget *button = gtk_button_new_with_label(gettext(text)); - gtk_box_pack_start(GTK_BOX(box), button, FALSE, TRUE, 0); - gtk_widget_show(button); - stpui_set_help_data(button, help); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(position_button_callback), - (gpointer) invalid); - return button; -} - -static void -create_paper_size_frame(void) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *media_size_table; - GtkWidget *table; - int vpos = 0; - - frame = gtk_frame_new (_("Paper Size")); - gtk_box_pack_start (GTK_BOX (right_vbox), frame, FALSE, TRUE, 0); - gtk_widget_show (frame); - - vbox = gtk_vbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); - gtk_container_add (GTK_CONTAINER (frame), vbox); - gtk_widget_show (vbox); - - table = gtk_table_new (1, 1, FALSE); - gtk_container_add (GTK_CONTAINER (vbox), table); - gtk_widget_show (table); - - /* - * Media size combo box. - */ - - page_size_table = gtk_table_new(1, 1, FALSE); - gtk_widget_show (page_size_table); - gtk_table_attach_defaults(GTK_TABLE(table), page_size_table, - 0, 2, vpos, vpos + 1); - vpos++; - show_all_paper_sizes_button = - gtk_check_button_new_with_label(_("Show All Paper Sizes")); - gtk_table_attach_defaults - (GTK_TABLE(table), show_all_paper_sizes_button, 0, 2, vpos, vpos + 1); - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(show_all_paper_sizes_button), - stpui_show_all_paper_sizes); - gtk_signal_connect(GTK_OBJECT(show_all_paper_sizes_button), "toggled", - GTK_SIGNAL_FUNC(show_all_paper_sizes_callback), NULL); - gtk_widget_show(show_all_paper_sizes_button); - vpos++; - - /* - * Custom media size entries - */ - - media_size_table = gtk_table_new (1, 1, FALSE); - stpui_table_attach_aligned(GTK_TABLE (table), 0, vpos++, _("Dimensions:"), - 0.0, 0.5, media_size_table, 1, TRUE); - gtk_table_set_col_spacings (GTK_TABLE (media_size_table), 4); - - custom_size_width = stpui_create_entry - (media_size_table, 0, 3, _("Width:"), - _("Width of the paper that you wish to print to"), - custom_media_size_callback); - - custom_size_height = stpui_create_entry - (media_size_table, 2, 3, _("Height:"), - _("Height of the paper that you wish to print to"), - custom_media_size_callback); - - vpos++; - auto_paper_size_button = - gtk_check_button_new_with_label(_("Automatic Paper Size")); - gtk_table_attach_defaults - (GTK_TABLE(table), auto_paper_size_button, 0, 2, vpos, vpos + 1); - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(auto_paper_size_button), FALSE); - gtk_signal_connect(GTK_OBJECT(auto_paper_size_button), "toggled", - GTK_SIGNAL_FUNC(auto_paper_size_callback), NULL); -} - -static void -create_copy_number_frame(void) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *event_box; - GtkAdjustment *adj; - - frame = gtk_frame_new (_("Number of Copies")); - gtk_box_pack_start (GTK_BOX (right_vbox), frame, FALSE, TRUE, 0); - gtk_widget_show (frame); - - vbox = gtk_hbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); - gtk_container_add (GTK_CONTAINER (frame), vbox); - gtk_widget_show (vbox); - - event_box = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (vbox), event_box); - stpui_set_help_data(event_box, - _("Select the number of copies to print; " - "a value between 1 and 100")); - gtk_widget_show (event_box); - - /* - * Number of Copies Spin Button - */ - - adj = (GtkAdjustment *) gtk_adjustment_new (1.0f, 1.0f, 100.0f, - 1.0f, 5.0f, 0.0f); - copy_count_spin_button = gtk_spin_button_new (adj, 0, 0); - gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (copy_count_spin_button), FALSE); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (copy_count_spin_button), TRUE); - gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (copy_count_spin_button), - GTK_UPDATE_IF_VALID); - - gtk_signal_connect(GTK_OBJECT (adj), "value_changed", - GTK_SIGNAL_FUNC (copy_count_callback), - NULL); - - gtk_container_add (GTK_CONTAINER (event_box), copy_count_spin_button); - gtk_widget_show(copy_count_spin_button); -} - -static void -create_positioning_frame (void) -{ - GtkWidget *frame; - GtkWidget *table; - GtkWidget *box; - GtkWidget *sep; - - frame = gtk_frame_new (_("Image Position")); - gtk_box_pack_start (GTK_BOX (right_vbox), frame, FALSE, TRUE, 0); - gtk_widget_show (frame); - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 2); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_container_set_border_width (GTK_CONTAINER (table), 4); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - /* - * Orientation option menu. - */ - - orientation_menu = - stpui_option_menu_new (FALSE, - _("Auto"), orientation_callback, - (gpointer) ORIENT_AUTO, NULL, NULL, 0, - _("Portrait"), orientation_callback, - (gpointer) ORIENT_PORTRAIT, NULL, NULL, 0, - _("Landscape"), orientation_callback, - (gpointer) ORIENT_LANDSCAPE, NULL, NULL, 0, - _("Upside down"), orientation_callback, - (gpointer) ORIENT_UPSIDEDOWN, NULL, NULL, 0, - _("Seascape"), orientation_callback, - (gpointer) ORIENT_SEASCAPE, NULL, NULL, 0, - NULL); - stpui_set_help_data (orientation_menu, - _("Select the orientation: portrait, landscape, " - "upside down, or seascape (upside down landscape)")); - stpui_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Orientation:"), - 1.0, 0.5, orientation_menu, 4, TRUE); - sep = gtk_hseparator_new (); - gtk_table_attach_defaults (GTK_TABLE (table), sep, 0, 6, 1, 2); - gtk_widget_show (sep); - - /* - * Position entries - */ - - left_entry = create_positioning_entry - (table, 0, 2, _("Left:"), - _("Distance from the left of the paper to the image")); -#if 0 - right_entry = create_positioning_entry - (table, 0, 3, _("Right:"), - _("Distance from the left of the paper to the right of the image")); -#endif - right_border_entry = create_positioning_entry - (table, 0, 4, _("Right:"), - _("Distance from the right of the paper to the image")); - top_entry = create_positioning_entry - (table, 3, 2, _("Top:"), - _("Distance from the top of the paper to the image")); -#if 0 - bottom_entry = create_positioning_entry - (table, 3, 3, _("Bottom:"), - _("Distance from the top of the paper to bottom of the image")); -#endif - bottom_border_entry = create_positioning_entry - (table, 3, 4, _("Bottom:"), - _("Distance from the bottom of the paper to the image")); - /* - * Center options - */ - - sep = gtk_hseparator_new (); - gtk_table_attach_defaults (GTK_TABLE (table), sep, 0, 6, 5, 6); - gtk_widget_show (sep); - - box = gtk_hbox_new (TRUE, 4); - stpui_table_attach_aligned (GTK_TABLE (table), 0, 7, _("Center:"), 0.5, 0.5, - box, 5, TRUE); - recenter_horizontal_button = create_positioning_button - (box, INVALID_LEFT, _("Horizontal"), - _("Center the image horizontally on the paper")); - recenter_button = create_positioning_button - (box, INVALID_LEFT | INVALID_TOP, _("Both"), - _("Center the image on the paper")); - recenter_vertical_button = create_positioning_button - (box, INVALID_TOP, _("Vertical"), - _("Center the image vertically on the paper")); -} - -static void -create_printer_dialog (void) -{ - GtkWidget *table; - GtkWidget *label; - GtkWidget *event_box; - GSList *group; - gint i; - stp_string_list_t *manufacturer_list = stp_string_list_create(); - - setup_dialog = stpui_dialog_new(_("Setup Printer"), "print", - GTK_WIN_POS_MOUSE, FALSE, TRUE, FALSE, - _("OK"), setup_ok_callback, - NULL, NULL, NULL, TRUE, FALSE, - _("Cancel"), setup_cancel_callback, - NULL, 1, NULL, FALSE, TRUE, - - NULL); - - /* - * Top-level table for dialog. - */ - - table = gtk_table_new (4, 4, FALSE); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_table_set_row_spacing (GTK_TABLE (table), 0, 150); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (setup_dialog)->vbox), table, - TRUE, TRUE, 0); - gtk_widget_show (table); - - /* - * Printer driver option menu. - */ - - label = gtk_label_new (_("Printer Make:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 2, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - - event_box = gtk_event_box_new (); - gtk_table_attach (GTK_TABLE (table), event_box, 2, 4, 0, 2, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); - gtk_widget_show (event_box); - - stpui_set_help_data (event_box, _("Select the make of your printer")); - - manufacturer_crawler = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (manufacturer_crawler), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (event_box), manufacturer_crawler); - gtk_widget_show (manufacturer_crawler); - - manufacturer_clist = gtk_clist_new (1); - gtk_widget_set_usize (manufacturer_clist, 200, 0); - gtk_clist_set_selection_mode(GTK_CLIST(manufacturer_clist),GTK_SELECTION_SINGLE); - gtk_container_add (GTK_CONTAINER (manufacturer_crawler), manufacturer_clist); - gtk_widget_show (manufacturer_clist); - - gtk_signal_connect (GTK_OBJECT (manufacturer_clist), "select_row", - GTK_SIGNAL_FUNC (manufacturer_callback), NULL); - - - label = gtk_label_new (_("Printer Model:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 4, 5, 0, 2, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - - event_box = gtk_event_box_new (); - gtk_table_attach (GTK_TABLE (table), event_box, 5, 7, 0, 2, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); - gtk_widget_show (event_box); - - stpui_set_help_data (event_box, _("Select your printer model")); - - printer_crawler = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (printer_crawler), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (event_box), printer_crawler); - gtk_widget_show (printer_crawler); - - printer_driver = gtk_clist_new (1); - gtk_widget_set_usize (printer_driver, 200, 0); - gtk_clist_set_selection_mode(GTK_CLIST(printer_driver),GTK_SELECTION_SINGLE); - gtk_container_add (GTK_CONTAINER (printer_crawler), printer_driver); - gtk_widget_show (printer_driver); - - gtk_signal_connect (GTK_OBJECT (printer_driver), "select_row", - GTK_SIGNAL_FUNC (print_driver_callback), NULL); - - - for (i = 0; i < stp_printer_model_count (); i ++) - { - const stp_printer_t *the_printer = stp_get_printer_by_index (i); - - if (strcmp(stp_printer_get_long_name (the_printer), "") != 0 && - strcmp(stp_printer_get_family(the_printer), "raw") != 0) - { - const gchar *make = stp_printer_get_manufacturer(the_printer); - if (! stp_string_list_is_present(manufacturer_list, make)) - stp_string_list_add_string(manufacturer_list, make, make); - } - } - - for (i = 0; i < stp_string_list_count(manufacturer_list); i++) - { - const stp_param_string_t *param = - stp_string_list_param(manufacturer_list, i); - gchar *xname = g_strdup(param->name); - gtk_clist_insert(GTK_CLIST(manufacturer_clist), i, &xname); - gtk_clist_set_row_data_full(GTK_CLIST(manufacturer_clist), i, xname, - g_free); - } - stp_string_list_destroy(manufacturer_list); - gtk_clist_sort(GTK_CLIST(manufacturer_clist)); - build_printer_driver_clist(); - - /* - * PPD file. - */ - - ppd_label = gtk_label_new (_("PPD File:")); - gtk_misc_set_alignment (GTK_MISC (ppd_label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), ppd_label, 1, 2, 3, 4, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (ppd_label); - - ppd_box = gtk_hbox_new (FALSE, 8); - gtk_table_attach (GTK_TABLE (table), ppd_box, 2, 7, 3, 4, - GTK_FILL, GTK_FILL, 0, 0); - - ppd_file = gtk_entry_new (); - gtk_signal_connect(GTK_OBJECT(ppd_file), "activate", - GTK_SIGNAL_FUNC(ppd_file_callback), NULL); - gtk_box_pack_start (GTK_BOX (ppd_box), ppd_file, TRUE, TRUE, 0); - gtk_widget_show (ppd_file); - - stpui_set_help_data(ppd_file,_("Enter the correct PPD filename for your printer")); - - ppd_button = gtk_button_new_with_label (_("Browse")); - gtk_misc_set_padding (GTK_MISC (GTK_BIN (ppd_button)->child), 2, 0); - gtk_box_pack_start (GTK_BOX (ppd_box), ppd_button, FALSE, FALSE, 0); - gtk_widget_show (ppd_button); - gtk_widget_show (ppd_box); - - stpui_set_help_data(ppd_button, - _("Choose the correct PPD filename for your printer")); - gtk_signal_connect (GTK_OBJECT (ppd_button), "clicked", - GTK_SIGNAL_FUNC (ppd_browse_callback), NULL); - - ppd_model_label = gtk_label_new (_("Printer Model:")); - gtk_misc_set_alignment (GTK_MISC (ppd_model_label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), ppd_model_label, 1, 2, 4, 5, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (ppd_model_label); - - ppd_model = gtk_label_new (""); - gtk_misc_set_alignment (GTK_MISC (ppd_model), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (table), ppd_model, 2, 7, 4, 5, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (ppd_model); - - - /* - * Print command. - */ - - group = NULL; - for (i = 0; i < command_options_count; i++) - group = stpui_create_radio_button(&(command_options[i]), group, table, - 0, i > 0 ? i + 6 : i + 5, - command_type_callback); - - standard_cmd_entry = gtk_entry_new(); - gtk_table_attach (GTK_TABLE (table), standard_cmd_entry, 2, 7, 6, 7, - GTK_FILL, GTK_FILL, 0, 0); - gtk_entry_set_editable(GTK_ENTRY(standard_cmd_entry), FALSE); - gtk_widget_set_sensitive(standard_cmd_entry, FALSE); - gtk_widget_show (standard_cmd_entry); - - queue_combo = gtk_combo_new (); - event_box = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (event_box), queue_combo); - gtk_widget_show (queue_combo); - gtk_widget_show (event_box); - build_queue_combo(); - - stpui_set_help_data(event_box, - _("Select the name of the output queue (not the type, " - "or model, of printer) that you wish to print to")); - label = gtk_label_new(_("Printer Queue:")); - gtk_widget_show(label); - gtk_table_attach (GTK_TABLE (table), label, 2, 3, 5, 6, - GTK_FILL, GTK_FILL, 0, 0); - gtk_table_attach (GTK_TABLE (table), event_box, 3, 7, 5, 6, - GTK_FILL, GTK_FILL, 0, 0); - - custom_command_entry = gtk_entry_new (); - gtk_table_attach (GTK_TABLE (table), custom_command_entry, 2, 7, 7, 8, - GTK_FILL, GTK_FILL, 0, 0); - gtk_signal_connect(GTK_OBJECT(custom_command_entry), "activate", - GTK_SIGNAL_FUNC(setup_callback), NULL); - gtk_widget_set_sensitive(custom_command_entry, FALSE); - gtk_widget_show (custom_command_entry); - - stpui_set_help_data - (custom_command_entry, _("Enter the correct command to print to your printer. ")); - - file_entry = gtk_entry_new (); - gtk_table_attach (GTK_TABLE (table), file_entry, 2, 6, 8, 9, - GTK_FILL, GTK_FILL, 0, 0); - gtk_signal_connect(GTK_OBJECT(file_entry), "activate", - GTK_SIGNAL_FUNC(setup_callback), NULL); - gtk_widget_show (file_entry); - - gtk_widget_set_sensitive(file_entry, FALSE); - stpui_set_help_data - (file_entry, _("Enter the file to print to. ")); - - file_button = gtk_button_new_with_label (_("Browse")); - - gtk_table_attach (GTK_TABLE (table), file_button, 6, 7, 8, 9, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (file_button); - - stpui_set_help_data(file_button, _("File to print to")); - gtk_signal_connect (GTK_OBJECT (file_button), "clicked", - GTK_SIGNAL_FUNC (file_browse_callback), NULL); - - /* - * Output file selection dialog. - */ - - file_browser = gtk_file_selection_new (_("Print To File")); - - gtk_signal_connect - (GTK_OBJECT (GTK_FILE_SELECTION (file_browser)->ok_button), "clicked", - GTK_SIGNAL_FUNC (file_ok_callback), NULL); - gtk_signal_connect - (GTK_OBJECT (GTK_FILE_SELECTION (file_browser)->cancel_button), "clicked", - GTK_SIGNAL_FUNC (file_cancel_callback), NULL); - - /* - * PPD file selection dialog. - */ - - ppd_browser = gtk_file_selection_new (_("PPD File")); - gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (ppd_browser)); - - gtk_signal_connect - (GTK_OBJECT (GTK_FILE_SELECTION (ppd_browser)->ok_button), "clicked", - GTK_SIGNAL_FUNC (ppd_ok_callback), NULL); - gtk_signal_connect_object - (GTK_OBJECT (GTK_FILE_SELECTION (ppd_browser)->cancel_button), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_hide), GTK_OBJECT (ppd_browser)); -} - -static void -create_new_printer_dialog (void) -{ - GtkWidget *table; - - new_printer_dialog = - stpui_dialog_new (_("Define New Printer"), "print", - GTK_WIN_POS_MOUSE, FALSE, FALSE, FALSE, - _("OK"), new_printer_ok_callback, - NULL, NULL, NULL, TRUE, FALSE, - _("Cancel"), gtk_widget_hide, - NULL, 1, NULL, FALSE, TRUE, - NULL); - - table = gtk_table_new (1, 1, FALSE); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_table_set_row_spacings (GTK_TABLE (table), 8); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (new_printer_dialog)->vbox), table, - FALSE, FALSE, 0); - gtk_widget_show (table); - - new_printer_entry = gtk_entry_new (); - gtk_entry_set_max_length (GTK_ENTRY (new_printer_entry), 127); - stpui_table_attach_aligned(GTK_TABLE (table), 0, 0, _("Printer Name:"), 1.0, - 0.5, new_printer_entry, 1, TRUE); - - stpui_set_help_data(new_printer_entry, - _("Enter the name you wish to give this logical printer")); - gtk_signal_connect (GTK_OBJECT (new_printer_entry), "activate", - GTK_SIGNAL_FUNC (new_printer_ok_callback), NULL); -} - -static void -create_about_dialog (void) -{ - GtkWidget *label; - about_dialog = - stpui_dialog_new (_("About Gutenprint " PLUG_IN_VERSION), "print", - GTK_WIN_POS_MOUSE, FALSE, FALSE, FALSE, - _("OK"), gtk_widget_hide, - NULL, 1, NULL, TRUE, TRUE, - NULL); - - label = gtk_label_new - (_("Gutenprint Version " PLUG_IN_VERSION "\n" - "\n" - "Copyright (C) 1997-2003 Michael Sweet, Robert Krawitz,\n" - "and the rest of the Gutenprint Development Team.\n" - "\n" - "Please visit our web site at http://gimp-print.sourceforge.net.\n" - "\n" - "This program is free software; you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation; either version 2 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with this program; if not, write to the Free Software\n" - "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 " - "USA\n")); - - gtk_misc_set_padding (GTK_MISC (label), 12, 4); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_dialog)->vbox), label, - FALSE, FALSE, 0); - gtk_widget_show (label); -} - -static void -create_printer_settings_frame (void) -{ - GtkWidget *table; - GtkWidget *sep; - GtkWidget *printer_hbox; - GtkWidget *button; - GtkWidget *event_box; - GtkWidget *scrolled_window; - gint vpos = 0; - - create_printer_dialog (); - create_about_dialog (); - create_new_printer_dialog (); - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 2); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_container_set_border_width (GTK_CONTAINER (table), 4); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table, - gtk_label_new (_("Printer Settings"))); - gtk_widget_show (table); - - /* - * Printer option menu. - */ - - printer_combo = gtk_combo_new (); - event_box = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (event_box), printer_combo); - gtk_widget_show (printer_combo); - - stpui_set_help_data(event_box, - _("Select the name of the printer (not the type, " - "or model, of printer) that you wish to print to")); - stpui_table_attach_aligned(GTK_TABLE (table), 0, vpos++, _("Printer Name:"), - 0.0, 0.5, event_box, 1, TRUE); - printer_model_label = gtk_label_new (""); - stpui_table_attach_aligned(GTK_TABLE (table), 0, vpos++, _("Printer Model:"), - 0.0, 0.0, printer_model_label, 1, TRUE); - printer_hbox = gtk_hbox_new (TRUE, 4); - gtk_table_attach (GTK_TABLE (table), printer_hbox, - 1, 4, vpos, vpos + 1, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); - vpos += 2; - gtk_widget_show (printer_hbox); - - /* - * Setup printer button - */ - - button = gtk_button_new_with_label (_("Setup Printer...")); - stpui_set_help_data(button, - _("Choose the printer model, PPD file, and command " - "that is used to print to this printer")); - gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0); - gtk_box_pack_start (GTK_BOX (printer_hbox), button, FALSE, TRUE, 0); - gtk_widget_show (button); - - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (setup_open_callback), NULL); - - /* - * New printer button - */ - - button = gtk_button_new_with_label (_("New Printer...")); - stpui_set_help_data (button, _("Define a new logical printer. This can be used to " - "name a collection of settings that you wish to " - "remember for future use.")); - gtk_box_pack_start (GTK_BOX (printer_hbox), button, FALSE, TRUE, 0); - gtk_widget_show (button); - - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (new_printer_open_callback), NULL); - - sep = gtk_hseparator_new (); - gtk_table_attach (GTK_TABLE (table), sep, 0, 5, vpos, vpos + 1, - GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (sep); - vpos++; - - printer_features_table = gtk_table_new(1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (printer_features_table), 2); - gtk_table_set_row_spacings (GTK_TABLE (printer_features_table), 0); - gtk_widget_show (printer_features_table); - - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), - printer_features_table); - gtk_table_attach_defaults(GTK_TABLE(table), scrolled_window, - 0, 6, vpos, vpos + 1); - gtk_widget_show(scrolled_window); - vpos++; - - button = gtk_button_new_with_label (_("Set Printer Option Defaults")); - stpui_set_help_data (button, _("Set all printer options to their defaults")); - gtk_table_attach(GTK_TABLE(table), button, 0, 6, vpos, vpos + 1, - GTK_EXPAND|GTK_FILL, GTK_SHRINK|GTK_FILL, 0, 0); - gtk_widget_show (button); - - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (set_printer_defaults), NULL); - -} - -static void -create_scaling_frame (void) -{ - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *table; - GtkWidget *box; - GtkWidget *label; - GtkWidget *event_box; - GtkWidget *sep; - GSList *group; - - frame = gtk_frame_new (_("Image Size")); - gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); - gtk_widget_show (frame); - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); - gtk_container_add (GTK_CONTAINER (frame), hbox); - gtk_widget_show (hbox); - - vbox = gtk_vbox_new (FALSE, 2); -/* gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); */ - gtk_container_add (GTK_CONTAINER (hbox), vbox); - gtk_widget_show (vbox); - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - /* - * Create the scaling adjustment using percent. It doesn't really matter, - * since as soon as we call plist_callback at the end of initialization - * everything will be put right. - */ - scaling_adjustment = - stpui_scale_entry_new (GTK_TABLE (table), 0, 0, _("Scaling:"), 100, 75, - 100.0, minimum_image_percent, 100.0, - 1.0, 10.0, 1, TRUE, 0, 0, NULL); - stpui_set_adjustment_tooltip(scaling_adjustment, - _("Set the scale (size) of the image")); - gtk_signal_connect (GTK_OBJECT (scaling_adjustment), "value_changed", - GTK_SIGNAL_FUNC (scaling_update), NULL); - - box = gtk_hbox_new (FALSE, 4); - gtk_box_pack_start (GTK_BOX (vbox), box, TRUE, TRUE, 0); - gtk_widget_show (box); - - /* - * The scale by percent/ppi toggles - */ - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_box_pack_start (GTK_BOX (box), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - event_box = gtk_event_box_new (); - gtk_table_attach (GTK_TABLE (table), event_box, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (event_box); - - label = gtk_label_new (_("Scale by:")); - gtk_container_add (GTK_CONTAINER (event_box), label); - gtk_widget_show (label); - - stpui_set_help_data(event_box, - _("Select whether scaling is measured as percent of " - "available page size or number of output dots per inch")); - - scaling_percent = gtk_radio_button_new_with_label (NULL, _("Percent")); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (scaling_percent)); - stpui_table_attach_aligned(GTK_TABLE (table), 0, 0, NULL, 0.5, 0.5, - scaling_percent, 2, TRUE); - - stpui_set_help_data(scaling_percent, _("Scale the print to the size of the page")); - gtk_signal_connect (GTK_OBJECT (scaling_percent), "toggled", - GTK_SIGNAL_FUNC (scaling_callback), NULL); - - scaling_ppi = gtk_radio_button_new_with_label (group, _("PPI")); - stpui_table_attach_aligned(GTK_TABLE (table), 2, 0, NULL, 0.5, 0.5, - scaling_ppi, 1, TRUE); - - stpui_set_help_data(scaling_ppi, - _("Scale the print to the number of dots per inch")); - gtk_signal_connect (GTK_OBJECT (scaling_ppi), "toggled", - GTK_SIGNAL_FUNC (scaling_callback), NULL); - - sep = gtk_vseparator_new (); - gtk_box_pack_start (GTK_BOX (hbox), sep, FALSE, FALSE, 8); - gtk_widget_show (sep); - - /* - * The width/height enries - */ - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - width_entry = create_positioning_entry - (table, 0, 0, _("Width:"), _("Set the width of the print")); - height_entry = create_positioning_entry - (table, 0, 1, _("Height:"), _("Set the height of the print")); - - /* - * The "image size" button - */ - - scaling_image = gtk_button_new_with_label (_("Use Original\nImage Size")); - gtk_misc_set_padding (GTK_MISC (GTK_BIN (scaling_image)->child), 2, 2); - gtk_box_pack_end (GTK_BOX (hbox), scaling_image, FALSE, FALSE, 0); - gtk_widget_show (scaling_image); - - stpui_set_help_data(scaling_image, - _("Set the print size to the size of the image")); - gtk_signal_connect (GTK_OBJECT (scaling_image), "clicked", - GTK_SIGNAL_FUNC (scaling_callback), NULL); -} - -/* - * create_color_adjust_window (void) - * - * NOTES: - * creates the color adjuster popup, allowing the user to adjust brightness, - * contrast, saturation, etc. - */ -static void -create_color_adjust_window (void) -{ - GtkWidget *table; - GtkWidget *label; - GtkWidget *event_box; - GtkWidget *scrolled_window; - - initialize_thumbnail(); - - color_adjust_dialog = - stpui_dialog_new(_("Print Color Adjust"), "print", - GTK_WIN_POS_MOUSE, FALSE, TRUE, FALSE, - - _("Set Defaults"), set_color_defaults, - NULL, NULL, NULL, FALSE, FALSE, - _("Close"), gtk_widget_hide, - NULL, 1, NULL, TRUE, TRUE, - NULL); - - table = gtk_table_new (1, 1, FALSE); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_table_set_row_spacings (GTK_TABLE (table), 0); -/* gtk_table_set_row_spacing (GTK_TABLE (table), 8, 6); */ - - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (color_adjust_dialog)->vbox), - table, TRUE, TRUE, 0); - gtk_widget_show (table); - - /* - * Drawing area for color swatch feedback display... - */ - - event_box = gtk_event_box_new (); - gtk_widget_show (GTK_WIDGET (event_box)); - gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (event_box), - 0, 1, 0, 1, 0, 0, 0, 0); - - swatch = (GtkDrawingArea *) gtk_drawing_area_new (); - gtk_widget_set_events (GTK_WIDGET (swatch), GDK_EXPOSURE_MASK); - gtk_drawing_area_size (swatch, thumbnail_w, thumbnail_h); - gtk_container_add (GTK_CONTAINER (event_box), GTK_WIDGET (swatch)); - gtk_widget_show (GTK_WIDGET (swatch)); - - stpui_set_help_data (GTK_WIDGET (event_box), _("Image preview")); - gtk_signal_connect (GTK_OBJECT (swatch), "expose_event", - GTK_SIGNAL_FUNC (redraw_color_swatch), - NULL); - - event_box = gtk_event_box_new (); - gtk_widget_show (GTK_WIDGET (event_box)); - gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (event_box), - 1, 2, 0, 1, 0, 0, 0, 0); - - output_color_vbox = gtk_vbox_new(TRUE, 0); - gtk_container_add(GTK_CONTAINER(event_box), output_color_vbox); - gtk_widget_show(GTK_WIDGET(output_color_vbox)); - - label = gtk_label_new(_("View Output Channels:")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), label, TRUE, TRUE, 0); - gtk_widget_show(GTK_WIDGET(label)); - - cyan_button = gtk_toggle_button_new_with_label(_("Cyan")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), cyan_button, TRUE, TRUE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cyan_button), TRUE); - gtk_widget_show(GTK_WIDGET(cyan_button)); - gtk_signal_connect (GTK_OBJECT (cyan_button), "toggled", - GTK_SIGNAL_FUNC (color_button_callback), NULL); - - magenta_button = gtk_toggle_button_new_with_label(_("Magenta")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), magenta_button, TRUE, TRUE,0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(magenta_button), TRUE); - gtk_widget_show(GTK_WIDGET(magenta_button)); - gtk_signal_connect (GTK_OBJECT (magenta_button), "toggled", - GTK_SIGNAL_FUNC (color_button_callback), NULL); - - yellow_button = gtk_toggle_button_new_with_label(_("Yellow")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), yellow_button, TRUE, TRUE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(yellow_button), TRUE); - gtk_widget_show(GTK_WIDGET(yellow_button)); - gtk_signal_connect (GTK_OBJECT (yellow_button), "toggled", - GTK_SIGNAL_FUNC (color_button_callback), NULL); - - black_button = gtk_toggle_button_new_with_label(_("Black")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), black_button, TRUE, TRUE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(black_button), TRUE); - gtk_widget_show(GTK_WIDGET(black_button)); - gtk_signal_connect (GTK_OBJECT (black_button), "toggled", - GTK_SIGNAL_FUNC (color_button_callback), NULL); - - red_button = gtk_toggle_button_new_with_label(_("Red")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), red_button, TRUE, TRUE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(red_button), TRUE); - gtk_widget_show(GTK_WIDGET(red_button)); - gtk_signal_connect (GTK_OBJECT (red_button), "toggled", - GTK_SIGNAL_FUNC (color_button_callback), NULL); - - green_button = gtk_toggle_button_new_with_label(_("Green")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), green_button, TRUE, TRUE,0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(green_button), TRUE); - gtk_widget_show(GTK_WIDGET(green_button)); - gtk_signal_connect (GTK_OBJECT (green_button), "toggled", - GTK_SIGNAL_FUNC (color_button_callback), NULL); - - blue_button = gtk_toggle_button_new_with_label(_("Blue")); - gtk_box_pack_start(GTK_BOX(output_color_vbox), blue_button, TRUE, TRUE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(blue_button), TRUE); - gtk_widget_show(GTK_WIDGET(blue_button)); - gtk_signal_connect (GTK_OBJECT (blue_button), "toggled", - GTK_SIGNAL_FUNC (color_button_callback), NULL); - - color_adjustment_table = gtk_table_new(1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (color_adjustment_table), 2); - gtk_table_set_row_spacings (GTK_TABLE (color_adjustment_table), 0); - gtk_container_set_border_width (GTK_CONTAINER (color_adjustment_table), 4); - gtk_widget_show (color_adjustment_table); - - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), - color_adjustment_table); - gtk_table_attach_defaults(GTK_TABLE(table), scrolled_window, - 0, 2, 1, 2); - gtk_widget_show(scrolled_window); -} - -static void -create_image_settings_frame (void) -{ - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *table; - GtkWidget *label; - GtkWidget *event_box; - GtkWidget *sep; - GSList *group; - gint i; - - create_color_adjust_window (); - - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, - gtk_label_new (_("Output"))); - gtk_widget_show (vbox); - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - event_box = gtk_event_box_new (); - gtk_table_attach (GTK_TABLE (table), event_box, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (event_box); - - /* - * Output type toggles. - */ - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); -/* gtk_table_set_row_spacing (GTK_TABLE (table), 2, 4); */ - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - event_box = gtk_event_box_new (); - gtk_table_attach (GTK_TABLE (table), event_box, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (event_box); - - label = gtk_label_new (_("Output Type:")); - gtk_container_add (GTK_CONTAINER (event_box), label); - gtk_widget_show (label); - - stpui_set_help_data(event_box, _("Select the desired output type")); - - group = NULL; - for (i = 0; i < output_type_count; i++) - group = stpui_create_radio_button(&(output_types[i]), group, table, 0, i, - output_type_callback); - - sep = gtk_hseparator_new (); - gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0); - gtk_widget_show (sep); - - /* - * Color adjust button - */ - hbox = gtk_hbox_new (FALSE, 4); - gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); - gtk_widget_show(hbox); - label = gtk_label_new(""); - gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - adjust_color_button = gtk_button_new_with_label (_("Adjust Output...")); - gtk_misc_set_padding (GTK_MISC (GTK_BIN (adjust_color_button)->child), 4, 0); - gtk_box_pack_start (GTK_BOX (hbox), adjust_color_button, FALSE, FALSE, 0); - gtk_widget_show(adjust_color_button); - label = gtk_label_new(""); - gtk_box_pack_end(GTK_BOX(hbox), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - stpui_set_help_data(adjust_color_button, - _("Adjust color balance, brightness, contrast, " - "saturation, and dither algorithm")); - gtk_signal_connect_object (GTK_OBJECT (adjust_color_button), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_show), - GTK_OBJECT (color_adjust_dialog)); -} - -static void -create_units_frame (void) -{ - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *label; - GtkWidget *event_box; - GSList *group; - gint i; - - units_hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new(_("Size Units:")); - gtk_widget_show(label); - gtk_box_pack_start(GTK_BOX(units_hbox), label, TRUE, TRUE, 0); - units_label = gtk_label_new(_(" ")); - gtk_widget_show(units_label); - gtk_box_pack_start(GTK_BOX(units_hbox), units_label, TRUE, TRUE, 0); - gtk_widget_show(units_hbox); - - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, units_hbox); - gtk_widget_show (vbox); - - /* - * The units toggles - */ - - table = gtk_table_new (1, 1, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - event_box = gtk_event_box_new (); - gtk_table_attach (GTK_TABLE (table), event_box, 0, 1, 0, 1, - GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); - gtk_widget_show (event_box); - - label = gtk_label_new (_("Units:")); - gtk_container_add (GTK_CONTAINER (event_box), label); - gtk_widget_show (label); - - stpui_set_help_data(event_box, - _("Select the base unit of measurement for printing")); - - group = NULL; - for (i = 0; i < unit_count; i++) - { - unit_t *unit = &(units[i]); - unit->checkbox = gtk_radio_button_new_with_label(group, gettext(unit->name)); - group = gtk_radio_button_group(GTK_RADIO_BUTTON(unit->checkbox)); - stpui_table_attach_aligned(GTK_TABLE(table), i / 2, i % 2, NULL, 0.5, - 0.5, unit->checkbox, 1, TRUE); - stpui_set_help_data(unit->checkbox, gettext(unit->help)); - gtk_signal_connect(GTK_OBJECT(unit->checkbox), "toggled", - GTK_SIGNAL_FUNC(unit_callback), (gpointer) i); - } -} - -/* - * create_main_window() - */ -static void -create_main_window (void) -{ - - set_current_printer(); - manufacturer = stp_printer_get_manufacturer(stp_get_printer(pv->v)); - /* - * Create the various dialog components. Note that we're not - * actually initializing the values at this point; that will be done after - * the UI is fully created. - */ - - stpui_help_init(); - - create_top_level_structure (); - - create_preview (); - create_printer_settings_frame (); - create_units_frame(); - create_paper_size_frame(); - create_copy_number_frame(); - create_positioning_frame (); - create_scaling_frame (); - create_image_settings_frame (); - - /* - * Now actually set up the correct values in the dialog - */ - - do_update_thumbnail = 1; - build_printer_combo (); - plist_callback (NULL, (gpointer) stpui_plist_current); - update_adjusted_thumbnail (TRUE); - - gtk_widget_show (print_dialog); -} - -static void -set_entry_value(GtkWidget *entry, double value, int block) -{ - gchar s[255]; - gdouble unit_scaler = units[pv->unit].scale; - const gchar *format = units[pv->unit].format; - - g_snprintf(s, sizeof(s), format, value / unit_scaler); - if (block) - gtk_signal_handler_block_by_data (GTK_OBJECT (entry), NULL); - gtk_entry_set_text (GTK_ENTRY (entry), s); - if (block) - gtk_signal_handler_unblock_by_data (GTK_OBJECT (entry), NULL); -} - -static void -reset_preview(void) -{ - if (!suppress_preview_reset) - { - stpui_enable_help(); - buttons_pressed = preview_active = 0; - } -} - -static void -invalidate_preview_thumbnail (void) -{ - preview_valid = FALSE; -} - -static void -invalidate_frame (void) -{ - frame_valid = FALSE; -} - -static void -compute_scaling_limits(gdouble *min_ppi_scaling, gdouble *max_ppi_scaling) -{ - if (auto_paper_size) - { - *min_ppi_scaling = - FINCH * (gdouble) image_width / (gdouble) printable_width; - } - else - { - gdouble min_ppi_scaling1 = - FINCH * (gdouble) image_width / (gdouble) printable_width; - gdouble min_ppi_scaling2 = - FINCH * (gdouble) image_height / (gdouble) printable_height; - - if (min_ppi_scaling1 > min_ppi_scaling2) - *min_ppi_scaling = min_ppi_scaling1; - else - *min_ppi_scaling = min_ppi_scaling2; - } - - *max_ppi_scaling = *min_ppi_scaling * 100 / minimum_image_percent; -} - -/* - * scaling_update() - Update the scaling scale using the slider. - */ -static void -scaling_update (GtkAdjustment *adjustment) -{ - reset_preview (); - - if (pv->scaling != adjustment->value) - { - invalidate_preview_thumbnail (); - if (GTK_TOGGLE_BUTTON (scaling_ppi)->active) - pv->scaling = -adjustment->value; - else - pv->scaling = adjustment->value; - - suppress_scaling_adjustment = TRUE; - preview_update (); - suppress_scaling_adjustment = FALSE; - } -} - -/* - * scaling_callback() - Update the scaling scale using radio buttons. - */ -static void -scaling_callback (GtkWidget *widget) -{ - gdouble max_ppi_scaling; - gdouble min_ppi_scaling; - gdouble current_scale; - - reset_preview (); - - if (suppress_scaling_callback) - return; - - compute_scaling_limits(&min_ppi_scaling, &max_ppi_scaling); - - if (widget == scaling_ppi) - { - if (! GTK_TOGGLE_BUTTON (scaling_ppi)->active) - return; - - GTK_ADJUSTMENT (scaling_adjustment)->lower = min_ppi_scaling; - GTK_ADJUSTMENT (scaling_adjustment)->upper = max_ppi_scaling; - - /* - * Compute the correct PPI to create an image of the same size - * as the one measured in percent - */ - current_scale = GTK_ADJUSTMENT (scaling_adjustment)->value; - GTK_ADJUSTMENT (scaling_adjustment)->value = - min_ppi_scaling / (current_scale / 100); - pv->scaling = 0.0; - } - else if (widget == scaling_percent) - { - gdouble new_percent; - - if (! GTK_TOGGLE_BUTTON (scaling_percent)->active) - return; - - current_scale = GTK_ADJUSTMENT (scaling_adjustment)->value; - GTK_ADJUSTMENT (scaling_adjustment)->lower = minimum_image_percent; - GTK_ADJUSTMENT (scaling_adjustment)->upper = 100.0; - - new_percent = 100 * min_ppi_scaling / current_scale; - - if (new_percent > 100) - new_percent = 100; - if (new_percent < minimum_image_percent) - new_percent = minimum_image_percent; - - GTK_ADJUSTMENT (scaling_adjustment)->value = new_percent; - pv->scaling = 0.0; - } - else if (widget == scaling_image) - { - gdouble yres = image_yres; - - invalidate_preview_thumbnail (); - - GTK_ADJUSTMENT (scaling_adjustment)->lower = min_ppi_scaling; - GTK_ADJUSTMENT (scaling_adjustment)->upper = max_ppi_scaling; - - if (yres < min_ppi_scaling) - yres = min_ppi_scaling; - if (yres > max_ppi_scaling) - yres = max_ppi_scaling; - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scaling_ppi), TRUE); - GTK_ADJUSTMENT (scaling_adjustment)->value = yres; - pv->scaling = 0.0; - } - - if (widget == scaling_ppi || widget == scaling_percent) - suppress_preview_update++; - gtk_adjustment_changed (GTK_ADJUSTMENT (scaling_adjustment)); - gtk_adjustment_value_changed (GTK_ADJUSTMENT (scaling_adjustment)); - if (auto_paper_size) - set_media_size(stp_get_string_parameter(pv->v, "PageSize")); - if (widget == scaling_ppi || widget == scaling_percent) - suppress_preview_update--; -} - -/**************************************************************************** - * - * plist_build_combo - * - ****************************************************************************/ -static void -plist_build_combo (GtkWidget *combo, /* I - Combo widget */ - GtkWidget *label, - stp_string_list_t *items, /* I - Menu items */ - int active, - const gchar *cur_item, /* I - Current item */ - const gchar *def_value, /* I - default item */ - GtkSignalFunc callback, /* I - Callback */ - gint *callback_id, /* IO - Callback ID (init to -1) */ - int (*check_func)(const char *string), - gpointer data) -{ - gint i; /* Looping var */ - GList *list = 0; - gint num_items = 0; - GtkEntry *entry = GTK_ENTRY (GTK_COMBO (combo)->entry); - - if (check_func && items) - { - stp_string_list_t *new_items = stp_string_list_create(); - num_items = stp_string_list_count(items); - for (i = 0; i < num_items; i++) - { - stp_param_string_t *param = stp_string_list_param(items, i); - if ((*check_func)(param->name)) - stp_string_list_add_string(new_items, param->name, param->text); - } - items = new_items; - } - - if (items) - num_items = stp_string_list_count(items); - - if (*callback_id != -1) - gtk_signal_disconnect (GTK_OBJECT (entry), *callback_id); - gtk_entry_set_editable (entry, FALSE); - - if (!active || num_items == 0) - { - list = g_list_append (list, _("Standard")); - gtk_combo_set_popdown_strings (GTK_COMBO (combo), list); - *callback_id = -1; - gtk_widget_set_sensitive (combo, FALSE); - gtk_widget_hide (combo); - if (label) - gtk_widget_hide(label); - if (check_func && items) - stp_string_list_destroy(items); - return; - } - - for (i = 0; i < num_items; i ++) - list = g_list_append(list, g_strdup(stp_string_list_param(items, i)->text)); - - gtk_combo_set_popdown_strings (GTK_COMBO (combo), list); - - if (cur_item) - for (i = 0; i < num_items; i ++) - if (strcmp(stp_string_list_param(items, i)->name, cur_item) == 0) - break; - - if (i >= num_items && def_value) - for (i = 0; i < num_items; i ++) - if (strcmp(stp_string_list_param(items, i)->name, def_value) == 0) - break; - - if (i >= num_items) - i = 0; - - gtk_entry_set_text (entry, stp_string_list_param(items, i)->text); - - gtk_combo_set_value_in_list (GTK_COMBO (combo), TRUE, FALSE); - gtk_widget_set_sensitive (combo, TRUE); - gtk_widget_show (combo); - if (label) - gtk_widget_show(label); - - *callback_id = gtk_signal_connect (GTK_OBJECT (entry), "changed", callback, - data); - if (check_func && items) - stp_string_list_destroy(items); -} - -void -stpui_set_image_dimensions(gint width, gint height) -{ - image_true_width = width; - image_true_height = height; -} - -void -stpui_set_image_resolution(gdouble xres, gdouble yres) -{ - image_xres = xres; - image_yres = yres; -} - -gint -stpui_compute_orientation(void) -{ - if (auto_paper_size || - (printable_width >= printable_height && - image_true_width >= image_true_height) || - (printable_height >= printable_width && - image_true_height >= image_true_width)) - return ORIENT_PORTRAIT; - else - return ORIENT_LANDSCAPE; -} - -static void -compute_printable_region(void) -{ - stp_get_media_size(pv->v, &paper_width, &paper_height); - stp_get_imageable_area(pv->v, &left, &right, &bottom, &top); - printable_width = right - left; - printable_height = bottom - top; -} - -static void -set_orientation(int orientation) -{ - compute_printable_region(); - pv->orientation = orientation; - if (orientation == ORIENT_AUTO) - orientation = stpui_compute_orientation(); - physical_orientation = orientation; - switch (orientation) - { - case ORIENT_PORTRAIT: - case ORIENT_UPSIDEDOWN: - image_height = image_true_height; - image_width = image_true_width; - preview_thumbnail_h = thumbnail_h; - preview_thumbnail_w = thumbnail_w; - break; - case ORIENT_LANDSCAPE: - case ORIENT_SEASCAPE: - image_height = image_true_width; - image_width = image_true_height; - preview_thumbnail_h = thumbnail_w; - preview_thumbnail_w = thumbnail_h; - break; - } - update_adjusted_thumbnail(FALSE); -} - -static void -position_button_callback(GtkWidget *widget, gpointer data) -{ - reset_preview(); - pv->invalid_mask |= (gint) data; - preview_update (); -} - -/* - * position_callback() - callback for position entry widgets - */ -static void -position_callback (GtkWidget *widget) -{ - gdouble new_printed_value = atof (gtk_entry_get_text (GTK_ENTRY (widget))); - gint new_value = SCALE(new_printed_value, units[pv->unit].scale); - - reset_preview (); - suppress_preview_update++; - - if (widget == top_entry) - stp_set_top(pv->v, new_value); -/* - else if (widget == bottom_entry) - stp_set_top(pv->v, new_value - print_height); -*/ - else if (widget == bottom_border_entry) - stp_set_top (pv->v, paper_height - print_height - new_value); - else if (widget == left_entry) - stp_set_left (pv->v, new_value); -/* - else if (widget == right_entry) - stp_set_left(pv->v, new_value - print_width); -*/ - else if (widget == right_border_entry) - stp_set_left (pv->v, paper_width - print_width - new_value); - else if (widget == width_entry || widget == height_entry) - { - gboolean was_percent = (pv->scaling >= 0); - if (pv->scaling >= 0) - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scaling_ppi), TRUE); - scaling_callback (scaling_ppi); - } - if (widget == width_entry) - GTK_ADJUSTMENT (scaling_adjustment)->value = - ((gdouble) image_width) / (new_value / FINCH); - else - GTK_ADJUSTMENT (scaling_adjustment)->value = - ((gdouble) image_height) / (new_value / FINCH); - gtk_adjustment_value_changed (GTK_ADJUSTMENT (scaling_adjustment)); - if (was_percent) - { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(scaling_percent),TRUE); - gtk_adjustment_value_changed(GTK_ADJUSTMENT (scaling_adjustment)); - } - } - - suppress_preview_update--; - preview_update (); -} - -static void -set_adjustment_active(option_t *opt, gboolean active, gboolean do_toggle) -{ - GtkObject *adj = opt->info.flt.adjustment; - if (do_toggle) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); - gtk_widget_set_sensitive - (GTK_WIDGET (SCALE_ENTRY_LABEL (adj)), active); - gtk_widget_set_sensitive - (GTK_WIDGET (SCALE_ENTRY_SCALE (adj)), active); - gtk_widget_set_sensitive - (GTK_WIDGET (SCALE_ENTRY_SPINBUTTON (adj)), active); -} - -static void -set_combo_active(option_t *opt, gboolean active, gboolean do_toggle) -{ - if (do_toggle) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); - gtk_widget_set_sensitive(GTK_WIDGET(opt->info.list.combo), active); - gtk_widget_set_sensitive(GTK_WIDGET(opt->info.list.label), active); -} - -static void -set_curve_active(option_t *opt, gboolean active, gboolean do_toggle) -{ - if (do_toggle) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); - gtk_widget_set_sensitive(GTK_WIDGET(opt->info.curve.button), active); - gtk_widget_set_sensitive(GTK_WIDGET(opt->info.curve.label), active); - if (active) - { - if (opt->info.curve.is_visible) - gtk_widget_show(GTK_WIDGET(opt->info.curve.dialog)); - } - else - gtk_widget_hide(GTK_WIDGET(opt->info.curve.dialog)); -} - -static void -set_bool_active(option_t *opt, gboolean active, gboolean do_toggle) -{ - if (do_toggle) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); - gtk_widget_set_sensitive(GTK_WIDGET(opt->info.bool.checkbox), active); -} - -static void -do_color_updates (void) -{ - int i; - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - if (opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL) - { - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_DOUBLE: - if (stp_check_float_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - gtk_adjustment_set_value - (GTK_ADJUSTMENT(opt->info.flt.adjustment), - stp_get_float_parameter(pv->v, opt->fast_desc->name)); - if (stp_check_float_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE) || - opt->fast_desc->is_mandatory) - set_adjustment_active(opt, TRUE, TRUE); - else - set_adjustment_active(opt, FALSE, TRUE); - break; - case STP_PARAMETER_TYPE_DIMENSION: - if (stp_check_dimension_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - { - gdouble unit_scaler = units[pv->unit].scale; - gtk_adjustment_set_value - (GTK_ADJUSTMENT(opt->info.flt.adjustment), - (stp_get_dimension_parameter(pv->v, opt->fast_desc->name) / - unit_scaler)); - } - if (stp_check_dimension_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE) || - opt->fast_desc->is_mandatory) - set_adjustment_active(opt, TRUE, TRUE); - else - set_adjustment_active(opt, FALSE, TRUE); - break; - case STP_PARAMETER_TYPE_CURVE: - if (stp_check_curve_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE) || - opt->fast_desc->is_mandatory) - set_curve_active(opt, TRUE, TRUE); - else - set_curve_active(opt, FALSE, TRUE); - break; - case STP_PARAMETER_TYPE_STRING_LIST: - if (strcmp(opt->fast_desc->name, "PageSize") == 0) - build_page_size_combo(opt); - else if (stp_check_string_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - plist_build_combo(opt->info.list.combo, opt->info.list.label, - opt->info.list.params, opt->is_active, - (stp_get_string_parameter - (pv->v, opt->fast_desc->name)), - opt->info.list.default_val, - combo_callback, - &(opt->info.list.callback_id), - NULL, opt); - if (stp_check_string_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE) || - opt->fast_desc->is_mandatory) - set_combo_active(opt, TRUE, TRUE); - else - set_combo_active(opt, FALSE, TRUE); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - if (stp_check_boolean_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(opt->info.bool.checkbox), - stp_get_boolean_parameter(pv->v, opt->fast_desc->name)); - if (stp_check_boolean_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE) || - opt->fast_desc->is_mandatory) - set_bool_active(opt, TRUE, TRUE); - else - set_bool_active(opt, FALSE, TRUE); - break; - default: - break; - } - } - } - update_adjusted_thumbnail (TRUE); -} - -static void -update_options(void) -{ - gtk_widget_hide(page_size_table); - gtk_widget_hide(printer_features_table); - gtk_widget_hide(color_adjustment_table); - populate_options(pv->v); - populate_option_table(page_size_table, STP_PARAMETER_CLASS_CORE); - populate_option_table(printer_features_table, STP_PARAMETER_CLASS_FEATURE); - populate_option_table(color_adjustment_table, STP_PARAMETER_CLASS_OUTPUT); - gtk_widget_show(page_size_table); - gtk_widget_show(printer_features_table); - gtk_widget_show(color_adjustment_table); - set_options_active(NULL); -} - -static void -update_standard_print_command(void) -{ - char *label_text = - stpui_build_standard_print_command(pv, stp_get_printer(pv->v)); - gtk_entry_set_text(GTK_ENTRY(standard_cmd_entry), label_text); - g_free(label_text); -} - -static void -set_color_options(void) -{ - stp_parameter_t desc; - stp_describe_parameter(pv->v, "PrintingMode", &desc); - if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST) - { - if (!stp_string_list_is_present(desc.bounds.str, "Color")) - { - gtk_widget_set_sensitive (output_types[1].button, TRUE); - if (gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (output_types[0].button)) == TRUE) - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON (output_types[1].button), TRUE); - gtk_widget_set_sensitive (output_types[0].button, FALSE); - } - else if (!stp_string_list_is_present(desc.bounds.str, "BW")) - { - gtk_widget_set_sensitive (output_types[0].button, TRUE); - if (gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (output_types[1].button)) == TRUE) - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON (output_types[0].button), TRUE); - gtk_widget_set_sensitive (output_types[1].button, FALSE); - } - else - { - gtk_widget_set_sensitive (output_types[0].button, TRUE); - gtk_widget_set_sensitive (output_types[1].button, TRUE); - } - } - stp_parameter_description_destroy(&desc); -} - -static void -do_all_updates(void) -{ - gint i; - suppress_preview_update++; - set_orientation(pv->orientation); - invalidate_preview_thumbnail (); - preview_update (); - update_standard_print_command(); - - if (pv->scaling < 0) - { - gdouble tmp = -pv->scaling; - gdouble max_ppi_scaling; - gdouble min_ppi_scaling; - - compute_scaling_limits(&min_ppi_scaling, &max_ppi_scaling); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scaling_ppi), TRUE); - GTK_ADJUSTMENT (scaling_adjustment)->lower = min_ppi_scaling; - GTK_ADJUSTMENT (scaling_adjustment)->upper = max_ppi_scaling; - GTK_ADJUSTMENT (scaling_adjustment)->value = tmp; - gtk_adjustment_changed (GTK_ADJUSTMENT (scaling_adjustment)); - gtk_adjustment_value_changed (GTK_ADJUSTMENT (scaling_adjustment)); - } - else - { - gdouble tmp = pv->scaling; - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scaling_percent), TRUE); - GTK_ADJUSTMENT (scaling_adjustment)->lower = minimum_image_percent; - GTK_ADJUSTMENT (scaling_adjustment)->upper = 100.0; - GTK_ADJUSTMENT (scaling_adjustment)->value = tmp; - gtk_signal_emit_by_name (scaling_adjustment, "changed"); - gtk_signal_emit_by_name (scaling_adjustment, "value_changed"); - } - - set_color_options(); - for (i = 0; i < output_type_count; i++) - { - if (stp_get_string_parameter(pv->v, "PrintingMode") && - strcmp(output_types[i].value, - stp_get_string_parameter(pv->v, "PrintingMode")) == 0) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(output_types[i].button), - TRUE); - } - - /* - * Now get option parameters. - */ - - update_options(); - do_color_updates (); - - gtk_option_menu_set_history (GTK_OPTION_MENU (orientation_menu), - pv->orientation + 1); - - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(units[pv->unit].checkbox), - TRUE); - gtk_label_set_text(GTK_LABEL(units_label), units[pv->unit].name); - suppress_preview_update--; - preview_update (); -} - -static void -copy_count_callback(GtkAdjustment *adjustment, gpointer data) -{ - gint copy_count = (gint) adjustment->value; - stpui_plist_set_copy_count(pv, copy_count); - update_standard_print_command(); -} - -static void -auto_paper_size_callback(GtkWidget *widget, gpointer data) -{ - auto_paper_size = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(auto_paper_size_button)); - pv->auto_size_roll_feed_paper = auto_paper_size; - set_orientation(pv->orientation); - do_all_updates(); -} - -static void -setup_auto_paper_size(void) -{ - const stp_papersize_t *ps = - stp_get_papersize_by_name(stp_get_string_parameter(pv->v, "PageSize")); - if (ps->height == 0 && ps->width != 0) /* Implies roll feed */ - { - gtk_signal_handler_block_by_data(GTK_OBJECT(auto_paper_size_button), - NULL); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(auto_paper_size_button), - pv->auto_size_roll_feed_paper); - gtk_widget_show(auto_paper_size_button); - gtk_signal_handler_unblock_by_data(GTK_OBJECT(auto_paper_size_button), - NULL); - } - else - { - gtk_widget_hide(auto_paper_size_button); - auto_paper_size = 0; - } -} - -static void -queue_callback (GtkWidget *widget, - gpointer data) -{ - int i; - int count = stp_string_list_count(stpui_system_print_queues); - const gchar *result = - gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(queue_combo)->entry)); - for (i = 0; i < count; i++) - { - const stp_param_string_t *s = - stp_string_list_param(stpui_system_print_queues, i); - if (!strcmp(result, s->text)) - { - stpui_plist_set_queue_name(pv, s->name); - do_all_updates(); - return; - } - } -} - -static void -setup_callback (GtkWidget *widget) -{ - const gchar *new_value = gtk_entry_get_text (GTK_ENTRY (widget)); - - if (widget == custom_command_entry) - stpui_plist_set_custom_command(pv, new_value); - else if (widget == file_entry) - { - stpui_plist_set_output_filename(pv, new_value); - gtk_file_selection_set_filename - (GTK_FILE_SELECTION (file_browser), - gtk_entry_get_text (GTK_ENTRY (file_entry))); - } -} - -/* - * plist_callback() - Update the current system printer. - */ -static void -plist_callback (GtkWidget *widget, - gpointer data) -{ - gint i; - char *tmp; - - suppress_preview_update++; - invalidate_frame (); - invalidate_preview_thumbnail (); - reset_preview (); - - if (widget) - { - const gchar *result = - gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(printer_combo)->entry)); - - for (i = 0; i < stpui_plist_count; i++) - { - if (! strcmp (result, stp_string_list_param(printer_list, i)->text)) - { - stpui_plist_current = i; - break; - } - } - } - else - { - stpui_plist_current = (gint) data; - } - - set_current_printer(); - build_queue_combo(); - manufacturer = stp_printer_get_manufacturer(stp_get_printer(pv->v)); - build_printer_driver_clist(); - - if (strcmp(stp_get_driver(pv->v), "") != 0) - tmp_printer = stp_get_printer(pv->v); - - gtk_entry_set_text(GTK_ENTRY(file_entry), - stpui_plist_get_output_filename(pv)); - tmp = stpui_build_standard_print_command(pv, stp_get_printer(pv->v)); - gtk_entry_set_text(GTK_ENTRY(standard_cmd_entry), tmp); - stp_free(tmp); - gtk_entry_set_text(GTK_ENTRY(custom_command_entry), - stpui_plist_get_custom_command(pv)); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(copy_count_spin_button), - (gfloat) stpui_plist_get_copy_count(pv)); - do_all_updates(); - - setup_update (); - do_all_updates(); - suppress_preview_update--; - update_adjusted_thumbnail(TRUE); - preview_update (); -} - -static void -show_all_paper_sizes_callback(GtkWidget *widget, gpointer data) -{ - int i; - stpui_show_all_paper_sizes = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - for (i = 0; i < current_option_count; i++) - { - option_t *option = &(current_options[i]); - if (option->fast_desc && - strcmp(option->fast_desc->name, "PageSize") == 0) - { - build_a_combo(option); - break; - } - } -} - -static void -custom_media_size_callback(GtkWidget *widget, - gpointer data) -{ - gint width_limit, height_limit; - gint min_width_limit, min_height_limit; - gdouble new_printed_value = atof(gtk_entry_get_text(GTK_ENTRY(widget))); - gint new_value = SCALE(new_printed_value, units[pv->unit].scale); - invalidate_frame (); - invalidate_preview_thumbnail (); - reset_preview (); - - stp_get_size_limit(pv->v, &width_limit, &height_limit, - &min_width_limit, &min_height_limit); - if (widget == custom_size_width) - { - if (new_value < min_width_limit) - new_value = min_width_limit; - else if (new_value > width_limit) - new_value = width_limit; - stp_set_page_width (pv->v, new_value); - } - else - { - if (new_value < min_height_limit) - new_value = min_height_limit; - else if (new_value > height_limit) - new_value = height_limit; - stp_set_page_height (pv->v, new_value); - } - set_entry_value (widget, new_value, 0); - preview_update (); -} - - -/* - * media_size_callback() - Update the current media size. - */ -static void -set_media_size(const gchar *new_media_size) -{ - static int setting_media_size = 0; - const stp_papersize_t *pap = stp_get_papersize_by_name (new_media_size); - - if (setting_media_size) - return; - setting_media_size++; - - if (pap) - { - gint size; - int old_width = stp_get_page_width(pv->v); - int old_height = stp_get_page_height(pv->v); - int need_preview_update = 0; - - if (! stpui_show_all_paper_sizes && - (pap->paper_unit == PAPERSIZE_METRIC_EXTENDED || - pap->paper_unit == PAPERSIZE_ENGLISH_EXTENDED)) - { - int i; - stp_parameter_t desc; - stp_describe_parameter(pv->v, "PageSize", &desc); - stp_set_string_parameter(pv->v, "PageSize", desc.deflt.str); - pap = stp_get_papersize_by_name(desc.deflt.str); - stp_parameter_description_destroy(&desc); - for (i = 0; i < current_option_count; i++) - { - option_t *option = &(current_options[i]); - if (option->fast_desc && - strcmp(option->fast_desc->name, "PageSize") == 0) - { - build_a_combo(option); - break; - } - } - } - - if (pap->width == 0) - { - int max_w, max_h, min_w, min_h; - stp_get_size_limit(pv->v, &max_w, &max_h, &min_w, &min_h); - size = old_width; - if (size < min_w) - size = min_w; - else if (size > max_w) - size = max_w; - gtk_widget_set_sensitive (GTK_WIDGET (custom_size_width), TRUE); - gtk_entry_set_editable (GTK_ENTRY (custom_size_width), TRUE); - } - else - { - size = pap->width; - gtk_widget_set_sensitive (GTK_WIDGET (custom_size_width), FALSE); - gtk_entry_set_editable (GTK_ENTRY (custom_size_width), FALSE); - } - if (size != old_width) - { - need_preview_update = 1; - set_entry_value (custom_size_width, size, 0); - stp_set_page_width (pv->v, size); - } - - setup_auto_paper_size(); - if (pap->height == 0) - { - int max_w, max_h, min_w, min_h; - stp_get_size_limit(pv->v, &max_w, &max_h, &min_w, &min_h); - if (auto_paper_size) - { - int l, r, b, t; - stp_set_page_height(pv->v, 0); - old_height = 0; - stp_get_imageable_area(pv->v, &l, &r, &b, &t); - gtk_widget_set_sensitive(GTK_WIDGET(custom_size_height), FALSE); - gtk_entry_set_editable(GTK_ENTRY(custom_size_height), FALSE); - size = print_height; - } - else - { - gtk_widget_set_sensitive (GTK_WIDGET (custom_size_height), TRUE); - gtk_entry_set_editable (GTK_ENTRY (custom_size_height), TRUE); - size = old_height; - } - if (size < min_h) - size = min_h; - else if (size > max_h) - size = max_h; - } - else - { - size = pap->height; - gtk_widget_set_sensitive(GTK_WIDGET (custom_size_height), FALSE); - gtk_entry_set_editable (GTK_ENTRY (custom_size_height), FALSE); - } - if (size != old_height) - { - need_preview_update = 1; - set_entry_value (custom_size_height, size, 0); - stp_set_page_height (pv->v, size); - } - if (need_preview_update) - { - invalidate_preview_thumbnail(); - invalidate_frame(); - preview_update(); - } - } - setting_media_size--; -} - -static gboolean -refresh_all_options(gpointer data) -{ - do_all_updates(); - do_all_updates(); /* Update twice to pick up cascading changes */ - return FALSE; -} - -static void -combo_callback(GtkWidget *widget, gpointer data) -{ - option_t *option = (option_t *)data; - const gchar *new_value = - stpui_combo_get_name(option->info.list.combo, option->info.list.params); - const gchar *value = - stp_get_string_parameter(pv->v, option->fast_desc->name); - if (value && new_value) - { - reset_preview(); - if (!value || strcmp(value, new_value) != 0) - { - invalidate_frame(); - invalidate_preview_thumbnail(); - stp_set_string_parameter(pv->v, option->fast_desc->name, new_value); - if (strcmp(option->fast_desc->name, "PageSize") == 0) - set_media_size(new_value); - g_idle_add(refresh_all_options, NULL); - if (option->fast_desc->p_class == STP_PARAMETER_CLASS_OUTPUT) - update_adjusted_thumbnail(TRUE); - preview_update(); - } - } -} - -/* - * orientation_callback() - Update the current media size. - */ -static void -orientation_callback (GtkWidget *widget, - gpointer data) -{ - reset_preview (); - - if (pv->orientation != (gint) data) - { - invalidate_preview_thumbnail (); - set_orientation((gint) data); - update_adjusted_thumbnail(TRUE); - preview_update (); - } -} - -/* - * output_type_callback() - Update the current output type. - */ -static void -output_type_callback (GtkWidget *widget, - gpointer data) -{ - reset_preview (); - - if (GTK_TOGGLE_BUTTON (widget)->active) - { - if (strcmp((const char *) data, "BW") == 0) - gtk_widget_hide(output_color_vbox); - else - gtk_widget_show(output_color_vbox); - stp_set_string_parameter(pv->v, "PrintingMode", (const char *) data); - invalidate_preview_thumbnail (); - update_adjusted_thumbnail (TRUE); - set_options_active(NULL); - preview_update (); - do_all_updates(); - } -} - -static void -command_type_callback(GtkWidget *widget, gpointer data) -{ - if (strcmp((const char *) data, "Standard") == 0) - { - gtk_widget_set_sensitive(standard_cmd_entry, TRUE); - gtk_widget_set_sensitive(queue_combo, TRUE); - gtk_widget_set_sensitive(file_entry, FALSE); - gtk_entry_set_editable(GTK_ENTRY(file_entry), FALSE); - gtk_widget_set_sensitive(custom_command_entry, FALSE); - gtk_entry_set_editable(GTK_ENTRY(custom_command_entry), FALSE); - gtk_widget_hide(GTK_WIDGET(file_browser)); - gtk_widget_set_sensitive(file_button, FALSE); - gtk_widget_set_sensitive(copy_count_spin_button, TRUE); - stpui_plist_set_command_type(pv, COMMAND_TYPE_DEFAULT); - } - else if (strcmp((const char *) data, "Custom") == 0) - { - gtk_widget_set_sensitive(standard_cmd_entry, FALSE); - gtk_widget_set_sensitive(queue_combo, FALSE); - gtk_widget_set_sensitive(file_entry, FALSE); - gtk_entry_set_editable(GTK_ENTRY(file_entry), FALSE); - gtk_widget_set_sensitive(custom_command_entry, TRUE); - gtk_entry_set_editable(GTK_ENTRY(custom_command_entry), TRUE); - gtk_widget_hide(GTK_WIDGET(file_browser)); - gtk_widget_set_sensitive(file_button, FALSE); - gtk_widget_set_sensitive(copy_count_spin_button, FALSE); - stpui_plist_set_command_type(pv, COMMAND_TYPE_CUSTOM); - } - else if (strcmp((const char *) data, "File") == 0) - { - gtk_widget_set_sensitive(standard_cmd_entry, FALSE); - gtk_widget_set_sensitive(queue_combo, FALSE); - gtk_widget_set_sensitive(file_entry, TRUE); - gtk_entry_set_editable(GTK_ENTRY(file_entry), TRUE); - gtk_widget_set_sensitive(custom_command_entry, FALSE); - gtk_entry_set_editable(GTK_ENTRY(custom_command_entry), FALSE); - gtk_widget_set_sensitive(file_button, TRUE); - gtk_widget_set_sensitive(copy_count_spin_button, FALSE); - stpui_plist_set_command_type(pv, COMMAND_TYPE_FILE); - } -} - -static void -set_all_entry_values(void) -{ - set_entry_value (top_entry, (stp_get_top (pv->v)), 1); - set_entry_value (left_entry, (stp_get_left (pv->v)), 1); -/* - set_entry_value (bottom_entry, (top + stp_get_top(pv->v) + print_height), 1); -*/ - set_entry_value (bottom_border_entry, - (paper_height - (stp_get_top (pv->v) + print_height)), 1); -/* - set_entry_value (right_entry, (stp_get_left(pv->v) + print_width), 1); -*/ - set_entry_value (right_border_entry, - (paper_width - (stp_get_left (pv->v) + print_width)), 1); - set_entry_value (width_entry, print_width, 1); - set_entry_value (height_entry, print_height, 1); - set_entry_value (custom_size_width, stp_get_page_width (pv->v), 1); - set_entry_value (custom_size_height, stp_get_page_height (pv->v), 1); -} - -/* - * unit_callback() - Update the current unit. - */ -static void -unit_callback (GtkWidget *widget, - gpointer data) -{ - reset_preview (); - - if (GTK_TOGGLE_BUTTON (widget)->active) - { - pv->unit = (gint) data; - gtk_label_set_text(GTK_LABEL(units_label), units[pv->unit].name); - set_all_entry_values(); - update_options(); - do_color_updates(); - } -} - -static void -destroy_dialogs (void) -{ - int i; - gtk_widget_destroy (color_adjust_dialog); - gtk_widget_destroy (setup_dialog); - gtk_widget_destroy (print_dialog); - gtk_widget_destroy (new_printer_dialog); - gtk_widget_destroy (about_dialog); - for (i = 0; i < current_option_count; i++) - { - if (current_options[i].fast_desc->p_type == STP_PARAMETER_TYPE_CURVE && - current_options[i].info.curve.dialog) - gtk_widget_destroy(current_options[i].info.curve.dialog); - } -} - -static void -dialogs_set_sensitive (gboolean sensitive) -{ - int i; - gtk_widget_set_sensitive (color_adjust_dialog, sensitive); - gtk_widget_set_sensitive (setup_dialog, sensitive); - gtk_widget_set_sensitive (print_dialog, sensitive); - gtk_widget_set_sensitive (new_printer_dialog, sensitive); - gtk_widget_set_sensitive (about_dialog, sensitive); - for (i = 0; i < current_option_count; i++) - { - if (current_options[i].fast_desc->p_type == STP_PARAMETER_TYPE_CURVE && - current_options[i].info.curve.dialog) - gtk_widget_set_sensitive(current_options[i].info.curve.dialog, - sensitive); - } -} - -/* - * 'print_callback()' - Start the print. - */ -static void -print_callback (void) -{ - if (stpui_plist_get_command_type(pv) == COMMAND_TYPE_FILE && - strlen(stpui_plist_get_output_filename(pv)) == 0) - { - dialogs_set_sensitive (FALSE); - exit_after_file_ok = 1; - gtk_widget_show (file_browser); - } - else - { - runme = TRUE; - destroy_dialogs (); - } -} - -/* - * printandsave_callback() - - */ -static void -printandsave_callback (void) -{ - saveme = TRUE; - print_callback(); -} - -static void -about_callback (void) -{ - gtk_widget_show (about_dialog); -} - -/* - * save_callback() - save settings, don't destroy dialog - */ -static void -save_callback (void) -{ - reset_preview (); - stpui_printrc_save (); -} - -/* - * setup_update() - update widgets in the setup dialog - */ -static void -setup_update (void) -{ - GtkAdjustment *adjustment; - gint idx = 0; - gint i; - gchar *tmp; - stp_parameter_t desc; - const char *ppd_file_name = stp_get_file_parameter(pv->v, "PPDFile"); - - for (i = 0; i < GTK_CLIST(manufacturer_clist)->rows; i++) - { - (void) gtk_clist_get_text(GTK_CLIST(manufacturer_clist), i, 0, &tmp); - if (tmp && strcmp(manufacturer, tmp) == 0) - { - idx = i; - break; - } - } - gtk_clist_select_row(GTK_CLIST(manufacturer_clist), idx, 0); - - idx = stp_get_printer_index_by_driver (stp_get_driver (pv->v)); - - idx = gtk_clist_find_row_from_data(GTK_CLIST(printer_driver), - (gpointer) idx); -/* - if (idx >= 0) - idx = 0; -*/ - gtk_clist_select_row (GTK_CLIST (printer_driver), idx, 0); - stp_describe_parameter(pv->v, "ModelName", &desc); - if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST && desc.is_active && - desc.deflt.str) - { - const char *extra_printer_model = desc.deflt.str; - char *label_text = - g_malloc(strlen(gettext (stp_printer_get_long_name (tmp_printer))) + - 2 + /* " (" */ - strlen(extra_printer_model) + - 2); /* ")" + null terminator */ - strcpy(label_text, extra_printer_model); - strcat(label_text, " ("); - strcat(label_text, gettext (stp_printer_get_long_name (tmp_printer))); - strcat(label_text, ")"); - gtk_label_set_text (GTK_LABEL (printer_model_label), label_text); - g_free(label_text); - } - else - { - gtk_label_set_text (GTK_LABEL (printer_model_label), - gettext (stp_printer_get_long_name (tmp_printer))); - } - stp_parameter_description_destroy(&desc); - - if (ppd_file_name) - gtk_entry_set_text (GTK_ENTRY (ppd_file), ppd_file_name); - else - gtk_entry_set_text (GTK_ENTRY (ppd_file), ""); - ppd_file_callback(ppd_file, NULL); - - if (stp_parameter_find_in_settings(pv->v, "PPDFile")) - { - gtk_widget_show (ppd_box); - gtk_widget_show (ppd_label); - gtk_widget_show (ppd_model_label); - gtk_widget_show (ppd_model); - } - else - { - gtk_widget_hide (ppd_box); - gtk_widget_hide (ppd_label); - gtk_widget_hide (ppd_model_label); - gtk_widget_hide (ppd_model); - } - gtk_entry_set_text (GTK_ENTRY (custom_command_entry), - stpui_plist_get_custom_command (pv)); - - adjustment = GTK_CLIST (printer_driver)->vadjustment; - gtk_adjustment_set_value - (adjustment, - adjustment->lower + idx * (adjustment->upper - adjustment->lower) / - GTK_CLIST (printer_driver)->rows); - - i = stpui_plist_get_command_type(pv); - if (i >= 0 && i < command_options_count) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(command_options[i].button), - TRUE); -} - -static void -ppd_file_callback(GtkWidget *widget, gpointer data) -{ - const gchar *name = gtk_entry_get_text(GTK_ENTRY(widget)); - if (name && pv && pv->v) - { - stp_parameter_t desc; - stp_vars_t *v = stp_vars_create_copy(pv->v); - stp_set_file_parameter(v, "PPDFile", name); - stp_describe_parameter(v, "ModelName", &desc); - if (desc.is_active) - gtk_label_set_text(GTK_LABEL(ppd_model), desc.deflt.str); - else - gtk_label_set_text(GTK_LABEL(ppd_model), ""); - stp_parameter_description_destroy(&desc); - stp_vars_destroy(v); - } - else - gtk_label_set_text(GTK_LABEL(ppd_model), ""); -} - -/* - * setup_open_callback() - - */ -static void -setup_open_callback (void) -{ - static gboolean first_time = TRUE; - manufacturer = stp_printer_get_manufacturer(stp_get_printer(pv->v)); - build_printer_driver_clist(); - - reset_preview (); - setup_update (); - -/* gtk_widget_set_sensitive(GTK_DIALOG(print_dialog)->action_area, FALSE); */ - gtk_widget_show (setup_dialog); - - if (first_time) - { - /* Make sure the driver scroller gets positioned correctly. */ - setup_update (); - first_time = FALSE; - } -} - -/* - * new_printer_open_callback() - - */ -static void -new_printer_open_callback (void) -{ - reset_preview (); - gtk_entry_set_text (GTK_ENTRY (new_printer_entry), ""); - gtk_widget_show (new_printer_dialog); -} - -static void -set_printer(void) -{ - manufacturer = stp_printer_get_manufacturer(tmp_printer); - build_printer_driver_clist(); - build_queue_combo(); - stp_set_driver (pv->v, stp_printer_get_driver (tmp_printer)); - stpui_plist_set_custom_command - (pv, gtk_entry_get_text (GTK_ENTRY (custom_command_entry))); - stpui_plist_set_output_filename - (pv, gtk_entry_get_text (GTK_ENTRY (file_entry))); - stp_set_file_parameter (pv->v, "PPDFile", - gtk_entry_get_text (GTK_ENTRY (ppd_file))); - gtk_label_set_text (GTK_LABEL (printer_model_label), - gettext (stp_printer_get_long_name (tmp_printer))); - - plist_callback (NULL, (gpointer) stpui_plist_current); -} - -/* - * setup_ok_callback() - - */ -static void -setup_ok_callback (void) -{ - gtk_widget_hide(ppd_browser); - gtk_widget_hide(file_browser); - gtk_widget_hide(setup_dialog); - set_printer(); - gtk_widget_set_sensitive(GTK_DIALOG(print_dialog)->action_area, TRUE); -} - -/* - * setup_cancel_callback() - - */ -static void -setup_cancel_callback (void) -{ - gtk_widget_hide(ppd_browser); - gtk_widget_hide(file_browser); - gtk_widget_hide(setup_dialog); - manufacturer = stp_printer_get_manufacturer(stp_get_printer(pv->v)); - build_printer_driver_clist(); - setup_update(); - gtk_widget_set_sensitive(GTK_DIALOG(print_dialog)->action_area, TRUE); -} - -/* - * setup_ok_callback() - - */ -static void -new_printer_ok_callback (void) -{ - const gchar *data = gtk_entry_get_text (GTK_ENTRY (new_printer_entry)); - stpui_plist_t key; - - if (strlen(data)) - { - memset(&key, 0, sizeof(key)); - stpui_printer_initialize (&key); - stpui_plist_copy(&key, pv); - stpui_plist_set_name(&key, data); - - if (stpui_plist_add (&key, 1)) - { - stp_vars_destroy(key.v); - g_free(key.name); - stpui_plist_current = stpui_plist_count - 1; - set_current_printer(); - build_printer_combo (); - set_printer(); - } - } - - gtk_widget_hide (new_printer_dialog); -} - -static void -pop_ppd_box(void) -{ - const stp_vars_t *v = stp_printer_get_defaults(tmp_printer); - if (stp_parameter_find_in_settings(v, "PPDFile")) - { - gtk_widget_show (ppd_label); - gtk_widget_show (ppd_box); - gtk_widget_show (ppd_model_label); - gtk_widget_show (ppd_model); - } - else - { - gtk_widget_hide (ppd_label); - gtk_widget_hide (ppd_box); - gtk_widget_hide (ppd_model_label); - gtk_widget_hide (ppd_model); - } -} - -static void -build_printer_driver_clist(void) -{ - int i; - int current_idx = 0; - gtk_clist_clear(GTK_CLIST(printer_driver)); - for (i = 0; i < stp_printer_model_count (); i ++) - { - const stp_printer_t *the_printer = stp_get_printer_by_index (i); - - if (strcmp(manufacturer, stp_printer_get_manufacturer(the_printer)) == 0) - { - gchar *tmp=g_strdup(gettext(stp_printer_get_long_name(the_printer))); - /* - * FIXME Somehow if the raw printer comes before any of the - * "real" printers in the list of printers created in module.c, - * this code barfs on any of those printers added later. For - * example, try listing olympus_LTX_stpi_module_data after - * raw_LTX_stpi_module_data. - */ - - gtk_clist_insert (GTK_CLIST (printer_driver), current_idx, &tmp); - gtk_clist_set_row_data (GTK_CLIST (printer_driver), current_idx, - (gpointer) i); - g_free(tmp); - current_idx++; - } - } -} - -static void -manufacturer_callback(GtkWidget *widget, /* I - Driver list */ - gint row, - gint column, - GdkEventButton *event, - gpointer data) -{ - static int calling_manufacturer_callback = 0; - gchar *text; - if (calling_manufacturer_callback) - return; - calling_manufacturer_callback++; - if (gtk_clist_get_text(GTK_CLIST(widget), row, column, &text)) - manufacturer = text; - build_printer_driver_clist(); - setup_update(); - calling_manufacturer_callback--; -} - -/* - * print_driver_callback() - Update the current printer driver. - */ -static void -print_driver_callback (GtkWidget *widget, /* I - Driver list */ - gint row, - gint column, - GdkEventButton *event, - gpointer data) /* I - Data */ -{ - char *tmp; - static int calling_print_driver_callback = 0; - if (calling_print_driver_callback) - return; - calling_print_driver_callback++; - invalidate_frame (); - invalidate_preview_thumbnail (); - reset_preview (); - data = gtk_clist_get_row_data (GTK_CLIST (widget), row); - tmp_printer = stp_get_printer_by_index ((gint) data); - tmp = stpui_build_standard_print_command(pv, tmp_printer); - gtk_entry_set_text(GTK_ENTRY(standard_cmd_entry), tmp); - g_free(tmp); - - pop_ppd_box(); - calling_print_driver_callback--; -} - -/* - * ppd_browse_callback() - - */ -static void -ppd_browse_callback (void) -{ - reset_preview (); - gtk_file_selection_set_filename (GTK_FILE_SELECTION (ppd_browser), - gtk_entry_get_text (GTK_ENTRY (ppd_file))); - gtk_widget_show (ppd_browser); -} - -/* - * ppd_ok_callback() - - */ -static void -ppd_ok_callback (void) -{ - reset_preview (); - gtk_widget_hide (ppd_browser); - gtk_entry_set_text - (GTK_ENTRY (ppd_file), - gtk_file_selection_get_filename (GTK_FILE_SELECTION (ppd_browser))); - ppd_file_callback(ppd_file, NULL); - update_options(); -} - -/* - * ppd_browse_callback() - - */ -static void -file_browse_callback (void) -{ - reset_preview (); - gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_browser), - gtk_entry_get_text (GTK_ENTRY (file_entry))); - gtk_widget_show (file_browser); -} - -/* - * file_ok_callback() - print to file and go away - */ -static void -file_ok_callback (void) -{ - const char *filename = - gtk_file_selection_get_filename(GTK_FILE_SELECTION(file_browser)); - gtk_widget_hide (file_browser); - gtk_entry_set_text(GTK_ENTRY(file_entry), filename); - stpui_plist_set_output_filename(pv, filename); - if (exit_after_file_ok) - { - runme = TRUE; - destroy_dialogs (); - } -} - -/* - * file_cancel_callback() - - */ -static void -file_cancel_callback (void) -{ - exit_after_file_ok = 0; - gtk_widget_hide (file_browser); - dialogs_set_sensitive (TRUE); -} - -static void -fill_buffer_writefunc(void *priv, const char *buffer, size_t bytes) -{ - int mask = 0; - int i; - - priv_t *p = (priv_t *) priv; - unsigned char *where = p->base_addr + p->offset; - const unsigned char *xbuffer = (const unsigned char *)buffer; - - if (strcmp(p->output_type, "Whitescale") == 0) - { - memcpy(where, xbuffer, bytes); - p->offset += bytes; - } - else if (strcmp(p->output_type, "Grayscale") == 0) - { - for (i = 0; i < bytes; i++) - where[i] = ~xbuffer[i]; - p->offset += bytes; - } - else if (strcmp(p->output_type, "RGB") == 0) - { - int pixels = bytes / 3; - if (bytes + p->offset > p->limit) - bytes = p->limit - p->offset; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(red_button))) - mask |= 1; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(green_button))) - mask |= 2; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(blue_button))) - mask |= 4; - - memset(where, 0, pixels * 3); - for (i = 0; i < pixels; i++) - { - if (mask & 1) - where[0] = xbuffer[0]; - if (mask & 2) - where[1] = xbuffer[1]; - if (mask & 4) - where[2] = xbuffer[2]; - where += 3; - xbuffer += 3; - } - p->offset += pixels * 3; - } - else if (strcmp(p->output_type, "CMY") == 0) - { - int pixels = bytes / 3; - if (bytes + p->offset > p->limit) - bytes = p->limit - p->offset; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cyan_button))) - mask |= 1; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(magenta_button))) - mask |= 2; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(yellow_button))) - mask |= 4; - - memset(where, 0xff, pixels * 3); - for (i = 0; i < pixels; i++) - { - if (mask & 1) - where[0] = ~xbuffer[0]; - if (mask & 2) - where[1] = ~xbuffer[1]; - if (mask & 4) - where[2] = ~xbuffer[2]; - where += 3; - xbuffer += 3; - } - p->offset += pixels * 3; - } - else - { - int pixels = bytes / 4; - if (bytes + p->offset > p->limit) - bytes = p->limit - p->offset; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cyan_button))) - mask |= 1; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(magenta_button))) - mask |= 2; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(yellow_button))) - mask |= 4; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(black_button))) - mask |= 8; - - memset(where, 0xff, pixels * 3); - for (i = 0; i < pixels; i++) - { - if (mask & 8) - { - where[0] -= xbuffer[3]; - where[1] -= xbuffer[3]; - where[2] -= xbuffer[3]; - } - if (mask & 1) - { - if (where[0] < xbuffer[0]) - where[0] = 0; - else - where[0] -= xbuffer[0]; - } - if (mask & 2) - { - if (where[1] < xbuffer[1]) - where[1] = 0; - else - where[1] -= xbuffer[1]; - } - if (mask & 4) - { - if (where[2] < xbuffer[2]) - where[2] = 0; - else - where[2] -= xbuffer[2]; - } - where += 3; - xbuffer += 4; - } - p->offset += pixels * 3; - } -} - -/* - * update_adjusted_thumbnail() - */ - -static void -redraw_color_swatch (void) -{ - static GdkGC *gc = NULL; - static GdkColormap *cmap; - - if (adjusted_thumbnail_data && swatch && swatch->widget.window) - { - if (gc == NULL) - { - gc = gdk_gc_new (swatch->widget.window); - cmap = gtk_widget_get_colormap (GTK_WIDGET(swatch)); - } - - if (!print_mode_is_color(pv->v)) - gdk_draw_gray_image(swatch->widget.window, gc, 0, 0, - thumbnail_w, thumbnail_h, GDK_RGB_DITHER_NORMAL, - adjusted_thumbnail_data, thumbnail_w); - else - gdk_draw_rgb_image(swatch->widget.window, gc, 0, 0, - thumbnail_w, thumbnail_h, GDK_RGB_DITHER_NORMAL, - adjusted_thumbnail_data, 3 * thumbnail_w); - } -} - -static void -initialize_thumbnail(void) -{ - int i; - if (stpui_get_thumbnail_func()) - { - const guchar *internal_thumbnail_data; - /* - * Fetch a thumbnail of the image we're to print from the Gimp. - */ - - thumbnail_w = thumbnail_hintw; - thumbnail_h = thumbnail_hinth; - internal_thumbnail_data = - (stpui_get_thumbnail_func()) (stpui_get_thumbnail_data(), &thumbnail_w, - &thumbnail_h, &thumbnail_bpp, 0); - if (adjusted_thumbnail_data) - g_free(adjusted_thumbnail_data); - if (preview_thumbnail_data) - g_free(preview_thumbnail_data); - if (thumbnail_data) - g_free(thumbnail_data); - - if (internal_thumbnail_data) - { - /* - * thumbnail_w and thumbnail_h have now been adjusted to the actual - * thumbnail dimensions. Now initialize a color-adjusted version of - * the thumbnail. - */ - - adjusted_thumbnail_data = g_malloc (3 * thumbnail_w * thumbnail_h); - preview_thumbnail_data = g_malloc (3 * thumbnail_w * thumbnail_h); - thumbnail_data = g_malloc (3 * thumbnail_w * thumbnail_h); - - switch (thumbnail_bpp) - { - case 1: - for (i = 0; i < thumbnail_w * thumbnail_h; i++) - { - gint val = internal_thumbnail_data[i]; - thumbnail_data[(3 * i) + 0] = val; - thumbnail_data[(3 * i) + 1] = val; - thumbnail_data[(3 * i) + 2] = val; - } - break; - case 3: - memcpy(thumbnail_data, internal_thumbnail_data, - 3 * thumbnail_w * thumbnail_h); - break; - case 2: - for (i = 0; i < thumbnail_w * thumbnail_h; i++) - { - gint val = internal_thumbnail_data[2 * i]; - gint alpha = internal_thumbnail_data[(2 * i) + 1]; - thumbnail_data[(3 * i) +0] = val * alpha / 255 + 255 - alpha; - thumbnail_data[(3 * i) +1] = val * alpha / 255 + 255 - alpha; - thumbnail_data[(3 * i) +2] = val * alpha / 255 + 255 - alpha; - } - break; - case 4: - for (i = 0; i < thumbnail_w * thumbnail_h; i++) - { - gint r = internal_thumbnail_data[(4 * i)]; - gint g = internal_thumbnail_data[(4 * i) + 1]; - gint b = internal_thumbnail_data[(4 * i) + 2]; - gint alpha = internal_thumbnail_data[(4 * i) + 3]; - thumbnail_data[(3 * i) + 0] = r * alpha / 255 + 255 - alpha; - thumbnail_data[(3 * i) + 1] = g * alpha / 255 + 255 - alpha; - thumbnail_data[(3 * i) + 2] = b * alpha / 255 + 255 - alpha; - } - break; - default: - break; - /* Whatever */ - } - thumbnail_bpp = 3; - } - else - { - thumbnail_h = 0; - thumbnail_w = 0; - } - } - else - { - thumbnail_h = 0; - thumbnail_w = 0; - } -} - -static int -compute_thumbnail(const stp_vars_t *v) -{ - priv_t priv; - int answer = 1; - stp_image_t *im = stpui_image_thumbnail_new(thumbnail_data, thumbnail_w, - thumbnail_h, thumbnail_bpp); - stp_vars_t *nv = stp_vars_create_copy(v); - const char *output_type = stp_describe_output(nv); - stp_set_top(nv, 0); - stp_set_left(nv, 0); - stp_set_width(nv, thumbnail_w); - stp_set_height(nv, thumbnail_h); - stp_set_outfunc(nv, fill_buffer_writefunc); - stp_set_outdata(nv, &priv); - stp_set_errfunc(nv, stpui_get_errfunc()); - stp_set_errdata(nv, stpui_get_errdata()); - if (strcmp(output_type, "Whitescale") == 0) - { - gtk_widget_hide(output_color_vbox); - priv.bpp = 1; - priv.output_type = "Whitescale"; - stp_set_string_parameter(nv, "InkType", "RGBGray"); - } - else if (strcmp(output_type, "Grayscale") == 0) - { - gtk_widget_hide(output_color_vbox); - priv.bpp = 1; - priv.output_type = "Grayscale"; - stp_set_string_parameter(nv, "InkType", "CMYGray"); - } - else if (strcmp(output_type, "CMY") == 0) - { - gtk_widget_hide(black_button); - gtk_widget_hide(red_button); - gtk_widget_hide(green_button); - gtk_widget_hide(blue_button); - gtk_widget_show(cyan_button); - gtk_widget_show(magenta_button); - gtk_widget_show(yellow_button); - gtk_widget_show(output_color_vbox); - priv.bpp = 3; - priv.output_type = "CMY"; - stp_set_string_parameter(nv, "InkType", "CMY"); - } - else if (strcmp(output_type, "RGB") == 0) - { - gtk_widget_hide(cyan_button); - gtk_widget_hide(magenta_button); - gtk_widget_hide(yellow_button); - gtk_widget_hide(black_button); - gtk_widget_show(red_button); - gtk_widget_show(green_button); - gtk_widget_show(blue_button); - gtk_widget_show(output_color_vbox); - priv.bpp = 3; - priv.output_type = "RGB"; - stp_set_string_parameter(nv, "InkType", "RGB"); - } - else - { - gtk_widget_hide(red_button); - gtk_widget_hide(green_button); - gtk_widget_hide(blue_button); - gtk_widget_show(cyan_button); - gtk_widget_show(magenta_button); - gtk_widget_show(yellow_button); - gtk_widget_show(black_button); - gtk_widget_show(output_color_vbox); - priv.bpp = 4; - priv.output_type = "CMYK"; - stp_set_string_parameter(nv, "InkType", "CMYK"); - } - stp_set_page_height(nv, thumbnail_h); - stp_set_page_width(nv, thumbnail_w); - stp_set_driver(nv, "raw-data-8"); - stp_set_float_parameter(nv, "Density", 1.0); - stp_set_float_parameter(nv, "InkLimit", 0); - stp_set_string_parameter(nv, "InputImageType", "RGB"); - - priv.base_addr = adjusted_thumbnail_data; - priv.offset = 0; - priv.limit = thumbnail_bpp * thumbnail_h * thumbnail_w; - - if (stp_verify(nv) != 1 || stp_print(nv, im) != 1) - { - answer = 0; - fprintf(stderr, "Could not print thumbnail!\n"); - } - stp_vars_destroy(nv); - thumbnail_needs_rebuild = FALSE; - return answer; -} - -static void -set_thumbnail_orientation(void) -{ - gint x, y; - gint preview_limit = (thumbnail_h * thumbnail_w) - 1; - gint bpp; - if (!print_mode_is_color(pv->v)) - bpp = 1; - else - bpp = 3; - switch (physical_orientation) - { - case ORIENT_PORTRAIT: - memcpy(preview_thumbnail_data, adjusted_thumbnail_data, - bpp * thumbnail_h * thumbnail_w); - break; - case ORIENT_SEASCAPE: - for (x = 0; x < thumbnail_w; x++) - for (y = 0; y < thumbnail_h; y++) - memcpy((preview_thumbnail_data + - bpp * (preview_limit - (x * thumbnail_h + y))), - (adjusted_thumbnail_data + - bpp * ((thumbnail_h - y - 1) * thumbnail_w + x)), bpp); - break; - - case ORIENT_UPSIDEDOWN: - for (x = 0; x < thumbnail_h * thumbnail_w; x++) - memcpy((preview_thumbnail_data + bpp * (preview_limit - x)), - adjusted_thumbnail_data + bpp * x, bpp); - break; - case ORIENT_LANDSCAPE: - for (x = 0; x < thumbnail_w; x++) - for (y = 0; y < thumbnail_h; y++) - memcpy((preview_thumbnail_data + bpp * (x * thumbnail_h + y)), - (adjusted_thumbnail_data + - bpp * ((thumbnail_h - y - 1) * thumbnail_w + x)), bpp); - break; - } -} - -static void -draw_arrow (GdkWindow *w, - GdkGC *gc, - gint paper_left, - gint paper_top) -{ - gint u = preview_ppi/2; - gint ox = paper_left + preview_ppi * paper_width / INCH / 2; - gint oy = paper_top + preview_ppi * paper_height / INCH / 2; - - oy -= preview_ppi * paper_height / INCH / 4; - if (oy < paper_top + u) - oy = paper_top + u; - gdk_draw_line (w, gc, ox, oy - u, ox - u, oy); - gdk_draw_line (w, gc, ox, oy - u, ox + u, oy); - gdk_draw_line (w, gc, ox, oy - u, ox, oy + u); -} - -static void -create_valid_preview(guchar **preview_data) -{ - if (adjusted_thumbnail_data) - { - gint bpp = (print_mode_is_color(pv->v)) ? 3 : 1; - gint v_denominator = preview_h > 1 ? preview_h - 1 : 1; - gint v_numerator = (preview_thumbnail_h - 1) % v_denominator; - gint v_whole = (preview_thumbnail_h - 1) / v_denominator; - gint h_denominator = preview_w > 1 ? preview_w - 1 : 1; - gint h_numerator = (preview_thumbnail_w - 1) % h_denominator; - gint h_whole = (preview_thumbnail_w - 1) / h_denominator; - gint adjusted_preview_width = bpp * preview_w; - gint adjusted_thumbnail_width = bpp * preview_thumbnail_w; - gint v_cur = 0; - gint v_last = -1; - gint v_error = v_denominator / 2; - gint y; - gint i; - - if (*preview_data) - g_free (*preview_data); - *preview_data = g_malloc (bpp * preview_h * preview_w); - - for (y = 0; y < preview_h; y++) - { - guchar *outbuf = *preview_data + adjusted_preview_width * y; - - if (v_cur == v_last) - memcpy (outbuf, outbuf-adjusted_preview_width, - adjusted_preview_width); - else - { - guchar *inbuf = preview_thumbnail_data - bpp - + adjusted_thumbnail_width * v_cur; - - gint h_cur = 0; - gint h_last = -1; - gint h_error = h_denominator / 2; - gint x; - - v_last = v_cur; - for (x = 0; x < preview_w; x++) - { - if (h_cur == h_last) - { - for (i = 0; i < bpp; i++) - outbuf[i] = outbuf[i - bpp]; - } - else - { - inbuf += bpp * (h_cur - h_last); - h_last = h_cur; - for (i = 0; i < bpp; i++) - outbuf[i] = inbuf[i]; - } - outbuf += bpp; - h_cur += h_whole; - h_error += h_numerator; - if (h_error >= h_denominator) - { - h_error -= h_denominator; - h_cur++; - } - } - } - v_cur += v_whole; - v_error += v_numerator; - if (v_error >= v_denominator) - { - v_error -= v_denominator; - v_cur++; - } - } - preview_valid = TRUE; - } -} - -/* - * preview_update_callback() - - */ -static void -do_preview_thumbnail (void) -{ - static GdkGC *gc = NULL; - static GdkGC *gcinv = NULL; - static GdkGC *gcset = NULL; - static guchar *preview_data = NULL; - gint opx = preview_x; - gint opy = preview_y; - gint oph = preview_h; - gint opw = preview_w; - gint paper_display_left, paper_display_top; - gint printable_display_left, printable_display_top; - gint paper_display_width, paper_display_height; - gint printable_display_width, printable_display_height; - int l_bottom = stp_get_top(pv->v) + stp_get_height(pv->v); - int l_right = stp_get_left(pv->v) + stp_get_width(pv->v); - - preview_ppi = preview_size_horiz * FINCH / (gdouble) paper_width; - - if (preview_ppi > preview_size_vert * FINCH / (gdouble) paper_height) - preview_ppi = preview_size_vert * FINCH / (gdouble) paper_height; - if (preview_ppi > MAX_PREVIEW_PPI) - preview_ppi = MAX_PREVIEW_PPI; - - if (preview == NULL || preview->widget.window == NULL) - return; - /* - * Center the page on the preview - */ - paper_display_width = MAX(3, ROUNDUP(preview_ppi * paper_width, INCH)); - paper_display_height = MAX(3, ROUNDUP(preview_ppi * paper_height, INCH)); - - paper_display_left = (preview_size_horiz - paper_display_width) / 2; - paper_display_top = (preview_size_vert - paper_display_height) / 2; - - printable_display_width = - MAX(3, ROUNDUP(preview_ppi * printable_width, INCH)); - printable_display_height = - MAX(3, ROUNDUP(preview_ppi * printable_height, INCH)); - - printable_display_left = paper_display_left + preview_ppi * left / INCH; - printable_display_top = paper_display_top + preview_ppi * top / INCH ; - - preview_x = - 1 + paper_display_left + preview_ppi * stp_get_left (pv->v) / INCH; - preview_y = - 1 + paper_display_top + preview_ppi * stp_get_top (pv->v) / INCH; - - if (!preview_valid) - { - gint preview_r = 1 + paper_display_left + preview_ppi * l_right / INCH; - gint preview_b = 1 + paper_display_top + preview_ppi * l_bottom / INCH; - preview_w = preview_r - preview_x; - preview_h = preview_b - preview_y; - if (preview_w >= printable_display_width) - preview_w = printable_display_width - 1; - if (preview_h >= printable_display_height) - preview_h = printable_display_height - 1; - } - - if (preview_w + preview_x > printable_display_left + printable_display_width) - preview_x--; - if (preview_h + preview_y > printable_display_top + printable_display_height) - preview_y--; - - if (gc == NULL) - { - gc = gdk_gc_new (preview->widget.window); - gcinv = gdk_gc_new (preview->widget.window); - gdk_gc_set_function (gcinv, GDK_INVERT); - gcset = gdk_gc_new (preview->widget.window); - gdk_gc_set_function (gcset, GDK_SET); - } - - if (!preview_valid) - create_valid_preview(&preview_data); - - if (printable_display_left < paper_display_left) - printable_display_left = paper_display_left; - if (printable_display_top < paper_display_top) - printable_display_top = paper_display_top; - if (printable_display_left + printable_display_width > - paper_display_left + paper_display_width) - printable_display_width = - paper_display_width - (paper_display_left - printable_display_left); - if (printable_display_top + printable_display_height > - paper_display_top + paper_display_height) - printable_display_height = - paper_display_height - (paper_display_top - printable_display_top); - if (need_exposure) - { - if (!frame_valid) - { - gdk_window_clear (preview->widget.window); - frame_valid = TRUE; - } - /* draw paper frame */ - gdk_draw_rectangle (preview->widget.window, gc, 0, - paper_display_left, paper_display_top, - paper_display_width, paper_display_height); - - /* draw printable frame */ - gdk_draw_rectangle (preview->widget.window, gc, 0, - printable_display_left, printable_display_top, - printable_display_width, printable_display_height); - need_exposure = FALSE; - } - else if (!frame_valid) - { - gdk_window_clear (preview->widget.window); - /* draw paper frame */ - gdk_draw_rectangle (preview->widget.window, gc, 0, - paper_display_left, paper_display_top, - paper_display_width, paper_display_height); - - /* draw printable frame */ - gdk_draw_rectangle (preview->widget.window, gc, 0, - printable_display_left, printable_display_top, - printable_display_width, printable_display_height); - frame_valid = TRUE; - } - else - { - if (opx + opw <= preview_x || opy + oph <= preview_y || - preview_x + preview_w <= opx || preview_y + preview_h <= opy) - { - gdk_window_clear_area (preview->widget.window, opx, opy, opw, oph); - } - else - { - if (opx < preview_x) - gdk_window_clear_area (preview->widget.window, - opx, opy, preview_x - opx, oph); - if (opy < preview_y) - gdk_window_clear_area (preview->widget.window, - opx, opy, opw, preview_y - opy); - if (opx + opw > preview_x + preview_w) - gdk_window_clear_area (preview->widget.window, - preview_x + preview_w, opy, - (opx + opw) - (preview_x + preview_w), oph); - if (opy + oph > preview_y + preview_h) - gdk_window_clear_area (preview->widget.window, - opx, preview_y + preview_h, - opw, (opy + oph) - (preview_y + preview_h)); - } - } - - draw_arrow (preview->widget.window, gcset, paper_display_left, - paper_display_top); - - if (!preview_valid) - gdk_draw_rectangle (preview->widget.window, gc, 1, - preview_x, preview_y, preview_w, preview_h); - else if (!print_mode_is_color(pv->v)) - gdk_draw_gray_image (preview->widget.window, gc, - preview_x, preview_y, preview_w, preview_h, - GDK_RGB_DITHER_NORMAL, preview_data, preview_w); - else - gdk_draw_rgb_image (preview->widget.window, gc, - preview_x, preview_y, preview_w, preview_h, - GDK_RGB_DITHER_NORMAL, preview_data, 3 * preview_w); - - /* If we're printing full bleed, redisplay the paper frame */ - if (preview_x <= paper_display_left || opx <= paper_display_left || - preview_y <= paper_display_top || opy <= paper_display_top || - preview_x + preview_w >= paper_display_left + paper_display_width || - opx + opw >= paper_display_left + paper_display_width || - preview_y + preview_h >= paper_display_top + paper_display_height || - opy + oph >= paper_display_top + paper_display_height) - gdk_draw_rectangle (preview->widget.window, gc, 0, - paper_display_left, paper_display_top, - paper_display_width, paper_display_height); - - - /* draw orientation arrow pointing to top-of-paper */ - draw_arrow (preview->widget.window, gcinv, paper_display_left, - paper_display_top); - gdk_flush(); -} - -static gboolean -idle_preview_thumbnail(gpointer data) -{ - if (thumbnail_data && adjusted_thumbnail_data && do_update_thumbnail) - { - thumbnail_update_pending = TRUE; - set_orientation(pv->orientation); - if (thumbnail_needs_rebuild && compute_thumbnail(pv->v)) - { - set_thumbnail_orientation(); - redraw_color_swatch (); - } - do_preview_thumbnail(); - } - thumbnail_update_pending = FALSE; - return FALSE; -} - -static void -update_adjusted_thumbnail (gboolean regenerate_image) -{ - if (regenerate_image) - thumbnail_needs_rebuild = TRUE; - preview_update (); -} - -static void -preview_expose (void) -{ - need_exposure = TRUE; - preview_update (); -} - -static void -preview_update (void) -{ - gdouble max_ppi_scaling; /* Maximum PPI for current page size */ - gdouble min_ppi_scaling; /* Minimum PPI for current page size */ - - suppress_preview_update++; - compute_printable_region(); - - if (pv->scaling < 0) - { - gdouble twidth; - - compute_scaling_limits(&min_ppi_scaling, &max_ppi_scaling); - - if (pv->scaling < 0 && pv->scaling > -min_ppi_scaling) - pv->scaling = -min_ppi_scaling; - - twidth = (FINCH * (gdouble) image_width / -pv->scaling); - print_width = twidth + .5; - print_height = (twidth * (gdouble) image_height / image_width) + .5; - GTK_ADJUSTMENT (scaling_adjustment)->lower = min_ppi_scaling; - GTK_ADJUSTMENT (scaling_adjustment)->upper = max_ppi_scaling; - GTK_ADJUSTMENT (scaling_adjustment)->value = -pv->scaling; - - if (!suppress_scaling_adjustment) - { - suppress_preview_reset++; - gtk_adjustment_changed (GTK_ADJUSTMENT (scaling_adjustment)); - suppress_scaling_callback = TRUE; - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scaling_ppi), TRUE); - suppress_scaling_callback = FALSE; - gtk_adjustment_value_changed (GTK_ADJUSTMENT (scaling_adjustment)); - suppress_preview_reset--; - } - } - else if (auto_paper_size) - { - gdouble twidth = printable_width * pv->scaling / 100; - - print_width = twidth + .5; - print_height = - (twidth * (gdouble) image_height / (gdouble) image_width) + .5; - } - else - { - /* we do pv->scaling % of height or width, whatever is less */ - /* this is relative to printable size */ - if (image_width * printable_height > printable_width * image_height) - /* if image_width/image_height > printable_width/printable_height */ - /* i.e. if image is wider relative to its height than the width - of the printable area relative to its height */ - { - gdouble twidth = printable_width * pv->scaling / 100; - - print_width = twidth + .5; - print_height = - (twidth * (gdouble) image_height / (gdouble) image_width) + .5; - } - else - { - gdouble theight = printable_height * pv->scaling /100; - - print_height = theight + .5; - print_width = - (theight * (gdouble) image_width / (gdouble) image_height) + .5; - } - } - - if (auto_paper_size) - set_media_size(stp_get_string_parameter(pv->v, "PageSize")); - - stp_set_width(pv->v, print_width); - stp_set_height(pv->v, print_height); - - if (pv->invalid_mask & INVALID_LEFT) - stp_set_left (pv->v, (paper_width - print_width) / 2); - - if (stp_get_left(pv->v) < left) - stp_set_left(pv->v, left); - - if (stp_get_left (pv->v) > right - print_width) - stp_set_left (pv->v, right - print_width); - - if (pv->invalid_mask & INVALID_TOP) - stp_set_top (pv->v, ((paper_height - print_height) / 2)); - if (stp_get_top(pv->v) < top) - stp_set_top(pv->v, top); - - if (stp_get_top (pv->v) > bottom - print_height) - stp_set_top (pv->v, bottom - print_height); - - pv->invalid_mask = 0; - - set_all_entry_values(); - suppress_preview_update--; - - /* draw image */ - if (! suppress_preview_update && !thumbnail_update_pending) - { - thumbnail_update_pending = TRUE; - g_idle_add(idle_preview_thumbnail, NULL); - } -} - -/* - * preview_button_callback() - - */ -static void -preview_button_callback (GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - if (event->type == GDK_BUTTON_PRESS) - { - if (preview_active == 0) - { - mouse_x = event->x; - mouse_y = event->y; - orig_left = stp_get_left (pv->v); - orig_top = stp_get_top (pv->v); - mouse_button = event->button; - buttons_mask = 1 << event->button; - buttons_pressed++; - preview_active = 1; - stpui_disable_help(); - move_constraint = - (event->state & GDK_SHIFT_MASK) ? MOVE_CONSTRAIN : MOVE_ANY; - if (event->state & GDK_CONTROL_MASK) - move_constraint |= MOVE_GRID; - } - else if ((buttons_mask & (1 << event->button)) == 0) - { - if (preview_active == 1) - { - stpui_enable_help(); - preview_active = -1; - stp_set_left (pv->v, orig_left); - stp_set_top (pv->v, orig_top); - preview_update (); - } - buttons_mask |= 1 << event->button; - buttons_pressed++; - } - } - else if (event->type == GDK_BUTTON_RELEASE) - { - buttons_pressed--; - buttons_mask &= ~(1 << event->button); - if (buttons_pressed == 0) - { - stpui_enable_help (); - preview_active = 0; - } - } -} - -/* - * preview_motion_callback() - - */ -static void -preview_motion_callback (GtkWidget *widget, - GdkEventMotion *event, - gpointer data) -{ - - gint old_top = stp_get_top (pv->v); - gint old_left = stp_get_left (pv->v); - gint new_top = old_top; - gint new_left = old_left; - gint steps; - if (preview_active != 1 || event->type != GDK_MOTION_NOTIFY) - return; - if (move_constraint == MOVE_CONSTRAIN) - { - int dx = abs(event->x - mouse_x); - int dy = abs(event->y - mouse_y); - if (dx > dy && dx > 3) - move_constraint = MOVE_HORIZONTAL; - else if (dy > dx && dy > 3) - move_constraint = MOVE_VERTICAL; - else - return; - } - - switch (mouse_button) - { - case 1: - if (move_constraint & MOVE_VERTICAL) - new_top = orig_top + INCH * (event->y - mouse_y) / preview_ppi; - if (move_constraint & MOVE_HORIZONTAL) - new_left = orig_left + INCH * (event->x - mouse_x) / preview_ppi; - break; - case 3: - if (move_constraint & MOVE_VERTICAL) - new_top = orig_top + event->y - mouse_y; - if (move_constraint & MOVE_HORIZONTAL) - new_left = orig_left + event->x - mouse_x; - break; - case 2: - if (move_constraint & MOVE_HORIZONTAL) - { - gint increment_width = - ((move_constraint & MOVE_GRID) && pv->scaling > 0) ? - printable_width * pv->scaling / 100 : print_width; - gint x_threshold = MAX (1, (preview_ppi * increment_width) / INCH); - if (event->x > mouse_x) - steps = MIN((event->x - mouse_x) / x_threshold, - ((right - orig_left) / increment_width) - 1); - else - steps = -(MIN((mouse_x - event->x) / x_threshold, - (orig_left - left) / increment_width)); - new_left = orig_left + steps * increment_width; - } - if (move_constraint & MOVE_VERTICAL) - { - gint increment_height = - ((move_constraint & MOVE_GRID) && pv->scaling > 0) ? - printable_height * pv->scaling / 100 : print_height; - gint y_threshold = MAX (1, (preview_ppi * increment_height) / INCH); - if (event->y > mouse_y) - steps = MIN((event->y - mouse_y) / y_threshold, - ((bottom - orig_top) / increment_height) - 1); - else - steps = -(MIN((mouse_y - event->y) / y_threshold, - (orig_top - top) / increment_height)); - new_top = orig_top + steps * increment_height; - } - break; - } - - if (new_top < top) - new_top = top; - if (new_top > bottom - print_height) - new_top = bottom - print_height; - if (new_left < left) - new_left = left; - if (new_left > right - print_width) - new_left = right - print_width; - - if (new_top != old_top || new_left != old_left) - { - stp_set_top (pv->v, new_top); - stp_set_left (pv->v, new_left); - preview_update (); - } -} - -static void -color_update (GtkAdjustment *adjustment) -{ - int i; - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - if (opt->fast_desc->p_type == STP_PARAMETER_TYPE_DOUBLE && - opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL && - opt->info.flt.adjustment && - adjustment == GTK_ADJUSTMENT(opt->info.flt.adjustment)) - { - invalidate_preview_thumbnail (); - if (stp_get_float_parameter(pv->v, opt->fast_desc->name) != - adjustment->value) - { - stp_set_float_parameter(pv->v, opt->fast_desc->name, - adjustment->value); - update_adjusted_thumbnail(TRUE); - } - } - } -} - -static void -dimension_update (GtkAdjustment *adjustment) -{ - int i; - gdouble unit_scaler = units[pv->unit].scale; - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - if (opt->fast_desc->p_type == STP_PARAMETER_TYPE_DIMENSION && - opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL && - opt->info.flt.adjustment && - adjustment == GTK_ADJUSTMENT(opt->info.flt.adjustment)) - { - invalidate_preview_thumbnail (); - if (stp_get_dimension_parameter(pv->v, opt->fast_desc->name) != - adjustment->value * unit_scaler) - { - stp_set_dimension_parameter(pv->v, opt->fast_desc->name, - adjustment->value * unit_scaler); - update_adjusted_thumbnail(FALSE); - } - } - } -} - -static void -set_controls_active (GtkObject *checkbutton, gpointer xopt) -{ - option_t *opt = (option_t *) xopt; - stp_parameter_t desc; - gboolean setting = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton)); - if (setting && opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL) - { - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_DOUBLE: - set_adjustment_active(opt, TRUE, FALSE); - if (! stp_check_float_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - { - stp_describe_parameter(pv->v, opt->fast_desc->name, &desc); - stp_set_float_parameter(pv->v, opt->fast_desc->name, - desc.deflt.dbl); - stp_parameter_description_destroy(&desc); - } - stp_set_float_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE); - break; - case STP_PARAMETER_TYPE_DIMENSION: - set_adjustment_active(opt, TRUE, FALSE); - if (! stp_check_dimension_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - { - stp_describe_parameter(pv->v, opt->fast_desc->name, &desc); - stp_set_dimension_parameter(pv->v, opt->fast_desc->name, - desc.deflt.dimension); - stp_parameter_description_destroy(&desc); - } - stp_set_dimension_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE); - break; - case STP_PARAMETER_TYPE_CURVE: - set_curve_active(opt, TRUE, FALSE); - if (! stp_check_curve_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - { - stp_describe_parameter(pv->v, opt->fast_desc->name, &desc); - stp_set_curve_parameter(pv->v, opt->fast_desc->name, - desc.deflt.curve); - stp_parameter_description_destroy(&desc); - } - stp_set_curve_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE); - break; - case STP_PARAMETER_TYPE_STRING_LIST: - set_combo_active(opt, TRUE, FALSE); - if (! stp_check_string_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - { - stp_describe_parameter(pv->v, opt->fast_desc->name, &desc); - stp_set_string_parameter(pv->v, opt->fast_desc->name, - desc.deflt.str); - stp_parameter_description_destroy(&desc); - } - stp_set_string_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - set_bool_active(opt, TRUE, FALSE); - if (! stp_check_boolean_parameter(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE)) - { - stp_describe_parameter(pv->v, opt->fast_desc->name, &desc); - stp_set_boolean_parameter(pv->v, opt->fast_desc->name, - desc.deflt.boolean); - stp_parameter_description_destroy(&desc); - } - stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_ACTIVE); - break; - default: - break; - } - } - else - { - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_DOUBLE: - set_adjustment_active(opt, FALSE, FALSE); - stp_set_float_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_DIMENSION: - set_adjustment_active(opt, FALSE, FALSE); - stp_set_dimension_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_CURVE: - set_curve_active(opt, FALSE, FALSE); - stp_set_curve_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_STRING_LIST: - set_combo_active(opt, FALSE, FALSE); - stp_set_string_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - case STP_PARAMETER_TYPE_BOOLEAN: /* ??? */ - set_bool_active(opt, FALSE, FALSE); - stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, - STP_PARAMETER_INACTIVE); - break; - default: - break; - } - } - invalidate_preview_thumbnail(); - update_adjusted_thumbnail(TRUE); -} - -static void -set_printer_defaults (void) -{ - int i; - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - if (opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL && - opt->fast_desc->p_class == STP_PARAMETER_CLASS_FEATURE && - opt->is_active && !opt->fast_desc->read_only) - { - stp_parameter_activity_t active; - gdouble unit_scaler; - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_DOUBLE: - active = - stp_get_float_parameter_active(pv->v, opt->fast_desc->name); - stp_set_float_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt); - stp_set_float_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_DIMENSION: - unit_scaler = units[pv->unit].scale; - active = - stp_get_dimension_parameter_active(pv->v, - opt->fast_desc->name); - stp_set_dimension_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt * unit_scaler); - stp_set_dimension_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - active = - stp_get_boolean_parameter_active(pv->v, opt->fast_desc->name); - stp_set_boolean_parameter(pv->v, opt->fast_desc->name, - opt->info.bool.deflt); - stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_STRING_LIST: - active = - stp_get_string_parameter_active(pv->v, opt->fast_desc->name); - stp_set_string_parameter(pv->v, opt->fast_desc->name, - opt->info.list.default_val); - stp_set_string_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - default: - break; - } - } - } - - do_all_updates (); -} - -static void -set_color_defaults (void) -{ - int i; - for (i = 0; i < current_option_count; i++) - { - option_t *opt = &(current_options[i]); - if (opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL && - opt->fast_desc->p_class == STP_PARAMETER_CLASS_OUTPUT && - opt->is_active && !opt->fast_desc->read_only) - { - stp_parameter_activity_t active; - gdouble unit_scaler; - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_DOUBLE: - active = - stp_get_float_parameter_active(pv->v, opt->fast_desc->name); - stp_set_float_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt); - stp_set_float_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_DIMENSION: - unit_scaler = units[pv->unit].scale; - active = - stp_get_dimension_parameter_active(pv->v, - opt->fast_desc->name); - stp_set_dimension_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt * unit_scaler); - stp_set_dimension_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - active = - stp_get_boolean_parameter_active(pv->v, opt->fast_desc->name); - stp_set_boolean_parameter(pv->v, opt->fast_desc->name, - opt->info.bool.deflt); - stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_STRING_LIST: - active = - stp_get_string_parameter_active(pv->v, opt->fast_desc->name); - stp_set_string_parameter(pv->v, opt->fast_desc->name, - opt->info.list.default_val); - stp_set_string_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - default: - break; - } - } - } - - do_color_updates (); -} - -gint -stpui_do_print_dialog(void) -{ - /* - * Get printrc options... - */ - stpui_printrc_load (); - - /* - * Print dialog window... - */ - create_main_window(); - - gtk_main (); - gdk_flush (); - - /* - * Set printrc options... - */ - if (saveme) - stpui_printrc_save (); - - /* - * Return ok/cancel... - */ - return (runme); -} diff --git a/src/gutenprintui/plist.c b/src/gutenprintui/plist.c deleted file mode 100644 index ecd6234..0000000 --- a/src/gutenprintui/plist.c +++ /dev/null @@ -1,1793 +0,0 @@ -/* - * "$Id: plist.c,v 1.3.6.2 2007/12/15 20:35:42 rlk Exp $" - * - * Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com) and - * 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 <gutenprint/gutenprint-intl-internal.h> -#include <gutenprint/gutenprint.h> -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" - -#include <unistd.h> -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <locale.h> - -#include <sys/types.h> -#include <signal.h> -#include <sys/wait.h> - - -typedef enum -{ - PRINTERS_NONE, - PRINTERS_LPC, - PRINTERS_LPSTAT -} printer_system_t; - -static int compare_printers (stpui_plist_t *p1, stpui_plist_t *p2); - -int stpui_plist_current = 0, /* Current system printer */ - stpui_plist_count = 0; /* Number of system printers */ -stpui_plist_t *stpui_plist; /* System printers */ -int stpui_show_all_paper_sizes = 0; -static char *printrc_name = NULL; -static char *image_type; -static gint image_raw_channels = 0; -static gint image_channel_depth = 8; -static stp_string_list_t *default_parameters = NULL; -stp_string_list_t *stpui_system_print_queues; -static const char *copy_count_name = "STPUICopyCount"; - -#define SAFE_FREE(x) \ -do \ -{ \ - if ((x)) \ - g_free((char *)(x)); \ - ((x)) = NULL; \ -} while (0) - -typedef struct -{ - const char *printing_system_name; - const char *printing_system_text; - const char *print_command; - const char *queue_select; - const char *raw_flag; - const char *key_file; - const char *scan_command; - const char *copy_count_command; -} print_system_t; - -/* - * Generic printing system, based on SysV lp - */ -static const print_system_t default_printing_system = - { "SysV", N_("System V lp"), "lp -s", "-d", "-oraw", "/usr/bin/lp", - "/usr/bin/lpstat -v | grep -i '^device for ' | awk '{print $3}' | sed 's/://'", - "-n" }; - -static print_system_t known_printing_systems[] = -{ - { "CUPS", N_("CUPS"), "lp -s", "-d", "-oraw", "/usr/sbin/cupsd", - "/usr/bin/lpstat -v | grep -i '^device for ' | awk '{print $3}' | sed 's/://'", - "-n" }, - { "SysV", N_("System V lp"), "lp -s", "-d", "-oraw", "/usr/bin/lp", - "/usr/bin/lpstat -v | grep -i '^device for ' | awk '{print $3}' | sed 's/://'", - "-n" }, - { "lpd", N_("Berkeley lpd (/etc/lpc)"), "lpr", "-P", "-l", "/etc/lpc", - "/etc/lpc status | grep '^...*:' | sed 's/:.*//'", - "-#" }, - { "lpd", N_("Berkeley lpd (/usr/bsd/lpc)"), "lpr", "-P", "-l", "/usr/bsd/lpc", - "/usr/bsd/lpc status | grep '^...*:' | sed 's/:.*//'", - "-#" }, - { "lpd", N_("Berkeley lpd (/usr/etc/lpc"), "lpr", "-P", "-l", "/usr/etc/lpc", - "/usr/etc/lpc status | grep '^...*:' | sed 's/:.*//'", - "-#" }, - { "lpd", N_("Berkeley lpd (/usr/libexec/lpc)"), "lpr", "-P", "-l", "/usr/libexec/lpc", - "/usr/libexec/lpc status | grep '^...*:' | sed 's/:.*//'", - "-#" }, - { "lpd", N_("Berkeley lpd (/usr/sbin/lpc)"), "lpr", "-P", "-l", "/usr/sbin/lpc", - "/usr/sbin/lpc status | grep '^...*:' | sed 's/:.*//'", - "-#" }, -}; - -static unsigned print_system_count = sizeof(known_printing_systems) / sizeof(print_system_t); - -static const print_system_t *global_printing_system = NULL; - -static void -initialize_default_parameters(void) -{ - default_parameters = stp_string_list_create(); - stp_string_list_add_string(default_parameters, "PrintingSystem", "Autodetect"); - stp_string_list_add_string(default_parameters, "PrintCommand", ""); - stp_string_list_add_string(default_parameters, "QueueSelect", ""); - stp_string_list_add_string(default_parameters, "RawOutputFlag", ""); - stp_string_list_add_string(default_parameters, "ScanOnStartup", "False"); - stp_string_list_add_string(default_parameters, "ScanPrintersCommand", ""); -} - -void -stpui_set_global_parameter(const char *param, const char *value) -{ - stp_string_list_remove_string(default_parameters, param); - stp_string_list_add_string(default_parameters, param, value); -} - -const char * -stpui_get_global_parameter(const char *param) -{ - stp_param_string_t *ps = stp_string_list_find(default_parameters, param); - if (ps) - return ps->text; - else - return NULL; -} - -static const print_system_t * -identify_print_system(void) -{ - int i; - if (!global_printing_system) - { - for (i = 0; i < print_system_count; i++) - { - if (!access(known_printing_systems[i].key_file, R_OK)) - { - global_printing_system = &(known_printing_systems[i]); - break; - } - } - if (!global_printing_system) - global_printing_system = &default_printing_system; - } - return global_printing_system; -} - -char * -stpui_build_standard_print_command(const stpui_plist_t *plist, - const stp_printer_t *printer) -{ - const char *queue_name = stpui_plist_get_queue_name(plist); - const char *extra_options = stpui_plist_get_extra_printer_options(plist); - const char *family = stp_printer_get_family(printer); - int copy_count = stpui_plist_get_copy_count(plist); - int raw = 0; - char *print_cmd; - char *count_string = NULL; - if (!queue_name) - queue_name = ""; - identify_print_system(); - if (strcmp(family, "ps") == 0) - raw = 0; - else - raw = 1; - - if (copy_count > 1) - stp_asprintf(&count_string, "%s %d ", - global_printing_system->copy_count_command, copy_count); - - stp_asprintf(&print_cmd, "%s %s %s %s %s%s%s", - global_printing_system->print_command, - queue_name[0] ? global_printing_system->queue_select : "", - queue_name[0] ? queue_name : "", - count_string ? count_string : "", - raw ? global_printing_system->raw_flag : "", - extra_options ? " " : "", - extra_options ? extra_options : ""); - SAFE_FREE(count_string); - return print_cmd; -} - -static void -append_external_options(char **command, const stp_vars_t *v) -{ - stp_string_list_t *external_options; - if (! command || ! *command) - return; - external_options = stp_get_external_options(v); - if (external_options) - { - int count = stp_string_list_count(external_options); - int i; - for (i = 0; i < count; i++) - { - stp_param_string_t *param = stp_string_list_param(external_options, i); - /* No g_shell_quote in glib 1.2...unfortunate */ - stp_catprintf(command, " -o'%s'='%s'", param->name, param->text); - } - stp_string_list_destroy(external_options); - } -} - - -void -stpui_set_printrc_file(const char *name) -{ - if (name && name == printrc_name) - return; - SAFE_FREE(printrc_name); - if (name) - printrc_name = g_strdup(name); - else - { - const char *where = getenv("HOME"); - if (where) - printrc_name = g_strconcat(where, "/.gutenprintrc", NULL); - } -} - -const char * -stpui_get_printrc_file(void) -{ - if (!printrc_name) - stpui_set_printrc_file(NULL); - return printrc_name; -} - -#define PLIST_ACCESSORS(name) \ -void \ -stpui_plist_set_##name(stpui_plist_t *p, const char *val) \ -{ \ - if (p->name == val) \ - return; \ - SAFE_FREE(p->name); \ - p->name = g_strdup(val); \ -} \ - \ -void \ -stpui_plist_set_##name##_n(stpui_plist_t *p, const char *val, int n) \ -{ \ - if (p->name == val) \ - return; \ - SAFE_FREE(p->name); \ - p->name = g_strndup(val, n); \ -} \ - \ -const char * \ -stpui_plist_get_##name(const stpui_plist_t *p) \ -{ \ - return p->name; \ -} - -PLIST_ACCESSORS(output_filename) -PLIST_ACCESSORS(name) -PLIST_ACCESSORS(queue_name) -PLIST_ACCESSORS(extra_printer_options) -PLIST_ACCESSORS(custom_command) -PLIST_ACCESSORS(current_standard_command) - -void -stpui_plist_set_command_type(stpui_plist_t *p, command_t val) -{ - switch (val) - { - case COMMAND_TYPE_DEFAULT: - case COMMAND_TYPE_CUSTOM: - case COMMAND_TYPE_FILE: - p->command_type = val; - break; - default: - p->command_type = COMMAND_TYPE_DEFAULT; - } -} - -command_t -stpui_plist_get_command_type(const stpui_plist_t *p) -{ - return p->command_type; -} - -void -stpui_plist_set_copy_count(stpui_plist_t *p, gint copy_count) -{ - if (copy_count > 0) - stp_set_int_parameter(p->v, copy_count_name, copy_count); -} - -gint -stpui_plist_get_copy_count(const stpui_plist_t *p) -{ - if (stp_check_int_parameter(p->v, copy_count_name, STP_PARAMETER_ACTIVE)) - return stp_get_int_parameter(p->v, copy_count_name); - else - return 1; -} - -void -stpui_set_image_type(const char *itype) -{ - image_type = g_strdup(itype); -} - -void -stpui_set_image_raw_channels(gint channels) -{ - image_raw_channels = channels; -} - -void -stpui_set_image_channel_depth(gint depth) -{ - image_channel_depth = depth; -} - -static void -writefunc(void *file, const char *buf, size_t bytes) -{ - FILE *prn = (FILE *)file; - fwrite(buf, 1, bytes, prn); -} - -static void -stpui_errfunc(void *file, const char *buf, size_t bytes) -{ - g_message(buf); -} - -void -stpui_printer_initialize(stpui_plist_t *printer) -{ - char tmp[32]; - stpui_plist_set_name(printer, ""); - stpui_plist_set_output_filename(printer, ""); - stpui_plist_set_queue_name(printer, ""); - stpui_plist_set_extra_printer_options(printer, ""); - stpui_plist_set_custom_command(printer, ""); - stpui_plist_set_current_standard_command(printer, ""); - printer->command_type = COMMAND_TYPE_DEFAULT; - printer->scaling = 100.0; - printer->orientation = ORIENT_AUTO; - printer->auto_size_roll_feed_paper = 0; - printer->unit = 0; - printer->v = stp_vars_create(); - stp_set_errfunc(printer->v, writefunc); - stp_set_errdata(printer->v, stderr); - stpui_plist_set_copy_count(printer, 1); - stp_set_string_parameter(printer->v, "InputImageType", image_type); - if (image_raw_channels) - { - (void) sprintf(tmp, "%d", image_raw_channels); - stp_set_string_parameter(printer->v, "RawChannels", tmp); - } - if (image_channel_depth) - { - (void) sprintf(tmp, "%d", image_channel_depth); - stp_set_string_parameter(printer->v, "ChannelBitDepth", tmp); - } - printer->invalid_mask = INVALID_TOP | INVALID_LEFT; -} - -static void -stpui_plist_destroy(stpui_plist_t *printer) -{ - SAFE_FREE(printer->name); - SAFE_FREE(printer->queue_name); - SAFE_FREE(printer->extra_printer_options); - SAFE_FREE(printer->custom_command); - SAFE_FREE(printer->current_standard_command); - SAFE_FREE(printer->output_filename); - stp_vars_destroy(printer->v); -} - -void -stpui_plist_copy(stpui_plist_t *vd, const stpui_plist_t *vs) -{ - if (vs == vd) - return; - stp_vars_copy(vd->v, vs->v); - vd->scaling = vs->scaling; - vd->orientation = vs->orientation; - vd->auto_size_roll_feed_paper = vs->auto_size_roll_feed_paper; - vd->unit = vs->unit; - vd->invalid_mask = vs->invalid_mask; - vd->command_type = vs->command_type; - stpui_plist_set_name(vd, stpui_plist_get_name(vs)); - stpui_plist_set_queue_name(vd, stpui_plist_get_queue_name(vs)); - stpui_plist_set_extra_printer_options(vd, stpui_plist_get_extra_printer_options(vs)); - stpui_plist_set_custom_command(vd, stpui_plist_get_custom_command(vs)); - stpui_plist_set_current_standard_command(vd, stpui_plist_get_current_standard_command(vs)); - stpui_plist_set_output_filename(vd, stpui_plist_get_output_filename(vs)); - stpui_plist_set_copy_count(vd, stpui_plist_get_copy_count(vs)); -} - -static stpui_plist_t * -allocate_stpui_plist_copy(const stpui_plist_t *vs) -{ - stpui_plist_t *rep = g_malloc(sizeof(stpui_plist_t)); - memset(rep, 0, sizeof(stpui_plist_t)); - rep->v = stp_vars_create(); - stpui_plist_copy(rep, vs); - return rep; -} - -static void -check_plist(int count) -{ - static int current_plist_size = 0; - int i; - if (count <= current_plist_size) - return; - else if (current_plist_size == 0) - { - current_plist_size = count; - stpui_plist = g_malloc(current_plist_size * sizeof(stpui_plist_t)); - for (i = 0; i < current_plist_size; i++) - { - memset(&(stpui_plist[i]), 0, sizeof(stpui_plist_t)); - stpui_printer_initialize(&(stpui_plist[i])); - } - } - else - { - int old_plist_size = current_plist_size; - current_plist_size *= 2; - if (current_plist_size < count) - current_plist_size = count; - stpui_plist = g_realloc(stpui_plist, current_plist_size * sizeof(stpui_plist_t)); - for (i = old_plist_size; i < current_plist_size; i++) - { - memset(&(stpui_plist[i]), 0, sizeof(stpui_plist_t)); - stpui_printer_initialize(&(stpui_plist[i])); - } - } -} - -#define GET_MANDATORY_INTERNAL_STRING_PARAM(param) \ -do { \ - if ((commaptr = strchr(lineptr, ',')) == NULL) \ - continue; \ - stpui_plist_set_##param##_n(&key, lineptr, commaptr - line); \ - lineptr = commaptr + 1; \ -} while (0) - -#define GET_MANDATORY_STRING_PARAM(param) \ -do { \ - if ((commaptr = strchr(lineptr, ',')) == NULL) \ - continue; \ - stp_set_##param##_n(key.v, lineptr, commaptr - line); \ - lineptr = commaptr + 1; \ -} while (0) - -static int -get_mandatory_string_param(stp_vars_t *v, const char *param, char **lineptr) -{ - char *commaptr = strchr(*lineptr, ','); - if (commaptr == NULL) - return 0; - stp_set_string_parameter_n(v, param, *lineptr, commaptr - *lineptr); - *lineptr = commaptr + 1; - return 1; -} - -static int -get_mandatory_file_param(stp_vars_t *v, const char *param, char **lineptr) -{ - char *commaptr = strchr(*lineptr, ','); - if (commaptr == NULL) - return 0; - stp_set_file_parameter_n(v, param, *lineptr, commaptr - *lineptr); - *lineptr = commaptr + 1; - return 1; -} - -#define GET_MANDATORY_INT_PARAM(param) \ -do { \ - if ((commaptr = strchr(lineptr, ',')) == NULL) \ - continue; \ - stp_set_##param(key.v, atoi(lineptr)); \ - lineptr = commaptr + 1; \ -} while (0) - -#define GET_MANDATORY_INTERNAL_INT_PARAM(param) \ -do { \ - if ((commaptr = strchr(lineptr, ',')) == NULL) \ - continue; \ - key.param = atoi(lineptr); \ - lineptr = commaptr + 1; \ -} while (0) - -static void -get_optional_string_param(stp_vars_t *v, const char *param, - char **lineptr, int *keepgoing) -{ - if (*keepgoing) - { - char *commaptr = strchr(*lineptr, ','); - if (commaptr == NULL) - { - stp_set_string_parameter(v, param, *lineptr); - *keepgoing = 0; - } - else - { - stp_set_string_parameter_n(v, param, *lineptr, commaptr - *lineptr); - *lineptr = commaptr + 1; - } - } -} - -#define GET_OPTIONAL_INT_PARAM(param) \ -do { \ - if ((keepgoing == 0) || ((commaptr = strchr(lineptr, ',')) == NULL)) \ - { \ - keepgoing = 0; \ - } \ - else \ - { \ - stp_set_##param(key.v, atoi(lineptr)); \ - lineptr = commaptr + 1; \ - } \ -} while (0) - -#define GET_OPTIONAL_INTERNAL_INT_PARAM(param) \ -do { \ - if ((keepgoing == 0) || ((commaptr = strchr(lineptr, ',')) == NULL)) \ - { \ - keepgoing = 0; \ - } \ - else \ - { \ - key.param = atoi(lineptr); \ - lineptr = commaptr + 1; \ - } \ -} while (0) - -#define IGNORE_OPTIONAL_PARAM(param) \ -do { \ - if ((keepgoing == 0) || ((commaptr = strchr(lineptr, ',')) == NULL)) \ - { \ - keepgoing = 0; \ - } \ - else \ - { \ - lineptr = commaptr + 1; \ - } \ -} while (0) - -static void -get_optional_float_param(stp_vars_t *v, const char *param, - char **lineptr, int *keepgoing) -{ - if (*keepgoing) - { - char *commaptr = strchr(*lineptr, ','); - if (commaptr == NULL) - { - stp_set_float_parameter(v, param, atof(*lineptr)); - *keepgoing = 0; - } - else - { - stp_set_float_parameter(v, param, atof(*lineptr)); - *lineptr = commaptr + 1; - } - } -} - -#define GET_OPTIONAL_INTERNAL_FLOAT_PARAM(param) \ -do { \ - if ((keepgoing == 0) || ((commaptr = strchr(lineptr, ',')) == NULL)) \ - { \ - keepgoing = 0; \ - } \ - else \ - { \ - key.param = atof(lineptr); \ - } \ -} while (0) - -static void * -psearch(const void *key, void *base, size_t nmemb, size_t size, - int (*compar)(const void *, const void *)) -{ - int i; - char *cbase = (char *) base; - for (i = 0; i < nmemb; i++) - { - if ((*compar)(key, (const void *) cbase) == 0) - return (void *) cbase; - cbase += size; - } - return NULL; -} - -stpui_plist_t * -stpui_plist_create(const char *name, const char *driver) -{ - stpui_plist_t key; - stpui_plist_t *answer = NULL; - memset(&key, 0, sizeof(key)); - stpui_printer_initialize(&key); - key.invalid_mask = 0; - stpui_plist_set_name(&key, name); - stp_set_driver(key.v, driver); - if (stpui_plist_add(&key, 0)) - answer = psearch(&key, stpui_plist, stpui_plist_count, - sizeof(stpui_plist_t), - (int (*)(const void *, const void *)) compare_printers); - SAFE_FREE(key.name); - SAFE_FREE(key.queue_name); - SAFE_FREE(key.extra_printer_options); - SAFE_FREE(key.custom_command); - SAFE_FREE(key.current_standard_command); - SAFE_FREE(key.output_filename); - stp_vars_destroy(key.v); - return answer; -} - -int -stpui_plist_add(const stpui_plist_t *key, int add_only) -{ - /* - * The format of the list is the File printer followed by a qsort'ed list - * of system printers. So, if we want to update the file printer, it is - * always first in the list, else call psearch. - */ - stpui_plist_t *p; - if (!stp_get_printer(key->v)) - stp_set_driver(key->v, "ps2"); - if (stp_get_printer(key->v)) - { - p = psearch(key, stpui_plist, stpui_plist_count, - sizeof(stpui_plist_t), - (int (*)(const void *, const void *)) compare_printers); - if (p == NULL) - { -#ifdef DEBUG - fprintf(stderr, "Adding new printer from printrc file: %s\n", - key->name); -#endif - check_plist(stpui_plist_count + 1); - p = stpui_plist + stpui_plist_count; - stpui_plist_count++; - stpui_plist_copy(p, key); - if (strlen(stpui_plist_get_queue_name(p)) == 0 && - stp_string_list_is_present(stpui_system_print_queues, - stpui_plist_get_name(p))) - stpui_plist_set_queue_name(p, stpui_plist_get_name(p)); - } - else - { - if (add_only) - return 0; -#ifdef DEBUG - fprintf(stderr, "Updating printer %s.\n", key->name); -#endif - stpui_plist_copy(p, key); - } - return 1; - } - else - { - fprintf(stderr, "No printer found!\n"); - return 0; - } -} - -static void -stpui_printrc_load_v0(FILE *fp) -{ - char line[1024]; /* Line in printrc file */ - char *lineptr; /* Pointer in line */ - char *commaptr; /* Pointer to next comma */ - stpui_plist_t key; /* Search key */ - int keepgoing = 1; - (void) memset(line, 0, 1024); - (void) memset(&key, 0, sizeof(stpui_plist_t)); - stpui_printer_initialize(&key); - key.name = g_strdup(_("File")); - while (fgets(line, sizeof(line), fp) != NULL) - { - /* - * Read old format printrc lines... - */ - - stpui_printer_initialize(&key); - key.invalid_mask = 0; - lineptr = line; - - /* - * Read the command-delimited printer definition data. Note that - * we can't use sscanf because %[^,] fails if the string is empty... - */ - - GET_MANDATORY_INTERNAL_STRING_PARAM(name); - GET_MANDATORY_INTERNAL_STRING_PARAM(custom_command); - GET_MANDATORY_STRING_PARAM(driver); - - if (! stp_get_printer(key.v)) - continue; - - if (!get_mandatory_file_param(key.v, "PPDFile", &lineptr)) - continue; - if ((commaptr = strchr(lineptr, ',')) != NULL) - { - switch (atoi(lineptr)) - { - case 1: - stp_set_string_parameter(key.v, "PrintingMode", "Color"); - break; - case 0: - default: - stp_set_string_parameter(key.v, "PrintingMode", "BW"); - break; - } - } - else - continue; - - if (!get_mandatory_string_param(key.v, "Resolution", &lineptr)) - continue; - if (!get_mandatory_string_param(key.v, "PageSize", &lineptr)) - continue; - if (!get_mandatory_string_param(key.v, "MediaType", &lineptr)) - continue; - - get_optional_string_param(key.v, "InputSlot", &lineptr, &keepgoing); - get_optional_float_param(key.v, "Brightness", &lineptr, &keepgoing); - - GET_OPTIONAL_INTERNAL_FLOAT_PARAM(scaling); - GET_OPTIONAL_INTERNAL_INT_PARAM(orientation); - GET_OPTIONAL_INT_PARAM(left); - GET_OPTIONAL_INT_PARAM(top); - get_optional_float_param(key.v, "Gamma", &lineptr, &keepgoing); - get_optional_float_param(key.v, "Contrast", &lineptr, &keepgoing); - get_optional_float_param(key.v, "Cyan", &lineptr, &keepgoing); - get_optional_float_param(key.v, "Magenta", &lineptr, &keepgoing); - get_optional_float_param(key.v, "Yellow", &lineptr, &keepgoing); - IGNORE_OPTIONAL_PARAM(linear); - IGNORE_OPTIONAL_PARAM(image_type); - get_optional_float_param(key.v, "Saturation", &lineptr, &keepgoing); - get_optional_float_param(key.v, "Density", &lineptr, &keepgoing); - get_optional_string_param(key.v, "InkType", &lineptr, &keepgoing); - get_optional_string_param(key.v,"DitherAlgorithm",&lineptr,&keepgoing); - GET_OPTIONAL_INTERNAL_INT_PARAM(unit); - stpui_plist_add(&key, 0); - g_free(key.name); - stp_vars_destroy(key.v); - } - stpui_plist_current = 0; -} - -static void -stpui_printrc_load_v1(FILE *fp) -{ - char line[1024]; /* Line in printrc file */ - stpui_plist_t key; /* Search key */ - char * current_printer = 0; /* printer to select */ - (void) memset(line, 0, 1024); - (void) memset(&key, 0, sizeof(stpui_plist_t)); - stpui_printer_initialize(&key); - key.name = g_strdup(_("File")); - while (fgets(line, sizeof(line), fp) != NULL) - { - /* - * Read new format printrc lines... - */ - - char *keyword, *end, *value; - - keyword = line; - for (keyword = line; isspace(*keyword); keyword++) - { - /* skip initial spaces... */ - } - if (!isalpha(*keyword)) - continue; - for (end = keyword; isalnum(*end) || *end == '-'; end++) - { - /* find end of keyword... */ - } - value = end; - while (isspace(*value)) - { - /* skip over white space... */ - value++; - } - if (*value != ':') - continue; - value++; - *end = '\0'; - while (isspace(*value)) - { - /* skip over white space... */ - value++; - } - for (end = value; *end && *end != '\n'; end++) - { - /* find end of line... */ - } - *end = '\0'; -#ifdef DEBUG - fprintf(stderr, "Keyword = `%s', value = `%s'\n", keyword, value); -#endif - if (strcasecmp("current-printer", keyword) == 0) - { - if (current_printer) - g_free (current_printer); - current_printer = g_strdup(value); - } - else if (strcasecmp("printer", keyword) == 0) - { - /* Switch to printer named VALUE */ - stpui_plist_add(&key, 0); -#ifdef DEBUG - fprintf(stderr, - "output_to is now %s\n", stpui_plist_get_output_to(&key)); -#endif - - stp_vars_destroy(key.v); - stpui_printer_initialize(&key); - key.invalid_mask = 0; - stpui_plist_set_name(&key, value); - } - else if (strcasecmp("destination", keyword) == 0) - stpui_plist_set_custom_command(&key, value); - else if (strcasecmp("driver", keyword) == 0) - stp_set_driver(key.v, value); - else if (strcasecmp("ppd-file", keyword) == 0) - stp_set_file_parameter(key.v, "PPDFile", value); - else if (strcasecmp("output-type", keyword) == 0) - { - switch (atoi(value)) - { - case 1: - stp_set_string_parameter(key.v, "PrintingMode", "Color"); - break; - case 0: - default: - stp_set_string_parameter(key.v, "PrintingMode", "BW"); - break; - } - } - else if (strcasecmp("media-size", keyword) == 0) - stp_set_string_parameter(key.v, "PageSize", value); - else if (strcasecmp("media-type", keyword) == 0) - stp_set_string_parameter(key.v, "MediaType", value); - else if (strcasecmp("media-source", keyword) == 0) - stp_set_float_parameter(key.v, "Brightness", atof(value)); - else if (strcasecmp("scaling", keyword) == 0) - key.scaling = atof(value); - else if (strcasecmp("orientation", keyword) == 0) - key.orientation = atoi(value); - else if (strcasecmp("left", keyword) == 0) - stp_set_left(key.v, atoi(value)); - else if (strcasecmp("top", keyword) == 0) - stp_set_top(key.v, atoi(value)); - else if (strcasecmp("linear", keyword) == 0) - /* Ignore linear */ - ; - else if (strcasecmp("image-type", keyword) == 0) - /* Ignore image type */ - ; - else if (strcasecmp("unit", keyword) == 0) - key.unit = atoi(value); - else if (strcasecmp("custom-page-width", keyword) == 0) - stp_set_page_width(key.v, atoi(value)); - else if (strcasecmp("custom-page-height", keyword) == 0) - stp_set_page_height(key.v, atoi(value)); - /* Special case Ink-Type and Dither-Algorithm */ - else if (strcasecmp("ink-type", keyword) == 0) - stp_set_string_parameter(key.v, "InkType", value); - else if (strcasecmp("dither-algorithm", keyword) == 0) - stp_set_string_parameter(key.v, "DitherAlgorithm", value); - else - { - stp_parameter_t desc; - stp_curve_t *curve; - stp_describe_parameter(key.v, keyword, &desc); - switch (desc.p_type) - { - case STP_PARAMETER_TYPE_STRING_LIST: - stp_set_string_parameter(key.v, keyword, value); - break; - case STP_PARAMETER_TYPE_FILE: - stp_set_file_parameter(key.v, keyword, value); - break; - case STP_PARAMETER_TYPE_DOUBLE: - stp_set_float_parameter(key.v, keyword, atof(value)); - break; - case STP_PARAMETER_TYPE_INT: - stp_set_int_parameter(key.v, keyword, atoi(value)); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - stp_set_boolean_parameter(key.v, keyword, atoi(value)); - break; - case STP_PARAMETER_TYPE_CURVE: - curve = stp_curve_create_from_string(value); - if (curve) - { - stp_set_curve_parameter(key.v, keyword, curve); - stp_curve_destroy(curve); - } - break; - default: - if (strlen(value)) - { - char buf[1024]; - snprintf(buf, sizeof(buf), - "Unrecognized keyword `%s' in printrc; value `%s' (%d)\n", - keyword, value, desc.p_type); - } - } - stp_parameter_description_destroy(&desc); - } - } - if (strlen(key.name) > 0) - { - stpui_plist_add(&key, 0); - stp_vars_destroy(key.v); - g_free(key.name); - } - if (current_printer) - { - int i; - for (i = 0; i < stpui_plist_count; i ++) - if (strcmp(current_printer, stpui_plist[i].name) == 0) - stpui_plist_current = i; - } -} - -char *stpui_printrc_current_printer = NULL; -extern FILE *yyin; -extern int yyparse(void); - -static void -stpui_printrc_load_v2(FILE *fp) -{ - int retval; - char *locale; - yyin = fp; - - stpui_printrc_current_printer = NULL; - setlocale(LC_ALL, "C"); - retval = yyparse(); - setlocale(LC_ALL, ""); - if (stpui_printrc_current_printer) - { - int i; - for (i = 0; i < stpui_plist_count; i ++) - { - if (strcmp(stpui_printrc_current_printer, stpui_plist[i].name) == 0) - stpui_plist_current = i; - if (!stp_check_boolean_parameter(stpui_plist[i].v, - "PageSizeExtended", - STP_PARAMETER_ACTIVE)) - stp_set_boolean_parameter(stpui_plist[i].v, "PageSizeExtended", 0); - } - SAFE_FREE(stpui_printrc_current_printer); - } -} - -/* - * 'stpui_printrc_load()' - Load the printer resource configuration file. - */ -void -stpui_printrc_load(void) -{ - FILE *fp; /* Printrc file */ - char line[1024]; /* Line in printrc file */ - int format = 0; /* rc file format version */ - const char *filename = stpui_get_printrc_file(); - - initialize_default_parameters(); - check_plist(1); - - /* - * Get the printer list... - */ - - stpui_get_system_printers(); - - if ((fp = fopen(filename, "r")) != NULL) - { - (void) memset(line, 0, 1024); - if (fgets(line, sizeof(line), fp) != NULL) - { - /* Force locale to "C", so that numbers scan correctly */ - setlocale(LC_ALL, "C"); - if (strncmp("#PRINTRCv", line, 9) == 0) - { -#ifdef DEBUG - fprintf(stderr, "Found printrc version tag: `%s'\n", line); - fprintf(stderr, "Version number: `%s'\n", &(line[9])); -#endif - (void) sscanf(&(line[9]), "%d", &format); - } - setlocale(LC_ALL, ""); - } - rewind(fp); - switch (format) - { - case 0: - stpui_printrc_load_v0(fp); - break; - case 1: - stpui_printrc_load_v1(fp); - break; - case 2: - case 3: - case 4: - stpui_printrc_load_v2(fp); - break; - } - (void) fclose(fp); - } - if (stpui_plist_count == 0) - stpui_plist_create(_("Printer"), "ps2"); -} - -/* - * 'stpui_printrc_save()' - Save the current printer resource configuration. - */ -void -stpui_printrc_save(void) -{ - FILE *fp; /* Printrc file */ - int i; /* Looping var */ - size_t global_settings_count = stp_string_list_count(default_parameters); - stpui_plist_t *p; /* Current printer */ - const char *filename = stpui_get_printrc_file(); - - - if ((fp = fopen(filename, "w")) != NULL) - { - /* - * Write the contents of the printer list... - */ - - /* Force locale to "C", so that numbers print correctly */ - setlocale(LC_ALL, "C"); -#ifdef DEBUG - fprintf(stderr, "Number of printers: %d\n", stpui_plist_count); -#endif - - fputs("#PRINTRCv4 written by Gutenprint " PLUG_IN_VERSION "\n\n", fp); - - fprintf(fp, "Global-Settings:\n"); - fprintf(fp, " Current-Printer: \"%s\"\n", - stpui_plist[stpui_plist_current].name); - fprintf(fp, " Show-All-Paper-Sizes: %s\n", - stpui_show_all_paper_sizes ? "True" : "False"); - for (i = 0; i < global_settings_count; i++) - { - stp_param_string_t *ps = stp_string_list_param(default_parameters, i); - fprintf(fp, " %s \"%s\"\n", ps->name, ps->text); - } - fprintf(fp, "End-Global-Settings:\n"); - - for (i = 0, p = stpui_plist; i < stpui_plist_count; i ++, p ++) - { - int count; - int j; - stp_parameter_list_t *params = stp_get_parameter_list(p->v); - count = stp_parameter_list_count(params); - fprintf(fp, "\nPrinter: \"%s\" \"%s\"\n", - p->name, stp_get_driver(p->v)); - fprintf(fp, " Command-Type: %d\n", p->command_type); - fprintf(fp, " Queue-Name: \"%s\"\n", p->queue_name); - fprintf(fp, " Output-Filename: \"%s\"\n", p->output_filename); - fprintf(fp, " Extra-Printer-Options: \"%s\"\n", p->extra_printer_options); - fprintf(fp, " Custom-Command: \"%s\"\n", p->custom_command); - fprintf(fp, " Scaling: %.3f\n", p->scaling); - fprintf(fp, " Orientation: %d\n", p->orientation); - fprintf(fp, " Autosize-Roll-Paper: %d\n", p->auto_size_roll_feed_paper); - fprintf(fp, " Unit: %d\n", p->unit); - - fprintf(fp, " Left: %d\n", stp_get_left(p->v)); - fprintf(fp, " Top: %d\n", stp_get_top(p->v)); - fprintf(fp, " Custom_Page_Width: %d\n", stp_get_page_width(p->v)); - fprintf(fp, " Custom_Page_Height: %d\n", stp_get_page_height(p->v)); - fprintf(fp, " Parameter %s Int True %d\n", copy_count_name, - stpui_plist_get_copy_count(p)); - - for (j = 0; j < count; j++) - { - const stp_parameter_t *param = stp_parameter_list_param(params, j); - if (strcmp(param->name, "AppGamma") == 0) - continue; - switch (param->p_type) - { - case STP_PARAMETER_TYPE_STRING_LIST: - if (stp_check_string_parameter(p->v, param->name, - STP_PARAMETER_INACTIVE)) - fprintf(fp, " Parameter %s String %s \"%s\"\n", - param->name, - ((stp_get_string_parameter_active - (p->v, param->name) == STP_PARAMETER_ACTIVE) ? - "True" : "False"), - stp_get_string_parameter(p->v, param->name)); - break; - case STP_PARAMETER_TYPE_FILE: - if (stp_check_file_parameter(p->v, param->name, - STP_PARAMETER_INACTIVE)) - fprintf(fp, " Parameter %s File %s \"%s\"\n", param->name, - ((stp_get_file_parameter_active - (p->v, param->name) == STP_PARAMETER_ACTIVE) ? - "True" : "False"), - stp_get_file_parameter(p->v, param->name)); - break; - case STP_PARAMETER_TYPE_DOUBLE: - if (stp_check_float_parameter(p->v, param->name, - STP_PARAMETER_INACTIVE)) - fprintf(fp, " Parameter %s Double %s %f\n", param->name, - ((stp_get_float_parameter_active - (p->v, param->name) == STP_PARAMETER_ACTIVE) ? - "True" : "False"), - stp_get_float_parameter(p->v, param->name)); - break; - case STP_PARAMETER_TYPE_DIMENSION: - if (stp_check_dimension_parameter(p->v, param->name, - STP_PARAMETER_INACTIVE)) - fprintf(fp, " Parameter %s Dimension %s %d\n", param->name, - ((stp_get_dimension_parameter_active - (p->v, param->name) == STP_PARAMETER_ACTIVE) ? - "True" : "False"), - stp_get_dimension_parameter(p->v, param->name)); - break; - case STP_PARAMETER_TYPE_INT: - if (stp_check_int_parameter(p->v, param->name, - STP_PARAMETER_INACTIVE)) - fprintf(fp, " Parameter %s Int %s %d\n", param->name, - ((stp_get_int_parameter_active - (p->v, param->name) == STP_PARAMETER_ACTIVE) ? - "True" : "False"), - stp_get_int_parameter(p->v, param->name)); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - if (stp_check_boolean_parameter(p->v, param->name, - STP_PARAMETER_INACTIVE)) - fprintf(fp, " Parameter %s Boolean %s %s\n", param->name, - ((stp_get_boolean_parameter_active - (p->v, param->name) == STP_PARAMETER_ACTIVE) ? - "True" : "False"), - (stp_get_boolean_parameter(p->v, param->name) ? - "True" : "False")); - break; - case STP_PARAMETER_TYPE_CURVE: - if (stp_check_curve_parameter(p->v, param->name, - STP_PARAMETER_INACTIVE)) - { - const stp_curve_t *curve = - stp_get_curve_parameter(p->v, param->name); - if (curve) - { - fprintf(fp, " Parameter %s Curve %s '", - param->name, - ((stp_get_curve_parameter_active - (p->v, param->name) == - STP_PARAMETER_ACTIVE) ? - "True" : "False")); - stp_curve_write(fp, curve); - fprintf(fp, "'\n"); - } - } - break; - default: - break; - } - } - stp_parameter_list_destroy(params); -#ifdef DEBUG - fprintf(stderr, "Wrote printer %d: %s\n", i, p->name); -#endif - } - setlocale(LC_ALL, ""); - fclose(fp); - } - else - fprintf(stderr, "could not open printrc file \"%s\"\n",filename); -} - -/* - * 'compare_printers()' - Compare system printer names for qsort(). - */ - -static int -compare_printers(stpui_plist_t *p1, stpui_plist_t *p2) -{ - return (strcmp(p1->name, p2->name)); -} - -/* - * 'stpui_get_system_printers()' - Get a complete list of printers from the spooler. - */ - -void -stpui_get_system_printers(void) -{ - FILE *pfile; /* Pipe to status command */ - char line[1025]; /* Line from status command */ - - stpui_system_print_queues = stp_string_list_create(); - stp_string_list_add_string(stpui_system_print_queues, "", - _("(Default Printer)")); - - /* - * Run the command, if any, to get the available printers... - */ - - identify_print_system(); - if (global_printing_system) - { - if ((pfile = popen(global_printing_system->scan_command, "r")) != NULL) - { - /* - * Read input as needed... - */ - - while (fgets(line, sizeof(line), pfile) != NULL) - { - char *tmp_ptr; - if ((tmp_ptr = strchr(line, '\n'))) - tmp_ptr[0] = '\0'; - if ((tmp_ptr = strchr(line, '\r'))) - tmp_ptr[0] = '\0'; - if (strlen(line) > 0) - { - if (!stp_string_list_is_present(stpui_system_print_queues, line)) - stp_string_list_add_string(stpui_system_print_queues, - line, line); - } - } - pclose(pfile); - } - } -} - -const stpui_plist_t * -stpui_get_current_printer(void) -{ - return &(stpui_plist[stpui_plist_current]); -} - -/* - * 'usr1_handler()' - Make a note when we receive SIGUSR1. - */ - -static volatile int usr1_interrupt; - -static void -usr1_handler (int sig) -{ - usr1_interrupt = 1; -} - -/* - * - * Process control for actually printing. Documented 20040821 - * by Robert Krawitz. - * - * In addition to the print command itself and the output generator, - * we spawn two additional processes to monitor the print job and clean - * up. We do this because the GIMP is very unfriendly about how it - * terminates plugins when the user cancels an operation: it sends a - * SIGKILL, which prevents the plugin from cleaning up. Since the - * plugin is sending data to an lpr process, this SIGKILL closes off - * the input to lpr. lpr doesn't know that its parent has died - * inappropriately, and happily proceeds to print the partial job. - * - * (The child may not actually be lpr, of course, but we'll just use - * that nomenclature for convenience.) - * - * The first such process is the "lpr monitor". Its job is to - * watch the parent (the actual data generator). If its parent dies, - * it kills the print command. Notice that it must keep the file - * descriptor used to write to the lpr process open, since as soon as - * the last writer to this pipe is closed, the lpr process sees its - * input close. Therefore, it first kills the child with SIGTERM and - * then closes the pipe. Perhaps a more robust method would be to - * send a SIGTERM followed by a SIGKILL, but we can worry about that - * later. The lpr monitor process is killed with SIGUSR1 by the - * master upon successful completion, at which point it exits. The lpr - * monitor itself detects that the master has finished by periodically - * sending it a kill 0 (a null signal). When the parent exits, this - * attempt to signal will return failure. This has a potential race - * condition if another process is created with the same PID between - * checks. A more robust (but more complicated) solution would involve - * IPC of some kind. - * - * The second such process (the "error monitor") monitors the stderr - * (and stdout) of the lpr process, to send any error messages back - * to the user. Since the GIMP is normally not launched from a - * terminal window, any errors would get lost. The error monitor - * captures this output and reports it back. It stays around until - * its input is closed (normally by the lpr process exiting), at - * which point it reports to the master that it has finished, and the - * master can clean up and return. - * - * The actual master process spawns the lpr monitor, which spawns - * the process that will later run the lpr command, which itself - * spawns the error monitor. - * - * This architecture is perhaps unnecessarily complex; the lpr monitor - * and error monitor could perhaps be combined into a single process - * that watches both for the parent to go away and for the error messages. - * - * The following diagrams illustrate the control flow during the normal - * case and also when the print job is cancelled. The notation for file - * descriptors is a number prefixed with < for an input file descriptor - * and suffixed > for an output file descriptor. For example, <0 means - * input file descriptor 0 and 1> means output file descriptor 1. The - * key to the file descriptors is given below. A file descriptor named - * x,y refers to file descriptor y duplicated onto file descriptor x. - * So "<0,3" means input file descriptor 3 (pipefd[0]) dup2'ed onto - * file descriptor 0. - * - * fd0 = fd 0 - * fd1 = fd 1 - * fd2 = fd 2 - * fd3 = pipefd[0] - * fd4 = pipefd[1] - * fd5 = syncfd[0] - * fd6 = syncfd[1] - * fd7 = errfd[0] - * fd8 = errfd[1] - * - * - * NORMAL CASE - * - * PARENT CHILD 1 CHILD 2 CHILD 3 - * (print generator) (lpr monitor) (print command) (error monitor) - * | - * stpui_print - * | - * | <0 1> 2> - * | - * | pipe(syncfd) - * | - * | <0 1> 2> <5 6> - * | - * | pipe(pipefd) - * | - * | <0 1> 2> <3 4> - * | <5 6> - * | - * | fork =============| - * | | - * | close(63) | close(syncfd[0]) - * | | <0 1> 2> <3 4> - * | <0 1> 2> 4> <5 | 6> - * | | - * | | fork =============| - * | | | - * | | close(01263) | dup2(pipefd[0], 0) - * | | | close(pipefd[0] - * | | 4> | close(pipefd[1] - * | | | - * | | | 1> 2> <0,3 6> - * | | | - * | | | pipe(errfd) - * | | | 1> 2> <0,3 6> - * | | | <7 8> - * | | | - * | | | fork =============| - * | | | | close(012348) - * | | | close(12) | 6> <7 - * | | | | - * | | | <0,3 6> <7 8> | - * | | | | - * | | | dup2(errfd[1],1) | - * | | | dup2(errfd[1],2) | - * | | | close(errfd[1]) | - * | | | close(pipefd[0]) | - * | | | close(pipefd[1]) | - * | | | close(syncfd[1]) | - * |<<<<<<<<<<<<<<<<<<<|kill(0,0) * EXEC lpr | - * |>>>>>>>>>>>>>>>>>>>|OK | <0,3 1,8> 2,8> | - * | | | | - * | write>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>| | - * | | | write(2,8)??>>>>>>|read(<7)->warn - * | | | | - * | close(4)>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>| | - * | <0 1> 2> <5 | | | - * | kill>>>>>>>>>>>>>>| | | - * | | close(4)>>>>>>>>>>| eof(<0,3) | - * | | | | - * | | *no open fd* | 1,8> 2,8> | - * | | exit | | - * | | | exit>>>>>>>>>>>>>>| eof(<7) - * | wait<<<<<<<<<<<<<<X X | 6> - * | | - * | read(<5)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| write(6>) - * | | - * | close(5) | exit - * | X - * | 0< 1> 2> - * | - * | return - * X - * - * - * ERROR CASE (job cancelled) - * - * PARENT CHILD 1 CHILD 2 CHILD 3 - * (print generator) (lpr monitor) (print command) (error monitor) - * | - * stpui_print - * | - * | <0 1> 2> - * | - * | pipe(syncfd) - * | - * | <0 1> 2> <5 6> - * | - * | pipe(pipefd) - * | - * | <0 1> 2> <3 4> - * | <5 6> - * | - * | fork =============| - * | | - * | close(63) | close(syncfd[0] - * | | <0 1> 2> <3 4> - * | <0 1> 2> 4> <5 | 6> - * | | - * | | fork =============| - * | | | - * | | close(01263) | dup2(pipefd[0], 0) - * | | | close(pipefd[0] - * | | 4> | close(pipefd[1] - * | | | - * | | | 1> 2> <3,0 6> - * | | | - * | | | pipe(errfd) - * | | | 1> 2> <3,0 6> - * | | | <7 8> - * | | | - * | | | fork =============| - * | | | | close(012348) - * | | | close(12) | 6> <7 - * | | | | - * | | | <3,0 6> <7 8> | - * | | | | - * | | | dup2(errfd[1],1) | - * | | | dup2(errfd[1],2) | - * | | | close(3468) | - * |<<<<<<<<<<<<<<<<<<<|kill(0,0) * EXEC lpr | - * |>>>>>>>>>>>>>>>>>>>|OK | <0,3 1,8> 2,8> | - * | | | | - * | write>>>>>>>>>>>>>+>>>>>>>>>>>>>>>>>>>| | - * | | | write(2,8)??>>>>>>|read(<7)->warn - * | KILLED | | | - * | close(01245)>>>>>>+>>>>>>>>>>>>>>>>>>>| | - * X | | | - * <<<<<<<<<<<<<<<<<<<|kill(0,0) | | - * >>>>>>>>>>>>>>>>>>>|DEAD! | | - * |kill(2)>>>>>>>>>>>>|Terminated | - * |close(4>)>>>>>>>>>>|eof(0,3) | - * | | 1,8> 2,8> | - * | *no open fd* |exit>>>>>>>>>>>>>>>|eof(7) - * | exit X | - * X | 6> - * <| write(6) - * | exit/SIGPIPE - * X - */ - -int -stpui_print(const stpui_plist_t *printer, stpui_image_t *image) -{ - int ppid = getpid (), /* PID of plugin */ - opid, /* PID of output process */ - cpid = 0, /* PID of control/monitor process */ - pipefd[2], /* Fds of the pipe connecting all the above */ - errfd[2], /* Message logger from lp command */ - syncfd[2]; /* Sync the logger */ - FILE *prn = NULL; /* Print file/command */ - int do_sync = 0; - int print_status = 0; - int dummy; - - /* - * Open the file/execute the print command... - */ - - if (stpui_plist_get_command_type(printer) == COMMAND_TYPE_DEFAULT || - stpui_plist_get_command_type(printer) == COMMAND_TYPE_CUSTOM) - { - /* - * The following IPC code is only necessary because the GIMP kills - * plugins with SIGKILL if its "Cancel" button is pressed; this - * gives the plugin no chance whatsoever to clean up after itself. - */ - do_sync = 1; - usr1_interrupt = 0; - signal (SIGUSR1, usr1_handler); - if (pipe (syncfd) != 0) - { - do_sync = 0; - } - if (pipe (pipefd) != 0) - { - prn = NULL; - } - else - { - cpid = fork (); - if (cpid < 0) /* Error */ - { - do_sync = 0; - prn = NULL; - } - else if (cpid == 0) /* Child 1 (lpr monitor and printer command) */ - { - /* LPR monitor process. Printer output is piped to us. */ - close(syncfd[0]); - opid = fork (); - if (opid < 0) - { - /* Errors will cause the plugin to get a SIGPIPE. */ - exit (1); - } - else if (opid == 0) /* Child 2 (printer command) */ - { - dup2 (pipefd[0], 0); - close (pipefd[0]); - close (pipefd[1]); - if (pipe(errfd) == 0) - { - opid = fork(); - if (opid < 0) - _exit(1); - else if (opid == 0) /* Child 3 (monitors stderr) */ - { - stp_outfunc_t errfunc = stpui_get_errfunc(); - void *errdata = stpui_get_errdata(); - /* calls g_message on anything it sees */ - char buf[4096]; - - close (pipefd[0]); - close (pipefd[1]); - close (0); - close (1); - close (2); - close (errfd[1]); - while (1) - { - ssize_t bytes = read(errfd[0], buf, 4095); - if (bytes > 0) - { - buf[bytes] = '\0'; - (*errfunc)(errdata, buf, bytes); - } - else - { - if (bytes < 0) - { - snprintf(buf, 4095, - "Read messages failed: %s\n", - strerror(errno)); - (*errfunc)(errdata, buf, strlen(buf)); - } - write(syncfd[1], "Done", 5); - _exit(0); - } - } - /* NOTREACHED */ - write(syncfd[1], "Done", 5); - _exit(0); - } - else /* Child 2 (printer command) */ - { - char *command; - if (stpui_plist_get_command_type(printer) == - COMMAND_TYPE_DEFAULT) - { - command = - stpui_build_standard_print_command - (printer, stp_get_printer(printer->v)); - append_external_options(&command, printer->v); - } - else - command = - (char *) stpui_plist_get_custom_command(printer); - (void) close(2); - (void) close(1); - dup2 (errfd[1], 2); - dup2 (errfd[1], 1); - close(errfd[1]); - close (pipefd[0]); - close (pipefd[1]); - close(syncfd[1]); - execl("/bin/sh", "/bin/sh", "-c", command, NULL); - /* NOTREACHED */ - _exit (1); - } - /* NOTREACHED */ - _exit(1); - } - else /* pipe() failed! */ - { - _exit(1); - } - } - else /* Child 1 (lpr monitor) */ - { - /* - * If the print plugin gets SIGKILLed by gimp, we kill lpr - * in turn. If the plugin signals us with SIGUSR1 that it's - * finished printing normally, we close our end of the pipe, - * and go away. - * - * Note that we keep pipefd[1] -- which is the pipe from - * the print plugin to the lpr process -- open during this. - * If we don't, and the parent gets killed, lpr will notice - * its stdin getting closed off and start printing. - * This way its stdin stays open until we kill it. - */ - close (0); - close (1); - close (2); - close (syncfd[1]); - close (pipefd[0]); - while (usr1_interrupt == 0) - { - /* - * Note potential race condition, if some other process - * happens to get the same pid! - */ - if (kill (ppid, 0) < 0) - { - /* - * The print plugin has been killed! - * Note that there is no possibility of the print - * job sending us a SIGUSR1 and then exiting; - * the parent (print plugin) stays around after - * sending us the SIGUSR1, and then waits - * for us to die. - */ - kill (opid, SIGTERM); - waitpid (opid, &dummy, 0); - close (pipefd[1]); - /* - * We do not want to allow cleanup before exiting. - * The exiting parent has already closed the - * connection to the X server; if we try to clean - * up, we'll notice that fact and complain. - */ - _exit (0); - } - sleep (5); - } - /* We got SIGUSR1. */ - close (pipefd[1]); - /* - * We do not want to allow cleanup before exiting. - * The exiting parent has already closed the connection - * to the X server; if we try to clean up, we'll notice - * that fact and complain. - */ - _exit (0); - } - } - else /* Parent (actually generates the output) */ - { - close (syncfd[1]); - close (pipefd[0]); - /* Parent process. We generate the printer output. */ - prn = fdopen (pipefd[1], "w"); - /* and fall through... */ - } - } - } - else - prn = fopen (stpui_plist_get_output_filename(printer), "wb"); - - if (prn != NULL) - { - char tmp[32]; - stpui_plist_t *np = allocate_stpui_plist_copy(printer); - const stp_vars_t *current_vars = - stp_printer_get_defaults(stp_get_printer(np->v)); - int orientation; - stp_merge_printvars(np->v, current_vars); - stp_set_string_parameter(np->v, "InputImageType", image_type); - if (image_raw_channels) - { - sprintf(tmp, "%d", image_raw_channels); - stp_set_string_parameter(np->v, "RawChannels", tmp); - } - sprintf(tmp, "%d", image_channel_depth); - stp_set_string_parameter(np->v, "ChannelBitDepth", tmp); - - /* - * Set up the orientation - */ - orientation = np->orientation; - if (orientation == ORIENT_AUTO) - orientation = stpui_compute_orientation(); - switch (orientation) - { - case ORIENT_PORTRAIT: - break; - case ORIENT_LANDSCAPE: - if (image->rotate_cw) - (image->rotate_cw)(image); - break; - case ORIENT_UPSIDEDOWN: - if (image->rotate_180) - (image->rotate_180)(image); - break; - case ORIENT_SEASCAPE: - if (image->rotate_ccw) - (image->rotate_ccw)(image); - break; - } - - /* - * Finally, call the print driver to send the image to the printer - * and close the output file/command... - */ - - stp_set_outfunc(np->v, writefunc); - stp_set_errfunc(np->v, stpui_get_errfunc()); - stp_set_outdata(np->v, prn); - stp_set_errdata(np->v, stpui_get_errdata()); - print_status = stp_print(np->v, &(image->im)); - - /* - * Note that we do not use popen() to create the output, therefore - * we do not use pclose() to close it. See bug 1013565. - */ - (void) fclose(prn); - if (stpui_plist_get_command_type(printer) == COMMAND_TYPE_DEFAULT || - stpui_plist_get_command_type(printer) == COMMAND_TYPE_CUSTOM) - { - /* - * It is important for us to first close off the lpr process, - * then kill the lpr monitor (child 1), and then wait for it - * to die before exiting. - */ - kill (cpid, SIGUSR1); - waitpid (cpid, &dummy, 0); - } - - /* - * Make sure that any errors have been reported back to the user - * prior to completion. In addition, explicitly close off the - * synchronization file descriptor since we're merely returning, - * not exiting, and don't want to leave any pollution around. - */ - if (do_sync) - { - char buf[8]; - (void) read(syncfd[0], buf, 8); - (void) close(syncfd[0]); - } - stpui_plist_destroy(np); - g_free(np); - return 1; - } - return 0; -} - -/* - * End of "$Id: plist.c,v 1.3.6.2 2007/12/15 20:35:42 rlk Exp $". - */ diff --git a/src/gutenprintui/print-image-thumbnail.c b/src/gutenprintui/print-image-thumbnail.c deleted file mode 100644 index e692d55..0000000 --- a/src/gutenprintui/print-image-thumbnail.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * "$Id: print-image-thumbnail.c,v 1.1 2004/09/17 18:38:14 rleigh Exp $" - * - * Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com) and - * Robert Krawitz (rlk@alum.mit.edu) - * Copyright 2000 Charles Briscoe-Smith <cpbs@debian.org> - * - * 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 <sys/types.h> -#include <string.h> - -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" - -/* Concrete type to represent image */ -typedef struct -{ - const guchar *data; - gint w, h, bpp; - gint32 real_bpp; -} thumbnail_image_t; - -static const char *Thumbnail_get_appname(stp_image_t *image); -static void Thumbnail_conclude(stp_image_t *image); -static stp_image_status_t Thumbnail_get_row(stp_image_t *image, - unsigned char *data, - size_t byte_limit, int row); -static int Thumbnail_height(stp_image_t *image); -static int Thumbnail_width(stp_image_t *image); -static void Thumbnail_reset(stp_image_t *image); -static void Thumbnail_init(stp_image_t *image); - -static stp_image_t theImage = -{ - Thumbnail_init, - Thumbnail_reset, - Thumbnail_width, - Thumbnail_height, - Thumbnail_get_row, - Thumbnail_get_appname, - Thumbnail_conclude, - NULL -}; - -stp_image_t * -stpui_image_thumbnail_new(const guchar *data, gint w, gint h, gint bpp) -{ - thumbnail_image_t *im; - if (! theImage.rep) - theImage.rep = stp_malloc(sizeof(thumbnail_image_t)); - im = (thumbnail_image_t *) (theImage.rep); - memset(im, 0, sizeof(thumbnail_image_t)); - im->data = data; - im->w = w; - im->h = h; - im->bpp = bpp; - - theImage.reset(&theImage); - return &theImage; -} - -static int -Thumbnail_width(stp_image_t *image) -{ - thumbnail_image_t *im = (thumbnail_image_t *) (image->rep); - return im->w; -} - -static int -Thumbnail_height(stp_image_t *image) -{ - thumbnail_image_t *im = (thumbnail_image_t *) (image->rep); - return im->h; -} - -static stp_image_status_t -Thumbnail_get_row(stp_image_t *image, unsigned char *data, - size_t byte_limit, int row) -{ - thumbnail_image_t *im = (thumbnail_image_t *) (image->rep); - const guchar *where = im->data + (row * im->w * im->bpp); - memcpy(data, where, im->w * im->bpp); - return STP_IMAGE_STATUS_OK; -} - -static void -Thumbnail_init(stp_image_t *image) -{ - /* Nothing to do. */ -} - -static void -Thumbnail_reset(stp_image_t *image) -{ -} - -static void -Thumbnail_conclude(stp_image_t *image) -{ -} - -static const char * -Thumbnail_get_appname(stp_image_t *image) -{ - static char pluginname[] = "Thumbnail V" VERSION " - " RELEASE_DATE; - return pluginname; -} - -/* - * End of "$Id: print-image-thumbnail.c,v 1.1 2004/09/17 18:38:14 rleigh Exp $". - */ diff --git a/src/gutenprintui/printrc.h b/src/gutenprintui/printrc.h deleted file mode 100644 index 9cf2ada..0000000 --- a/src/gutenprintui/printrc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * "$Id: printrc.h,v 1.1 2004/09/17 18:38:14 rleigh Exp $" - * - * Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com), - * Robert Krawitz (rlk@alum.mit.edu). and Steve Miller (smiller@rni.net - * - * 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. - * - * - * Revision History: - * - * See ChangeLog - */ - -#ifndef __GIMP_PRINT_PRINTRC_H__ -#define __GIMP_PRINT_PRINTRC_H__ - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -typedef union yylv { - int ival; - double dval; - char *sval; -} YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -#endif - -#include "printrcy.h" - -#endif /* __GIMP_PRINT_PRINTRC_H__ */ diff --git a/src/gutenprintui/printrcl.c b/src/gutenprintui/printrcl.c deleted file mode 100644 index 075fa0a..0000000 --- a/src/gutenprintui/printrcl.c +++ /dev/null @@ -1,2118 +0,0 @@ - -#line 3 "printrcl.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ - -#if __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include <inttypes.h> -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -#define yywrap(n) 1 -#define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 40 -#define YY_END_OF_BUFFER 41 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[335] = - { 0, - 0, 0, 41, 40, 37, 39, 40, 38, 40, 40, - 31, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 37, 0, 33, - 38, 38, 0, 31, 0, 0, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 38, 32, 0, 32, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 24, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 38, 35, 35, 35, 35, 35, - - 35, 35, 35, 35, 35, 0, 35, 35, 26, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 11, - 34, 35, 38, 35, 35, 35, 35, 30, 35, 35, - 35, 35, 35, 0, 35, 35, 10, 35, 35, 35, - 35, 35, 35, 0, 35, 8, 38, 35, 35, 35, - 35, 35, 35, 35, 27, 35, 0, 0, 35, 35, - 35, 35, 35, 0, 35, 0, 25, 38, 35, 29, - 35, 35, 0, 35, 35, 35, 9, 0, 0, 0, - 23, 35, 0, 35, 35, 35, 0, 35, 0, 38, - 35, 0, 0, 0, 35, 35, 35, 0, 0, 0, - - 35, 0, 35, 35, 3, 0, 5, 0, 38, 0, - 0, 0, 0, 35, 35, 28, 0, 0, 0, 35, - 0, 35, 15, 0, 0, 38, 0, 0, 0, 0, - 35, 35, 0, 0, 0, 35, 0, 35, 0, 0, - 38, 36, 0, 0, 0, 0, 35, 35, 0, 0, - 0, 35, 0, 35, 16, 0, 0, 0, 0, 0, - 35, 4, 0, 0, 0, 6, 0, 14, 0, 0, - 20, 0, 0, 35, 35, 0, 0, 0, 0, 0, - 0, 0, 0, 35, 35, 0, 0, 0, 0, 0, - 0, 0, 19, 35, 35, 0, 0, 0, 0, 0, - - 0, 1, 35, 35, 0, 0, 21, 17, 0, 0, - 35, 35, 0, 0, 0, 0, 35, 12, 0, 0, - 0, 0, 13, 0, 0, 0, 7, 22, 0, 0, - 0, 2, 18, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 5, 1, 1, 1, 6, 1, - 1, 1, 7, 1, 8, 9, 1, 10, 10, 11, - 11, 11, 10, 10, 10, 10, 10, 12, 1, 1, - 1, 1, 1, 1, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 1, 1, 1, 1, 13, 1, 14, 15, 16, 17, - - 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[39] = - { 0, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, - 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3 - } ; - -static yyconst flex_int16_t yy_base[340] = - { 0, - 0, 0, 374, 375, 371, 375, 368, 343, 364, 29, - 32, 336, 341, 18, 26, 21, 32, 343, 0, 340, - 347, 19, 41, 331, 42, 32, 337, 360, 357, 375, - 0, 330, 353, 55, 50, 68, 0, 326, 330, 331, - 37, 324, 329, 320, 330, 334, 318, 325, 324, 320, - 314, 326, 322, 311, 312, 319, 322, 325, 311, 307, - 308, 302, 312, 311, 59, 70, 72, 305, 307, 305, - 54, 297, 296, 309, 311, 291, 316, 293, 291, 303, - 305, 0, 287, 300, 289, 302, 289, 281, 289, 277, - 289, 298, 291, 276, 281, 275, 287, 290, 285, 284, - - 274, 278, 273, 274, 279, 276, 281, 276, 0, 279, - 280, 265, 257, 264, 256, 269, 264, 277, 258, 375, - 0, 271, 250, 259, 266, 253, 252, 0, 252, 250, - 244, 256, 243, 248, 263, 246, 375, 237, 236, 249, - 248, 257, 238, 249, 242, 375, 231, 222, 233, 241, - 225, 77, 242, 233, 0, 242, 226, 224, 79, 237, - 81, 218, 219, 222, 227, 222, 0, 229, 226, 0, - 235, 234, 225, 212, 207, 211, 375, 222, 206, 204, - 375, 202, 214, 200, 213, 218, 215, 216, 203, 192, - 217, 192, 195, 195, 207, 198, 193, 204, 195, 198, - - 193, 192, 176, 182, 375, 186, 375, 202, 198, 178, - 170, 176, 180, 184, 176, 0, 178, 175, 168, 172, - 174, 169, 0, 178, 167, 191, 166, 164, 169, 165, - 171, 162, 179, 154, 153, 158, 165, 164, 169, 166, - 176, 375, 154, 159, 150, 161, 161, 161, 141, 153, - 148, 157, 142, 155, 375, 138, 141, 152, 131, 136, - 51, 375, 143, 130, 133, 375, 144, 375, 139, 148, - 375, 137, 137, 135, 130, 119, 142, 129, 123, 117, - 118, 115, 132, 121, 125, 109, 113, 108, 120, 129, - 122, 123, 375, 114, 101, 110, 103, 118, 117, 97, - - 99, 375, 105, 104, 98, 91, 375, 375, 100, 103, - 88, 107, 98, 95, 78, 85, 102, 375, 82, 85, - 93, 98, 375, 97, 82, 76, 375, 375, 68, 84, - 81, 375, 375, 375, 94, 97, 100, 89, 103 - } ; - -static yyconst flex_int16_t yy_def[340] = - { 0, - 334, 1, 334, 334, 334, 334, 335, 336, 337, 334, - 334, 338, 338, 338, 338, 338, 338, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 334, 335, 334, - 336, 336, 337, 334, 334, 334, 338, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, - 338, 338, 338, 336, 334, 334, 334, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, - 338, 338, 338, 338, 336, 338, 338, 338, 338, 338, - - 338, 338, 338, 338, 338, 334, 338, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 338, 338, 338, 334, - 338, 338, 336, 338, 338, 338, 338, 338, 338, 338, - 338, 338, 338, 334, 338, 338, 334, 338, 338, 338, - 338, 338, 338, 334, 338, 334, 336, 338, 338, 338, - 338, 338, 338, 338, 338, 338, 334, 334, 338, 338, - 338, 338, 338, 334, 338, 334, 338, 336, 338, 338, - 338, 338, 334, 338, 338, 338, 334, 334, 334, 334, - 334, 338, 334, 338, 338, 338, 334, 338, 334, 336, - 338, 334, 334, 334, 338, 338, 338, 334, 334, 334, - - 338, 334, 338, 338, 334, 334, 334, 334, 336, 334, - 334, 334, 334, 338, 338, 338, 334, 334, 334, 338, - 334, 338, 338, 334, 334, 339, 334, 334, 334, 334, - 338, 338, 334, 334, 334, 338, 334, 338, 334, 334, - 339, 334, 334, 334, 334, 334, 338, 338, 334, 334, - 334, 338, 334, 338, 334, 334, 334, 334, 334, 334, - 338, 334, 334, 334, 334, 334, 334, 334, 334, 334, - 334, 334, 334, 338, 338, 334, 334, 334, 334, 334, - 334, 334, 334, 338, 338, 334, 334, 334, 334, 334, - 334, 334, 334, 338, 338, 334, 334, 334, 334, 334, - - 334, 334, 338, 338, 334, 334, 334, 334, 334, 334, - 338, 338, 334, 334, 334, 334, 338, 334, 334, 334, - 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, - 334, 334, 334, 0, 334, 334, 334, 334, 334 - } ; - -static yyconst flex_int16_t yy_nxt[414] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 10, 4, 11, - 11, 4, 4, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 19, 21, 19, 19, 22, 23, 24, 19, - 25, 26, 27, 19, 19, 19, 19, 19, 34, 34, - 35, 34, 34, 42, 40, 48, 46, 43, 53, 36, - 41, 54, 44, 49, 55, 45, 47, 58, 61, 65, - 65, 62, 59, 35, 34, 34, 71, 72, 65, 65, - 56, 274, 36, 60, 66, 66, 36, 67, 67, 67, - 67, 67, 67, 99, 173, 275, 180, 100, 183, 174, - 181, 37, 333, 184, 29, 332, 29, 31, 331, 31, - - 33, 33, 33, 241, 241, 241, 330, 329, 328, 327, - 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, - 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, - 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, - 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, - 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, - 276, 273, 272, 271, 270, 269, 268, 267, 266, 265, - 264, 263, 262, 261, 260, 259, 258, 257, 242, 256, - 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, - 245, 244, 243, 242, 240, 239, 238, 237, 236, 235, - - 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, - 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, - 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, - 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, - 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, - 182, 179, 178, 177, 176, 175, 172, 171, 170, 169, - 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, - 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, - 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, - 138, 137, 136, 121, 135, 134, 133, 132, 131, 130, - - 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, - 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, - 109, 108, 107, 106, 105, 104, 103, 102, 101, 98, - 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, - 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, - 77, 76, 75, 74, 73, 70, 69, 68, 30, 64, - 30, 28, 63, 57, 52, 51, 50, 39, 38, 30, - 32, 30, 28, 334, 3, 334, 334, 334, 334, 334, - 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, - 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, - - 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, - 334, 334, 334 - } ; - -static yyconst flex_int16_t yy_chk[414] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, - 11, 11, 11, 15, 14, 17, 16, 15, 22, 11, - 14, 22, 15, 17, 23, 15, 16, 25, 26, 35, - 35, 26, 25, 34, 34, 34, 41, 41, 65, 65, - 23, 261, 34, 25, 36, 36, 65, 36, 36, 66, - 66, 67, 67, 71, 152, 261, 159, 71, 161, 152, - 159, 338, 331, 161, 335, 330, 335, 336, 329, 336, - - 337, 337, 337, 339, 339, 339, 326, 325, 324, 322, - 321, 320, 319, 317, 316, 315, 314, 313, 312, 311, - 310, 309, 306, 305, 304, 303, 301, 300, 299, 298, - 297, 296, 295, 294, 292, 291, 290, 289, 288, 287, - 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, - 276, 275, 274, 273, 272, 270, 269, 267, 265, 264, - 263, 260, 259, 258, 257, 256, 254, 253, 252, 251, - 250, 249, 248, 247, 246, 245, 244, 243, 241, 240, - 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, - 229, 228, 227, 226, 225, 224, 222, 221, 220, 219, - - 218, 217, 215, 214, 213, 212, 211, 210, 209, 208, - 206, 204, 203, 202, 201, 200, 199, 198, 197, 196, - 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, - 185, 184, 183, 182, 180, 179, 178, 176, 175, 174, - 173, 172, 171, 169, 168, 166, 165, 164, 163, 162, - 160, 158, 157, 156, 154, 153, 151, 150, 149, 148, - 147, 145, 144, 143, 142, 141, 140, 139, 138, 136, - 135, 134, 133, 132, 131, 130, 129, 127, 126, 125, - 124, 123, 122, 119, 118, 117, 116, 115, 114, 113, - 112, 111, 110, 108, 107, 106, 105, 104, 103, 102, - - 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, - 91, 90, 89, 88, 87, 86, 85, 84, 83, 81, - 80, 79, 78, 77, 76, 75, 74, 73, 72, 70, - 69, 68, 64, 63, 62, 61, 60, 59, 58, 57, - 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, - 46, 45, 44, 43, 42, 40, 39, 38, 33, 32, - 29, 28, 27, 24, 21, 20, 18, 13, 12, 9, - 8, 7, 5, 3, 334, 334, 334, 334, 334, 334, - 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, - 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, - - 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, - 334, 334, 334 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "printrcl.l" -/* -*-Mode: C-*- - * "$Id: printrcl.l,v 1.10 2004/08/19 03:24:35 rlk Exp $" - * - * printrc parser - * - * Copyright 2003 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. - */ -#line 24 "printrcl.l" - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gutenprint/gutenprint-intl-internal.h> -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" -#include "printrc.h" - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#define YY_NO_UNPUT - -int mylineno = 1; - -#define DBG(x) \ -do \ - { \ - if (getenv("STP_DEBUG_PRINTRC")) \ - fprintf(stderr, "'%s' => %s\n", yytext, #x); \ - } \ - while (0) - -static char * -q_strdup(const char *s) -{ - /* Strip the leading and trailing quote */ - if (strlen(s) <= 2) - return NULL; - else - return g_strndup(s + 1, strlen(s) - 2); -} - -#line 710 "printrcl.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include <unistd.h> -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 73 "printrcl.l" - - -#line 866 "printrcl.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 335 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 375 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 75 "printrcl.l" -DBG(CURRENT_PRINTER); return CURRENT_PRINTER; - YY_BREAK -case 2: -YY_RULE_SETUP -#line 76 "printrcl.l" -DBG(SHOW_ALL_PAPER_SIZES); return SHOW_ALL_PAPER_SIZES; - YY_BREAK -case 3: -YY_RULE_SETUP -#line 77 "printrcl.l" -DBG(PRINTER); return PRINTER; - YY_BREAK -case 4: -YY_RULE_SETUP -#line 78 "printrcl.l" -DBG(DESTINATION); return DESTINATION; - YY_BREAK -case 5: -YY_RULE_SETUP -#line 79 "printrcl.l" -DBG(SCALING); return SCALING; - YY_BREAK -case 6: -YY_RULE_SETUP -#line 80 "printrcl.l" -DBG(ORIENTATION); return ORIENTATION; - YY_BREAK -case 7: -YY_RULE_SETUP -#line 81 "printrcl.l" -DBG(AUTOSIZE_ROLL_PAPER); return AUTOSIZE_ROLL_PAPER; - YY_BREAK -case 8: -YY_RULE_SETUP -#line 82 "printrcl.l" -DBG(UNIT); return UNIT; - YY_BREAK -case 9: -YY_RULE_SETUP -#line 83 "printrcl.l" -DBG(DRIVER); return DRIVER; - YY_BREAK -case 10: -YY_RULE_SETUP -#line 84 "printrcl.l" -DBG(LEFT); return LEFT; - YY_BREAK -case 11: -YY_RULE_SETUP -#line 85 "printrcl.l" -DBG(TOP); return TOP; - YY_BREAK -case 12: -YY_RULE_SETUP -#line 86 "printrcl.l" -DBG(CUSTOM_PAGE_WIDTH); return CUSTOM_PAGE_WIDTH; - YY_BREAK -case 13: -YY_RULE_SETUP -#line 87 "printrcl.l" -DBG(CUSTOM_PAGE_HEIGHT); return CUSTOM_PAGE_HEIGHT; - YY_BREAK -case 14: -YY_RULE_SETUP -#line 88 "printrcl.l" -DBG(OUTPUT_TYPE); return OUTPUT_TYPE; - YY_BREAK -case 15: -YY_RULE_SETUP -#line 89 "printrcl.l" -DBG(PARAMETER); return PARAMETER; - YY_BREAK -case 16: -YY_RULE_SETUP -#line 90 "printrcl.l" -DBG(QUEUE_NAME); return QUEUE_NAME; - YY_BREAK -case 17: -YY_RULE_SETUP -#line 91 "printrcl.l" -DBG(OUTPUT_FILENAME); return OUTPUT_FILENAME; - YY_BREAK -case 18: -YY_RULE_SETUP -#line 92 "printrcl.l" -DBG(EXTRA_PRINTER_OPTIONS); return EXTRA_PRINTER_OPTIONS; - YY_BREAK -case 19: -YY_RULE_SETUP -#line 93 "printrcl.l" -DBG(CUSTOM_COMMAND); return CUSTOM_COMMAND; - YY_BREAK -case 20: -YY_RULE_SETUP -#line 94 "printrcl.l" -DBG(COMMAND_TYPE); return COMMAND_TYPE; - YY_BREAK -case 21: -YY_RULE_SETUP -#line 95 "printrcl.l" -DBG(GLOBAL_SETTINGS); return GLOBAL_SETTINGS; - YY_BREAK -case 22: -YY_RULE_SETUP -#line 96 "printrcl.l" -DBG(END_GLOBAL_SETTINGS); return END_GLOBAL_SETTINGS; - YY_BREAK -case 23: -YY_RULE_SETUP -#line 97 "printrcl.l" -DBG(GLOBAL); return GLOBAL; - YY_BREAK -case 24: -YY_RULE_SETUP -#line 99 "printrcl.l" -DBG(pINT); return pINT; - YY_BREAK -case 25: -YY_RULE_SETUP -#line 100 "printrcl.l" -DBG(pSTRING_LIST); return pSTRING_LIST; - YY_BREAK -case 26: -YY_RULE_SETUP -#line 101 "printrcl.l" -DBG(pFILE); return pFILE; - YY_BREAK -case 27: -YY_RULE_SETUP -#line 102 "printrcl.l" -DBG(pDOUBLE); return pDOUBLE; - YY_BREAK -case 28: -YY_RULE_SETUP -#line 103 "printrcl.l" -DBG(pDIMENSION); return pDIMENSION; - YY_BREAK -case 29: -YY_RULE_SETUP -#line 104 "printrcl.l" -DBG(pBOOLEAN); return pBOOLEAN; - YY_BREAK -case 30: -YY_RULE_SETUP -#line 105 "printrcl.l" -DBG(pCURVE); return pCURVE; - YY_BREAK -case 31: -YY_RULE_SETUP -#line 107 "printrcl.l" -yylval.ival = atoi(yytext); DBG(tINT); return tINT; - YY_BREAK -case 32: -YY_RULE_SETUP -#line 108 "printrcl.l" -yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; - YY_BREAK -case 33: -/* rule 33 can match eol */ -YY_RULE_SETUP -#line 109 "printrcl.l" -yylval.sval = q_strdup(yytext); DBG(tSTRING); return tSTRING; - YY_BREAK -case 34: -YY_RULE_SETUP -#line 110 "printrcl.l" -yylval.sval = g_strdup(yytext); DBG(tBOOLEAN); return tBOOLEAN; - YY_BREAK -case 35: -YY_RULE_SETUP -#line 111 "printrcl.l" -yylval.sval = g_strdup(yytext); DBG(tWORD); return tWORD; - YY_BREAK -case 36: -/* rule 36 can match eol */ -YY_RULE_SETUP -#line 112 "printrcl.l" -DBG(PRINTRC_HDR); return PRINTRC_HDR; - YY_BREAK -case 37: -YY_RULE_SETUP -#line 113 "printrcl.l" -DBG(whitespace1); /* Skip blanks/tabs */ - YY_BREAK -case 38: -YY_RULE_SETUP -#line 114 "printrcl.l" -DBG(comment1); /* Skip comments */ - YY_BREAK -case 39: -/* rule 39 can match eol */ -YY_RULE_SETUP -#line 115 "printrcl.l" -DBG(newline); mylineno++; - YY_BREAK -case 40: -YY_RULE_SETUP -#line 116 "printrcl.l" -ECHO; - YY_BREAK -#line 1152 "printrcl.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 335 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 335 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 334); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 116 "printrcl.l" diff --git a/src/gutenprintui/printrcl.l b/src/gutenprintui/printrcl.l deleted file mode 100644 index cf4933e..0000000 --- a/src/gutenprintui/printrcl.l +++ /dev/null @@ -1,115 +0,0 @@ -/* -*-Mode: C-*- - * "$Id: printrcl.l,v 1.1 2004/09/17 18:38:14 rleigh Exp $" - * - * printrc parser - * - * Copyright 2003 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 <gutenprint/gutenprint-intl-internal.h> -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" -#include "printrc.h" - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#define YY_NO_UNPUT - -int mylineno = 1; - -#define DBG(x) \ -do \ - { \ - if (getenv("STP_DEBUG_PRINTRC")) \ - fprintf(stderr, "'%s' => %s\n", yytext, #x); \ - } \ - while (0) - -static char * -q_strdup(const char *s) -{ - /* Strip the leading and trailing quote */ - if (strlen(s) <= 2) - return NULL; - else - return g_strndup(s + 1, strlen(s) - 2); -} - -%} - -%option noyywrap - -digit [0-9] -boolean (True)|(False) -integer [-+]?{digit}+ -float [-+]?{digit}+(\.{digit}+)?([eE][-+]?{digit}+)? -string ([\"][^\"\n]*[\"])|([\'][^\']*[\']) -ws [ \t]+ -printrc_hdr #PRINTRCv[234].*\n -word [a-zA-Z][a-zA-Z0-9_]* - -%% - -Current-Printer: DBG(CURRENT_PRINTER); return CURRENT_PRINTER; -Show-All-Paper-Sizes: DBG(SHOW_ALL_PAPER_SIZES); return SHOW_ALL_PAPER_SIZES; -Printer: DBG(PRINTER); return PRINTER; -Destination: DBG(DESTINATION); return DESTINATION; -Scaling: DBG(SCALING); return SCALING; -Orientation: DBG(ORIENTATION); return ORIENTATION; -Autosize-Roll-Paper: DBG(AUTOSIZE_ROLL_PAPER); return AUTOSIZE_ROLL_PAPER; -Unit: DBG(UNIT); return UNIT; -Driver: DBG(DRIVER); return DRIVER; -Left: DBG(LEFT); return LEFT; -Top: DBG(TOP); return TOP; -Custom_Page_Width: DBG(CUSTOM_PAGE_WIDTH); return CUSTOM_PAGE_WIDTH; -Custom_Page_Height: DBG(CUSTOM_PAGE_HEIGHT); return CUSTOM_PAGE_HEIGHT; -Output_Type: DBG(OUTPUT_TYPE); return OUTPUT_TYPE; -Parameter DBG(PARAMETER); return PARAMETER; -Queue-Name: DBG(QUEUE_NAME); return QUEUE_NAME; -Output-Filename: DBG(OUTPUT_FILENAME); return OUTPUT_FILENAME; -Extra-Printer-Options: DBG(EXTRA_PRINTER_OPTIONS); return EXTRA_PRINTER_OPTIONS; -Custom-Command: DBG(CUSTOM_COMMAND); return CUSTOM_COMMAND; -Command-Type: DBG(COMMAND_TYPE); return COMMAND_TYPE; -Global-Settings: DBG(GLOBAL_SETTINGS); return GLOBAL_SETTINGS; -End-Global-Settings: DBG(END_GLOBAL_SETTINGS); return END_GLOBAL_SETTINGS; -Global: DBG(GLOBAL); return GLOBAL; - -Int DBG(pINT); return pINT; -String DBG(pSTRING_LIST); return pSTRING_LIST; -File DBG(pFILE); return pFILE; -Double DBG(pDOUBLE); return pDOUBLE; -Dimension DBG(pDIMENSION); return pDIMENSION; -Boolean DBG(pBOOLEAN); return pBOOLEAN; -Curve DBG(pCURVE); return pCURVE; - -{integer} yylval.ival = atoi(yytext); DBG(tINT); return tINT; -{float} yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; -{string} yylval.sval = q_strdup(yytext); DBG(tSTRING); return tSTRING; -{boolean} yylval.sval = g_strdup(yytext); DBG(tBOOLEAN); return tBOOLEAN; -{word} yylval.sval = g_strdup(yytext); DBG(tWORD); return tWORD; -{printrc_hdr} DBG(PRINTRC_HDR); return PRINTRC_HDR; -{ws} DBG(whitespace1); /* Skip blanks/tabs */ -#[^\n]* DBG(comment1); /* Skip comments */ -\n DBG(newline); mylineno++; diff --git a/src/gutenprintui/printrcy.c b/src/gutenprintui/printrcy.c deleted file mode 100644 index ffc38c6..0000000 --- a/src/gutenprintui/printrcy.c +++ /dev/null @@ -1,2061 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - - - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - tINT = 258, - tDOUBLE = 259, - tDIMENSION = 260, - tBOOLEAN = 261, - tSTRING = 262, - tWORD = 263, - tGSWORD = 264, - CURRENT_PRINTER = 265, - SHOW_ALL_PAPER_SIZES = 266, - PRINTER = 267, - DESTINATION = 268, - SCALING = 269, - ORIENTATION = 270, - AUTOSIZE_ROLL_PAPER = 271, - UNIT = 272, - DRIVER = 273, - LEFT = 274, - TOP = 275, - CUSTOM_PAGE_WIDTH = 276, - CUSTOM_PAGE_HEIGHT = 277, - OUTPUT_TYPE = 278, - PRINTRC_HDR = 279, - PARAMETER = 280, - QUEUE_NAME = 281, - OUTPUT_FILENAME = 282, - EXTRA_PRINTER_OPTIONS = 283, - CUSTOM_COMMAND = 284, - COMMAND_TYPE = 285, - GLOBAL_SETTINGS = 286, - GLOBAL = 287, - END_GLOBAL_SETTINGS = 288, - pINT = 289, - pSTRING_LIST = 290, - pFILE = 291, - pDOUBLE = 292, - pDIMENSION = 293, - pBOOLEAN = 294, - pCURVE = 295 - }; -#endif -/* Tokens. */ -#define tINT 258 -#define tDOUBLE 259 -#define tDIMENSION 260 -#define tBOOLEAN 261 -#define tSTRING 262 -#define tWORD 263 -#define tGSWORD 264 -#define CURRENT_PRINTER 265 -#define SHOW_ALL_PAPER_SIZES 266 -#define PRINTER 267 -#define DESTINATION 268 -#define SCALING 269 -#define ORIENTATION 270 -#define AUTOSIZE_ROLL_PAPER 271 -#define UNIT 272 -#define DRIVER 273 -#define LEFT 274 -#define TOP 275 -#define CUSTOM_PAGE_WIDTH 276 -#define CUSTOM_PAGE_HEIGHT 277 -#define OUTPUT_TYPE 278 -#define PRINTRC_HDR 279 -#define PARAMETER 280 -#define QUEUE_NAME 281 -#define OUTPUT_FILENAME 282 -#define EXTRA_PRINTER_OPTIONS 283 -#define CUSTOM_COMMAND 284 -#define COMMAND_TYPE 285 -#define GLOBAL_SETTINGS 286 -#define GLOBAL 287 -#define END_GLOBAL_SETTINGS 288 -#define pINT 289 -#define pSTRING_LIST 290 -#define pFILE 291 -#define pDOUBLE 292 -#define pDIMENSION 293 -#define pBOOLEAN 294 -#define pCURVE 295 - - - - -/* Copy the first part of user declarations. */ -#line 23 "printrcy.y" - - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gutenprint/gutenprint-intl-internal.h> -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" -#include "printrc.h" - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -extern int mylineno; - -extern int yylex(void); -char *quotestrip(const char *i); -char *endstrip(const char *i); - -extern char* yytext; - -static int yyerror( const char *s ) -{ - fprintf(stderr,"stdin:%d: %s before '%s'\n", mylineno, s, yytext); - return 0; -} - -static stpui_plist_t *current_printer = NULL; - - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - - -/* Copy the second part of user declarations. */ - - -/* Line 216 of yacc.c. */ -#line 219 "printrcy.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 10 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 75 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 41 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 42 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 70 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 114 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 295 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40 -}; - -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 7, 10, 13, 16, 19, 22, 25, - 28, 31, 34, 37, 40, 43, 46, 49, 52, 53, - 58, 63, 68, 73, 78, 83, 88, 90, 92, 94, - 96, 98, 100, 102, 105, 108, 110, 112, 114, 116, - 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, - 138, 140, 143, 145, 149, 152, 154, 157, 160, 162, - 164, 167, 170, 172, 174, 177, 179, 183, 185, 187, - 189 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 82, 0, -1, 12, 7, 7, -1, 13, 7, -1, - 26, 7, -1, 27, 7, -1, 28, 7, -1, 29, - 7, -1, 30, 3, -1, 14, 4, -1, 15, 3, - -1, 16, 3, -1, 17, 3, -1, 19, 3, -1, - 20, 3, -1, 23, 3, -1, 21, 3, -1, 22, - 3, -1, -1, 8, 34, 6, 3, -1, 8, 35, - 6, 7, -1, 8, 36, 6, 7, -1, 8, 37, - 6, 4, -1, 8, 38, 6, 3, -1, 8, 39, - 6, 6, -1, 8, 40, 6, 7, -1, 59, -1, - 60, -1, 61, -1, 62, -1, 64, -1, 65, -1, - 63, -1, 25, 66, -1, 68, 67, -1, 58, -1, - 43, -1, 49, -1, 50, -1, 51, -1, 52, -1, - 53, -1, 54, -1, 56, -1, 57, -1, 55, -1, - 44, -1, 45, -1, 46, -1, 47, -1, 48, -1, - 70, 69, -1, 58, -1, 42, 70, 68, -1, 72, - 71, -1, 58, -1, 10, 7, -1, 11, 6, -1, - 73, -1, 74, -1, 73, 74, -1, 8, 7, -1, - 75, -1, 77, -1, 79, 78, -1, 58, -1, 31, - 79, 33, -1, 80, -1, 76, -1, 58, -1, 24, - 81, 72, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 100, 100, 111, 118, 128, 138, 148, 158, 165, - 172, 179, 186, 193, 200, 207, 228, 235, 242, 245, - 262, 280, 298, 315, 332, 353, 376, 376, 376, 376, - 377, 377, 377, 380, 383, 383, 386, 386, 386, 386, - 387, 387, 387, 387, 387, 388, 388, 388, 388, 389, - 389, 392, 392, 395, 398, 398, 401, 405, 415, 415, - 418, 421, 432, 432, 435, 435, 438, 441, 441, 441, - 444 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "tINT", "tDOUBLE", "tDIMENSION", - "tBOOLEAN", "tSTRING", "tWORD", "tGSWORD", "CURRENT_PRINTER", - "SHOW_ALL_PAPER_SIZES", "PRINTER", "DESTINATION", "SCALING", - "ORIENTATION", "AUTOSIZE_ROLL_PAPER", "UNIT", "DRIVER", "LEFT", "TOP", - "CUSTOM_PAGE_WIDTH", "CUSTOM_PAGE_HEIGHT", "OUTPUT_TYPE", "PRINTRC_HDR", - "PARAMETER", "QUEUE_NAME", "OUTPUT_FILENAME", "EXTRA_PRINTER_OPTIONS", - "CUSTOM_COMMAND", "COMMAND_TYPE", "GLOBAL_SETTINGS", "GLOBAL", - "END_GLOBAL_SETTINGS", "pINT", "pSTRING_LIST", "pFILE", "pDOUBLE", - "pDIMENSION", "pBOOLEAN", "pCURVE", "$accept", "Printer", "Destination", - "Queue_Name", "Output_Filename", "Extra_Printer_Options", - "Custom_Command", "Command_Type", "Scaling", "Orientation", - "Autosize_Roll_Paper", "Unit", "Left", "Top", "Output_Type", - "Custom_Page_Width", "Custom_Page_Height", "Empty", "Int_Param", - "String_List_Param", "File_Param", "Double_Param", "Dimension_Param", - "Boolean_Param", "Curve_Param", "Typed_Param", "Parameter", "Parameters", - "Standard_Value", "Standard_Values", "A_Printer", "Printers", - "Current_Printer", "Show_All_Paper_Sizes", "Global", "Old_Globals", - "New_Global_Setting", "Global_Setting", "Global_Settings", - "Global_Subblock", "Global_Block", "Thing", 0 -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295 -}; -# endif - -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 66, 66, 66, - 66, 66, 66, 67, 68, 68, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 70, 70, 71, 72, 72, 73, 74, 75, 75, - 76, 77, 78, 78, 79, 79, 80, 81, 81, 81, - 82 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 3, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 0, 4, - 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 3, 2, 1, 2, 2, 1, 1, - 2, 2, 1, 1, 2, 1, 3, 1, 1, 1, - 3 -}; - -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 18, 0, 0, 18, 69, 0, 68, 67, 18, - 1, 56, 65, 0, 0, 60, 55, 70, 0, 66, - 58, 59, 62, 63, 64, 57, 0, 18, 54, 61, - 0, 52, 18, 2, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, - 46, 47, 48, 49, 50, 37, 38, 39, 40, 41, - 42, 45, 43, 44, 35, 53, 51, 3, 9, 10, - 11, 12, 13, 14, 16, 17, 15, 4, 5, 6, - 7, 8, 0, 34, 0, 26, 27, 28, 29, 32, - 30, 31, 33, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, - 22, 23, 24, 25 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 27, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 5, 85, 86, - 87, 88, 89, 90, 91, 92, 83, 65, 66, 32, - 28, 17, 6, 15, 22, 7, 23, 24, 13, 8, - 9, 2 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -26 -static const yytype_int8 yypact[] = -{ - -22, -2, 6, 0, -26, -26, 5, -26, -26, -26, - -26, -26, -26, -7, 11, -26, -26, 7, 13, -26, - -26, -26, -26, -26, -26, -26, 14, -26, -26, -26, - 15, -26, 17, -26, 18, 20, 24, 32, 38, 39, - 45, 46, 47, 48, 49, 50, 51, 52, 57, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, 27, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, 10, -26, -25, -26, -26, -26, -26, -26, - -26, -26, -26, 55, 56, 58, 59, 60, 61, 62, - 66, 63, 64, 68, 70, 69, 67, -26, -26, -26, - -26, -26, -26, -26 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -4, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, 40, 41, -26, -26, -26, -26, -26, -26, - -26, -26 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = -{ - 12, 18, 1, 3, 14, 16, 10, 11, 3, 93, - 94, 95, 96, 97, 98, 99, 14, 25, 84, 26, - 29, 30, 33, 31, 68, 67, 19, 69, 64, 4, - 34, 35, 36, 37, 38, 70, 39, 40, 41, 42, - 43, 71, 72, 44, 45, 46, 47, 48, 73, 74, - 75, 76, 82, 20, 21, 0, 77, 78, 79, 80, - 81, 100, 101, 0, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 113, 112 -}; - -static const yytype_int8 yycheck[] = -{ - 4, 8, 24, 10, 11, 9, 0, 7, 10, 34, - 35, 36, 37, 38, 39, 40, 11, 6, 8, 12, - 7, 7, 7, 27, 4, 7, 33, 3, 32, 31, - 13, 14, 15, 16, 17, 3, 19, 20, 21, 22, - 23, 3, 3, 26, 27, 28, 29, 30, 3, 3, - 3, 3, 25, 13, 13, -1, 7, 7, 7, 7, - 3, 6, 6, -1, 6, 6, 6, 6, 6, 3, - 7, 7, 4, 3, 7, 6 -}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 24, 82, 10, 31, 58, 73, 76, 80, 81, - 0, 7, 58, 79, 11, 74, 58, 72, 8, 33, - 73, 74, 75, 77, 78, 6, 12, 42, 71, 7, - 7, 58, 70, 7, 13, 14, 15, 16, 17, 19, - 20, 21, 22, 23, 26, 27, 28, 29, 30, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 68, 69, 7, 4, 3, - 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, - 7, 3, 25, 67, 8, 59, 60, 61, 62, 63, - 64, 65, 66, 34, 35, 36, 37, 38, 39, 40, - 6, 6, 6, 6, 6, 6, 6, 3, 7, 7, - 4, 3, 6, 7 -}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ - - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*----------. -| yyparse. | -`----------*/ - -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () - -#endif -#endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; - - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 101 "printrcy.y" - { - current_printer = stpui_plist_create((yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].sval)); - g_free((yyvsp[(2) - (3)].sval)); - g_free((yyvsp[(3) - (3)].sval)); - } - break; - - case 3: -#line 112 "printrcy.y" - { - if ((yyvsp[(2) - (2)].sval)) - g_free((yyvsp[(2) - (2)].sval)); - } - break; - - case 4: -#line 119 "printrcy.y" - { - if (current_printer && (yyvsp[(2) - (2)].sval)) - { - stpui_plist_set_queue_name(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); - } - } - break; - - case 5: -#line 129 "printrcy.y" - { - if (current_printer && (yyvsp[(2) - (2)].sval)) - { - stpui_plist_set_output_filename(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); - } - } - break; - - case 6: -#line 139 "printrcy.y" - { - if (current_printer && (yyvsp[(2) - (2)].sval)) - { - stpui_plist_set_extra_printer_options(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); - } - } - break; - - case 7: -#line 149 "printrcy.y" - { - if (current_printer && (yyvsp[(2) - (2)].sval)) - { - stpui_plist_set_custom_command(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); - } - } - break; - - case 8: -#line 159 "printrcy.y" - { - if (current_printer) - stpui_plist_set_command_type(current_printer, (yyvsp[(2) - (2)].ival)); - } - break; - - case 9: -#line 166 "printrcy.y" - { - if (current_printer) - current_printer->scaling = (yyvsp[(2) - (2)].dval); - } - break; - - case 10: -#line 173 "printrcy.y" - { - if (current_printer) - current_printer->orientation = (yyvsp[(2) - (2)].ival); - } - break; - - case 11: -#line 180 "printrcy.y" - { - if (current_printer) - current_printer->auto_size_roll_feed_paper = (yyvsp[(2) - (2)].ival); - } - break; - - case 12: -#line 187 "printrcy.y" - { - if (current_printer) - current_printer->unit = (yyvsp[(2) - (2)].ival); - } - break; - - case 13: -#line 194 "printrcy.y" - { - if (current_printer) - stp_set_left(current_printer->v, (yyvsp[(2) - (2)].ival)); - } - break; - - case 14: -#line 201 "printrcy.y" - { - if (current_printer) - stp_set_top(current_printer->v, (yyvsp[(2) - (2)].ival)); - } - break; - - case 15: -#line 208 "printrcy.y" - { - if (current_printer) - { - switch ((yyvsp[(2) - (2)].ival)) - { - case 0: - stp_set_string_parameter - (current_printer->v, "PrintingMode", "BW"); - break; - case 1: - case 2: - default: - stp_set_string_parameter - (current_printer->v, "PrintingMode", "Color"); - break; - } - } - } - break; - - case 16: -#line 229 "printrcy.y" - { - if (current_printer) - stp_set_page_width(current_printer->v, (yyvsp[(2) - (2)].ival)); - } - break; - - case 17: -#line 236 "printrcy.y" - { - if (current_printer) - stp_set_page_height(current_printer->v, (yyvsp[(2) - (2)].ival)); - } - break; - - case 19: -#line 246 "printrcy.y" - { - if (current_printer) - { - stp_set_int_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].ival)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_int_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_INACTIVE); - else - stp_set_int_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_ACTIVE); - } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - } - break; - - case 20: -#line 263 "printrcy.y" - { - if (current_printer) - { - stp_set_string_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].sval)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_string_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_INACTIVE); - else - stp_set_string_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_ACTIVE); - } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); - } - break; - - case 21: -#line 281 "printrcy.y" - { - if (current_printer) - { - stp_set_file_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].sval)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_file_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_INACTIVE); - else - stp_set_file_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_ACTIVE); - } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); - } - break; - - case 22: -#line 299 "printrcy.y" - { - if (current_printer) - { - stp_set_float_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].dval)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_float_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_INACTIVE); - else - stp_set_float_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_ACTIVE); - } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - } - break; - - case 23: -#line 316 "printrcy.y" - { - if (current_printer) - { - stp_set_dimension_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].ival)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_dimension_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_INACTIVE); - else - stp_set_dimension_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_ACTIVE); - } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - } - break; - - case 24: -#line 333 "printrcy.y" - { - if (current_printer) - { - if (strcmp((yyvsp[(4) - (4)].sval), "False") == 0) - stp_set_boolean_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), 0); - else - stp_set_boolean_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), 1); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_boolean_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_INACTIVE); - else - stp_set_boolean_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_ACTIVE); - } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); - } - break; - - case 25: -#line 354 "printrcy.y" - { - if (current_printer) - { - stp_curve_t *curve = stp_curve_create_from_string((yyvsp[(4) - (4)].sval)); - if (curve) - { - stp_set_curve_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), curve); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_curve_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_INACTIVE); - else - stp_set_curve_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), - STP_PARAMETER_ACTIVE); - stp_curve_destroy(curve); - } - } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); - } - break; - - case 56: -#line 402 "printrcy.y" - { stpui_printrc_current_printer = (yyvsp[(2) - (2)].sval); } - break; - - case 57: -#line 406 "printrcy.y" - { - if (strcmp((yyvsp[(2) - (2)].sval), "True") == 0) - stpui_show_all_paper_sizes = 1; - else - stpui_show_all_paper_sizes = 0; - g_free((yyvsp[(2) - (2)].sval)); - } - break; - - case 61: -#line 422 "printrcy.y" - { - if ((yyvsp[(2) - (2)].sval)) - { - stpui_set_global_parameter((yyvsp[(1) - (2)].sval), (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); - } - g_free((yyvsp[(1) - (2)].sval)); - } - break; - - -/* Line 1267 of yacc.c. */ -#line 1846 "printrcy.c" - default: break; - } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse look-ahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); -} - - -#line 447 "printrcy.y" - - diff --git a/src/gutenprintui/printrcy.h b/src/gutenprintui/printrcy.h deleted file mode 100644 index 8a6c041..0000000 --- a/src/gutenprintui/printrcy.h +++ /dev/null @@ -1,133 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - tINT = 258, - tDOUBLE = 259, - tDIMENSION = 260, - tBOOLEAN = 261, - tSTRING = 262, - tWORD = 263, - tGSWORD = 264, - CURRENT_PRINTER = 265, - SHOW_ALL_PAPER_SIZES = 266, - PRINTER = 267, - DESTINATION = 268, - SCALING = 269, - ORIENTATION = 270, - AUTOSIZE_ROLL_PAPER = 271, - UNIT = 272, - DRIVER = 273, - LEFT = 274, - TOP = 275, - CUSTOM_PAGE_WIDTH = 276, - CUSTOM_PAGE_HEIGHT = 277, - OUTPUT_TYPE = 278, - PRINTRC_HDR = 279, - PARAMETER = 280, - QUEUE_NAME = 281, - OUTPUT_FILENAME = 282, - EXTRA_PRINTER_OPTIONS = 283, - CUSTOM_COMMAND = 284, - COMMAND_TYPE = 285, - GLOBAL_SETTINGS = 286, - GLOBAL = 287, - END_GLOBAL_SETTINGS = 288, - pINT = 289, - pSTRING_LIST = 290, - pFILE = 291, - pDOUBLE = 292, - pDIMENSION = 293, - pBOOLEAN = 294, - pCURVE = 295 - }; -#endif -/* Tokens. */ -#define tINT 258 -#define tDOUBLE 259 -#define tDIMENSION 260 -#define tBOOLEAN 261 -#define tSTRING 262 -#define tWORD 263 -#define tGSWORD 264 -#define CURRENT_PRINTER 265 -#define SHOW_ALL_PAPER_SIZES 266 -#define PRINTER 267 -#define DESTINATION 268 -#define SCALING 269 -#define ORIENTATION 270 -#define AUTOSIZE_ROLL_PAPER 271 -#define UNIT 272 -#define DRIVER 273 -#define LEFT 274 -#define TOP 275 -#define CUSTOM_PAGE_WIDTH 276 -#define CUSTOM_PAGE_HEIGHT 277 -#define OUTPUT_TYPE 278 -#define PRINTRC_HDR 279 -#define PARAMETER 280 -#define QUEUE_NAME 281 -#define OUTPUT_FILENAME 282 -#define EXTRA_PRINTER_OPTIONS 283 -#define CUSTOM_COMMAND 284 -#define COMMAND_TYPE 285 -#define GLOBAL_SETTINGS 286 -#define GLOBAL 287 -#define END_GLOBAL_SETTINGS 288 -#define pINT 289 -#define pSTRING_LIST 290 -#define pFILE 291 -#define pDOUBLE 292 -#define pDIMENSION 293 -#define pBOOLEAN 294 -#define pCURVE 295 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - -extern YYSTYPE yylval; - diff --git a/src/gutenprintui/printrcy.y b/src/gutenprintui/printrcy.y deleted file mode 100644 index f2dd851..0000000 --- a/src/gutenprintui/printrcy.y +++ /dev/null @@ -1,447 +0,0 @@ -/* - * "$Id: printrcy.y,v 1.1.18.1 2007/03/02 12:01:19 rlk Exp $" - * - * Test pattern generator for Gutenprint - * - * Copyright 2001 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 <gutenprint/gutenprint-intl-internal.h> -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" -#include "printrc.h" - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -extern int mylineno; - -extern int yylex(void); -char *quotestrip(const char *i); -char *endstrip(const char *i); - -extern char* yytext; - -static int yyerror( const char *s ) -{ - fprintf(stderr,"stdin:%d: %s before '%s'\n", mylineno, s, yytext); - return 0; -} - -static stpui_plist_t *current_printer = NULL; - -%} - -%token <ival> tINT -%token <dval> tDOUBLE -%token <ival> tDIMENSION -%token <sval> tBOOLEAN -%token <sval> tSTRING -%token <sval> tWORD -%token <sval> tGSWORD - -%token CURRENT_PRINTER -%token SHOW_ALL_PAPER_SIZES -%token PRINTER -%token DESTINATION -%token SCALING -%token ORIENTATION -%token AUTOSIZE_ROLL_PAPER -%token UNIT -%token DRIVER -%token LEFT -%token TOP -%token CUSTOM_PAGE_WIDTH -%token CUSTOM_PAGE_HEIGHT -%token OUTPUT_TYPE -%token PRINTRC_HDR -%token PARAMETER -%token QUEUE_NAME -%token OUTPUT_FILENAME -%token EXTRA_PRINTER_OPTIONS -%token CUSTOM_COMMAND -%token COMMAND_TYPE -%token GLOBAL_SETTINGS -%token GLOBAL -%token END_GLOBAL_SETTINGS -%token pINT -%token pSTRING_LIST -%token pFILE -%token pDOUBLE -%token pDIMENSION -%token pBOOLEAN -%token pCURVE - -%start Thing - -%% - -Printer: PRINTER tSTRING tSTRING - { - current_printer = stpui_plist_create($2, $3); - g_free($2); - g_free($3); - } -; - -/* - * Destination is obsolete; ignore it. - */ -Destination: DESTINATION tSTRING - { - if ($2) - g_free($2); - } -; - -Queue_Name: QUEUE_NAME tSTRING - { - if (current_printer && $2) - { - stpui_plist_set_queue_name(current_printer, $2); - g_free($2); - } - } -; - -Output_Filename: OUTPUT_FILENAME tSTRING - { - if (current_printer && $2) - { - stpui_plist_set_output_filename(current_printer, $2); - g_free($2); - } - } -; - -Extra_Printer_Options: EXTRA_PRINTER_OPTIONS tSTRING - { - if (current_printer && $2) - { - stpui_plist_set_extra_printer_options(current_printer, $2); - g_free($2); - } - } -; - -Custom_Command: CUSTOM_COMMAND tSTRING - { - if (current_printer && $2) - { - stpui_plist_set_custom_command(current_printer, $2); - g_free($2); - } - } -; - -Command_Type: COMMAND_TYPE tINT - { - if (current_printer) - stpui_plist_set_command_type(current_printer, $2); - } -; - -Scaling: SCALING tDOUBLE - { - if (current_printer) - current_printer->scaling = $2; - } -; - -Orientation: ORIENTATION tINT - { - if (current_printer) - current_printer->orientation = $2; - } -; - -Autosize_Roll_Paper: AUTOSIZE_ROLL_PAPER tINT - { - if (current_printer) - current_printer->auto_size_roll_feed_paper = $2; - } -; - -Unit: UNIT tINT - { - if (current_printer) - current_printer->unit = $2; - } -; - -Left: LEFT tINT - { - if (current_printer) - stp_set_left(current_printer->v, $2); - } -; - -Top: TOP tINT - { - if (current_printer) - stp_set_top(current_printer->v, $2); - } -; - -Output_Type: OUTPUT_TYPE tINT - { - if (current_printer) - { - switch ($2) - { - case 0: - stp_set_string_parameter - (current_printer->v, "PrintingMode", "BW"); - break; - case 1: - case 2: - default: - stp_set_string_parameter - (current_printer->v, "PrintingMode", "Color"); - break; - } - } - } -; - -Custom_Page_Width: CUSTOM_PAGE_WIDTH tINT - { - if (current_printer) - stp_set_page_width(current_printer->v, $2); - } -; - -Custom_Page_Height: CUSTOM_PAGE_HEIGHT tINT - { - if (current_printer) - stp_set_page_height(current_printer->v, $2); - } -; - -Empty: -; - -Int_Param: tWORD pINT tBOOLEAN tINT - { - if (current_printer) - { - stp_set_int_parameter(current_printer->v, $1, $4); - if (strcmp($3, "False") == 0) - stp_set_int_parameter_active(current_printer->v, $1, - STP_PARAMETER_INACTIVE); - else - stp_set_int_parameter_active(current_printer->v, $1, - STP_PARAMETER_ACTIVE); - } - g_free($1); - g_free($3); - } -; - -String_List_Param: tWORD pSTRING_LIST tBOOLEAN tSTRING - { - if (current_printer) - { - stp_set_string_parameter(current_printer->v, $1, $4); - if (strcmp($3, "False") == 0) - stp_set_string_parameter_active(current_printer->v, $1, - STP_PARAMETER_INACTIVE); - else - stp_set_string_parameter_active(current_printer->v, $1, - STP_PARAMETER_ACTIVE); - } - g_free($1); - g_free($3); - g_free($4); - } -; - -File_Param: tWORD pFILE tBOOLEAN tSTRING - { - if (current_printer) - { - stp_set_file_parameter(current_printer->v, $1, $4); - if (strcmp($3, "False") == 0) - stp_set_file_parameter_active(current_printer->v, $1, - STP_PARAMETER_INACTIVE); - else - stp_set_file_parameter_active(current_printer->v, $1, - STP_PARAMETER_ACTIVE); - } - g_free($1); - g_free($3); - g_free($4); - } -; - -Double_Param: tWORD pDOUBLE tBOOLEAN tDOUBLE - { - if (current_printer) - { - stp_set_float_parameter(current_printer->v, $1, $4); - if (strcmp($3, "False") == 0) - stp_set_float_parameter_active(current_printer->v, $1, - STP_PARAMETER_INACTIVE); - else - stp_set_float_parameter_active(current_printer->v, $1, - STP_PARAMETER_ACTIVE); - } - g_free($1); - g_free($3); - } -; - -Dimension_Param: tWORD pDIMENSION tBOOLEAN tINT - { - if (current_printer) - { - stp_set_dimension_parameter(current_printer->v, $1, $4); - if (strcmp($3, "False") == 0) - stp_set_dimension_parameter_active(current_printer->v, $1, - STP_PARAMETER_INACTIVE); - else - stp_set_dimension_parameter_active(current_printer->v, $1, - STP_PARAMETER_ACTIVE); - } - g_free($1); - g_free($3); - } -; - -Boolean_Param: tWORD pBOOLEAN tBOOLEAN tBOOLEAN - { - if (current_printer) - { - if (strcmp($4, "False") == 0) - stp_set_boolean_parameter(current_printer->v, $1, 0); - else - stp_set_boolean_parameter(current_printer->v, $1, 1); - if (strcmp($3, "False") == 0) - stp_set_boolean_parameter_active(current_printer->v, $1, - STP_PARAMETER_INACTIVE); - else - stp_set_boolean_parameter_active(current_printer->v, $1, - STP_PARAMETER_ACTIVE); - } - g_free($1); - g_free($3); - g_free($4); - } -; - -Curve_Param: tWORD pCURVE tBOOLEAN tSTRING - { - if (current_printer) - { - stp_curve_t *curve = stp_curve_create_from_string($4); - if (curve) - { - stp_set_curve_parameter(current_printer->v, $1, curve); - if (strcmp($3, "False") == 0) - stp_set_curve_parameter_active(current_printer->v, $1, - STP_PARAMETER_INACTIVE); - else - stp_set_curve_parameter_active(current_printer->v, $1, - STP_PARAMETER_ACTIVE); - stp_curve_destroy(curve); - } - } - g_free($1); - g_free($3); - g_free($4); - } -; - -Typed_Param: Int_Param | String_List_Param | File_Param | Double_Param - | Boolean_Param | Curve_Param | Dimension_Param -; - -Parameter: PARAMETER Typed_Param -; - -Parameters: Parameters Parameter | Empty -; - -Standard_Value: Destination | Scaling | Orientation | Autosize_Roll_Paper | - Unit | Left | Top | Custom_Page_Width | Custom_Page_Height | - Output_Type | Queue_Name | Output_Filename | Extra_Printer_Options | - Custom_Command | Command_Type -; - -Standard_Values: Standard_Values Standard_Value | Empty -; - -A_Printer: Printer Standard_Values Parameters -; - -Printers: Printers A_Printer | Empty -; - -Current_Printer: CURRENT_PRINTER tSTRING - { stpui_printrc_current_printer = $2; } -; - -Show_All_Paper_Sizes: SHOW_ALL_PAPER_SIZES tBOOLEAN - { - if (strcmp($2, "True") == 0) - stpui_show_all_paper_sizes = 1; - else - stpui_show_all_paper_sizes = 0; - g_free($2); - } -; - -Global: Current_Printer | Show_All_Paper_Sizes -; - -Old_Globals: Current_Printer Show_All_Paper_Sizes -; - -New_Global_Setting: tWORD tSTRING - { - if ($2) - { - stpui_set_global_parameter($1, $2); - g_free($2); - } - g_free($1); - } -; - -Global_Setting: Global | New_Global_Setting -; - -Global_Settings: Global_Settings Global_Setting | Empty -; - -Global_Subblock: GLOBAL_SETTINGS Global_Settings END_GLOBAL_SETTINGS -; - -Global_Block: Global_Subblock | Old_Globals | Empty -; - -Thing: PRINTRC_HDR Global_Block Printers -; - -%% diff --git a/src/gutenprintui/ui-utils.c b/src/gutenprintui/ui-utils.c deleted file mode 100644 index ebac462..0000000 --- a/src/gutenprintui/ui-utils.c +++ /dev/null @@ -1,870 +0,0 @@ -/* - * "$Id: ui-utils.c,v 1.2 2006/05/28 16:59:04 rlk Exp $" - * - * Main window code for Print plug-in for the GIMP. - * - * Copyright 1997-2000 Michael Sweet (mike@easysw.com), - * Robert Krawitz (rlk@alum.mit.edu), Steve Miller (smiller@rni.net) - * and Michael Natterer (mitch@gimp.org) - * - * 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 <gutenprint/gutenprint-intl-internal.h> -#include <gutenprintui/gutenprintui.h> -#include "gutenprintui-internal.h" - -#include <stdio.h> -#include <string.h> - -static void default_errfunc(void *data, const char *buffer, size_t bytes); -static gchar *image_filename; -static stp_outfunc_t the_errfunc = default_errfunc; -static void *the_errdata = NULL; -static get_thumbnail_func_t thumbnail_func; -static void *thumbnail_private_data; - -/*****************************************************************\ -* * -* The following from libgimp/gimpdialog.c * -* * -\*****************************************************************/ - -/* local callbacks of dialog_new () */ -static gint -dialog_delete_callback (GtkWidget *widget, - GdkEvent *event, - gpointer data) -{ - GtkSignalFunc cancel_callback; - GtkWidget *cancel_widget; - - cancel_callback = - (GtkSignalFunc) gtk_object_get_data (GTK_OBJECT (widget), - "dialog_cancel_callback"); - cancel_widget = - (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget), - "dialog_cancel_widget"); - - /* the cancel callback has to destroy the dialog */ - if (cancel_callback) - (* cancel_callback) (cancel_widget, data); - - return TRUE; -} - -/** - * dialog_create_action_areav: - * @dialog: The #GtkDialog you want to create the action_area for. - * @args: A @va_list as obtained with va_start() describing the action_area - * buttons. - * - */ -static void -dialog_create_action_areav (GtkDialog *dialog, - va_list args) -{ - GtkWidget *hbbox = NULL; - GtkWidget *button; - - /* action area variables */ - const gchar *label; - GtkSignalFunc callback; - gpointer data; - GtkObject *slot_object; - GtkWidget **widget_ptr; - gboolean default_action; - gboolean connect_delete; - - gboolean delete_connected = FALSE; - - g_return_if_fail (dialog != NULL); - g_return_if_fail (GTK_IS_DIALOG (dialog)); - - /* prepare the action_area */ - label = va_arg (args, const gchar *); - - if (label) - { - gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 2); - gtk_box_set_homogeneous (GTK_BOX (dialog->action_area), FALSE); - - hbbox = gtk_hbutton_box_new (); - gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4); - gtk_box_pack_end (GTK_BOX (dialog->action_area), hbbox, FALSE, FALSE, 0); - gtk_widget_show (hbbox); - } - - /* the action_area buttons */ - while (label) - { - callback = va_arg (args, GtkSignalFunc); - data = va_arg (args, gpointer); - slot_object = va_arg (args, GtkObject *); - widget_ptr = va_arg (args, GtkWidget **); - default_action = va_arg (args, gboolean); - connect_delete = va_arg (args, gboolean); - - button = gtk_button_new_with_label (label); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); - gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); - - if (slot_object == (GtkObject *) 1) - slot_object = GTK_OBJECT (dialog); - - if (data == NULL) - data = dialog; - - if (callback) - { - if (slot_object) - gtk_signal_connect_object (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (callback), - slot_object); - else - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (callback), - data); - } - - if (widget_ptr) - *widget_ptr = button; - - if (connect_delete && callback && !delete_connected) - { - gtk_object_set_data (GTK_OBJECT (dialog), - "dialog_cancel_callback", - (gpointer) callback); - gtk_object_set_data (GTK_OBJECT (dialog), - "dialog_cancel_widget", - slot_object ? slot_object : GTK_OBJECT (button)); - - /* catch the WM delete event */ - gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", - GTK_SIGNAL_FUNC (dialog_delete_callback), - data); - - delete_connected = TRUE; - } - - if (default_action) - gtk_widget_grab_default (button); - gtk_widget_show (button); - - label = va_arg (args, gchar *); - } -} - -/** - * dialog_new: - * @title: The dialog's title which will be set with gtk_window_set_title(). - * @wmclass_name: The dialog's @wmclass_name which will be set with - * gtk_window_set_wmclass(). The @wmclass_class will be - * automatically set to "Gimp". - * @position: The dialog's initial position which will be set with - * gtk_window_set_position(). - * @allow_shrink: The dialog's @allow_shrink flag, ... - * @allow_grow: ... it't @allow_grow flag and ... - * @auto_shrink: ... it's @auto_shrink flag which will all be set with - * gtk_window_set_policy(). - * @...: A #NULL terminated @va_list destribing the action_area buttons. - * - * This function simply packs the action_area arguments passed in "..." - * into a @va_list variable and passes everything to dialog_newv(). - * - * For a description of the format of the @va_list describing the - * action_area buttons see dialog_create_action_areav(). - * - * Returns: A #GtkDialog. - * - */ -GtkWidget * -stpui_dialog_new (const gchar *title, - const gchar *wmclass_name, - GtkWindowPosition position, - gint allow_shrink, - gint allow_grow, - gint auto_shrink, - - /* specify action area buttons as va_list: - * const gchar *label, - * GtkSignalFunc callback, - * gpointer data, - * GtkObject *slot_object, - * GtkWidget **widget_ptr, - * gboolean default_action, - * gboolean connect_delete, - */ - - ...) -{ - GtkWidget *dialog; - va_list args; - - va_start (args, auto_shrink); - - g_return_val_if_fail (title != NULL, NULL); - g_return_val_if_fail (wmclass_name != NULL, NULL); - - dialog = gtk_dialog_new (); - gtk_window_set_title (GTK_WINDOW (dialog), title); - gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp"); - gtk_window_set_position (GTK_WINDOW (dialog), position); - gtk_window_set_policy (GTK_WINDOW (dialog), - allow_shrink, allow_grow, auto_shrink); - - /* prepare the action_area */ - dialog_create_action_areav (GTK_DIALOG (dialog), args); - - va_end (args); - - return dialog; -} - -/*****************************************************************\ -* * -* The following from libgimp/gimpwidgets.c * -* * -\*****************************************************************/ - -/** - * option_menu_new: - * @menu_only: #TRUE if the function should return a #GtkMenu only. - * @...: A #NULL terminated @va_list describing the menu items. - * - * Returns: A #GtkOptionMenu or a #GtkMenu (depending on @menu_only). - **/ -GtkWidget * -stpui_option_menu_new(gboolean menu_only, - - /* specify menu items as va_list: - * const gchar *label, - * GtkSignalFunc callback, - * gpointer data, - * gpointer user_data, - * GtkWidget **widget_ptr, - * gboolean active - */ - - ...) -{ - GtkWidget *menu; - GtkWidget *menuitem; - - /* menu item variables */ - const gchar *label; - GtkSignalFunc callback; - gpointer data; - gpointer user_data; - GtkWidget **widget_ptr; - gboolean active; - - va_list args; - gint i; - gint initial_index; - - menu = gtk_menu_new (); - - /* create the menu items */ - initial_index = 0; - - va_start (args, menu_only); - label = va_arg (args, const gchar *); - - for (i = 0; label; i++) - { - callback = va_arg (args, GtkSignalFunc); - data = va_arg (args, gpointer); - user_data = va_arg (args, gpointer); - widget_ptr = va_arg (args, GtkWidget **); - active = va_arg (args, gboolean); - - if (strcmp (label, "---")) - { - menuitem = gtk_menu_item_new_with_label (label); - - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - callback, - data); - - if (user_data) - gtk_object_set_user_data (GTK_OBJECT (menuitem), user_data); - } - else - { - menuitem = gtk_menu_item_new (); - - gtk_widget_set_sensitive (menuitem, FALSE); - } - - gtk_menu_append (GTK_MENU (menu), menuitem); - - if (widget_ptr) - *widget_ptr = menuitem; - - gtk_widget_show (menuitem); - - /* remember the initial menu item */ - if (active) - initial_index = i; - - label = va_arg (args, const gchar *); - } - va_end (args); - - if (! menu_only) - { - GtkWidget *optionmenu; - - optionmenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu); - - /* select the initial menu item */ - gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), initial_index); - - return optionmenu; - } - - return menu; -} - -/*****************************************************************\ -* * -* The following from libgimp/gimpwidgets.c * -* * -\*****************************************************************/ - -/** - * spin_button_new: - * @adjustment: Returns the spinbutton's #GtkAdjustment. - * @value: The initial value of the spinbutton. - * @lower: The lower boundary. - * @upper: The uppper boundary. - * @step_increment: The spinbutton's step increment. - * @page_increment: The spinbutton's page increment (mouse button 2). - * @page_size: The spinbutton's page size. - * @climb_rate: The spinbutton's climb rate. - * @digits: The spinbutton's number of decimal digits. - * - * This function is a shortcut for gtk_adjustment_new() and a subsequent - * gtk_spin_button_new() and does some more initialisation stuff like - * setting a standard minimun horizontal size. - * - * Returns: A #GtkSpinbutton and it's #GtkAdjustment. - **/ -static GtkWidget * -spin_button_new (GtkObject **adjustment, /* return value */ - gfloat value, - gfloat lower, - gfloat upper, - gfloat step_increment, - gfloat page_increment, - gfloat page_size, - gfloat climb_rate, - guint digits) -{ - GtkWidget *spinbutton; - - *adjustment = gtk_adjustment_new (value, lower, upper, - step_increment, page_increment, page_size); - - spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment), - climb_rate, digits); - gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton), - GTK_SHADOW_NONE); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); - gtk_widget_set_usize (spinbutton, 75, -1); - - return spinbutton; -} - -static void -scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment, - GtkAdjustment *other_adj) -{ - gtk_signal_handler_block_by_data (GTK_OBJECT (other_adj), adjustment); - - gtk_adjustment_set_value (other_adj, adjustment->value); - - gtk_signal_handler_unblock_by_data (GTK_OBJECT (other_adj), adjustment); -} - -/** - * scale_entry_new: - * @table: The #GtkTable the widgets will be attached to. - * @column: The column to start with. - * @row: The row to attach the widgets. - * @text: The text for the #GtkLabel which will appear - * left of the #GtkHScale. - * @scale_usize: The minimum horizontal size of the #GtkHScale. - * @spinbutton_usize: The minimum horizontal size of the #GtkSpinButton. - * @value: The initial value. - * @lower: The lower boundary. - * @upper: The upper boundary. - * @step_increment: The step increment. - * @page_increment: The page increment. - * @digits: The number of decimal digits. - * @constrain: #TRUE if the range of possible values of the - * #GtkSpinButton should be the same as of the #GtkHScale. - * @unconstrained_lower: The spinbutton's lower boundary - * if @constrain == #FALSE. - * @unconstrained_upper: The spinbutton's upper boundary - * if @constrain == #FALSE. - * @tooltip: A tooltip message for the scale and the spinbutton. - * - * This function creates a #GtkLabel, a #GtkHScale and a #GtkSpinButton and - * attaches them to a 3-column #GtkTable. - * - * Returns: The #GtkSpinButton's #GtkAdjustment. - **/ -GtkObject * -stpui_scale_entry_new(GtkTable *table, - gint column, - gint row, - const gchar *text, - gint scale_usize, - gint spinbutton_usize, - gfloat value, - gfloat lower, - gfloat upper, - gfloat step_increment, - gfloat page_increment, - guint digits, - gboolean constrain, - gfloat unconstrained_lower, - gfloat unconstrained_upper, - const gchar *tooltip) -{ - GtkWidget *label; - GtkWidget *scale; - GtkWidget *spinbutton; - GtkObject *adjustment; - GtkObject *return_adj; - - label = gtk_label_new (text); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, - column + 1, column + 2, row, row + 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - - if (! constrain && - unconstrained_lower <= lower && - unconstrained_upper >= upper) - { - GtkObject *constrained_adj; - - constrained_adj = gtk_adjustment_new (value, lower, upper, - step_increment, page_increment, - 0.0); - - spinbutton = spin_button_new (&adjustment, value, - unconstrained_lower, - unconstrained_upper, - step_increment, page_increment, 0.0, - 1.0, digits); - - gtk_signal_connect - (GTK_OBJECT (constrained_adj), "value_changed", - GTK_SIGNAL_FUNC (scale_entry_unconstrained_adjustment_callback), - adjustment); - - gtk_signal_connect - (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (scale_entry_unconstrained_adjustment_callback), - constrained_adj); - - return_adj = adjustment; - - adjustment = constrained_adj; - } - else - { - spinbutton = spin_button_new (&adjustment, value, lower, upper, - step_increment, page_increment, 0.0, - 1.0, digits); - - return_adj = adjustment; - } - - if (spinbutton_usize > 0) - gtk_widget_set_usize (spinbutton, spinbutton_usize, -1); - - scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment)); - if (scale_usize > 0) - gtk_widget_set_usize (scale, scale_usize, -1); - gtk_scale_set_digits (GTK_SCALE (scale), digits); - gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE); - gtk_table_attach (GTK_TABLE (table), scale, - column + 2, column + 3, row, row + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - gtk_widget_show (scale); - - gtk_table_attach (GTK_TABLE (table), spinbutton, - column + 3, column + 4, row, row + 1, - GTK_SHRINK, GTK_SHRINK, 0, 0); - gtk_widget_show (spinbutton); - - if (tooltip) - { - stpui_set_help_data (scale, tooltip); - stpui_set_help_data (spinbutton, tooltip); - } - - gtk_object_set_data (GTK_OBJECT (return_adj), "label", label); - gtk_object_set_data (GTK_OBJECT (return_adj), "scale", scale); - gtk_object_set_data (GTK_OBJECT (return_adj), "spinbutton", spinbutton); - - return return_adj; -} - -/** - * table_attach_aligned: - * @table: The #GtkTable the widgets will be attached to. - * @column: The column to start with. - * @row: The row to attach the eidgets. - * @label_text: The text for the #GtkLabel which will be attached left of the - * widget. - * @xalign: The horizontal alignment of the #GtkLabel. - * @yalign: The vertival alignment of the #GtkLabel. - * @widget: The #GtkWidget to attach right of the label. - * @colspan: The number of columns the widget will use. - * @left_align: #TRUE if the widget should be left-aligned. - * - * Note that the @label_text can be #NULL and that the widget will be attached - * starting at (@column + 1) in this case, too. - **/ -void -stpui_table_attach_aligned (GtkTable *table, - gint column, - gint row, - const gchar *label_text, - gfloat xalign, - gfloat yalign, - GtkWidget *widget, - gint colspan, - gboolean left_align) -{ - if (label_text) - { - GtkWidget *label; - - label = gtk_label_new (label_text); - gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_table_attach (table, label, column, column + 1, row, row + 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - } - - gtk_widget_show (widget); - if (left_align) - { - GtkWidget *alignment; - - alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (alignment), widget); - - widget = alignment; - } - - gtk_table_attach (table, widget, column + 1, column + 1 + colspan, - row, row + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - - gtk_widget_show (widget); -} - -/*****************************************************************\ -* * -* The following borrowed from libgimp/gimphelpui.c * -* * -\*****************************************************************/ - -static GtkTooltips * tool_tips = NULL; - -/** - * stpui_help_init: - * - * This function initializes GIMP's help system. - * - * Currently it only creates a #GtkTooltips object with gtk_tooltips_new() - * which will be used by help_stpui_set_help_data(). - **/ -void -stpui_help_init (void) -{ - tool_tips = gtk_tooltips_new (); -} - -/** - * stpui_help_free: - * - * This function frees the memory used by the #GtkTooltips created by - * stpui_help_init(). - **/ -void -stpui_help_free (void) -{ - gtk_object_destroy (GTK_OBJECT (tool_tips)); - gtk_object_unref (GTK_OBJECT (tool_tips)); -} - -/** - * help_enable_tooltips: - * - * This function calls gtk_tooltips_enable(). - **/ -void -stpui_enable_help (void) -{ - gtk_tooltips_enable (tool_tips); -} - -/** - * help_disable_tooltips: - * - * This function calls gtk_tooltips_disable(). - **/ - -void -stpui_disable_help (void) -{ - gtk_tooltips_disable (tool_tips); -} - -void -stpui_set_help_data (GtkWidget *widget, const gchar *tooltip) -{ - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - if (tooltip) - { - gtk_tooltips_set_tip (tool_tips, widget, tooltip, NULL); - } -} - -/*****************************************************************\ -* * -* The below is new code * -* * -\*****************************************************************/ - - -void -stpui_set_image_filename(const char *name) -{ - if (name && name == image_filename) - return; - if (image_filename) - g_free(image_filename); - if (name) - image_filename = g_strdup(name); - else - image_filename = g_strdup(""); -} - -const char * -stpui_get_image_filename(void) -{ - stpui_set_image_filename(image_filename); - return(image_filename); -} - -static void -default_errfunc(void *data, const char *buffer, size_t bytes) -{ - fwrite(buffer, 1, bytes, data ? data : stderr); -} - -void -stpui_set_errfunc(stp_outfunc_t wfunc) -{ - the_errfunc = wfunc; -} - -stp_outfunc_t -stpui_get_errfunc(void) -{ - return the_errfunc; -} - -void -stpui_set_errdata(void *errdata) -{ - the_errdata = errdata; -} - -void * -stpui_get_errdata(void) -{ - return the_errdata; -} - -void -stpui_set_thumbnail_func(get_thumbnail_func_t func) -{ - thumbnail_func = func; -} - -get_thumbnail_func_t -stpui_get_thumbnail_func(void) -{ - return thumbnail_func; -} - -void -stpui_set_thumbnail_data(void *data) -{ - thumbnail_private_data = data; -} - -void * -stpui_get_thumbnail_data(void) -{ - return thumbnail_private_data; -} - -GtkWidget * -stpui_create_entry(GtkWidget *table, int hpos, int vpos, const char *text, - const char *help, GtkSignalFunc callback) -{ - GtkWidget *entry = gtk_entry_new(); - gtk_widget_set_usize(entry, 60, 0); - stpui_table_attach_aligned(GTK_TABLE(table), hpos, vpos, text, - 0.0, 0.5, entry, 1, TRUE); - stpui_set_help_data(entry, help); - gtk_signal_connect(GTK_OBJECT(entry), "activate", - GTK_SIGNAL_FUNC(callback), NULL); - return entry; -} - -GSList * -stpui_create_radio_button(radio_group_t *radio, GSList *group, - GtkWidget *table, int hpos, int vpos, - GtkSignalFunc callback) -{ - radio->button = gtk_radio_button_new_with_label(group, gettext(radio->name)); - group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio->button)); - stpui_table_attach_aligned(GTK_TABLE(table), hpos, vpos, NULL, 0.5, 0.5, - radio->button, 1, FALSE); - stpui_set_help_data(radio->button, gettext(radio->help)); - gtk_signal_connect(GTK_OBJECT(radio->button), "toggled", - GTK_SIGNAL_FUNC(callback), (gpointer) radio->value); - return group; -} - -void -stpui_set_adjustment_tooltip (GtkObject *adj, const gchar *tip) -{ - stpui_set_help_data (GTK_WIDGET (SCALE_ENTRY_SCALE (adj)), tip); - stpui_set_help_data (GTK_WIDGET (SCALE_ENTRY_SPINBUTTON (adj)), tip); -} - -static GtkWidget * -table_label(GtkTable *table, gint column, gint row) -{ - GList *children = table->children;; - while (children) - { - GtkTableChild *child = (GtkTableChild *)children->data; - if (child->left_attach == column + 1 && child->top_attach == row) - return child->widget; - children = children->next; - } - return NULL; -} - -void -stpui_create_new_combo(option_t *option, GtkWidget *table, - int hpos, int vpos, gboolean is_optional) -{ - GtkWidget *event_box = gtk_event_box_new(); - GtkWidget *combo = gtk_combo_new(); - - option->checkbox = gtk_check_button_new(); - gtk_table_attach(GTK_TABLE(table), option->checkbox, - hpos, hpos + 1, vpos, vpos + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - - option->info.list.combo = combo; - gtk_container_add(GTK_CONTAINER(event_box), combo); - gtk_widget_show(combo); - gtk_widget_show(event_box); - stpui_set_help_data(event_box, gettext(option->fast_desc->help)); - stpui_table_attach_aligned - (GTK_TABLE(table), hpos + 1, vpos, gettext(option->fast_desc->text), - 0.0, 0.5, event_box, 2, TRUE); - option->info.list.label = table_label(GTK_TABLE(table), hpos, vpos); -} - -const char * -stpui_combo_get_name(GtkWidget *combo, - const stp_string_list_t *options) -{ - if (options) - { - gint i; - gint num_options = stp_string_list_count(options); - gchar *text = (gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry))); - - if (text == NULL) - return (NULL); - - if (num_options == 0) - return ((const char *)text); - - for (i = 0; i < num_options; i ++) - if (strcmp(stp_string_list_param(options, i)->text, text) == 0) - return (stp_string_list_param(options, i)->name); - } - return (NULL); -} - -void -stpui_create_scale_entry(option_t *opt, - GtkTable *table, - gint column, - gint row, - const gchar *text, - gint scale_usize, - gint spinbutton_usize, - gfloat value, - gfloat lower, - gfloat upper, - gfloat step_increment, - gfloat page_increment, - guint digits, - gboolean constrain, - gfloat unconstrained_lower, - gfloat unconstrained_upper, - const gchar *tooltip, - gboolean is_optional) -{ - opt->checkbox = gtk_check_button_new(); - gtk_table_attach(GTK_TABLE(table), opt->checkbox, - column, column + 1, row, row + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - opt->info.flt.adjustment = - stpui_scale_entry_new(table, column, row, text, scale_usize, - spinbutton_usize, value, lower, upper, - step_increment, page_increment, digits, constrain, - unconstrained_lower, unconstrained_upper, tooltip); -} diff --git a/src/gutenprintui2/Makefile.am b/src/gutenprintui2/Makefile.am index 94279a3..2f436fc 100644 --- a/src/gutenprintui2/Makefile.am +++ b/src/gutenprintui2/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.6.10.1 2007/12/02 02:41:10 rlk Exp $ +## $Id: Makefile.am,v 1.7 2007/12/02 02:39:58 rlk Exp $ ## Copyright (C) 2000 Roger Leigh ## ## This program is free software; you can redistribute it and/or modify diff --git a/src/gutenprintui2/Makefile.in b/src/gutenprintui2/Makefile.in index 6eed08e..8e850a6 100644 --- a/src/gutenprintui2/Makefile.in +++ b/src/gutenprintui2/Makefile.in @@ -44,13 +44,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src/gutenprintui2 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -157,27 +156,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -185,13 +170,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -296,16 +274,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -334,6 +308,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la m4datadir = $(datadir)/aclocal pkgconfigdatadir = $(libdir)/pkgconfig @BUILD_LIBGUTENPRINTUI2_TRUE@lib_LTLIBRARIES = libgutenprintui2.la diff --git a/src/gutenprintui2/gutenprintui-internal.h b/src/gutenprintui2/gutenprintui-internal.h index af3caae..fef3b63 100644 --- a/src/gutenprintui2/gutenprintui-internal.h +++ b/src/gutenprintui2/gutenprintui-internal.h @@ -1,5 +1,5 @@ /* - * "$Id: gutenprintui-internal.h,v 1.3 2005/09/17 21:54:33 rlk Exp $" + * "$Id: gutenprintui-internal.h,v 1.5 2008/01/22 02:36:42 rlk Exp $" * * Print plug-in for the GIMP. * @@ -77,15 +77,27 @@ typedef struct typedef struct { + GtkWidget *f_label; + GtkWidget *f_entry; + GtkWidget *f_button; + GtkWidget *f_browser; + gboolean f_is_visible; +} file_option_t; + +typedef struct +{ const stp_parameter_t *fast_desc; int is_active; int is_enabled; + int reset_all; GtkWidget *checkbox; + GtkWidget *reset_btn; union { list_option_t list; float_option_t flt; curve_option_t curve; boolean_option_t bool; + file_option_t file; } info; } option_t; diff --git a/src/gutenprintui2/panel.c b/src/gutenprintui2/panel.c index 7fa3de0..cf262e5 100644 --- a/src/gutenprintui2/panel.c +++ b/src/gutenprintui2/panel.c @@ -1,5 +1,5 @@ /* - * "$Id: panel.c,v 1.11.8.3 2007/12/15 20:35:42 rlk Exp $" + * "$Id: panel.c,v 1.17 2008/01/22 02:36:42 rlk Exp $" * * Main window code for Print plug-in for the GIMP. * @@ -255,6 +255,7 @@ static void plist_build_combo(GtkWidget *combo, int (*check_func)(const char *string), gpointer data); static void initialize_thumbnail(void); +static void reset_callback (GtkObject *widget, gpointer data); static void set_color_defaults (void); static void set_printer_defaults (void); static void redraw_color_swatch (void); @@ -565,6 +566,106 @@ stpui_create_curve(option_t *opt, } static int +open_file_browser(GtkObject *button, gpointer xopt) +{ + option_t *opt = (option_t *)xopt; + GtkWidget *browser = opt->info.file.f_browser; + GtkWidget *entry = opt->info.file.f_entry; + gtk_file_selection_set_filename (GTK_FILE_SELECTION (browser), + gtk_entry_get_text (GTK_ENTRY (entry))); + gtk_widget_show(opt->info.file.f_browser); + return 1; +} + +static void +file_entry_callback(GtkWidget *widget, gpointer xopt) +{ + const gchar *name = gtk_entry_get_text(GTK_ENTRY(widget)); + if (name && pv && pv->v) + { + option_t *opt = (option_t *)xopt; + stp_set_file_parameter(pv->v, opt->fast_desc->name, name); + } +} + +static int +file_browser_ok_callback(GtkObject *browser_ok, gpointer xopt) +{ + option_t *opt = (option_t *)xopt; + GtkWidget *entry = opt->info.file.f_entry; + GtkWidget *browser = opt->info.file.f_browser; + gtk_widget_hide(opt->info.file.f_browser); + gtk_entry_set_text + (GTK_ENTRY (entry), + gtk_file_selection_get_filename (GTK_FILE_SELECTION (browser))); + file_entry_callback(entry, xopt); + return 1; +} + +static void +stpui_create_file_browser(option_t *opt, + GtkTable *table, + gint column, + gint row, + const gchar *text, + gboolean is_optional) +{ + opt->checkbox = gtk_check_button_new(); + gtk_table_attach(GTK_TABLE(table), opt->checkbox, + column, column + 1, row, row + 1, + GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); + if (is_optional) + gtk_widget_show(opt->checkbox); + else + gtk_widget_hide(opt->checkbox); + + opt->info.file.f_label = gtk_label_new(text); + gtk_misc_set_alignment (GTK_MISC (opt->info.file.f_label), 0.0, 0.5); + gtk_table_attach (GTK_TABLE (table), opt->info.file.f_label, + column + 1, column + 2, row, row + 1, + GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show (opt->info.file.f_label); + + opt->info.file.f_entry = gtk_entry_new(); + gtk_table_attach (GTK_TABLE (table), opt->info.file.f_entry, + column + 2, column + 3, row, row + 1, + GTK_FILL, GTK_FILL, 0, 0); + g_signal_connect(G_OBJECT(opt->info.file.f_entry), "activate", + G_CALLBACK(file_entry_callback), opt); + if (stp_get_file_parameter(pv->v, opt->fast_desc->name)) + gtk_entry_set_text + (GTK_ENTRY (opt->info.file.f_entry), + stp_get_file_parameter(pv->v, opt->fast_desc->name)); + gtk_widget_show (opt->info.file.f_entry); + + opt->info.file.f_button = gtk_button_new_with_label(_("Select File...")); + g_signal_connect(G_OBJECT(opt->info.file.f_button), "clicked", + G_CALLBACK(open_file_browser), opt); + gtk_table_attach (GTK_TABLE (table), opt->info.file.f_button, + column + 3, column + 4, row, row + 1, + GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show(opt->info.file.f_button); + + opt->info.file.f_browser = + gtk_file_selection_new(gettext(opt->fast_desc->text)); + + g_signal_connect + (G_OBJECT (GTK_FILE_SELECTION (opt->info.file.f_browser)->ok_button), "clicked", + G_CALLBACK (file_browser_ok_callback), opt); + g_signal_connect_object + (G_OBJECT (GTK_FILE_SELECTION (opt->info.file.f_browser)->cancel_button), "clicked", + G_CALLBACK (gtk_widget_hide), G_OBJECT (opt->info.file.f_browser), G_CONNECT_SWAPPED); + + if (opt->fast_desc->help) + { + stpui_set_help_data (opt->info.file.f_label, opt->fast_desc->help); + stpui_set_help_data (opt->info.file.f_button, opt->fast_desc->help); + stpui_set_help_data (opt->info.file.f_entry, opt->fast_desc->help); + stpui_set_help_data (opt->info.file.f_browser, opt->fast_desc->help); + } +} + +static int checkbox_callback(GtkObject *button, gpointer xopt) { option_t *opt = (option_t *)xopt; @@ -804,11 +905,19 @@ populate_options(const stp_vars_t *v) case STP_PARAMETER_TYPE_BOOLEAN: gtk_widget_destroy(GTK_WIDGET(opt->info.bool.checkbox)); break; + case STP_PARAMETER_TYPE_FILE: + gtk_widget_destroy(GTK_WIDGET(opt->info.file.f_label)); + gtk_widget_destroy(GTK_WIDGET(opt->info.file.f_button)); + gtk_widget_destroy(GTK_WIDGET(opt->info.file.f_entry)); + gtk_widget_destroy(GTK_WIDGET(opt->info.file.f_browser)); + break; default: break; } if (opt->checkbox) gtk_widget_destroy(GTK_WIDGET(opt->checkbox)); + if (opt->reset_btn) + gtk_widget_destroy(GTK_WIDGET(opt->reset_btn)); } g_free(current_options); } @@ -829,6 +938,7 @@ populate_options(const stp_vars_t *v) opt->fast_desc = stp_parameter_list_param(params, i); stp_describe_parameter(v, opt->fast_desc->name, &desc); opt->checkbox = NULL; + opt->reset_btn = NULL; opt->is_active = 0; opt->is_enabled = 0; switch (opt->fast_desc->p_type) @@ -876,6 +986,15 @@ populate_options(const stp_vars_t *v) opt->info.bool.current = 0; opt->info.bool.deflt = desc.deflt.boolean; opt->is_active = desc.is_active; + break; + case STP_PARAMETER_TYPE_FILE: + opt->info.file.f_label = NULL; + opt->info.file.f_button = NULL; + opt->info.file.f_entry = NULL; + opt->info.file.f_browser = NULL; + opt->info.file.f_is_visible = FALSE; + opt->is_active = desc.is_active; + break; default: break; } @@ -894,6 +1013,17 @@ destroy_something(GtkWidget *widget, gpointer data) } static void +add_reset_button(option_t *opt, GtkWidget *table, gint column, gint row) +{ + GtkWidget *button = gtk_button_new_with_label(_("Reset")); + gtk_table_attach(GTK_TABLE(table), button, column, column + 1, + row, row + 1, GTK_FILL, GTK_FILL, 0, 0); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_callback), opt); + opt->reset_btn = button; + gtk_widget_show(button); +} + +static void populate_option_table(GtkWidget *table, int p_class) { int i, j; @@ -930,6 +1060,7 @@ populate_option_table(GtkWidget *table, int p_class) case STP_PARAMETER_TYPE_DOUBLE: case STP_PARAMETER_TYPE_CURVE: case STP_PARAMETER_TYPE_BOOLEAN: + case STP_PARAMETER_TYPE_FILE: counts[desc->p_level][desc->p_type]++; break; default: @@ -976,9 +1107,14 @@ populate_option_table(GtkWidget *table, int p_class) gdouble unit_scaler; gdouble minor_increment; gint digits; + if (p_class == STP_PARAMETER_CLASS_OUTPUT) + opt->reset_all = FALSE; + else + opt->reset_all = TRUE; switch (desc->p_type) { case STP_PARAMETER_TYPE_STRING_LIST: + add_reset_button(opt, table, 4, vpos[desc->p_level][desc->p_type]); stpui_create_new_combo(opt, table, 0, vpos[desc->p_level][desc->p_type]++, !(desc->is_mandatory)); @@ -987,6 +1123,7 @@ populate_option_table(GtkWidget *table, int p_class) STP_PARAMETER_INACTIVE); break; case STP_PARAMETER_TYPE_DOUBLE: + add_reset_button(opt, table, 4, vpos[desc->p_level][desc->p_type]); stpui_create_scale_entry(opt, GTK_TABLE(table), 0, vpos[desc->p_level][desc->p_type]++, gettext(desc->text), 200, 0, @@ -1026,6 +1163,7 @@ populate_option_table(GtkWidget *table, int p_class) digits = 0; minor_increment = 1; } + add_reset_button(opt, table, 4, vpos[desc->p_level][desc->p_type]); stpui_create_scale_entry(opt, GTK_TABLE(table), 0, vpos[desc->p_level][desc->p_type]++, gettext(desc->text), 200, 0, @@ -1050,6 +1188,7 @@ populate_option_table(GtkWidget *table, int p_class) opt->info.curve.current = stp_curve_create_copy(xcurve); else opt->info.curve.current = NULL; + add_reset_button(opt, table, 4, vpos[desc->p_level][desc->p_type]); stpui_create_curve(opt, GTK_TABLE(table), 0, vpos[desc->p_level][desc->p_type]++, gettext(desc->text), opt->info.curve.deflt, @@ -1061,6 +1200,7 @@ populate_option_table(GtkWidget *table, int p_class) case STP_PARAMETER_TYPE_BOOLEAN: opt->info.bool.current = stp_get_boolean_parameter(pv->v, opt->fast_desc->name); + add_reset_button(opt, table, 4, vpos[desc->p_level][desc->p_type]); stpui_create_boolean(opt, GTK_TABLE(table), 0, vpos[desc->p_level][desc->p_type]++, gettext(desc->text), opt->info.bool.deflt, @@ -1079,7 +1219,15 @@ populate_option_table(GtkWidget *table, int p_class) break; case STP_PARAMETER_TYPE_FILE: if (strcmp(opt->fast_desc->name, "PPDFile") != 0) - stp_set_file_parameter_active(pv->v, opt->fast_desc->name, + { + add_reset_button(opt, table, 4, vpos[desc->p_level][desc->p_type]); + stpui_create_file_browser(opt, GTK_TABLE(table), 0, + vpos[desc->p_level][desc->p_type]++, + gettext(desc->text), + !(desc->is_mandatory)); + } + if (desc->p_level > MAXIMUM_PARAMETER_LEVEL) + stp_set_file_parameter_active(pv->v, desc->name, STP_PARAMETER_INACTIVE); break; default: @@ -1150,15 +1298,42 @@ set_options_active(const char *omit) gtk_widget_hide(GTK_WIDGET(opt->info.bool.checkbox)); } break; + case STP_PARAMETER_TYPE_FILE: + if (opt->is_active && desc->p_level <= MAXIMUM_PARAMETER_LEVEL) + { + gtk_widget_show(GTK_WIDGET(opt->info.file.f_label)); + gtk_widget_show(GTK_WIDGET(opt->info.file.f_button)); + gtk_widget_show(GTK_WIDGET(opt->info.file.f_entry)); + } + else + { + gtk_widget_hide(GTK_WIDGET(opt->info.file.f_label)); + gtk_widget_hide(GTK_WIDGET(opt->info.file.f_button)); + gtk_widget_hide(GTK_WIDGET(opt->info.file.f_entry)); + gtk_widget_hide(GTK_WIDGET(opt->info.file.f_browser)); + } + break; default: break; } - if (opt->checkbox) + if (!(opt->is_active) || desc->p_level > MAXIMUM_PARAMETER_LEVEL) { - if (!(opt->is_active) || desc->p_level > MAXIMUM_PARAMETER_LEVEL) + if (opt->checkbox) gtk_widget_hide(GTK_WIDGET(opt->checkbox)); - else if (!(desc->is_mandatory)) - gtk_widget_show(GTK_WIDGET(opt->checkbox)); + if (opt->reset_btn) + gtk_widget_hide(GTK_WIDGET(opt->reset_btn)); + } + else + { + if (opt->checkbox) + { + if (!desc->is_mandatory) + gtk_widget_show(GTK_WIDGET(opt->checkbox)); + else + gtk_widget_hide(GTK_WIDGET(opt->checkbox)); + } + if (opt->reset_btn) + gtk_widget_show(GTK_WIDGET(opt->reset_btn)); } } } @@ -2812,12 +2987,10 @@ set_adjustment_active(option_t *opt, gboolean active, gboolean do_toggle) GtkObject *adj = opt->info.flt.adjustment; if (do_toggle) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); - gtk_widget_set_sensitive - (GTK_WIDGET (SCALE_ENTRY_LABEL (adj)), active); - gtk_widget_set_sensitive - (GTK_WIDGET (SCALE_ENTRY_SCALE (adj)), active); - gtk_widget_set_sensitive - (GTK_WIDGET (SCALE_ENTRY_SPINBUTTON (adj)), active); + gtk_widget_set_sensitive (GTK_WIDGET (SCALE_ENTRY_LABEL (adj)), active); + gtk_widget_set_sensitive (GTK_WIDGET (SCALE_ENTRY_SCALE (adj)), active); + gtk_widget_set_sensitive (GTK_WIDGET (SCALE_ENTRY_SPINBUTTON (adj)), active); + gtk_widget_set_sensitive (GTK_WIDGET (opt->reset_btn), active); } static void @@ -2827,6 +3000,7 @@ set_combo_active(option_t *opt, gboolean active, gboolean do_toggle) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); gtk_widget_set_sensitive(GTK_WIDGET(opt->info.list.combo), active); gtk_widget_set_sensitive(GTK_WIDGET(opt->info.list.label), active); + gtk_widget_set_sensitive (GTK_WIDGET (opt->reset_btn), active); } static void @@ -2843,6 +3017,7 @@ set_curve_active(option_t *opt, gboolean active, gboolean do_toggle) } else gtk_widget_hide(GTK_WIDGET(opt->info.curve.dialog)); + gtk_widget_set_sensitive (GTK_WIDGET (opt->reset_btn), active); } static void @@ -2851,6 +3026,25 @@ set_bool_active(option_t *opt, gboolean active, gboolean do_toggle) if (do_toggle) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); gtk_widget_set_sensitive(GTK_WIDGET(opt->info.bool.checkbox), active); + gtk_widget_set_sensitive (GTK_WIDGET (opt->reset_btn), active); +} + +static void +set_file_active(option_t *opt, gboolean active, gboolean do_toggle) +{ + if (do_toggle) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opt->checkbox), active); + gtk_widget_set_sensitive(GTK_WIDGET(opt->info.file.f_label), active); + gtk_widget_set_sensitive(GTK_WIDGET(opt->info.file.f_button), active); + gtk_widget_set_sensitive(GTK_WIDGET(opt->info.file.f_entry), active); + if (active) + { + if (opt->info.file.f_is_visible) + gtk_widget_show(GTK_WIDGET(opt->info.file.f_browser)); + } + else + gtk_widget_hide(GTK_WIDGET(opt->info.file.f_browser)); + gtk_widget_set_sensitive (GTK_WIDGET (opt->reset_btn), active); } static void @@ -2935,6 +3129,14 @@ do_color_updates (void) else set_bool_active(opt, FALSE, TRUE); break; + case STP_PARAMETER_TYPE_FILE: + if (stp_check_file_parameter(pv->v, opt->fast_desc->name, + STP_PARAMETER_ACTIVE) || + opt->fast_desc->is_mandatory) + set_file_active(opt, TRUE, TRUE); + else + set_file_active(opt, FALSE, TRUE); + break; default: break; } @@ -4335,6 +4537,7 @@ compute_thumbnail(const stp_vars_t *v) stp_set_float_parameter(nv, "Density", 1.0); stp_set_float_parameter(nv, "InkLimit", 0); stp_set_string_parameter(nv, "InputImageType", "RGB"); + stp_clear_file_parameter(nv, "LUTDumpFile"); priv.base_addr = adjusted_thumbnail_data; priv.offset = 0; @@ -5077,6 +5280,11 @@ set_controls_active (GtkObject *checkbutton, gpointer xopt) stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, STP_PARAMETER_ACTIVE); break; + case STP_PARAMETER_TYPE_FILE: + set_file_active(opt, TRUE, FALSE); + stp_set_file_parameter_active(pv->v, opt->fast_desc->name, + STP_PARAMETER_ACTIVE); + break; default: break; } @@ -5110,6 +5318,11 @@ set_controls_active (GtkObject *checkbutton, gpointer xopt) stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, STP_PARAMETER_INACTIVE); break; + case STP_PARAMETER_TYPE_FILE: /* ??? */ + set_file_active(opt, FALSE, FALSE); + stp_set_file_parameter_active(pv->v, opt->fast_desc->name, + STP_PARAMETER_INACTIVE); + break; default: break; } @@ -5119,6 +5332,68 @@ set_controls_active (GtkObject *checkbutton, gpointer xopt) } static void +set_one_default(option_t *opt) +{ + stp_parameter_activity_t active; + gdouble unit_scaler; + switch (opt->fast_desc->p_type) + { + case STP_PARAMETER_TYPE_DOUBLE: + active = stp_get_float_parameter_active(pv->v, opt->fast_desc->name); + stp_set_float_parameter(pv->v, opt->fast_desc->name, + opt->info.flt.deflt); + stp_set_float_parameter_active(pv->v, opt->fast_desc->name, + active); + break; + case STP_PARAMETER_TYPE_DIMENSION: + unit_scaler = units[pv->unit].scale; + active = stp_get_dimension_parameter_active(pv->v, + opt->fast_desc->name); + stp_set_dimension_parameter(pv->v, opt->fast_desc->name, + opt->info.flt.deflt * unit_scaler); + stp_set_dimension_parameter_active(pv->v, opt->fast_desc->name, + active); + break; + case STP_PARAMETER_TYPE_BOOLEAN: + active = stp_get_boolean_parameter_active(pv->v, opt->fast_desc->name); + stp_set_boolean_parameter(pv->v, opt->fast_desc->name, + opt->info.bool.deflt); + stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, + active); + break; + case STP_PARAMETER_TYPE_STRING_LIST: + active = stp_get_string_parameter_active(pv->v, opt->fast_desc->name); + stp_set_string_parameter(pv->v, opt->fast_desc->name, + opt->info.list.default_val); + stp_set_string_parameter_active(pv->v, opt->fast_desc->name, + active); + break; + case STP_PARAMETER_TYPE_FILE: + active = stp_get_file_parameter_active(pv->v, opt->fast_desc->name); + stp_set_file_parameter(pv->v, opt->fast_desc->name, ""); + stp_set_file_parameter_active(pv->v, opt->fast_desc->name, + active); + break; + default: + break; + } +} + +static void +reset_callback(GtkObject *button, gpointer xopt) +{ + option_t *opt = (option_t *)xopt; + if (opt) + { + set_one_default(opt); + if (opt->reset_all) + do_all_updates (); + else + do_color_updates (); + } +} + +static void set_printer_defaults (void) { int i; @@ -5128,49 +5403,7 @@ set_printer_defaults (void) if (opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL && opt->fast_desc->p_class == STP_PARAMETER_CLASS_FEATURE && opt->is_active && !opt->fast_desc->read_only) - { - stp_parameter_activity_t active; - gdouble unit_scaler; - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_DOUBLE: - active = - stp_get_float_parameter_active(pv->v, opt->fast_desc->name); - stp_set_float_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt); - stp_set_float_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_DIMENSION: - unit_scaler = units[pv->unit].scale; - active = - stp_get_dimension_parameter_active(pv->v, - opt->fast_desc->name); - stp_set_dimension_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt * unit_scaler); - stp_set_dimension_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - active = - stp_get_boolean_parameter_active(pv->v, opt->fast_desc->name); - stp_set_boolean_parameter(pv->v, opt->fast_desc->name, - opt->info.bool.deflt); - stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_STRING_LIST: - active = - stp_get_string_parameter_active(pv->v, opt->fast_desc->name); - stp_set_string_parameter(pv->v, opt->fast_desc->name, - opt->info.list.default_val); - stp_set_string_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - default: - break; - } - } + set_one_default(opt); } do_all_updates (); @@ -5186,49 +5419,7 @@ set_color_defaults (void) if (opt->fast_desc->p_level <= MAXIMUM_PARAMETER_LEVEL && opt->fast_desc->p_class == STP_PARAMETER_CLASS_OUTPUT && opt->is_active && !opt->fast_desc->read_only) - { - stp_parameter_activity_t active; - gdouble unit_scaler; - switch (opt->fast_desc->p_type) - { - case STP_PARAMETER_TYPE_DOUBLE: - active = - stp_get_float_parameter_active(pv->v, opt->fast_desc->name); - stp_set_float_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt); - stp_set_float_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_DIMENSION: - unit_scaler = units[pv->unit].scale; - active = - stp_get_dimension_parameter_active(pv->v, - opt->fast_desc->name); - stp_set_dimension_parameter(pv->v, opt->fast_desc->name, - opt->info.flt.deflt * unit_scaler); - stp_set_dimension_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_BOOLEAN: - active = - stp_get_boolean_parameter_active(pv->v, opt->fast_desc->name); - stp_set_boolean_parameter(pv->v, opt->fast_desc->name, - opt->info.bool.deflt); - stp_set_boolean_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - case STP_PARAMETER_TYPE_STRING_LIST: - active = - stp_get_string_parameter_active(pv->v, opt->fast_desc->name); - stp_set_string_parameter(pv->v, opt->fast_desc->name, - opt->info.list.default_val); - stp_set_string_parameter_active(pv->v, opt->fast_desc->name, - active); - break; - default: - break; - } - } + set_one_default(opt); } do_color_updates (); diff --git a/src/gutenprintui2/plist.c b/src/gutenprintui2/plist.c index 01d752e..e8b5aec 100644 --- a/src/gutenprintui2/plist.c +++ b/src/gutenprintui2/plist.c @@ -1,5 +1,5 @@ /* - * "$Id: plist.c,v 1.6.10.4 2007/12/15 20:35:43 rlk Exp $" + * "$Id: plist.c,v 1.17 2008/01/31 12:56:09 m0m Exp $" * * Print plug-in for the GIMP. * @@ -84,34 +84,37 @@ typedef struct /* * Generic printing system, based on SysV lp + * + * CAUTION: Do not use lpstat -t or lpstat -p. + * See bug 742187 (huge delays with lpstat -d -p) for an explanation. */ static const print_system_t default_printing_system = { "SysV", N_("System V lp"), "lp -s", "-d", "-oraw", "/usr/bin/lp", - "/usr/bin/lpstat -v | grep -i '^device for ' | awk '{print $3}' | sed 's/://'", + "/usr/bin/lpstat -v | awk '/^device for /i {sub(\":\", \"\", $3); print $3}'", "-n" }; static print_system_t known_printing_systems[] = { { "CUPS", N_("CUPS"), "lp -s", "-d", "-oraw", "/usr/sbin/cupsd", - "/usr/bin/lpstat -v | grep -i '^device for ' | awk '{print $3}' | sed 's/://'", + "/usr/bin/lpstat -v | awk '/^device for /i {sub(\":\", \"\", $3); print $3}'", "-n" }, { "SysV", N_("System V lp"), "lp -s", "-d", "-oraw", "/usr/bin/lp", - "/usr/bin/lpstat -v | grep -i '^device for ' | awk '{print $3}' | sed 's/://'", + "/usr/bin/lpstat -v | awk '/^device for /i {sub(\":\", \"\", $3); print $3}'", "-n" }, { "lpd", N_("Berkeley lpd (/etc/lpc)"), "lpr", "-P", "-l", "/etc/lpc", - "/etc/lpc status | grep '^...*:' | sed 's/:.*//'", + "/etc/lpc status | awk '/^...*:/ {sub(\":.*\", \"\"); print}'", "-#" }, { "lpd", N_("Berkeley lpd (/usr/bsd/lpc)"), "lpr", "-P", "-l", "/usr/bsd/lpc", - "/usr/bsd/lpc status | grep '^...*:' | sed 's/:.*//'", + "/usr/bsd/lpc status | awk '/^...*:/ {sub(\":.*\", \"\"); print}'", "-#" }, { "lpd", N_("Berkeley lpd (/usr/etc/lpc"), "lpr", "-P", "-l", "/usr/etc/lpc", - "/usr/etc/lpc status | grep '^...*:' | sed 's/:.*//'", + "/usr/etc/lpc status | awk '/^...*:/ {sub(\":.*\", \"\"); print}'", "-#" }, { "lpd", N_("Berkeley lpd (/usr/libexec/lpc)"), "lpr", "-P", "-l", "/usr/libexec/lpc", - "/usr/libexec/lpc status | grep '^...*:' | sed 's/:.*//'", + "/usr/libexec/lpc status | awk '/^...*:/ {sub(\":.*\", \"\"); print}'", "-#" }, { "lpd", N_("Berkeley lpd (/usr/sbin/lpc)"), "lpr", "-P", "-l", "/usr/sbin/lpc", - "/usr/sbin/lpc status | grep '^...*:' | sed 's/:.*//'", + "/usr/sbin/lpc status | awk '/^...*:/ {sub(\":.*\", \"\"); print}'", "-#" }, }; @@ -1257,7 +1260,11 @@ stpui_get_system_printers(void) if (global_printing_system) { const char *old_locale = getenv("LC_ALL"); + const char *old_lc_messages = getenv("LC_MESSAGES"); + const char *old_lang = getenv("LANG"); (void) setenv("LC_ALL", "C", 1); + (void) setenv("LC_MESSAGES", "C", 1); + (void) setenv("LANG", "C", 1); if ((pfile = popen(global_printing_system->scan_command, "r")) != NULL) { /* @@ -1283,6 +1290,14 @@ stpui_get_system_printers(void) setenv("LC_ALL", old_locale, 1); else unsetenv("LC_ALL"); + if (old_lc_messages) + setenv("LC_MESSAGES", old_lc_messages, 1); + else + unsetenv("LC_MESSAGES"); + if (old_lang) + setenv("LANG", old_lang, 1); + else + unsetenv("LANG"); } } } @@ -1623,6 +1638,7 @@ stpui_print(const stpui_plist_t *printer, stpui_image_t *image) else /* Child 2 (printer command) */ { char *command; + char *locale; if (stpui_plist_get_command_type(printer) == COMMAND_TYPE_DEFAULT) { @@ -1642,6 +1658,10 @@ stpui_print(const stpui_plist_t *printer, stpui_image_t *image) close (pipefd[0]); close (pipefd[1]); close(syncfd[1]); +#ifdef HAVE_LOCALE_H + locale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); +#endif execl("/bin/sh", "/bin/sh", "-c", command, NULL); /* NOTREACHED */ _exit (1); @@ -1815,5 +1835,5 @@ stpui_print(const stpui_plist_t *printer, stpui_image_t *image) } /* - * End of "$Id: plist.c,v 1.6.10.4 2007/12/15 20:35:43 rlk Exp $". + * End of "$Id: plist.c,v 1.17 2008/01/31 12:56:09 m0m Exp $". */ diff --git a/src/gutenprintui2/printrcl.c b/src/gutenprintui2/printrcl.c index 94a58f5..1c4d8e1 100644 --- a/src/gutenprintui2/printrcl.c +++ b/src/gutenprintui2/printrcl.c @@ -1,93 +1,32 @@ - -#line 3 "printrcl.c" - -#define YY_INT_ALIGNED short int - /* A lexical scanner generated by flex */ +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ + */ + #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ #include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H -/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include <inttypes.h> -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus #endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ #ifdef __cplusplus +#include <stdlib.h> +#include <unistd.h> + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -95,17 +34,34 @@ typedef unsigned int flex_uint32_t; #if __STDC__ +#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include <io.h> +#include <stdlib.h> +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -120,75 +76,71 @@ typedef unsigned int flex_uint32_t; * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN (yy_start) = 1 + 2 * +#define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START (((yy_start) - 1) / 2) +#define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ -#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 -#endif -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif extern int yyleng; - extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ + *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, (yytext_ptr) ) +#define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; -#endif -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE + struct yy_buffer_state { FILE *yy_input_file; @@ -225,16 +177,12 @@ struct yy_buffer_state */ int yy_at_bol; - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; - #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -248,38 +196,28 @@ struct yy_buffer_state * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". - * - * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) +#define YY_CURRENT_BUFFER yy_current_buffer -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; + static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ +static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches @@ -287,90 +225,69 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +void yyrestart YY_PROTO(( FILE *input_file )); -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) -#define yywrap(n) 1 -#define YY_SKIP_YYWRAP +#define yywrap() 1 +#define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; - FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - typedef int yy_state_type; - -extern int yylineno; extern char *yytext; #define yytext_ptr yytext -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; + yy_c_buf_p = yy_cp; #define YY_NUM_RULES 40 #define YY_END_OF_BUFFER 41 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[335] = +static yyconst short int yy_accept[335] = { 0, 0, 0, 41, 40, 37, 39, 40, 38, 40, 40, 31, 35, 35, 35, 35, 35, 35, 35, 35, 35, @@ -411,7 +328,7 @@ static yyconst flex_int16_t yy_accept[335] = 0, 2, 18, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -443,7 +360,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[39] = +static yyconst int yy_meta[39] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, @@ -451,7 +368,7 @@ static yyconst flex_int32_t yy_meta[39] = 3, 3, 3, 3, 3, 3, 3, 3 } ; -static yyconst flex_int16_t yy_base[340] = +static yyconst short int yy_base[340] = { 0, 0, 0, 374, 375, 371, 375, 368, 343, 364, 29, 32, 336, 341, 18, 26, 21, 32, 343, 0, 340, @@ -492,7 +409,7 @@ static yyconst flex_int16_t yy_base[340] = 81, 375, 375, 375, 94, 97, 100, 89, 103 } ; -static yyconst flex_int16_t yy_def[340] = +static yyconst short int yy_def[340] = { 0, 334, 1, 334, 334, 334, 334, 335, 336, 337, 334, 334, 338, 338, 338, 338, 338, 338, 338, 338, 338, @@ -533,7 +450,7 @@ static yyconst flex_int16_t yy_def[340] = 334, 334, 334, 0, 334, 334, 334, 334, 334 } ; -static yyconst flex_int16_t yy_nxt[414] = +static yyconst short int yy_nxt[414] = { 0, 4, 5, 6, 7, 8, 9, 10, 10, 4, 11, 11, 4, 4, 12, 13, 14, 15, 16, 17, 18, @@ -583,7 +500,7 @@ static yyconst flex_int16_t yy_nxt[414] = 334, 334, 334 } ; -static yyconst flex_int16_t yy_chk[414] = +static yyconst short int yy_chk[414] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -636,9 +553,6 @@ static yyconst flex_int16_t yy_chk[414] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int yy_flex_debug; -int yy_flex_debug = 0; - /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -648,6 +562,7 @@ int yy_flex_debug = 0; #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "printrcl.l" +#define INITIAL 0 /* -*-Mode: C-*- * "$Id: printrcl.l,v 1.1 2004/09/17 18:38:14 rleigh Exp $" * @@ -706,23 +621,7 @@ q_strdup(const char *s) return g_strndup(s + 1, strlen(s) - 2); } -#line 710 "printrcl.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include <unistd.h> -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); +#line 625 "printrcl.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -730,30 +629,65 @@ static int yy_init_globals (void ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (void ); +extern "C" int yywrap YY_PROTO(( void )); #else -extern int yywrap (void ); +extern int yywrap YY_PROTO(( void )); +#endif #endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif - static void yyunput (int c,char *buf_ptr ); - #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput YY_PROTO(( void )); #else -static int input (void ); +static int input YY_PROTO(( void )); +#endif #endif +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include <stdlib.h> +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -762,6 +696,7 @@ static int input (void ); #endif /* Copy whatever the last rule matched to the standard output. */ + #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -774,10 +709,9 @@ static int input (void ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + if ( yy_current_buffer->yy_is_interactive ) \ { \ - int c = '*'; \ - size_t n; \ + int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -787,22 +721,9 @@ static int input (void ); YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -823,18 +744,12 @@ static int input (void ); #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif -/* end tables serialization structures and prototypes */ - /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ +#define YY_DECL int yylex YY_PROTO(( void )) +#endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. @@ -851,29 +766,27 @@ extern int yylex (void); #define YY_RULE_SETUP \ YY_USER_ACTION -/** The main scanner function which does all the work. - */ YY_DECL -{ + { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + #line 73 "printrcl.l" -#line 866 "printrcl.c" +#line 779 "printrcl.c" - if ( !(yy_init) ) + if ( yy_init ) { - (yy_init) = 1; + yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; @@ -881,36 +794,34 @@ YY_DECL if ( ! yyout ) yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state( ); + yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = (yy_c_buf_p); + yy_cp = yy_c_buf_p; /* Support of yytext. */ - *yy_cp = (yy_hold_char); + *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = (yy_start); + yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -927,22 +838,24 @@ yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; + do_action: /* This label is used only to access EOF actions. */ + switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: @@ -1106,7 +1019,6 @@ YY_RULE_SETUP yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; YY_BREAK case 33: -/* rule 33 can match eol */ YY_RULE_SETUP #line 109 "printrcl.l" yylval.sval = q_strdup(yytext); DBG(tSTRING); return tSTRING; @@ -1122,7 +1034,6 @@ YY_RULE_SETUP yylval.sval = g_strdup(yytext); DBG(tWORD); return tWORD; YY_BREAK case 36: -/* rule 36 can match eol */ YY_RULE_SETUP #line 112 "printrcl.l" DBG(PRINTRC_HDR); return PRINTRC_HDR; @@ -1138,7 +1049,6 @@ YY_RULE_SETUP DBG(comment1); /* Skip comments */ YY_BREAK case 39: -/* rule 39 can match eol */ YY_RULE_SETUP #line 115 "printrcl.l" DBG(newline); mylineno++; @@ -1148,33 +1058,33 @@ YY_RULE_SETUP #line 116 "printrcl.l" ECHO; YY_BREAK -#line 1152 "printrcl.c" +#line 1062 "printrcl.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); + *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our + * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -1184,13 +1094,13 @@ case YY_STATE_EOF(INITIAL): * end-of-buffer state). Contrast this with the test * in input(). */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state( ); + yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -1203,30 +1113,30 @@ case YY_STATE_EOF(INITIAL): yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); + yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = (yy_c_buf_p); + yy_cp = yy_c_buf_p; goto yy_find_action; } } - else switch ( yy_get_next_buffer( ) ) + else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { - (yy_did_buffer_switch_on_eof) = 0; + yy_did_buffer_switch_on_eof = 0; - if ( yywrap( ) ) + if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1237,7 +1147,7 @@ case YY_STATE_EOF(INITIAL): * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1245,30 +1155,30 @@ case YY_STATE_EOF(INITIAL): else { - if ( ! (yy_did_buffer_switch_on_eof) ) + if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state( ); + yy_current_state = yy_get_previous_state(); - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state( ); + yy_current_state = yy_get_previous_state(); - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; @@ -1279,7 +1189,8 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of yylex */ + } /* end of yylex */ + /* yy_get_next_buffer - try to read in a new buffer * @@ -1288,20 +1199,21 @@ case YY_STATE_EOF(INITIAL): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; register int number_to_move, i; int ret_val; - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1321,30 +1233,34 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); + (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -1357,7 +1273,8 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1367,35 +1284,35 @@ static int yy_get_next_buffer (void) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - +#endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + yy_current_buffer->yy_n_chars = yy_n_chars; } - if ( (yy_n_chars) == 0 ) + if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); + yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1403,31 +1320,32 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; -} + } + /* yy_get_previous_state - get the state just before the EOB char was reached */ - static yy_state_type yy_get_previous_state (void) -{ +static yy_state_type yy_get_previous_state() + { register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = (yy_start); - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1439,23 +1357,30 @@ static int yy_get_next_buffer (void) } return yy_current_state; -} + } + /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1467,73 +1392,80 @@ static int yy_get_next_buffer (void) yy_is_jam = (yy_current_state == 334); return yy_is_jam ? 0 : yy_current_state; -} + } - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); + *yy_cp = yy_hold_char; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} -#ifndef YY_NO_INPUT + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + #ifdef __cplusplus - static int yyinput (void) +static int yyinput() #else - static int input (void) +static int input() #endif - -{ + { int c; - - *(yy_c_buf_p) = (yy_hold_char); - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; + *yy_c_buf_p = '\0'; else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; - switch ( yy_get_next_buffer( ) ) + switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1547,16 +1479,16 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart(yyin ); + yyrestart( yyin ); - /*FALLTHROUGH*/ + /* fall through */ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) + if ( yywrap() ) return EOF; - if ( ! (yy_did_buffer_switch_on_eof) ) + if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1566,92 +1498,90 @@ static int yy_get_next_buffer (void) } case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; + yy_c_buf_p = yytext_ptr + offset; break; } } } - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + return c; -} -#endif /* ifndef YY_NO_INPUT */ + } -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) return; - if ( YY_CURRENT_BUFFER ) + if ( yy_current_buffer ) { /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; } - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + yy_current_buffer = new_buffer; + yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - (yy_did_buffer_switch_on_eof) = 1; -} + yy_did_buffer_switch_on_eof = 1; + } -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1660,75 +1590,80 @@ static void yy_load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer(b,file ); + yy_init_buffer( b, file ); return b; -} + } -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { if ( ! b ) return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); + yy_flex_free( (void *) b->yy_ch_buf ); - yyfree((void *) b ); -} + yy_flex_free( (void *) b ); + } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) -{ - int oerrno = errno; - - yy_flush_buffer(b ); +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) return; b->yy_n_chars = 0; @@ -1745,121 +1680,29 @@ extern int isatty (int ); b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; + if ( b == yy_current_buffer ) + yy_load_buffer_state(); } -} -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); @@ -1873,51 +1716,56 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer(b ); + yy_switch_to_buffer( b ); return b; -} + } +#endif -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); + n = len + 2; + buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer(buf,n ); + b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -1927,177 +1775,148 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) b->yy_is_our_buffer = 1; return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 + } #endif -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} -/* Redefine yyless() so it works in section 3 code. */ +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); -/* Accessor methods (get/set functions) to struct members. */ + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} + yy_start_stack[yy_start_stack_ptr++] = YY_START; -/** Get the current token. - * - */ + BEGIN(new_state); + } +#endif -char *yyget_text (void) -{ - return yytext; -} -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif -int yyget_debug (void) -{ - return yy_flex_debug; -} -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; +static void yy_fatal_error( msg ) +char msg[]; #endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; +/* Redefine yyless() so it works in section 3 code. */ - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) - return 0; -} -/* - * Internal utility routines. - */ +/* Internal utility routines. */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; -} + } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { register int n; for ( n = 0; s[n]; ++n ) ; return n; -} + } #endif -void *yyalloc (yy_size_t size ) -{ + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { return (void *) malloc( size ); -} + } -void *yyrealloc (void * ptr, yy_size_t size ) -{ +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2106,13 +1925,23 @@ void *yyrealloc (void * ptr, yy_size_t size ) * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} + } -#define YYTABLES_NAME "yytables" +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif #line 116 "printrcl.l" diff --git a/src/gutenprintui2/printrcy.c b/src/gutenprintui2/printrcy.c index 178c7f5..d0a6c99 100644 --- a/src/gutenprintui2/printrcy.c +++ b/src/gutenprintui2/printrcy.c @@ -1,9 +1,7 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 1.875. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. 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 @@ -17,24 +15,16 @@ 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -46,9 +36,6 @@ /* Identify Bison output. */ #define YYBISON 1 -/* Bison version. */ -#define YYBISON_VERSION "2.3" - /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -106,7 +93,6 @@ pCURVE = 295 }; #endif -/* Tokens. */ #define tINT 258 #define tDOUBLE 259 #define tDIMENSION 260 @@ -197,12 +183,7 @@ static stpui_plist_t *current_printer = NULL; # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) typedef int YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -214,171 +195,49 @@ typedef int YYSTYPE; /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 219 "printrcy.c" - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif +/* Line 214 of yacc.c. */ +#line 199 "printrcy.c" -#if ! defined yyoverflow || YYERROR_VERBOSE +#if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) +# if defined (__STDC__) || defined (__cplusplus) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif +# define YYSIZE_T size_t # endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; + short yyss; YYSTYPE yyvs; }; @@ -388,24 +247,24 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ +# if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ - YYSIZE_T yyi; \ + register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif @@ -423,33 +282,39 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (YYID (0)) + while (0) #endif -/* YYFINAL -- State number of the termination state. */ +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 10 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 75 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 41 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 42 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 70 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 114 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 295 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = +static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -486,7 +351,7 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const yytype_uint8 yyprhs[] = +static const unsigned char yyprhs[] = { 0, 0, 3, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 53, @@ -498,8 +363,8 @@ static const yytype_uint8 yyprhs[] = 189 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = { 82, 0, -1, 12, 7, 7, -1, 13, 7, -1, 26, 7, -1, 27, 7, -1, 28, 7, -1, 29, @@ -524,7 +389,7 @@ static const yytype_int8 yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const unsigned short yyrline[] = { 0, 100, 100, 111, 118, 128, 138, 148, 158, 165, 172, 179, 186, 193, 200, 207, 228, 235, 242, 245, @@ -537,37 +402,37 @@ static const yytype_uint16 yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "tINT", "tDOUBLE", "tDIMENSION", - "tBOOLEAN", "tSTRING", "tWORD", "tGSWORD", "CURRENT_PRINTER", - "SHOW_ALL_PAPER_SIZES", "PRINTER", "DESTINATION", "SCALING", - "ORIENTATION", "AUTOSIZE_ROLL_PAPER", "UNIT", "DRIVER", "LEFT", "TOP", - "CUSTOM_PAGE_WIDTH", "CUSTOM_PAGE_HEIGHT", "OUTPUT_TYPE", "PRINTRC_HDR", - "PARAMETER", "QUEUE_NAME", "OUTPUT_FILENAME", "EXTRA_PRINTER_OPTIONS", - "CUSTOM_COMMAND", "COMMAND_TYPE", "GLOBAL_SETTINGS", "GLOBAL", - "END_GLOBAL_SETTINGS", "pINT", "pSTRING_LIST", "pFILE", "pDOUBLE", - "pDIMENSION", "pBOOLEAN", "pCURVE", "$accept", "Printer", "Destination", - "Queue_Name", "Output_Filename", "Extra_Printer_Options", - "Custom_Command", "Command_Type", "Scaling", "Orientation", - "Autosize_Roll_Paper", "Unit", "Left", "Top", "Output_Type", - "Custom_Page_Width", "Custom_Page_Height", "Empty", "Int_Param", - "String_List_Param", "File_Param", "Double_Param", "Dimension_Param", - "Boolean_Param", "Curve_Param", "Typed_Param", "Parameter", "Parameters", - "Standard_Value", "Standard_Values", "A_Printer", "Printers", - "Current_Printer", "Show_All_Paper_Sizes", "Global", "Old_Globals", - "New_Global_Setting", "Global_Setting", "Global_Settings", - "Global_Subblock", "Global_Block", "Thing", 0 + "$end", "error", "$undefined", "tINT", "tDOUBLE", "tDIMENSION", + "tBOOLEAN", "tSTRING", "tWORD", "tGSWORD", "CURRENT_PRINTER", + "SHOW_ALL_PAPER_SIZES", "PRINTER", "DESTINATION", "SCALING", + "ORIENTATION", "AUTOSIZE_ROLL_PAPER", "UNIT", "DRIVER", "LEFT", "TOP", + "CUSTOM_PAGE_WIDTH", "CUSTOM_PAGE_HEIGHT", "OUTPUT_TYPE", "PRINTRC_HDR", + "PARAMETER", "QUEUE_NAME", "OUTPUT_FILENAME", "EXTRA_PRINTER_OPTIONS", + "CUSTOM_COMMAND", "COMMAND_TYPE", "GLOBAL_SETTINGS", "GLOBAL", + "END_GLOBAL_SETTINGS", "pINT", "pSTRING_LIST", "pFILE", "pDOUBLE", + "pDIMENSION", "pBOOLEAN", "pCURVE", "$accept", "Printer", "Destination", + "Queue_Name", "Output_Filename", "Extra_Printer_Options", + "Custom_Command", "Command_Type", "Scaling", "Orientation", + "Autosize_Roll_Paper", "Unit", "Left", "Top", "Output_Type", + "Custom_Page_Width", "Custom_Page_Height", "Empty", "Int_Param", + "String_List_Param", "File_Param", "Double_Param", "Dimension_Param", + "Boolean_Param", "Curve_Param", "Typed_Param", "Parameter", + "Parameters", "Standard_Value", "Standard_Values", "A_Printer", + "Printers", "Current_Printer", "Show_All_Paper_Sizes", "Global", + "Old_Globals", "New_Global_Setting", "Global_Setting", + "Global_Settings", "Global_Subblock", "Global_Block", "Thing", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = +static const unsigned short yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -578,7 +443,7 @@ static const yytype_uint16 yytoknum[] = # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const unsigned char yyr1[] = { 0, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, @@ -591,7 +456,7 @@ static const yytype_uint8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const unsigned char yyr2[] = { 0, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 4, @@ -606,7 +471,7 @@ static const yytype_uint8 yyr2[] = /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = +static const unsigned char yydefact[] = { 0, 18, 0, 0, 18, 69, 0, 68, 67, 18, 1, 56, 65, 0, 0, 60, 55, 70, 0, 66, @@ -622,8 +487,8 @@ static const yytype_uint8 yydefact[] = 22, 23, 24, 25 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yysigned_char yydefgoto[] = { -1, 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 5, 85, 86, @@ -635,7 +500,7 @@ static const yytype_int8 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -26 -static const yytype_int8 yypact[] = +static const yysigned_char yypact[] = { -22, -2, 6, 0, -26, -26, 5, -26, -26, -26, -26, -26, -26, -7, 11, -26, -26, 7, 13, -26, @@ -652,7 +517,7 @@ static const yytype_int8 yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +static const yysigned_char yypgoto[] = { -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -4, -26, -26, @@ -666,7 +531,7 @@ static const yytype_int8 yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = +static const unsigned char yytable[] = { 12, 18, 1, 3, 14, 16, 10, 11, 3, 93, 94, 95, 96, 97, 98, 99, 14, 25, 84, 26, @@ -678,7 +543,7 @@ static const yytype_uint8 yytable[] = 108, 109, 110, 111, 113, 112 }; -static const yytype_int8 yycheck[] = +static const yysigned_char yycheck[] = { 4, 8, 24, 10, 11, 9, 0, 7, 10, 34, 35, 36, 37, 38, 39, 40, 11, 6, 8, 12, @@ -692,7 +557,7 @@ static const yytype_int8 yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const unsigned char yystos[] = { 0, 24, 82, 10, 31, 58, 73, 76, 80, 81, 0, 7, 58, 79, 11, 74, 58, 72, 8, 33, @@ -708,6 +573,22 @@ static const yytype_uint8 yystos[] = 4, 3, 6, 7 }; +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -715,8 +596,7 @@ static const yytype_uint8 yystos[] = #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - +#define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. @@ -733,63 +613,30 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ + YYPOPSTACK; \ goto yybackup; \ } \ else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ + { \ + yyerror ("syntax error: cannot back up");\ YYERROR; \ } \ -while (YYID (0)) - +while (0) #define YYTERROR 1 #define YYERRCODE 256 +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.first_line = Rhs[1].first_line; \ + Current.first_column = Rhs[1].first_column; \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #endif - /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -810,96 +657,42 @@ while (YYID (0)) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +} while (0) -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | +| TOP (cinluded). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (short *bottom, short *top) #else static void yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; + short *bottom; + short *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) + for (/* Nothing. */; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -908,52 +701,45 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (int yyrule) #else static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; +yy_reduce_print (yyrule) int yyrule; #endif { - int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } + unsigned int yylineno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylineno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) + yy_reduce_print (Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -968,9 +754,13 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ +#if YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -980,47 +770,45 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H +# if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -#else -static YYSIZE_T +# else yystrlen (yystr) - const char *yystr; -#endif + const char *yystr; +# endif { - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) + register const char *yys = yystr; + + while (*yys++ != '\0') continue; - return yylen; + + return yys - yystr - 1; } # endif # endif # ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * +# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -#else -static char * +# else yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif + char *yydest; + const char *yysrc; +# endif { - char *yyd = yydest; - const char *yys = yysrc; + register char *yyd = yydest; + register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -1030,192 +818,70 @@ yystpcpy (yydest, yysrc) # endif # endif -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } +#endif /* !YYERROR_VERBOSE */ - if (! yyres) - return yystrlen (yystr); + - return yystpcpy (yyres, yystr) - yyres; -} -# endif +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif { - int yyn = yypact[yystate]; + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + if (yytype < YYNTOKENS) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); } -#endif /* YYERROR_VERBOSE */ - +#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +yydestruct (int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; +yydestruct (yytype, yyvaluep) int yytype; YYSTYPE *yyvaluep; #endif { - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; switch (yytype) { default: - break; + break; } } @@ -1223,13 +889,13 @@ yydestruct (yymsg, yytype, yyvaluep) /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus +# if defined (__STDC__) || defined (__cplusplus) int yyparse (void *YYPARSE_PARAM); -#else +# else int yyparse (); -#endif +# endif #else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus +#if defined (__STDC__) || defined (__cplusplus) int yyparse (void); #else int yyparse (); @@ -1238,10 +904,10 @@ int yyparse (); -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1254,18 +920,14 @@ int yynerrs; `----------*/ #ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif #else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) int yyparse (void) #else @@ -1276,19 +938,13 @@ yyparse () #endif { - int yystate; - int yyn; + register int yystate; + register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ + /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif /* Three stacks and their tools: `yyss': related to states, @@ -1299,18 +955,18 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + register YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) +#define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; @@ -1319,9 +975,9 @@ yyparse () YYSTYPE yyval; - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1345,7 +1001,8 @@ yyparse () `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ + have just been pushed. so pushing a state here evens the stacks. + */ yyssp++; yysetstate: @@ -1358,18 +1015,18 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), + yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), @@ -1380,21 +1037,21 @@ yyparse () } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; + goto yyoverflowlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyoverflowlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyexhaustedlab; + goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); @@ -1425,17 +1082,19 @@ yyparse () `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ - /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1450,7 +1109,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1470,21 +1129,22 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token unless it is eof. */ + /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; - yystate = yyn; *++yyvsp = yylval; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; goto yynewstate; @@ -1522,27 +1182,27 @@ yyreduce: case 2: #line 101 "printrcy.y" { - current_printer = stpui_plist_create((yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].sval)); - g_free((yyvsp[(2) - (3)].sval)); - g_free((yyvsp[(3) - (3)].sval)); + current_printer = stpui_plist_create(yyvsp[-1].sval, yyvsp[0].sval); + g_free(yyvsp[-1].sval); + g_free(yyvsp[0].sval); } break; case 3: #line 112 "printrcy.y" { - if ((yyvsp[(2) - (2)].sval)) - g_free((yyvsp[(2) - (2)].sval)); + if (yyvsp[0].sval) + g_free(yyvsp[0].sval); } break; case 4: #line 119 "printrcy.y" { - if (current_printer && (yyvsp[(2) - (2)].sval)) + if (current_printer && yyvsp[0].sval) { - stpui_plist_set_queue_name(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); + stpui_plist_set_queue_name(current_printer, yyvsp[0].sval); + g_free(yyvsp[0].sval); } } break; @@ -1550,10 +1210,10 @@ yyreduce: case 5: #line 129 "printrcy.y" { - if (current_printer && (yyvsp[(2) - (2)].sval)) + if (current_printer && yyvsp[0].sval) { - stpui_plist_set_output_filename(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); + stpui_plist_set_output_filename(current_printer, yyvsp[0].sval); + g_free(yyvsp[0].sval); } } break; @@ -1561,10 +1221,10 @@ yyreduce: case 6: #line 139 "printrcy.y" { - if (current_printer && (yyvsp[(2) - (2)].sval)) + if (current_printer && yyvsp[0].sval) { - stpui_plist_set_extra_printer_options(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); + stpui_plist_set_extra_printer_options(current_printer, yyvsp[0].sval); + g_free(yyvsp[0].sval); } } break; @@ -1572,10 +1232,10 @@ yyreduce: case 7: #line 149 "printrcy.y" { - if (current_printer && (yyvsp[(2) - (2)].sval)) + if (current_printer && yyvsp[0].sval) { - stpui_plist_set_custom_command(current_printer, (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); + stpui_plist_set_custom_command(current_printer, yyvsp[0].sval); + g_free(yyvsp[0].sval); } } break; @@ -1584,7 +1244,7 @@ yyreduce: #line 159 "printrcy.y" { if (current_printer) - stpui_plist_set_command_type(current_printer, (yyvsp[(2) - (2)].ival)); + stpui_plist_set_command_type(current_printer, yyvsp[0].ival); } break; @@ -1592,7 +1252,7 @@ yyreduce: #line 166 "printrcy.y" { if (current_printer) - current_printer->scaling = (yyvsp[(2) - (2)].dval); + current_printer->scaling = yyvsp[0].dval; } break; @@ -1600,7 +1260,7 @@ yyreduce: #line 173 "printrcy.y" { if (current_printer) - current_printer->orientation = (yyvsp[(2) - (2)].ival); + current_printer->orientation = yyvsp[0].ival; } break; @@ -1608,7 +1268,7 @@ yyreduce: #line 180 "printrcy.y" { if (current_printer) - current_printer->auto_size_roll_feed_paper = (yyvsp[(2) - (2)].ival); + current_printer->auto_size_roll_feed_paper = yyvsp[0].ival; } break; @@ -1616,7 +1276,7 @@ yyreduce: #line 187 "printrcy.y" { if (current_printer) - current_printer->unit = (yyvsp[(2) - (2)].ival); + current_printer->unit = yyvsp[0].ival; } break; @@ -1624,7 +1284,7 @@ yyreduce: #line 194 "printrcy.y" { if (current_printer) - stp_set_left(current_printer->v, (yyvsp[(2) - (2)].ival)); + stp_set_left(current_printer->v, yyvsp[0].ival); } break; @@ -1632,7 +1292,7 @@ yyreduce: #line 201 "printrcy.y" { if (current_printer) - stp_set_top(current_printer->v, (yyvsp[(2) - (2)].ival)); + stp_set_top(current_printer->v, yyvsp[0].ival); } break; @@ -1641,7 +1301,7 @@ yyreduce: { if (current_printer) { - switch ((yyvsp[(2) - (2)].ival)) + switch (yyvsp[0].ival) { case 0: stp_set_string_parameter @@ -1662,7 +1322,7 @@ yyreduce: #line 229 "printrcy.y" { if (current_printer) - stp_set_page_width(current_printer->v, (yyvsp[(2) - (2)].ival)); + stp_set_page_width(current_printer->v, yyvsp[0].ival); } break; @@ -1670,7 +1330,7 @@ yyreduce: #line 236 "printrcy.y" { if (current_printer) - stp_set_page_height(current_printer->v, (yyvsp[(2) - (2)].ival)); + stp_set_page_height(current_printer->v, yyvsp[0].ival); } break; @@ -1679,16 +1339,16 @@ yyreduce: { if (current_printer) { - stp_set_int_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].ival)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_int_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_int_parameter(current_printer->v, yyvsp[-3].sval, yyvsp[0].ival); + if (strcmp(yyvsp[-1].sval, "False") == 0) + stp_set_int_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_INACTIVE); else - stp_set_int_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_int_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_ACTIVE); } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); + g_free(yyvsp[-3].sval); + g_free(yyvsp[-1].sval); } break; @@ -1697,17 +1357,17 @@ yyreduce: { if (current_printer) { - stp_set_string_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].sval)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_string_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_string_parameter(current_printer->v, yyvsp[-3].sval, yyvsp[0].sval); + if (strcmp(yyvsp[-1].sval, "False") == 0) + stp_set_string_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_INACTIVE); else - stp_set_string_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_string_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_ACTIVE); } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); + g_free(yyvsp[-3].sval); + g_free(yyvsp[-1].sval); + g_free(yyvsp[0].sval); } break; @@ -1716,17 +1376,17 @@ yyreduce: { if (current_printer) { - stp_set_file_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].sval)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_file_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_file_parameter(current_printer->v, yyvsp[-3].sval, yyvsp[0].sval); + if (strcmp(yyvsp[-1].sval, "False") == 0) + stp_set_file_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_INACTIVE); else - stp_set_file_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_file_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_ACTIVE); } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); + g_free(yyvsp[-3].sval); + g_free(yyvsp[-1].sval); + g_free(yyvsp[0].sval); } break; @@ -1735,16 +1395,16 @@ yyreduce: { if (current_printer) { - stp_set_float_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].dval)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_float_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_float_parameter(current_printer->v, yyvsp[-3].sval, yyvsp[0].dval); + if (strcmp(yyvsp[-1].sval, "False") == 0) + stp_set_float_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_INACTIVE); else - stp_set_float_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_float_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_ACTIVE); } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); + g_free(yyvsp[-3].sval); + g_free(yyvsp[-1].sval); } break; @@ -1753,16 +1413,16 @@ yyreduce: { if (current_printer) { - stp_set_dimension_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), (yyvsp[(4) - (4)].ival)); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_dimension_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_dimension_parameter(current_printer->v, yyvsp[-3].sval, yyvsp[0].ival); + if (strcmp(yyvsp[-1].sval, "False") == 0) + stp_set_dimension_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_INACTIVE); else - stp_set_dimension_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_dimension_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_ACTIVE); } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); + g_free(yyvsp[-3].sval); + g_free(yyvsp[-1].sval); } break; @@ -1771,20 +1431,20 @@ yyreduce: { if (current_printer) { - if (strcmp((yyvsp[(4) - (4)].sval), "False") == 0) - stp_set_boolean_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), 0); + if (strcmp(yyvsp[0].sval, "False") == 0) + stp_set_boolean_parameter(current_printer->v, yyvsp[-3].sval, 0); else - stp_set_boolean_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), 1); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_boolean_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_boolean_parameter(current_printer->v, yyvsp[-3].sval, 1); + if (strcmp(yyvsp[-1].sval, "False") == 0) + stp_set_boolean_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_INACTIVE); else - stp_set_boolean_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_boolean_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_ACTIVE); } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); + g_free(yyvsp[-3].sval); + g_free(yyvsp[-1].sval); + g_free(yyvsp[0].sval); } break; @@ -1793,62 +1453,63 @@ yyreduce: { if (current_printer) { - stp_curve_t *curve = stp_curve_create_from_string((yyvsp[(4) - (4)].sval)); + stp_curve_t *curve = stp_curve_create_from_string(yyvsp[0].sval); if (curve) { - stp_set_curve_parameter(current_printer->v, (yyvsp[(1) - (4)].sval), curve); - if (strcmp((yyvsp[(3) - (4)].sval), "False") == 0) - stp_set_curve_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_curve_parameter(current_printer->v, yyvsp[-3].sval, curve); + if (strcmp(yyvsp[-1].sval, "False") == 0) + stp_set_curve_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_INACTIVE); else - stp_set_curve_parameter_active(current_printer->v, (yyvsp[(1) - (4)].sval), + stp_set_curve_parameter_active(current_printer->v, yyvsp[-3].sval, STP_PARAMETER_ACTIVE); stp_curve_destroy(curve); } } - g_free((yyvsp[(1) - (4)].sval)); - g_free((yyvsp[(3) - (4)].sval)); - g_free((yyvsp[(4) - (4)].sval)); + g_free(yyvsp[-3].sval); + g_free(yyvsp[-1].sval); + g_free(yyvsp[0].sval); } break; case 56: #line 402 "printrcy.y" - { stpui_printrc_current_printer = (yyvsp[(2) - (2)].sval); } + { stpui_printrc_current_printer = yyvsp[0].sval; } break; case 57: #line 406 "printrcy.y" { - if (strcmp((yyvsp[(2) - (2)].sval), "True") == 0) + if (strcmp(yyvsp[0].sval, "True") == 0) stpui_show_all_paper_sizes = 1; else stpui_show_all_paper_sizes = 0; - g_free((yyvsp[(2) - (2)].sval)); + g_free(yyvsp[0].sval); } break; case 61: #line 422 "printrcy.y" { - if ((yyvsp[(2) - (2)].sval)) + if (yyvsp[0].sval) { - stpui_set_global_parameter((yyvsp[(1) - (2)].sval), (yyvsp[(2) - (2)].sval)); - g_free((yyvsp[(2) - (2)].sval)); + stpui_set_global_parameter(yyvsp[-1].sval, yyvsp[0].sval); + g_free(yyvsp[0].sval); } - g_free((yyvsp[(1) - (2)].sval)); + g_free(yyvsp[-1].sval); } break; -/* Line 1267 of yacc.c. */ -#line 1846 "printrcy.c" - default: break; } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - YYPOPSTACK (yylen); - yylen = 0; +/* Line 991 of yacc.c. */ +#line 1507 "printrcy.c" + + yyvsp -= yylen; + yyssp -= yylen; + + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; @@ -1877,93 +1538,109 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) +#if YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("syntax error, unexpected ") + 1; + yysize += yystrlen (yytname[yytype]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); } if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + /* Return failure if at end of input. */ + if (yychar == YYEOF) + { + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyss < yyssp) + { + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + YYPOPSTACK; + } + YYABORT; + } + + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; + } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ - goto yyerrlab1; + goto yyerrlab2; + +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ +yyerrlab1: -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: + /* Suppress GCC warning that yyerrlab1 is unused when no action + invokes YYERROR. */ +#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) \ + && !defined __cplusplus + __attribute__ ((__unused__)) +#endif - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; + goto yyerrlab2; -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: +/*---------------------------------------------------------------. +| yyerrlab2 -- pop states until the error token can be shifted. | +`---------------------------------------------------------------*/ +yyerrlab2: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) @@ -1984,22 +1661,21 @@ yyerrlab1: if (yyssp == yyss) YYABORT; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; - *++yyvsp = yylval; + YYDPRINTF ((stderr, "Shifting error token, ")); + *++yyvsp = yylval; - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -2020,39 +1696,21 @@ yyabortlab: goto yyreturn; #ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } diff --git a/src/gutenprintui2/printrcy.h b/src/gutenprintui2/printrcy.h index 8a6c041..afa662b 100644 --- a/src/gutenprintui2/printrcy.h +++ b/src/gutenprintui2/printrcy.h @@ -1,9 +1,7 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 1.875. */ -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. 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 @@ -17,21 +15,13 @@ 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -79,7 +69,6 @@ pCURVE = 295 }; #endif -/* Tokens. */ #define tINT 258 #define tDOUBLE 259 #define tDIMENSION 260 @@ -122,7 +111,7 @@ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) typedef int YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -131,3 +120,5 @@ typedef int YYSTYPE; extern YYSTYPE yylval; + + diff --git a/src/gutenprintui2/printrcy.y b/src/gutenprintui2/printrcy.y index 625d1d7..72e946a 100644 --- a/src/gutenprintui2/printrcy.y +++ b/src/gutenprintui2/printrcy.y @@ -1,5 +1,5 @@ /* - * "$Id: printrcy.y,v 1.1.18.1 2007/03/02 12:01:20 rlk Exp $" + * "$Id: printrcy.y,v 1.2 2006/11/15 01:28:49 rlk Exp $" * * Test pattern generator for Gutenprint * diff --git a/src/main/Makefile.am b/src/main/Makefile.am index 55b2868..077713f 100644 --- a/src/main/Makefile.am +++ b/src/main/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.92.10.1 2007/03/02 12:01:20 rlk Exp $ +## $Id: Makefile.am,v 1.99 2008/04/28 02:06:44 rlk Exp $ ## Copyright (C) 2000 Roger Leigh ## ## This program is free software; you can redistribute it and/or modify @@ -25,8 +25,8 @@ include $(top_srcdir)/scripts/global.mk ## Variables pkgconfigdatadir = $(libdir)/pkgconfig -pkgxmldatadir = $(pkgdatadir)/$(VERSION)/xml -pkgmoduledir = $(pkglibdir)/$(VERSION)/modules +pkgxmldatadir = $(pkgdatadir)/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/xml +pkgmoduledir = $(pkglibdir)/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/modules ## Programs @@ -39,7 +39,7 @@ pkgmodule_LTLIBRARIES = \ print-lexmark.la \ print-pcl.la \ print-ps.la \ - print-olympus.la \ + print-dyesub.la \ print-raw.la endif @@ -77,11 +77,11 @@ print_lexmark_la_LDFLAGS = -module -avoid-version print_pcl_la_SOURCES = print-pcl.c print_pcl_la_LDFLAGS = -module -avoid-version -print_ps_la_SOURCES = print-ps.c +print_ps_la_SOURCES = print-ps.c xmlppd.c xmlppd.h print_ps_la_LDFLAGS = -module -avoid-version -print_olympus_la_SOURCES = print-olympus.c -print_olympus_la_LDFLAGS = -module -avoid-version +print_dyesub_la_SOURCES = print-olympus.c +print_dyesub_la_LDFLAGS = -module -avoid-version print_raw_la_SOURCES = print-raw.c print_raw_la_LDFLAGS = -module -avoid-version @@ -95,7 +95,7 @@ module_SOURCES = \ $(print_lexmark_la_SOURCES) \ $(print_pcl_la_SOURCES) \ $(print_ps_la_SOURCES) \ - $(print_olympus_la_SOURCES) \ + $(print_dyesub_la_SOURCES) \ $(print_raw_la_SOURCES) if !BUILD_MODULES diff --git a/src/main/Makefile.in b/src/main/Makefile.in index ef0e99e..3af179d 100644 --- a/src/main/Makefile.in +++ b/src/main/Makefile.in @@ -43,13 +43,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src/main ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -91,7 +90,7 @@ am__libgutenprint_la_SOURCES_DIST = array.c bit-ops.c channel.c \ canon-printers.h print-escp2.c escp2-driver.c print-escp2.h \ print-escp2-data.c escp2-channels.c escp2-inks.c \ escp2-papers.c escp2-resolutions.c print-lexmark.c print-pcl.c \ - print-ps.c print-olympus.c print-raw.c + print-ps.c xmlppd.c xmlppd.h print-olympus.c print-raw.c am__objects_1 = mxml-attr.lo mxml-file.lo mxml-node.lo mxml-search.lo am__objects_2 = am__objects_3 = print-color.lo color-conversions.lo @@ -101,7 +100,7 @@ am__objects_5 = print-escp2.lo escp2-driver.lo print-escp2-data.lo \ escp2-resolutions.lo am__objects_6 = print-lexmark.lo am__objects_7 = print-pcl.lo -am__objects_8 = print-ps.lo +am__objects_8 = print-ps.lo xmlppd.lo am__objects_9 = print-olympus.lo am__objects_10 = print-raw.lo am__objects_11 = $(am__objects_3) $(am__objects_4) $(am__objects_5) \ @@ -128,6 +127,13 @@ print_canon_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(print_canon_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_MODULES_TRUE@am_print_canon_la_rpath = -rpath $(pkgmoduledir) +print_dyesub_la_LIBADD = +am_print_dyesub_la_OBJECTS = print-olympus.lo +print_dyesub_la_OBJECTS = $(am_print_dyesub_la_OBJECTS) +print_dyesub_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(print_dyesub_la_LDFLAGS) $(LDFLAGS) -o $@ +@BUILD_MODULES_TRUE@am_print_dyesub_la_rpath = -rpath $(pkgmoduledir) print_escp2_la_LIBADD = am_print_escp2_la_OBJECTS = print-escp2.lo escp2-driver.lo \ print-escp2-data.lo escp2-channels.lo escp2-inks.lo \ @@ -144,13 +150,6 @@ print_lexmark_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(print_lexmark_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_MODULES_TRUE@am_print_lexmark_la_rpath = -rpath $(pkgmoduledir) -print_olympus_la_LIBADD = -am_print_olympus_la_OBJECTS = print-olympus.lo -print_olympus_la_OBJECTS = $(am_print_olympus_la_OBJECTS) -print_olympus_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(print_olympus_la_LDFLAGS) $(LDFLAGS) -o $@ -@BUILD_MODULES_TRUE@am_print_olympus_la_rpath = -rpath $(pkgmoduledir) print_pcl_la_LIBADD = am_print_pcl_la_OBJECTS = print-pcl.lo print_pcl_la_OBJECTS = $(am_print_pcl_la_OBJECTS) @@ -159,7 +158,7 @@ print_pcl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(print_pcl_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_MODULES_TRUE@am_print_pcl_la_rpath = -rpath $(pkgmoduledir) print_ps_la_LIBADD = -am_print_ps_la_OBJECTS = print-ps.lo +am_print_ps_la_OBJECTS = print-ps.lo xmlppd.lo print_ps_la_OBJECTS = $(am_print_ps_la_OBJECTS) print_ps_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -185,14 +184,14 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(color_traditional_la_SOURCES) $(libgutenprint_la_SOURCES) \ - $(print_canon_la_SOURCES) $(print_escp2_la_SOURCES) \ - $(print_lexmark_la_SOURCES) $(print_olympus_la_SOURCES) \ + $(print_canon_la_SOURCES) $(print_dyesub_la_SOURCES) \ + $(print_escp2_la_SOURCES) $(print_lexmark_la_SOURCES) \ $(print_pcl_la_SOURCES) $(print_ps_la_SOURCES) \ $(print_raw_la_SOURCES) DIST_SOURCES = $(color_traditional_la_SOURCES) \ $(am__libgutenprint_la_SOURCES_DIST) $(print_canon_la_SOURCES) \ - $(print_escp2_la_SOURCES) $(print_lexmark_la_SOURCES) \ - $(print_olympus_la_SOURCES) $(print_pcl_la_SOURCES) \ + $(print_dyesub_la_SOURCES) $(print_escp2_la_SOURCES) \ + $(print_lexmark_la_SOURCES) $(print_pcl_la_SOURCES) \ $(print_ps_la_SOURCES) $(print_raw_la_SOURCES) pkgconfigdataDATA_INSTALL = $(INSTALL_DATA) pkgxmldataDATA_INSTALL = $(INSTALL_DATA) @@ -248,27 +247,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -276,13 +261,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -387,16 +365,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -425,9 +399,10 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la pkgconfigdatadir = $(libdir)/pkgconfig -pkgxmldatadir = $(pkgdatadir)/$(VERSION)/xml -pkgmoduledir = $(pkglibdir)/$(VERSION)/modules +pkgxmldatadir = $(pkgdatadir)/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/xml +pkgmoduledir = $(pkglibdir)/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/modules @BUILD_MODULES_TRUE@pkgmodule_LTLIBRARIES = \ @BUILD_MODULES_TRUE@ color-traditional.la \ @BUILD_MODULES_TRUE@ print-canon.la \ @@ -435,7 +410,7 @@ pkgmoduledir = $(pkglibdir)/$(VERSION)/modules @BUILD_MODULES_TRUE@ print-lexmark.la \ @BUILD_MODULES_TRUE@ print-pcl.la \ @BUILD_MODULES_TRUE@ print-ps.la \ -@BUILD_MODULES_TRUE@ print-olympus.la \ +@BUILD_MODULES_TRUE@ print-dyesub.la \ @BUILD_MODULES_TRUE@ print-raw.la color_traditional_la_SOURCES = \ @@ -468,10 +443,10 @@ print_lexmark_la_SOURCES = print-lexmark.c print_lexmark_la_LDFLAGS = -module -avoid-version print_pcl_la_SOURCES = print-pcl.c print_pcl_la_LDFLAGS = -module -avoid-version -print_ps_la_SOURCES = print-ps.c +print_ps_la_SOURCES = print-ps.c xmlppd.c xmlppd.h print_ps_la_LDFLAGS = -module -avoid-version -print_olympus_la_SOURCES = print-olympus.c -print_olympus_la_LDFLAGS = -module -avoid-version +print_dyesub_la_SOURCES = print-olympus.c +print_dyesub_la_LDFLAGS = -module -avoid-version print_raw_la_SOURCES = print-raw.c print_raw_la_LDFLAGS = -module -avoid-version lib_LTLIBRARIES = libgutenprint.la @@ -482,7 +457,7 @@ module_SOURCES = \ $(print_lexmark_la_SOURCES) \ $(print_pcl_la_SOURCES) \ $(print_ps_la_SOURCES) \ - $(print_olympus_la_SOURCES) \ + $(print_dyesub_la_SOURCES) \ $(print_raw_la_SOURCES) @BUILD_MODULES_FALSE@libgutenprint_modules = $(module_SOURCES) @@ -651,12 +626,12 @@ libgutenprint.la: $(libgutenprint_la_OBJECTS) $(libgutenprint_la_DEPENDENCIES) $(libgutenprint_la_LINK) -rpath $(libdir) $(libgutenprint_la_OBJECTS) $(libgutenprint_la_LIBADD) $(LIBS) print-canon.la: $(print_canon_la_OBJECTS) $(print_canon_la_DEPENDENCIES) $(print_canon_la_LINK) $(am_print_canon_la_rpath) $(print_canon_la_OBJECTS) $(print_canon_la_LIBADD) $(LIBS) +print-dyesub.la: $(print_dyesub_la_OBJECTS) $(print_dyesub_la_DEPENDENCIES) + $(print_dyesub_la_LINK) $(am_print_dyesub_la_rpath) $(print_dyesub_la_OBJECTS) $(print_dyesub_la_LIBADD) $(LIBS) print-escp2.la: $(print_escp2_la_OBJECTS) $(print_escp2_la_DEPENDENCIES) $(print_escp2_la_LINK) $(am_print_escp2_la_rpath) $(print_escp2_la_OBJECTS) $(print_escp2_la_LIBADD) $(LIBS) print-lexmark.la: $(print_lexmark_la_OBJECTS) $(print_lexmark_la_DEPENDENCIES) $(print_lexmark_la_LINK) $(am_print_lexmark_la_rpath) $(print_lexmark_la_OBJECTS) $(print_lexmark_la_LIBADD) $(LIBS) -print-olympus.la: $(print_olympus_la_OBJECTS) $(print_olympus_la_DEPENDENCIES) - $(print_olympus_la_LINK) $(am_print_olympus_la_rpath) $(print_olympus_la_OBJECTS) $(print_olympus_la_LIBADD) $(LIBS) print-pcl.la: $(print_pcl_la_OBJECTS) $(print_pcl_la_DEPENDENCIES) $(print_pcl_la_LINK) $(am_print_pcl_la_rpath) $(print_pcl_la_OBJECTS) $(print_pcl_la_LIBADD) $(LIBS) print-ps.la: $(print_ps_la_OBJECTS) $(print_ps_la_DEPENDENCIES) @@ -718,6 +693,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sequence.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-list.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlppd.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/src/main/bit-ops.c b/src/main/bit-ops.c index ab111ca..a110adf 100644 --- a/src/main/bit-ops.c +++ b/src/main/bit-ops.c @@ -1,5 +1,5 @@ /* - * "$Id: bit-ops.c,v 1.9.8.2 2007/05/12 19:14:27 faust3 Exp $" + * "$Id: bit-ops.c,v 1.12 2007/03/08 13:34:27 faust3 Exp $" * * Softweave calculator for Gutenprint. * diff --git a/src/main/canon-inks.h b/src/main/canon-inks.h index a3a3fbb..1cd69fc 100644 --- a/src/main/canon-inks.h +++ b/src/main/canon-inks.h @@ -304,6 +304,19 @@ static const canon_inkset_t canon_9_C3M3Y2K2_c_inkset[] = { {0,0.0,NULL} }; +/* iP6000D */ +static const canon_inkset_t canon_9_C3M3Y3K3_inkset[] = { + {'C',1.0,&canon_2b_3l_ink}, + {'M',1.0,&canon_2b_3l_ink}, + {'Y',1.0,&canon_2b_3l_ink}, + {'K',1.0,&canon_2b_3l_ink}, + {0,0.0,NULL}, + {0,0.0,NULL}, + {0,0.0,NULL}, + {0,0.0,NULL}, + {0,0.0,NULL} +}; + /* iP4000 default print mode (quality 2) */ static const canon_inkset_t canon_9_C3M3Y2K2k3_c_inkset[] = { {'C',1.0,&canon_2b_3l_c_ink}, diff --git a/src/main/canon-modes.h b/src/main/canon-modes.h index 815481b..0397688 100644 --- a/src/main/canon-modes.h +++ b/src/main/canon-modes.h @@ -321,6 +321,10 @@ static const canon_mode_t canon_PIXMA_iP4200_modes[] = { }; DECLARE_MODES(canon_PIXMA_iP4200,2); +static const canon_mode_t canon_PIXMA_iP6000_modes[] = { + { 600, 600,CANON_INK_CMYK,"600x600dpi",N_("600x600 DPI"),INKSET(9_C3M3Y3K3),MODE_FLAG_EXTENDED_T,NULL,1.0,1.0,NULL,NULL,NULL,2}, +}; +DECLARE_MODES(canon_PIXMA_iP6000,0); static const canon_mode_t canon_PIXMA_iP6700_modes[] = { { 600, 600,CANON_INK_CMYK,"600x600dpi",N_("600x600 DPI"),INKSET(19_C3M3Y3k3),MODE_FLAG_EXTENDED_T,NULL,1.0,1.0,NULL,NULL,NULL,2}, diff --git a/src/main/canon-printers.h b/src/main/canon-printers.h index b136a41..cd44195 100644 --- a/src/main/canon-printers.h +++ b/src/main/canon-printers.h @@ -46,6 +46,7 @@ typedef struct canon_caps { const char *lum_adjustment; const char *hue_adjustment; const char *sat_adjustment; + const char *channel_order; /* (in gutenprint notation) 0123 => KCMY, 1230 => CMYK etc. */ } canon_cap_t; static const char standard_sat_adjustment[] = @@ -164,6 +165,8 @@ static const char* control_cmd_MULTIPASS_MP150[] = { NULL }; +static const char iP4500_channel_order[STP_NCOLORS] = {1,2,3,0}; /* CMYK */ + static const canon_cap_t canon_model_capabilities[] = { /* the first printer is used as default in case something has gone wrong in printers.xml */ @@ -177,6 +180,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, /* ******************************** */ @@ -204,6 +208,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -217,6 +222,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -230,6 +236,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 85 *//* heads: BC-20 BC-21 BC-22 */ @@ -242,6 +249,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -255,6 +263,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -268,6 +277,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -281,6 +291,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -294,6 +305,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -307,6 +319,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 8200 *//* heads: BC-50 */ @@ -319,6 +332,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon S500 */ @@ -331,6 +345,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -351,6 +366,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 240 *//* heads: BC-02 BC-05 BC-06 */ @@ -363,6 +379,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 250 *//* heads: BC-02 BC-05 BC-06 */ @@ -375,6 +392,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 1000 *//* heads: BC-02 BC-05 BC-06 */ @@ -387,6 +405,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 2000 *//* heads: BC-20 BC-21 BC-22 BC-29 */ @@ -399,6 +418,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 3000 *//* heads: BC-30 BC-33 BC-34 */ @@ -411,6 +431,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 6100 *//* heads: BC-30/BC-31 BC-32/BC-31 */ @@ -423,6 +444,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 7000 *//* heads: BC-60/BC-61 BC-60/BC-62 ??????? */ @@ -435,6 +457,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC i560 */ @@ -447,6 +470,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 7100 *//* heads: BC-60/BC-61 BC-60/BC-62 ??????? */ @@ -459,6 +483,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC i80 *//* heads: BC-60/BC-61 BC-60/BC-62 ??????? */ @@ -471,6 +496,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, @@ -491,6 +517,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 5500 *//* heads: BC-20 BC-21 BC-29 */ @@ -503,6 +530,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 6500 *//* heads: BC-30/BC-31 BC-32/BC-31 */ @@ -515,6 +543,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon BJC 8500 *//* heads: BC-80/BC-81 BC-82/BC-81 */ @@ -527,6 +556,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_default_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon PIXMA iP2000 */ @@ -539,6 +569,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon PIXMA iP3000 */ @@ -551,6 +582,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon PIXMA iP4000 */ @@ -563,6 +595,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* PIXMA MP740 (== iP4000 without duplex) */ @@ -576,6 +609,7 @@ static const canon_cap_t canon_model_capabilities[] = NULL, NULL, NULL, + NULL }, { /* Canon PIXMA iP5300, MP610 */ "PIXMA iP5300", 3, /*model, model_id*/ @@ -587,6 +621,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon PIXMA iP4500 */ @@ -594,12 +629,13 @@ static const canon_cap_t canon_model_capabilities[] = 842, 17*72, /* max paper width and height */ 10, 10, 15, 15, /*border_left, border_right, border_top, border_bottom */ &canon_PIXMA_iP4000_slotlist, - CANON_CAP_STD0|CANON_CAP_DUPLEX|CANON_CAP_r|CANON_CAP_px|CANON_CAP_I,0x64,control_cmd_PIXMA_iP4000, /*features */ + CANON_CAP_STD0|CANON_CAP_DUPLEX|CANON_CAP_r|CANON_CAP_px|CANON_CAP_I,0x61,control_cmd_MULTIPASS_MP150, /*features */ &canon_PIXMA_iP5300_modelist, &canon_PIXMA_iP4000_paperlist, NULL, NULL, - NULL + NULL, + iP4500_channel_order }, { /* Canon PIXMA iP4200 */ "PIXMA iP4200", 3, /*model, model_id*/ @@ -614,6 +650,19 @@ static const canon_cap_t canon_model_capabilities[] = iP4200_sat_adjustment }, { /* Canon PIXMA iP6700 */ + "PIXMA iP6000", 3, /*model, model_id*/ + 842, 17*72, /* max paper width and height */ + 10, 10, 15, 15, /*border_left, border_right, border_top, border_bottom */ + &canon_PIXMA_iP4000_slotlist, + CANON_CAP_STD0|CANON_CAP_DUPLEX|CANON_CAP_r|CANON_CAP_px,0x64,control_cmd_PIXMA_iP4000, /*features */ + &canon_PIXMA_iP6000_modelist, + &canon_PIXMA_iP4000_paperlist, + NULL, + NULL, + NULL, + NULL + }, + { /* Canon PIXMA iP6700 */ "PIXMA iP6700", 3, /*model, model_id*/ 842, 17*72, /* max paper width and height */ 10, 10, 15, 15, /*border_left, border_right, border_top, border_bottom */ @@ -623,6 +672,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon PIXMA iX5000 */ @@ -630,11 +680,25 @@ static const canon_cap_t canon_model_capabilities[] = 842, 17*72, /* max paper width and height */ 10, 10, 15, 15, /*border_left, border_right, border_top, border_bottom */ &canon_PIXMA_iP4000_slotlist, - CANON_CAP_STD0|CANON_CAP_DUPLEX|CANON_CAP_r|CANON_CAP_px,0x61,control_cmd_PIXMA_iP4000, /*features */ + CANON_CAP_STD0|CANON_CAP_DUPLEX|CANON_CAP_r|CANON_CAP_px|CANON_CAP_I,0x61,control_cmd_PIXMA_iP4000, /*features */ + &canon_PIXMA_iX5000_modelist, + &canon_PIXMA_iP4000_paperlist, + NULL, + NULL, + NULL, + NULL + }, + { /* Canon PIXMA MP520 */ + "PIXMA MP520", 3, /*model, model_id*/ + 842, 17*72, /* max paper width and height */ + 10, 10, 15, 15, /*border_left, border_right, border_top, border_bottom */ + &canon_PIXMA_iP4000_slotlist, + CANON_CAP_STD0|CANON_CAP_DUPLEX|CANON_CAP_r|CANON_CAP_px|CANON_CAP_I,0x61,control_cmd_PIXMA_iP4000, /*features */ &canon_PIXMA_iX5000_modelist, &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon PIXMA Pro9500 */ @@ -647,6 +711,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon PIXMA iP8500 */ @@ -659,6 +724,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, { /* Canon MULTIPASS MP150 */ @@ -671,6 +737,7 @@ static const canon_cap_t canon_model_capabilities[] = &canon_PIXMA_iP4000_paperlist, NULL, NULL, + NULL, NULL }, }; diff --git a/src/main/color-conversion.h b/src/main/color-conversion.h index ab04380..5e4f1c3 100644 --- a/src/main/color-conversion.h +++ b/src/main/color-conversion.h @@ -1,5 +1,5 @@ /* - * "$Id: color-conversion.h,v 1.11 2005/09/17 21:54:33 rlk Exp $" + * "$Id: color-conversion.h,v 1.12 2008/01/21 23:19:39 rlk Exp $" * * Gutenprint color management module - traditional Gimp-Print algorithm. * @@ -150,9 +150,7 @@ typedef struct stp_cached_curve_t contrast_correction; stp_cached_curve_t user_color_correction; stp_cached_curve_t channel_curves[STP_CHANNEL_LIMIT]; - stp_cached_curve_t hue_angle; double gamma_values[STP_CHANNEL_LIMIT]; - double hue_angles[STP_CHANNEL_LIMIT]; double print_gamma; double app_gamma; double screen_gamma; diff --git a/src/main/curve.c b/src/main/curve.c index 3820dea..e65900b 100644 --- a/src/main/curve.c +++ b/src/main/curve.c @@ -1,5 +1,5 @@ /* - * "$Id: curve.c,v 1.52 2006/09/12 19:03:32 easysw Exp $" + * "$Id: curve.c,v 1.53 2008/01/21 23:19:39 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * @@ -469,6 +469,49 @@ stp_curve_create_copy(const stp_curve_t *curve) return ret; } +void +stp_curve_reverse(stp_curve_t *dest, const stp_curve_t *source) +{ + check_curve(dest); + check_curve(source); + curve_dtor(dest); + dest->curve_type = source->curve_type; + dest->wrap_mode = source->wrap_mode; + dest->gamma = source->gamma; + if (source->piecewise) + { + const double *source_data; + size_t size; + double *new_data; + int i; + stp_sequence_get_data(source->seq, &size, &source_data); + new_data = stp_malloc(sizeof(double) * size); + for (i = 0; i < size; i += 2) + { + int j = size - i - 2; + new_data[i] = 1.0 - source_data[j]; + new_data[i + 1] = source_data[j + 1]; + } + dest->seq = stp_sequence_create(); + stp_sequence_set_data(dest->seq, size, new_data); + stp_free(new_data); + } + else + dest->seq = stp_sequence_create_reverse(source->seq); + dest->piecewise = source->piecewise; + dest->recompute_interval = 1; +} + +stp_curve_t * +stp_curve_create_reverse(const stp_curve_t *curve) +{ + stp_curve_t *ret; + check_curve(curve); + ret = stp_curve_create(curve->wrap_mode); + stp_curve_reverse(ret, curve); + return ret; +} + int stp_curve_set_bounds(stp_curve_t *curve, double low, double high) { diff --git a/src/main/dither-eventone.c b/src/main/dither-eventone.c index 51eb10b..2b983e0 100644 --- a/src/main/dither-eventone.c +++ b/src/main/dither-eventone.c @@ -1,5 +1,5 @@ /* - * "$Id: dither-eventone.c,v 1.40 2004/09/17 18:38:18 rleigh Exp $" + * "$Id: dither-eventone.c,v 1.42 2008/02/19 01:13:46 rlk Exp $" * * EvenTone dither implementation for Gimp-Print * @@ -55,6 +55,8 @@ typedef struct int physical_aspect; int diff_factor; stpi_dither_channel_t *dummy_channel; + double transition; /* Exponential scaling for transition region */ + stp_dither_matrix_impl_t transition_matrix; } eventone_t; typedef struct shade_segment @@ -86,14 +88,17 @@ free_eventone_data(stpi_dither_t *d) STP_SAFE_FREE(CHANNEL(d, i).aux_data); } } - if (et->dummy_channel) { - stpi_dither_channel_t *dc = et->dummy_channel; - shade_distance_t *shade = (shade_distance_t *) dc->aux_data; - STP_SAFE_FREE(shade->et_dis); - STP_SAFE_FREE(dc->aux_data); - stpi_dither_channel_destroy(dc); - STP_SAFE_FREE(et->dummy_channel); - } + if (et->dummy_channel) + { + stpi_dither_channel_t *dc = et->dummy_channel; + shade_distance_t *shade = (shade_distance_t *) dc->aux_data; + STP_SAFE_FREE(shade->et_dis); + STP_SAFE_FREE(dc->aux_data); + stpi_dither_channel_destroy(dc); + STP_SAFE_FREE(et->dummy_channel); + } + if (d->stpi_dither_type & D_UNITONE) + stp_dither_matrix_destroy(&(et->transition_matrix)); STP_SAFE_FREE(et); } @@ -105,20 +110,26 @@ et_setup(stpi_dither_t *d) eventone_t *et = stp_zalloc(sizeof(eventone_t)); int xa, ya; int i; - for (i = 0; i < CHANNEL_COUNT(d); i++) { - CHANNEL(d, i).error_rows = 1; - CHANNEL(d, i).errs = stp_zalloc(1 * sizeof(int *)); - CHANNEL(d, i).errs[0] = stp_zalloc(size * sizeof(int)); - } - if (d->stpi_dither_type & D_UNITONE) { - stpi_dither_channel_t *dc = stp_zalloc(sizeof(stpi_dither_channel_t)); - stp_dither_matrix_clone(&(d->dither_matrix), &(dc->dithermat), 0, 0); - stp_dither_matrix_clone(&(d->transition_matrix), &(dc->pick), 0, 0); - dc->error_rows = 1; - dc->errs = stp_zalloc(1 * sizeof(int *)); - dc->errs[0] = stp_zalloc(size * sizeof(int)); - et->dummy_channel = dc; - } + for (i = 0; i < CHANNEL_COUNT(d); i++) + { + CHANNEL(d, i).error_rows = 1; + CHANNEL(d, i).errs = stp_zalloc(1 * sizeof(int *)); + CHANNEL(d, i).errs[0] = stp_zalloc(size * sizeof(int)); + } + if (d->stpi_dither_type & D_UNITONE) + { + stpi_dither_channel_t *dc = stp_zalloc(sizeof(stpi_dither_channel_t)); + stp_dither_matrix_clone(&(d->dither_matrix), &(dc->dithermat), 0, 0); + et->transition = 0.7; + stp_dither_matrix_destroy(&(et->transition_matrix)); + stp_dither_matrix_copy(&(d->dither_matrix), &(et->transition_matrix)); + stp_dither_matrix_scale_exponentially(&(et->transition_matrix), et->transition); + stp_dither_matrix_clone(&(et->transition_matrix), &(dc->pick), 0, 0); + dc->error_rows = 1; + dc->errs = stp_zalloc(1 * sizeof(int *)); + dc->errs[0] = stp_zalloc(size * sizeof(int)); + et->dummy_channel = dc; + } xa = d->x_aspect / d->y_aspect; if (xa == 0) @@ -136,30 +147,30 @@ et_setup(stpi_dither_t *d) et->unitone_aspect = UNITONE_C2 / (xa * ya); et->d_sq.r_sq = 0; - for (i = 0; i < CHANNEL_COUNT(d); i++) { - int x; - shade_distance_t *shade = stp_zalloc(sizeof(shade_distance_t)); - shade->dis = et->d_sq; - shade->et_dis = stp_malloc(sizeof(distance_t) * d->dst_width); - if (CHANNEL(d, i).darkness > .1) - shade->share_this_channel = 1; - else - shade->share_this_channel = 0; - for (x = 0; x < d->dst_width; x++) { - shade->et_dis[x] = et->d_sq; + for (i = 0; i < CHANNEL_COUNT(d); i++) + { + int x; + shade_distance_t *shade = stp_zalloc(sizeof(shade_distance_t)); + shade->dis = et->d_sq; + shade->et_dis = stp_malloc(sizeof(distance_t) * d->dst_width); + if (CHANNEL(d, i).darkness > .1) + shade->share_this_channel = 1; + else + shade->share_this_channel = 0; + for (x = 0; x < d->dst_width; x++) + shade->et_dis[x] = et->d_sq; + CHANNEL(d, i).aux_data = shade; } - CHANNEL(d, i).aux_data = shade; - } - if (et->dummy_channel) { - int x; - shade_distance_t *shade = stp_zalloc(sizeof(shade_distance_t)); - shade->dis = et->d_sq; - shade->et_dis = stp_malloc(sizeof(distance_t) * d->dst_width); - for (x = 0; x < d->dst_width; x++) { - shade->et_dis[x] = et->d_sq; + if (et->dummy_channel) + { + int x; + shade_distance_t *shade = stp_zalloc(sizeof(shade_distance_t)); + shade->dis = et->d_sq; + shade->et_dis = stp_malloc(sizeof(distance_t) * d->dst_width); + for (x = 0; x < d->dst_width; x++) + shade->et_dis[x] = et->d_sq; + et->dummy_channel->aux_data = shade; } - et->dummy_channel->aux_data = shade; - } et->physical_aspect = d->y_aspect / d->x_aspect; if (et->physical_aspect >= 4) @@ -183,27 +194,27 @@ et_initializer(stpi_dither_t *d, int duplicate_line, int zero_mask) et_setup(d); et = (eventone_t *) (d->aux_data); - if (!duplicate_line) { - if ((zero_mask & ((1 << CHANNEL_COUNT(d)) - 1)) != - ((1 << CHANNEL_COUNT(d)) - 1)) { - d->last_line_was_empty = 0; - } else { - d->last_line_was_empty++; + if (!duplicate_line) + { + if ((zero_mask & ((1 << CHANNEL_COUNT(d)) - 1)) != + ((1 << CHANNEL_COUNT(d)) - 1)) + d->last_line_was_empty = 0; + else + d->last_line_was_empty++; } - } else if (d->last_line_was_empty) { + else if (d->last_line_was_empty) d->last_line_was_empty++; - } - if (d->last_line_was_empty >= 5) { + if (d->last_line_was_empty >= 5) return 0; - } else if (d->last_line_was_empty == 4) { - if (et->dummy_channel) { - memset(et->dummy_channel->errs[0], 0, d->dst_width * sizeof(int)); + else if (d->last_line_was_empty == 4) + { + if (et->dummy_channel) + memset(et->dummy_channel->errs[0], 0, d->dst_width * sizeof(int)); + for (i = 0; i < CHANNEL_COUNT(d); i++) + memset(CHANNEL(d, i).errs[0], 0, d->dst_width * sizeof(int)); + return 0; } - for (i = 0; i < CHANNEL_COUNT(d); i++) - memset(CHANNEL(d, i).errs[0], 0, d->dst_width * sizeof(int)); - return 0; - } for (i = 0; i < CHANNEL_COUNT(d); i++) CHANNEL(d, i).v = 0; if (et->dummy_channel) @@ -216,12 +227,13 @@ advance_eventone_pre(shade_distance_t *sp, eventone_t *et, int x) { distance_t *etd = &sp->et_dis[x]; int t = sp->dis.r_sq + sp->dis.dx; - if (t <= etd->r_sq) { /* Do eventone calculations */ - sp->dis.r_sq = t; /* Nearest pixel same as last one */ - sp->dis.dx += et->d2x; - } else { + if (t <= etd->r_sq) + { /* Do eventone calculations */ + sp->dis.r_sq = t; /* Nearest pixel same as last one */ + sp->dis.dx += et->d2x; + } + else sp->dis = *etd; /* Nearest pixel is from a previous line */ - } } static inline void @@ -232,16 +244,16 @@ eventone_update(stpi_dither_channel_t *dc, eventone_t *et, distance_t *etd = &sp->et_dis[x]; int t = etd->r_sq + etd->dy; /* r^2 from dot above */ int u = sp->dis.r_sq + sp->dis.dy; /* r^2 from dot on this line */ - if (u < t) { /* If dot from this line is close */ - t = u; /* Use it instead */ - etd->dx = sp->dis.dx; - etd->dy = sp->dis.dy; - } + if (u < t) + { /* If dot from this line is close */ + t = u; /* Use it instead */ + etd->dx = sp->dis.dx; + etd->dy = sp->dis.dy; + } etd->dy += et->d2y; - if (t > 65535) { /* Do some hard limiting */ - t = 65535; - } + if (t > 65535) + t = 65535; /* Do some hard limiting */ etd->r_sq = t; } @@ -255,7 +267,7 @@ diffuse_error(stpi_dither_channel_t *dc, eventone_t *et, int x, int direction) * -- rlk 20031101 */ #if 0 -/* int fraction = (dc->v + (et->diff_factor>>1)) / et->diff_factor; */ + /* int fraction = (dc->v + (et->diff_factor>>1)) / et->diff_factor; */ int frac_2 = dc->v + dc->v; int frac_3 = frac_2 + dc->v; dc->errs[0][x + MAX_SPREAD] = frac_3; @@ -277,16 +289,17 @@ eventone_adjust(stpi_dither_channel_t *dc, eventone_t *et, int dither_point, return 0; else if (dither_point >= 65535) return 65535; - if (desired == 0) { + if (desired == 0) dither_point = 0; - } else { - shade_distance_t *shade = (shade_distance_t *) dc->aux_data; - dither_point += shade->dis.r_sq * et->aspect - (EVEN_C1 * 65535) / desired; - if (dither_point > 65535) - dither_point = 65535; - else if (dither_point < 0) - dither_point = 0; - } + else + { + shade_distance_t *shade = (shade_distance_t *) dc->aux_data; + dither_point += shade->dis.r_sq * et->aspect - (EVEN_C1 * 65535) / desired; + if (dither_point > 65535) + dither_point = 65535; + else if (dither_point < 0) + dither_point = 0; + } return dither_point; } @@ -298,13 +311,14 @@ unitone_adjust(stpi_dither_channel_t *dc, eventone_t *et, return INT_MIN; else if (dither_point >= 65535) return dither_point; - if (desired == 0) { + if (desired == 0) dither_point = INT_MIN; - } else { - shade_distance_t *shade = (shade_distance_t *) dc->aux_data; - dither_point += shade->dis.r_sq * et->unitone_aspect - - (UNITONE_C1 * 65535u) / desired; - } + else + { + shade_distance_t *shade = (shade_distance_t *) dc->aux_data; + dither_point += shade->dis.r_sq * et->unitone_aspect - + (UNITONE_C1 * 65535u) / desired; + } return dither_point; } @@ -326,12 +340,13 @@ find_segment(stpi_dither_channel_t *dc, unsigned inkval, int i; stpi_ink_defn_t *ip; - for (i=0, ip = dc->ink_list; i < dc->nlevels - 1; i++, ip++) { - if (ip->value > inkval) - break; - lower->bits = ip->bits; - lower->range = ip->value; - } + for (i=0, ip = dc->ink_list; i < dc->nlevels - 1; i++, ip++) + { + if (ip->value > inkval) + break; + lower->bits = ip->bits; + lower->range = ip->value; + } upper->bits = ip->bits; upper->range = ip->value; @@ -373,10 +388,11 @@ print_ink(stpi_dither_t *d, unsigned char *tptr, const stpi_ink_defn_t *ink, tptr[length] |= bit; return; default: - for (j=1; j <= ink->bits; j+=j, tptr += length) { - if (j & ink->bits) - *tptr |= bit; - } + for (j=1; j <= ink->bits; j+=j, tptr += length) + { + if (j & ink->bits) + *tptr |= bit; + } return; } } @@ -393,8 +409,8 @@ stpi_dither_et(stp_vars_t *v, stpi_dither_t *d = (stpi_dither_t *) stp_get_component_data(v, "Dither"); eventone_t *et; - int x, - length; + int x; + int length; unsigned char bit; int i; @@ -407,90 +423,100 @@ stpi_dither_et(stp_vars_t *v, return; et = (eventone_t *) d->aux_data; + if (d->stpi_dither_type & D_UNITONE) + stp_dither_matrix_set_row(&(et->transition_matrix), row); length = (d->dst_width + 7) / 8; - if (row & 1) { - direction = 1; - x = 0; - terminate = d->dst_width; - d->ptr_offset = 0; - } else { - direction = -1; - x = d->dst_width - 1; - terminate = -1; - d->ptr_offset = length - 1; - raw += channel_count * (d->src_width - 1); - } + if (row & 1) + { + direction = 1; + x = 0; + terminate = d->dst_width; + d->ptr_offset = 0; + } + else + { + direction = -1; + x = d->dst_width - 1; + terminate = -1; + d->ptr_offset = length - 1; + raw += channel_count * (d->src_width - 1); + } bit = 1 << (7 - (x & 7)); xstep = channel_count * (d->src_width / d->dst_width); xmod = d->src_width % d->dst_width; xerror = (xmod * x) % d->dst_width; - for (; x != terminate; x += direction) { + for (; x != terminate; x += direction) + { - int point_error = 0; - int comparison = 32768; + int point_error = 0; + int comparison = 32768; - if (d->stpi_dither_type & D_ORDERED_BASE) - comparison += (ditherpoint(d, &(d->dither_matrix), x) / 16) - 2048; + if (d->stpi_dither_type & D_ORDERED_BASE) + comparison += (ditherpoint(d, &(d->dither_matrix), x) / 16) - 2048; - for (i=0; i < channel_count; i++) { - if (CHANNEL(d, i).ptr) + for (i=0; i < channel_count; i++) { - int inkspot; - int range_point; - stpi_dither_channel_t *dc = &CHANNEL(d, i); - shade_distance_t *sp = (shade_distance_t *) dc->aux_data; - stpi_ink_defn_t *inkp; - stpi_ink_defn_t lower, upper; - - advance_eventone_pre(sp, et, x); - - /* - * Find which are the two candidate dot sizes. - * Rather than use the absolute value of the point to compute - * the error, we will use the relative value of the point within - * the range to find the two candidate dot sizes. - */ - range_point = - find_segment_and_ditherpoint(dc, raw[i], &lower, &upper); - - /* Incorporate error data from previous line */ - dc->v += 2 * range_point + (dc->errs[0][x + MAX_SPREAD] + 8) / 16; - inkspot = dc->v - range_point; - - point_error += eventone_adjust(dc, et, inkspot, range_point); - - /* Determine whether to print the larger or smaller dot */ - inkp = &lower; - if (point_error >= comparison) { - point_error -= 65535; - inkp = &upper; - dc->v -= 131070; - sp->dis = et->d_sq; - } - - /* Adjust the error to reflect the dot choice */ - if (inkp->bits) { - if (!mask || (*(mask + d->ptr_offset) & bit)) { - set_row_ends(dc, x); - - /* Do the printing */ - print_ink(d, dc->ptr, inkp, bit, length); + if (CHANNEL(d, i).ptr) + { + int inkspot; + int range_point; + stpi_dither_channel_t *dc = &CHANNEL(d, i); + shade_distance_t *sp = (shade_distance_t *) dc->aux_data; + stpi_ink_defn_t *inkp; + stpi_ink_defn_t lower, upper; + + advance_eventone_pre(sp, et, x); + + /* + * Find which are the two candidate dot sizes. + * Rather than use the absolute value of the point to compute + * the error, we will use the relative value of the point within + * the range to find the two candidate dot sizes. + */ + range_point = + find_segment_and_ditherpoint(dc, raw[i], &lower, &upper); + + /* Incorporate error data from previous line */ + dc->v += 2 * range_point + (dc->errs[0][x + MAX_SPREAD] + 8) / 16; + inkspot = dc->v - range_point; + + point_error += eventone_adjust(dc, et, inkspot, range_point); + + /* Determine whether to print the larger or smaller dot */ + inkp = &lower; + if (point_error >= comparison) + { + point_error -= 65535; + inkp = &upper; + dc->v -= 131070; + sp->dis = et->d_sq; + } + + /* Adjust the error to reflect the dot choice */ + if (inkp->bits) + { + if (!mask || (*(mask + d->ptr_offset) & bit)) + { + set_row_ends(dc, x); + + /* Do the printing */ + print_ink(d, dc->ptr, inkp, bit, length); + } + } + + /* Spread the error around to the adjacent dots */ + eventone_update(dc, et, x, direction); + diffuse_error(dc, et, x, direction); } - } - - /* Spread the error around to the adjacent dots */ - eventone_update(dc, et, x, direction); - diffuse_error(dc, et, x, direction); } + if (direction == 1) + ADVANCE_UNIDIRECTIONAL(d, bit, raw, channel_count, xerror, xstep, xmod); + else + ADVANCE_REVERSE(d, bit, raw, channel_count, xerror, xstep, xmod); } - if (direction == 1) - ADVANCE_UNIDIRECTIONAL(d, bit, raw, channel_count, xerror, xstep, xmod); - else - ADVANCE_REVERSE(d, bit, raw, channel_count, xerror, xstep, xmod); - } if (direction == -1) stpi_dither_reverse_row_ends(d); } @@ -506,8 +532,8 @@ stpi_dither_ut(stp_vars_t *v, stpi_dither_t *d = (stpi_dither_t *) stp_get_component_data(v, "Dither"); eventone_t *et; - int x, - length; + int x; + int length; unsigned char bit; int i; @@ -517,10 +543,11 @@ stpi_dither_ut(stp_vars_t *v, int channel_count = CHANNEL_COUNT(d); stpi_dither_channel_t *ddc; - if (channel_count == 1) { - stpi_dither_et(v, row, raw, duplicate_line, zero_mask, mask); - return; - } + if (channel_count == 1) + { + stpi_dither_et(v, row, raw, duplicate_line, zero_mask, mask); + return; + } if (!et_initializer(d, duplicate_line, zero_mask)) return; @@ -530,181 +557,201 @@ stpi_dither_ut(stp_vars_t *v, length = (d->dst_width + 7) / 8; - if (row & 1) { - direction = 1; - x = 0; - terminate = d->dst_width; - d->ptr_offset = 0; - } else { - direction = -1; - x = d->dst_width - 1; - terminate = -1; - d->ptr_offset = length - 1; - raw += channel_count * (d->src_width - 1); - } + if (row & 1) + { + direction = 1; + x = 0; + terminate = d->dst_width; + d->ptr_offset = 0; + } + else + { + direction = -1; + x = d->dst_width - 1; + terminate = -1; + d->ptr_offset = length - 1; + raw += channel_count * (d->src_width - 1); + } bit = 1 << (7 - (x & 7)); xstep = channel_count * (d->src_width / d->dst_width); xmod = d->src_width % d->dst_width; xerror = (xmod * x) % d->dst_width; - for (; x != terminate; x += direction) { - - shade_distance_t *ssp = (shade_distance_t *) ddc->aux_data; - int point_error = 0; - int total_error = 0; - int channels_to_print = 0; - int print_all_channels = 0; - int maximum_value = 0; - int comparison = 32768; - stpi_dither_channel_t *best_channel = NULL; - stpi_dither_channel_t *second_best_channel = NULL; - int best_channel_value = INT_MIN; - int second_best_channel_value = INT_MIN; - int random_value = ditherpoint(d, &(d->dither_matrix), x); - - if (d->stpi_dither_type & D_ORDERED_BASE) - comparison += (random_value / 16) - 2048; - - - ddc->b = 0; - advance_eventone_pre(ssp, et, x); - - for (i=0; i < channel_count; i++) { - stpi_dither_channel_t *dc = &CHANNEL(d, i); - if (dc->ptr) { - shade_distance_t *sp = (shade_distance_t *) dc->aux_data; - - advance_eventone_pre(sp, et, x); - - /* - * Find which are the two candidate dot sizes. - * Rather than use the absolute value of the point to compute - * the error, we will use the relative value of the point within - * the range to find the two candidate dot sizes. - */ - dc->b = find_segment_and_ditherpoint(dc, raw[i], - &(sp->lower), &(sp->upper)); - if (sp->share_this_channel) { - if (dc->b > maximum_value) - maximum_value = dc->b; - ddc->b += dc->b; + for (; x != terminate; x += direction) + { + + shade_distance_t *ssp = (shade_distance_t *) ddc->aux_data; + int point_error = 0; + int total_error = 0; + int channels_to_print = 0; + int print_all_channels = 0; + int maximum_value = 0; + int comparison = 32768; + stpi_dither_channel_t *best_channel = NULL; + stpi_dither_channel_t *second_best_channel = NULL; + int best_channel_value = INT_MIN; + int second_best_channel_value = INT_MIN; + int random_value = ditherpoint(d, &(d->dither_matrix), x); + + if (d->stpi_dither_type & D_ORDERED_BASE) + comparison += (random_value / 16) - 2048; + + + ddc->b = 0; + advance_eventone_pre(ssp, et, x); + + for (i=0; i < channel_count; i++) + { + stpi_dither_channel_t *dc = &CHANNEL(d, i); + if (dc->ptr) + { + shade_distance_t *sp = (shade_distance_t *) dc->aux_data; + + advance_eventone_pre(sp, et, x); + + /* + * Find which are the two candidate dot sizes. + * Rather than use the absolute value of the point to compute + * the error, we will use the relative value of the point within + * the range to find the two candidate dot sizes. + */ + dc->b = find_segment_and_ditherpoint(dc, raw[i], + &(sp->lower), &(sp->upper)); + if (sp->share_this_channel) + { + if (dc->b > maximum_value) + maximum_value = dc->b; + ddc->b += dc->b; + } + /* Incorporate error data from previous line */ + dc->v += 2 * dc->b + (dc->errs[0][x + MAX_SPREAD] + 8) / 16; + dc->o = unitone_adjust(dc, et, dc->v - dc->b, dc->b); + } } - /* Incorporate error data from previous line */ - dc->v += 2 * dc->b + (dc->errs[0][x + MAX_SPREAD] + 8) / 16; - dc->o = unitone_adjust(dc, et, dc->v - dc->b, dc->b); - } - } #if 0 - if ((2 * (ddc->b - maximum_value)) < (3 * maximum_value)) - print_all_channels = 1; + if ((2 * (ddc->b - maximum_value)) < (3 * maximum_value)) + print_all_channels = 1; #endif - if (ddc->b > 131070) - print_all_channels = 1; - else if (ddc->b > 65535) { - ddc->b -= 65535; - channels_to_print = 1; - } + if (ddc->b > 131070) + print_all_channels = 1; + else if (ddc->b > 65535) + { + ddc->b -= 65535; + channels_to_print = 1; + } - if (ddc->b > 65535) { - ddc->b = 65535; - } + if (ddc->b > 65535) + ddc->b = 65535; - ddc->v += 2 * ddc->b + (ddc->errs[0][x + MAX_SPREAD] + 8) / 16; - total_error += eventone_adjust(ddc, et, ddc->v - ddc->b, ddc->b); - if (total_error >= comparison) { - channels_to_print += 1; - } + ddc->v += 2 * ddc->b + (ddc->errs[0][x + MAX_SPREAD] + 8) / 16; + total_error += eventone_adjust(ddc, et, ddc->v - ddc->b, ddc->b); + if (total_error >= comparison) + channels_to_print += 1; - if (!print_all_channels) { - for (i=0; i < channel_count; i++) { - stpi_dither_channel_t *dc = &CHANNEL(d, i); - shade_distance_t *sp = (shade_distance_t *) dc->aux_data; + if (!print_all_channels) + { + for (i=0; i < channel_count; i++) + { + stpi_dither_channel_t *dc = &CHANNEL(d, i); + shade_distance_t *sp = (shade_distance_t *) dc->aux_data; - if (dc->ptr) { - - if (sp->share_this_channel) { - if (dc->o > best_channel_value) { - second_best_channel = best_channel; - best_channel = dc; - second_best_channel_value = best_channel_value; - if (dc->o >= 32768) - best_channel_value = INT_MAX; - else - best_channel_value = dc->o; - } else if (dc->o > second_best_channel_value) { - second_best_channel = dc; - if (dc->o >= 32768) - second_best_channel_value = INT_MAX; - else - second_best_channel_value = dc->o; + if (dc->ptr) + { + + if (sp->share_this_channel) + { + if (dc->o > best_channel_value) + { + second_best_channel = best_channel; + best_channel = dc; + second_best_channel_value = best_channel_value; + if (dc->o >= 32768) + best_channel_value = INT_MAX; + else + best_channel_value = dc->o; + } + else if (dc->o > second_best_channel_value) + { + second_best_channel = dc; + if (dc->o >= 32768) + second_best_channel_value = INT_MAX; + else + second_best_channel_value = dc->o; + } + } + } } - } } - } - } - for (i=0; i < channel_count; i++) { - stpi_dither_channel_t *dc = &CHANNEL(d, i); - if (dc->ptr) { - - /* Determine whether to print the larger or smaller dot */ - shade_distance_t *sp = (shade_distance_t *) dc->aux_data; - stpi_ink_defn_t *inkp = &(sp->lower); - - if (dc->o < 0) - dc->o = 0; - else if (dc->o > 65535) - dc->o = 65535; - if (print_all_channels || !sp->share_this_channel) { - point_error += dc->o; - if (point_error >= comparison) { - point_error -= 65535; - inkp = &(sp->upper); - dc->v -= 131070; - sp->dis = et->d_sq; - } - } else if ((channels_to_print >= 1 && best_channel == dc) || - (channels_to_print >= 2 && second_best_channel == dc)) { - inkp = &(sp->upper); - dc->v -= 131070; - sp->dis = et->d_sq; - } - if (inkp->bits) { - if (!mask || (*(mask + d->ptr_offset) & bit)) { - set_row_ends(dc, x); - - /* Do the printing */ - print_ink(d, dc->ptr, inkp, bit, length); - } + for (i=0; i < channel_count; i++) + { + stpi_dither_channel_t *dc = &CHANNEL(d, i); + if (dc->ptr) + { + /* Determine whether to print the larger or smaller dot */ + shade_distance_t *sp = (shade_distance_t *) dc->aux_data; + stpi_ink_defn_t *inkp = &(sp->lower); + + if (dc->o < 0) + dc->o = 0; + else if (dc->o > 65535) + dc->o = 65535; + if (print_all_channels || !sp->share_this_channel) + { + point_error += dc->o; + if (point_error >= comparison) + { + point_error -= 65535; + inkp = &(sp->upper); + dc->v -= 131070; + sp->dis = et->d_sq; + } + } + else if ((channels_to_print >= 1 && best_channel == dc) || + (channels_to_print >= 2 && second_best_channel == dc)) + { + inkp = &(sp->upper); + dc->v -= 131070; + sp->dis = et->d_sq; + } + if (inkp->bits) + { + if (!mask || (*(mask + d->ptr_offset) & bit)) + { + set_row_ends(dc, x); + + /* Do the printing */ + print_ink(d, dc->ptr, inkp, bit, length); + } + } + } + } + if (total_error >= comparison) + { + ddc->v -= 131070; + total_error -= 65535; + ssp->dis = et->d_sq; } - } - } - if (total_error >= comparison) { - ddc->v -= 131070; - total_error -= 65535; - ssp->dis = et->d_sq; - } - - eventone_update(ddc, et, x, direction); - diffuse_error(ddc, et, x, direction); - for (i=0; i < channel_count; i++) { - stpi_dither_channel_t *dc = &CHANNEL(d, i); - if (dc->ptr) { - /* Spread the error around to the adjacent dots */ - eventone_update(dc, et, x, direction); - diffuse_error(dc, et, x, direction); - } + eventone_update(ddc, et, x, direction); + diffuse_error(ddc, et, x, direction); + for (i=0; i < channel_count; i++) + { + stpi_dither_channel_t *dc = &CHANNEL(d, i); + if (dc->ptr) + { + /* Spread the error around to the adjacent dots */ + eventone_update(dc, et, x, direction); + diffuse_error(dc, et, x, direction); + } + } + if (direction == 1) + ADVANCE_UNIDIRECTIONAL(d, bit, raw, channel_count, xerror, xstep, xmod); + else + ADVANCE_REVERSE(d, bit, raw, channel_count, xerror, xstep, xmod); } - - - if (direction == 1) - ADVANCE_UNIDIRECTIONAL(d, bit, raw, channel_count, xerror, xstep, xmod); - else - ADVANCE_REVERSE(d, bit, raw, channel_count, xerror, xstep, xmod); - } if (direction == -1) stpi_dither_reverse_row_ends(d); } diff --git a/src/main/dither-impl.h b/src/main/dither-impl.h index e297464..28f9832 100644 --- a/src/main/dither-impl.h +++ b/src/main/dither-impl.h @@ -1,5 +1,5 @@ /* - * "$Id: dither-impl.h,v 1.25.18.1 2007/12/15 20:35:44 rlk Exp $" + * "$Id: dither-impl.h,v 1.32 2008/02/18 14:20:17 rlk Exp $" * * Internal implementation of dither algorithms * @@ -57,7 +57,10 @@ extern "C" { #define D_HYBRID_EVENTONE (D_ORDERED_BASE | D_EVENTONE) #define D_HYBRID_UNITONE (D_ORDERED_BASE | D_UNITONE) #define D_HYBRID_EVENBETTER (D_ORDERED_BASE | D_EVENBETTER) -#define D_PREDITHERED 128 +#define D_PREDITHERED 256 +#define D_ORDERED_NEW 512 +#define D_ORDERED_SEGMENTED 1024 +#define D_ORDERED_SEGMENTED_NEW (D_ORDERED_SEGMENTED | D_ORDERED_NEW) #define D_INVALID -2 #define DITHER_FAST_STEPS (6) @@ -148,7 +151,6 @@ typedef struct dither int x_aspect; /* Aspect ratio numerator */ int y_aspect; /* Aspect ratio denominator */ - double transition; /* Exponential scaling for transition region */ int *offset0_table; int *offset1_table; @@ -163,7 +165,6 @@ typedef struct dither * some things */ stp_dither_matrix_impl_t dither_matrix; - stp_dither_matrix_impl_t transition_matrix; stpi_dither_channel_t *channel; unsigned channel_count; unsigned total_channel_count; @@ -259,5 +260,5 @@ do \ #endif /* GUTENPRINT_INTERNAL_DITHER_IMPL_H */ /* - * End of "$Id: dither-impl.h,v 1.25.18.1 2007/12/15 20:35:44 rlk Exp $". + * End of "$Id: dither-impl.h,v 1.32 2008/02/18 14:20:17 rlk Exp $". */ diff --git a/src/main/dither-inks.c b/src/main/dither-inks.c index f7568e3..d69cf48 100644 --- a/src/main/dither-inks.c +++ b/src/main/dither-inks.c @@ -1,5 +1,5 @@ /* - * "$Id: dither-inks.c,v 1.25 2004/09/17 18:38:18 rleigh Exp $" + * "$Id: dither-inks.c,v 1.26 2008/02/18 14:20:17 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * @@ -114,7 +114,6 @@ initialize_channel(stp_vars_t *v, int channel, int subchannel) assert(idx >= 0); memset(dc, 0, sizeof(stpi_dither_channel_t)); stp_dither_matrix_clone(&(d->dither_matrix), &(dc->dithermat), 0, 0); - stp_dither_matrix_clone(&(d->transition_matrix), &(dc->pick), 0, 0); shade.dot_sizes = ˙ shade.value = 1.0; shade.numsizes = 1; diff --git a/src/main/dither-main.c b/src/main/dither-main.c index 77211c3..b9ba80a 100644 --- a/src/main/dither-main.c +++ b/src/main/dither-main.c @@ -1,5 +1,5 @@ /* - * "$Id: dither-main.c,v 1.52.8.1 2007/12/15 20:35:44 rlk Exp $" + * "$Id: dither-main.c,v 1.59 2008/02/18 14:20:17 rlk Exp $" * * Dither routine entrypoints * @@ -62,10 +62,13 @@ static const stpi_dither_algorithm_t dither_algos[] = #endif { "Adaptive", N_ ("Adaptive Hybrid"), D_ADAPTIVE_HYBRID }, { "Ordered", N_ ("Ordered"), D_ORDERED }, + { "OrderedNew", N_ ("Ordered New"), D_ORDERED_NEW }, { "Fast", N_ ("Fast"), D_FAST }, { "VeryFast", N_ ("Very Fast"), D_VERY_FAST }, { "Floyd", N_ ("Hybrid Floyd-Steinberg"), D_FLOYD_HYBRID }, - { "Predithered", N_ ("Predithered Input"), D_PREDITHERED } + { "Predithered", N_ ("Predithered Input"), D_PREDITHERED }, + { "Segmented", N_ ("Drop Size Segmented"), D_ORDERED_SEGMENTED }, + { "SegmentedNew", N_ ("Drop Size Segmented New"),D_ORDERED_SEGMENTED_NEW } }; static const int num_dither_algos = sizeof(dither_algos)/sizeof(stpi_dither_algorithm_t); @@ -175,6 +178,9 @@ stpi_set_dither_function(stp_vars_t *v) if (color_correction && strcmp(color_correction, "Predithered") == 0) d->stpi_dither_type = D_PREDITHERED; + else if (color_correction && strcmp(color_correction, "Raw") != 0 && + algorithm && strcmp(algorithm, "Segmented") == 0) + d->stpi_dither_type = D_ORDERED; else if (algorithm && strcmp(algorithm, "None") != 0) { for (i = 0; i < num_dither_algos; i++) @@ -255,6 +261,9 @@ stpi_set_dither_function(stp_vars_t *v) case D_VERY_FAST: RETURN_DITHERFUNC(stpi_dither_very_fast, v); case D_ORDERED: + case D_ORDERED_SEGMENTED: + case D_ORDERED_NEW: + case D_ORDERED_SEGMENTED_NEW: case D_FAST: RETURN_DITHERFUNC(stpi_dither_ordered, v); case D_HYBRID_EVENTONE: @@ -323,7 +332,6 @@ stpi_dither_free(void *vd) STP_SAFE_FREE(d->offset0_table); STP_SAFE_FREE(d->offset1_table); stp_dither_matrix_destroy(&(d->dither_matrix)); - stp_dither_matrix_destroy(&(d->transition_matrix)); stp_free(d->channel); stp_free(d->channel_index); stp_free(d->subchannel_count); @@ -356,7 +364,6 @@ stp_dither_init(stp_vars_t *v, stp_image_t *image, int out_width, d->y_aspect = 1; } d->ditherfunc = stpi_set_dither_function(v); - d->transition = 1.0; d->adaptive_limit = .75 * 65535; /* @@ -399,7 +406,6 @@ stp_dither_init(stp_vars_t *v, stp_image_t *image, int out_width, stp_abort(); } } - stp_dither_set_transition(v, 0.7); d->src_width = in_width; d->dst_width = out_width; @@ -467,7 +473,6 @@ stp_dither_internal(stp_vars_t *v, int row, const unsigned short *input, stpi_dither_t *d = (stpi_dither_t *) stp_get_component_data(v, "Dither"); stpi_dither_finalize(v); stp_dither_matrix_set_row(&(d->dither_matrix), row); - stp_dither_matrix_set_row(&(d->transition_matrix), row); for (i = 0; i < CHANNEL_COUNT(d); i++) { CHANNEL(d, i).ptr = CHANNEL(d, i).ptr; diff --git a/src/main/dither-ordered.c b/src/main/dither-ordered.c index a355b41..ca119c1 100644 --- a/src/main/dither-ordered.c +++ b/src/main/dither-ordered.c @@ -1,5 +1,5 @@ /* - * "$Id: dither-ordered.c,v 1.17.18.1 2007/12/15 20:35:44 rlk Exp $" + * "$Id: dither-ordered.c,v 1.28 2008/02/18 14:20:17 rlk Exp $" * * Ordered dither algorithm * @@ -33,6 +33,184 @@ #include <gutenprint/gutenprint-intl-internal.h> #include "dither-impl.h" #include "dither-inlined-functions.h" +#include <assert.h> + + +typedef struct { + size_t channels; + double *drops; + unsigned short *lut; +} stpi_new_ordered_t; + +typedef struct { + unsigned short shift; + unsigned short mask; + unsigned short x_mask; + stpi_new_ordered_t *ord_new; +} stpi_ordered_t; + +static int +compare_channels(const stpi_dither_channel_t *dc1, + const stpi_dither_channel_t *dc2) +{ + int i; + if (dc1->nlevels != dc2->nlevels) + return 0; + for (i = 0; i < dc1->nlevels; i++) + if (dc1->ranges[i].upper->value != dc2->ranges[i].upper->value) + return 0; + return 1; +} + +const static double dp_fraction = 0.5; + +static void +init_dither_channel_new(stpi_dither_channel_t *dc, stp_vars_t *v) +{ + int i, j, k; + double bp = 0; + double lbp = 0; + double lower_bottom = 0; + double lower_middle = 0; + double lower_top = 0; + double upper_bottom = 0; + double upper_middle = 0; + double upper_top = 0; + + double *breakpoints; + double *val; + unsigned short *data; + stpi_new_ordered_t *ord = stp_malloc(sizeof(stpi_new_ordered_t)); + ((stpi_ordered_t *) (dc->aux_data))->ord_new = ord; + ord->channels = dc->nlevels - 1; + ord->drops = stp_malloc(sizeof(double) * (ord->channels + 1)); + breakpoints = stp_malloc(sizeof(double) * (ord->channels + 1)); + val = stp_malloc(sizeof(double) * ord->channels); + data = stp_malloc(sizeof(unsigned short) * 65536 * ord->channels); + ord->lut = data; + for (j = 0; j < ord->channels; j++) + { + stpi_dither_segment_t *dd = &(dc->ranges[j]); + ord->drops[j] = (double) dd->upper->value / 65535.0; + } + ord->drops[ord->channels] = 1; + for (j = 0; j < ord->channels; j++) + { + if (j == 0) + breakpoints[j] = 65535 * ord->drops[j] * dp_fraction; + else + breakpoints[j] = 65535 * ((ord->drops[j] * dp_fraction) + + (ord->drops[j - 1] * (1.0 - dp_fraction))); + stp_dprintf(STP_DBG_INK, v, " size %.3f bp %5.0f\n", + ord->drops[j], breakpoints[j]); + } + breakpoints[ord->channels] = 65535; + j = 0; + for (i = 0; i <= ord->channels; i++) + { + lbp = bp; + bp = breakpoints[i]; + lower_bottom = upper_middle; + upper_bottom = 0; + lower_middle = upper_top; + lower_top = 0; + if (i == ord->channels) + upper_top = 0; + else + upper_top = 65535 * dp_fraction; + if (i > 0) + upper_middle = 65535 - upper_top; + while (j <= bp) + { + double range_point = (j - lbp) / (bp - lbp); + double uv, mv, lv; + int total_ink = 0; + for (k = 0; k < ord->channels; k++) + val[k] = 0; + uv = lower_top + (upper_top - lower_top) * range_point; + mv = lower_middle + (upper_middle - lower_middle) * range_point; + lv = lower_bottom + (upper_bottom - lower_bottom) * range_point; + + if (i < ord->channels) + val[i] = (unsigned short) uv; + if (i > 0) + val[i - 1] = (unsigned short) mv; + if (i > 1) + val[i - 2] = (unsigned short) lv; + for (k = ord->channels - 1; k >= 0; k--) + { + total_ink += val[k]; + if (total_ink > 65535) + total_ink = 65535; + data[k] = total_ink; + } + if ((stp_get_debug_level() & STP_DBG_INK) && (j % 257 == 0)) + { + stp_dprintf(STP_DBG_INK, v, " %5d:", j); + for (k = 0; k < ord->channels; k++) + stp_dprintf(STP_DBG_INK, v, " %9.3f", val[k]); + stp_dprintf(STP_DBG_INK, v, " "); + for (k = 0; k < ord->channels; k++) + stp_dprintf(STP_DBG_INK, v, " %9.3f", breakpoints[k]); + stp_dprintf(STP_DBG_INK, v, " "); + for (k = 0; k < ord->channels; k++) + stp_dprintf(STP_DBG_INK, v, " %5d", data[k]); + stp_dprintf(STP_DBG_INK, v, "\n"); + } + data += ord->channels; + j++; + } + } + stp_free(breakpoints); + stp_free(val); +} + +static inline void +print_color_ordered_new(const stpi_dither_t *d, stpi_dither_channel_t *dc, + int val, int x, int y, unsigned char bit, int length) +{ + int i; + int j; + unsigned bits; + int levels = dc->nlevels - 1; + unsigned dpoint = ditherpoint(d, &(dc->dithermat), x); + const stpi_ordered_t *o = (const stpi_ordered_t *) dc->aux_data; + const stpi_new_ordered_t *ord = (const stpi_new_ordered_t *) o->ord_new; + unsigned short swhere = (unsigned short) val; + unsigned short *where = ord ? ord->lut + (val * levels) : &swhere; + /* + * Look for the appropriate range into which the input value falls. + * Notice that we use the input, not the error, to decide what dot type + * to print (if any). We actually use the "density" input to permit + * the caller to use something other that simply the input value, if it's + * desired to use some function of overall density, rather than just + * this color's input, for this purpose. + */ + for (i = levels - 1; i >= 0; i--) + { + if (dpoint < where[i]) + { + stpi_dither_segment_t *dd = &(dc->ranges[i]); + bits = dd->upper->bits; + if (bits) + { + unsigned char *tptr = dc->ptr + d->ptr_offset; + + /* + * Lay down all of the bits in the pixel. + */ + set_row_ends(dc, x); + for (j = 1; j <= bits; j += j, tptr += length) + { + if (j & bits) + tptr[0] |= bit; + } + + } + return; + } + } +} static inline void print_color_ordered(const stpi_dither_t *d, stpi_dither_channel_t *dc, int val, @@ -90,6 +268,76 @@ print_color_ordered(const stpi_dither_t *d, stpi_dither_channel_t *dc, int val, } } +static void +free_dither_ordered(stpi_dither_t *d) +{ + int i; + stpi_dither_channel_t *dc0 = &CHANNEL(d, 0); + stpi_ordered_t *o0 = dc0->aux_data; + stpi_new_ordered_t *no0; + if (o0) + no0 = o0->ord_new; + for (i = CHANNEL_COUNT(d) - 1; i >= 0 ; i--) + { + stpi_dither_channel_t *dc = &CHANNEL(d, i); + if (dc->aux_data) + { + stpi_ordered_t *ord = (stpi_ordered_t *) dc->aux_data; + if (ord->ord_new && (i == 0 || ord->ord_new != no0)) + { + stpi_new_ordered_t *no = (stpi_new_ordered_t *) ord->ord_new; + if (no->drops) + stp_free(no->drops); + if (no->lut) + stp_free(no->lut); + stp_free(no); + } + stp_free(dc->aux_data); + dc->aux_data = NULL; + } + } + stp_free(d->aux_data); +} + +static void +init_dither_ordered(stpi_dither_t *d, stp_vars_t *v) +{ + int i; + d->aux_data = stp_malloc(1); + d->aux_freefunc = &free_dither_ordered; + stp_dprintf(STP_DBG_INK, v, "init_dither_ordered\n"); + for (i = 0; i < CHANNEL_COUNT(d); i++) + { + stpi_dither_channel_t *dc = &CHANNEL(d, i); + stpi_ordered_t *s; + dc->aux_data = stp_malloc(sizeof(stpi_ordered_t)); + s = (stpi_ordered_t *) dc->aux_data; + s->ord_new = NULL; + if (d->stpi_dither_type & D_ORDERED_SEGMENTED) + { + s->shift = 16 - dc->signif_bits; + s->mask = ((1 << dc->signif_bits) - 1) << s->shift; + s->x_mask = ~(s->mask); + stp_dprintf(STP_DBG_INK, v, " channel %d: shift %d mask 0x%x x_mask 0x%x\n", + i, s->shift, s->mask, s->x_mask); + } + if (d->stpi_dither_type & D_ORDERED_NEW) + { + if (dc->nlevels < 2) + stp_dprintf(STP_DBG_INK, v, " channel %d ignored\n", i); + else if (i == 0 || !compare_channels(&CHANNEL(d, 0), dc)) + { + stp_dprintf(STP_DBG_INK, v, " channel %d\n", i); + init_dither_channel_new(dc, v); + } + else + { + stp_dprintf(STP_DBG_INK, v, " channel %d duplicated from channel 0\n", i); + s->ord_new = ((stpi_ordered_t *) (CHANNEL(d, 0).aux_data))->ord_new; + } + } + } +} void stpi_dither_ordered(stp_vars_t *v, @@ -105,6 +353,7 @@ stpi_dither_ordered(stp_vars_t *v, unsigned char bit; int i; int one_bit_only = 1; + int one_level_only = 1; int xerror, xstep, xmod; @@ -122,9 +371,14 @@ stpi_dither_ordered(stp_vars_t *v, for (i = 0; i < CHANNEL_COUNT(d); i++) { stpi_dither_channel_t *dc = &(CHANNEL(d, i)); + if (dc->nlevels != 1) + one_level_only = 0; if (dc->nlevels != 1 || dc->ranges[0].upper->bits != 1) one_bit_only = 0; } + if (! one_bit_only && ! d->aux_data && + (d->stpi_dither_type & (D_ORDERED_SEGMENTED | D_ORDERED_NEW))) + init_dither_ordered(d, v); if (one_bit_only) { @@ -146,7 +400,51 @@ stpi_dither_ordered(stp_vars_t *v, xerror, xstep, xmod); } } - else + else if (d->stpi_dither_type & D_ORDERED_SEGMENTED) + { + for (x = 0; x < d->dst_width; x ++) + { + if (!mask || (*(mask + d->ptr_offset) & bit)) + { + for (i = 0; i < CHANNEL_COUNT(d); i++) + { + stpi_dither_channel_t *dc = &CHANNEL(d, i); + stpi_ordered_t *s = (stpi_ordered_t *) dc->aux_data; + unsigned short bits = raw[i] >> s->shift; + unsigned short val = raw[i] << dc->signif_bits; + val |= val >> s->shift; + + if (bits) + { + if (val && + val >= ditherpoint(d, &(CHANNEL(d, i).dithermat), x)) + { + int j; + unsigned char *tptr = dc->ptr + d->ptr_offset; + set_row_ends(dc, x); + for (j = 1; j <= bits; j += j, tptr += length) + { + if (j & bits) + tptr[0] |= bit; + } + } + } + else if (CHANNEL(d, i).ptr && val) + { + if (d->stpi_dither_type & D_ORDERED_NEW) + print_color_ordered_new(d, &(CHANNEL(d, i)), val, x, + row, bit, length); + else + print_color_ordered(d, &(CHANNEL(d, i)), val, x, + row, bit, length); + } + } + } + ADVANCE_UNIDIRECTIONAL(d, bit, raw, CHANNEL_COUNT(d), + xerror, xstep, xmod); + } + } + else if (one_level_only || !(d->stpi_dither_type == D_ORDERED_NEW)) { for (x = 0; x != d->dst_width; x ++) { @@ -163,4 +461,21 @@ stpi_dither_ordered(stp_vars_t *v, xstep, xmod); } } + else + { + for (x = 0; x != d->dst_width; x ++) + { + if (!mask || (*(mask + d->ptr_offset) & bit)) + { + for (i = 0; i < CHANNEL_COUNT(d); i++) + { + if (CHANNEL(d, i).ptr && raw[i]) + print_color_ordered_new(d, &(CHANNEL(d, i)), raw[i], x, + row, bit, length); + } + } + ADVANCE_UNIDIRECTIONAL(d, bit, raw, CHANNEL_COUNT(d), xerror, + xstep, xmod); + } + } } diff --git a/src/main/escp2-channels.c b/src/main/escp2-channels.c index 1a8cc5d..1ca2c94 100644 --- a/src/main/escp2-channels.c +++ b/src/main/escp2-channels.c @@ -1,5 +1,5 @@ /* - * "$Id: escp2-channels.c,v 1.62.8.3 2007/12/29 20:42:26 rlk Exp $" + * "$Id: escp2-channels.c,v 1.75 2008/02/27 00:43:37 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -285,380 +285,380 @@ static hue_curve_t picturemate_blue_curve = static const physical_subchannel_t standard_black_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL } + { 0, -1, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(standard_black); static const physical_subchannel_t f360_black_subchannels[] = { - { 0, 0, 1, 0, "BlackDensity", NULL } + { 0, 0, 1, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_black); static const physical_subchannel_t x80_black_subchannels[] = { - { 0, -1, 48, 0, "BlackDensity", NULL } + { 0, -1, 48, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(x80_black); static const physical_subchannel_t c80_black_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL } + { 0, -1, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c80_black); static const physical_subchannel_t c120_black_subchannels[] = { - { 0, 4, 0, 2, "BlackDensity", NULL, { 0, 0x40 } } + { 0, 4, 0, 2, "BlackDensity", NULL, NULL, NULL, { 0, 0x40 } } }; DECLARE_INK_CHANNEL(c120_black); static const physical_subchannel_t c64_black_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL } + { 0, -1, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c64_black); static const physical_subchannel_t standard_cyan_subchannels[] = { - { 2, -1, 0, 0, "CyanDensity", NULL } + { 2, -1, 0, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(standard_cyan); static const physical_subchannel_t f360_standard_cyan_subchannels[] = { - { 2, -1, 1, 0, "CyanDensity", NULL } + { 2, -1, 1, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_standard_cyan); static const physical_subchannel_t r800_cyan_subchannels[] = { - { 2, -1, 1, 0, "CyanDensity", NULL } + { 2, -1, 1, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(r800_cyan); static const physical_subchannel_t picturemate_cyan_subchannels[] = { - { 2, -1, 0, 0, "CyanDensity", NULL } + { 2, -1, 0, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(picturemate_cyan); static const physical_subchannel_t cx3650_standard_cyan_subchannels[] = { - { 2, -1, 2, 0, "CyanDensity", NULL } + { 2, -1, 2, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(cx3650_standard_cyan); static const physical_subchannel_t x80_cyan_subchannels[] = { - { 2, -1, 96, 0, "CyanDensity", NULL } + { 2, -1, 96, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(x80_cyan); static const physical_subchannel_t c80_cyan_subchannels[] = { - { 2, -1, 0, 0, "CyanDensity", NULL } + { 2, -1, 0, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c80_cyan); static const physical_subchannel_t c120_cyan_subchannels[] = { - { 2, -1, 0, 0, "CyanDensity", NULL } + { 2, -1, 0, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c120_cyan); static const physical_subchannel_t c64_cyan_subchannels[] = { - { 2, -1, 0, 0, "CyanDensity", NULL } + { 2, -1, 0, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c64_cyan); static const physical_subchannel_t standard_magenta_subchannels[] = { - { 1, -1, 0, 0, "MagentaDensity", NULL } + { 1, -1, 0, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(standard_magenta); static const physical_subchannel_t r800_magenta_subchannels[] = { - { 1, -1, 0, 0, "MagentaDensity", NULL } + { 1, -1, 0, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(r800_magenta); static const physical_subchannel_t picturemate_magenta_subchannels[] = { - { 1, -1, 0, 0, "MagentaDensity", NULL } + { 1, -1, 0, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(picturemate_magenta); static const physical_subchannel_t f360_standard_magenta_subchannels[] = { - { 1, -1, 1, 0, "MagentaDensity", NULL } + { 1, -1, 1, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_standard_magenta); static const physical_subchannel_t x80_magenta_subchannels[] = { - { 1, -1, 48, 0, "MagentaDensity", NULL } + { 1, -1, 48, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(x80_magenta); static const physical_subchannel_t c80_magenta_subchannels[] = { - { 1, -1, 120, 0, "MagentaDensity", NULL } + { 1, -1, 120, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c80_magenta); static const physical_subchannel_t c120_magenta_subchannels[] = { - { 1, -1, 120, 0, "MagentaDensity", NULL } + { 1, -1, 120, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c120_magenta); static const physical_subchannel_t c64_magenta_subchannels[] = { - { 1, -1, 90, 0, "MagentaDensity", NULL } + { 1, -1, 90, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c64_magenta); static const physical_subchannel_t standard_yellow_subchannels[] = { - { 4, -1, 0, 0, "YellowDensity", NULL } + { 4, -1, 0, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(standard_yellow); static const physical_subchannel_t x80_yellow_subchannels[] = { - { 4, -1, 0, 0, "YellowDensity", NULL } + { 4, -1, 0, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(x80_yellow); static const physical_subchannel_t c80_yellow_subchannels[] = { - { 4, -1, 240, 0, "YellowDensity", NULL } + { 4, -1, 240, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c80_yellow); static const physical_subchannel_t c120_yellow_subchannels[] = { - { 4, -1, 240, 0, "YellowDensity", NULL } + { 4, -1, 240, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c120_yellow); static const physical_subchannel_t c64_yellow_subchannels[] = { - { 4, -1, 180, 0, "YellowDensity", NULL } + { 4, -1, 180, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(c64_yellow); static const physical_subchannel_t f360_standard_yellow_subchannels[] = { - { 4, -1, 1, 0, "YellowDensity", NULL } + { 4, -1, 1, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_standard_yellow); static const physical_subchannel_t r800_yellow_subchannels[] = { - { 4, -1, 1, 0, "YellowDensity", NULL } + { 4, -1, 1, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(r800_yellow); static const physical_subchannel_t picturemate_yellow_subchannels[] = { - { 4, -1, 0, 0, "YellowDensity", NULL } + { 4, -1, 0, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(picturemate_yellow); static const physical_subchannel_t r800_red_subchannels[] = { - { 7, -1, 0, 0, "RedDensity", NULL } + { 7, -1, 0, 0, "RedDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(r800_red); static const physical_subchannel_t picturemate_red_subchannels[] = { - { 7, -1, 0, 0, "RedDensity", NULL } + { 7, -1, 0, 0, "RedDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(picturemate_red); static const physical_subchannel_t r800_blue_subchannels[] = { - { 8, -1, 1, 0, "BlueDensity", NULL } + { 8, -1, 1, 0, "BlueDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(r800_blue); static const physical_subchannel_t picturemate_blue_subchannels[] = { - { 8, -1, 1, 0, "BlueDensity", NULL } + { 8, -1, 1, 0, "BlueDensity", NULL, NULL, NULL } }; DECLARE_EXTENDED_INK_CHANNEL(picturemate_blue); static const physical_subchannel_t standard_gloss_subchannels[] = { - { 9, -1, 0, 0, "GlossDensity", NULL } + { 9, -1, 0, 0, "GlossDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(standard_gloss); static const physical_subchannel_t f360_gloss_subchannels[] = { - { 9, -1, 1, 0, "GlossDensity", NULL } + { 9, -1, 1, 0, "GlossDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_gloss); static const physical_subchannel_t standard_photo_black_subchannels[] = { - { 0, 4, 0, 0, "BlackDensity", NULL } + { 0, 4, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(standard_photo_black); static const physical_subchannel_t f360_photo_black_subchannels[] = { - { 0, 4, 1, 0, "BlackDensity", NULL } + { 0, 4, 1, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_photo_black); static const physical_subchannel_t r800_matte_black_subchannels[] = { - { 0, 0, 0, 0, "BlackDensity", NULL } + { 0, 0, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(r800_matte_black); static const physical_subchannel_t photo_black_subchannels[] = { - { 0, 0, 0, 0, "BlackDensity", NULL } + { 0, 0, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(photo_black); static const physical_subchannel_t extended_black_subchannels[] = { - { 0, 1, 0, 0, "BlackDensity", NULL } + { 0, 1, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(extended_black); static const physical_subchannel_t f360_extended_black_subchannels[] = { - { 0, 1, 1, 0, "BlackDensity", NULL } + { 0, 1, 1, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_extended_black); static const physical_subchannel_t photo_cyan_subchannels[] = { - { 2, 0, 0, 0, "CyanDensity", NULL }, - { 2, 1, 0, 0, "CyanDensity", "LightCyanTransition" } + { 2, 0, 0, 0, "CyanDensity", "LightCyanTransition", NULL, NULL }, + { 2, 1, 0, 0, "CyanDensity", "LightCyanTransition", "LightCyanValue", "LightCyanScale" } }; DECLARE_INK_CHANNEL(photo_cyan); static const physical_subchannel_t extended_cyan_subchannels[] = { - { 2, 1, 0, 0, "CyanDensity", NULL } + { 2, 1, 0, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(extended_cyan); static const physical_subchannel_t f360_extended_cyan_subchannels[] = { - { 2, 1, 1, 0, "CyanDensity", NULL } + { 2, 1, 1, 0, "CyanDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_extended_cyan); static const physical_subchannel_t photo_magenta_subchannels[] = { - { 1, 0, 0, 0, "MagentaDensity", NULL }, - { 1, 1, 0, 0, "MagentaDensity", "LightMagentaTransition" } + { 1, 0, 0, 0, "MagentaDensity", "LightMagentaTransition", NULL, NULL }, + { 1, 1, 0, 0, "MagentaDensity", "LightMagentaTransition", "LightMagentaValue", "LightMagentaScale" } }; DECLARE_INK_CHANNEL(photo_magenta); static const physical_subchannel_t extended_magenta_subchannels[] = { - { 1, 1, 0, 0, "MagentaDensity", NULL } + { 1, 1, 0, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(extended_magenta); static const physical_subchannel_t f360_extended_magenta_subchannels[] = { - { 1, 1, 1, 0, "MagentaDensity", NULL } + { 1, 1, 1, 0, "MagentaDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_extended_magenta); static const physical_subchannel_t photo_yellow_subchannels[] = { - { 4, 0, 0, 0, "YellowDensity", NULL } + { 4, 0, 0, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(photo_yellow); static const physical_subchannel_t f360_photo_yellow_subchannels[] = { - { 4, 0, 1, 0, "YellowDensity", NULL } + { 4, 0, 1, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_photo_yellow); static const physical_subchannel_t j_extended_yellow_subchannels[] = { - { 4, 2, 0, 0, "YellowDensity", NULL } + { 4, 2, 0, 0, "YellowDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(j_extended_yellow); static const physical_subchannel_t extended_photo3_black_subchannels[] = { - { 0, 3, 0, 0, "BlackDensity", NULL } + { 0, 3, 0, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(extended_photo3_black); static const physical_subchannel_t f360_extended_photo3_black_subchannels[] = { - { 0, 3, 1, 0, "BlackDensity", NULL } + { 0, 3, 1, 0, "BlackDensity", NULL, NULL, NULL } }; DECLARE_INK_CHANNEL(f360_extended_photo3_black); @@ -666,200 +666,200 @@ DECLARE_INK_CHANNEL(f360_extended_photo3_black); /* For Japanese 7-color printers, with dark yellow */ static const physical_subchannel_t photo2_yellow_subchannels[] = { - { 4, 2, 0, 0, "YellowDensity", NULL }, - { 4, 0, 0, 0, "YellowDensity", "DarkYellowTransition" } + { 4, 2, 0, 0, "YellowDensity", "DarkYellowTransition", NULL, NULL }, + { 4, 0, 0, 0, "YellowDensity", "DarkYellowTransition", "DarkYellowValue", "DarkYellowScale" } }; DECLARE_INK_CHANNEL(photo2_yellow); static const physical_subchannel_t f360_photo2_yellow_subchannels[] = { - { 4, 2, 0, 0, "YellowDensity", NULL }, - { 4, 0, 1, 0, "YellowDensity", "DarkYellowTransition" } + { 4, 2, 0, 0, "YellowDensity", "DarkYellowTransition", NULL, NULL }, + { 4, 0, 1, 0, "YellowDensity", "DarkYellowTransition", "DarkYellowValue", "DarkYellowScale" } }; DECLARE_INK_CHANNEL(f360_photo2_yellow); static const physical_subchannel_t photo2_black_subchannels[] = { - { 0, 0, 0, 0, "BlackDensity", NULL }, - { 0, 1, 0, 0, "BlackDensity", "GrayTransition" } + { 0, 0, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 0, 1, 0, 0, "BlackDensity", "GrayTransition", "GrayValue", "GrayScale" } }; DECLARE_INK_CHANNEL(photo2_black); static const physical_subchannel_t f360_photo2_black_subchannels[] = { - { 0, 0, 1, 0, "BlackDensity", NULL }, - { 0, 1, 0, 0, "BlackDensity", "GrayTransition" } + { 0, 0, 1, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 0, 1, 0, 0, "BlackDensity", "GrayTransition", "GrayValue", "GrayScale" } }; DECLARE_INK_CHANNEL(f360_photo2_black); static const physical_subchannel_t photo3_black_subchannels[] = { - { 0, 0, 0, 0, "BlackDensity", NULL }, - { 0, 1, 0, 0, "BlackDensity", "DarkGrayTransition" }, - { 0, 3, 0, 0, "BlackDensity", "LightGrayTransition" } + { 0, 0, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 0, 1, 0, 0, "BlackDensity", "GrayTransition", "DarkGrayValue", "DarkGrayScale" }, + { 0, 3, 0, 0, "BlackDensity", "GrayTransition", "LightGrayValue", "LightGrayScale" } }; DECLARE_INK_CHANNEL(photo3_black); static const physical_subchannel_t f360_photo3_black_subchannels[] = { - { 0, 0, 1, 0, "BlackDensity", NULL }, - { 0, 1, 0, 0, "BlackDensity", "DarkGrayTransition" }, - { 0, 3, 1, 0, "BlackDensity", "LightGrayTransition" } + { 0, 0, 1, 0, "BlackDensity", NULL, NULL, NULL }, + { 0, 1, 0, 0, "BlackDensity", "DarkGrayTransition", "DarkGrayValue", "DarkGrayScale" }, + { 0, 3, 1, 0, "BlackDensity", "LightGrayTransition", "LightGrayValue", "LightGrayScale" } }; DECLARE_INK_CHANNEL(f360_photo3_black); static const physical_subchannel_t quadtone_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL }, - { 2, -1, 0, 0, "BlackDensity", "Gray3Transition" }, - { 1, -1, 0, 0, "BlackDensity", "Gray2Transition" }, - { 4, -1, 0, 0, "BlackDensity", "Gray1Transition" }, + { 0, -1, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 2, -1, 0, 0, "BlackDensity", "GrayTransition", "Gray3Value", "Gray3Scale" }, + { 1, -1, 0, 0, "BlackDensity", "GrayTransition", "Gray2Value", "Gray2Scale" }, + { 4, -1, 0, 0, "BlackDensity", "GrayTransition", "Gray1Value", "Gray1Scale" }, }; DECLARE_INK_CHANNEL(quadtone); static const physical_subchannel_t c80_quadtone_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL }, - { 2, -1, 0, 0, "BlackDensity", "Gray3Transition" }, - { 1, -1, 120, 0, "BlackDensity", "Gray2Transition" }, - { 4, -1, 240, 0, "BlackDensity", "Gray1Transition" }, + { 0, -1, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 2, -1, 0, 0, "BlackDensity", "GrayTransition", "Gray3Value", "Gray3Scale" }, + { 1, -1, 120, 0, "BlackDensity", "GrayTransition", "Gray2Value", "Gray2Scale" }, + { 4, -1, 240, 0, "BlackDensity", "GrayTransition", "Gray1Value", "Gray1Scale" }, }; DECLARE_INK_CHANNEL(c80_quadtone); static const physical_subchannel_t c120_quadtone_subchannels[] = { - { 0, 4, 0, 0, "BlackDensity", NULL }, - { 2, -1, 0, 0, "BlackDensity", "Gray3Transition" }, - { 1, -1, 120, 0, "BlackDensity", "Gray2Transition" }, - { 4, -1, 240, 0, "BlackDensity", "Gray1Transition" }, + { 0, 4, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 2, -1, 0, 0, "BlackDensity", "GrayTransition", "Gray3Value", "Gray3Scale" }, + { 1, -1, 120, 0, "BlackDensity", "GrayTransition", "Gray2Value", "Gray2Scale" }, + { 4, -1, 240, 0, "BlackDensity", "GrayTransition", "Gray1Value", "Gray1Scale" }, }; DECLARE_INK_CHANNEL(c120_quadtone); static const physical_subchannel_t c64_quadtone_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL }, - { 2, -1, 0, 0, "BlackDensity", "Gray3Transition" }, - { 1, -1, 90, 0, "BlackDensity", "Gray2Transition" }, - { 4, -1, 180, 0, "BlackDensity", "Gray1Transition" }, + { 0, -1, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 2, -1, 0, 0, "BlackDensity", "Gray3Transition", "Gray3Value", "Gray3Scale" }, + { 1, -1, 90, 0, "BlackDensity", "Gray2Transition", "Gray2Value", "Gray2Scale" }, + { 4, -1, 180, 0, "BlackDensity", "Gray1Transition", "Gray1Value", "Gray1Scale" }, }; DECLARE_INK_CHANNEL(c64_quadtone); static const physical_subchannel_t f360_quadtone_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL }, - { 2, -1, 1, 0, "BlackDensity", "Gray3Transition" }, - { 1, -1, 1, 0, "BlackDensity", "Gray2Transition" }, - { 4, -1, 0, 0, "BlackDensity", "Gray1Transition" }, + { 0, -1, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 2, -1, 1, 0, "BlackDensity", "GrayTransition", "Gray3Value", "Gray3Scale" }, + { 1, -1, 1, 0, "BlackDensity", "GrayTransition", "Gray2Value", "Gray2Scale" }, + { 4, -1, 0, 0, "BlackDensity", "GrayTransition", "Gray1Value", "Gray1Scale" }, }; DECLARE_INK_CHANNEL(f360_quadtone); static const physical_subchannel_t cx3650_quadtone_subchannels[] = { - { 0, -1, 0, 0, "BlackDensity", NULL }, - { 2, -1, 2, 0, "BlackDensity", "Gray3Transition" }, - { 1, -1, 1, 0, "BlackDensity", "Gray2Transition" }, - { 4, -1, 0, 0, "BlackDensity", "Gray1Transition" }, + { 0, -1, 0, 0, "BlackDensity", "GrayTransition", NULL, NULL }, + { 2, -1, 2, 0, "BlackDensity", "GrayTransition", "Gray3Value", "Gray3Scale" }, + { 1, -1, 1, 0, "BlackDensity", "GrayTransition", "Gray2Value", "Gray2Scale" }, + { 4, -1, 0, 0, "BlackDensity", "GrayTransition", "Gray1Value", "Gray1Scale" }, }; DECLARE_INK_CHANNEL(cx3650_quadtone); static const physical_subchannel_t f360_photo_cyan_subchannels[] = { - { 2, 0, 1, 0, "CyanDensity", NULL }, - { 2, 1, 0, 0, "CyanDensity", "LightCyanTransition" } + { 2, 0, 1, 0, "CyanDensity", "LightCyanTransition", NULL, NULL }, + { 2, 1, 0, 0, "CyanDensity", "LightCyanTransition", "LightCyanValue", "LightCyanScale" } }; DECLARE_INK_CHANNEL(f360_photo_cyan); static const physical_subchannel_t f360x_photo_cyan_subchannels[] = { - { 2, 0, 0, 0, "CyanDensity", NULL }, - { 2, 1, 1, 0, "CyanDensity", "LightCyanTransition" } + { 2, 0, 0, 0, "CyanDensity", "LightCyanTransition", NULL, NULL }, + { 2, 1, 1, 0, "CyanDensity", "LightCyanTransition", "LightCyanValue", "LightCyanScale" } }; DECLARE_INK_CHANNEL(f360x_photo_cyan); static const physical_subchannel_t f360_photo_magenta_subchannels[] = { - { 1, 0, 1, 0, "MagentaDensity", NULL }, - { 1, 1, 0, 0, "MagentaDensity", "LightMagentaTransition" } + { 1, 0, 1, 0, "MagentaDensity", "LightMagentaTransition", NULL, NULL }, + { 1, 1, 0, 0, "MagentaDensity", "LightMagentaTransition", "LightMagentaValue", "LightMagentaScale" } }; DECLARE_INK_CHANNEL(f360_photo_magenta); static const physical_subchannel_t f360x_photo_magenta_subchannels[] = { - { 1, 0, 0, 0, "MagentaDensity", NULL }, - { 1, 1, 1, 0, "MagentaDensity", "LightMagentaTransition" } + { 1, 0, 0, 0, "MagentaDensity", "LightMagentaTransition", NULL, NULL }, + { 1, 1, 1, 0, "MagentaDensity", "LightMagentaTransition", "LightMagentaValue", "LightMagentaScale" } }; DECLARE_INK_CHANNEL(f360x_photo_magenta); static const physical_subchannel_t claria_black_subchannels[] = { - { 0, 0, 0, 0, "BlackDensity", NULL }, + { 0, 0, 0, 0, "BlackDensity", NULL, NULL, NULL }, }; DECLARE_INK_CHANNEL(claria_black); static const physical_subchannel_t claria_yellow_subchannels[] = { - { 4, 0, 2, 0, "YellowDensity", NULL }, + { 4, 0, 2, 0, "YellowDensity", NULL, NULL, NULL }, }; DECLARE_INK_CHANNEL(claria_yellow); static const physical_subchannel_t claria_cyan_subchannels[] = { - { 2, 0, 0, 0, "CyanDensity", NULL }, + { 2, 0, 0, 0, "CyanDensity", NULL, NULL, NULL }, }; DECLARE_INK_CHANNEL(claria_cyan); static const physical_subchannel_t claria_photo_cyan_subchannels[] = { - { 2, 0, 0, 0, "CyanDensity", NULL }, - { 2, 1, 2, 0, "CyanDensity", "LightCyanTransition" }, + { 2, 0, 0, 0, "CyanDensity", "LightCyanTransition", NULL, NULL }, + { 2, 1, 2, 0, "CyanDensity", "LightCyanTransition", "LightCyanValue", "LightCyanScale" }, }; DECLARE_INK_CHANNEL(claria_photo_cyan); static const physical_subchannel_t extended_claria_cyan_subchannels[] = { - { 2, 1, 2, 0, "CyanDensity", "LightCyanTransition" }, + { 2, 1, 2, 0, "CyanDensity", NULL, NULL, NULL }, }; DECLARE_INK_CHANNEL(extended_claria_cyan); static const physical_subchannel_t claria_magenta_subchannels[] = { - { 1, 0, 2, 0, "MagentaDensity", NULL }, + { 1, 0, 2, 0, "MagentaDensity", NULL, NULL, NULL }, }; DECLARE_INK_CHANNEL(claria_magenta); static const physical_subchannel_t claria_photo_magenta_subchannels[] = { - { 1, 0, 2, 0, "MagentaDensity", NULL }, - { 1, 1, 0, 0, "MagentaDensity", "LightMagentaTransition" }, + { 1, 0, 2, 0, "MagentaDensity", "LightMagentaTransition", NULL, NULL }, + { 1, 1, 0, 0, "MagentaDensity", "LightMagentaTransition", "LightMagentaValue", "LightMagentaScale" }, }; DECLARE_INK_CHANNEL(claria_photo_magenta); static const physical_subchannel_t extended_claria_magenta_subchannels[] = { - { 1, 1, 0, 0, "MagentaDensity", "LightMagentaTransition" }, + { 1, 1, 0, 0, "MagentaDensity", NULL, NULL, NULL }, }; DECLARE_INK_CHANNEL(extended_claria_magenta); @@ -1453,6 +1453,20 @@ static const escp2_inkname_t claria_four_color_standard_inkset = &claria_cmyk_channel_set }; +static const ink_channel_t *const four_color_picturemate_channels[] = +{ + &photo_black_channel, &picturemate_cyan_channel, + &picturemate_magenta_channel, &picturemate_yellow_channel +}; + +DECLARE_CHANNEL_SET(four_color_picturemate); + +static const escp2_inkname_t four_color_picturemate_inkset = +{ + "CMYK", N_("Four Color Photo"), INKSET_CMYK, + &four_color_picturemate_channel_set +}; + /* **************************************************************** @@ -2116,6 +2130,12 @@ static const escp2_inkname_t claria_four_color_extended_inkset = &claria_cmyk_channel_set }; +static const escp2_inkname_t four_color_picturemate_extended_inkset = +{ + "PhysicalCMYK", N_("Four Color Raw"), INKSET_EXTENDED, + &four_color_picturemate_channel_set +}; + static const escp2_inkname_t four_color_r800_extended_inkset = { "PhysicalCMYKGloss", N_("Four Color Raw"), INKSET_EXTENDED, @@ -2795,14 +2815,25 @@ static const escp2_inkname_t *const cmykrb_photo_ink_types[] = DECLARE_INKLIST("cmykrbphoto", cmykrb_photo, cmykrb_photo, N_("Photo Black"), r800, r800_photo, standard); -static const escp2_inkname_t *const picturemate_photo_ink_types[] = +static const escp2_inkname_t *const picturemate_6_photo_ink_types[] = { &six_color_picturemate_inkset, + &four_color_picturemate_inkset, &six_color_picturemate_extended_inkset, + &four_color_picturemate_extended_inkset, +}; + +DECLARE_INKLIST("picturemate_6", picturemate_6, picturemate_6_photo, + N_("Standard"), picturemate, picturemate_6, standard); + +static const escp2_inkname_t *const picturemate_4_photo_ink_types[] = +{ + &four_color_picturemate_inkset, + &four_color_picturemate_extended_inkset, }; -DECLARE_INKLIST("picturemate", picturemate, picturemate_photo, - N_("Standard"), picturemate, picturemate, standard); +DECLARE_INKLIST("picturemate_4", picturemate_4, picturemate_4_photo, + N_("Standard"), picturemate, picturemate_4, standard); #define DECLARE_INKGROUP(name) \ @@ -2968,12 +2999,19 @@ static const inklist_t *const cmykrb_group[] = DECLARE_INKGROUP(cmykrb); -static const inklist_t *const picturemate_group[] = +static const inklist_t *const picturemate_4_group[] = { - &picturemate_inklist, + &picturemate_4_inklist, }; -DECLARE_INKGROUP(picturemate); +DECLARE_INKGROUP(picturemate_4); + +static const inklist_t *const picturemate_6_group[] = +{ + &picturemate_6_inklist, +}; + +DECLARE_INKGROUP(picturemate_6); static const inklist_t *const claria_group[] = { @@ -3010,7 +3048,8 @@ static const ink_t the_inks[] = { "f360_ultrachrome", &f360_ultrachrome_inkgroup }, { "f360_ultrachrome_k3", &f360_ultrachrome_k3_inkgroup }, { "cmykrb", &cmykrb_inkgroup }, - { "picturemate", &picturemate_inkgroup }, + { "picturemate_6", &picturemate_6_inkgroup }, + { "picturemate_4", &picturemate_4_inkgroup }, { "claria", &claria_inkgroup }, }; @@ -3172,7 +3211,7 @@ static const char *r800_channel_names[] = DECLARE_CHANNEL_LIST(r800); -static const char *picturemate_channel_names[] = +static const char *picturemate_6_channel_names[] = { N_("Yellow"), N_("Magenta"), @@ -3182,7 +3221,17 @@ static const char *picturemate_channel_names[] = N_("Blue"), }; -DECLARE_CHANNEL_LIST(picturemate); +DECLARE_CHANNEL_LIST(picturemate_6); + +static const char *picturemate_4_channel_names[] = +{ + N_("Yellow"), + N_("Magenta"), + N_("Cyan"), + N_("Black"), +}; + +DECLARE_CHANNEL_LIST(picturemate_4); static const char *r2400_channel_names[] = { @@ -3209,7 +3258,8 @@ static const channel_t the_channels[] = { "cx3800", &cx3800_channel_name_list }, { "mfp2005", &mfp2005_channel_name_list }, { "photo", &photo_channel_name_list }, - { "picturemate", &picturemate_channel_name_list }, + { "picturemate_6", &picturemate_6_channel_name_list }, + { "picturemate_4", &picturemate_4_channel_name_list }, { "pm_950c", &pm_950c_channel_name_list }, { "r2400", &r2400_channel_name_list }, { "sp1400", &sp1400_channel_name_list }, diff --git a/src/main/escp2-driver.c b/src/main/escp2-driver.c index 4e0ecbd..af8e005 100644 --- a/src/main/escp2-driver.c +++ b/src/main/escp2-driver.c @@ -1,5 +1,5 @@ /* - * "$Id: escp2-driver.c,v 1.30.6.3 2007/12/30 05:37:55 rlk Exp $" + * "$Id: escp2-driver.c,v 1.38 2007/12/30 05:38:44 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * diff --git a/src/main/escp2-inks.c b/src/main/escp2-inks.c index e3d93a6..b772744 100644 --- a/src/main/escp2-inks.c +++ b/src/main/escp2-inks.c @@ -1,5 +1,5 @@ /* - * "$Id: escp2-inks.c,v 1.46.10.3 2007/12/29 20:42:26 rlk Exp $" + * "$Id: escp2-inks.c,v 1.62 2008/02/03 03:41:43 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -152,21 +152,21 @@ static const escp2_dropsize_t escp2_r300_2880_1440_dropsizes = * and 0x25. The economy settings (0x10 and 0x0) don't provide any * bigger drops. We get quite smooth output at 720x360 and 360 DPI, and * even 360x180 is surprisingly smooth. - * Roy Harrington estimates the drop sizes are: + * Roy Harrington's estimates in first column; my remeasurements in second: * - * 1 1.5 pl - * 2 2.4 pl - * 3 6.3 pl - * 4 12 pl (rlk estimate) - * 5 21 pl + * 1 1.5 pl 1.5 pl + * 2 2.4 pl 1.8 pl + * 3 6.3 pl 4.5 pl + * 4 12 pl (rlk estimate) 8.0 pl + * 5 21 pl 11 pl (+/- 1 pl) */ static const escp2_dropsize_t escp2_claria_720_dropsizes = - { "claria_720", 3, { 0.071, 0.3, 1.0 } }; + { "claria_720", 3, { 0.125, 0.42, 1.0 } }; static const escp2_dropsize_t escp2_claria_1440_dropsizes = - { "claria_1440", 3, { 0.23, 0.37, 1.0 } }; + { "claria_1440", 3, { 0.338, 0.40, 1.0 } }; static const escp2_dropsize_t escp2_claria_2880_dropsizes = - { "claria_2880", 2, { 0.62, 1.0 } }; + { "claria_2880", 2, { 0.833, 1.0 } }; static const escp2_dropsize_t escp2_claria_5760_dropsizes = { "claria_5760", 1, { 1.0 } }; @@ -183,13 +183,13 @@ static const escp2_dropsize_t escp2_claria_5760_dropsizes = */ static const escp2_dropsize_t escp2_claria_1400_720_dropsizes = - { "claria_1400_720", 3, { 0.3, 0.57, 1.0 } }; + { "claria_1400_720", 3, { 0.42, 0.67, 1.0 } }; static const escp2_dropsize_t escp2_claria_1400_1440_720_dropsizes = - { "claria_1400_1440_720", 3, { 0.071, 0.3, 1.0 } }; + { "claria_1400_1440_720", 3, { 0.125, 0.42, 1.0 } }; static const escp2_dropsize_t escp2_claria_1400_1440_dropsizes = - { "claria_1400_1440", 3, { 0.23, 0.37, 1.0 } }; + { "claria_1400_1440", 3, { 0.338, 0.40, 1.0 } }; static const escp2_dropsize_t escp2_claria_1400_2880_dropsizes = - { "claria_1400_2880", 2, { 0.62, 1.0 } }; + { "claria_1400_2880", 2, { 0.833, 1.0 } }; static const escp2_dropsize_t escp2_claria_1400_5760_dropsizes = { "claria_1400_5760", 1, { 1.0 } }; @@ -376,7 +376,7 @@ static const escp2_drop_list_t claria_drops = &escp2_claria_720_dropsizes, &escp2_claria_720_dropsizes, &escp2_claria_720_dropsizes, - &escp2_claria_1440_dropsizes, + &escp2_claria_720_dropsizes, &escp2_claria_1440_dropsizes, &escp2_claria_2880_dropsizes, &escp2_claria_5760_dropsizes, @@ -389,7 +389,7 @@ static const escp2_drop_list_t claria_1400_drops = &escp2_claria_1400_720_dropsizes, &escp2_claria_1400_720_dropsizes, &escp2_claria_1400_1440_720_dropsizes, - &escp2_claria_1400_1440_dropsizes, + &escp2_claria_1400_1440_720_dropsizes, &escp2_claria_1400_1440_dropsizes, &escp2_claria_1400_2880_dropsizes, &escp2_claria_1400_5760_dropsizes, diff --git a/src/main/escp2-papers.c b/src/main/escp2-papers.c index 1cdc837..42a9fe5 100644 --- a/src/main/escp2-papers.c +++ b/src/main/escp2-papers.c @@ -1,5 +1,5 @@ /* - * "$Id: escp2-papers.c,v 1.99.8.3 2007/12/29 20:42:26 rlk Exp $" + * "$Id: escp2-papers.c,v 1.108 2008/02/27 00:43:37 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -1194,7 +1194,7 @@ static const paper_adjustment_t r800_matte_adjustments[] = DECLARE_PAPER_ADJUSTMENTS(r800_matte); -static const paper_adjustment_t picturemate_adjustments[] = +static const paper_adjustment_t picturemate_6_adjustments[] = { { "GlossyPhoto", 1.00, 1, 1, .02, 2.0, .882, 1, .250, 1, 1, 0.92, r800_glossy_hue_adj, r800_glossy_lum_adj, r800_glossy_sat_adj }, @@ -1202,7 +1202,17 @@ static const paper_adjustment_t picturemate_adjustments[] = r800_glossy_hue_adj, r800_glossy_lum_adj, r800_glossy_sat_adj }, }; -DECLARE_PAPER_ADJUSTMENTS(picturemate); +DECLARE_PAPER_ADJUSTMENTS(picturemate_6); + +static const paper_adjustment_t picturemate_4_adjustments[] = +{ + { "GlossyPhoto", 1.00, 1, 1, .02, 2.0, .882, 1, .250, 1, 1, 0.92, + r800_glossy_hue_adj, r800_glossy_lum_adj, r800_glossy_sat_adj }, + { "Other", 0.878, .1, 1, .02, 2.0, .882, 1, .250, 1, 1, 1.0, + r800_glossy_hue_adj, r800_glossy_lum_adj, r800_glossy_sat_adj }, +}; + +DECLARE_PAPER_ADJUSTMENTS(picturemate_4); static const paper_adjustment_t durabrite_adjustments[] = { @@ -1674,7 +1684,8 @@ static const paperadj_t the_adjustments[] = { "ultrachrome_k3_matte", &ultrachrome_k3_matte_paper_adjustment_list }, { "r800_photo", &r800_photo_paper_adjustment_list }, { "r800_matte", &r800_matte_paper_adjustment_list }, - { "picturemate", &picturemate_paper_adjustment_list }, + { "picturemate_4", &picturemate_4_paper_adjustment_list }, + { "picturemate_6", &picturemate_6_paper_adjustment_list }, { "claria", &claria_paper_adjustment_list }, }; diff --git a/src/main/escp2-resolutions.c b/src/main/escp2-resolutions.c index 17a480a..76d8313 100644 --- a/src/main/escp2-resolutions.c +++ b/src/main/escp2-resolutions.c @@ -1,5 +1,5 @@ /* - * "$Id: escp2-resolutions.c,v 1.33.8.3 2007/12/15 20:35:44 rlk Exp $" + * "$Id: escp2-resolutions.c,v 1.44 2008/02/24 04:08:05 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -647,6 +647,21 @@ static const quality_t standard_qualities[] = DECLARE_QUALITY_LIST(standard); +static const quality_t v2880_qualities[] = +{ + { "FastEconomy", N_("Fast Economy"), 180, 90, 360, 120, 360, 90 }, + { "Economy", N_("Economy"), 360, 180, 360, 240, 360, 180 }, + { "Draft", N_("Draft"), 360, 360, 360, 360, 360, 360 }, + { "Standard", N_("Standard"), 0, 0, 0, 0, 720, 360 }, + { "High", N_("High"), 0, 0, 0, 0, 720, 720 }, + { "Photo", N_("Photo"), 1440, 720, 2880, 720, 1440, 720 }, + { "HighPhoto", N_("Super Photo"), 1440, 1440, 2880, 1440, 1440, 1440 }, + { "UltraPhoto", N_("Ultra Photo"), 2880, 2880, 2880, 2880, 2880, 2880 }, + { "Best", N_("Best"), 720, 360, 0, 0, -1, -1 }, +}; + +DECLARE_QUALITY_LIST(v2880); + static const quality_t p1_5_qualities[] = { { "FastEconomy", N_("Fast Economy"), 180, 90, 360, 120, 360, 90 }, @@ -686,6 +701,7 @@ static const qual_t the_qualities[] = { "standard", &standard_quality_list }, { "p1_5", &p1_5_quality_list }, { "picturemate", &picturemate_quality_list }, + { "v2880", &v2880_quality_list }, }; const quality_list_t * diff --git a/src/main/module.c b/src/main/module.c index f2fdfe6..83d9037 100644 --- a/src/main/module.c +++ b/src/main/module.c @@ -1,5 +1,5 @@ /* - * "$Id: module.c,v 1.25 2004/09/17 18:38:21 rleigh Exp $" + * "$Id: module.c,v 1.26 2006/09/28 15:40:05 m0m Exp $" * * Gutenprint module loader - load modules with libltdl/libdl. * @@ -62,7 +62,7 @@ extern stp_module_t print_escp2_LTX_stp_module_data; extern stp_module_t print_lexmark_LTX_stp_module_data; extern stp_module_t print_pcl_LTX_stp_module_data; extern stp_module_t print_ps_LTX_stp_module_data; -extern stp_module_t print_olympus_LTX_stp_module_data; +extern stp_module_t print_dyesub_LTX_stp_module_data; extern stp_module_t print_raw_LTX_stp_module_data; extern stp_module_t color_traditional_LTX_stp_module_data; @@ -76,7 +76,7 @@ static stp_module_t *static_modules[] = &print_escp2_LTX_stp_module_data, &print_pcl_LTX_stp_module_data, &print_lexmark_LTX_stp_module_data, - &print_olympus_LTX_stp_module_data, + &print_dyesub_LTX_stp_module_data, &print_raw_LTX_stp_module_data, &color_traditional_LTX_stp_module_data, NULL diff --git a/src/main/papers.xml b/src/main/papers.xml index 97b6a40..6aff8fe 100644 --- a/src/main/papers.xml +++ b/src/main/papers.xml @@ -4,7 +4,7 @@ XML description of papers known to libgutenprint. It should be edited by hand. - "$Id: papers.xml,v 1.21.8.2 2007/12/15 20:35:44 rlk Exp $" + "$Id: papers.xml,v 1.28 2008/04/15 00:08:20 rlk Exp $" --> <!-- @@ -81,6 +81,12 @@ <height value="360"/> <unit value="english-extended"/> </paper> + <paper name="w252h360"> + <description value="3 1/2 x5"/> + <width value="252"/> + <height value="360"/> + <unit value="english-extended"/> + </paper> <paper name="w288h432"> <description value="4x6"/> <width value="288"/> @@ -581,6 +587,15 @@ <width value="2599"/> <height value="3676"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C0_l"> + <description value="C0 landscape"/> + <comment value="917mm x 1297mm landscape"/> + <width value="3676"/> + <height value="2599"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C1"> <description value="C1"/> @@ -588,6 +603,15 @@ <width value="1836"/> <height value="2599"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C1_l"> + <description value="C1 landscape"/> + <comment value="648mm x 917mm landscape"/> + <width value="2599"/> + <height value="1836"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C2"> <description value="C2"/> @@ -595,6 +619,15 @@ <width value="1298"/> <height value="1836"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C2_l"> + <description value="C2 landscape"/> + <comment value="458mm x 648mm landscape"/> + <width value="1836"/> + <height value="1298"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C3"> <description value="C3"/> @@ -602,6 +635,15 @@ <width value="918"/> <height value="1298"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C3_l"> + <description value="C3 landscape"/> + <comment value="324mm x 458mm landscape"/> + <width value="1298"/> + <height value="918"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C4"> <description value="C4"/> @@ -609,6 +651,15 @@ <width value="649"/> <height value="918"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C4_l"> + <description value="C4 landscape"/> + <comment value="229mm x 324mm landscape"/> + <width value="918"/> + <height value="649"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C5"> <description value="C5"/> @@ -616,6 +667,15 @@ <width value="459"/> <height value="649"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C5_l"> + <description value="C5 landscape"/> + <comment value="162mm x 229mm landscape"/> + <width value="649"/> + <height value="459"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="w354h918"> <description value="B6-C4"/> @@ -623,6 +683,15 @@ <width value="354"/> <height value="918"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="w354h918_l"> + <description value="B6-C4 landscape"/> + <comment value="125mm x 324mm landscape"/> + <width value="918"/> + <height value="354"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C6"> <description value="C6"/> @@ -630,6 +699,15 @@ <width value="323"/> <height value="459"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C6_l"> + <description value="C6 landscape"/> + <comment value="114mm x 162mm landscape"/> + <width value="459"/> + <height value="323"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="DL"> <description value="DL"/> @@ -637,6 +715,15 @@ <width value="311"/> <height value="623"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="DL_l"> + <description value="DL landscape"/> + <comment value="110mm x 220mm landscape"/> + <width value="623"/> + <height value="311"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="w229h459"> <description value="C7-6"/> @@ -644,6 +731,15 @@ <width value="229"/> <height value="459"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="w229h459_l"> + <description value="C7-6 landscape"/> + <comment value="81mm x 162mm landscape"/> + <width value="459"/> + <height value="229"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C7"> <description value="C7"/> @@ -651,6 +747,15 @@ <width value="229"/> <height value="323"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C7_l"> + <description value="C7 landscape"/> + <comment value="81mm x 114mm landscape"/> + <width value="323"/> + <height value="229"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C8"> <description value="C8"/> @@ -658,6 +763,15 @@ <width value="161"/> <height value="229"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C8_l"> + <description value="C8 landscape"/> + <comment value="57mm x 81mm landscape"/> + <width value="229"/> + <height value="161"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C9"> <description value="C9"/> @@ -665,6 +779,15 @@ <width value="113"/> <height value="161"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C9_l"> + <description value="C9 landscape"/> + <comment value="40mm x 57mm landscape"/> + <width value="161"/> + <height value="113"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="C10"> <description value="C10"/> @@ -672,6 +795,15 @@ <width value="79"/> <height value="113"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="C10_l"> + <description value="C10 landscape"/> + <comment value="28mm x 40mm landscape"/> + <width value="113"/> + <height value="79"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <!-- GROUP: US CAD --> <!-- @@ -894,18 +1026,42 @@ <width value="340"/> <height value="666"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="w340h666_l"> + <description value="Japanese long envelope #3 landscape"/> + <width value="666"/> + <height value="340"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="w255h581"> <description value="Japanese long envelope #4"/> <width value="255"/> <height value="581"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="w255h581_l"> + <description value="Japanese long envelope #4 landscape"/> + <width value="581"/> + <height value="255"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="w680h941"> <description value="Japanese Kaku envelope #4"/> <width value="680"/> <height value="941"/> <unit value="metric-extended"/> + <type value="envelope"/> + </paper> + <paper name="w680h941_l"> + <description value="Japanese Kaku envelope #4 landscape"/> + <width value="941"/> + <height value="680"/> + <unit value="metric-extended"/> + <type value="envelope"/> </paper> <paper name="COM10"> <description value="Commercial 10"/> @@ -913,6 +1069,15 @@ <width value="297"/> <height value="684"/> <unit value="english-extended"/> + <type value="envelope"/> + </paper> + <paper name="COM10_l"> + <description value="Commercial 10 landscape"/> + <comment value="US Commercial 10 env landscape"/> + <width value="684"/> + <height value="297"/> + <unit value="english-extended"/> + <type value="envelope"/> </paper> <paper name="w315h414"> <description value="A2 Invitation"/> @@ -927,6 +1092,15 @@ <width value="279"/> <height value="540"/> <unit value="english-extended"/> + <type value="envelope"/> + </paper> + <paper name="Monarch_l"> + <description value="Monarch Envelope landscape"/> + <comment value="3.875in x 7.5in landscape"/> + <width value="540"/> + <height value="279"/> + <unit value="english-extended"/> + <type value="envelope"/> </paper> <paper name="w288h387"> <description value="4x5 3/8"/> @@ -949,7 +1123,7 @@ </paper> <paper name="w155h244"> <description value="Card"/> - <comment value="86mm x 54mm"/> + <comment value="54mm x 86mm"/> <width value="155"/> <height value="244"/> <unit value="metric-extended"/> diff --git a/src/main/print-canon.c b/src/main/print-canon.c index 5df9c9f..9a2080d 100644 --- a/src/main/print-canon.c +++ b/src/main/print-canon.c @@ -1,5 +1,5 @@ /* - * "$Id: print-canon.c,v 1.190.2.5 2007/12/29 20:42:27 rlk Exp $" + * "$Id: print-canon.c,v 1.226 2008/04/20 13:39:16 faust3 Exp $" * * Print plug-in CANON BJL driver for the GIMP. * @@ -1579,6 +1579,8 @@ static int canon_setup_channel(stp_vars_t *v,canon_privdata_t* privdata,int chan /* setup the dither channels */ static void canon_setup_channels(stp_vars_t *v,canon_privdata_t* privdata){ + /* (in gutenprint notation) => KCMY, 1230 => CMYK etc. */ + const char default_channel_order[STP_NCOLORS] = {0,1,2,3}; /* codes for the primary channels */ const char primary[STP_NCOLORS] = {'K','C','M','Y',}; /* codes for the subchannels */ @@ -1588,15 +1590,23 @@ static void canon_setup_channels(stp_vars_t *v,canon_privdata_t* privdata){ const char *secondary_density_control[STP_NCOLORS] = {NULL,"LightCyanTransition","LightMagentaTransition","LightYellowTransition"}; /* ink darkness for every channel */ const double ink_darkness[] = {1.0, 0.31 / .5, 0.61 / .97, 0.08}; + const char* channel_order = default_channel_order; + + int channel; + int channel_idx; + + if(privdata->caps->channel_order) + channel_order = privdata->caps->channel_order; /* loop through the dither channels */ - for(channel=0; channel < STP_NCOLORS ; channel++){ + for(channel_idx = 0; channel_idx < STP_NCOLORS ; channel_idx++){ int i; unsigned int subchannel = 0; stp_shade_t* shades = NULL; + channel = channel_order[channel_idx]; if(channel == STP_ECOLOR_K && privdata->used_inks & CANON_INK_K_MASK){ /* black channel */ /* find K and k inks */ for(i=0;i<privdata->mode->num_inks;i++){ @@ -2114,6 +2124,11 @@ canon_do_print(stp_vars_t *v, stp_image_t *image) canon_deinit_printer(v, &privdata); + /* canon_end_job does not get called for jobmode automatically */ + if(!stp_get_string_parameter(v, "JobMode") || + strcmp(stp_get_string_parameter(v, "JobMode"), "Page") == 0){ + canon_end_job(v,image); + } for(i=0;i< privdata.num_channels;i++) if(privdata.channels[i].buf) diff --git a/src/main/print-color.c b/src/main/print-color.c index b6ffabd..0c7e592 100644 --- a/src/main/print-color.c +++ b/src/main/print-color.c @@ -1,5 +1,5 @@ /* - * "$Id: print-color.c,v 1.135.8.2 2007/12/15 20:35:45 rlk Exp $" + * "$Id: print-color.c,v 1.139 2008/01/25 00:38:32 rlk Exp $" * * Gutenprint color management module - traditional Gutenprint algorithm. * @@ -416,6 +416,14 @@ static const float_param_t float_parameters[] = RAW_GAMMA_CHANNEL(29), RAW_GAMMA_CHANNEL(30), RAW_GAMMA_CHANNEL(31), + { + { + "LUTDumpFile", N_("LUT dump file"), N_("Advanced Output Control"), + N_("Dump file for LUT for external color adjustment"), + STP_PARAMETER_TYPE_FILE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 0.0, 0.0, CMASK_EVERY, 0, -1 + }, }; static const int float_parameter_count = @@ -1223,6 +1231,69 @@ setup_channel(stp_vars_t *v, int i, const channel_param_t *p) compute_one_lut(lut, i); } +static void +stpi_print_lut_curve(FILE *fp, const char *text, stp_cached_curve_t *c, + int reverse) +{ + if (stp_curve_cache_get_curve(c)) + { + fprintf(fp, "%s: '", text); + if (reverse) + { + stp_curve_t *rev = stp_curve_create_reverse(stp_curve_cache_get_curve(c)); + stp_curve_write(fp, rev); + stp_curve_destroy(rev); + } + else + stp_curve_write(fp, stp_curve_cache_get_curve(c)); + fprintf(fp, "'\n"); + } +} + +static void +stpi_do_dump_lut_to_file(stp_vars_t *v, FILE *fp) +{ + int i; + lut_t *lut = (lut_t *)(stp_get_component_data(v, "Color")); + const stp_curve_t *curve; + fprintf(fp, "Gutenprint LUT dump version 0\n\n"); + fprintf(fp, "Input color description: '%s'\n", lut->input_color_description->name); + fprintf(fp, "Output color description: '%s'\n", lut->output_color_description->name); + fprintf(fp, "Color correction type: '%s'\n", lut->color_correction->name); + fprintf(fp, "Ink limit: %f\n", stp_get_float_parameter(v, "InkLimit")); + stpi_print_lut_curve(fp, "Brightness correction", &(lut->brightness_correction), 0); + stpi_print_lut_curve(fp, "Contrast correction", &(lut->contrast_correction), 0); + stpi_print_lut_curve(fp, "User color correction", &(lut->user_color_correction), 0); + for (i = 0; i < STP_CHANNEL_LIMIT; i++) + { + char buf[64]; + sprintf(buf, "Channel %d curve", i); + stpi_print_lut_curve(fp, buf, &(lut->channel_curves[i]), + lut->invert_output && ! channel_is_synthesized(lut, i)); + } + curve = stp_channel_get_gcr_curve(v); + if (curve) + { + fprintf(fp, "GCR curve: '"); + stp_curve_write(fp, curve); + fprintf(fp, "'\n"); + } +} + +static void +stpi_dump_lut_to_file(stp_vars_t *v, const char *dump_file) +{ + FILE *fp; + if (!dump_file) + return; + fp = fopen(dump_file, "w"); + if (fp) + { + stp_dprintf(STP_DBG_LUT, v, "Dumping LUT to %s\n", dump_file); + stpi_do_dump_lut_to_file(v, fp); + (void) fclose(fp); + } +} static void stpi_compute_lut(stp_vars_t *v) @@ -1326,6 +1397,8 @@ stpi_compute_lut(stp_vars_t *v) lut->input_color_description->color_id == COLOR_ID_RGB || lut->input_color_description->color_id == COLOR_ID_CMY)) initialize_gcr_curve(v); + if (stp_check_file_parameter(v, "LUTDumpFile", STP_PARAMETER_ACTIVE)) + stpi_dump_lut_to_file(v, stp_get_file_parameter(v, "LUTDumpFile")); } static int diff --git a/src/main/print-dither-matrices.c b/src/main/print-dither-matrices.c index 0d30cbb..a6fc6df 100644 --- a/src/main/print-dither-matrices.c +++ b/src/main/print-dither-matrices.c @@ -1,5 +1,5 @@ /* - * "$Id: print-dither-matrices.c,v 1.36 2006/03/19 00:19:09 rlk Exp $" + * "$Id: print-dither-matrices.c,v 1.37 2008/02/18 14:20:17 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * @@ -380,7 +380,6 @@ postinit_matrix(stp_vars_t *v, int x_shear, int y_shear) x_n * i, y_n * j); color++; } - stp_dither_set_transition(v, d->transition); } void @@ -435,11 +434,7 @@ stp_dither_set_transition(stp_vars_t *v, double exponent) unsigned y_n = d->dither_matrix.y_size / rc; for (i = 0; i < CHANNEL_COUNT(d); i++) stp_dither_matrix_destroy(&(CHANNEL(d, i).pick)); - stp_dither_matrix_destroy(&(d->transition_matrix)); - stp_dither_matrix_copy(&(d->dither_matrix), &(d->transition_matrix)); - d->transition = exponent; if (exponent < .999 || exponent > 1.001) - stp_dither_matrix_scale_exponentially(&(d->transition_matrix), exponent); for (i = 0; i < rc; i++) for (j = 0; j < rc; j++) if (color < CHANNEL_COUNT(d)) diff --git a/src/main/print-escp2-data.c b/src/main/print-escp2-data.c index e8aa6c4..9a7ff60 100644 --- a/src/main/print-escp2-data.c +++ b/src/main/print-escp2-data.c @@ -1,5 +1,5 @@ /* - * "$Id: print-escp2-data.c,v 1.202.6.4 2007/12/29 20:42:27 rlk Exp $" + * "$Id: print-escp2-data.c,v 1.246 2008/02/27 00:43:37 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -80,10 +80,10 @@ static const escp2_dot_size_t p1_5pl_dotsizes = { 0x10, 0x10, 0x10, 0x11, 0x12, 0x13, 0x13, 0x13, 0x13 }; static const escp2_dot_size_t claria_dotsizes = -{ 0x33, 0x33, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25 }; +{ 0x33, 0x33, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25 }; static const escp2_dot_size_t claria_1400_dotsizes = -{ 0x33, 0x33, 0x21, 0x21, 0x33, 0x25, 0x25, 0x25, 0x25 }; +{ 0x33, 0x33, 0x21, 0x21, 0x33, 0x33, 0x25, 0x25, 0x25 }; static const escp2_dot_size_t c2pl_dotsizes = { 0x12, 0x12, 0x12, 0x11, 0x13, -1, 0x10, 0x10, 0x10 }; @@ -208,7 +208,7 @@ static const escp2_base_resolutions_t c1_5_base_res = { 360, 360, 720, 720, 720, 720, 720, 720, 720 }; static const escp2_base_resolutions_t claria_1400_base_res = -{ 360, 360, 720, 720, 360, 720, 720, 720, 720 }; +{ 360, 360, 720, 720, 360, 360, 720, 720, 720 }; static const escp2_base_resolutions_t stc900_base_res = { 360, 360, 360, 360, 180, 180, 360, 360, 360 }; @@ -269,10 +269,10 @@ static const escp2_densities_t p1_5pl_densities = { 2.8, 1.4, 1.00, 1.000, 0.869, 0.942, 0.471, 0.500, 0.530 }; static const escp2_densities_t claria_densities = -{ 2.8, 1.4, 2.00, 1.000, 0.500, 0.812, 0.406, 0.546, 0.440 }; +{ 4.0, 4.0, 3.52, 1.760, 0.880, 0.440, 0.586, 0.733, 0.440 }; static const escp2_densities_t claria_1400_densities = -{ 2.8, 1.4, 2.00, 1.000, 0.500, 0.812, 0.406, 0.546, 0.440 }; +{ 4.0, 4.0, 3.52, 1.760, 0.880, 0.440, 0.586, 0.733, 0.440 }; static const escp2_densities_t p3_5pl_densities = { 2.8, 1.4, 1.77, 0.886, 0.443, 0.221, 0.240, 0.293, 0.146 }; @@ -378,7 +378,7 @@ static const stp_raw_t sprx600_borderless_sequence = STP_RAW_STRING("SN\114\000\ static const stp_raw_t sprx620_borderless_sequence = STP_RAW_STRING("SN\114\000\000\011\026\000\000\000\000\000\000\000\003\000\000\001\260\004\336\004\064\001\000\002\000\000\000\000\064\010\150\020\030\025\310\031\340\075\314\020\214\012\024\005\214\000\012\001\054\001\000\000\017\017\017\017\017\017\017\017\004\012\004\017\017\017\017\017\006\004\000\001\001\001\000\000\367\007"); -static const stp_raw_t sc120_borderless_sequence = STP_RAW_STRING("SN\001\000\000US\003\000\000\000\002"); +static const stp_raw_t generic_borderless_sequence = STP_RAW_STRING("SN\001\000\000US\003\000\000\000\002"); #define INCH(x) (72 * x) @@ -390,11 +390,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 15, 1, 4, 15, 1, 4, 15, 1, 4, 4, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g1_dotsizes, g1_densities, "simple", @@ -408,11 +409,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g2_dotsizes, g1_densities, "simple", @@ -426,11 +428,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17), INCH(44), INCH(2), INCH(2), + INCH(17), INCH(44), INCH(2), INCH(2), INCH(17), INCH(44), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g1_dotsizes, sc1500_densities, "simple", @@ -444,11 +447,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 8, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 8, 9, 0, 30, 8, 9, 0, 30, 8, 9, 0, 0, 8, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, sc600_dotsizes, g3_densities, "simple", @@ -462,11 +466,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 64, 1, 2, 64, 1, 2, 64, 1, 2, 4, 360, 14400, -1, 1440, 720, 180, 180, 0, 1, 4, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 8, 9, 9, 40, 8, 9, 9, 40, 8, 9, 0, 0, 8, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g3_dotsizes, g3_densities, "simple", @@ -480,11 +485,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 64, 1, 2, 64, 1, 2, 64, 1, 2, 4, 360, 14400, -1, 1440, 720, 180, 180, 0, 1, 4, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g3_dotsizes, g3_densities, "simple", @@ -498,11 +504,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 64, 1, 2, 64, 1, 2, 64, 1, 2, 4, 360, 14400, -1, 1440, 720, 180, 180, 0, 1, 4, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17), INCH(44), INCH(2), INCH(2), + INCH(17), INCH(44), INCH(2), INCH(2), INCH(136 / 10), INCH(44), 8, 9, 9, 40, 8, 9, 9, 40, 8, 9, 0, 0, 8, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g3_dotsizes, g3_densities, "simple", @@ -518,11 +525,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 8, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 30, 9, 9, 0, 30, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 15, 0, 0, /* Is it really 15 pairs??? */ sp700_dotsizes, sp700_densities, "simple", @@ -536,11 +544,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_NO | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 8, 1, 28800, 720 * 720, - INCH(118 / 10), INCH(44), INCH(2), INCH(2), + INCH(118 / 10), INCH(44), INCH(2), INCH(2), INCH(118 / 10), INCH(44), 9, 9, 0, 30, 9, 9, 0, 30, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, sp700_dotsizes, sp700_densities, "simple", @@ -554,11 +563,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 6, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 8, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 30, 9, 9, 0, 30, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, sp700_dotsizes, sp700_densities, "simple", @@ -574,11 +584,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1999 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 21, 1, 4, 21, 1, 4, 21, 1, 4, 4, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 8, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 15, 0, 0, sc440_dotsizes, sc440_densities, "simple", @@ -592,11 +603,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1999 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 8, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 15, 0, 0, sc640_dotsizes, sc440_densities, "simple", @@ -610,11 +622,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 144, 1, 1, 144, 1, 1, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c6pl_dotsizes, c6pl_densities, "variable_6pl", @@ -628,11 +641,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 96, 1, 2, 192, 1, 1, 192, 1, 1, 4, 360, 14400, -1, 1440, 720, 180, 180, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c3pl_dotsizes, c3pl_densities, "variable_3pl", @@ -646,11 +660,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c6pl_dotsizes, c6pl_densities, "variable_6pl", @@ -664,11 +679,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(44), INCH(2), INCH(2), + INCH(13), INCH(44), INCH(2), INCH(2), INCH(13), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c6pl_dotsizes, c6pl_densities, "variable_6pl", @@ -682,11 +698,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 144, 1, 1, 144, 1, 1, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_densities, "variable_1440_4pl", @@ -700,11 +717,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 144, 1, 1, 144, 1, 1, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(44), INCH(2), INCH(2), + INCH(13), INCH(44), INCH(2), INCH(2), INCH(13), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_densities, "variable_1440_4pl", @@ -718,11 +736,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1999 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 8, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 9, 9, 9, 9, 9, 26, 9, 9, 9, 0, 9, 9, 9, 0, -1, -1, 0, 0, 0, 1, 15, 0, 0, sc660_dotsizes, sc660_densities, "simple", @@ -736,11 +755,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 144, 1, 1, 144, 1, 1, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_densities, "variable_1440_4pl", @@ -754,11 +774,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, sp720_dotsizes, c6pl_densities, "variable_6pl", @@ -772,11 +793,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_YES | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 15, 15, 3, 48, 48, 3, 48, 48, 3, 4, 360, 14400, 360, 720, 720, 90, 90, 0, 1, 0, 0, 0, -99, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, sc480_dotsizes, sc480_densities, "variable_x80_6pl", @@ -790,11 +812,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_densities, "variable_1440_4pl", @@ -808,11 +831,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(1200), INCH(2), INCH(2), + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_densities, "variable_1440_4pl", @@ -826,11 +850,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 64, 1, 2, 64, 1, 2, 64, 1, 2, 4, 360, 14400, -1, 1440, 720, 180, 180, 0, 1, 4, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17), INCH(44), INCH(2), INCH(2), + INCH(17), INCH(44), INCH(2), INCH(2), INCH(17), INCH(44), 8, 9, 9, 40, 8, 9, 9, 40, 8, 9, 0, 0, 8, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g3_dotsizes, g3_densities, "simple", @@ -844,11 +869,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 64, 1, 2, 64, 1, 2, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, sc670_dotsizes, c6pl_densities, "variable_6pl", @@ -862,11 +888,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 144, 1, 1, 144, 1, 1, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(1200), INCH(2), INCH(2), + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 2, 15, 0, 0, sp2000_dotsizes, sp2000_densities, "variable_2000p", @@ -880,11 +907,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 64, 1, 2, 64, 1, 2, 64, 1, 2, 6, 360, 14400, -1, 1440, 720, 180, 180, 0, 1, 0, 0, 0, 0, 0, 4, 1, 28800, 720 * 720, - INCH(13), INCH(44), INCH(2), INCH(2), + INCH(13), INCH(44), INCH(2), INCH(2), INCH(13), INCH(44), 9, 9, 0, 30, 9, 9, 0, 30, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, spro5000_dotsizes, sp700_densities, "simple", @@ -898,11 +926,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_PRO | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(24), INCH(1200), INCH(7), INCH(7), + INCH(24), INCH(1200), INCH(7), INCH(7), INCH(24), INCH(1200), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 9, 9, 9, 9, 9, 9, -1, -1, 0, 0, 0, 1, 7, 0, 0, spro_dye_dotsizes, spro_dye_densities, "simple", @@ -916,11 +945,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_PRO | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_YES | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(24), INCH(1200), INCH(7), INCH(7), + INCH(24), INCH(1200), INCH(7), INCH(7), INCH(24), INCH(1200), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 9, 9, 9, 9, 9, 9, -1, -1, 0, 0, 0, 1, 7, 0, 0, spro_pigment_dotsizes, spro_pigment_densities, "simple", @@ -934,11 +964,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_PRO | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(44), INCH(1200), INCH(7), INCH(7), + INCH(44), INCH(1200), INCH(7), INCH(7), INCH(44), INCH(1200), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 9, 9, 9, 9, 9, 9, -1, -1, 0, 0, 0, 1, 7, 0, 0, spro_dye_dotsizes, spro_dye_densities, "simple", @@ -952,11 +983,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_PRO | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_YES | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(44), INCH(1200), INCH(7), INCH(7), + INCH(44), INCH(1200), INCH(7), INCH(7), INCH(44), INCH(1200), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 9, 9, 9, 9, 9, 9, -1, -1, 0, 0, 0, 1, 7, 0, 0, spro_pigment_dotsizes, spro_pigment_densities, "simple", @@ -970,11 +1002,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 144, 1, 1, 144, 1, 1, 4, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -988,11 +1021,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 144, 1, 1, 144, 1, 1, 4, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1006,11 +1040,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 96, 1, 2, 192, 1, 1, 192, 1, 1, 4, 360, 14400, -1, 2880, 720, 180, 180, 38, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c3pl_dotsizes, sc980_densities, "variable_3pl", @@ -1024,11 +1059,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1042,11 +1078,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1060,11 +1097,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(1200), INCH(2), INCH(2), + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1078,11 +1116,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_YES | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 15, 15, 3, 48, 48, 3, 48, 48, 3, 4, 360, 14400, 360, 1440, 720, 90, 90, 0, 1, 0, 0, 0, -99, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, sc480_dotsizes, sc480_densities, "variable_x80_6pl", @@ -1096,11 +1135,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 16, 1, 4, 16, 1, 4, 16, 1, 4, 4, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(1200), INCH(2), INCH(2), + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g1_dotsizes, g1_densities, "simple", @@ -1114,11 +1154,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_PRO | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_YES | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(1200), INCH(2), INCH(2), + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, spro_pigment_dotsizes, spro_pigment_densities, "simple", @@ -1132,11 +1173,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_PRO | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_YES | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(44), INCH(1200), INCH(7), INCH(7), + INCH(44), INCH(1200), INCH(7), INCH(7), INCH(44), INCH(1200), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 9, 9, 9, 9, 9, 9, -1, -1, 0, 0, 0, 1, 7, 0, 0, spro10000_dotsizes, spro10000_densities, "spro10000", @@ -1150,11 +1192,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_YES | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 15, 15, 3, 48, 48, 3, 48, 48, 3, 4, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, -99, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, sc480_dotsizes, sc480_densities, "variable_x80_6pl", @@ -1168,11 +1211,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_YES | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 15, 15, 3, 48, 48, 3, 48, 48, 3, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, -99, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, sc480_dotsizes, sc480_densities, "variable_x80_6pl", @@ -1186,11 +1230,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 60, 60, 2, 180, 180, 2, 180, 180, 2, 4, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 0, 0, -240, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_densities, "variable_3pl_pigment", @@ -1204,11 +1249,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_NO | MODEL_COMMAND_1998 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_NO| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 16, 1, 4, 16, 1, 4, 16, 1, 4, 4, 360, 14400, -1, 720, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(44), INCH(2), INCH(2), + INCH(19 / 2), INCH(44), INCH(2), INCH(2), INCH(17 / 2), INCH(44), 9, 9, 9, 40, 9, 9, 9, 40, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 1, 7, 0, 0, g1_dotsizes, g1_densities, "simple", @@ -1222,11 +1268,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_YES | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 96, 96, 2, 96, 96, 2, 24, 24, 1, 6, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 0, 0, 24, 4, 15, 0, 0, c2pl_dotsizes, c2pl_densities, "variable_2pl", @@ -1240,11 +1287,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_H_ONLY | MODEL_VACUUM_NO | MODEL_FAST_360_YES | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_YES), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_YES | + MODEL_ENVELOPE_LANDSCAPE_YES), 96, 96, 2, 96, 96, 2, 192, 192, 1, 7, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(13), INCH(1200), INCH(2), INCH(2), + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 0, 0, 0, 4, 15, 0, 0, c4pl_pigment_dotsizes, c4pl_pigment_densities, "variable_ultrachrome", @@ -1258,11 +1306,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_PRO | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_YES | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(24), INCH(1200), INCH(7), INCH(7), + INCH(24), INCH(1200), INCH(7), INCH(7), INCH(24), INCH(1200), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, spro_c4pl_pigment_dotsizes, c4pl_pigment_densities, "variable_ultrachrome", @@ -1276,11 +1325,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_PRO | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_YES | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(44), INCH(1200), INCH(7), INCH(7), + INCH(44), INCH(1200), INCH(7), INCH(7), INCH(44), INCH(1200), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, spro_c4pl_pigment_dotsizes, c4pl_pigment_densities, "variable_ultrachrome", @@ -1294,11 +1344,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 2880, 1440, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1312,11 +1363,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 2880, 1440, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1330,11 +1382,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 48, 1, 3, 144, 1, 1, 144, 1, 1, 4, 360, 14400, -1, 2880, 1440, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1348,11 +1401,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_YES | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 96, 96, 2, 96, 96, 2, 24, 24, 1, 6, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 0, 0, 24, 4, 15, 0, 0, c2pl_dotsizes, c2pl_densities, "variable_2pl", @@ -1366,11 +1420,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_1999 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 32, 1, 4, 32, 1, 4, 32, 1, 4, 6, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, 0, 0, 0, 1, 28800, 720 * 720, - INCH(13), INCH(44), INCH(2), INCH(2), + INCH(13), INCH(44), INCH(2), INCH(2), INCH(13), INCH(44), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, sp720_dotsizes, c6pl_densities, "variable_6pl", @@ -1384,11 +1439,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 59, 60, 2, 180, 180, 2, 180, 180, 2, 4, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 0, 0, -240, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_densities, "variable_3pl_pigment", @@ -1402,11 +1458,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 15, 15, 3, 48, 48, 3, 48, 48, 3, 4, 360, 14400, -1, 1440, 720, 90, 90, 0, 1, 0, 0, 0, -99, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_densities, "variable_x80_6pl", @@ -1420,11 +1477,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_YES | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 180, 180, 2, 360, 360, 1, 360, 360, 1, 7, 360, 14400, -1, 2880, 2880, 720, 360, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c1_8pl_dotsizes, c1_8pl_densities, "variable_2pl", @@ -1438,11 +1496,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 90, 2, 90, 90, 2, 90, 90, 2, 6, 360, 14400, -1, 2880, 2880, 720, 360, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c1_8pl_dotsizes, c1_8pl_densities, "variable_2pl", @@ -1456,11 +1515,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_NO | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_YES | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 15, 15, 3, 48, 48, 3, 48, 48, 3, 4, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 0, 0, -99, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 9, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 3, 15, 0, 0, c4pl_dotsizes, c4pl_densities, "variable_x80_6pl", @@ -1474,11 +1534,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 59, 60, 2, 180, 180, 2, 180, 180, 2, 4, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 80, 42, -240, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_densities, "variable_3pl_pigment", @@ -1492,11 +1553,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 29, 30, 3, 90, 90, 3, 90, 90, 3, 4, 360, 14400, -1, 2880, 1440, 360, 120, 0, 1, 0, 80, 42, -180, 0, 0, 1, 28800, 1440 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_densities, "variable_3pl_pigment", @@ -1510,11 +1572,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 399, 394, 595, 842, 24, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1528,11 +1591,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 3, 90, 1, 3, 90, 1, 3, 6, 360, 14400, -1, 2880, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 24, 4, 15, 0, 0, p3pl_dotsizes, p3pl_densities, "variable_3pl_pmg", @@ -1546,17 +1610,18 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 180, 1, 2, 180, 1, 2, 180, 1, 2, 8, 360, 28800, -1, 5760, 2880, 360, 180, - 0, 1, 0, 80, 42, 0, 0, 0, 1, 180, 5760 * 2880, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + 180 * 2, 1, 0, 80, 42, 0, 0, 0, 1, 180, 5760 * 2880, + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 11, 9, 9, 0, 11, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 24, 4, 15, 0, 0, p1_5pl_dotsizes, p1_5pl_densities, "variable_1_5pl", "superfine", "cmykrb", variable_bits, c1_5_base_res, "r1800", - "p1_5", &new_init_sequence, &je_deinit_sequence, + "v2880", &new_init_sequence, &je_deinit_sequence, &spr800_borderless_sequence, NULL, "r800" }, /* 65: Stylus Photo CX4600 */ @@ -1564,11 +1629,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 3, 90, 1, 3, 90, 1, 3, 4, 360, 14400, -1, 5760, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 180, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 0, 4, 15, 0, 0, p3pl_dotsizes, p3pl_densities, "variable_3pl_pmg", @@ -1582,11 +1648,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 29, 30, 3, 90, 90, 3, 90, 90, 3, 4, 360, 14400, -1, 2880, 1440, 360, 120, 0, 1, 0, 80, 42, -180, 0, 0, 1, 28800, 1440 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_c66_densities, "variable_3pl_pigment_c66", @@ -1600,17 +1667,18 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 180, 1, 2, 180, 1, 2, 180, 1, 2, 8, 360, 28800, -1, 5760, 2880, 360, 180, - 0, 1, 0, 96, 42, 0, 0, 0, 1, 180, 5760 * 2880, - INCH(13), INCH(1200), INCH(2), INCH(2), + 180 * 2, 1, 0, 96, 42, 0, 0, 0, 1, 180, 5760 * 2880, + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 0, 11, 9, 9, 0, 11, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 24, 4, 15, 0, 0, p1_5pl_dotsizes, p1_5pl_densities, "variable_1_5pl", "superfine", "cmykrb", variable_bits, c1_5_base_res, "r1800", - "p1_5", &new_init_sequence, &je_deinit_sequence, + "v2880", &new_init_sequence, &je_deinit_sequence, &spr800_borderless_sequence, NULL, "r800" }, /* 68: PM-G820 */ @@ -1618,17 +1686,18 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 180, 1, 2, 180, 1, 2, 180, 1, 2, 8, 360, 14400, -1, 5760, 2880, 360, 180, - 0, 1, 0, 80, 42, 0, 0, 0, 1, 180, 5760 * 2880, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + 180 * 2, 1, 0, 80, 42, 0, 0, 0, 1, 180, 5760 * 2880, + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 11, 9, 9, 0, 11, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 24, 4, 15, 0, 0, p1_5pl_dotsizes, p1_5pl_densities, "variable_1_5pl", - "superfine", "photo_gen3", + "superfine", "cmykrb", variable_bits, c1_5_base_res, "cd_roll_feed", - "standard", &new_init_sequence, &je_deinit_sequence, + "v2880", &new_init_sequence, &je_deinit_sequence, &spr800_borderless_sequence, NULL, "r800" }, /* 69: Stylus C86 */ @@ -1636,11 +1705,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 59, 60, 2, 180, 180, 2, 180, 180, 2, 4, 360, 14400, -1, 2880, 2880, 360, 180, 0, 1, 0, 80, 42, -240, 0, 0, 1, 28800, 1440 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_densities, "variable_3pl_pigment", @@ -1654,47 +1724,50 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 180, 1, 2, 180, 1, 2, 180, 1, 2, 6, 360, 28800, -1, 5760, 2880, 360, 180, - 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + 10, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 263, 595, 842, 0, 4, 15, 0, 0, p1_5pl_dotsizes, p1_5pl_densities, "variable_1_5pl", "superfine", "photo_gen3", variable_bits, c1_5_base_res, "rx700", "p1_5", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "rx700" + &generic_borderless_sequence, NULL, "rx700" }, /* 71: Stylus Photo R2400 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_YES), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_YES | + MODEL_ENVELOPE_LANDSCAPE_NO), 180, 1, 2, 180, 1, 2, 180, 1, 2, 8, 360, 14400, -1, 5760, 2880, 360, 180, - 0, 1, 0, 80, 42, 0, 0, 0, 1, 180, 1440 * 1440, - INCH(13), INCH(1200), INCH(2), INCH(2), + 10, 1, 0, 80, 42, 0, 0, 0, 1, 180, 1440 * 1440, + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 0, 4, 15, 0, 0, p3_5pl_dotsizes, p3_5pl_densities, "variable_r2400", "superfine", "f360_ultrachrome_k3", variable_bits, c1_5_base_res, "r2400", - "standard", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "r2400" + "v2880", &new_init_sequence, &je_deinit_sequence, + &generic_borderless_sequence, NULL, "r2400" }, /* 72: Stylus CX3700/3800/3810 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 29, 30, 3, 90, 90, 3, 90, 90, 3, 4, 360, 14400, -1, 2880, 1440, 360, 120, 0, 1, 0, 80, 42, -180, 0, 0, 1, 28800, 1440 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_c66_densities, "variable_3pl_pigment_c66", @@ -1708,47 +1781,50 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 3, 90, 1, 3, 90, 1, 3, 6, 360, 28800, -1, 5760, 1440, 1440, 720, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(4), INCH(1200), INCH(2), INCH(2), + INCH(4), INCH(1200), INCH(2), INCH(2), INCH(4), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 0, 4, 15, 0, 0, picturemate_dotsizes, picturemate_densities, "variable_picturemate", - "picturemate", "picturemate", + "picturemate", "picturemate_6", variable_bits, c1_5_base_res, "default", "picturemate", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "picturemate" + NULL, NULL, "picturemate_6" }, /* 74: PM-A650 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 90, 3, 90, 90, 3, 90, 90, 3, 4, 360, 14400, -1, 5760, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 0, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_c66_densities, "variable_3pl_pigment_c66", "superfine", "c64", variable_bits, variable_base_res, "cd_roll_feed", "standard", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "standard" + &generic_borderless_sequence, NULL, "standard" }, /* 75: Japanese PM-A750 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_YES | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 90, 3, 90, 90, 3, 90, 90, 3, 4, 360, 14400, -1, 5760, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 0, 0, 0, 4, 15, 0, 0, c2pl_dotsizes, c2pl_densities, "variable_2pl", @@ -1762,47 +1838,50 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_YES | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 90, 3, 90, 90, 3, 90, 90, 3, 6, 360, 14400, -1, 5760, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 0, 0, 0, 4, 15, 0, 0, c2pl_dotsizes, c2pl_densities, "variable_2pl", "superfine", "photo_gen3", variable_bits, variable_base_res, "cd_roll_feed", "standard", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "standard" + &generic_borderless_sequence, NULL, "standard" }, /* 77: Japanese PM-D600 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 3, 90, 1, 3, 90, 1, 3, 4, 360, 14400, -1, 2880, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 0, 4, 15, 0, 0, p3pl_dotsizes, p3pl_densities, "variable_3pl_pmg", "superfine", "c64", variable_bits, variable_base_res, "cd_roll_feed", "standard", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "photo" + &generic_borderless_sequence, NULL, "photo" }, /* 78: Stylus Photo 810/820 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_YES), 48, 1, 3, 48, 1, 3, 48, 1, 3, 6, 360, 14400, -1, 2880, 720, 90, 90, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(19 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 3, 15, 0, 0, c4pl_dotsizes, c4pl_2880_densities, "variable_2880_4pl", @@ -1816,11 +1895,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 59, 60, 2, 180, 180, 2, 180, 180, 2, 4, 360, 14400, -1, 2880, 1440, 360, 180, 0, 1, 0, 80, 42, -240, 0, 0, 1, 28800, 720 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_densities, "variable_3pl_pigment", @@ -1834,11 +1914,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 59, 60, 2, 180, 180, 2, 180, 180, 2, 4, 360, 14400, -1, 2880, 2880, 360, 180, 0, 1, 0, 80, 42, -240, 0, 0, 1, 28800, 1440 * 720, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c3pl_pigment_dotsizes, c3pl_pigment_densities, "variable_3pl_pigment", @@ -1852,47 +1933,50 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 4, 90, 1, 4, 90, 1, 4, 6, 360, 14400, -1, 5760, 2880, 360, 90, - 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 5760 * 2880, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + 90 * 4, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 5760 * 2880, + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 189, 595, 842, 24, 4, 15, 0, 0, claria_dotsizes, claria_densities, "variable_claria", "superfine", "claria", variable_bits, c1_5_base_res, "cd_roll_feed", - "standard", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "sp1400" + "v2880", &new_init_sequence, &je_deinit_sequence, + &generic_borderless_sequence, NULL, "sp1400" }, /* 82: Stylus Photo 1400 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 4, 90, 1, 4, 90, 1, 4, 6, 360, 14400, -1, 5760, 2880, 360, 90, - 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 5760 * 2880, - INCH(13), INCH(1200), INCH(2), INCH(2), + 90 * 4, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 5760 * 2880, + INCH(13), INCH(1200), INCH(2), INCH(2), INCH(13), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 263, 595, 842, 24, 4, 15, 0, 0, claria_1400_dotsizes, claria_1400_densities, "variable_claria_1400", "claria_1400", "claria", variable_bits, claria_1400_base_res, "cd_roll_feed", - "standard", &new_init_sequence, &je_deinit_sequence, - NULL, NULL, "sp1400" + "v2880", &new_init_sequence, &je_deinit_sequence, + &generic_borderless_sequence, NULL, "sp1400" }, /* 83: Stylus Photo R240 */ { (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 3, 90, 1, 3, 90, 1, 3, 4, 360, 14400, -1, 5760, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 24, 4, 15, 0, 0, p3pl_dotsizes, p3pl_densities, "variable_3pl_pmg", @@ -1906,11 +1990,12 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 90, 1, 3, 90, 1, 3, 90, 1, 3, 6, 360, 14400, -1, 2880, 1440, 360, 120, 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 24, 4, 15, 0, 0, p3pl_dotsizes, p3pl_densities, "variable_3pl_pmg", @@ -1924,18 +2009,38 @@ const stpi_escp2_printer_t stpi_escp2_model_capabilities[] = (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_YES | MODEL_ZEROMARGIN_YES | MODEL_VACUUM_NO | MODEL_FAST_360_NO | MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | - MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO), + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), 59, 60, 2, 360, 1, 1, 360, 1, 1, 4, - 360, 14400, -1, 5760, 1440, 360, 180, + 360, 14400, -1, 5760, 2880, 360, 180, 0, 1, 0, 80, 42, -240, 0, 0, 1, 28800, 5760 * 2880, - INCH(17 / 2), INCH(1200), INCH(2), INCH(2), + INCH(17 / 2), INCH(1200), INCH(2), INCH(2), INCH(17 / 2), INCH(1200), 9, 9, 0, 9, 9, 9, 0, 9, 9, 9, 0, 0, 9, 9, 0, 0, -1, -1, 0, 0, 24, 4, 15, 0, 0, c3pl_pigment_c120_dotsizes, c3pl_pigment_c120_densities, "variable_3pl_pigment_c120", "superfine", "c120", variable_bits, variable_base_res, "default", "standard", &new_init_sequence, &je_deinit_sequence, - &sc120_borderless_sequence, NULL, "c120" + &generic_borderless_sequence, NULL, "c120" + }, + /* 86: PictureMate 4-color */ + { + (MODEL_VARIABLE_YES | MODEL_COMMAND_2000 | MODEL_GRAYMODE_NO | + MODEL_ZEROMARGIN_FULL | MODEL_VACUUM_NO | MODEL_FAST_360_NO | + MODEL_SEND_ZERO_ADVANCE_YES | MODEL_SUPPORTS_INK_CHANGE_NO | + MODEL_PACKET_MODE_YES| MODEL_INTERCHANGEABLE_INK_NO | + MODEL_ENVELOPE_LANDSCAPE_NO), + 90, 1, 3, 90, 1, 3, 90, 1, 3, 4, + 360, 28800, -1, 5760, 1440, 1440, 720, + 0, 1, 0, 80, 42, 0, 0, 0, 1, 28800, 1440 * 1440, + INCH(4), INCH(1200), INCH(2), INCH(2), INCH(4), INCH(1200), + 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 9, 9, 0, 0, 204, 191, 595, 842, 0, + 4, 15, 0, 0, + picturemate_dotsizes, picturemate_densities, "variable_picturemate", + "picturemate", "picturemate_4", + variable_bits, c1_5_base_res, "default", + "picturemate", &new_init_sequence, &je_deinit_sequence, + NULL, NULL, "picturemate_4" }, }; diff --git a/src/main/print-escp2.c b/src/main/print-escp2.c index 582702f..b00b8d4 100644 --- a/src/main/print-escp2.c +++ b/src/main/print-escp2.c @@ -1,5 +1,5 @@ /* - * "$Id: print-escp2.c,v 1.355.2.4 2007/12/29 20:42:27 rlk Exp $" + * "$Id: print-escp2.c,v 1.387 2008/02/27 02:22:26 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -35,6 +35,7 @@ #include <string.h> #include <assert.h> #include <math.h> +#include <limits.h> #include "print-escp2.h" #ifdef __GNUC__ @@ -68,6 +69,7 @@ static const escp2_printer_attr_t escp2_printer_attrs[] = { "supports_ink_change", 11, 1 }, { "packet_mode", 12, 1 }, { "interchangeable_ink", 13, 1 }, + { "envelope_landscape", 14, 1 }, }; typedef struct @@ -397,6 +399,8 @@ static const stp_parameter_t the_parameters[] = PARAMETER_INT(max_paper_height), PARAMETER_INT(min_paper_width), PARAMETER_INT(min_paper_height), + PARAMETER_INT(max_imageable_width), + PARAMETER_INT(max_imageable_height), PARAMETER_INT(extra_feed), PARAMETER_INT(pseudo_separation_rows), PARAMETER_INT(base_separation), @@ -415,6 +419,9 @@ static const stp_parameter_t the_parameters[] = PARAMETER_INT(right_margin), PARAMETER_INT(top_margin), PARAMETER_INT(bottom_margin), + PARAMETER_INT(ink_type), + PARAMETER_INT(bits), + PARAMETER_INT(base_res), PARAMETER_INT_RO(alignment_passes), PARAMETER_INT_RO(alignment_choices), PARAMETER_INT_RO(alternate_alignment_passes), @@ -492,6 +499,38 @@ static const float_param_t float_parameters[] = }, { { + "DropSize1", N_("Drop Size Small"), N_("Advanced Ink Adjustment"), + N_("Drop Size 1 (small)"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 1.0, 0.0, 1 + }, + { + { + "DropSize2", N_("Drop Size Medium"), N_("Advanced Ink Adjustment"), + N_("Drop Size 2 (medium)"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 1.0, 0.0, 1 + }, + { + { + "DropSize3", N_("Drop Size Large"), N_("Advanced Ink Adjustment"), + N_("Drop Size 3 (large)"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 1.0, 0.0, 1 + }, + { + { + "LightCyanValue", N_("Light Cyan Value"), N_("Advanced Ink Adjustment"), + N_("Light Cyan Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "LightCyanTransition", N_("Light Cyan Transition"), N_("Advanced Ink Adjustment"), N_("Light Cyan Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -500,6 +539,30 @@ static const float_param_t float_parameters[] = }, { { + "LightCyanScale", N_("Light Cyan Density Scale"), N_("Advanced Ink Adjustment"), + N_("Light Cyan Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "LightMagentaValue", N_("Light Magenta Value"), N_("Advanced Ink Adjustment"), + N_("Light Magenta Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "LightMagentaScale", N_("Light Magenta Density Scale"), N_("Advanced Ink Adjustment"), + N_("Light Magenta Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "LightMagentaTransition", N_("Light Magenta Transition"), N_("Advanced Ink Adjustment"), N_("Light Magenta Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -508,6 +571,14 @@ static const float_param_t float_parameters[] = }, { { + "DarkYellowValue", N_("Dark Yellow Value"), N_("Advanced Ink Adjustment"), + N_("Dark Yellow Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "DarkYellowTransition", N_("Dark Yellow Transition"), N_("Advanced Ink Adjustment"), N_("Dark Yellow Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -516,6 +587,22 @@ static const float_param_t float_parameters[] = }, { { + "DarkYellowScale", N_("Dark Yellow Density Scale"), N_("Advanced Ink Adjustment"), + N_("Dark Yellow Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "GrayValue", N_("Gray Value"), N_("Advanced Ink Adjustment"), + N_("Gray Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "GrayTransition", N_("Gray Transition"), N_("Advanced Ink Adjustment"), N_("Gray Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -524,6 +611,22 @@ static const float_param_t float_parameters[] = }, { { + "GrayScale", N_("Gray Density Scale"), N_("Advanced Ink Adjustment"), + N_("Gray Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "DarkGrayValue", N_("Gray Value"), N_("Advanced Ink Adjustment"), + N_("Gray Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "DarkGrayTransition", N_("Gray Transition"), N_("Advanced Ink Adjustment"), N_("Gray Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -532,6 +635,22 @@ static const float_param_t float_parameters[] = }, { { + "DarkGrayScale", N_("Gray Density Scale"), N_("Advanced Ink Adjustment"), + N_("Gray Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "LightGrayValue", N_("Light Gray Value"), N_("Advanced Ink Adjustment"), + N_("Light Gray Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "LightGrayTransition", N_("Light Gray Transition"), N_("Advanced Ink Adjustment"), N_("Light Gray Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -540,6 +659,22 @@ static const float_param_t float_parameters[] = }, { { + "LightGrayScale", N_("Light Gray Density Scale"), N_("Advanced Ink Adjustment"), + N_("Light Gray Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "Gray3Value", N_("Dark Gray Value"), N_("Advanced Ink Adjustment"), + N_("Dark Gray Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "Gray3Transition", N_("Dark Gray Transition"), N_("Advanced Ink Adjustment"), N_("Dark Gray Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -548,6 +683,22 @@ static const float_param_t float_parameters[] = }, { { + "Gray3Scale", N_("Dark Gray Density Scale"), N_("Advanced Ink Adjustment"), + N_("Dark Gray Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "Gray2Value", N_("Mid Gray Value"), N_("Advanced Ink Adjustment"), + N_("Medium Gray Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "Gray2Transition", N_("Mid Gray Transition"), N_("Advanced Ink Adjustment"), N_("Medium Gray Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, @@ -556,12 +707,60 @@ static const float_param_t float_parameters[] = }, { { + "Gray2Scale", N_("Mid Gray Density Scale"), N_("Advanced Ink Adjustment"), + N_("Medium Gray Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "Gray1Value", N_("Light Gray Value"), N_("Advanced Ink Adjustment"), + N_("Light Gray Value"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { "Gray1Transition", N_("Light Gray Transition"), N_("Advanced Ink Adjustment"), N_("Light Gray Transition"), STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 }, 0.0, 5.0, 1.0, 1 }, + { + { + "Gray1Scale", N_("Light Gray Density Scale"), N_("Advanced Ink Adjustment"), + N_("Light Gray Density Scale"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, -1, 1, 0 + }, 0.0, 5.0, 1.0, 1 + }, + { + { + "BlackTrans", N_("GCR Transition"), N_("Advanced Output Control"), + N_("Adjust the gray component transition rate"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, 0, 1, 0 + }, 0.0, 1.0, 1.0, 1 + }, + { + { + "GCRLower", N_("GCR Lower Bound"), N_("Advanced Output Control"), + N_("Lower bound of gray component reduction"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, 0, 1, 0 + }, 0.0, 1.0, 0.2, 1 + }, + { + { + "GCRUpper", N_("GCR Upper Bound"), N_("Advanced Output Control"), + N_("Upper bound of gray component reduction"), + STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, + STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, 0, 1, 0 + }, 0.0, 5.0, 0.5, 1 + }, }; static const int float_parameter_count = @@ -679,6 +878,8 @@ DEF_SIMPLE_ACCESSOR(max_paper_width, unsigned) DEF_SIMPLE_ACCESSOR(max_paper_height, unsigned) DEF_SIMPLE_ACCESSOR(min_paper_width, unsigned) DEF_SIMPLE_ACCESSOR(min_paper_height, unsigned) +DEF_SIMPLE_ACCESSOR(max_imageable_width, unsigned) +DEF_SIMPLE_ACCESSOR(max_imageable_height, unsigned) DEF_SIMPLE_ACCESSOR(cd_x_offset, int) DEF_SIMPLE_ACCESSOR(cd_y_offset, int) DEF_SIMPLE_ACCESSOR(cd_page_width, int) @@ -817,11 +1018,11 @@ escp2_bits(const stp_vars_t *v, int resid) } } -static double +static int escp2_base_res(const stp_vars_t *v, int resid) { - if (stp_check_float_parameter(v, "escp2_base_res", STP_PARAMETER_ACTIVE)) - return stp_get_float_parameter(v, "escp2_base_res"); + if (stp_check_int_parameter(v, "escp2_base_res", STP_PARAMETER_ACTIVE)) + return stp_get_int_parameter(v, "escp2_base_res"); else { int model = stp_get_model_id(v); @@ -838,6 +1039,28 @@ escp2_dropsizes(const stp_vars_t *v, int resid) return (*drops)[resid]; } +static escp2_dropsize_t * +escp2_copy_dropsizes(const stp_vars_t *v, int resid) +{ + const escp2_dropsize_t *drops = escp2_dropsizes(v, resid); + int i; + escp2_dropsize_t *ndrops = stp_zalloc(sizeof(escp2_dropsize_t)); + if (! drops) + return NULL; + ndrops->listname = drops->listname; + ndrops->numdropsizes = drops->numdropsizes; + for (i = 0; i < drops->numdropsizes; i++) + ndrops->dropsizes[i] = drops->dropsizes[i]; + return ndrops; +} + +static void +escp2_free_dropsizes(escp2_dropsize_t *drops) +{ + if (drops) + stp_free(drops); +} + static const inklist_t * escp2_inklist(const stp_vars_t *v) { @@ -865,6 +1088,28 @@ escp2_shades(const stp_vars_t *v, int channel) return &((*inklist->shades)[channel]); } +static shade_t * +escp2_copy_shades(const stp_vars_t *v, int channel) +{ + const shade_t *shades = escp2_shades(v, channel); + int i; + shade_t *nshades; + if (! shades) + return NULL; + nshades = stp_zalloc(sizeof(shade_t)); + nshades->n_shades = shades->n_shades; + for (i = 0; i < shades->n_shades; i++) + nshades->shades[i] = shades->shades[i]; + return nshades; +} + +static void +escp2_free_shades(shade_t *shades) +{ + if (shades) + stp_free(shades); +} + static const paperlist_t * escp2_paperlist(const stp_vars_t *v) { @@ -1206,11 +1451,15 @@ verify_papersize(const stp_vars_t *v, const stp_papersize_t *pt) { unsigned int height_limit, width_limit; unsigned int min_height_limit, min_width_limit; + unsigned int envelope_landscape = + escp2_has_cap(v, MODEL_ENVELOPE_LANDSCAPE, MODEL_ENVELOPE_LANDSCAPE_YES); width_limit = escp2_max_paper_width(v); height_limit = escp2_max_paper_height(v); min_width_limit = escp2_min_paper_width(v); min_height_limit = escp2_min_paper_height(v); if (strlen(pt->name) > 0 && + (pt->paper_size_type != PAPERSIZE_TYPE_ENVELOPE || + envelope_landscape || pt->height > pt->width) && pt->width <= width_limit && pt->height <= height_limit && (pt->height >= min_height_limit || pt->height == 0) && (pt->width >= min_width_limit || pt->width == 0) && @@ -1337,15 +1586,6 @@ escp2_list_parameters(const stp_vars_t *v) } static void -fill_transition_parameters(stp_parameter_t *description) -{ - description->is_active = 1; - description->bounds.dbl.lower = 0; - description->bounds.dbl.upper = 5.0; - description->deflt.dbl = 1.0; -} - -static void set_density_parameter(const stp_vars_t *v, stp_parameter_t *description, int color) @@ -1397,6 +1637,82 @@ set_hue_map_parameter(const stp_vars_t *v, } static void +fill_value_parameters(const stp_vars_t *v, + stp_parameter_t *description, + int color) +{ + const shade_t *shades = escp2_shades(v, color); + const escp2_inkname_t *ink_name = get_inktype(v); + description->is_active = 1; + description->bounds.dbl.lower = 0; + description->bounds.dbl.upper = 1.0; + description->deflt.dbl = 1.0; + if (shades && ink_name) + { + const ink_channel_t *channel = ink_name->channel_set->channels[color]; + int i; + for (i = 0; i < channel->n_subchannels; i++) + { + if (channel->subchannels[i].subchannel_value && + strcmp(description->name, + channel->subchannels[i].subchannel_value) == 0) + { + description->deflt.dbl = shades->shades[i]; + return; + } + } + } +} + +static void +set_color_value_parameter(const stp_vars_t *v, + stp_parameter_t *description, + int color) +{ + description->is_active = 0; + if (stp_get_string_parameter(v, "PrintingMode") && + strcmp(stp_get_string_parameter(v, "PrintingMode"), "BW") != 0) + { + const escp2_inkname_t *ink_name = get_inktype(v); + if (ink_name && + ink_name->channel_set->channel_count == 4 && + ink_name->channel_set->channels[color] && + ink_name->channel_set->channels[color]->n_subchannels == 2) + fill_value_parameters(v, description, color); + } +} + +static void +set_gray_value_parameter(const stp_vars_t *v, + stp_parameter_t *description, + int expected_channels) +{ + const escp2_inkname_t *ink_name = get_inktype(v); + description->is_active = 0; + if (ink_name && ink_name->channel_set->channels[STP_ECOLOR_K] && + (ink_name->channel_set->channels[STP_ECOLOR_K]->n_subchannels == + expected_channels)) + fill_value_parameters(v, description, STP_ECOLOR_K); + else + set_color_value_parameter(v, description, STP_ECOLOR_K); +} + +static void +fill_transition_parameters(const stp_vars_t *v, + stp_parameter_t *description, + int color) +{ + const paper_adjustment_t *paper_adj = get_media_adjustment(v); + description->is_active = 1; + description->bounds.dbl.lower = 0; + description->bounds.dbl.upper = 1.0; + if (paper_adj) + description->deflt.dbl = paper_adj->subchannel_cutoff; + else + description->deflt.dbl = 1.0; +} + +static void set_color_transition_parameter(const stp_vars_t *v, stp_parameter_t *description, int color) @@ -1410,7 +1726,7 @@ set_color_transition_parameter(const stp_vars_t *v, ink_name->channel_set->channel_count == 4 && ink_name->channel_set->channels[color] && ink_name->channel_set->channels[color]->n_subchannels == 2) - fill_transition_parameters(description); + fill_transition_parameters(v, description, color); } } @@ -1424,11 +1740,53 @@ set_gray_transition_parameter(const stp_vars_t *v, if (ink_name && ink_name->channel_set->channels[STP_ECOLOR_K] && (ink_name->channel_set->channels[STP_ECOLOR_K]->n_subchannels == expected_channels)) - fill_transition_parameters(description); + fill_transition_parameters(v, description, STP_ECOLOR_K); else set_color_transition_parameter(v, description, STP_ECOLOR_K); } +static void +fill_scale_parameters(stp_parameter_t *description) +{ + description->is_active = 1; + description->bounds.dbl.lower = 0; + description->bounds.dbl.upper = 5.0; + description->deflt.dbl = 1.0; +} + +static void +set_color_scale_parameter(const stp_vars_t *v, + stp_parameter_t *description, + int color) +{ + description->is_active = 0; + if (stp_get_string_parameter(v, "PrintingMode") && + strcmp(stp_get_string_parameter(v, "PrintingMode"), "BW") != 0) + { + const escp2_inkname_t *ink_name = get_inktype(v); + if (ink_name && + ink_name->channel_set->channel_count == 4 && + ink_name->channel_set->channels[color] && + ink_name->channel_set->channels[color]->n_subchannels == 2) + fill_scale_parameters(description); + } +} + +static void +set_gray_scale_parameter(const stp_vars_t *v, + stp_parameter_t *description, + int expected_channels) +{ + const escp2_inkname_t *ink_name = get_inktype(v); + description->is_active = 0; + if (ink_name && ink_name->channel_set->channels[STP_ECOLOR_K] && + (ink_name->channel_set->channels[STP_ECOLOR_K]->n_subchannels == + expected_channels)) + fill_scale_parameters(description); + else + set_color_scale_parameter(v, description, STP_ECOLOR_K); +} + static const res_t * find_default_resolution(const stp_vars_t *v, const quality_t *q, int strict) @@ -1624,6 +1982,12 @@ escp2_parameters(const stp_vars_t *v, const char *name, if (strcmp(name, the_parameters[i].name) == 0) { stp_fill_parameter_settings(description, &(the_parameters[i])); + if (description->p_type == STP_PARAMETER_TYPE_INT) + { + description->deflt.integer = 0; + description->bounds.integer.upper = INT_MAX; + description->bounds.integer.lower = INT_MIN; + } break; } @@ -1764,8 +2128,12 @@ escp2_parameters(const stp_vars_t *v, const char *name, { const inklist_t *inks = escp2_inklist(v); int ninktypes = inks->n_inks; + int verified_inktypes = 0; + for (i = 0; i < ninktypes; i++) + if (verify_inktype(v, inks->inknames[i])) + verified_inktypes++; description->bounds.str = stp_string_list_create(); - if (ninktypes > 1) + if (verified_inktypes > 1) { stp_string_list_add_string(description->bounds.str, "None", _("Standard")); @@ -1945,6 +2313,62 @@ escp2_parameters(const stp_vars_t *v, const char *name, else description->is_active = 0; } + else if (strcmp(name, "DropSize1") == 0 || + strcmp(name, "DropSize2") == 0 || + strcmp(name, "DropSize3") == 0) + { + if (escp2_has_cap(v, MODEL_VARIABLE_DOT, MODEL_VARIABLE_YES)) + { + int resid = compute_resid(escp2_find_resolution(v)); + const escp2_dropsize_t *drops = escp2_dropsizes(v, resid); + if (strcmp(name, "DropSize1") == 0 && drops->numdropsizes >= 1) + description->deflt.dbl = drops->dropsizes[0]; + else if (strcmp(name, "DropSize2") == 0 && drops->numdropsizes >= 2) + description->deflt.dbl = drops->dropsizes[1]; + else if (strcmp(name, "DropSize3") == 0 && drops->numdropsizes >= 3) + description->deflt.dbl = drops->dropsizes[2]; + description->is_active = 1; + } + else + description->is_active = 0; + } + else if (strcmp(name, "BlackTrans") == 0 || + strcmp(name, "GCRLower") == 0 || + strcmp(name, "GCRUpper") == 0) + { + const paper_adjustment_t *paper_adj = get_media_adjustment(v); + if (paper_adj && + stp_get_string_parameter(v, "PrintingMode") && + strcmp(stp_get_string_parameter(v, "PrintingMode"), "BW") != 0) + { + if (paper_adj) + { + if (strcmp(name, "BlackTrans") == 0) + description->deflt.dbl = paper_adj->k_transition; + else if (strcmp(name, "GCRUpper") == 0) + description->deflt.dbl = paper_adj->k_upper; + else if (strcmp(name, "GCRLower") == 0) + description->deflt.dbl = paper_adj->k_lower; + } + } + else + description->p_type = STP_PARAMETER_TYPE_INVALID; + } + else if (strcmp(name, "GrayValue") == 0) + set_gray_value_parameter(v, description, 2); + else if (strcmp(name, "DarkGrayValue") == 0 || + strcmp(name, "LightGrayValue") == 0) + set_gray_value_parameter(v, description, 3); + else if (strcmp(name, "Gray1Value") == 0 || + strcmp(name, "Gray2Value") == 0 || + strcmp(name, "Gray3Value") == 0) + set_gray_value_parameter(v, description, 4); + else if (strcmp(name, "LightCyanValue") == 0) + set_color_value_parameter(v, description, STP_ECOLOR_C); + else if (strcmp(name, "LightMagentaValue") == 0) + set_color_value_parameter(v, description, STP_ECOLOR_M); + else if (strcmp(name, "DarkYellowValue") == 0) + set_color_value_parameter(v, description, STP_ECOLOR_Y); else if (strcmp(name, "GrayTransition") == 0) set_gray_transition_parameter(v, description, 2); else if (strcmp(name, "DarkGrayTransition") == 0 || @@ -1960,6 +2384,21 @@ escp2_parameters(const stp_vars_t *v, const char *name, set_color_transition_parameter(v, description, STP_ECOLOR_M); else if (strcmp(name, "DarkYellowTransition") == 0) set_color_transition_parameter(v, description, STP_ECOLOR_Y); + else if (strcmp(name, "GrayScale") == 0) + set_gray_scale_parameter(v, description, 2); + else if (strcmp(name, "DarkGrayScale") == 0 || + strcmp(name, "LightGrayScale") == 0) + set_gray_scale_parameter(v, description, 3); + else if (strcmp(name, "Gray1Scale") == 0 || + strcmp(name, "Gray2Scale") == 0 || + strcmp(name, "Gray3Scale") == 0) + set_gray_scale_parameter(v, description, 4); + else if (strcmp(name, "LightCyanScale") == 0) + set_color_scale_parameter(v, description, STP_ECOLOR_C); + else if (strcmp(name, "LightMagentaScale") == 0) + set_color_scale_parameter(v, description, STP_ECOLOR_M); + else if (strcmp(name, "DarkYellowScale") == 0) + set_color_scale_parameter(v, description, STP_ECOLOR_Y); else if (strcmp(name, "AlignmentPasses") == 0) { description->deflt.integer = escp2_alignment_passes(v); @@ -2188,6 +2627,10 @@ internal_imageable_area(const stp_vars_t *v, int use_paper_margins, } } } + if (width > escp2_max_imageable_width(v)) + width = escp2_max_imageable_width(v); + if (height > escp2_max_imageable_height(v)) + height = escp2_max_imageable_height(v); *left = left_margin; *right = width - right_margin; *top = top_margin; @@ -2546,14 +2989,38 @@ setup_inks(stp_vars_t *v) { escp2_privdata_t *pd = get_privdata(v); int i, j; - const escp2_dropsize_t *drops; + escp2_dropsize_t *drops; const escp2_inkname_t *ink_type = pd->inkname; const paper_adjustment_t *paper = pd->paper_adjustment; int gloss_channel = -1; double gloss_scale = get_double_param(v, "Density"); - drops = escp2_dropsizes(v, pd->ink_resid); + drops = escp2_copy_dropsizes(v, pd->ink_resid); stp_init_debug_messages(v); + if (stp_check_float_parameter(v, "DropSize1", STP_PARAMETER_ACTIVE)) + { + drops->dropsizes[0] = stp_get_float_parameter(v, "DropSize1"); + if (drops->dropsizes[0] > 0 && drops->numdropsizes < 1) + drops->numdropsizes = 1; + } + if (stp_check_float_parameter(v, "DropSize2", STP_PARAMETER_ACTIVE)) + { + drops->dropsizes[1] = stp_get_float_parameter(v, "DropSize2"); + if (drops->dropsizes[1] > 0 && drops->numdropsizes < 2) + drops->numdropsizes = 2; + } + if (stp_check_float_parameter(v, "DropSize3", STP_PARAMETER_ACTIVE)) + { + drops->dropsizes[2] = stp_get_float_parameter(v, "DropSize3"); + if (drops->dropsizes[2] > 0 && drops->numdropsizes < 3) + drops->numdropsizes = 3; + } + for (i = drops->numdropsizes - 1; i >= 0; i--) + { + if (drops->dropsizes[i] > 0) + break; + drops->numdropsizes--; + } for (i = 0; i < pd->logical_channels; i++) { const ink_channel_t *channel = ink_type->channel_set->channels[i]; @@ -2561,7 +3028,7 @@ setup_inks(stp_vars_t *v) { int hue_curve_found = 0; const char *param = channel->subchannels[0].channel_density; - const shade_t *shades = escp2_shades(v, i); + shade_t *shades = escp2_copy_shades(v, i); double userval = get_double_param(v, param); if (shades->n_shades < channel->n_subchannels) { @@ -2577,6 +3044,14 @@ setup_inks(stp_vars_t *v) gloss_channel = i; } } + for (j = 0; j < channel->n_subchannels; j++) + { + const char *subparam = + channel->subchannels[j].subchannel_value; + if (subparam && + stp_check_float_parameter(v, subparam, STP_PARAMETER_ACTIVE)) + shades->shades[j] = stp_get_float_parameter(v, subparam); + } stp_dither_set_inks(v, i, 1.0, ink_darknesses[i % 8], channel->n_subchannels, shades->shades, drops->numdropsizes, drops->dropsizes); @@ -2587,7 +3062,13 @@ setup_inks(stp_vars_t *v) double scale = userval * get_double_param(v, subparam); scale *= get_double_param(v, "Density"); stp_channel_set_density_adjustment(v, i, j, scale); - if (paper) + subparam = + channel->subchannels[j].subchannel_transition; + if (subparam && + stp_check_float_parameter(v, subparam, STP_PARAMETER_ACTIVE)) + stp_channel_set_cutoff_adjustment + (v, i, j, stp_get_float_parameter(v, subparam)); + else if (paper) stp_channel_set_cutoff_adjustment(v, i, j, paper->subchannel_cutoff); } @@ -2627,6 +3108,7 @@ setup_inks(stp_vars_t *v) } } } + escp2_free_shades(shades); } } if (pd->use_aux_channels) @@ -2640,7 +3122,7 @@ setup_inks(stp_vars_t *v) { int ch = i + base_count; const char *param = channel->subchannels[0].channel_density; - const shade_t *shades = escp2_shades(v, ch); + shade_t *shades = escp2_copy_shades(v, ch); double userval = get_double_param(v, param); if (shades->n_shades < channel->n_subchannels) { @@ -2652,6 +3134,14 @@ setup_inks(stp_vars_t *v) stp_channel_set_gloss_channel(v, ch); stp_channel_set_gloss_limit(v, gloss_scale); } + for (j = 0; j < channel->n_subchannels; j++) + { + const char *subparam = + channel->subchannels[j].subchannel_value; + if (subparam && + stp_check_float_parameter(v, subparam, STP_PARAMETER_ACTIVE)) + shades->shades[j] = stp_get_float_parameter(v, subparam); + } stp_dither_set_inks(v, ch, 1.0, ink_darknesses[ch % 8], channel->n_subchannels, shades->shades, drops->numdropsizes, drops->dropsizes); @@ -2662,7 +3152,13 @@ setup_inks(stp_vars_t *v) double scale = userval * get_double_param(v, subparam); scale *= get_double_param(v, "Density"); stp_channel_set_density_adjustment(v, ch, j, scale); - if (paper) + subparam = + channel->subchannels[j].subchannel_transition; + if (subparam && + stp_check_float_parameter(v, subparam, STP_PARAMETER_ACTIVE)) + stp_channel_set_cutoff_adjustment + (v, ch, j, stp_get_float_parameter(v, subparam)); + else if (paper) stp_channel_set_cutoff_adjustment(v, ch, j, paper->subchannel_cutoff); } @@ -2677,9 +3173,11 @@ setup_inks(stp_vars_t *v) stp_channel_set_curve(v, ch, curve_tmp); stp_curve_destroy(curve_tmp); } + escp2_free_shades(shades); } } } + escp2_free_dropsizes(drops); stp_flush_debug_messages(v); } diff --git a/src/main/print-escp2.h b/src/main/print-escp2.h index 4f88f4d..622b0ab 100644 --- a/src/main/print-escp2.h +++ b/src/main/print-escp2.h @@ -1,5 +1,5 @@ /* - * "$Id: print-escp2.h,v 1.105.6.4 2007/12/29 20:42:28 rlk Exp $" + * "$Id: print-escp2.h,v 1.117 2008/01/19 21:08:45 rlk Exp $" * * Print plug-in EPSON ESC/P2 driver for the GIMP. * @@ -68,7 +68,7 @@ typedef struct { const char *listname; short numdropsizes; - const double dropsizes[MAX_DROP_SIZES]; + double dropsizes[MAX_DROP_SIZES]; } escp2_dropsize_t; typedef const escp2_dropsize_t *escp2_drop_list_t[RES_N]; @@ -177,6 +177,8 @@ typedef struct short head_offset; short split_channel_count; const char *channel_density; + const char *subchannel_transition; + const char *subchannel_value; const char *subchannel_scale; const short split_channels[PHYSICAL_CHANNEL_LIMIT]; } physical_subchannel_t; @@ -227,7 +229,7 @@ typedef struct typedef struct { int n_shades; - const double shades[PHYSICAL_CHANNEL_LIMIT]; + double shades[PHYSICAL_CHANNEL_LIMIT]; } shade_t; typedef shade_t shade_set_t[PHYSICAL_CHANNEL_LIMIT]; @@ -407,7 +409,11 @@ typedef struct #define MODEL_INTERCHANGEABLE_INK_MASK 0x2000ul #define MODEL_INTERCHANGEABLE_INK_NO 0x0000ul -#define MODEL_INTERCHANGEABLE_INK_YES 0x1000ul +#define MODEL_INTERCHANGEABLE_INK_YES 0x2000ul + +#define MODEL_ENVELOPE_LANDSCAPE_MASK 0x4000ul +#define MODEL_ENVELOPE_LANDSCAPE_NO 0x0000ul +#define MODEL_ENVELOPE_LANDSCAPE_YES 0x4000ul typedef enum { @@ -421,6 +427,7 @@ typedef enum MODEL_SUPPORTS_INK_CHANGE, MODEL_PACKET_MODE, MODEL_INTERCHANGEABLE_INK, + MODEL_ENVELOPE_LANDSCAPE, MODEL_LIMIT } escp2_model_option_t; @@ -481,6 +488,8 @@ typedef struct escp2_printer int max_paper_height; /* Maximum paper height, in points */ int min_paper_width; /* Maximum paper width, in points */ int min_paper_height; /* Maximum paper height, in points */ + int max_imageable_width; /* Maximum imageable area, in points */ + int max_imageable_height; /* Maximum imageable area, in points */ /*****************************************************************************/ /* Borders */ /* SHEET FED: */ @@ -677,5 +686,5 @@ extern void stpi_escp2_terminate_page(stp_vars_t *v); #endif /* GUTENPRINT_INTERNAL_ESCP2_H */ /* - * End of "$Id: print-escp2.h,v 1.105.6.4 2007/12/29 20:42:28 rlk Exp $". + * End of "$Id: print-escp2.h,v 1.117 2008/01/19 21:08:45 rlk Exp $". */ diff --git a/src/main/print-lexmark.c b/src/main/print-lexmark.c index 69bc08f..005ed1e 100644 --- a/src/main/print-lexmark.c +++ b/src/main/print-lexmark.c @@ -1,6 +1,6 @@ /* - * "$Id: print-lexmark.c,v 1.154.8.1 2007/12/15 20:35:48 rlk Exp $" + * "$Id: print-lexmark.c,v 1.155 2007/08/27 00:44:12 rlk Exp $" * * Print plug-in Lexmark driver for the GIMP. * diff --git a/src/main/print-olympus.c b/src/main/print-olympus.c index e2ef864..29c4f20 100644 --- a/src/main/print-olympus.c +++ b/src/main/print-olympus.c @@ -1,5 +1,5 @@ /* - * "$Id: print-olympus.c,v 1.61.2.3 2007/12/29 20:42:28 rlk Exp $" + * "$Id: print-olympus.c,v 1.83 2007/12/27 20:34:28 rlk Exp $" * * Print plug-in DyeSub driver (formerly Olympus driver) for the GIMP. * @@ -39,8 +39,6 @@ #include <stdio.h> #include <limits.h> -#define STP_DBG_DYESUB STP_DBG_OLYMPUS - #ifdef __GNUC__ #define inline __inline__ #endif @@ -2670,16 +2668,16 @@ print_dyesub_module_exit(void) /* Module header */ -#define stp_module_version print_olympus_LTX_stp_module_version -#define stp_module_data print_olympus_LTX_stp_module_data +#define stp_module_version print_dyesub_LTX_stp_module_version +#define stp_module_data print_dyesub_LTX_stp_module_data stp_module_version_t stp_module_version = {0, 0}; stp_module_t stp_module_data = { - "olympus", + "dyesub", VERSION, - "Olympus family driver", + "DyeSub family driver", STP_MODULE_CLASS_FAMILY, NULL, print_dyesub_module_init, diff --git a/src/main/print-papers.c b/src/main/print-papers.c index 1164c27..79dd59a 100644 --- a/src/main/print-papers.c +++ b/src/main/print-papers.c @@ -1,5 +1,5 @@ /* - * "$Id: print-papers.c,v 1.35 2004/09/17 18:38:25 rleigh Exp $" + * "$Id: print-papers.c,v 1.38 2008/01/15 03:48:46 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * @@ -270,6 +270,7 @@ stp_xml_process_paper(stp_mxml_node_t *paper) /* The paper node */ "bottom", "top", "unit", + "type", NULL };*/ stp_papersize_t *outpaper; /* Generated paper */ @@ -300,6 +301,7 @@ stp_xml_process_paper(stp_mxml_node_t *paper) /* The paper node */ outpaper->left = 0; outpaper->bottom = 0; outpaper->right = 0; + outpaper->paper_size_type = PAPERSIZE_TYPE_STANDARD; if (outpaper->name) id = 1; @@ -378,10 +380,21 @@ stp_xml_process_paper(stp_mxml_node_t *paper) /* The paper node */ unit = 1; } } + if (!strcmp(prop_name, "type")) + { + stmp = stp_mxmlElementGetAttr(prop, "value"); + if (stmp) + { + if (!strcmp(stmp, "envelope")) + outpaper->paper_size_type = PAPERSIZE_TYPE_ENVELOPE; + else + outpaper->paper_size_type = PAPERSIZE_TYPE_STANDARD; + } + } } prop = prop->next; } - if (id && name && width && height && unit) /* Margins are optional */ + if (id && name && width && height && unit) /* Margins and type are optional */ return outpaper; stp_free(outpaper); outpaper = NULL; diff --git a/src/main/print-pcl.c b/src/main/print-pcl.c index 9a8fb2e..2455aa6 100644 --- a/src/main/print-pcl.c +++ b/src/main/print-pcl.c @@ -1,5 +1,5 @@ /* - * "$Id: print-pcl.c,v 1.145.2.1 2007/12/15 20:35:49 rlk Exp $" + * "$Id: print-pcl.c,v 1.150 2008/04/26 01:15:11 rlk Exp $" * * Print plug-in HP PCL driver for the GIMP. * @@ -199,6 +199,9 @@ static const pcl_t pcl_media_types[] = */ #define PAPERSOURCE_MOD 16 +#define PAPERSOURCE_340_MOD (PAPERSOURCE_MOD) +#define PAPERSOURCE_DJ_MOD (PAPERSOURCE_MOD << 1) +#define PAPERSOURCE_ADJ_GUIDE (PAPERSOURCE_MOD << 2) #define PCL_PAPERSOURCE_STANDARD 0 /* Don't output code */ #define PCL_PAPERSOURCE_MANUAL 2 @@ -209,20 +212,24 @@ static const pcl_t pcl_media_types[] = #define PCL_PAPERSOURCE_LJ_TRAY3 4 #define PCL_PAPERSOURCE_LJ_TRAY4 5 #define PCL_PAPERSOURCE_LJ_TRAY1 8 +#define PCL_PAPERSOURCE_LJ_TRAY1_ADJ (PCL_PAPERSOURCE_LJ_TRAY1 + PAPERSOURCE_ADJ_GUIDE) +#define PCL_PAPERSOURCE_LJ_TRAY2_ADJ (PCL_PAPERSOURCE_LJ_TRAY2 + PAPERSOURCE_ADJ_GUIDE) +#define PCL_PAPERSOURCE_LJ_TRAY3_ADJ (PCL_PAPERSOURCE_LJ_TRAY3 + PAPERSOURCE_ADJ_GUIDE) +#define PCL_PAPERSOURCE_LJ_TRAY4_ADJ (PCL_PAPERSOURCE_LJ_TRAY4 + PAPERSOURCE_ADJ_GUIDE) /* Deskjet 340 types */ -#define PCL_PAPERSOURCE_340_PCSF 1 + PAPERSOURCE_MOD +#define PCL_PAPERSOURCE_340_PCSF (1 + PAPERSOURCE_340_MOD) /* Portable sheet feeder for 340 */ -#define PCL_PAPERSOURCE_340_DCSF 4 + PAPERSOURCE_MOD +#define PCL_PAPERSOURCE_340_DCSF (4 + PAPERSOURCE_340_MOD) /* Desktop sheet feeder for 340 */ /* Other Deskjet types */ -#define PCL_PAPERSOURCE_DJ_TRAY 1 + PAPERSOURCE_MOD + PAPERSOURCE_MOD -#define PCL_PAPERSOURCE_DJ_TRAY2 4 + PAPERSOURCE_MOD + PAPERSOURCE_MOD +#define PCL_PAPERSOURCE_DJ_TRAY (1 + PAPERSOURCE_DJ_MOD) +#define PCL_PAPERSOURCE_DJ_TRAY2 (4 + PAPERSOURCE_DJ_MOD) /* Tray 2 for 2500 */ -#define PCL_PAPERSOURCE_DJ_OPTIONAL 5 + PAPERSOURCE_MOD + PAPERSOURCE_MOD +#define PCL_PAPERSOURCE_DJ_OPTIONAL (5 + PAPERSOURCE_DJ_MOD) /* Optional source for 2500 */ -#define PCL_PAPERSOURCE_DJ_AUTO 7 + PAPERSOURCE_MOD + PAPERSOURCE_MOD +#define PCL_PAPERSOURCE_DJ_AUTO (7 + PAPERSOURCE_DJ_MOD) /* Autoselect for 2500 */ static const pcl_t pcl_media_sources[] = @@ -230,9 +237,13 @@ static const pcl_t pcl_media_sources[] = { "Standard", N_ ("Standard"), PCL_PAPERSOURCE_STANDARD}, { "Manual", N_ ("Manual"), PCL_PAPERSOURCE_MANUAL}, /* {"Envelope", PCL_PAPERSOURCE_ENVELOPE}, */ + { "MultiPurposeAdj", N_ ("Tray 1 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY1_ADJ}, { "MultiPurpose", N_ ("Tray 1"), PCL_PAPERSOURCE_LJ_TRAY1}, + { "UpperAdj", N_ ("Tray 2 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY2_ADJ}, { "Upper", N_ ("Tray 2"), PCL_PAPERSOURCE_LJ_TRAY2}, + { "LowerAdj", N_ ("Tray 3 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY3_ADJ}, { "Lower", N_ ("Tray 3"), PCL_PAPERSOURCE_LJ_TRAY3}, + { "LargeCapacityAdj", N_ ("Tray 4 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY4_ADJ}, { "LargeCapacity", N_ ("Tray 4"), PCL_PAPERSOURCE_LJ_TRAY4}, { "Portable", N_ ("Portable Sheet Feeder"), PCL_PAPERSOURCE_340_PCSF}, { "Desktop", N_ ("Desktop Sheet Feeder"), PCL_PAPERSOURCE_340_DCSF}, @@ -611,9 +622,13 @@ static const short laserjet_papersources[] = { PCL_PAPERSOURCE_STANDARD, PCL_PAPERSOURCE_MANUAL, + PCL_PAPERSOURCE_LJ_TRAY1_ADJ, PCL_PAPERSOURCE_LJ_TRAY1, + PCL_PAPERSOURCE_LJ_TRAY2_ADJ, PCL_PAPERSOURCE_LJ_TRAY2, + PCL_PAPERSOURCE_LJ_TRAY3_ADJ, PCL_PAPERSOURCE_LJ_TRAY3, + PCL_PAPERSOURCE_LJ_TRAY4_ADJ, PCL_PAPERSOURCE_LJ_TRAY4, -1, }; @@ -1034,6 +1049,19 @@ static const pcl_cap_t pcl_model_capabilities[] = emptylist, laserjet_papersources, }, + /* PCL-4 with large paper */ + { 23, + 13 * 72, 19 * 72, + 1, 1, /* Min paper size */ + PCL_RES_150_150 | PCL_RES_300_300, + {12, 12, 18, 18}, + {12, 12, 10, 10}, /* Check/Fix */ + PCL_COLOR_NONE, + PCL_PRINTER_LJ, + ljbig_papersizes, + emptylist, + laserjet_papersources, + }, /* LaserJet III series */ { 3, 17 * 72 / 2, 14 * 72, @@ -1047,6 +1075,19 @@ static const pcl_cap_t pcl_model_capabilities[] = emptylist, laserjet_papersources, }, + /* LaserJet III series */ + { 31, + 17 * 72 / 2, 14 * 72, + 1, 1, /* Min paper size */ + PCL_RES_150_150 | PCL_RES_300_300, + {12, 12, 18, 18}, + {12, 12, 10, 10}, /* Check/Fix */ + PCL_COLOR_NONE, + PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE, + ljsmall_papersizes, + emptylist, + laserjet_papersources, + }, /* Some laser printers don't have expanded A4 margins */ { 32, 17 * 72 / 2, 14 * 72, @@ -1060,6 +1101,19 @@ static const pcl_cap_t pcl_model_capabilities[] = emptylist, laserjet_papersources, }, + /* PCL-5 with large paper */ + { 33, + 13 * 72, 19 * 72, + 1, 1, /* Min paper size */ + PCL_RES_150_150 | PCL_RES_300_300, + {12, 12, 18, 18}, + {12, 12, 10, 10}, /* Check/Fix */ + PCL_COLOR_NONE, + PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE, + ljbig_papersizes, + emptylist, + laserjet_papersources, + }, /* LaserJet 4L */ { 4, 17 * 72 / 2, 14 * 72, @@ -1114,6 +1168,20 @@ static const pcl_cap_t pcl_model_capabilities[] = emptylist, laserjet_papersources, }, + /* PCL-5c/5e/6/XL with large paper */ + { 61, + 13 * 72, 19 * 72, + 1, 1, /* Min paper size */ + PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, + {12, 12, 18, 18}, + {12, 12, 10, 10}, /* Check/Fix */ + PCL_COLOR_NONE, + PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | + PCL_PRINTER_DUPLEX, + ljbig_papersizes, + emptylist, + laserjet_papersources, + }, /* Some laser printers don't have expanded A4 margins */ { 62, 17 * 72 / 2, 14 * 72, @@ -2079,6 +2147,8 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image) const stp_papersize_t *pp; int the_top_margin, /* Corrected top margin */ the_left_margin; /* Corrected left margin */ + int manual_feed_left_adjust = 0; + int extra_left_margin = 0; stp_curve_t *lum_adjustment; stp_curve_t *hue_adjustment; double density; @@ -2264,6 +2334,12 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image) /* Correct the value by taking the modulus */ + if ((pcl_media_source & PAPERSOURCE_ADJ_GUIDE) == + PAPERSOURCE_ADJ_GUIDE) + { + manual_feed_left_adjust = 1; + stp_deprintf(STP_DBG_PCL, "Adjusting left margin for manual feed.\n"); + } pcl_media_source = pcl_media_source % PAPERSOURCE_MOD; stp_zprintf(v, "\033&l%dH", pcl_media_source); } @@ -2454,8 +2530,26 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image) stp_deprintf(STP_DBG_PCL, "left %d margin %d top %d margin %d width %d height %d\n", left, the_left_margin, top, the_top_margin, out_width, out_height); + if (manual_feed_left_adjust) + { + unsigned wdelta = caps->custom_max_width - stp_get_page_width(v); + if (wdelta > 0) + { + /* + * Why 3? I would expect it would be 2 here, but it appears + * that at least one printer (LJ 1022) actually partially + * adjusts the margin itself. Adjusting the left margin by 1/3 + * of the difference between the maximum width and the actual + * width experimentally yields correct results -- rlk 20081014 + */ + stp_deprintf(STP_DBG_PCL, + " Adjusting manual feed left margin by %d\n", wdelta / 3); + extra_left_margin += wdelta / 3; + } + } + if (!privdata.do_cretb) { - stp_zprintf(v, "\033&a%dH", 10 * left); /* Set left raster position */ + stp_zprintf(v, "\033&a%dH", 10 * (left + extra_left_margin)); /* Set left raster position */ stp_zprintf(v, "\033&a%dV", 10 * (top + the_top_margin)); /* Set top raster position */ } @@ -2466,7 +2560,7 @@ pcl_do_print(stp_vars_t *v, stp_image_t *image) { /* Move to top left of printed area */ stp_zprintf(v, "\033*p%dY", (top + the_top_margin)*4); /* Measured in dots. */ - stp_zprintf(v, "\033*p%dX", left*4); + stp_zprintf(v, "\033*p%dX", (left + extra_left_margin)*4); } stp_puts("\033*r1A", v); /* Start GFX */ diff --git a/src/main/print-ps.c b/src/main/print-ps.c index 3bff8a4..c12bbc2 100644 --- a/src/main/print-ps.c +++ b/src/main/print-ps.c @@ -1,5 +1,5 @@ /* - * "$Id: print-ps.c,v 1.87.8.2 2007/12/15 20:35:49 rlk Exp $" + * "$Id: print-ps.c,v 1.99 2007/12/24 03:05:52 rlk Exp $" * * Print plug-in Adobe PostScript driver for the GIMP. * @@ -39,6 +39,8 @@ #include <limits.h> #endif #include <stdio.h> +#include <unistd.h> +#include "xmlppd.h" #ifdef _MSC_VER #define strncasecmp(s,t,n) _strnicmp(s,t,n) @@ -49,8 +51,8 @@ * Local variables... */ -static FILE *ps_ppd = NULL; -static const char *ps_ppd_file = NULL; +static char *m_ppd_file = NULL; +static stp_mxml_node_t *m_ppd = NULL; /* @@ -59,47 +61,22 @@ static const char *ps_ppd_file = NULL; static void ps_hex(const stp_vars_t *, unsigned short *, int); static void ps_ascii85(const stp_vars_t *, unsigned short *, int, int); -static char *ppd_find(const char *, const char *, const char *, int *); static const stp_parameter_t the_parameters[] = { { - "PageSize", N_("Page Size"), N_("Basic Printer Setup"), - N_("Size of the paper being printed to"), - STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_CORE, - STP_PARAMETER_LEVEL_BASIC, 1, 1, -1, 1, 0 - }, - { - "MediaType", N_("Media Type"), N_("Basic Printer Setup"), - N_("Type of media (plain paper, photo paper, etc.)"), - STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, - STP_PARAMETER_LEVEL_BASIC, 1, 1, -1, 1, 0 - }, - { - "InputSlot", N_("Media Source"), N_("Basic Printer Setup"), - N_("Source (input slot) of the media"), - STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, - STP_PARAMETER_LEVEL_BASIC, 1, 1, -1, 1, 0 - }, - { - "Resolution", N_("Resolution"), N_("Basic Printer Setup"), - N_("Resolution and quality of the print"), - STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, - STP_PARAMETER_LEVEL_BASIC, 1, 1, -1, 1, 0 - }, - { - "InkType", N_("Ink Type"), N_("Advanced Printer Setup"), - N_("Type of ink in the printer"), - STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, - STP_PARAMETER_LEVEL_BASIC, 1, 1, -1, 1, 0 - }, - { "PPDFile", N_("PPDFile"), N_("Basic Printer Setup"), N_("PPD File"), STP_PARAMETER_TYPE_FILE, STP_PARAMETER_CLASS_FEATURE, STP_PARAMETER_LEVEL_BASIC, 1, 1, -1, 1, 0 }, { + "ModelName", N_("Model Name"), N_("Basic Printer Setup"), + N_("PPD File Model Name"), + STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_CORE, + STP_PARAMETER_LEVEL_INTERNAL, 0, 0, -1, 0, 0 + }, + { "PrintingMode", N_("Printing Mode"), N_("Core Parameter"), N_("Printing Output Mode"), STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_CORE, @@ -110,17 +87,176 @@ static const stp_parameter_t the_parameters[] = static const int the_parameter_count = sizeof(the_parameters) / sizeof(const stp_parameter_t); +static int +ps_option_to_param(stp_parameter_t *param, stp_mxml_node_t *option) +{ + const char *group_text = stp_mxmlElementGetAttr(option, "grouptext"); + + if (group_text != NULL) + param->category = group_text; + else + param->category = NULL; + + param->text = stp_mxmlElementGetAttr(option, "text"); + param->help = stp_mxmlElementGetAttr(option, "text"); + if (stp_mxmlElementGetAttr(option, "stptype")) + { + const char *default_value = stp_mxmlElementGetAttr(option, "default"); + double stp_default_value = strtod(stp_mxmlElementGetAttr(option, "stpdefault"), 0); + double lower_bound = strtod(stp_mxmlElementGetAttr(option, "stplower"), NULL); + double upper_bound = strtod(stp_mxmlElementGetAttr(option, "stpupper"), NULL); + param->p_type = atoi(stp_mxmlElementGetAttr(option, "stptype")); + param->is_mandatory = atoi(stp_mxmlElementGetAttr(option, "stpmandatory")); + param->p_class = atoi(stp_mxmlElementGetAttr(option, "stpclass")); + param->p_level = atoi(stp_mxmlElementGetAttr(option, "stplevel")); + param->channel = (unsigned char) atoi(stp_mxmlElementGetAttr(option, "stpchannel")); + param->read_only = 0; + param->is_active = 1; + param->verify_this_parameter = 1; + param->name = stp_mxmlElementGetAttr(option, "stpname"); + stp_deprintf(STP_DBG_PS, + "Gutenprint parameter %s type %d mandatory %d class %d level %d channel %d default %s %f", + param->name, param->p_type, param->is_mandatory, + param->p_class, param->p_level, param->channel, + default_value, stp_default_value); + switch (param->p_type) + { + case STP_PARAMETER_TYPE_DOUBLE: + param->deflt.dbl = stp_default_value; + param->bounds.dbl.upper = upper_bound; + param->bounds.dbl.lower = lower_bound; + stp_deprintf(STP_DBG_PS, " %.3f %.3f %.3f\n", + param->deflt.dbl, param->bounds.dbl.upper, + param->bounds.dbl.lower); + break; + case STP_PARAMETER_TYPE_DIMENSION: + param->deflt.dimension = atoi(default_value); + param->bounds.dimension.upper = (int) upper_bound; + param->bounds.dimension.lower = (int) lower_bound; + stp_deprintf(STP_DBG_PS, " %d %d %d\n", + param->deflt.dimension, param->bounds.dimension.upper, + param->bounds.dimension.lower); + break; + case STP_PARAMETER_TYPE_INT: + param->deflt.integer = atoi(default_value); + param->bounds.integer.upper = (int) upper_bound; + param->bounds.integer.lower = (int) lower_bound; + stp_deprintf(STP_DBG_PS, " %d %d %d\n", + param->deflt.integer, param->bounds.integer.upper, + param->bounds.integer.lower); + break; + case STP_PARAMETER_TYPE_BOOLEAN: + param->deflt.boolean = strcasecmp(default_value, "true") == 0 ? 1 : 0; + stp_deprintf(STP_DBG_PS, " %d\n", param->deflt.boolean); + break; + default: + stp_deprintf(STP_DBG_PS, "\n"); + break; + } + } + else + { + const char *ui = stp_mxmlElementGetAttr(option, "ui"); + param->name = stp_mxmlElementGetAttr(option, "name"); + if (strcasecmp(ui, "Boolean") == 0) + param->p_type = STP_PARAMETER_TYPE_BOOLEAN; + else + param->p_type = STP_PARAMETER_TYPE_STRING_LIST; + if (strcmp(param->name, "PageSize") == 0) + param->p_class = STP_PARAMETER_CLASS_CORE; + else + param->p_class = STP_PARAMETER_CLASS_FEATURE; + param->p_level = STP_PARAMETER_LEVEL_BASIC; + param->is_mandatory = 1; + param->is_active = 1; + param->channel = -1; + param->verify_this_parameter = 1; + param->read_only = 0; + } + + return 0; +} + /* * 'ps_parameters()' - Return the parameter values for the given parameter. */ +static int +check_ppd_file(const stp_vars_t *v) +{ + const char *ppd_file = stp_get_file_parameter(v, "PPDFile"); + + if (ppd_file == NULL || ppd_file[0] == 0) + { + stp_dprintf(STP_DBG_PS, v, "Empty PPD file\n"); + return 0; + } + else if (m_ppd_file && strcmp(m_ppd_file, ppd_file) == 0) + { + stp_dprintf(STP_DBG_PS, v, "Not replacing PPD file %s\n", m_ppd_file); + return 1; + } + else + { + stp_dprintf(STP_DBG_PS, v, "Replacing PPD file %s with %s\n", + m_ppd_file ? m_ppd_file : "(null)", + ppd_file ? ppd_file : "(null)"); + if (m_ppd != NULL) + stp_mxmlDelete(m_ppd); + m_ppd = NULL; + + if (m_ppd_file) + stp_free(m_ppd_file); + m_ppd_file = NULL; + + if ((m_ppd = stpi_xmlppd_read_ppd_file(ppd_file)) == NULL) + { + stp_eprintf(v, "Unable to open PPD file %s\n", ppd_file); + return 0; + } + + m_ppd_file = stp_strdup(ppd_file); + return 1; + } +} + + static stp_parameter_list_t ps_list_parameters(const stp_vars_t *v) { stp_parameter_list_t *ret = stp_parameter_list_create(); + stp_mxml_node_t *option; int i; + int status = check_ppd_file(v); + stp_dprintf(STP_DBG_PS, v, "Adding parameters from %s\n", + m_ppd_file ? m_ppd_file : "(null)"); + for (i = 0; i < the_parameter_count; i++) stp_parameter_list_add_param(ret, &(the_parameters[i])); + + if (status) + { + int num_options = stpi_xmlppd_find_option_count(m_ppd); + for (i=0; i < num_options; i++) + { + /* MEMORY LEAK!!! */ + stp_parameter_t *param = stp_malloc(sizeof(stp_parameter_t)); + option = stpi_xmlppd_find_option_index(m_ppd, i); + if (option) + { + ps_option_to_param(param, option); + if (param->p_type != STP_PARAMETER_TYPE_INVALID && + strcmp(param->name, "PageRegion") != 0) + { + stp_dprintf(STP_DBG_PS, v, "Adding parameter %s %s\n", + param->name, param->text); + stp_parameter_list_add_param(ret, param); + } + else + stp_free(param); + } + } + } return ret; } @@ -129,103 +265,116 @@ ps_parameters_internal(const stp_vars_t *v, const char *name, stp_parameter_t *description) { int i; - char line[1024], - lname[255], - loption[255], - *ltext; - const char *ppd_file = stp_get_file_parameter(v, "PPDFile"); + stp_mxml_node_t *option; + int status = 0; + int num_choices; + const char *defchoice; + description->p_type = STP_PARAMETER_TYPE_INVALID; description->deflt.str = 0; + description->is_active = 0; if (name == NULL) return; - if (ppd_file != NULL && strlen(ppd_file) > 0 && - (ps_ppd_file == NULL || strcmp(ps_ppd_file, ppd_file) != 0)) - { - if (ps_ppd != NULL) - fclose(ps_ppd); - - ps_ppd = fopen(ppd_file, "r"); - - if (ps_ppd == NULL) - ps_ppd_file = NULL; - else - ps_ppd_file = ppd_file; - } + status = check_ppd_file(v); for (i = 0; i < the_parameter_count; i++) + { if (strcmp(name, the_parameters[i].name) == 0) { stp_fill_parameter_settings(description, &(the_parameters[i])); - break; + if (strcmp(name, "PPDFile") == 0) + description->is_active = 1; + else if (strcmp(name, "ModelName") == 0) + { + if (m_ppd && stp_mxmlElementGetAttr(m_ppd, "nickname")) + { + const char *nickname = stp_mxmlElementGetAttr(m_ppd, "nickname"); + description->bounds.str = stp_string_list_create(); + stp_string_list_add_string(description->bounds.str, + nickname, nickname); + description->deflt.str = nickname; + description->is_active = status; + } + else + description->is_active = 0; + return; + } + else if (strcmp(name, "PrintingMode") == 0) + { + if (! m_ppd || strcmp(stp_mxmlElementGetAttr(m_ppd, "color"), "1") == 0) + { + description->bounds.str = stp_string_list_create(); + stp_string_list_add_string + (description->bounds.str, "Color", _("Color")); + stp_string_list_add_string + (description->bounds.str, "BW", _("Black and White")); + description->deflt.str = + stp_string_list_param(description->bounds.str, 0)->name; + description->is_active = 1; + } + else + description->is_active = 0; + return; + } } - if (strcmp(name, "PPDFile") == 0) - return; - - if (strcmp(name, "PrintingMode") == 0) - { - description->bounds.str = stp_string_list_create(); - stp_string_list_add_string - (description->bounds.str, "Color", _("Color")); - stp_string_list_add_string - (description->bounds.str, "BW", _("Black and White")); - description->deflt.str = - stp_string_list_param(description->bounds.str, 0)->name; - return; - } + } - if (ps_ppd == NULL) - { - if (strcmp(name, "PageSize") == 0) - { - int papersizes = stp_known_papersizes(); - description->bounds.str = stp_string_list_create(); - for (i = 0; i < papersizes; i++) - { - const stp_papersize_t *pt = stp_get_papersize_by_index(i); - if (strlen(pt->name) > 0) - stp_string_list_add_string - (description->bounds.str, pt->name, gettext(pt->text)); - } - description->deflt.str = - stp_string_list_param(description->bounds.str, 0)->name; - description->is_active = 1; - } - else if (strcmp(name, "PPDFile") == 0) - description->is_active = 1; - else - description->is_active = 0; - return; - } + if (!status) + return; + if ((option = stpi_xmlppd_find_option_named(m_ppd, name)) == NULL) + { + char *tmp = stp_malloc(strlen(name) + 4); + strcpy(tmp, "Stp"); + strncat(tmp, name, strlen(name) + 3); + if ((option = stpi_xmlppd_find_option_named(m_ppd, tmp)) == NULL) + { + stp_dprintf(STP_DBG_PS, v, "no parameter %s", name); + stp_free(tmp); + return; + } + stp_free(tmp); + } - rewind(ps_ppd); + ps_option_to_param(description, option); + if (description->p_type != STP_PARAMETER_TYPE_STRING_LIST) + return; + num_choices = atoi(stp_mxmlElementGetAttr(option, "num_choices")); + defchoice = stp_mxmlElementGetAttr(option, "default"); description->bounds.str = stp_string_list_create(); - while (fgets(line, sizeof(line), ps_ppd) != NULL) - { - if (line[0] != '*') - continue; + stp_dprintf(STP_DBG_PS, v, "describe parameter %s, output name=[%s] text=[%s] category=[%s] choices=[%d] default=[%s]\n", + name, description->name, description->text, + description->category, num_choices, defchoice); - if (sscanf(line, "*%s %[^:]", lname, loption) != 2) - continue; + /* Describe all choices for specified option. */ + for (i=0; i < num_choices; i++) + { + stp_mxml_node_t *choice = stpi_xmlppd_find_choice_index(option, i); + const char *choice_name = stp_mxmlElementGetAttr(choice, "name"); + const char *choice_text = stp_mxmlElementGetAttr(choice, "text"); + stp_string_list_add_string(description->bounds.str, choice_name, choice_text); + stp_dprintf(STP_DBG_PS, v, " parameter %s, choice %d [%s] [%s]", + name, i, choice_name, choice_text); + if (strcmp(choice_name, defchoice) == 0) + { + stp_dprintf(STP_DBG_PS, v, + " parameter %s, choice %d [%s] DEFAULT\n", + name, i, choice_name); + description->deflt.str = choice_name; + } + } - if (strcasecmp(lname, name) == 0) + if (!description->deflt.str) { - if ((ltext = strchr(loption, '/')) != NULL) - *ltext++ = '\0'; - else - ltext = loption; - - stp_string_list_add_string(description->bounds.str, loption, ltext); + stp_dprintf(STP_DBG_PS, v, + " parameter %s, defaulting to [%s]", + name, stp_string_list_param(description->bounds.str, 0)->name); + description->deflt.str = stp_string_list_param(description->bounds.str, 0)->name; } - } - if (stp_string_list_count(description->bounds.str) > 0) - description->deflt.str = - stp_string_list_param(description->bounds.str, 0)->name; - else - description->is_active = 0; + description->is_active = 1; return; } @@ -253,29 +402,35 @@ ps_media_size_internal(const stp_vars_t *v, /* I */ int *width, /* O - Width in points */ int *height) /* O - Height in points */ { - char *dimensions; /* Dimensions of media size */ const char *pagesize = stp_get_string_parameter(v, "PageSize"); - const char *ppd_file_name = stp_get_file_parameter(v, "PPDFile"); - float fwidth, fheight; + int status = check_ppd_file(v); if (!pagesize) pagesize = ""; stp_dprintf(STP_DBG_PS, v, "ps_media_size(%d, \'%s\', \'%s\', %p, %p)\n", - stp_get_model_id(v), ppd_file_name, pagesize, + stp_get_model_id(v), m_ppd_file, pagesize, (void *) width, (void *) height); - if ((dimensions = ppd_find(ppd_file_name, "PaperDimension", pagesize, NULL)) - != NULL) + stp_default_media_size(v, width, height); + + if (status) { - sscanf(dimensions, "%f%f", &fwidth, &fheight); - *width = (int) fwidth; - *height = (int) fheight; - stp_dprintf(STP_DBG_PS, v, "dimensions '%s' %f %f %d %d\n", - dimensions, fwidth, fheight, *width, *height); + stp_mxml_node_t *paper = stpi_xmlppd_find_page_size(m_ppd, pagesize); + if (paper) + { + *width = atoi(stp_mxmlElementGetAttr(paper, "width")); + *height = atoi(stp_mxmlElementGetAttr(paper, "height")); + } + else + { + *width = 0; + *height = 0; + } } - else - stp_default_media_size(v, width, height); + + stp_dprintf(STP_DBG_PS, v, "dimensions %d %d\n", *width, *height); + return; } static void @@ -304,55 +459,55 @@ ps_imageable_area_internal(const stp_vars_t *v, /* I */ int *bottom, /* O - Bottom position in points */ int *top) /* O - Top position in points */ { - char *area; /* Imageable area of media */ - float fleft, /* Floating point versions */ - fright, - fbottom, - ftop; int width, height; const char *pagesize = stp_get_string_parameter(v, "PageSize"); if (!pagesize) pagesize = ""; - ps_media_size(v, &width, &height); - if ((area = ppd_find(stp_get_file_parameter(v, "PPDFile"), - "ImageableArea", pagesize, NULL)) - != NULL) + /* Set some defaults. */ + ps_media_size_internal(v, &width, &height); + *left = 0; + *right = width; + *top = 0; + *bottom = height; + + if (check_ppd_file(v)) { - int status = sscanf(area, "%f%f%f%f", &fleft, &fbottom, &fright, &ftop); - stp_dprintf(STP_DBG_PS, v, - "area = \'%s\' status = %d l %f r %f b %f t %f h %d w %d\n", - area, status, fleft, fright, fbottom, ftop, width, height); - if (status) + stp_mxml_node_t *paper = stpi_xmlppd_find_page_size(m_ppd, pagesize); + if (paper) { - *left = (int) ceil((double) fleft); - *right = (int) floor((double) fright); - *bottom = (int) floor((double) height - fbottom); - *top = (int) ceil((double) height - ftop); - if (use_max_area) - { - if (*left > 0) - *left = 0; - if (*right < width) - *right = width; - if (*top > 0) - *top = 0; - if (*bottom < height) - *bottom = height; - } + double pleft = atoi(stp_mxmlElementGetAttr(paper, "left")); + double pright = atoi(stp_mxmlElementGetAttr(paper, "right")); + double ptop = atoi(stp_mxmlElementGetAttr(paper, "top")); + double pbottom = atoi(stp_mxmlElementGetAttr(paper, "bottom")); + stp_dprintf(STP_DBG_PS, v, "size=l %f r %f b %f t %f h %d w %d\n", + pleft, pright, pbottom, ptop, height, width); + *left = (int) pleft; + *right = (int) pright; + *top = height - (int) ptop; + *bottom = height - (int) pbottom; + stp_dprintf(STP_DBG_PS, v, ">>>> l %d r %d b %d t %d h %d w %d\n", + *left, *right, *bottom, *top, height, width); } - else - *left = *right = *bottom = *top = 0; - stp_dprintf(STP_DBG_PS, v, "l %d r %d b %d t %d h %d w %d\n", - *left, *right, *bottom, *top, width, height); } - else - { - *left = 0; - *right = width; - *top = 0; + + if (use_max_area) + { + if (*left > 0) + *left = 0; + if (*right < width) + *right = width; + if (*top > 0) + *top = 0; + if (*bottom < height) *bottom = height; - } + } + + stp_dprintf(STP_DBG_PS, v, "pagesize %s max_area=%d l %d r %d b %d t %d h %d w %d\n", + pagesize ? pagesize : "(null)", + use_max_area, *left, *right, *bottom, *top, width, height); + + return; } static void @@ -449,6 +604,135 @@ ps_describe_output(const stp_vars_t *v) return "Whitescale"; } +static stp_string_list_t * +ps_external_options(const stp_vars_t *v) +{ + stp_parameter_list_t param_list = ps_list_parameters(v); + stp_string_list_t *answer; + char *tmp; + char *ppd_name = NULL; + int i; +#ifdef HAVE_LOCALE_H + char *locale; +#endif + if (! param_list) + return NULL; + answer = stp_string_list_create(); +#ifdef HAVE_LOCALE_H + locale = stp_strdup(setlocale(LC_ALL, NULL)); + setlocale(LC_ALL, "C"); +#endif + for (i = 0; i < stp_parameter_list_count(param_list); i++) + { + const stp_parameter_t *param = stp_parameter_list_param(param_list, i); + stp_parameter_t desc; + stp_describe_parameter(v, param->name, &desc); + if (desc.is_active) + { + stp_mxml_node_t *option; + if (m_ppd && + (option = stpi_xmlppd_find_option_named(m_ppd, desc.name)) == NULL) + { + ppd_name = stp_malloc(strlen(desc.name) + 4); + strcpy(ppd_name, "Stp"); + strncat(ppd_name, desc.name, strlen(desc.name) + 3); + if ((option = stpi_xmlppd_find_option_named(m_ppd, ppd_name)) == NULL) + { + stp_dprintf(STP_DBG_PS, v, "no parameter %s", desc.name); + STP_SAFE_FREE(ppd_name); + } + } + switch (desc.p_type) + { + case STP_PARAMETER_TYPE_STRING_LIST: + if (stp_get_string_parameter(v, desc.name) && + strcmp(stp_get_string_parameter(v, desc.name), + desc.deflt.str)) + { + stp_dprintf(STP_DBG_PS, v, "Adding string parameter %s (%s): %s %s\n", + desc.name, ppd_name ? ppd_name : "(null)", + stp_get_string_parameter(v, desc.name), + desc.deflt.str); + stp_string_list_add_string(answer, + ppd_name ? ppd_name : desc.name, + stp_get_string_parameter(v, desc.name)); + } + break; + case STP_PARAMETER_TYPE_INT: + if (stp_get_int_parameter(v, desc.name) != desc.deflt.integer) + { + stp_dprintf(STP_DBG_PS, v, "Adding integer parameter %s (%s): %d %d\n", + desc.name, ppd_name ? ppd_name : "(null)", + stp_get_int_parameter(v, desc.name), + desc.deflt.integer); + stp_asprintf(&tmp, "%d", stp_get_int_parameter(v, desc.name)); + stp_string_list_add_string(answer, + ppd_name ? ppd_name : desc.name, + tmp); + stp_free(tmp); + } + break; + case STP_PARAMETER_TYPE_BOOLEAN: + if (stp_get_boolean_parameter(v, desc.name) != desc.deflt.boolean) + { + stp_dprintf(STP_DBG_PS, v, "Adding boolean parameter %s (%s): %d %d\n", + desc.name, ppd_name ? ppd_name : "(null)", + stp_get_boolean_parameter(v, desc.name), + desc.deflt.boolean); + stp_asprintf(&tmp, "%s", + stp_get_boolean_parameter(v, desc.name) ? + "True" : "False"); + stp_string_list_add_string(answer, + ppd_name ? ppd_name : desc.name, + tmp); + stp_free(tmp); + } + break; + case STP_PARAMETER_TYPE_DOUBLE: + if (fabs(stp_get_float_parameter(v, desc.name) - desc.deflt.dbl) > .00001) + { + stp_dprintf(STP_DBG_PS, v, "Adding float parameter %s (%s): %.3f %.3f\n", + desc.name, ppd_name ? ppd_name : "(null)", + stp_get_float_parameter(v, desc.name), + desc.deflt.dbl); + stp_asprintf(&tmp, "%.3f", + stp_get_float_parameter(v, desc.name)); + stp_string_list_add_string(answer, + ppd_name ? ppd_name : desc.name, + tmp); + stp_free(tmp); + } + break; + case STP_PARAMETER_TYPE_DIMENSION: + if (stp_get_dimension_parameter(v, desc.name) != + desc.deflt.dimension) + { + stp_dprintf(STP_DBG_PS, v, "Adding dimension parameter %s (%s): %d %d\n", + desc.name, ppd_name ? ppd_name : "(null)", + stp_get_dimension_parameter(v, desc.name), + desc.deflt.dimension); + stp_asprintf(&tmp, "%d", + stp_get_dimension_parameter(v, desc.name)); + stp_string_list_add_string(answer, + ppd_name ? ppd_name : desc.name, + tmp); + stp_free(tmp); + } + break; + default: + break; + } + STP_SAFE_FREE(ppd_name); + } + stp_parameter_description_destroy(&desc); + } +#ifdef HAVE_LOCALE_H + setlocale(LC_ALL, locale); + stp_free(locale); +#endif + return answer; +} + /* * 'ps_print()' - Print an image to a PostScript printer. */ @@ -458,17 +742,11 @@ ps_print_internal(stp_vars_t *v, stp_image_t *image) { int status = 1; int model = stp_get_model_id(v); - const char *ppd_file = stp_get_file_parameter(v, "PPDFile"); - const char *resolution = stp_get_string_parameter(v, "Resolution"); - const char *media_size = stp_get_string_parameter(v, "PageSize"); - const char *media_type = stp_get_string_parameter(v, "MediaType"); - const char *media_source = stp_get_string_parameter(v, "InputSlot"); const char *print_mode = stp_get_string_parameter(v, "PrintingMode"); const char *input_image_type = stp_get_string_parameter(v, "InputImageType"); unsigned short *out = NULL; int top = stp_get_top(v); int left = stp_get_left(v); - int i, j; /* Looping vars */ int y; /* Looping vars */ int page_left, /* Left margin of page */ page_right, /* Right margin of page */ @@ -485,30 +763,11 @@ ps_print_internal(stp_vars_t *v, stp_image_t *image) out_offset; /* Output offset (Level 2 output) */ time_t curtime; /* Current time of day */ unsigned zero_mask; - char *command; /* PostScript command */ - const char *temp; /* Temporary string pointer */ - int order, /* Order of command */ - num_commands; /* Number of commands */ - struct /* PostScript commands... */ - { - const char *keyword, *choice; - char *command; - int order; - } commands[4]; int image_height, image_width; int color_out = 0; int cmyk_out = 0; - if (!resolution) - resolution = ""; - if (!media_size) - media_size = ""; - if (!media_type) - media_type = ""; - if (!media_source) - media_source = ""; - if (print_mode && strcmp(print_mode, "Color") == 0) color_out = 1; if (color_out && @@ -571,104 +830,10 @@ ps_print_internal(stp_vars_t *v, stp_image_t *image) stp_puts("%%Orientation: Portrait\n", v); stp_puts("%%EndComments\n", v); - /* - * Find any printer-specific commands... - */ - - num_commands = 0; - - if ((command = ppd_find(ppd_file, "PageSize", media_size, &order)) != NULL) - { - commands[num_commands].keyword = "PageSize"; - commands[num_commands].choice = media_size; - commands[num_commands].command = stp_malloc(strlen(command) + 1); - strcpy(commands[num_commands].command, command); - commands[num_commands].order = order; - num_commands ++; - } - - if ((command = ppd_find(ppd_file, "InputSlot", media_source, &order)) != NULL) - { - commands[num_commands].keyword = "InputSlot"; - commands[num_commands].choice = media_source; - commands[num_commands].command = stp_malloc(strlen(command) + 1); - strcpy(commands[num_commands].command, command); - commands[num_commands].order = order; - num_commands ++; - } - - if ((command = ppd_find(ppd_file, "MediaType", media_type, &order)) != NULL) - { - commands[num_commands].keyword = "MediaType"; - commands[num_commands].choice = media_type; - commands[num_commands].command = stp_malloc(strlen(command) + 1); - strcpy(commands[num_commands].command, command); - commands[num_commands].order = order; - num_commands ++; - } - - if ((command = ppd_find(ppd_file, "Resolution", resolution, &order)) != NULL) - { - commands[num_commands].keyword = "Resolution"; - commands[num_commands].choice = resolution; - commands[num_commands].command = stp_malloc(strlen(command) + 1); - strcpy(commands[num_commands].command, command); - commands[num_commands].order = order; - num_commands ++; - } - - /* - * Sort the commands using the OrderDependency value... - */ - - for (i = 0; i < (num_commands - 1); i ++) - for (j = i + 1; j < num_commands; j ++) - if (commands[j].order < commands[i].order) - { - temp = commands[i].keyword; - commands[i].keyword = commands[j].keyword; - commands[j].keyword = temp; - - temp = commands[i].choice; - commands[i].choice = commands[j].choice; - commands[j].choice = temp; - - order = commands[i].order; - commands[i].order = commands[j].order; - commands[j].order = order; - - command = commands[i].command; - commands[i].command = commands[j].command; - commands[j].command = command; - } - - /* - * Send the commands... - */ - - if (num_commands > 0) - { - stp_puts("%%BeginSetup\n", v); - - for (i = 0; i < num_commands; i ++) - { - stp_puts("[{\n", v); - stp_zprintf(v, "%%%%BeginFeature: *%s %s\n", commands[i].keyword, - commands[i].choice); - if (commands[i].command[0]) - { - stp_puts(commands[i].command, v); - if (commands[i].command[strlen(commands[i].command) - 1] != '\n') - stp_puts("\n", v); - } - - stp_puts("%%EndFeature\n", v); - stp_puts("} stopped cleartomark\n", v); - stp_free(commands[i].command); - } - - stp_puts("%%EndSetup\n", v); - } +#if 0 + /* This is still not correct -- rlk 20070601 */ + ps_print_device_settings(v); +#endif /* * Output the page... @@ -996,93 +1161,6 @@ ps_ascii85(const stp_vars_t *v, /* I - File to print to */ } -/* - * 'ppd_find()' - Find a control string with the specified name & parameters. - */ - -static char * /* O - Control string */ -ppd_find(const char *ppd_file, /* I - Name of PPD file */ - const char *name, /* I - Name of parameter */ - const char *option, /* I - Value of parameter */ - int *order) /* O - Order of the control string */ -{ - char line[1024], /* Line from file */ - lname[255], /* Name from line */ - loption[255], /* Value from line */ - *opt; /* Current control string pointer */ - static char *value = NULL; /* Current control string value */ - - - if (ppd_file == NULL || name == NULL || option == NULL) - return (NULL); - if (!value) - value = stp_zalloc(32768); - - if (ps_ppd_file == NULL || strcmp(ps_ppd_file, ppd_file) != 0) - { - if (ps_ppd != NULL) - fclose(ps_ppd); - - ps_ppd = fopen(ppd_file, "r"); - - if (ps_ppd == NULL) - ps_ppd_file = NULL; - else - ps_ppd_file = ppd_file; - } - - if (ps_ppd == NULL) - return (NULL); - - if (order != NULL) - *order = 1000; - - rewind(ps_ppd); - while (fgets(line, sizeof(line), ps_ppd) != NULL) - { - if (line[0] != '*') - continue; - - if (strncasecmp(line, "*OrderDependency:", 17) == 0 && order != NULL) - { - sscanf(line, "%*s%d", order); - continue; - } - else if (sscanf(line, "*%s %[^/:]", lname, loption) != 2) - continue; - - if (strcasecmp(lname, name) == 0 && - strcasecmp(loption, option) == 0) - { - opt = strchr(line, ':') + 1; - while (*opt == ' ' || *opt == '\t') - opt ++; - if (*opt != '\"') - continue; - - strcpy(value, opt + 1); - if ((opt = strchr(value, '\"')) == NULL) - { - while (fgets(line, sizeof(line), ps_ppd) != NULL) - { - strcat(value, line); - if (strchr(line, '\"') != NULL) - { - strcpy(strchr(value, '\"'), "\n"); - break; - } - } - } - else - *opt = '\0'; - - return (value); - } - } - - return (NULL); -} - static const stp_printfuncs_t print_ps_printfuncs = { ps_list_parameters, @@ -1097,7 +1175,7 @@ static const stp_printfuncs_t print_ps_printfuncs = stp_verify_printer_params, NULL, NULL, - NULL + ps_external_options }; diff --git a/src/main/print-raw.c b/src/main/print-raw.c index 5f4c31f..c345ae1 100644 --- a/src/main/print-raw.c +++ b/src/main/print-raw.c @@ -1,5 +1,5 @@ /* - * "$Id: print-raw.c,v 1.38.8.1 2007/12/15 20:35:49 rlk Exp $" + * "$Id: print-raw.c,v 1.39 2007/08/27 00:44:12 rlk Exp $" * * Print plug-in RAW driver for the GIMP. * diff --git a/src/main/print-util.c b/src/main/print-util.c index e0ac696..ad4e4b9 100644 --- a/src/main/print-util.c +++ b/src/main/print-util.c @@ -1,5 +1,5 @@ /* - * "$Id: print-util.c,v 1.109.4.4 2007/12/15 20:35:49 rlk Exp $" + * "$Id: print-util.c,v 1.115 2007/09/02 18:11:51 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * diff --git a/src/main/print-vars.c b/src/main/print-vars.c index e3d4195..ae0c8e4 100644 --- a/src/main/print-vars.c +++ b/src/main/print-vars.c @@ -1,5 +1,5 @@ /* - * "$Id: print-vars.c,v 1.75.8.1 2007/05/29 01:47:29 rlk Exp $" + * "$Id: print-vars.c,v 1.81 2008/03/05 14:08:35 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * @@ -86,15 +86,14 @@ static int standard_vars_initialized = 0; static stp_vars_t default_vars; -static inline void -check_vars(const stp_vars_t *v) -{ - if (v == NULL) - { - stp_erprintf("Null stp_vars_t! Please report this bug.\n"); - stp_abort(); - } -} +#define CHECK_VARS(v) \ +do { \ + if (v == NULL) \ + { \ + stp_erprintf("Null stp_vars_t! Please report this bug.\n"); \ + stp_abort(); \ + } \ +} while (0) static const char * value_namefunc(const void *item) @@ -237,7 +236,7 @@ stp_allocate_component_data(stp_vars_t *v, { compdata_t *cd; stp_list_item_t *item; - check_vars(v); + CHECK_VARS(v); cd = stp_malloc(sizeof(compdata_t)); item = stp_list_get_item_by_name(v->internal_data, name); if (item) @@ -253,7 +252,7 @@ void stp_destroy_component_data(stp_vars_t *v, const char *name) { stp_list_item_t *item; - check_vars(v); + CHECK_VARS(v); item = stp_list_get_item_by_name(v->internal_data, name); if (item) stp_list_item_destroy(v->internal_data, item); @@ -263,7 +262,7 @@ void * stp_get_component_data(const stp_vars_t *v, const char *name) { stp_list_item_t *item; - check_vars(v); + CHECK_VARS(v); item = stp_list_get_item_by_name(v->internal_data, name); if (item) return ((compdata_t *) stp_list_item_get_data(item))->data; @@ -332,7 +331,7 @@ void stp_vars_destroy(stp_vars_t *v) { int i; - check_vars(v); + CHECK_VARS(v); for (i = 0; i < STP_PARAMETER_TYPE_INVALID; i++) stp_list_destroy(v->params[i]); stp_list_destroy(v->internal_data); @@ -345,7 +344,7 @@ stp_vars_destroy(stp_vars_t *v) void \ pre##_set_##s(stp_vars_t *v, const char *val) \ { \ - check_vars(v); \ + CHECK_VARS(v); \ if (val) \ stp_deprintf(STP_DBG_VARS, "set %s to %s (0x%p)\n", #s, val, \ (const void *) v); \ @@ -362,7 +361,7 @@ pre##_set_##s(stp_vars_t *v, const char *val) \ void \ pre##_set_##s##_n(stp_vars_t *v, const char *val, int n) \ { \ - check_vars(v); \ + CHECK_VARS(v); \ if (v->s == val) \ return; \ STP_SAFE_FREE(v->s); \ @@ -373,7 +372,7 @@ pre##_set_##s##_n(stp_vars_t *v, const char *val, int n) \ const char * \ pre##_get_##s(const stp_vars_t *v) \ { \ - check_vars(v); \ + CHECK_VARS(v); \ return v->s; \ } @@ -381,7 +380,7 @@ pre##_get_##s(const stp_vars_t *v) \ void \ pre##_set_##s(stp_vars_t *v, t val) \ { \ - check_vars(v); \ + CHECK_VARS(v); \ v->verified = 0; \ v->s = val; \ } \ @@ -389,7 +388,7 @@ pre##_set_##s(stp_vars_t *v, t val) \ t \ pre##_get_##s(const stp_vars_t *v) \ { \ - check_vars(v); \ + CHECK_VARS(v); \ return v->s; \ } @@ -409,14 +408,14 @@ DEF_FUNCS(errfunc, stp_outfunc_t, stp) void stp_set_verified(stp_vars_t *v, int val) { - check_vars(v); + CHECK_VARS(v); v->verified = val; } int stp_get_verified(const stp_vars_t *v) { - check_vars(v); + CHECK_VARS(v); return v->verified; } diff --git a/src/main/print-weave.c b/src/main/print-weave.c index d440ef1..ce79ee4 100644 --- a/src/main/print-weave.c +++ b/src/main/print-weave.c @@ -1,5 +1,5 @@ /* - * "$Id: print-weave.c,v 1.65.8.1 2007/03/02 12:01:32 rlk Exp $" + * "$Id: print-weave.c,v 1.68 2007/12/26 18:16:25 rlk Exp $" * * Softweave calculator for Gutenprint. * diff --git a/src/main/printers.c b/src/main/printers.c index 0820a22..4cb0bc8 100644 --- a/src/main/printers.c +++ b/src/main/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c,v 1.79.2.2 2007/12/15 20:35:50 rlk Exp $" + * "$Id: printers.c,v 1.83 2008/01/21 23:34:25 rlk Exp $" * * Print plug-in driver utility functions for the GIMP. * @@ -66,6 +66,7 @@ struct stp_printer char *family; /* Printer family */ char *manufacturer; /* Printer manufacturer */ int model; /* Model number */ + int vars_initialized; const stp_printfuncs_t *printfuncs; stp_vars_t *printvars; }; @@ -209,12 +210,6 @@ stpi_get_printfuncs(const stp_printer_t *printer) return printer->printfuncs; } -const stp_vars_t * -stp_printer_get_defaults(const stp_printer_t *printer) -{ - return printer->printvars; -} - const stp_printer_t * stp_get_printer_by_long_name(const char *long_name) @@ -357,7 +352,6 @@ stp_set_printer_defaults(stp_vars_t *v, const stp_printer_t *printer) void stp_initialize_printer_defaults(void) { - stp_list_item_t *printer_item; if (printer_list == NULL) { stpi_init_printer_list(); @@ -365,16 +359,19 @@ stp_initialize_printer_defaults(void) (STP_DBG_PRINTERS, "stpi_family_register(): initialising printer_list...\n"); } - printer_item = stp_list_get_start(printer_list); - while (printer_item) +} + +const stp_vars_t * +stp_printer_get_defaults(const stp_printer_t *printer) +{ + if (! printer->vars_initialized) { - stp_deprintf - (STP_DBG_PRINTERS, " ==>init %s\n", - ((stp_printer_t *)(stp_list_item_get_data(printer_item)))->driver); - set_printer_defaults - (((stp_printer_t *)(stp_list_item_get_data(printer_item)))->printvars, 1); - printer_item = stp_list_item_next(printer_item); + stp_printer_t *nc_printer = (stp_printer_t *) printer; + stp_deprintf(STP_DBG_PRINTERS, " ==>init %s\n", printer->driver); + set_printer_defaults (nc_printer->printvars, 1); + nc_printer->vars_initialized = 1; } + return printer->printvars; } void @@ -738,10 +735,6 @@ stp_verify_printer_params(stp_vars_t *v) errbuf_t errbuf; stp_outfunc_t ofunc = stp_get_errfunc(v); void *odata = stp_get_errdata(v); - - stp_dprintf(STP_DBG_VARS, v, "** Entering stp_verify_printer_params(0x%p)\n", - v); - stp_parameter_list_t params; int nparams; int i; @@ -749,6 +742,9 @@ stp_verify_printer_params(stp_vars_t *v) int left, top, bottom, right; const char *pagesize = stp_get_string_parameter(v, "PageSize"); + stp_dprintf(STP_DBG_VARS, v, "** Entering stp_verify_printer_params(0x%p)\n", + (void *) v); + stp_set_errfunc((stp_vars_t *) v, fill_buffer_writefunc); stp_set_errdata((stp_vars_t *) v, &errbuf); @@ -848,7 +844,7 @@ stp_verify_printer_params(stp_vars_t *v) stp_free(errbuf.data); } stp_dprintf(STP_DBG_VARS, v, "** Exiting stp_verify_printer_params(0x%p) => %d\n", - v, answer); + (void *) v, answer); return answer; } @@ -901,8 +897,7 @@ stp_family_register(stp_list_t *family) while(printer_item) { printer = (const stp_printer_t *) stp_list_item_get_data(printer_item); - if (!stp_list_get_item_by_name(printer_list, - stp_get_driver(printer->printvars))) + if (!stp_list_get_item_by_name(printer_list, printer->driver)) stp_list_item_create(printer_list, NULL, printer); printer_item = stp_list_item_next(printer_item); } @@ -934,8 +929,7 @@ stp_family_unregister(stp_list_t *family) { printer = (const stp_printer_t *) stp_list_item_get_data(printer_item); old_printer_item = - stp_list_get_item_by_name(printer_list, - stp_get_driver(printer->printvars)); + stp_list_get_item_by_name(printer_list, printer->driver); if (old_printer_item) stp_list_item_destroy(printer_list, old_printer_item); @@ -1075,10 +1069,10 @@ stp_printvars_create_from_xmltree(stp_mxml_node_t *printer, outprintvars->name = sbuf; prop = printer->child; stp_deprintf(STP_DBG_XML, ">>stp_printvars_create_from_xmltree: %p, %s\n", - outprintvars->printvars, outprintvars->name); + (void *) (outprintvars->printvars), outprintvars->name); stp_fill_printvars_from_xmltree(prop, outprintvars->printvars); stp_deprintf(STP_DBG_XML, "<<stp_printvars_create_from_xmltree: %p, %s\n", - outprintvars->printvars, outprintvars->name); + (void *) (outprintvars->printvars), outprintvars->name); return outprintvars; } diff --git a/src/main/printers.xml b/src/main/printers.xml index 8250426..e815c23 100644 --- a/src/main/printers.xml +++ b/src/main/printers.xml @@ -4,7 +4,7 @@ XML description of printers known to libgutenprint This file was originally generated. It should be edited by hand. - "$Id: printers.xml,v 1.157.4.8 2007/12/29 20:42:28 rlk Exp $" + "$Id: printers.xml,v 1.227 2008/04/26 01:15:12 rlk Exp $" --> <gutenprint xmlns="http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0" @@ -59,13 +59,6 @@ <parameter type="float" name="MagentaGamma">1.3</parameter> <parameter type="float" name="CyanGamma">1.3</parameter> </parameters> - <parameters name="PIXMA_iP4300_params"> - <parameter type="float" name="Brightness">0.7</parameter> - <parameter type="float" name="Density">0.6</parameter> - <parameter type="float" name="Contrast">1.7</parameter> - <parameter type="float" name="Gamma">0.9</parameter> - <parameter type="float" name="BlackGamma">0.6</parameter> - </parameters> <printer name="Canon BJ-30" driver="bjc-30" manufacturer="Canon" model="30" parameters="gamma_2_density_800_params" /> <printer name="Canon BJC-50" driver="bjc-50" manufacturer="Canon" model="4400" parameters="gamma_5_density_800_params" /> <printer name="Canon BJC-55" driver="bjc-55" manufacturer="Canon" model="4400" parameters="gamma_5_density_800_params" /> @@ -114,6 +107,7 @@ <printer name="Canon PIXMA iP5000" driver="bjc-PIXMA-iP5000" manufacturer="Canon" model="3004000" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA iP5200" driver="bjc-PIXMA-iP5200" manufacturer="Canon" model="3004200" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA iP5300" driver="bjc-PIXMA-iP5300" manufacturer="Canon" model="3005300" parameters="PIXMA_iP4000_params" /> + <printer name="Canon PIXMA iP6000D" driver="bjc-PIXMA-iP6000D" manufacturer="Canon" model="3006000" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA iP6700" driver="bjc-PIXMA-iP6700" manufacturer="Canon" model="3006700" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA iP8500" driver="bjc-PIXMA-iP8500" manufacturer="Canon" model="3008500" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA iX5000" driver="bjc-PIXMA-iX5000" manufacturer="Canon" model="4005000" parameters="PIXMA_iX5000_params" /> @@ -122,6 +116,7 @@ <printer name="Canon PIXMA MP170" driver="bjc-MULTIPASS-MP170" manufacturer="Canon" model="5000150" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA MP180" driver="bjc-MULTIPASS-MP180" manufacturer="Canon" model="5000150" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA MP500" driver="bjc-MULTIPASS-MP500" manufacturer="Canon" model="3004200" parameters="PIXMA_iP4000_params" /> + <printer name="Canon PIXMA MP520" driver="bjc-MULTIPASS-MP520" manufacturer="Canon" model="5000520" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA MP610" driver="bjc-MULTIPASS-MP610" manufacturer="Canon" model="3005300" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA MP700" driver="bjc-MULTIPASS-MP700" manufacturer="Canon" model="3003000" parameters="PIXMA_iP4000_params" /> <printer name="Canon PIXMA MP710" driver="bjc-MULTIPASS-MP710" manufacturer="Canon" model="3003000" parameters="PIXMA_iP4000_params" /> @@ -283,6 +278,8 @@ <printer name="Epson Stylus Photo R260" driver="escp2-r260" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo R265" driver="escp2-r265" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo R270" driver="escp2-r270" manufacturer="Epson" model="81" parameters="claria_params" /> + <printer name="Epson Stylus Photo R280" driver="escp2-r280" manufacturer="Epson" model="81" parameters="claria_params" /> + <printer name="Epson Stylus Photo R285" driver="escp2-r285" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo R300" driver="escp2-r300" manufacturer="Epson" model="63" parameters="standard_params" /> <printer name="Epson Stylus Photo R310" driver="escp2-r310" manufacturer="Epson" model="63" parameters="standard_params" /> <printer name="Epson Stylus Photo R320" driver="escp2-r320" manufacturer="Epson" model="63" parameters="standard_params" /> @@ -299,12 +296,15 @@ <printer name="Epson Stylus Photo RX510" driver="escp2-rx510" manufacturer="Epson" model="84" parameters="standard_params" /> <printer name="Epson Stylus Photo RX560" driver="escp2-rx560" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo RX580" driver="escp2-rx580" manufacturer="Epson" model="81" parameters="claria_params" /> + <printer name="Epson Stylus Photo RX585" driver="escp2-rx585" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo RX590" driver="escp2-rx590" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo RX595" driver="escp2-rx595" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo RX600" driver="escp2-rx600" manufacturer="Epson" model="84" parameters="standard_params" /> <printer name="Epson Stylus Photo RX620" driver="escp2-rx620" manufacturer="Epson" model="84" parameters="standard_params" /> <printer name="Epson Stylus Photo RX630" driver="escp2-rx630" manufacturer="Epson" model="84" parameters="standard_params" /> <printer name="Epson Stylus Photo RX640" driver="escp2-rx640" manufacturer="Epson" model="81" parameters="claria_params" /> + <printer name="Epson Stylus Photo RX680" driver="escp2-rx680" manufacturer="Epson" model="81" parameters="claria_params" /> + <printer name="Epson Stylus Photo RX685" driver="escp2-rx685" manufacturer="Epson" model="81" parameters="claria_params" /> <printer name="Epson Stylus Photo RX700" driver="escp2-rx700" manufacturer="Epson" model="70" parameters="standard_params" /> <printer name="Epson Stylus Photo R800" driver="escp2-r800" manufacturer="Epson" model="64" parameters="standard_params" /> <printer name="Epson Stylus Photo R1800" driver="escp2-r1800" manufacturer="Epson" model="67" parameters="standard_params" /> @@ -361,29 +361,49 @@ <printer name="Epson Stylus CX9400" driver="escp2-cx9400" manufacturer="Epson" model="65" parameters="cx3500_params" /> <printer name="Epson Stylus D68" driver="escp2-d68" manufacturer="Epson" model="66" parameters="standard_params" /> <printer name="Epson Stylus D88" driver="escp2-d88" manufacturer="Epson" model="69" parameters="standard_params" /> + <printer name="Epson Stylus D92" driver="escp2-d92" manufacturer="Epson" model="66" parameters="standard_params" /> <printer name="Epson Stylus D120" driver="escp2-d120" manufacturer="Epson" model="85" parameters="standard_params" /> <printer name="Epson Stylus DX3800" driver="escp2-dx3800" manufacturer="Epson" model="72" parameters="standard_params" /> <printer name="Epson Stylus DX3850" driver="escp2-dx3850" manufacturer="Epson" model="72" parameters="standard_params" /> <printer name="Epson Stylus DX4050" driver="escp2-dx4050" manufacturer="Epson" model="72" parameters="standard_params" /> <printer name="Epson Stylus DX4200" driver="escp2-dx4200" manufacturer="Epson" model="65" parameters="cx3500_params" /> <printer name="Epson Stylus DX4250" driver="escp2-dx4250" manufacturer="Epson" model="65" parameters="cx3500_params" /> + <printer name="Epson Stylus DX4400" driver="escp2-dx4400" manufacturer="Epson" model="72" parameters="standard_params" /> + <printer name="Epson Stylus DX4450" driver="escp2-dx4450" manufacturer="Epson" model="72" parameters="standard_params" /> <printer name="Epson Stylus DX4800" driver="escp2-dx4800" manufacturer="Epson" model="65" parameters="standard_params" /> + <printer name="Epson Stylus DX7000F" driver="escp2-dx7000f" manufacturer="Epson" model="65" parameters="cx3500_params" /> + <printer name="Epson Stylus DX7400" driver="escp2-dx7400" manufacturer="Epson" model="65" parameters="cx3500_params" /> + <printer name="Epson Stylus DX7450" driver="escp2-dx7450" manufacturer="Epson" model="65" parameters="cx3500_params" /> + <printer name="Epson Stylus DX8400" driver="escp2-dx8400" manufacturer="Epson" model="79" parameters="cx3500_params" /> + <printer name="Epson Stylus DX8450" driver="escp2-dx8450" manufacturer="Epson" model="79" parameters="cx3500_params" /> <printer name="Epson PictureMate" driver="escp2-picmate" manufacturer="Epson" model="73" parameters="standard_params" /> + <printer name="Epson PictureMate Dash" driver="escp2-picmatedash" manufacturer="Epson" model="86" parameters="standard_params" /> <printer name="Epson PictureMate Deluxe" driver="escp2-picmated" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson PictureMate Flash" driver="escp2-picmateflash" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson PictureMate Pal" driver="escp2-picmatepal" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson PictureMate Snap" driver="escp2-picmatesnap" manufacturer="Epson" model="73" parameters="standard_params" /> + <printer name="Epson PictureMate Flash" driver="escp2-picmateflash" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate Pal" driver="escp2-picmatepal" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate Snap" driver="escp2-picmatesnap" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 100" driver="escp2-picmate100" manufacturer="Epson" model="86" parameters="standard_params" /> <printer name="Epson PictureMate 200" driver="escp2-picmate200" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson PictureMate 210" driver="escp2-picmate210" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson PictureMate 240" driver="escp2-picmate240" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson PictureMate 250" driver="escp2-picmate250" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson PictureMate 280" driver="escp2-picmate280" manufacturer="Epson" model="73" parameters="standard_params" /> + <printer name="Epson PictureMate 210" driver="escp2-picmate210" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 240" driver="escp2-picmate240" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 250" driver="escp2-picmate250" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 260" driver="escp2-picmate260" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 270" driver="escp2-picmate270" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 280" driver="escp2-picmate280" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 290" driver="escp2-picmate290" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson PictureMate 500" driver="escp2-picmate500" manufacturer="Epson" model="73" parameters="standard_params" /> + <printer name="Epson PictureMate 2005" driver="escp2-picmate2005" manufacturer="Epson" model="73" parameters="standard_params" /> <printer name="Epson CL 700" driver="escp2-cl700" manufacturer="Epson" model="38" parameters="480_params" /> <printer name="Epson CL 750" driver="escp2-cl750" manufacturer="Epson" model="43" parameters="480_params" /> <printer name="Epson CL 760" driver="escp2-cl760" manufacturer="Epson" model="56" parameters="480_params" /> <printer name="Epson E 100" driver="escp2-e100" manufacturer="Epson" model="73" parameters="standard_params" /> - <printer name="Epson E 150" driver="escp2-e150" manufacturer="Epson" model="73" parameters="standard_params" /> + <printer name="Epson E 150" driver="escp2-e150" manufacturer="Epson" model="86" parameters="standard_params" /> <printer name="Epson E 200" driver="escp2-e200" manufacturer="Epson" model="73" parameters="standard_params" /> + <printer name="Epson E 300" driver="escp2-e300" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson E 500" driver="escp2-e500" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson E 520" driver="escp2-e520" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson E 700" driver="escp2-e700" manufacturer="Epson" model="86" parameters="standard_params" /> + <printer name="Epson E 720" driver="escp2-e720" manufacturer="Epson" model="86" parameters="standard_params" /> <printer name="Epson EM 900C" driver="escp2-em900c" manufacturer="Epson" model="13" parameters="standard_params" /> <printer name="Epson EM 930C" driver="escp2-em930c" manufacturer="Epson" model="34" parameters="standard_params" /> <printer name="Epson MC 2000" driver="escp2-mc2000" manufacturer="Epson" model="26" parameters="standard_params" /> @@ -533,10 +553,15 @@ <printer name="Fujitsu PrintPartner 20W" driver="fujitsu-pp_20w" manufacturer="Fujitsu" model="6" parameters="pcl_laser_params" /> <printer name="Fujitsu PrintPartner 8000" driver="fujitsu-pp_8000" manufacturer="Fujitsu" model="3" parameters="pcl_laser_params" /> <printer name="Generic PCL 4 Printer" driver="pcl-g_4" manufacturer="Generic" model="2" parameters="pcl_laser_params" /> + <printer name="Generic PCL 4 LF Printer" driver="pcl-g_4_l" manufacturer="Generic" model="23" parameters="pcl_laser_params" /> <printer name="Generic PCL 5 Printer" driver="pcl-g_5" manufacturer="Generic" model="3" parameters="pcl_laser_params" /> + <printer name="Generic PCL 5 LF Printer" driver="pcl-g_5_l" manufacturer="Generic" model="33" parameters="pcl_laser_params" /> <printer name="Generic PCL 5c Printer" driver="pcl-g_5c" manufacturer="Generic" model="6" parameters="pcl_laser_params" /> + <printer name="Generic PCL 5c LF Printer" driver="pcl-g_5c_l" manufacturer="Generic" model="61" parameters="pcl_laser_params" /> <printer name="Generic PCL 5e Printer" driver="pcl-g_5e" manufacturer="Generic" model="6" parameters="pcl_laser_params" /> + <printer name="Generic PCL 5e LF Printer" driver="pcl-g_5e_l" manufacturer="Generic" model="61" parameters="pcl_laser_params" /> <printer name="Generic PCL 6/PCL XL Printer" driver="pcl-g_6" manufacturer="Generic" model="6" parameters="pcl_laser_params" /> + <printer name="Generic PCL 6/PCL XL LF Printer" driver="pcl-g_6_l" manufacturer="Generic" model="61" parameters="pcl_laser_params" /> <printer name="HP Business Inkjet 2200" driver="hp-bij_2200" manufacturer="HP" model="900" parameters="pcl_inkjet_params" /> <printer name="HP Business Inkjet 2230" driver="hp-bij_2230" manufacturer="HP" model="900" parameters="pcl_inkjet_params" /> <printer name="HP Business Inkjet 2250" driver="hp-bij_2250" manufacturer="HP" model="900" parameters="pcl_inkjet_params" /> @@ -552,7 +577,7 @@ <printer name="HP Color LaserJet 5000" driver="hp-clj_5000" manufacturer="HP" model="6" parameters="pcl_laser_params" /> <printer name="HP Color LaserJet 5500" driver="hp-clj_5500" manufacturer="HP" model="6" parameters="pcl_laser_params" /> <printer name="HP Color LaserJet 8550GN" driver="hp-clj_8550gn" manufacturer="HP" model="6" parameters="pcl_laser_params" /> - <printer name="HP DesignJet 230" driver="pcl-desnj-230" manufacturer="HP" model="10230" parameters="pcl_inkjet_params" /> + <printer name="HP DesignJet 230" driver="pcl-desnj-230" manufacturer="HP" model="10230" parameters="pcl_inkjet_params" /> <printer name="HP DesignJet 250C" driver="pcl-desnj-250" manufacturer="HP" model="10250" parameters="pcl_inkjet_params" /> <printer name="HP DesignJet 430" driver="pcl-desnj-430" manufacturer="HP" model="10230" parameters="pcl_inkjet_params" /> <printer name="HP DesignJet 450C" driver="pcl-desnj-450" manufacturer="HP" model="10250" parameters="pcl_inkjet_params" /> @@ -924,7 +949,7 @@ <printer name="Lexmark Z52" driver="lexmark-z52" manufacturer="Lexmark" model="10052" parameters="standard_params" /> <printer name="Lexmark Z53" driver="lexmark-z53" manufacturer="Lexmark" model="10052" parameters="standard_params" /> </family> - <family name="olympus"> + <family name="dyesub"> <printer name="Olympus P-10" driver="olympus-p10" manufacturer="Olympus" model="2" /> <printer name="Olympus P-11" driver="olympus-p11" manufacturer="Olympus" model="2" /> <printer name="Olympus P-200" driver="olympus-p200" manufacturer="Olympus" model="4" /> diff --git a/src/main/sequence.c b/src/main/sequence.c index 09cb116..9cf5885 100644 --- a/src/main/sequence.c +++ b/src/main/sequence.c @@ -1,5 +1,5 @@ /* - * "$Id: sequence.c,v 1.23.2.1 2007/12/15 20:35:51 rlk Exp $" + * "$Id: sequence.c,v 1.25 2008/01/21 23:19:41 rlk Exp $" * * Sequence data type. This type is designed to be derived from by * the curve and dither matrix types. @@ -140,6 +140,24 @@ stp_sequence_copy(stp_sequence_t *dest, const stp_sequence_t *source) memcpy(dest->data, source->data, (sizeof(double) * source->size)); } +void +stp_sequence_reverse(stp_sequence_t *dest, const stp_sequence_t *source) +{ + int i; + check_sequence(dest); + check_sequence(source); + + dest->recompute_range = source->recompute_range; + dest->blo = source->blo; + dest->bhi = source->bhi; + dest->rlo = source->rlo; + dest->rhi = source->rhi; + dest->size = source->size; + dest->data = stp_zalloc(sizeof(double) * source->size); + for (i = 0; i < source->size; i++) + dest->data[i] = source->data[source->size - i - 1]; +} + stp_sequence_t * stp_sequence_create_copy(const stp_sequence_t *sequence) { @@ -150,6 +168,16 @@ stp_sequence_create_copy(const stp_sequence_t *sequence) return ret; } +stp_sequence_t * +stp_sequence_create_reverse(const stp_sequence_t *sequence) +{ + stp_sequence_t *ret; + check_sequence(sequence); + ret = stp_sequence_create(); + stp_sequence_reverse(ret, sequence); + return ret; +} + int stp_sequence_set_bounds(stp_sequence_t *sequence, double low, double high) { diff --git a/src/main/util.h b/src/main/util.h index 7a3fe61..91165e3 100644 --- a/src/main/util.h +++ b/src/main/util.h @@ -1,5 +1,5 @@ /* - * "$Id: util.h,v 1.33.10.1 2007/03/02 12:01:33 rlk Exp $" + * "$Id: util.h,v 1.34 2007/02/24 21:43:49 faust3 Exp $" * * Gutenprint header. * @@ -70,5 +70,5 @@ extern stp_image_t* stpi_buffer_image(stp_image_t* image, unsigned int flags); #endif /* GUTENPRINT_INTERNAL_UTIL_H */ /* - * End of "$Id: util.h,v 1.33.10.1 2007/03/02 12:01:33 rlk Exp $". + * End of "$Id: util.h,v 1.34 2007/02/24 21:43:49 faust3 Exp $". */ diff --git a/src/main/xml.c b/src/main/xml.c index c43b13b..5c38736 100644 --- a/src/main/xml.c +++ b/src/main/xml.c @@ -1,5 +1,5 @@ /* - * "$Id: xml.c,v 1.33.18.1 2007/05/29 01:47:30 rlk Exp $" + * "$Id: xml.c,v 1.38 2007/05/26 15:53:06 rlk Exp $" * * XML parser - process Gutenprint XML data with mxml. * diff --git a/src/main/xmlppd.c b/src/main/xmlppd.c new file mode 100644 index 0000000..6bd2611 --- /dev/null +++ b/src/main/xmlppd.c @@ -0,0 +1,530 @@ +/* + * "xmlppd.c" + * + * PPD to XML converter. + * + * Copyright 2007 by Michael R Sweet and Robert Krawitz + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <stdio.h> +#include <gutenprint/mxml.h> +#include <stdlib.h> +#include "xmlppd.h" + +typedef struct +{ + int order; + const char *name; +} order_t; + +static int +order_compare(const void *a, const void *b) +{ + const order_t *aa = (const order_t *)a; + const order_t *bb = (const order_t *)b; + if (aa->order < bb->order) + return -1; + else if (aa->order > bb->order) + return 1; + else + return strcmp(aa->name, bb->name); +} + + +static stp_mxml_node_t * +find_element_named(stp_mxml_node_t *root, const char *name, const char *what) +{ + stp_mxml_node_t *element; + if (root && name) + { + for (element = stp_mxmlFindElement(root, root, what, NULL, NULL, + STP_MXML_DESCEND); + element; + element = stp_mxmlFindElement(element, root, what, NULL, NULL, + STP_MXML_DESCEND)) + { + if (!strcmp(stp_mxmlElementGetAttr(element, "name"), name)) + return element; + } + } + return NULL; +} + +static stp_mxml_node_t * +find_element_index(stp_mxml_node_t *root, int idx, const char *what) +{ + stp_mxml_node_t *element; + int count = 0; + if (root && idx >= 0) + { + for (element = stp_mxmlFindElement(root, root, what, NULL, NULL, + STP_MXML_DESCEND); + element; + element = stp_mxmlFindElement(element, root, what, NULL, NULL, + STP_MXML_DESCEND)) + { + if (count++ == idx) + return element; + } + } + return NULL; +} + +static size_t +find_element_count(stp_mxml_node_t *root, const char *what) +{ + stp_mxml_node_t *element; + size_t count = 0; + if (root) + { + for (element = stp_mxmlFindElement(root, root, what, NULL, NULL, + STP_MXML_DESCEND); + element; + element = stp_mxmlFindElement(element, root, what, NULL, NULL, + STP_MXML_DESCEND)) + count++; + } + return count; +} + +stp_mxml_node_t * +stpi_xmlppd_find_group_named(stp_mxml_node_t *root, const char *name) +{ + return find_element_named(root, name, "group"); +} + +stp_mxml_node_t * +stpi_xmlppd_find_group_index(stp_mxml_node_t *root, int idx) +{ + return find_element_index(root, idx, "group"); +} + +int +stpi_xmlppd_find_group_count(stp_mxml_node_t *root) +{ + return find_element_count(root, "group"); +} + +stp_mxml_node_t * +stpi_xmlppd_find_option_named(stp_mxml_node_t *root, const char *name) +{ + return find_element_named(root, name, "option"); +} + +stp_mxml_node_t * +stpi_xmlppd_find_option_index(stp_mxml_node_t *root, int idx) +{ + return find_element_index(root, idx, "option"); +} + +int +stpi_xmlppd_find_option_count(stp_mxml_node_t *root) +{ + return find_element_count(root, "option"); +} + +stp_mxml_node_t * +stpi_xmlppd_find_choice_named(stp_mxml_node_t *option, const char *name) +{ + return find_element_named(option, name, "choice"); +} + +stp_mxml_node_t * +stpi_xmlppd_find_choice_index(stp_mxml_node_t *option, int idx) +{ + return find_element_index(option, idx, "choice"); +} + +int +stpi_xmlppd_find_choice_count(stp_mxml_node_t *option) +{ + return find_element_count(option, "choice"); +} + +stp_mxml_node_t * +stpi_xmlppd_find_page_size(stp_mxml_node_t *root, const char *name) +{ + return stpi_xmlppd_find_choice_named(stpi_xmlppd_find_option_named(root, "PageSize"), name); +} + +static void +parse_values(const char **data, int limit, char *value) +{ + int dptr = 0; + char *where = value; + char *end = value; + for (dptr = 0; dptr < limit; dptr++) + data[dptr] = NULL; + for (dptr = 0; *where && dptr < limit; dptr++) + { + where = end; + while (*where && isspace(*where)) + where++; + end = where; + while (*end && !isspace(*end)) + end++; + *end++ = '\0'; + data[dptr] = where; + } +} + +/* + * 'read_ppd_file()' - Read a PPD file into XML data. + */ + +stp_mxml_node_t * /* O - PPD file as XML */ +stpi_xmlppd_read_ppd_file(const char *filename) /* I - PPD file */ +{ + stp_mxml_node_t *ppd, /* Root node of "ppd" group */ + *group, /* Current group */ + *option, /* Current option */ + *choice; /* Current choice */ + FILE *fp; /* PPD file */ + int ch, /* Current character */ + sawcolon, /* Saw a colon? */ + inquote, /* In a quoted string? */ + num_choices = 0; + char buffer[32768], /* Line buffer */ + *bufptr, /* Pointer into line */ + *xptr, /* Pointer into line */ + option_name[42], /* Option name */ + stp_option_data_name[64], /* Option name */ + *keyword, /* Pointer to option keyword */ + *text, /* Pointer to text */ + *value; /* Pointer to value */ + order_t *order_array; /* Precedence order of options */ + int i; + int option_count; + int order_length; + char *order_list; + + + /* + * Open the file... + */ + + if ((fp = fopen(filename, "rb")) == NULL) + { + perror(filename); + return (NULL); + } + + /* + * Create the base PPD file tree; the completed tree will look like: + * + * <?xml version="1.0"?> + * <ppd color="0/1" level="1/2/3"> + * <option name="..." text="..." default="..." section="..." order="..." + * type="..."> + * <choice name="..." text="...">code</choice> + * ... + * </option> + * ... + * <group name="..." text="..."> + * <option ...> + * <choice ...>code</choice> + * </option> + * </group> + * </ppd> + */ + +/* xml = stp_mxmlNewXML("1.0"); */ +/* ppd = stp_mxmlNewElement(xml, "ppd"); */ + ppd = stp_mxmlNewElement(STP_MXML_NO_PARENT, "ppd"); + + stp_mxmlElementSetAttr(ppd, "color", "0"); + stp_mxmlElementSetAttr(ppd, "level", "2"); + + /* + * Read all of the lines of the form: + * + * *% comment + * *Keyword: value + * *Keyword OptionKeyword: value + * *Keyword OptionKeyword/Text: value + * + * Only save groups, options, and choices, along with specific metadata + * from the file... + */ + + group = NULL; + option = NULL; + option_name[0] = '\0'; + + while ((ch = getc(fp)) != EOF) + { + /* + * Read the line... + */ + + buffer[0] = ch; + bufptr = buffer + 1; + inquote = 0; + sawcolon = 0; + + while ((ch != '\n' || inquote) && bufptr < (buffer + sizeof(buffer) - 1)) + { + if ((ch = getc(fp)) == '\r') + { + if ((ch = getc(fp)) != '\n') + ungetc(ch, fp); + } + + *bufptr++ = ch; + + if (ch == ':' && !sawcolon) + sawcolon = 1; + else if (ch == '\"' && sawcolon) + inquote = !inquote; + } + + /* + * Strip trailing whitespace... + */ + + for (bufptr --; bufptr > buffer && isspace(bufptr[-1] & 255); bufptr --); + + *bufptr = '\0'; + + /* + * Now parse it... + */ + + if (!strncmp(buffer, "*%", 2) || !buffer[0]) + continue; + + if ((value = strchr(buffer, ':')) == NULL) + continue; + + for (*value++ = '\0'; + *value && (isspace(*value & 255) || (*value & 255) == '"'); + value ++); + for (xptr = value; + *xptr && (*xptr & 255) != '"'; + xptr ++); + if (*xptr == '"') + *xptr = '\0'; + + for (keyword = buffer; *keyword && !isspace(*keyword & 255); keyword ++); + + while (isspace(*keyword & 255)) + *keyword++ = '\0'; + + if ((text = strchr(keyword, '/')) != NULL) + *text++ = '\0'; + + /* + * And then use the parsed values... + */ + + if (!strcmp(buffer, "*ColorDevice")) + { + /* + * Color support... + */ + + if (!strcasecmp(value, "true")) + stp_mxmlElementSetAttr(ppd, "color", "1"); + else + stp_mxmlElementSetAttr(ppd, "color", "0"); + } + else if (!strcmp(buffer, "*LanguageLevel") && atoi(value) > 0) + { + /* + * PostScript language level... + */ + + stp_mxmlElementSetAttr(ppd, "level", value); + } + else if (!strcmp(buffer, "*StpDriverName")) + stp_mxmlElementSetAttr(ppd, "driver", value); + else if (!strcmp(buffer, "*ModelName")) + stp_mxmlElementSetAttr(ppd, "modelname", value); + else if (!strcmp(buffer, "*ShortNickName")) + stp_mxmlElementSetAttr(ppd, "shortnickname", value); + else if (!strcmp(buffer, "*NickName")) + stp_mxmlElementSetAttr(ppd, "nickname", value); + else if (!strcmp(buffer, "*OpenGroup")) + { + if ((text = strchr(value, '/')) != NULL) + *text++ = '\0'; + + group = stp_mxmlNewElement(ppd, "group"); + stp_mxmlElementSetAttr(group, "name", value); + stp_mxmlElementSetAttr(group, "text", text ? text : value); + } + else if (!strcmp(buffer, "*CloseGroup")) + group = NULL; + else if ((!strcmp(buffer, "*OpenUI") || !strcmp(buffer, "*JCLOpenUI")) && + keyword[0] == '*' && keyword[1]) + { + /* + * Start a new option... + */ + + option = stp_mxmlNewElement(group ? group : ppd, "option"); + stp_mxmlElementSetAttr(option, "name", keyword + 1); + stp_mxmlElementSetAttr(option, "text", text ? text : keyword + 1); + stp_mxmlElementSetAttr(option, "ui", value); + + strncpy(option_name, keyword, sizeof(option_name) - 1); + option_name[sizeof(option_name) - 1] = '\0'; + strcpy(stp_option_data_name, "*Stp"); + strcpy(stp_option_data_name + 4, option_name + 1); + if (group) + { + stp_mxmlElementSetAttr(option, "groupname", stp_mxmlElementGetAttr(group, "name")); + stp_mxmlElementSetAttr(option, "grouptext", stp_mxmlElementGetAttr(group, "text")); + } + num_choices = 0; + } + else if (option && !strcmp(buffer, stp_option_data_name)) + { + const char *data[8]; + parse_values(data, 8, value); + if (data[7]) + { + stp_mxmlElementSetAttr(option, "stptype", data[0]); + stp_mxmlElementSetAttr(option, "stpmandatory", data[1]); + stp_mxmlElementSetAttr(option, "stpclass", data[2]); + stp_mxmlElementSetAttr(option, "stplevel", data[3]); + stp_mxmlElementSetAttr(option, "stpchannel", data[4]); + stp_mxmlElementSetAttr(option, "stplower", data[5]); + stp_mxmlElementSetAttr(option, "stpupper", data[6]); + stp_mxmlElementSetAttr(option, "stpdefault", data[7]); + stp_mxmlElementSetAttr(option, "stpname", stp_option_data_name + 7); + } + } + else if (!strcmp(buffer, "*OrderDependency") && option) + { + /* + * Get order and section for option + */ + + char order[256], /* Order number */ + section[256]; /* Section name */ + + + if (sscanf(value, "%255s%255s", order, section) == 2) + { + stp_mxmlElementSetAttr(option, "order", order); + stp_mxmlElementSetAttr(option, "section", section); + } + } + else if (!strncmp(buffer, "*Default", 8) && option && + !strcmp(buffer + 8, option_name + 1)) + stp_mxmlElementSetAttr(option, "default", value); + else if (!strcmp(buffer, "*CloseUI") || !strcmp(buffer, "*JCLCloseUI")) + { + char buf[64]; + (void) sprintf(buf, "%d", num_choices); + stp_mxmlElementSetAttr(option, "num_choices", buf); + option = NULL; + stp_option_data_name[0] = '\0'; + } + else if (option && !strcmp(buffer, option_name)) + { + /* + * A choice... + */ + + choice = stp_mxmlNewElement(option, "choice"); + stp_mxmlElementSetAttr(choice, "name", keyword); + stp_mxmlElementSetAttr(choice, "text", text ? text : keyword); + + if (value[0] == '\"') + value ++; + + if (bufptr > buffer && bufptr[-1] == '\"') + { + bufptr --; + *bufptr = '\0'; + } + + stp_mxmlNewOpaque(choice, value); + num_choices++; + } + else if (!option && !strcmp(buffer, "*ImageableArea")) + { + stp_mxml_node_t *psize = stpi_xmlppd_find_page_size(ppd, keyword); + if (psize) + { + const char *data[4]; + parse_values(data, 4, value); + if (data[3]) + { + stp_mxmlElementSetAttr(psize, "left", data[0]); + stp_mxmlElementSetAttr(psize, "bottom", data[1]); + stp_mxmlElementSetAttr(psize, "right", data[2]); + stp_mxmlElementSetAttr(psize, "top", data[3]); + } + } + } + else if (!option && !strcmp(buffer, "*PaperDimension")) + { + stp_mxml_node_t *psize = stpi_xmlppd_find_page_size(ppd, keyword); + if (psize) + { + const char *data[2]; + parse_values(data, 2, value); + if (data[1]) + { + stp_mxmlElementSetAttr(psize, "width", data[0]); + stp_mxmlElementSetAttr(psize, "height", data[1]); + } + } + } + } + option_count = stpi_xmlppd_find_option_count(ppd); + order_length = 1; /* Terminating null */ + order_array = malloc(sizeof(order_t) * option_count); + i = 0; + for (option = stp_mxmlFindElement(ppd, ppd, "option", NULL, NULL, + STP_MXML_DESCEND); + option && i < option_count; + option = stp_mxmlFindElement(option, ppd, "option", NULL, NULL, + STP_MXML_DESCEND)) + { + if (stp_mxmlElementGetAttr(option, "order")) + { + order_array[i].name = stp_mxmlElementGetAttr(option, "name"); + order_length += strlen(order_array[i].name) + 1; + order_array[i].order = atoi(stp_mxmlElementGetAttr(option, "order")); + i++; + } + } + option_count = i; + qsort(order_array, option_count, sizeof(order_t), &order_compare); + order_list = malloc(order_length); + order_length = 0; + for (i = 0; i < option_count; i++) + { + if (i > 0) + order_list[order_length++] = ' '; + strcpy(order_list + order_length, order_array[i].name); + order_length += strlen(order_array[i].name); + } + stp_mxmlElementSetAttr(ppd, "optionorder", order_list); + free(order_list); + free(order_array); + return (ppd); +} + +/* + * End of "xmlppd.c". + */ diff --git a/src/main/xmlppd.h b/src/main/xmlppd.h new file mode 100644 index 0000000..a348d70 --- /dev/null +++ b/src/main/xmlppd.h @@ -0,0 +1,46 @@ +/* + * "$Id: xmlppd.h,v 1.2 2007/12/24 03:05:52 rlk Exp $" + * + * Copyright 2007 by Michael R Sweet and Robert Krawitz + * + * 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. + */ + +#ifndef GUTENPRINT_INTERNAL_XMLPPD_H +#define GUTENPRINT_INTERNAL_XMLPPD_H + +extern stp_mxml_node_t *stpi_xmlppd_find_group_named(stp_mxml_node_t *root, const char *name); + +extern stp_mxml_node_t *stpi_xmlppd_find_group_index(stp_mxml_node_t *root, int idx); + +extern int stpi_xmlppd_find_group_count(stp_mxml_node_t *root); + +extern stp_mxml_node_t *stpi_xmlppd_find_option_named(stp_mxml_node_t *root, const char *name); + +extern stp_mxml_node_t *stpi_xmlppd_find_option_index(stp_mxml_node_t *root, int idx); + +extern int stpi_xmlppd_find_option_count(stp_mxml_node_t *root); + +extern stp_mxml_node_t *stpi_xmlppd_find_choice_named(stp_mxml_node_t *option, const char *name); + +extern stp_mxml_node_t *stpi_xmlppd_find_choice_index(stp_mxml_node_t *option, int idx); + +extern int stpi_xmlppd_find_choice_count(stp_mxml_node_t *option); + +extern stp_mxml_node_t *stpi_xmlppd_find_page_size(stp_mxml_node_t *root, const char *name); + +extern stp_mxml_node_t *stpi_xmlppd_read_ppd_file(const char *filename); + +#endif /* GUTENPRINT_INTERNAL_XMLPPD_H */ diff --git a/src/testpattern/Makefile.am b/src/testpattern/Makefile.am index b0ec34a..6d8434a 100644 --- a/src/testpattern/Makefile.am +++ b/src/testpattern/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.25.8.1 2007/12/15 20:35:51 rlk Exp $ +## $Id: Makefile.am,v 1.27 2007/12/02 02:44:29 rlk Exp $ ## Copyright (C) 2000 Roger Leigh ## ## This program is free software; you can redistribute it and/or modify diff --git a/src/testpattern/Makefile.in b/src/testpattern/Makefile.in index 1249030..f6c13bc 100644 --- a/src/testpattern/Makefile.in +++ b/src/testpattern/Makefile.in @@ -47,13 +47,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = src/testpattern ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stp.m4 \ - $(top_srcdir)/m4/stp_cups.m4 $(top_srcdir)/m4/stp_gimp.m4 \ - $(top_srcdir)/m4/stp_option.m4 $(top_srcdir)/m4/stp_release.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs @@ -156,27 +155,13 @@ FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@ GENPPD_LIBS = @GENPPD_LIBS@ GIMP2_CFLAGS = @GIMP2_CFLAGS@ GIMP2_LIBS = @GIMP2_LIBS@ -GIMPTOOL = @GIMPTOOL@ GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@ -GIMPTOOL_CHECK = @GIMPTOOL_CHECK@ -GIMP_CFLAGS = @GIMP_CFLAGS@ -GIMP_CFLAGS_NOUI = @GIMP_CFLAGS_NOUI@ -GIMP_DATA_DIR = @GIMP_DATA_DIR@ -GIMP_LIBS = @GIMP_LIBS@ -GIMP_LIBS_NOUI = @GIMP_LIBS_NOUI@ -GIMP_PLUGIN_DIR = @GIMP_PLUGIN_DIR@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GNUCFLAGS = @GNUCFLAGS@ GREP = @GREP@ GTK2_CFLAGS = @GTK2_CFLAGS@ GTK2_LIBS = @GTK2_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ GUTENPRINTUI2_BINARY_AGE = @GUTENPRINTUI2_BINARY_AGE@ GUTENPRINTUI2_CFLAGS = @GUTENPRINTUI2_CFLAGS@ GUTENPRINTUI2_CURRENT_INTERFACE = @GUTENPRINTUI2_CURRENT_INTERFACE@ @@ -184,13 +169,6 @@ GUTENPRINTUI2_INTERFACE_AGE = @GUTENPRINTUI2_INTERFACE_AGE@ GUTENPRINTUI2_LIBDEPS = @GUTENPRINTUI2_LIBDEPS@ GUTENPRINTUI2_LIBS = $(top_builddir)/src/gutenprintui2/libgutenprintui2.la GUTENPRINTUI2_VERSION = @GUTENPRINTUI2_VERSION@ -GUTENPRINTUI_BINARY_AGE = @GUTENPRINTUI_BINARY_AGE@ -GUTENPRINTUI_CFLAGS = @GUTENPRINTUI_CFLAGS@ -GUTENPRINTUI_CURRENT_INTERFACE = @GUTENPRINTUI_CURRENT_INTERFACE@ -GUTENPRINTUI_INTERFACE_AGE = @GUTENPRINTUI_INTERFACE_AGE@ -GUTENPRINTUI_LIBDEPS = @GUTENPRINTUI_LIBDEPS@ -GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la -GUTENPRINTUI_VERSION = @GUTENPRINTUI_VERSION@ GUTENPRINT_BINARY_AGE = @GUTENPRINT_BINARY_AGE@ GUTENPRINT_CFLAGS = @GUTENPRINT_CFLAGS@ GUTENPRINT_CURRENT_INTERFACE = @GUTENPRINT_CURRENT_INTERFACE@ @@ -295,16 +273,12 @@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ gimp2_plug_indir = @gimp2_plug_indir@ -gimp_plug_indir = @gimp_plug_indir@ gutenprint_cflags = @gutenprint_cflags@ gutenprint_libdeps = @gutenprint_libdeps@ gutenprint_libs = @gutenprint_libs@ gutenprintui2_cflags = @gutenprintui2_cflags@ gutenprintui2_libdeps = @gutenprintui2_libdeps@ gutenprintui2_libs = @gutenprintui2_libs@ -gutenprintui_cflags = @gutenprintui_cflags@ -gutenprintui_libdeps = @gutenprintui_libdeps@ -gutenprintui_libs = @gutenprintui_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -333,6 +307,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la TESTS = run-testpattern-1 run-testpattern-2 @BUILD_TESTPATTERN_TRUE@noinst_SCRIPTS = run-testpattern-2 AM_LFLAGS = -i diff --git a/src/testpattern/printer_options.c b/src/testpattern/printer_options.c index 444e4b5..b44da2d 100644 --- a/src/testpattern/printer_options.c +++ b/src/testpattern/printer_options.c @@ -1,5 +1,5 @@ /* - * "$Id: printer_options.c,v 1.2.8.2 2007/03/04 23:57:48 tillkamppeter Exp $" + * "$Id: printer_options.c,v 1.4 2007/03/05 00:04:00 tillkamppeter Exp $" * * Dump the per-printer options for the OpenPrinting database * diff --git a/src/testpattern/printers.c b/src/testpattern/printers.c index 21ffd1e..3879de9 100644 --- a/src/testpattern/printers.c +++ b/src/testpattern/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c,v 1.6.18.1 2007/03/04 23:57:49 tillkamppeter Exp $" + * "$Id: printers.c,v 1.7 2007/03/05 00:04:00 tillkamppeter Exp $" * * Dump the per-printer options for the OpenPrinting database * diff --git a/src/testpattern/run-testpattern b/src/testpattern/run-testpattern index f194323..3fa058e 100755 --- a/src/testpattern/run-testpattern +++ b/src/testpattern/run-testpattern @@ -144,7 +144,7 @@ fi #StandardDithers="EvenTone HybridEvenTone UniTone HybridUniTone Adaptive Ordered Fast VeryFast Floyd Predithered" -StandardDithers="EvenTone HybridEvenTone Adaptive Ordered Fast VeryFast Floyd Predithered" +StandardDithers="EvenTone HybridEvenTone Adaptive Ordered OrderedNew Fast VeryFast Floyd Predithered Segmented SegmentedNew" the_message='' diff --git a/src/testpattern/testpattern.c b/src/testpattern/testpattern.c index 29c30b1..a0ef100 100644 --- a/src/testpattern/testpattern.c +++ b/src/testpattern/testpattern.c @@ -1,5 +1,5 @@ /* - * "$Id: testpattern.c,v 1.44.8.2 2007/12/31 03:37:27 rlk Exp $" + * "$Id: testpattern.c,v 1.48 2008/01/27 21:44:21 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -87,6 +87,7 @@ int global_channel_depth; int global_invert_data = 0; int global_use_raw_cmyk; int global_did_something; +int global_noscale = 0; int global_suppress_output = 0; char *global_output = NULL; @@ -137,10 +138,10 @@ clear_testpattern(testpattern_t *p) int i; for (i = 0; i < STP_CHANNEL_LIMIT; i++) { - p->d.p.mins[i] = 0; - p->d.p.vals[i] = 0; - p->d.p.gammas[i] = 1; - p->d.p.levels[i] = 0; + p->d.pattern.mins[i] = 0; + p->d.pattern.vals[i] = 0; + p->d.pattern.gammas[i] = 1; + p->d.pattern.levels[i] = 0; } } @@ -639,8 +640,8 @@ fill_grid_##bits(unsigned char *data, size_t len, size_t scount, \ { \ int i; \ int xlen = (len / scount) * scount; \ - int errdiv = (p->d.g.ticks) / (xlen - 1); \ - int errmod = (p->d.g.ticks) % (xlen - 1); \ + int errdiv = (p->d.grid.ticks) / (xlen - 1); \ + int errmod = (p->d.grid.ticks) % (xlen - 1); \ int errval = 0; \ int errlast = -1; \ int errline = 0; \ @@ -683,97 +684,102 @@ fill_grid(unsigned char *data, size_t len, size_t scount, } } -#define FILL_COLORS_EXTENDED_FUNCTION(T, bits) \ -static void \ -fill_colors_extended_##bits(unsigned char *data, size_t len, \ - size_t scount, testpattern_t *p) \ -{ \ - double mins[STP_CHANNEL_LIMIT]; \ - double vals[STP_CHANNEL_LIMIT]; \ - double gammas[STP_CHANNEL_LIMIT]; \ - int i; \ - int j; \ - int k; \ - int pixels; \ - int channel_limit = global_channel_depth <= 7 ? 7 : global_channel_depth; \ - T *s_data = (T *) data; \ - unsigned multiplier = (1 << bits) - 1; \ - \ - for (j = 0; j < channel_limit; j++) \ - { \ - mins[j] = p->d.p.mins[j] == -2 ? global_levels[j] : p->d.p.mins[j]; \ - vals[j] = p->d.p.vals[j] == -2 ? global_levels[j] : p->d.p.vals[j]; \ - gammas[j] = p->d.p.gammas[j] * global_gamma * global_gammas[j]; \ - vals[j] -= mins[j]; \ - } \ - if (scount > len) \ - scount = len; \ - pixels = len / scount; \ - for (i = 0; i < scount; i++) \ - { \ - double where = (double) i / ((double) scount - 1); \ - double val = where; \ - double xvals[STP_CHANNEL_LIMIT]; \ - \ - for (j = 0; j < channel_limit; j++) \ - { \ - xvals[j] = mins[j] + val * vals[j]; \ - xvals[j] = pow(xvals[j], gammas[j]); \ - xvals[j] *= global_ink_limit * multiplier; \ - } \ - for (k = 0; k < pixels; k++) \ - { \ - switch (global_channel_depth) \ - { \ - case 1: \ - s_data[0] = xvals[0]; \ - break; \ - case 2: \ - s_data[0] = xvals[0]; \ - s_data[1] = xvals[4]; \ - break; \ - case 3: \ - s_data[0] = xvals[1]; \ - s_data[1] = xvals[2]; \ - s_data[2] = xvals[3]; \ - break; \ - case 4: \ - s_data[0] = xvals[0]; \ - s_data[1] = xvals[1]; \ - s_data[2] = xvals[2]; \ - s_data[3] = xvals[3]; \ - break; \ - case 5: \ - s_data[0] = xvals[1]; \ - s_data[1] = xvals[5]; \ - s_data[2] = xvals[2]; \ - s_data[3] = xvals[6]; \ - s_data[4] = xvals[3]; \ - break; \ - case 6: \ - s_data[0] = xvals[0]; \ - s_data[1] = xvals[1]; \ - s_data[2] = xvals[5]; \ - s_data[3] = xvals[2]; \ - s_data[4] = xvals[6]; \ - s_data[5] = xvals[3]; \ - break; \ - case 7: \ - s_data[0] = xvals[0]; \ - s_data[1] = xvals[4]; \ - s_data[2] = xvals[1]; \ - s_data[3] = xvals[5]; \ - s_data[4] = xvals[2]; \ - s_data[5] = xvals[6]; \ - s_data[6] = xvals[3]; \ - break; \ - default: \ - for (j = 0; j < global_channel_depth; j++) \ - s_data[j] = xvals[j]; \ - } \ - s_data += global_channel_depth; \ - } \ - } \ +#define FILL_COLORS_EXTENDED_FUNCTION(T, bits) \ +static void \ +fill_colors_extended_##bits(unsigned char *data, size_t len, \ + size_t scount, testpattern_t *p) \ +{ \ + double mins[STP_CHANNEL_LIMIT]; \ + double vals[STP_CHANNEL_LIMIT]; \ + double gammas[STP_CHANNEL_LIMIT]; \ + int i; \ + int j; \ + int k; \ + int pixels; \ + int channel_limit = \ + global_channel_depth <= 7 ? 7 : global_channel_depth; \ + T *s_data = (T *) data; \ + unsigned multiplier = global_noscale ? 1 : (1 << bits) - 1; \ + \ + for (j = 0; j < channel_limit; j++) \ + { \ + mins[j] = p->d.pattern.mins[j] == -2 ? \ + global_levels[j] : p->d.pattern.mins[j]; \ + vals[j] = p->d.pattern.vals[j] == -2 ? \ + global_levels[j] : p->d.pattern.vals[j]; \ + gammas[j] = \ + p->d.pattern.gammas[j] * global_gamma * global_gammas[j]; \ + vals[j] -= mins[j]; \ + } \ + if (scount > len) \ + scount = len; \ + pixels = len / scount; \ + for (i = 0; i < scount; i++) \ + { \ + double where = (double) i / ((double) scount - 1); \ + double val = where; \ + double xvals[STP_CHANNEL_LIMIT]; \ + \ + for (j = 0; j < channel_limit; j++) \ + { \ + xvals[j] = mins[j] + val * vals[j]; \ + xvals[j] = pow(xvals[j], gammas[j]); \ + xvals[j] *= global_ink_limit * multiplier; \ + xvals[j] += 0.9; \ + } \ + for (k = 0; k < pixels; k++) \ + { \ + switch (global_channel_depth) \ + { \ + case 1: \ + s_data[0] = xvals[0]; \ + break; \ + case 2: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[4]; \ + break; \ + case 3: \ + s_data[0] = xvals[1]; \ + s_data[1] = xvals[2]; \ + s_data[2] = xvals[3]; \ + break; \ + case 4: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[1]; \ + s_data[2] = xvals[2]; \ + s_data[3] = xvals[3]; \ + break; \ + case 5: \ + s_data[0] = xvals[1]; \ + s_data[1] = xvals[5]; \ + s_data[2] = xvals[2]; \ + s_data[3] = xvals[6]; \ + s_data[4] = xvals[3]; \ + break; \ + case 6: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[1]; \ + s_data[2] = xvals[5]; \ + s_data[3] = xvals[2]; \ + s_data[4] = xvals[6]; \ + s_data[5] = xvals[3]; \ + break; \ + case 7: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[4]; \ + s_data[2] = xvals[1]; \ + s_data[3] = xvals[5]; \ + s_data[4] = xvals[2]; \ + s_data[5] = xvals[6]; \ + s_data[6] = xvals[3]; \ + break; \ + default: \ + for (j = 0; j < global_channel_depth; j++) \ + s_data[j] = xvals[j]; \ + } \ + s_data += global_channel_depth; \ + } \ + } \ } FILL_COLORS_EXTENDED_FUNCTION(unsigned short, 16) @@ -794,117 +800,121 @@ fill_colors_extended(unsigned char *data, size_t len, size_t scount, } } -#define FILL_COLORS_FUNCTION(T, bits) \ -static void \ -fill_colors_##bits(unsigned char *data, size_t len, size_t scount, \ - testpattern_t *p) \ -{ \ - double mins[4]; \ - double vals[4]; \ - double gammas[4]; \ - double levels[4]; \ - double lower = p->d.p.lower; \ - double upper = p->d.p.upper; \ - int i; \ - int j; \ - int pixels; \ - T *s_data = (T *) data; \ - unsigned multiplier = (1 << bits) - 1; \ - \ - vals[0] = p->d.p.vals[0]; \ - mins[0] = p->d.p.mins[0]; \ - \ - for (j = 1; j < 4; j++) \ - { \ - vals[j] = p->d.p.vals[j] == -2 ? global_levels[j] : p->d.p.vals[j]; \ - mins[j] = p->d.p.mins[j] == -2 ? global_levels[j] : p->d.p.mins[j]; \ - levels[j] = p->d.p.levels[j] == \ - -2 ? global_levels[j] : p->d.p.levels[j]; \ - } \ - for (j = 0; j < 4; j++) \ - { \ - gammas[j] = p->d.p.gammas[j] * global_gamma * global_gammas[j]; \ - vals[j] -= mins[j]; \ - } \ - \ - if (scount > len) \ - scount = len; \ - pixels = len / scount; \ - for (i = 0; i < scount; i++) \ - { \ - int k; \ - double where = (double) i / ((double) scount - 1); \ - double cmyv; \ - double kv; \ - double val = where; \ - double xvals[4]; \ - for (j = 0; j < 4; j++) \ - { \ - if (j > 0) \ - xvals[j] = mins[j] + val * vals[j]; \ - else \ - xvals[j] = mins[j] + vals[j]; \ - xvals[j] = pow(xvals[j], gammas[j]); \ - } \ - \ - if (where <= lower) \ - kv = 0; \ - else if (where > upper) \ - kv = where; \ - else \ - kv = (where - lower) * upper / (upper - lower); \ - cmyv = vals[0] * (where - kv); \ - xvals[0] *= kv; \ - for (j = 1; j < 4; j++) \ - xvals[j] += cmyv * levels[j]; \ - for (j = 0; j < 4; j++) \ - { \ - if (xvals[j] > 1) \ - xvals[j] = 1; \ - xvals[j] *= global_ink_limit * multiplier; \ - } \ - for (k = 0; k < pixels; k++) \ - { \ - switch (global_channel_depth) \ - { \ - case 0: \ - for (j = 0; j < 4; j++) \ - s_data[j] = xvals[(j + 1) % 4]; \ - s_data += 4; \ - break; \ - case 1: \ - s_data[0] = xvals[0]; \ - break; \ - case 2: \ - s_data[0] = xvals[0]; \ - s_data[1] = 0; \ - break; \ - case 3: \ - for (j = 1; j < 4; j++) \ - s_data[j - 1] = xvals[j]; \ - break; \ - case 4: \ - for (j = 0; j < 4; j++) \ - s_data[j] = xvals[j]; \ - break; \ - case 6: \ - s_data[0] = xvals[0]; \ - s_data[1] = xvals[1]; \ - s_data[2] = 0; \ - s_data[3] = xvals[2]; \ - s_data[4] = 0; \ - s_data[5] = xvals[3]; \ - break; \ - case 7: \ - for (j = 0; j < 4; j++) \ - s_data[j * 2] = xvals[j]; \ - for (j = 1; j < 6; j += 2) \ - s_data[j] = 0; \ - break; \ - } \ - s_data += global_channel_depth; \ - } \ - } \ +#define FILL_COLORS_FUNCTION(T, bits) \ +static void \ +fill_colors_##bits(unsigned char *data, size_t len, size_t scount, \ + testpattern_t *p) \ +{ \ + double mins[4]; \ + double vals[4]; \ + double gammas[4]; \ + double levels[4]; \ + double lower = p->d.pattern.lower; \ + double upper = p->d.pattern.upper; \ + int i; \ + int j; \ + int pixels; \ + T *s_data = (T *) data; \ + unsigned multiplier = global_noscale ? 1 : (1 << bits) - 1; \ + \ + vals[0] = p->d.pattern.vals[0]; \ + mins[0] = p->d.pattern.mins[0]; \ + \ + for (j = 1; j < 4; j++) \ + { \ + vals[j] = p->d.pattern.vals[j] == -2 ? global_levels[j] : \ + p->d.pattern.vals[j]; \ + mins[j] = p->d.pattern.mins[j] == -2 ? global_levels[j] : \ + p->d.pattern.mins[j]; \ + levels[j] = p->d.pattern.levels[j] == \ + -2 ? global_levels[j] : p->d.pattern.levels[j]; \ + } \ + for (j = 0; j < 4; j++) \ + { \ + gammas[j] = \ + p->d.pattern.gammas[j] * global_gamma * global_gammas[j]; \ + vals[j] -= mins[j]; \ + } \ + \ + if (scount > len) \ + scount = len; \ + pixels = len / scount; \ + for (i = 0; i < scount; i++) \ + { \ + int k; \ + double where = (double) i / ((double) scount - 1); \ + double cmyv; \ + double kv; \ + double val = where; \ + double xvals[4]; \ + for (j = 0; j < 4; j++) \ + { \ + if (j > 0) \ + xvals[j] = mins[j] + val * vals[j]; \ + else \ + xvals[j] = mins[j] + vals[j]; \ + xvals[j] = pow(xvals[j], gammas[j]); \ + } \ + \ + if (where <= lower) \ + kv = 0; \ + else if (where > upper) \ + kv = where; \ + else \ + kv = (where - lower) * upper / (upper - lower); \ + cmyv = vals[0] * (where - kv); \ + xvals[0] *= kv; \ + for (j = 1; j < 4; j++) \ + xvals[j] += cmyv * levels[j]; \ + for (j = 0; j < 4; j++) \ + { \ + if (xvals[j] > 1) \ + xvals[j] = 1; \ + xvals[j] *= global_ink_limit * multiplier; \ + xvals[j] += 0.9; \ + } \ + for (k = 0; k < pixels; k++) \ + { \ + switch (global_channel_depth) \ + { \ + case 0: \ + for (j = 0; j < 4; j++) \ + s_data[j] = xvals[(j + 1) % 4]; \ + s_data += 4; \ + break; \ + case 1: \ + s_data[0] = xvals[0]; \ + break; \ + case 2: \ + s_data[0] = xvals[0]; \ + s_data[1] = 0; \ + break; \ + case 3: \ + for (j = 1; j < 4; j++) \ + s_data[j - 1] = xvals[j]; \ + break; \ + case 4: \ + for (j = 0; j < 4; j++) \ + s_data[j] = xvals[j]; \ + break; \ + case 6: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[1]; \ + s_data[2] = 0; \ + s_data[3] = xvals[2]; \ + s_data[4] = 0; \ + s_data[5] = xvals[3]; \ + break; \ + case 7: \ + for (j = 0; j < 4; j++) \ + s_data[j * 2] = xvals[j]; \ + for (j = 1; j < 6; j += 2) \ + s_data[j] = 0; \ + break; \ + } \ + s_data += global_channel_depth; \ + } \ + } \ } FILL_COLORS_FUNCTION(unsigned short, 16) @@ -937,7 +947,7 @@ fill_pattern(testpattern_t *p, unsigned char *data, size_t width, size_t s_count, size_t image_depth, size_t byte_depth) { memset(data, 0, global_printer_width * image_depth * byte_depth); - switch (p->t) + switch (p->type) { case E_PATTERN: fill_colors(data, width, s_count, p, byte_depth); @@ -959,12 +969,12 @@ Image_get_row(stp_image_t *image, unsigned char *data, size_t byte_limit, int row) { int depth = global_channel_depth; - if (static_testpatterns[0].t == E_IMAGE) + if (static_testpatterns[0].type == E_IMAGE) { testpattern_t *t = &(static_testpatterns[0]); - int total_read = fread(data, 1, t->d.i.x * depth * global_bit_depth / 8, + int total_read = fread(data, 1, t->d.image.x * depth * global_bit_depth / 8, yyin); - if (total_read != t->d.i.x * depth * global_bit_depth / 8) + if (total_read != t->d.image.x * depth * global_bit_depth / 8) { fprintf(stderr, "Read failed!\n"); return STP_IMAGE_STATUS_ABORT; @@ -1008,8 +1018,8 @@ Image_get_row(stp_image_t *image, unsigned char *data, static int Image_width(stp_image_t *image) { - if (static_testpatterns[0].t == E_IMAGE) - return static_testpatterns[0].d.i.x; + if (static_testpatterns[0].type == E_IMAGE) + return static_testpatterns[0].d.image.x; else return global_printer_width; } @@ -1017,8 +1027,8 @@ Image_width(stp_image_t *image) static int Image_height(stp_image_t *image) { - if (static_testpatterns[0].t == E_IMAGE) - return static_testpatterns[0].d.i.y; + if (static_testpatterns[0].type == E_IMAGE) + return static_testpatterns[0].d.image.y; else return global_printer_height; } diff --git a/src/testpattern/testpattern.h b/src/testpattern/testpattern.h index 6b0fc83..3d3bbdc 100644 --- a/src/testpattern/testpattern.h +++ b/src/testpattern/testpattern.h @@ -1,5 +1,5 @@ /* - * "$Id: testpattern.h,v 1.15.18.1 2007/12/15 20:35:52 rlk Exp $" + * "$Id: testpattern.h,v 1.17 2008/01/27 21:44:21 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -34,7 +34,7 @@ typedef struct E_XPATTERN, E_IMAGE, E_GRID - } t; + } type; union { struct { double mins[32]; @@ -43,16 +43,16 @@ typedef struct double levels[32]; double lower; double upper; - } p; + } pattern; struct { int ticks; - } g; + } grid; struct { int x; int y; int bits; const char *data; - } i; + } image; } d; } testpattern_t; @@ -81,13 +81,14 @@ extern int global_bit_depth; extern int global_channel_depth; extern int global_did_something; extern int global_invert_data; +extern int global_noscale; extern char *global_output; extern char *c_strdup(const char *s); extern testpattern_t *get_next_testpattern(void); -typedef union yylv { +typedef struct yylv { int ival; double dval; char *sval; diff --git a/src/testpattern/testpatternl.c b/src/testpattern/testpatternl.c index 3cfa272..be9bd04 100644 --- a/src/testpattern/testpatternl.c +++ b/src/testpattern/testpatternl.c @@ -361,8 +361,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 50 -#define YY_END_OF_BUFFER 51 +#define YY_NUM_RULES 51 +#define YY_END_OF_BUFFER 52 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -370,34 +370,35 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[239] = +static yyconst flex_int16_t yy_accept[249] = { 0, - 0, 0, 51, 50, 47, 49, 50, 48, 50, 50, - 44, 32, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 47, 0, 48, 0, 46, 44, 46, 0, - 44, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 0, 45, 0, 46, 45, 46, 46, 37, 46, - 46, 46, 43, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - - 46, 46, 46, 46, 46, 36, 46, 20, 46, 46, - 46, 46, 45, 46, 46, 34, 1, 46, 46, 46, - 46, 39, 38, 29, 46, 46, 46, 35, 46, 46, - 46, 21, 46, 46, 46, 33, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 7, 46, 46, 46, - 46, 9, 22, 27, 46, 46, 46, 46, 10, 46, - 46, 46, 46, 46, 46, 46, 11, 23, 40, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 2, 46, - 46, 46, 41, 46, 46, 46, 46, 46, 5, 46, - 30, 46, 19, 46, 46, 8, 46, 3, 42, 46, - - 46, 25, 13, 46, 46, 6, 28, 46, 46, 46, - 46, 26, 24, 12, 4, 31, 14, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 15, 46, - 46, 46, 46, 18, 17, 46, 16, 0 + 0, 0, 52, 51, 48, 50, 51, 49, 51, 51, + 45, 45, 32, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 48, 0, 49, 0, 47, 45, + 47, 0, 45, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 0, 46, 0, 47, 46, + 45, 47, 47, 37, 47, 47, 47, 44, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 36, 47, 20, 47, 47, 47, 47, 46, 47, + 47, 34, 1, 47, 47, 47, 47, 39, 38, 29, + 47, 47, 47, 35, 47, 47, 47, 21, 47, 47, + 47, 33, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 7, 47, 47, 47, 47, 9, 22, + 27, 47, 47, 47, 47, 10, 47, 47, 47, 47, + 47, 47, 47, 47, 11, 23, 40, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 2, 47, 47, 47, + 47, 41, 47, 47, 47, 47, 47, 5, 47, 30, + + 47, 19, 47, 47, 8, 47, 3, 42, 43, 47, + 47, 25, 13, 47, 47, 6, 28, 47, 47, 47, + 47, 26, 24, 12, 4, 31, 14, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 15, 47, + 47, 47, 47, 18, 17, 47, 16, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -406,16 +407,16 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 5, 1, 1, 1, 6, 1, - 1, 1, 7, 1, 8, 9, 1, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 1, 11, 1, - 1, 1, 1, 1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 22, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 1, 1, 1, 1, 12, 1, 13, 14, 15, 16, - - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 22, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 7, 1, 8, 9, 1, 10, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 1, 12, 1, + 1, 1, 1, 1, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 1, 1, 1, 1, 13, 1, 14, 15, 16, 17, + + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 23, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -432,196 +433,206 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[38] = +static yyconst flex_int32_t yy_meta[39] = { 0, 1, 1, 2, 3, 1, 1, 1, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4 + 4, 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst flex_int16_t yy_base[243] = +static yyconst flex_int16_t yy_base[253] = { 0, - 0, 0, 479, 480, 476, 480, 0, 0, 471, 466, - 29, 480, 466, 31, 32, 33, 34, 35, 40, 47, - 38, 42, 49, 52, 54, 56, 62, 65, 68, 69, - 71, 70, 472, 469, 0, 466, 480, 85, 462, 460, - 87, 98, 72, 73, 79, 100, 81, 92, 94, 91, - 102, 103, 105, 110, 112, 116, 119, 120, 121, 122, - 123, 127, 128, 133, 134, 146, 136, 140, 141, 147, - 142, 160, 155, 459, 164, 166, 162, 160, 169, 170, - 171, 172, 459, 173, 174, 175, 176, 178, 180, 182, - 186, 184, 191, 188, 194, 195, 196, 197, 199, 201, - - 200, 210, 212, 207, 213, 458, 214, 457, 221, 222, - 223, 224, 455, 226, 225, 455, 454, 228, 234, 231, - 232, 453, 452, 451, 227, 247, 237, 450, 250, 253, - 241, 449, 256, 258, 259, 448, 238, 262, 260, 264, - 266, 268, 269, 270, 273, 267, 279, 274, 281, 280, - 283, 447, 446, 445, 286, 287, 284, 291, 444, 292, - 297, 300, 303, 304, 305, 308, 443, 442, 441, 309, - 306, 311, 313, 315, 310, 318, 319, 320, 440, 321, - 332, 339, 439, 329, 327, 340, 330, 342, 438, 343, - 437, 344, 436, 345, 346, 435, 348, 434, 433, 351, - - 353, 432, 425, 354, 355, 422, 417, 356, 364, 359, - 365, 416, 413, 412, 411, 410, 372, 374, 366, 373, - 376, 377, 381, 382, 384, 387, 390, 392, 409, 391, - 394, 397, 398, 405, 404, 408, 137, 480, 428, 432, - 436, 87 + 0, 0, 516, 517, 513, 517, 0, 0, 508, 29, + 32, 35, 517, 504, 38, 39, 43, 42, 40, 46, + 48, 50, 49, 70, 55, 62, 71, 72, 64, 63, + 73, 78, 77, 84, 510, 507, 0, 504, 517, 98, + 500, 79, 101, 113, 104, 91, 116, 94, 118, 108, + 109, 117, 119, 120, 126, 128, 124, 130, 132, 140, + 133, 144, 134, 151, 138, 148, 152, 153, 161, 165, + 150, 164, 168, 178, 169, 188, 190, 178, 193, 196, + 200, 203, 154, 204, 188, 205, 162, 499, 207, 208, + 209, 211, 212, 213, 215, 217, 218, 222, 223, 224, + + 227, 231, 232, 230, 234, 228, 233, 236, 244, 247, + 248, 498, 254, 497, 255, 256, 257, 259, 259, 258, + 263, 496, 495, 262, 264, 265, 267, 494, 493, 492, + 276, 282, 271, 491, 288, 289, 286, 490, 290, 292, + 295, 489, 296, 298, 299, 302, 304, 305, 307, 308, + 309, 311, 312, 314, 315, 316, 320, 325, 488, 487, + 486, 323, 335, 321, 337, 485, 326, 327, 340, 341, + 344, 345, 347, 348, 484, 483, 482, 350, 351, 352, + 353, 355, 358, 361, 362, 360, 481, 363, 367, 371, + 373, 480, 376, 378, 384, 383, 385, 479, 387, 478, + + 388, 477, 390, 394, 476, 392, 475, 468, 465, 391, + 399, 461, 458, 393, 400, 457, 450, 395, 412, 410, + 403, 447, 446, 397, 396, 269, 421, 416, 413, 427, + 422, 428, 431, 430, 432, 433, 434, 436, 268, 435, + 444, 439, 442, 182, 176, 445, 88, 517, 471, 475, + 479, 90 } ; -static yyconst flex_int16_t yy_def[243] = +static yyconst flex_int16_t yy_def[253] = { 0, - 238, 1, 238, 238, 238, 238, 239, 240, 241, 238, - 242, 238, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 238, 239, 240, 241, 238, 238, 242, 238, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 238, 238, 238, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 238, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 0, 238, 238, - 238, 238 + 248, 1, 248, 248, 248, 248, 249, 250, 251, 248, + 252, 252, 248, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 248, 249, 250, 251, 248, 248, + 252, 248, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 248, 248, 248, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 248, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, + 252, 252, 252, 252, 252, 252, 252, 0, 248, 248, + 248, 248 } ; -static yyconst flex_int16_t yy_nxt[518] = +static yyconst flex_int16_t yy_nxt[556] = { 0, 4, 5, 6, 7, 8, 9, 10, 10, 4, 11, - 12, 13, 13, 14, 15, 16, 17, 13, 18, 19, - 20, 13, 21, 22, 23, 13, 24, 25, 26, 27, - 28, 13, 29, 30, 31, 32, 13, 40, 41, 238, - 238, 238, 238, 238, 47, 42, 238, 51, 238, 48, - 238, 44, 56, 57, 43, 238, 45, 238, 58, 49, - 238, 59, 238, 52, 238, 60, 63, 46, 50, 53, - 238, 54, 55, 238, 65, 61, 238, 238, 238, 238, - 238, 238, 64, 62, 77, 78, 71, 238, 69, 238, - 39, 67, 66, 40, 38, 40, 41, 68, 70, 238, - - 238, 72, 238, 42, 74, 75, 238, 76, 238, 83, - 238, 238, 80, 238, 79, 86, 81, 82, 238, 87, - 238, 84, 90, 88, 238, 89, 85, 238, 238, 238, - 238, 238, 93, 94, 91, 238, 238, 96, 100, 98, - 92, 238, 238, 95, 238, 238, 102, 106, 238, 238, - 238, 99, 97, 105, 238, 238, 103, 101, 104, 111, - 109, 110, 107, 108, 73, 112, 74, 74, 238, 113, - 238, 72, 238, 76, 238, 76, 114, 238, 238, 238, - 238, 238, 238, 238, 238, 115, 238, 118, 238, 120, - 238, 116, 238, 124, 238, 117, 238, 127, 121, 238, - - 126, 119, 238, 238, 238, 238, 131, 238, 238, 238, - 122, 123, 133, 134, 129, 238, 125, 136, 238, 128, - 238, 238, 238, 130, 139, 132, 138, 137, 135, 238, - 238, 238, 238, 238, 238, 238, 238, 140, 141, 238, - 238, 142, 238, 153, 152, 238, 238, 146, 147, 238, - 148, 149, 144, 145, 150, 238, 151, 143, 238, 158, - 155, 238, 156, 154, 238, 157, 238, 238, 238, 162, - 238, 161, 238, 163, 238, 238, 238, 238, 238, 159, - 165, 238, 238, 160, 164, 168, 169, 238, 238, 238, - 173, 238, 238, 171, 238, 238, 166, 167, 176, 238, - - 238, 178, 172, 170, 174, 238, 177, 180, 238, 179, - 175, 238, 238, 238, 238, 182, 238, 238, 238, 238, - 185, 238, 181, 238, 187, 188, 238, 238, 238, 238, - 183, 190, 184, 186, 194, 238, 191, 238, 238, 189, - 238, 192, 196, 195, 198, 193, 197, 238, 238, 200, - 238, 238, 238, 238, 238, 199, 238, 201, 203, 238, - 207, 238, 238, 238, 238, 202, 208, 238, 205, 211, - 204, 213, 238, 238, 238, 216, 215, 206, 209, 212, - 238, 238, 238, 218, 238, 238, 214, 210, 219, 238, - 238, 220, 238, 217, 221, 238, 224, 223, 238, 238, - - 238, 225, 238, 222, 232, 238, 238, 226, 228, 227, - 234, 233, 238, 238, 229, 230, 238, 238, 238, 238, - 238, 238, 231, 236, 238, 238, 237, 235, 34, 34, - 238, 34, 35, 238, 35, 35, 36, 36, 36, 36, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 113, 238, 238, 238, 113, 73, - 238, 37, 37, 33, 238, 38, 37, 33, 238, 3, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238 + 12, 13, 14, 14, 15, 16, 17, 18, 14, 19, + 20, 21, 14, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 14, 31, 32, 33, 34, 14, 40, 40, + 42, 43, 43, 42, 43, 43, 248, 248, 248, 44, + 248, 248, 44, 54, 248, 50, 248, 248, 248, 47, + 51, 60, 46, 248, 48, 59, 61, 45, 52, 55, + 248, 248, 248, 57, 58, 49, 56, 53, 248, 248, + 248, 248, 65, 62, 67, 248, 248, 63, 77, 77, + 71, 69, 248, 41, 66, 70, 248, 64, 73, 248, + + 68, 75, 248, 72, 82, 74, 42, 40, 40, 42, + 43, 43, 248, 81, 81, 76, 248, 248, 44, 78, + 79, 248, 80, 80, 248, 248, 248, 248, 248, 83, + 84, 85, 248, 88, 248, 87, 248, 95, 248, 91, + 248, 248, 248, 92, 86, 90, 248, 93, 248, 94, + 89, 101, 248, 96, 98, 99, 248, 97, 248, 248, + 248, 248, 248, 103, 104, 100, 102, 105, 106, 248, + 248, 108, 248, 248, 111, 112, 248, 248, 114, 107, + 121, 109, 113, 110, 248, 115, 248, 119, 119, 116, + 248, 117, 125, 118, 78, 78, 248, 119, 119, 77, + + 77, 248, 80, 80, 248, 80, 80, 76, 248, 81, + 81, 248, 248, 248, 123, 248, 248, 248, 120, 248, + 248, 248, 124, 248, 126, 248, 248, 122, 130, 133, + 248, 248, 248, 127, 132, 248, 248, 137, 248, 248, + 248, 248, 248, 143, 248, 128, 135, 129, 139, 140, + 131, 142, 248, 145, 134, 248, 248, 146, 138, 136, + 141, 144, 248, 248, 248, 248, 248, 248, 119, 119, + 248, 248, 248, 248, 148, 248, 248, 248, 147, 248, + 159, 154, 149, 153, 248, 157, 156, 151, 152, 155, + 248, 158, 150, 160, 248, 162, 248, 248, 248, 161, + + 248, 163, 164, 248, 248, 165, 248, 248, 168, 169, + 248, 171, 248, 248, 166, 248, 248, 248, 167, 248, + 248, 173, 248, 248, 248, 176, 177, 172, 248, 248, + 170, 248, 181, 248, 248, 248, 174, 175, 180, 179, + 182, 184, 178, 248, 185, 248, 190, 187, 248, 248, + 186, 183, 248, 248, 188, 248, 248, 189, 248, 248, + 248, 248, 194, 248, 191, 196, 248, 197, 248, 248, + 248, 248, 192, 199, 193, 248, 195, 200, 203, 248, + 207, 248, 201, 205, 248, 198, 248, 204, 208, 206, + 209, 248, 248, 248, 202, 248, 248, 210, 248, 248, + + 248, 248, 248, 248, 248, 248, 217, 248, 248, 211, + 212, 248, 213, 215, 214, 218, 221, 223, 248, 222, + 248, 248, 216, 219, 248, 225, 224, 226, 220, 248, + 248, 229, 227, 228, 230, 248, 248, 231, 248, 248, + 248, 248, 248, 248, 248, 233, 232, 248, 235, 242, + 248, 234, 248, 248, 248, 248, 243, 238, 248, 236, + 237, 244, 240, 239, 247, 248, 248, 241, 246, 248, + 245, 36, 36, 248, 36, 37, 248, 37, 37, 38, + 38, 38, 38, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + + 248, 248, 248, 248, 248, 248, 248, 248, 248, 39, + 39, 35, 248, 39, 35, 248, 3, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248 } ; -static yyconst flex_int16_t yy_chk[518] = +static yyconst flex_int16_t yy_chk[556] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 11, 11, 14, - 15, 16, 17, 18, 16, 11, 21, 18, 19, 16, - 22, 15, 21, 22, 14, 20, 15, 23, 22, 17, - 24, 23, 25, 18, 26, 23, 25, 15, 17, 19, - 27, 20, 20, 28, 26, 23, 29, 30, 32, 31, - 43, 44, 25, 24, 43, 44, 32, 45, 30, 47, - 242, 28, 27, 38, 38, 41, 41, 29, 31, 50, - - 48, 38, 49, 41, 42, 42, 42, 42, 46, 49, - 51, 52, 46, 53, 45, 52, 47, 48, 54, 52, - 55, 50, 54, 52, 56, 53, 51, 57, 58, 59, - 60, 61, 57, 57, 55, 62, 63, 58, 61, 59, - 56, 64, 65, 57, 67, 237, 63, 65, 68, 69, - 71, 60, 58, 64, 66, 70, 63, 62, 63, 70, - 68, 69, 66, 67, 73, 71, 72, 72, 78, 72, - 77, 73, 75, 75, 76, 76, 77, 79, 80, 81, - 82, 84, 85, 86, 87, 78, 88, 81, 89, 84, - 90, 79, 92, 88, 91, 80, 94, 91, 85, 93, - - 90, 82, 95, 96, 97, 98, 95, 99, 101, 100, - 86, 87, 97, 98, 93, 104, 89, 100, 102, 92, - 103, 105, 107, 94, 103, 96, 102, 101, 99, 109, - 110, 111, 112, 115, 114, 125, 118, 104, 105, 120, - 121, 107, 119, 125, 121, 127, 137, 112, 114, 131, - 115, 118, 110, 111, 119, 126, 120, 109, 129, 131, - 127, 130, 129, 126, 133, 130, 134, 135, 139, 137, - 138, 135, 140, 138, 141, 146, 142, 143, 144, 133, - 140, 145, 148, 134, 139, 143, 144, 147, 150, 149, - 148, 151, 157, 146, 155, 156, 141, 142, 151, 158, - - 160, 156, 147, 145, 149, 161, 155, 158, 162, 157, - 150, 163, 164, 165, 171, 161, 166, 170, 175, 172, - 164, 173, 160, 174, 166, 170, 176, 177, 178, 180, - 162, 172, 163, 165, 176, 185, 173, 184, 187, 171, - 181, 174, 178, 177, 181, 175, 180, 182, 186, 184, - 188, 190, 192, 194, 195, 182, 197, 185, 187, 200, - 194, 201, 204, 205, 208, 186, 195, 210, 190, 201, - 188, 205, 209, 211, 219, 210, 209, 192, 197, 204, - 217, 220, 218, 217, 221, 222, 208, 200, 218, 223, - 224, 218, 225, 211, 218, 226, 220, 219, 227, 230, - - 228, 221, 231, 218, 228, 232, 233, 222, 224, 223, - 231, 230, 235, 234, 225, 226, 236, 229, 216, 215, - 214, 213, 227, 233, 212, 207, 236, 232, 239, 239, - 206, 239, 240, 203, 240, 240, 241, 241, 241, 241, - 202, 199, 198, 196, 193, 191, 189, 183, 179, 169, - 168, 167, 159, 154, 153, 152, 136, 132, 128, 124, - 123, 122, 117, 116, 113, 108, 106, 83, 74, 40, - 39, 36, 34, 33, 13, 10, 9, 5, 3, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238 + 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, + 11, 11, 11, 12, 12, 12, 15, 16, 19, 11, + 18, 17, 12, 19, 20, 17, 21, 23, 22, 16, + 17, 23, 15, 25, 16, 22, 23, 11, 18, 19, + 26, 30, 29, 21, 21, 16, 20, 18, 24, 27, + 28, 31, 25, 24, 27, 33, 32, 24, 42, 42, + 30, 28, 34, 252, 26, 29, 247, 24, 32, 46, + + 27, 34, 48, 31, 46, 33, 40, 40, 40, 43, + 43, 43, 45, 45, 45, 40, 50, 51, 43, 44, + 44, 44, 44, 44, 47, 52, 49, 53, 54, 47, + 48, 49, 57, 52, 55, 51, 56, 57, 58, 55, + 59, 61, 63, 55, 50, 54, 65, 55, 60, 56, + 53, 61, 62, 58, 60, 60, 66, 59, 71, 64, + 67, 68, 83, 62, 63, 60, 61, 64, 65, 69, + 87, 67, 72, 70, 68, 69, 73, 75, 71, 66, + 83, 67, 70, 67, 245, 72, 74, 78, 78, 73, + 244, 74, 87, 75, 76, 76, 85, 76, 76, 77, + + 77, 79, 79, 79, 80, 80, 80, 77, 81, 81, + 81, 82, 84, 86, 85, 89, 90, 91, 82, 92, + 93, 94, 86, 95, 89, 96, 97, 84, 93, 96, + 98, 99, 100, 90, 95, 101, 106, 100, 104, 102, + 103, 107, 105, 106, 108, 91, 98, 92, 102, 103, + 94, 105, 109, 108, 97, 110, 111, 109, 101, 99, + 104, 107, 113, 115, 116, 117, 120, 118, 119, 119, + 124, 121, 125, 126, 111, 127, 239, 226, 110, 133, + 127, 120, 113, 118, 131, 125, 124, 116, 117, 121, + 132, 126, 115, 131, 137, 133, 135, 136, 139, 132, + + 140, 135, 136, 141, 143, 137, 144, 145, 141, 143, + 146, 145, 147, 148, 139, 149, 150, 151, 140, 152, + 153, 147, 154, 155, 156, 150, 151, 146, 157, 164, + 144, 162, 155, 158, 167, 168, 148, 149, 154, 153, + 156, 158, 152, 163, 162, 165, 168, 164, 169, 170, + 163, 157, 171, 172, 165, 173, 174, 167, 178, 179, + 180, 181, 172, 182, 169, 174, 183, 178, 186, 184, + 185, 188, 170, 180, 171, 189, 173, 181, 184, 190, + 189, 191, 182, 186, 193, 179, 194, 185, 190, 188, + 191, 196, 195, 197, 183, 199, 201, 193, 203, 210, + + 206, 214, 204, 218, 225, 224, 203, 211, 215, 194, + 195, 221, 196, 199, 197, 204, 211, 215, 220, 214, + 219, 229, 201, 206, 228, 219, 218, 220, 210, 227, + 231, 228, 221, 227, 228, 230, 232, 228, 234, 233, + 235, 236, 237, 240, 238, 229, 228, 242, 231, 238, + 243, 230, 241, 246, 223, 222, 240, 234, 217, 232, + 233, 241, 236, 235, 246, 216, 213, 237, 243, 212, + 242, 249, 249, 209, 249, 250, 208, 250, 250, 251, + 251, 251, 251, 207, 205, 202, 200, 198, 192, 187, + 177, 176, 175, 166, 161, 160, 159, 142, 138, 134, + + 130, 129, 128, 123, 122, 114, 112, 88, 41, 38, + 36, 35, 14, 9, 5, 3, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248 } ; static yy_state_type yy_last_accepting_state; @@ -640,7 +651,7 @@ int yy_flex_debug = 0; char *yytext; #line 1 "testpatternl.l" /* - * "$Id: testpatternl.l,v 1.17.14.1 2007/12/15 20:35:52 rlk Exp $" + * "$Id: testpatternl.l,v 1.20 2008/02/03 02:48:20 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -700,7 +711,7 @@ do \ while (0) -#line 704 "testpatternl.c" +#line 715 "testpatternl.c" #define INITIAL 0 @@ -856,7 +867,7 @@ YY_DECL #line 73 "testpatternl.l" -#line 860 "testpatternl.c" +#line 871 "testpatternl.c" if ( !(yy_init) ) { @@ -909,13 +920,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 239 ) + if ( yy_current_state >= 249 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 480 ); + while ( yy_base[yy_current_state] != 517 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1152,46 +1163,51 @@ DBG(MESSAGE); return MESSAGE; case 43: YY_RULE_SETUP #line 117 "testpatternl.l" -DBG(END); return END; +DBG(NOSCALE); return NOSCALE; YY_BREAK case 44: YY_RULE_SETUP -#line 120 "testpatternl.l" -yylval.ival = atoi(yytext); DBG(tINT); return tINT; +#line 118 "testpatternl.l" +DBG(END); return END; YY_BREAK case 45: YY_RULE_SETUP #line 121 "testpatternl.l" -yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; +yylval.ival = strtol(yytext, NULL, 0); yylval.dval = (double) yylval.ival; DBG(tINT); return tINT; YY_BREAK case 46: -/* rule 46 can match eol */ YY_RULE_SETUP #line 122 "testpatternl.l" -yylval.sval = c_strstrip(yytext); DBG(tSTRING); return tSTRING; +yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; YY_BREAK case 47: +/* rule 47 can match eol */ YY_RULE_SETUP #line 123 "testpatternl.l" -DBG(whitespace); /* Skip blanks/tabs */ +yylval.sval = c_strstrip(yytext); DBG(tSTRING); return tSTRING; YY_BREAK case 48: YY_RULE_SETUP #line 124 "testpatternl.l" -DBG(comment); /* Skip comments */ +DBG(whitespace); /* Skip blanks/tabs */ YY_BREAK case 49: -/* rule 49 can match eol */ YY_RULE_SETUP #line 125 "testpatternl.l" -DBG(newline); mylineno++; +DBG(comment); /* Skip comments */ YY_BREAK case 50: +/* rule 50 can match eol */ YY_RULE_SETUP #line 126 "testpatternl.l" +DBG(newline); mylineno++; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 127 "testpatternl.l" ECHO; YY_BREAK -#line 1195 "testpatternl.c" +#line 1211 "testpatternl.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1475,7 +1491,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 239 ) + if ( yy_current_state >= 249 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1503,11 +1519,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 239 ) + if ( yy_current_state >= 249 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 238); + yy_is_jam = (yy_current_state == 248); return yy_is_jam ? 0 : yy_current_state; } @@ -2158,4 +2174,4 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 126 "testpatternl.l" +#line 127 "testpatternl.l" diff --git a/src/testpattern/testpatternl.l b/src/testpattern/testpatternl.l index e7a213d..58dcfe2 100644 --- a/src/testpattern/testpatternl.l +++ b/src/testpattern/testpatternl.l @@ -1,5 +1,5 @@ /* - * "$Id: testpatternl.l,v 1.17.14.1 2007/12/15 20:35:52 rlk Exp $" + * "$Id: testpatternl.l,v 1.20 2008/02/03 02:48:20 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -65,7 +65,7 @@ do \ %option noyywrap digit [0-9] -integer [-+]?{digit}+ +integer ([-+]|0[xX])?{digit}+ float [-+]?{digit}+(\.{digit}+)?([eE][-+]?{digit}+)? string ([\"][^\"]+[\"])|([a-zA-Z0-9_][-a-zA-Z0-9_]*)|([\'][^\']*[\']) ws [ \t]+ @@ -114,10 +114,11 @@ gray yylval.ival = GRAY;DBG(GRAY); return GRAY; white yylval.ival = WHITE;DBG(WHITE); return WHITE; output DBG(OUTPUT); return OUTPUT; message DBG(MESSAGE); return MESSAGE; +noscale DBG(NOSCALE); return NOSCALE; end DBG(END); return END; -{integer} yylval.ival = atoi(yytext); DBG(tINT); return tINT; +{integer} yylval.ival = strtol(yytext, NULL, 0); yylval.dval = (double) yylval.ival; DBG(tINT); return tINT; {float} yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; {string} yylval.sval = c_strstrip(yytext); DBG(tSTRING); return tSTRING; {ws} DBG(whitespace); /* Skip blanks/tabs */ diff --git a/src/testpattern/testpatterny.c b/src/testpattern/testpatterny.c index 524355e..a7ea3dc 100644 --- a/src/testpattern/testpatterny.c +++ b/src/testpattern/testpatterny.c @@ -92,25 +92,26 @@ HSIZE = 281, VSIZE = 282, BLACKLINE = 283, - PATTERN = 284, - XPATTERN = 285, - EXTENDED = 286, - IMAGE = 287, - GRID = 288, - SEMI = 289, - CHANNEL = 290, - CMYK = 291, - KCMY = 292, - RGB = 293, - CMY = 294, - GRAY = 295, - WHITE = 296, - RAW = 297, - MODE = 298, - PAGESIZE = 299, - MESSAGE = 300, - OUTPUT = 301, - END = 302 + NOSCALE = 284, + PATTERN = 285, + XPATTERN = 286, + EXTENDED = 287, + IMAGE = 288, + GRID = 289, + SEMI = 290, + CHANNEL = 291, + CMYK = 292, + KCMY = 293, + RGB = 294, + CMY = 295, + GRAY = 296, + WHITE = 297, + RAW = 298, + MODE = 299, + PAGESIZE = 300, + MESSAGE = 301, + OUTPUT = 302, + END = 303 }; #endif /* Tokens. */ @@ -140,25 +141,26 @@ #define HSIZE 281 #define VSIZE 282 #define BLACKLINE 283 -#define PATTERN 284 -#define XPATTERN 285 -#define EXTENDED 286 -#define IMAGE 287 -#define GRID 288 -#define SEMI 289 -#define CHANNEL 290 -#define CMYK 291 -#define KCMY 292 -#define RGB 293 -#define CMY 294 -#define GRAY 295 -#define WHITE 296 -#define RAW 297 -#define MODE 298 -#define PAGESIZE 299 -#define MESSAGE 300 -#define OUTPUT 301 -#define END 302 +#define NOSCALE 284 +#define PATTERN 285 +#define XPATTERN 286 +#define EXTENDED 287 +#define IMAGE 288 +#define GRID 289 +#define SEMI 290 +#define CHANNEL 291 +#define CMYK 292 +#define KCMY 293 +#define RGB 294 +#define CMY 295 +#define GRAY 296 +#define WHITE 297 +#define RAW 298 +#define MODE 299 +#define PAGESIZE 300 +#define MESSAGE 301 +#define OUTPUT 302 +#define END 303 @@ -222,7 +224,7 @@ find_color(const char *name) int i = 0; while (color_map[i].name) { - if (strcmp(color_map[i].name, name) == 0) + if (strcasecmp(color_map[i].name, name) == 0) return color_map[i].channel; i++; } @@ -262,7 +264,7 @@ typedef int YYSTYPE; /* Line 216 of yacc.c. */ -#line 266 "testpatterny.c" +#line 268 "testpatterny.c" #ifdef short # undef short @@ -475,22 +477,22 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 59 +#define YYFINAL 61 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 136 +#define YYLAST 178 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 48 +#define YYNTOKENS 49 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 70 +#define YYNNTS 72 /* YYNRULES -- Number of rules. */ -#define YYNRULES 123 +#define YYNRULES 127 /* YYNRULES -- Number of states. */ -#define YYNSTATES 180 +#define YYNSTATES 185 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 302 +#define YYMAXUTOK 303 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -528,7 +530,7 @@ static const yytype_uint8 yytranslate[] = 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47 + 45, 46, 47, 48 }; #if YYDEBUG @@ -537,74 +539,75 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, - 19, 22, 25, 28, 31, 34, 37, 41, 43, 45, - 47, 49, 51, 53, 55, 58, 62, 66, 70, 74, - 77, 80, 83, 86, 89, 93, 95, 97, 101, 105, - 109, 113, 115, 117, 119, 121, 124, 127, 130, 133, - 136, 139, 143, 145, 148, 149, 151, 154, 159, 165, - 167, 169, 171, 174, 175, 177, 179, 181, 187, 191, - 194, 197, 201, 204, 208, 213, 219, 226, 228, 230, - 232, 234, 236, 238, 240, 243, 245, 247, 249, 251, - 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, - 273, 275, 277, 279, 281, 283, 285, 287, 290, 292, - 294, 296, 298, 301, 302, 305, 307, 308, 311, 313, - 315, 316, 319, 320 + 19, 21, 23, 26, 29, 32, 35, 38, 41, 45, + 47, 49, 51, 53, 55, 57, 59, 62, 66, 70, + 74, 78, 81, 84, 87, 90, 93, 97, 99, 101, + 105, 109, 113, 117, 119, 121, 123, 125, 128, 131, + 134, 137, 140, 143, 146, 150, 152, 155, 156, 158, + 161, 166, 172, 174, 176, 178, 181, 182, 184, 186, + 188, 194, 198, 201, 204, 208, 211, 215, 220, 226, + 233, 235, 237, 239, 241, 243, 245, 247, 250, 252, + 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, + 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, + 294, 296, 299, 301, 303, 305, 307, 310, 311, 314, + 316, 317, 320, 322, 324, 325, 328, 329 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 116, 0, -1, 6, -1, 7, -1, 8, -1, 9, - -1, 10, -1, 11, -1, 12, -1, 13, -1, 36, - 3, -1, 37, 3, -1, 38, 3, -1, 39, 3, - -1, 40, 3, -1, 41, 3, -1, 31, 3, 3, - -1, 50, -1, 51, -1, 52, -1, 53, -1, 54, - -1, 55, -1, 56, -1, 43, 57, -1, 15, 49, - 4, -1, 15, 3, 4, -1, 14, 49, 4, -1, - 14, 3, 4, -1, 14, 4, -1, 16, 3, -1, - 17, 4, -1, 18, 5, -1, 44, 5, -1, 44, - 3, 3, -1, 67, -1, 68, -1, 19, 5, 5, - -1, 20, 5, 3, -1, 21, 5, 4, -1, 22, - 5, 5, -1, 70, -1, 71, -1, 72, -1, 73, - -1, 23, 4, -1, 24, 4, -1, 25, 4, -1, - 26, 4, -1, 27, 4, -1, 28, 3, -1, 4, - 4, 4, -1, 81, -1, 82, 81, -1, -1, 82, - -1, 81, 83, -1, 49, 4, 4, 4, -1, 35, - 3, 4, 4, 4, -1, 85, -1, 86, -1, 87, - -1, 88, 87, -1, -1, 88, -1, 84, -1, 89, - -1, 4, 4, 4, 4, 4, -1, 29, 91, 90, - -1, 30, 90, -1, 33, 3, -1, 32, 3, 3, - -1, 45, 5, -1, 45, 5, 5, -1, 45, 5, - 5, 5, -1, 45, 5, 5, 5, 5, -1, 45, - 5, 5, 5, 5, 5, -1, 96, -1, 97, -1, - 98, -1, 99, -1, 100, -1, 101, -1, 46, -1, - 46, 5, -1, 103, -1, 104, -1, 105, -1, 61, - -1, 62, -1, 59, -1, 60, -1, 63, -1, 64, - -1, 65, -1, 66, -1, 74, -1, 75, -1, 76, - -1, 77, -1, 78, -1, 79, -1, 80, -1, 58, - -1, 69, -1, 102, -1, 106, -1, 107, 34, -1, - 92, -1, 93, -1, 94, -1, 102, -1, 109, 34, - -1, -1, 111, 110, -1, 95, -1, -1, 113, 108, - -1, 111, -1, 112, -1, -1, 47, 34, -1, -1, - 113, 117, 114, 115, -1 + 119, 0, -1, 6, -1, 7, -1, 8, -1, 9, + -1, 10, -1, 11, -1, 12, -1, 13, -1, 4, + -1, 3, -1, 37, 3, -1, 38, 3, -1, 39, + 3, -1, 40, 3, -1, 41, 3, -1, 42, 3, + -1, 32, 3, 3, -1, 52, -1, 53, -1, 54, + -1, 55, -1, 56, -1, 57, -1, 58, -1, 44, + 59, -1, 15, 50, 51, -1, 15, 3, 51, -1, + 14, 50, 51, -1, 14, 3, 51, -1, 14, 51, + -1, 16, 3, -1, 17, 51, -1, 18, 5, -1, + 45, 5, -1, 45, 3, 3, -1, 69, -1, 70, + -1, 19, 5, 5, -1, 20, 5, 3, -1, 21, + 5, 51, -1, 22, 5, 5, -1, 72, -1, 73, + -1, 74, -1, 75, -1, 23, 51, -1, 24, 51, + -1, 25, 51, -1, 26, 51, -1, 27, 51, -1, + 28, 3, -1, 29, 3, -1, 51, 51, 51, -1, + 84, -1, 85, 84, -1, -1, 85, -1, 84, 86, + -1, 50, 51, 51, 51, -1, 36, 3, 51, 51, + 51, -1, 88, -1, 89, -1, 90, -1, 91, 90, + -1, -1, 91, -1, 87, -1, 92, -1, 51, 51, + 51, 51, 51, -1, 30, 94, 93, -1, 31, 93, + -1, 34, 3, -1, 33, 3, 3, -1, 46, 5, + -1, 46, 5, 5, -1, 46, 5, 5, 5, -1, + 46, 5, 5, 5, 5, -1, 46, 5, 5, 5, + 5, 5, -1, 99, -1, 100, -1, 101, -1, 102, + -1, 103, -1, 104, -1, 47, -1, 47, 5, -1, + 106, -1, 107, -1, 108, -1, 63, -1, 64, -1, + 61, -1, 62, -1, 65, -1, 66, -1, 67, -1, + 68, -1, 76, -1, 77, -1, 78, -1, 79, -1, + 80, -1, 81, -1, 82, -1, 83, -1, 60, -1, + 71, -1, 105, -1, 109, -1, 110, 35, -1, 95, + -1, 96, -1, 97, -1, 105, -1, 112, 35, -1, + -1, 114, 113, -1, 98, -1, -1, 116, 111, -1, + 114, -1, 115, -1, -1, 48, 35, -1, -1, 116, + 120, 117, 118, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 140, 140, 140, 140, 140, 141, 141, 141, 141, - 144, 156, 168, 180, 192, 204, 216, 228, 228, 228, - 228, 228, 228, 228, 231, 234, 244, 253, 263, 272, - 279, 286, 293, 302, 311, 320, 320, 323, 333, 342, - 351, 365, 365, 365, 365, 367, 374, 381, 388, 395, - 402, 410, 425, 425, 428, 428, 431, 434, 448, 461, - 461, 464, 464, 467, 467, 470, 470, 473, 488, 491, - 506, 517, 534, 540, 547, 555, 564, 575, 575, 575, - 575, 575, 578, 581, 588, 593, 593, 596, 599, 599, - 599, 599, 599, 599, 600, 600, 600, 600, 600, 600, - 600, 601, 601, 601, 601, 601, 601, 604, 608, 608, - 608, 608, 611, 615, 615, 618, 622, 622, 625, 625, - 628, 628, 633, 632 + 0, 141, 141, 141, 141, 141, 142, 142, 142, 142, + 144, 144, 147, 159, 171, 183, 195, 207, 219, 231, + 231, 231, 231, 231, 231, 231, 234, 237, 247, 256, + 266, 275, 282, 289, 296, 305, 314, 323, 323, 326, + 336, 345, 354, 368, 368, 368, 368, 370, 377, 384, + 391, 398, 405, 413, 421, 436, 436, 439, 439, 442, + 445, 459, 472, 472, 475, 475, 478, 478, 481, 481, + 484, 499, 502, 517, 528, 545, 551, 558, 566, 575, + 586, 586, 586, 586, 586, 589, 592, 599, 604, 604, + 607, 610, 610, 610, 610, 610, 610, 611, 611, 611, + 611, 611, 611, 611, 612, 612, 612, 612, 612, 612, + 612, 615, 619, 619, 619, 619, 622, 626, 626, 629, + 633, 633, 636, 636, 639, 639, 644, 643 }; #endif @@ -617,21 +620,22 @@ static const char *const yytname[] = "L_CYAN", "MAGENTA", "L_MAGENTA", "YELLOW", "D_YELLOW", "BLACK", "L_BLACK", "GAMMA", "LEVEL", "STEPS", "INK_LIMIT", "PRINTER", "PARAMETER", "PARAMETER_INT", "PARAMETER_FLOAT", "PARAMETER_CURVE", - "DENSITY", "TOP", "LEFT", "HSIZE", "VSIZE", "BLACKLINE", "PATTERN", - "XPATTERN", "EXTENDED", "IMAGE", "GRID", "SEMI", "CHANNEL", "CMYK", - "KCMY", "RGB", "CMY", "GRAY", "WHITE", "RAW", "MODE", "PAGESIZE", - "MESSAGE", "OUTPUT", "END", "$accept", "COLOR", "cmykspec", "kcmyspec", - "rgbspec", "cmyspec", "grayspec", "whitespec", "extendedspec", - "modespec", "inputspec", "level", "channel_level", "gamma", - "channel_gamma", "global_gamma", "steps", "ink_limit", "printer", - "page_size_name", "page_size_custom", "page_size", "parameter_string", - "parameter_int", "parameter_float", "parameter_curve", "parameter", - "density", "top", "left", "hsize", "vsize", "blackline", "color_block1", - "color_blocks1a", "color_blocks1b", "color_blocks1", "color_block2a", - "color_block2b", "color_block2", "color_blocks2a", "color_blocks2", - "color_blocks", "patvars", "pattern", "xpattern", "grid", "image", - "Message0", "Message1", "Message2", "Message3", "Message4", "A_Message", - "message", "Output0", "Output1", "A_Output", "output", "A_Rule", "Rule", + "DENSITY", "TOP", "LEFT", "HSIZE", "VSIZE", "BLACKLINE", "NOSCALE", + "PATTERN", "XPATTERN", "EXTENDED", "IMAGE", "GRID", "SEMI", "CHANNEL", + "CMYK", "KCMY", "RGB", "CMY", "GRAY", "WHITE", "RAW", "MODE", "PAGESIZE", + "MESSAGE", "OUTPUT", "END", "$accept", "COLOR", "NUMBER", "cmykspec", + "kcmyspec", "rgbspec", "cmyspec", "grayspec", "whitespec", + "extendedspec", "modespec", "inputspec", "level", "channel_level", + "gamma", "channel_gamma", "global_gamma", "steps", "ink_limit", + "printer", "page_size_name", "page_size_custom", "page_size", + "parameter_string", "parameter_int", "parameter_float", + "parameter_curve", "parameter", "density", "top", "left", "hsize", + "vsize", "blackline", "noscale", "color_block1", "color_blocks1a", + "color_blocks1b", "color_blocks1", "color_block2a", "color_block2b", + "color_block2", "color_blocks2a", "color_blocks2", "color_blocks", + "patvars", "pattern", "xpattern", "grid", "image", "Message0", + "Message1", "Message2", "Message3", "Message4", "A_Message", "message", + "Output0", "Output1", "A_Output", "output", "A_Rule", "Rule", "A_Pattern", "Pattern", "Patterns", "Image", "Rules", "Output", "EOF", "Thing", "@1", 0 }; @@ -646,44 +650,44 @@ static const yytype_uint16 yytoknum[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302 + 295, 296, 297, 298, 299, 300, 301, 302, 303 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 48, 49, 49, 49, 49, 49, 49, 49, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 57, 57, - 57, 57, 57, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 69, 70, 71, 72, - 73, 74, 74, 74, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 82, 83, 83, 84, 85, 86, 87, - 87, 88, 88, 89, 89, 90, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 101, 101, - 101, 101, 102, 103, 104, 105, 105, 106, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 108, 109, 109, - 109, 109, 110, 111, 111, 112, 113, 113, 114, 114, - 115, 115, 117, 116 + 0, 49, 50, 50, 50, 50, 50, 50, 50, 50, + 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 59, 59, 59, 59, 59, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 71, 72, + 73, 74, 75, 76, 76, 76, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 85, 86, 86, 87, + 88, 89, 90, 90, 91, 91, 92, 92, 93, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 104, 104, 104, 104, 105, 106, 107, 108, 108, + 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 110, 111, 112, 112, 112, 112, 113, 114, 114, 115, + 116, 116, 117, 117, 118, 118, 120, 119 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, - 1, 1, 1, 1, 2, 3, 3, 3, 3, 2, - 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, - 3, 1, 1, 1, 1, 2, 2, 2, 2, 2, - 2, 3, 1, 2, 0, 1, 2, 4, 5, 1, - 1, 1, 2, 0, 1, 1, 1, 5, 3, 2, - 2, 3, 2, 3, 4, 5, 6, 1, 1, 1, - 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 2, 2, 2, 2, 2, 3, 1, + 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, + 3, 2, 2, 2, 2, 2, 3, 1, 1, 3, + 3, 3, 3, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 2, 3, 1, 2, 0, 1, 2, + 4, 5, 1, 1, 1, 2, 0, 1, 1, 1, + 5, 3, 2, 2, 3, 2, 3, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, - 1, 1, 2, 0, 2, 1, 0, 2, 1, 1, - 0, 2, 0, 4 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 2, 0, 2, 1, + 0, 2, 1, 1, 0, 2, 0, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -691,73 +695,77 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 116, 122, 0, 0, 0, 0, 0, 0, 0, 0, + 120, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 83, 103, 90, 91, 88, 89, 92, 93, 94, - 95, 35, 36, 104, 41, 42, 43, 44, 96, 97, - 98, 99, 100, 101, 102, 77, 78, 79, 80, 81, - 82, 105, 85, 86, 87, 106, 0, 117, 113, 1, - 0, 29, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 0, 0, 30, 31, 32, 0, 0, 0, 0, - 45, 46, 47, 48, 49, 50, 0, 0, 0, 0, - 0, 0, 0, 17, 18, 19, 20, 21, 22, 23, - 24, 0, 33, 72, 84, 107, 0, 115, 118, 119, - 120, 28, 27, 26, 25, 37, 38, 39, 40, 0, - 10, 11, 12, 13, 14, 15, 34, 73, 0, 0, - 63, 0, 108, 109, 110, 111, 0, 114, 0, 123, - 16, 74, 71, 0, 63, 0, 0, 0, 54, 65, - 59, 60, 61, 64, 66, 69, 70, 112, 121, 75, - 0, 68, 0, 0, 0, 52, 55, 56, 62, 76, - 0, 51, 0, 0, 53, 0, 0, 57, 67, 58 + 0, 0, 86, 107, 93, 94, 91, 92, 95, 96, + 97, 98, 37, 38, 108, 43, 44, 45, 46, 99, + 100, 101, 102, 103, 104, 105, 106, 80, 81, 82, + 83, 84, 85, 109, 88, 89, 90, 110, 0, 121, + 117, 1, 11, 10, 2, 3, 4, 5, 6, 7, + 8, 9, 0, 31, 0, 0, 32, 11, 33, 34, + 0, 0, 0, 0, 47, 48, 49, 50, 51, 52, + 53, 0, 0, 0, 0, 0, 0, 0, 19, 20, + 21, 22, 23, 24, 25, 26, 0, 35, 75, 87, + 111, 0, 119, 122, 123, 124, 30, 29, 28, 27, + 39, 40, 41, 42, 0, 12, 13, 14, 15, 16, + 17, 36, 76, 0, 0, 66, 0, 112, 113, 114, + 115, 0, 118, 0, 127, 18, 77, 74, 0, 66, + 0, 0, 0, 57, 68, 62, 63, 64, 67, 69, + 72, 73, 116, 125, 78, 0, 71, 0, 0, 0, + 55, 58, 59, 65, 79, 0, 0, 0, 54, 56, + 0, 0, 60, 70, 61 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 147, 93, 94, 95, 96, 97, 98, 99, 100, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + -1, 151, 152, 98, 99, 100, 101, 102, 103, 104, + 105, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 148, 166, 167, 149, 150, 151, 152, - 153, 154, 155, 144, 132, 133, 134, 107, 45, 46, + 42, 43, 44, 45, 46, 153, 171, 172, 154, 155, + 156, 157, 158, 159, 160, 149, 137, 138, 139, 112, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 136, 137, 108, 109, 1, 110, 139, 2, 58 + 57, 58, 59, 141, 142, 113, 114, 1, 115, 144, + 2, 60 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -124 -static const yytype_int16 yypact[] = +#define YYPACT_NINF -112 +static const yytype_int8 yypact[] = { - -124, -14, 16, 57, 41, 24, 54, 67, 68, 69, - 70, 77, 55, 79, 80, 81, 82, 84, 40, 23, - 83, 85, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -124, -124, -124, 58, -124, 59, -124, - 89, -124, -124, -124, -124, -124, -124, -124, -124, -124, - 90, 91, 92, -124, -124, -124, 93, 86, 95, 96, - -124, -124, -124, -124, -124, -124, 94, 97, 99, 100, - 101, 102, 103, -124, -124, -124, -124, -124, -124, -124, - -124, 104, -124, 105, -124, -124, 106, -124, 12, -124, - 61, -124, -124, -124, -124, -124, -124, -124, -124, 108, - -124, -124, -124, -124, -124, -124, -124, 107, 110, 111, - 11, 113, -124, -124, -124, -124, 87, -124, 88, -124, - -124, 109, -124, 114, 11, 115, 117, 119, 120, -124, - -124, -124, -124, 27, -124, -124, -124, -124, -124, 112, - 121, -124, 122, 123, 124, -124, 120, -124, -124, -124, - 125, -124, 126, 127, -124, 128, 129, -124, -124, -124 + -112, 0, 1, 77, 88, 29, 2, 36, 38, 51, + 52, 53, 2, 2, 2, 2, 2, 61, 63, 70, + -1, 62, 65, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, 33, -112, + 40, -112, 2, -112, -112, -112, -112, -112, -112, -112, + -112, -112, 2, -112, 2, 2, -112, -112, -112, -112, + 69, 72, 2, 71, -112, -112, -112, -112, -112, -112, + -112, 79, 89, 90, 100, 101, 102, 103, -112, -112, + -112, -112, -112, -112, -112, -112, 110, -112, 109, -112, + -112, 112, -112, 31, -112, 68, -112, -112, -112, -112, + -112, -112, -112, -112, 114, -112, -112, -112, -112, -112, + -112, -112, 113, 116, 2, 27, 117, -112, -112, -112, + -112, 86, -112, 87, -112, -112, 118, -112, 2, 27, + 121, 2, 2, 2, -112, -112, -112, -112, 42, -112, + -112, -112, -112, -112, 120, 2, -112, 2, 2, 2, + -112, 2, -112, -112, -112, 2, 2, 2, -112, -112, + 2, 2, -112, -112, -112 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -124, 52, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -123, -124, -124, -124, -124, -124, -19, - -124, -124, -9, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, -124, 28, -124, -124, -124, -124, -124, - -124, -124, -124, -124, -124, -124, -124, -124, -124, -124 + -112, 4, -3, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -111, -112, -112, -112, -112, + -112, -32, -112, -112, -22, -112, -112, -112, -112, -112, + -112, -112, -112, -112, -112, -112, 15, -112, -112, -112, + -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, + -112, -112 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -767,62 +775,71 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 145, 59, 62, 63, 64, - 65, 66, 67, 68, 69, 165, 101, 73, 102, 18, - 19, 20, 21, 62, 63, 64, 65, 66, 67, 68, - 69, 129, 130, 174, 71, 131, 146, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 72, 20, 74, 80, - 60, 61, 146, 62, 63, 64, 65, 66, 67, 68, - 69, 86, 75, 76, 77, 78, 87, 88, 89, 90, - 91, 92, 79, 81, 82, 83, 84, 85, 103, 116, - 104, 106, 105, 111, 112, 113, 114, 119, 115, 117, - 120, 118, 121, 122, 123, 124, 125, 126, 138, 128, - 127, 140, 141, 142, 159, 143, 156, 169, 160, 162, - 163, 157, 158, 164, 145, 170, 171, 172, 173, 175, - 176, 177, 178, 179, 168, 161, 135 + 73, 61, 106, 78, 107, 77, 63, 72, 75, 84, + 85, 86, 87, 88, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 77, 63, 76, 64, 65, 66, 67, 68, 69, 70, + 71, 79, 170, 80, 19, 20, 21, 22, 64, 65, + 66, 67, 68, 69, 70, 71, 81, 82, 83, 116, + 179, 134, 135, 150, 89, 136, 90, 108, 110, 117, + 109, 118, 119, 111, 120, 121, 123, 21, 150, 122, + 62, 63, 124, 64, 65, 66, 67, 68, 69, 70, + 71, 74, 125, 126, 64, 65, 66, 67, 68, 69, + 70, 71, 91, 127, 128, 129, 130, 92, 93, 94, + 95, 96, 97, 131, 132, 133, 143, 145, 146, 147, + 161, 162, 163, 164, 167, 174, 173, 166, 140, 0, + 0, 148, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 165, 0, 0, 168, 169, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 175, 0, 176, 177, 178, 0, 0, 0, + 0, 0, 180, 181, 182, 0, 0, 183, 184 }; -static const yytype_uint8 yycheck[] = +static const yytype_int16 yycheck[] = { - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 4, 0, 6, 7, 8, - 9, 10, 11, 12, 13, 148, 3, 3, 5, 43, - 44, 45, 46, 6, 7, 8, 9, 10, 11, 12, - 13, 29, 30, 166, 3, 33, 35, 6, 7, 8, - 9, 10, 11, 12, 13, 3, 4, 45, 4, 4, - 3, 4, 35, 6, 7, 8, 9, 10, 11, 12, - 13, 31, 5, 5, 5, 5, 36, 37, 38, 39, - 40, 41, 5, 4, 4, 4, 4, 3, 5, 3, - 5, 32, 34, 4, 4, 4, 4, 3, 5, 4, - 3, 5, 3, 3, 3, 3, 3, 3, 47, 3, - 5, 3, 5, 3, 5, 4, 3, 5, 4, 4, - 3, 34, 34, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 153, 144, 108 + 3, 0, 3, 6, 5, 3, 4, 3, 4, 12, + 13, 14, 15, 16, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 3, 4, 3, 6, 7, 8, 9, 10, 11, 12, + 13, 5, 153, 5, 44, 45, 46, 47, 6, 7, + 8, 9, 10, 11, 12, 13, 5, 5, 5, 62, + 171, 30, 31, 36, 3, 34, 3, 5, 35, 72, + 5, 74, 75, 33, 5, 3, 5, 46, 36, 82, + 3, 4, 3, 6, 7, 8, 9, 10, 11, 12, + 13, 3, 3, 3, 6, 7, 8, 9, 10, 11, + 12, 13, 32, 3, 3, 3, 3, 37, 38, 39, + 40, 41, 42, 3, 5, 3, 48, 3, 5, 3, + 3, 35, 35, 5, 3, 5, 158, 149, 113, -1, + -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 148, -1, -1, 151, 152, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 165, -1, 167, 168, 169, -1, -1, -1, + -1, -1, 175, 176, 177, -1, -1, 180, 181 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 113, 116, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 43, 44, - 45, 46, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 117, 0, - 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, - 49, 3, 49, 3, 4, 5, 5, 5, 5, 5, - 4, 4, 4, 4, 4, 3, 31, 36, 37, 38, - 39, 40, 41, 50, 51, 52, 53, 54, 55, 56, - 57, 3, 5, 5, 5, 34, 32, 95, 111, 112, - 114, 4, 4, 4, 4, 5, 3, 4, 5, 3, - 3, 3, 3, 3, 3, 3, 3, 5, 3, 29, - 30, 33, 92, 93, 94, 102, 109, 110, 47, 115, - 3, 5, 3, 4, 91, 4, 35, 49, 81, 84, - 85, 86, 87, 88, 89, 90, 3, 34, 34, 5, - 4, 90, 4, 3, 4, 81, 82, 83, 87, 5, - 4, 4, 4, 4, 81, 4, 4, 4, 4, 4 + 0, 116, 119, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 44, + 45, 46, 47, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 120, 0, 3, 4, 6, 7, 8, 9, 10, 11, + 12, 13, 50, 51, 3, 50, 3, 3, 51, 5, + 5, 5, 5, 5, 51, 51, 51, 51, 51, 3, + 3, 32, 37, 38, 39, 40, 41, 42, 52, 53, + 54, 55, 56, 57, 58, 59, 3, 5, 5, 5, + 35, 33, 98, 114, 115, 117, 51, 51, 51, 51, + 5, 3, 51, 5, 3, 3, 3, 3, 3, 3, + 3, 3, 5, 3, 30, 31, 34, 95, 96, 97, + 105, 112, 113, 48, 118, 3, 5, 3, 51, 94, + 36, 50, 51, 84, 87, 88, 89, 90, 91, 92, + 93, 3, 35, 35, 5, 51, 93, 3, 51, 51, + 84, 85, 86, 90, 5, 51, 51, 51, 51, 84, + 51, 51, 51, 51, 51 }; #define yyerrok (yyerrstatus = 0) @@ -1636,8 +1653,8 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 10: -#line 145 "testpatterny.y" + case 12: +#line 148 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>cmykspec %d\n", (yyvsp[(2) - (2)].ival)); @@ -1649,8 +1666,8 @@ yyreduce: } break; - case 11: -#line 157 "testpatterny.y" + case 13: +#line 160 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>kcmyspec %d\n", (yyvsp[(2) - (2)].ival)); @@ -1662,8 +1679,8 @@ yyreduce: } break; - case 12: -#line 169 "testpatterny.y" + case 14: +#line 172 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>rgbspec %d\n", (yyvsp[(2) - (2)].ival)); @@ -1675,8 +1692,8 @@ yyreduce: } break; - case 13: -#line 181 "testpatterny.y" + case 15: +#line 184 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>cmyspec %d\n", (yyvsp[(2) - (2)].ival)); @@ -1688,8 +1705,8 @@ yyreduce: } break; - case 14: -#line 193 "testpatterny.y" + case 16: +#line 196 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>grayspec %d\n", (yyvsp[(2) - (2)].ival)); @@ -1701,8 +1718,8 @@ yyreduce: } break; - case 15: -#line 205 "testpatterny.y" + case 17: +#line 208 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>whitespec %d\n", (yyvsp[(2) - (2)].ival)); @@ -1714,8 +1731,8 @@ yyreduce: } break; - case 16: -#line 217 "testpatterny.y" + case 18: +#line 220 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>extendedspec %d\n", (yyvsp[(2) - (3)].ival)); @@ -1727,59 +1744,59 @@ yyreduce: } break; - case 25: -#line 235 "testpatterny.y" + case 27: +#line 238 "testpatterny.y" { int channel = find_color((yyvsp[(2) - (3)]).sval); if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>level %s %f\n", (yyvsp[(2) - (3)]).sval, (yyvsp[(3) - (3)].dval)); + fprintf(stderr, ">>>level %s %f\n", (yyvsp[(2) - (3)]).sval, (yyvsp[(3) - (3)]).dval); if (channel >= 0) - global_levels[channel] = (yyvsp[(3) - (3)].dval); + global_levels[channel] = (yyvsp[(3) - (3)]).dval; } break; - case 26: -#line 245 "testpatterny.y" + case 28: +#line 248 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>channel_level %d %f\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].dval)); + fprintf(stderr, ">>>channel_level %d %f\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)]).dval); if ((yyvsp[(2) - (3)].ival) >= 0 && (yyvsp[(2) - (3)].ival) <= STP_CHANNEL_LIMIT) - global_levels[(yyvsp[(2) - (3)].ival)] = (yyvsp[(3) - (3)].dval); + global_levels[(yyvsp[(2) - (3)].ival)] = (yyvsp[(3) - (3)]).dval; } break; - case 27: -#line 254 "testpatterny.y" + case 29: +#line 257 "testpatterny.y" { int channel = find_color((yyvsp[(2) - (3)]).sval); if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>gamma %s %f\n", (yyvsp[(2) - (3)]).sval, (yyvsp[(3) - (3)].dval)); + fprintf(stderr, ">>>gamma %s %f\n", (yyvsp[(2) - (3)]).sval, (yyvsp[(3) - (3)]).dval); if (channel >= 0) - global_gammas[channel] = (yyvsp[(3) - (3)].dval); + global_gammas[channel] = (yyvsp[(3) - (3)]).dval; } break; - case 28: -#line 264 "testpatterny.y" + case 30: +#line 267 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>channel_gamma %d %f\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].dval)); + fprintf(stderr, ">>>channel_gamma %d %f\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)]).dval); if ((yyvsp[(2) - (3)].ival) >= 0 && (yyvsp[(2) - (3)].ival) <= STP_CHANNEL_LIMIT) - global_gammas[(yyvsp[(2) - (3)].ival)] = (yyvsp[(3) - (3)].dval); + global_gammas[(yyvsp[(2) - (3)].ival)] = (yyvsp[(3) - (3)]).dval; } break; - case 29: -#line 273 "testpatterny.y" + case 31: +#line 276 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>global_gamma %f\n", (yyvsp[(2) - (2)].dval)); - global_gamma = (yyvsp[(2) - (2)].dval); + fprintf(stderr, ">>>global_gamma %f\n", (yyvsp[(2) - (2)]).dval); + global_gamma = (yyvsp[(2) - (2)]).dval; } break; - case 30: -#line 280 "testpatterny.y" + case 32: +#line 283 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>steps %d\n", (yyvsp[(2) - (2)].ival)); @@ -1787,17 +1804,17 @@ yyreduce: } break; - case 31: -#line 287 "testpatterny.y" + case 33: +#line 290 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>ink_limit %f\n", (yyvsp[(2) - (2)].dval)); - global_ink_limit = (yyvsp[(2) - (2)].dval); + fprintf(stderr, ">>>ink_limit %f\n", (yyvsp[(2) - (2)]).dval); + global_ink_limit = (yyvsp[(2) - (2)]).dval; } break; - case 32: -#line 294 "testpatterny.y" + case 34: +#line 297 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>printer %s\n", (yyvsp[(2) - (2)].sval)); @@ -1806,8 +1823,8 @@ yyreduce: } break; - case 33: -#line 303 "testpatterny.y" + case 35: +#line 306 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>page_size_name %s\n", (yyvsp[(2) - (2)].sval)); @@ -1816,8 +1833,8 @@ yyreduce: } break; - case 34: -#line 312 "testpatterny.y" + case 36: +#line 315 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>page_size_custom %d %d\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].ival)); @@ -1826,8 +1843,8 @@ yyreduce: } break; - case 37: -#line 324 "testpatterny.y" + case 39: +#line 327 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>parameter_string %s %s\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].sval)); @@ -1837,8 +1854,8 @@ yyreduce: } break; - case 38: -#line 334 "testpatterny.y" + case 40: +#line 337 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>parameter_int %s %d\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].ival)); @@ -1847,18 +1864,18 @@ yyreduce: } break; - case 39: -#line 343 "testpatterny.y" + case 41: +#line 346 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>parameter_float %s %f\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].dval)); - stp_set_float_parameter(global_vars, (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].dval)); + fprintf(stderr, ">>>parameter_float %s %f\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)]).dval); + stp_set_float_parameter(global_vars, (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)]).dval); free((yyvsp[(2) - (3)].sval)); } break; - case 40: -#line 352 "testpatterny.y" + case 42: +#line 355 "testpatterny.y" { stp_curve_t *curve = stp_curve_create_from_string((yyvsp[(3) - (3)].sval)); if (getenv("STP_TESTPATTERN_DEBUG")) @@ -1872,53 +1889,53 @@ yyreduce: } break; - case 45: -#line 368 "testpatterny.y" + case 47: +#line 371 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>density %f\n", (yyvsp[(2) - (2)].dval)); - global_density = (yyvsp[(2) - (2)].dval); + fprintf(stderr, ">>>density %f\n", (yyvsp[(2) - (2)]).dval); + global_density = (yyvsp[(2) - (2)]).dval; } break; - case 46: -#line 375 "testpatterny.y" + case 48: +#line 378 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>top %f\n", (yyvsp[(2) - (2)].dval)); - global_xtop = (yyvsp[(2) - (2)].dval); + fprintf(stderr, ">>>top %f\n", (yyvsp[(2) - (2)]).dval); + global_xtop = (yyvsp[(2) - (2)]).dval; } break; - case 47: -#line 382 "testpatterny.y" + case 49: +#line 385 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>left %f\n", (yyvsp[(2) - (2)].dval)); - global_xleft = (yyvsp[(2) - (2)].dval); + fprintf(stderr, ">>>left %f\n", (yyvsp[(2) - (2)]).dval); + global_xleft = (yyvsp[(2) - (2)]).dval; } break; - case 48: -#line 389 "testpatterny.y" + case 50: +#line 392 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>hsize %f\n", (yyvsp[(2) - (2)].dval)); - global_hsize = (yyvsp[(2) - (2)].dval); + fprintf(stderr, ">>>hsize %f\n", (yyvsp[(2) - (2)]).dval); + global_hsize = (yyvsp[(2) - (2)]).dval; } break; - case 49: -#line 396 "testpatterny.y" + case 51: +#line 399 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>vsize %f\n", (yyvsp[(2) - (2)].dval)); - global_vsize = (yyvsp[(2) - (2)].dval); + fprintf(stderr, ">>>vsize %f\n", (yyvsp[(2) - (2)]).dval); + global_vsize = (yyvsp[(2) - (2)]).dval; } break; - case 50: -#line 403 "testpatterny.y" + case 52: +#line 406 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>blackline %d\n", (yyvsp[(2) - (2)].ival)); @@ -1926,69 +1943,78 @@ yyreduce: } break; - case 51: -#line 411 "testpatterny.y" + case 53: +#line 414 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>noscale %d\n", (yyvsp[(2) - (2)].ival)); + global_noscale = (yyvsp[(2) - (2)].ival); + } + break; + + case 54: +#line 422 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", (yyvsp[(1) - (3)].dval), (yyvsp[(2) - (3)].dval), (yyvsp[(3) - (3)].dval), + fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", (yyvsp[(1) - (3)]).dval, (yyvsp[(2) - (3)]).dval, (yyvsp[(3) - (3)]).dval, current_index); if (current_index < STP_CHANNEL_LIMIT) { - current_testpattern->d.p.mins[current_index] = (yyvsp[(1) - (3)].dval); - current_testpattern->d.p.vals[current_index] = (yyvsp[(2) - (3)].dval); - current_testpattern->d.p.gammas[current_index] = (yyvsp[(3) - (3)].dval); + current_testpattern->d.pattern.mins[current_index] = (yyvsp[(1) - (3)]).dval; + current_testpattern->d.pattern.vals[current_index] = (yyvsp[(2) - (3)]).dval; + current_testpattern->d.pattern.gammas[current_index] = (yyvsp[(3) - (3)]).dval; current_index++; } } break; - case 57: -#line 435 "testpatterny.y" + case 60: +#line 446 "testpatterny.y" { int channel = find_color((yyvsp[(1) - (4)]).sval); if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>color_block2a %s %f %f %f\n", (yyvsp[(1) - (4)]).sval, (yyvsp[(2) - (4)].dval), (yyvsp[(3) - (4)].dval), (yyvsp[(4) - (4)].dval)); + fprintf(stderr, ">>>color_block2a %s %f %f %f\n", (yyvsp[(1) - (4)]).sval, (yyvsp[(2) - (4)]).dval, (yyvsp[(3) - (4)]).dval, (yyvsp[(4) - (4)]).dval); if (channel >= 0 && channel < STP_CHANNEL_LIMIT) { - current_testpattern->d.p.mins[channel] = (yyvsp[(2) - (4)].dval); - current_testpattern->d.p.vals[channel] = (yyvsp[(3) - (4)].dval); - current_testpattern->d.p.gammas[channel] = (yyvsp[(4) - (4)].dval); + current_testpattern->d.pattern.mins[channel] = (yyvsp[(2) - (4)]).dval; + current_testpattern->d.pattern.vals[channel] = (yyvsp[(3) - (4)]).dval; + current_testpattern->d.pattern.gammas[channel] = (yyvsp[(4) - (4)]).dval; } } break; - case 58: -#line 449 "testpatterny.y" + case 61: +#line 460 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>color_block2b %d %f %f %f\n", (yyvsp[(2) - (5)].ival), (yyvsp[(3) - (5)].dval), (yyvsp[(4) - (5)].dval), (yyvsp[(5) - (5)].dval)); + fprintf(stderr, ">>>color_block2b %d %f %f %f\n", (yyvsp[(2) - (5)].ival), (yyvsp[(3) - (5)]).dval, (yyvsp[(4) - (5)]).dval, (yyvsp[(5) - (5)]).dval); if ((yyvsp[(2) - (5)].ival) >= 0 && (yyvsp[(2) - (5)].ival) < STP_CHANNEL_LIMIT) { - current_testpattern->d.p.mins[(yyvsp[(2) - (5)].ival)] = (yyvsp[(3) - (5)].dval); - current_testpattern->d.p.vals[(yyvsp[(2) - (5)].ival)] = (yyvsp[(4) - (5)].dval); - current_testpattern->d.p.gammas[(yyvsp[(2) - (5)].ival)] = (yyvsp[(5) - (5)].dval); + current_testpattern->d.pattern.mins[(yyvsp[(2) - (5)].ival)] = (yyvsp[(3) - (5)]).dval; + current_testpattern->d.pattern.vals[(yyvsp[(2) - (5)].ival)] = (yyvsp[(4) - (5)]).dval; + current_testpattern->d.pattern.gammas[(yyvsp[(2) - (5)].ival)] = (yyvsp[(5) - (5)]).dval; } } break; - case 67: -#line 474 "testpatterny.y" + case 70: +#line 485 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>patvars %f %f %f %f %f\n", (yyvsp[(1) - (5)].dval), (yyvsp[(2) - (5)].dval), (yyvsp[(3) - (5)].dval), (yyvsp[(4) - (5)].dval), (yyvsp[(5) - (5)].dval)); - current_testpattern->t = E_PATTERN; - current_testpattern->d.p.lower = (yyvsp[(1) - (5)].dval); - current_testpattern->d.p.upper = (yyvsp[(2) - (5)].dval); - current_testpattern->d.p.levels[1] = (yyvsp[(3) - (5)].dval); - current_testpattern->d.p.levels[2] = (yyvsp[(4) - (5)].dval); - current_testpattern->d.p.levels[3] = (yyvsp[(5) - (5)].dval); + fprintf(stderr, ">>>patvars %f %f %f %f %f\n", (yyvsp[(1) - (5)]).dval, (yyvsp[(2) - (5)]).dval, (yyvsp[(3) - (5)]).dval, (yyvsp[(4) - (5)]).dval, (yyvsp[(5) - (5)]).dval); + current_testpattern->type = E_PATTERN; + current_testpattern->d.pattern.lower = (yyvsp[(1) - (5)]).dval; + current_testpattern->d.pattern.upper = (yyvsp[(2) - (5)]).dval; + current_testpattern->d.pattern.levels[1] = (yyvsp[(3) - (5)]).dval; + current_testpattern->d.pattern.levels[2] = (yyvsp[(4) - (5)]).dval; + current_testpattern->d.pattern.levels[3] = (yyvsp[(5) - (5)]).dval; current_testpattern = get_next_testpattern(); current_index = 0; } break; - case 69: -#line 492 "testpatterny.y" + case 72: +#line 503 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>xpattern\n"); @@ -1997,34 +2023,34 @@ yyreduce: fprintf(stderr, "xpattern may only be used with extended color depth\n"); exit(1); } - current_testpattern->t = E_XPATTERN; + current_testpattern->type = E_XPATTERN; current_testpattern = get_next_testpattern(); current_index = 0; } break; - case 70: -#line 507 "testpatterny.y" + case 73: +#line 518 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>grid %d\n", (yyvsp[(2) - (2)].ival)); - current_testpattern->t = E_GRID; - current_testpattern->d.g.ticks = (yyvsp[(2) - (2)].ival); + current_testpattern->type = E_GRID; + current_testpattern->d.grid.ticks = (yyvsp[(2) - (2)].ival); current_testpattern = get_next_testpattern(); current_index = 0; } break; - case 71: -#line 518 "testpatterny.y" + case 74: +#line 529 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>image %d %d\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].ival)); - current_testpattern->t = E_IMAGE; - current_testpattern->d.i.x = (yyvsp[(2) - (3)].ival); - current_testpattern->d.i.y = (yyvsp[(3) - (3)].ival); - if (current_testpattern->d.i.x <= 0 || - current_testpattern->d.i.y <= 0) + current_testpattern->type = E_IMAGE; + current_testpattern->d.image.x = (yyvsp[(2) - (3)].ival); + current_testpattern->d.image.y = (yyvsp[(3) - (3)].ival); + if (current_testpattern->d.image.x <= 0 || + current_testpattern->d.image.y <= 0) { fprintf(stderr, "image width and height must be greater than zero\n"); exit(1); @@ -2033,16 +2059,16 @@ yyreduce: } break; - case 72: -#line 535 "testpatterny.y" + case 75: +#line 546 "testpatterny.y" { fprintf(stderr,"%s",(yyvsp[(2) - (2)].sval)); free((yyvsp[(2) - (2)].sval)); } break; - case 73: -#line 541 "testpatterny.y" + case 76: +#line 552 "testpatterny.y" { fprintf(stderr,"%s%s", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].sval)); free((yyvsp[(2) - (3)].sval)); @@ -2050,8 +2076,8 @@ yyreduce: } break; - case 74: -#line 548 "testpatterny.y" + case 77: +#line 559 "testpatterny.y" { fprintf(stderr,"%s%s%s", (yyvsp[(2) - (4)].sval), (yyvsp[(3) - (4)].sval), (yyvsp[(4) - (4)].sval)); free((yyvsp[(2) - (4)].sval)); @@ -2060,8 +2086,8 @@ yyreduce: } break; - case 75: -#line 556 "testpatterny.y" + case 78: +#line 567 "testpatterny.y" { fprintf(stderr, "%s%s%s%s", (yyvsp[(2) - (5)].sval), (yyvsp[(3) - (5)].sval), (yyvsp[(4) - (5)].sval), (yyvsp[(5) - (5)].sval)); free((yyvsp[(2) - (5)].sval)); @@ -2071,8 +2097,8 @@ yyreduce: } break; - case 76: -#line 565 "testpatterny.y" + case 79: +#line 576 "testpatterny.y" { fprintf(stderr, "%s%s%s%s%s", (yyvsp[(2) - (6)].sval), (yyvsp[(3) - (6)].sval), (yyvsp[(4) - (6)].sval), (yyvsp[(5) - (6)].sval), (yyvsp[(6) - (6)].sval)); free((yyvsp[(2) - (6)].sval)); @@ -2083,8 +2109,8 @@ yyreduce: } break; - case 83: -#line 582 "testpatterny.y" + case 86: +#line 593 "testpatterny.y" { if (global_output) free(global_output); @@ -2092,35 +2118,35 @@ yyreduce: } break; - case 84: -#line 589 "testpatterny.y" + case 87: +#line 600 "testpatterny.y" { global_output = (yyvsp[(2) - (2)].sval); } break; - case 107: -#line 605 "testpatterny.y" + case 111: +#line 616 "testpatterny.y" { global_did_something = 1; } break; - case 112: -#line 612 "testpatterny.y" + case 116: +#line 623 "testpatterny.y" { global_did_something = 1; } break; - case 115: -#line 619 "testpatterny.y" + case 119: +#line 630 "testpatterny.y" { global_did_something = 1; } break; - case 121: -#line 629 "testpatterny.y" + case 125: +#line 640 "testpatterny.y" { return 0; } break; - case 122: -#line 633 "testpatterny.y" + case 126: +#line 644 "testpatterny.y" { current_testpattern = get_next_testpattern(); } @@ -2128,7 +2154,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 2132 "testpatterny.c" +#line 2158 "testpatterny.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2342,6 +2368,6 @@ yyreturn: } -#line 639 "testpatterny.y" +#line 650 "testpatterny.y" diff --git a/src/testpattern/testpatterny.h b/src/testpattern/testpatterny.h index a005618..fdb65ae 100644 --- a/src/testpattern/testpatterny.h +++ b/src/testpattern/testpatterny.h @@ -65,25 +65,26 @@ HSIZE = 281, VSIZE = 282, BLACKLINE = 283, - PATTERN = 284, - XPATTERN = 285, - EXTENDED = 286, - IMAGE = 287, - GRID = 288, - SEMI = 289, - CHANNEL = 290, - CMYK = 291, - KCMY = 292, - RGB = 293, - CMY = 294, - GRAY = 295, - WHITE = 296, - RAW = 297, - MODE = 298, - PAGESIZE = 299, - MESSAGE = 300, - OUTPUT = 301, - END = 302 + NOSCALE = 284, + PATTERN = 285, + XPATTERN = 286, + EXTENDED = 287, + IMAGE = 288, + GRID = 289, + SEMI = 290, + CHANNEL = 291, + CMYK = 292, + KCMY = 293, + RGB = 294, + CMY = 295, + GRAY = 296, + WHITE = 297, + RAW = 298, + MODE = 299, + PAGESIZE = 300, + MESSAGE = 301, + OUTPUT = 302, + END = 303 }; #endif /* Tokens. */ @@ -113,25 +114,26 @@ #define HSIZE 281 #define VSIZE 282 #define BLACKLINE 283 -#define PATTERN 284 -#define XPATTERN 285 -#define EXTENDED 286 -#define IMAGE 287 -#define GRID 288 -#define SEMI 289 -#define CHANNEL 290 -#define CMYK 291 -#define KCMY 292 -#define RGB 293 -#define CMY 294 -#define GRAY 295 -#define WHITE 296 -#define RAW 297 -#define MODE 298 -#define PAGESIZE 299 -#define MESSAGE 300 -#define OUTPUT 301 -#define END 302 +#define NOSCALE 284 +#define PATTERN 285 +#define XPATTERN 286 +#define EXTENDED 287 +#define IMAGE 288 +#define GRID 289 +#define SEMI 290 +#define CHANNEL 291 +#define CMYK 292 +#define KCMY 293 +#define RGB 294 +#define CMY 295 +#define GRAY 296 +#define WHITE 297 +#define RAW 298 +#define MODE 299 +#define PAGESIZE 300 +#define MESSAGE 301 +#define OUTPUT 302 +#define END 303 diff --git a/src/testpattern/testpatterny.y b/src/testpattern/testpatterny.y index c32b20f..f3527d1 100644 --- a/src/testpattern/testpatterny.y +++ b/src/testpattern/testpatterny.y @@ -1,5 +1,5 @@ /* - * "$Id: testpatterny.y,v 1.26.18.3 2007/12/15 20:35:52 rlk Exp $" + * "$Id: testpatterny.y,v 1.30 2008/01/27 21:44:21 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -77,7 +77,7 @@ find_color(const char *name) int i = 0; while (color_map[i].name) { - if (strcmp(color_map[i].name, name) == 0) + if (strcasecmp(color_map[i].name, name) == 0) return color_map[i].channel; i++; } @@ -113,6 +113,7 @@ find_color(const char *name) %token HSIZE %token VSIZE %token BLACKLINE +%token NOSCALE %token PATTERN %token XPATTERN %token EXTENDED @@ -140,6 +141,8 @@ find_color(const char *name) COLOR: CYAN | L_CYAN | MAGENTA | L_MAGENTA | YELLOW | D_YELLOW | BLACK | L_BLACK ; +NUMBER: tDOUBLE | tINT +; cmykspec: CMYK tINT { @@ -231,49 +234,49 @@ modespec: cmykspec | kcmyspec | rgbspec | cmyspec | grayspec | whitespec | exten inputspec: MODE modespec ; -level: LEVEL COLOR tDOUBLE +level: LEVEL COLOR NUMBER { int channel = find_color($2.sval); if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>level %s %f\n", $2.sval, $3); + fprintf(stderr, ">>>level %s %f\n", $2.sval, $3.dval); if (channel >= 0) - global_levels[channel] = $3; + global_levels[channel] = $3.dval; } ; -channel_level: LEVEL tINT tDOUBLE +channel_level: LEVEL tINT NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>channel_level %d %f\n", $2, $3); + fprintf(stderr, ">>>channel_level %d %f\n", $2, $3.dval); if ($2 >= 0 && $2 <= STP_CHANNEL_LIMIT) - global_levels[$2] = $3; + global_levels[$2] = $3.dval; } ; -gamma: GAMMA COLOR tDOUBLE +gamma: GAMMA COLOR NUMBER { int channel = find_color($2.sval); if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>gamma %s %f\n", $2.sval, $3); + fprintf(stderr, ">>>gamma %s %f\n", $2.sval, $3.dval); if (channel >= 0) - global_gammas[channel] = $3; + global_gammas[channel] = $3.dval; } ; -channel_gamma: GAMMA tINT tDOUBLE +channel_gamma: GAMMA tINT NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>channel_gamma %d %f\n", $2, $3); + fprintf(stderr, ">>>channel_gamma %d %f\n", $2, $3.dval); if ($2 >= 0 && $2 <= STP_CHANNEL_LIMIT) - global_gammas[$2] = $3; + global_gammas[$2] = $3.dval; } ; -global_gamma: GAMMA tDOUBLE +global_gamma: GAMMA NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>global_gamma %f\n", $2); - global_gamma = $2; + fprintf(stderr, ">>>global_gamma %f\n", $2.dval); + global_gamma = $2.dval; } ; steps: STEPS tINT @@ -283,11 +286,11 @@ steps: STEPS tINT global_steps = $2; } ; -ink_limit: INK_LIMIT tDOUBLE +ink_limit: INK_LIMIT NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>ink_limit %f\n", $2); - global_ink_limit = $2; + fprintf(stderr, ">>>ink_limit %f\n", $2.dval); + global_ink_limit = $2.dval; } ; printer: PRINTER tSTRING @@ -339,11 +342,11 @@ parameter_int: PARAMETER_INT tSTRING tINT } ; -parameter_float: PARAMETER_FLOAT tSTRING tDOUBLE +parameter_float: PARAMETER_FLOAT tSTRING NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>parameter_float %s %f\n", $2, $3); - stp_set_float_parameter(global_vars, $2, $3); + fprintf(stderr, ">>>parameter_float %s %f\n", $2, $3.dval); + stp_set_float_parameter(global_vars, $2, $3.dval); free($2); } ; @@ -364,39 +367,39 @@ parameter_curve: PARAMETER_CURVE tSTRING tSTRING parameter: parameter_string | parameter_int | parameter_float | parameter_curve ; -density: DENSITY tDOUBLE +density: DENSITY NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>density %f\n", $2); - global_density = $2; + fprintf(stderr, ">>>density %f\n", $2.dval); + global_density = $2.dval; } ; -top: TOP tDOUBLE +top: TOP NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>top %f\n", $2); - global_xtop = $2; + fprintf(stderr, ">>>top %f\n", $2.dval); + global_xtop = $2.dval; } ; -left: LEFT tDOUBLE +left: LEFT NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>left %f\n", $2); - global_xleft = $2; + fprintf(stderr, ">>>left %f\n", $2.dval); + global_xleft = $2.dval; } ; -hsize: HSIZE tDOUBLE +hsize: HSIZE NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>hsize %f\n", $2); - global_hsize = $2; + fprintf(stderr, ">>>hsize %f\n", $2.dval); + global_hsize = $2.dval; } ; -vsize: VSIZE tDOUBLE +vsize: VSIZE NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>vsize %f\n", $2); - global_vsize = $2; + fprintf(stderr, ">>>vsize %f\n", $2.dval); + global_vsize = $2.dval; } ; blackline: BLACKLINE tINT @@ -407,16 +410,24 @@ blackline: BLACKLINE tINT } ; -color_block1: tDOUBLE tDOUBLE tDOUBLE +noscale: NOSCALE tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>noscale %d\n", $2); + global_noscale = $2; + } +; + +color_block1: NUMBER NUMBER NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", $1, $2, $3, + fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", $1.dval, $2.dval, $3.dval, current_index); if (current_index < STP_CHANNEL_LIMIT) { - current_testpattern->d.p.mins[current_index] = $1; - current_testpattern->d.p.vals[current_index] = $2; - current_testpattern->d.p.gammas[current_index] = $3; + current_testpattern->d.pattern.mins[current_index] = $1.dval; + current_testpattern->d.pattern.vals[current_index] = $2.dval; + current_testpattern->d.pattern.gammas[current_index] = $3.dval; current_index++; } } @@ -431,29 +442,29 @@ color_blocks1b: /* empty */ | color_blocks1a color_blocks1: color_block1 color_blocks1b ; -color_block2a: COLOR tDOUBLE tDOUBLE tDOUBLE +color_block2a: COLOR NUMBER NUMBER NUMBER { int channel = find_color($1.sval); if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>color_block2a %s %f %f %f\n", $1.sval, $2, $3, $4); + fprintf(stderr, ">>>color_block2a %s %f %f %f\n", $1.sval, $2.dval, $3.dval, $4.dval); if (channel >= 0 && channel < STP_CHANNEL_LIMIT) { - current_testpattern->d.p.mins[channel] = $2; - current_testpattern->d.p.vals[channel] = $3; - current_testpattern->d.p.gammas[channel] = $4; + current_testpattern->d.pattern.mins[channel] = $2.dval; + current_testpattern->d.pattern.vals[channel] = $3.dval; + current_testpattern->d.pattern.gammas[channel] = $4.dval; } } ; -color_block2b: CHANNEL tINT tDOUBLE tDOUBLE tDOUBLE +color_block2b: CHANNEL tINT NUMBER NUMBER NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>color_block2b %d %f %f %f\n", $2, $3, $4, $5); + fprintf(stderr, ">>>color_block2b %d %f %f %f\n", $2, $3.dval, $4.dval, $5.dval); if ($2 >= 0 && $2 < STP_CHANNEL_LIMIT) { - current_testpattern->d.p.mins[$2] = $3; - current_testpattern->d.p.vals[$2] = $4; - current_testpattern->d.p.gammas[$2] = $5; + current_testpattern->d.pattern.mins[$2] = $3.dval; + current_testpattern->d.pattern.vals[$2] = $4.dval; + current_testpattern->d.pattern.gammas[$2] = $5.dval; } } ; @@ -470,16 +481,16 @@ color_blocks2: /* empty */ | color_blocks2a color_blocks: color_blocks1 | color_blocks2 ; -patvars: tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE +patvars: NUMBER NUMBER NUMBER NUMBER NUMBER { if (getenv("STP_TESTPATTERN_DEBUG")) - fprintf(stderr, ">>>patvars %f %f %f %f %f\n", $1, $2, $3, $4, $5); - current_testpattern->t = E_PATTERN; - current_testpattern->d.p.lower = $1; - current_testpattern->d.p.upper = $2; - current_testpattern->d.p.levels[1] = $3; - current_testpattern->d.p.levels[2] = $4; - current_testpattern->d.p.levels[3] = $5; + fprintf(stderr, ">>>patvars %f %f %f %f %f\n", $1.dval, $2.dval, $3.dval, $4.dval, $5.dval); + current_testpattern->type = E_PATTERN; + current_testpattern->d.pattern.lower = $1.dval; + current_testpattern->d.pattern.upper = $2.dval; + current_testpattern->d.pattern.levels[1] = $3.dval; + current_testpattern->d.pattern.levels[2] = $4.dval; + current_testpattern->d.pattern.levels[3] = $5.dval; current_testpattern = get_next_testpattern(); current_index = 0; } @@ -497,7 +508,7 @@ xpattern: XPATTERN color_blocks fprintf(stderr, "xpattern may only be used with extended color depth\n"); exit(1); } - current_testpattern->t = E_XPATTERN; + current_testpattern->type = E_XPATTERN; current_testpattern = get_next_testpattern(); current_index = 0; } @@ -507,8 +518,8 @@ grid: GRID tINT { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>grid %d\n", $2); - current_testpattern->t = E_GRID; - current_testpattern->d.g.ticks = $2; + current_testpattern->type = E_GRID; + current_testpattern->d.grid.ticks = $2; current_testpattern = get_next_testpattern(); current_index = 0; } @@ -518,11 +529,11 @@ image: IMAGE tINT tINT { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>image %d %d\n", $2, $3); - current_testpattern->t = E_IMAGE; - current_testpattern->d.i.x = $2; - current_testpattern->d.i.y = $3; - if (current_testpattern->d.i.x <= 0 || - current_testpattern->d.i.y <= 0) + current_testpattern->type = E_IMAGE; + current_testpattern->d.image.x = $2; + current_testpattern->d.image.y = $3; + if (current_testpattern->d.image.x <= 0 || + current_testpattern->d.image.y <= 0) { fprintf(stderr, "image width and height must be greater than zero\n"); exit(1); @@ -598,7 +609,7 @@ output: A_Output A_Rule: gamma | channel_gamma | level | channel_level | global_gamma | steps | ink_limit | printer | parameter | density | top | left | hsize - | vsize | blackline | inputspec | page_size | message | output + | vsize | blackline | noscale | inputspec | page_size | message | output ; Rule: A_Rule SEMI |