summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-10-26 16:11:41 +0000
committerRoger Leigh <rleigh@debian.org>2008-10-26 16:11:41 +0000
commitdfae5860833782af557deb35e286d7e186fe3cf5 (patch)
treee3b4282ae08e120f78cd0c097f7cb3b570e94da2 /test
parent3b59bb0a607ec27ea60f07d1cd5d1bbb4483c832 (diff)
Imported Upstream version 4.3.99+cvs20050702
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am34
-rw-r--r--test/Makefile.in909
-rw-r--r--test/bjc-unprint.c22
-rw-r--r--test/curve.c1157
-rw-r--r--test/escp2-weavetest.c307
-rwxr-xr-xtest/parse-escp22
-rw-r--r--test/pcl-unprint.c544
-rwxr-xr-xtest/run-testdither32
-rwxr-xr-xtest/run-weavetest110
-rw-r--r--test/testdither.c384
-rw-r--r--test/unprint.c271
-rw-r--r--test/xml-curve.c71
12 files changed, 2836 insertions, 1007 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index ce13935..3c7e2aa 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,4 +1,4 @@
-## $Id: Makefile.am,v 1.30.2.4 2002/06/05 23:52:05 rlk Exp $
+## $Id: Makefile.am,v 1.43 2004/09/17 18:38:27 rleigh Exp $
## Copyright (C) 2000 Roger Leigh
##
## This program is free software; you can redistribute it and/or modify
@@ -23,44 +23,42 @@ AUTOMAKE_OPTIONS = 1.4 gnu
MAINT_CHARSET = latin1
+include $(top_srcdir)/scripts/global.mk
+
## Variables
-AM_CFLAGS = $(GNUCFLAGS)
-INCLUDES = @INCLUDES@ $(LIBGIMPPRINT_CFLAGS) -I$(top_srcdir)/src/main
-LIBPRINTUT = $(top_builddir)/lib/libprintut.la
-LIBS = $(INTLLIBS) @LIBS@
+LOCAL_CPPFLAGS = -I$(top_srcdir)/src/main $(GUTENPRINT_CFLAGS)
-TESTS = run-testdither run-weavetest
+TESTS = curve run-testdither run-weavetest
## Programs
if BUILD_TEST
-noinst_PROGRAMS = testdither escp2-weavetest unprint pcl-unprint bjc-unprint
+noinst_PROGRAMS = testdither escp2-weavetest unprint pcl-unprint bjc-unprint curve xml-curve
endif
escp2_weavetest_SOURCES = escp2-weavetest.c
-escp2_weavetest_LDADD = $(LIBPRINTUT) $(LIBGIMPPRINT_LIBS)
-escp2_weavetest_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+escp2_weavetest_LDADD = $(GUTENPRINT_LIBS)
unprint_SOURCES = unprint.c
-unprint_LDADD = $(LIBPRINTUT)
+unprint_LDADD = $(GUTENPRINT_LIBS)
+
+curve_SOURCES = curve.c
+curve_LDADD = $(GUTENPRINT_LIBS)
pcl_unprint_SOURCES = pcl-unprint.c
-pcl_unprint_LDADD = $(LIBPRINTUT)
+pcl_unprint_LDADD = $(GUTENPRINT_LIBS)
bjc_unprint_SOURCES = bjc-unprint.c
-bjc_unprint_LDADD = $(LIBPRINTUT)
+bjc_unprint_LDADD = $(GUTENPRINT_LIBS)
testdither_SOURCES = testdither.c
-testdither_LDADD = $(LIBPRINTUT) $(LIBGIMPPRINT_LIBS)
-testdither_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
-
-$(LIBGIMPPRINT_LIBS):
- cd ../src/main ; \
- $(MAKE)
+testdither_LDADD = $(GUTENPRINT_LIBS)
+xml_curve_SOURCES = xml-curve.c
+xml_curve_LDADD = $(GUTENPRINT_LIBS)
## Rules
diff --git a/test/Makefile.in b/test/Makefile.in
index 4bc5c2a..7ffe70a 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,6 +1,8 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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.
@@ -10,312 +12,466 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+@SET_MAKE@
-SHELL = @SHELL@
+# Variables
+
+SOURCES = $(bjc_unprint_SOURCES) $(curve_SOURCES) $(escp2_weavetest_SOURCES) $(pcl_unprint_SOURCES) $(testdither_SOURCES) $(unprint_SOURCES) $(xml_curve_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
-
top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
+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 = :
-host_alias = @host_alias@
+build_triplet = @build@
host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/scripts/global.mk
+@BUILD_TEST_TRUE@noinst_PROGRAMS = testdither$(EXEEXT) \
+@BUILD_TEST_TRUE@ escp2-weavetest$(EXEEXT) unprint$(EXEEXT) \
+@BUILD_TEST_TRUE@ pcl-unprint$(EXEEXT) bjc-unprint$(EXEEXT) \
+@BUILD_TEST_TRUE@ curve$(EXEEXT) xml-curve$(EXEEXT)
+subdir = test
+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/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 =
+PROGRAMS = $(noinst_PROGRAMS)
+am_bjc_unprint_OBJECTS = bjc-unprint.$(OBJEXT)
+bjc_unprint_OBJECTS = $(am_bjc_unprint_OBJECTS)
+am__DEPENDENCIES_1 = $(top_builddir)/src/main/libgutenprint.la
+bjc_unprint_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_curve_OBJECTS = curve.$(OBJEXT)
+curve_OBJECTS = $(am_curve_OBJECTS)
+curve_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_escp2_weavetest_OBJECTS = escp2-weavetest.$(OBJEXT)
+escp2_weavetest_OBJECTS = $(am_escp2_weavetest_OBJECTS)
+escp2_weavetest_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_pcl_unprint_OBJECTS = pcl-unprint.$(OBJEXT)
+pcl_unprint_OBJECTS = $(am_pcl_unprint_OBJECTS)
+pcl_unprint_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_testdither_OBJECTS = testdither.$(OBJEXT)
+testdither_OBJECTS = $(am_testdither_OBJECTS)
+testdither_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_unprint_OBJECTS = unprint.$(OBJEXT)
+unprint_OBJECTS = $(am_unprint_OBJECTS)
+unprint_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_xml_curve_OBJECTS = xml-curve.$(OBJEXT)
+xml_curve_OBJECTS = $(am_xml_curve_OBJECTS)
+xml_curve_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+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 --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(bjc_unprint_SOURCES) $(curve_SOURCES) \
+ $(escp2_weavetest_SOURCES) $(pcl_unprint_SOURCES) \
+ $(testdither_SOURCES) $(unprint_SOURCES) $(xml_curve_SOURCES)
+DIST_SOURCES = $(bjc_unprint_SOURCES) $(curve_SOURCES) \
+ $(escp2_weavetest_SOURCES) $(pcl_unprint_SOURCES) \
+ $(testdither_SOURCES) $(unprint_SOURCES) $(xml_curve_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
ALL_LINGUAS = @ALL_LINGUAS@
-AS = @AS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BISON_PROG = @BISON_PROG@
-BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
+BUILD_CUPS_FALSE = @BUILD_CUPS_FALSE@
+BUILD_CUPS_PPDS_FALSE = @BUILD_CUPS_PPDS_FALSE@
+BUILD_CUPS_PPDS_TRUE = @BUILD_CUPS_PPDS_TRUE@
+BUILD_CUPS_TRUE = @BUILD_CUPS_TRUE@
+BUILD_ESCPUTIL_FALSE = @BUILD_ESCPUTIL_FALSE@
+BUILD_ESCPUTIL_TRUE = @BUILD_ESCPUTIL_TRUE@
+BUILD_FOOMATIC_3_FALSE = @BUILD_FOOMATIC_3_FALSE@
+BUILD_FOOMATIC_3_TRUE = @BUILD_FOOMATIC_3_TRUE@
+BUILD_FOOMATIC_FALSE = @BUILD_FOOMATIC_FALSE@
+BUILD_FOOMATIC_TRUE = @BUILD_FOOMATIC_TRUE@
+BUILD_GENPPD_STATIC_FALSE = @BUILD_GENPPD_STATIC_FALSE@
+BUILD_GENPPD_STATIC_TRUE = @BUILD_GENPPD_STATIC_TRUE@
+BUILD_GHOSTSCRIPT_FALSE = @BUILD_GHOSTSCRIPT_FALSE@
+BUILD_GHOSTSCRIPT_TRUE = @BUILD_GHOSTSCRIPT_TRUE@
+BUILD_GIMP2_FALSE = @BUILD_GIMP2_FALSE@
+BUILD_GIMP2_TRUE = @BUILD_GIMP2_TRUE@
+BUILD_GIMP_FALSE = @BUILD_GIMP_FALSE@
+BUILD_GIMP_TRUE = @BUILD_GIMP_TRUE@
+BUILD_LIBGUTENPRINTUI2_FALSE = @BUILD_LIBGUTENPRINTUI2_FALSE@
+BUILD_LIBGUTENPRINTUI2_TRUE = @BUILD_LIBGUTENPRINTUI2_TRUE@
+BUILD_LIBGUTENPRINTUI_FALSE = @BUILD_LIBGUTENPRINTUI_FALSE@
+BUILD_LIBGUTENPRINTUI_TRUE = @BUILD_LIBGUTENPRINTUI_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_TESTPATTERN_FALSE = @BUILD_TESTPATTERN_FALSE@
+BUILD_TESTPATTERN_TRUE = @BUILD_TESTPATTERN_TRUE@
+BUILD_TEST_FALSE = @BUILD_TEST_FALSE@
+BUILD_TEST_TRUE = @BUILD_TEST_TRUE@
+BUILD_TRANSLATED_CUPS_PPDS_FALSE = @BUILD_TRANSLATED_CUPS_PPDS_FALSE@
+BUILD_TRANSLATED_CUPS_PPDS_TRUE = @BUILD_TRANSLATED_CUPS_PPDS_TRUE@
CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
CONVERT = @CONVERT@
-CUPS_BACKEND_BIN = @CUPS_BACKEND_BIN@
-CUPS_BIN = @CUPS_BIN@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
CUPS_CFLAGS = @CUPS_CFLAGS@
-CUPS_CONF = @CUPS_CONF@
CUPS_CONFIG = @CUPS_CONFIG@
-CUPS_FILTER_BIN = @CUPS_FILTER_BIN@
-CUPS_INSTALL = @CUPS_INSTALL@
CUPS_LIBS = @CUPS_LIBS@
-CUPS_MAN = @CUPS_MAN@
-CUPS_NOINST_BIN = @CUPS_NOINST_BIN@
-CUPS_PKG = @CUPS_PKG@
+CUPS_PPDS_AT_TOP_LEVEL_FALSE = @CUPS_PPDS_AT_TOP_LEVEL_FALSE@
+CUPS_PPDS_AT_TOP_LEVEL_TRUE = @CUPS_PPDS_AT_TOP_LEVEL_TRUE@
CUPS_PPD_PS_LEVEL = @CUPS_PPD_PS_LEVEL@
-DATADIRNAME = @DATADIRNAME@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
DB2HTML = @DB2HTML@
DB2PDF = @DB2PDF@
DB2PS = @DB2PS@
-DLLTOOL = @DLLTOOL@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIALOG = @DIALOG@
+DOXYGEN = @DOXYGEN@
DVIPDF = @DVIPDF@
DVIPS = @DVIPS@
ECHO = @ECHO@
-ESCPUTIL_BIN = @ESCPUTIL_BIN@
-ESCPUTIL_MAN = @ESCPUTIL_MAN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
EXEEXT = @EXEEXT@
-FOOMATIC_3_NOINST_BIN = @FOOMATIC_3_NOINST_BIN@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FIND = @FIND@
FOOMATIC_CONFIGURE = @FOOMATIC_CONFIGURE@
-FOOMATIC_INSTALL = @FOOMATIC_INSTALL@
FOOMATIC_KITLOAD = @FOOMATIC_KITLOAD@
-FOOMATIC_NOINST_BIN = @FOOMATIC_NOINST_BIN@
-FOOMATIC_OLDIDS_NOINST_BIN = @FOOMATIC_OLDIDS_NOINST_BIN@
FOOMATIC_PPDFILE = @FOOMATIC_PPDFILE@
-GENCAT = @GENCAT@
-GIMPPRINT_BINARY_AGE = @GIMPPRINT_BINARY_AGE@
-GIMPPRINT_CFLAGS = @GIMPPRINT_CFLAGS@
-GIMPPRINT_CURRENT_INTERFACE = @GIMPPRINT_CURRENT_INTERFACE@
-GIMPPRINT_DEPLIBS = @GIMPPRINT_DEPLIBS@
-GIMPPRINT_INTERFACE_AGE = @GIMPPRINT_INTERFACE_AGE@
-GIMPPRINT_LIBS = @GIMPPRINT_LIBS@
-GIMPPRINT_MAJOR_VERSION = @GIMPPRINT_MAJOR_VERSION@
-GIMPPRINT_MICRO_VERSION = @GIMPPRINT_MICRO_VERSION@
-GIMPPRINT_MINOR_VERSION = @GIMPPRINT_MINOR_VERSION@
-GIMPPRINT_VERSION = @GIMPPRINT_VERSION@
+GENPPD_LIBS = @GENPPD_LIBS@
+GIMP2_CFLAGS = @GIMP2_CFLAGS@
+GIMP2_LIBS = @GIMP2_LIBS@
GIMPTOOL = @GIMPTOOL@
+GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@
GIMPTOOL_CHECK = @GIMPTOOL_CHECK@
-GIMP_BIN = @GIMP_BIN@
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@
-GLIBC21 = @GLIBC21@
-GMOFILES = @GMOFILES@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
GMSGFMT = @GMSGFMT@
GNUCFLAGS = @GNUCFLAGS@
-IJS_BIN = @IJS_BIN@
+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_INSTALL = @IJS_INSTALL@
IJS_LIBS = @IJS_LIBS@
-INSTOBJEXT = @INSTOBJEXT@
-INTLBISON = @INTLBISON@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SAMPLES_FALSE = @INSTALL_SAMPLES_FALSE@
+INSTALL_SAMPLES_TRUE = @INSTALL_SAMPLES_TRUE@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTALL_USER_GUIDE_FALSE = @INSTALL_USER_GUIDE_FALSE@
+INSTALL_USER_GUIDE_TRUE = @INSTALL_USER_GUIDE_TRUE@
INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
-INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
+LDFLAGS = @LDFLAGS@
LEX = @LEX@
-LIBGIMPPRINT_LIBS = @LIBGIMPPRINT_LIBS@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
-LIBM = @LIBM@
+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@
-LT_AGE = @LT_AGE@
-LT_CURRENT = @LT_CURRENT@
-LT_RELEASE = @LT_RELEASE@
-LT_REVISION = @LT_REVISION@
MAINT = @MAINT@
MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@
-MAIN_BIN = @MAIN_BIN@
-MAIN_DAT = @MAIN_DAT@
-MAIN_MAN = @MAIN_MAN@
-MAIN_SCR = @MAIN_SCR@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
-OBJDUMP = @OBJDUMP@
+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@
-POFILES = @POFILES@
POSUB = @POSUB@
-PRINT_VASPRINTF = @PRINT_VASPRINTF@
RANLIB = @RANLIB@
RELEASE_DATE = @RELEASE_DATE@
RM = @RM@
-SAMPLE_IMAGES = @SAMPLE_IMAGES@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
STRIP = @STRIP@
-TESTPATTERN_BIN = @TESTPATTERN_BIN@
-TEST_BIN = @TEST_BIN@
TEXI2HTML = @TEXI2HTML@
-USER_GUIDE = @USER_GUIDE@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_LEVEL3_PS_FALSE = @USE_LEVEL3_PS_FALSE@
+USE_LEVEL3_PS_TRUE = @USE_LEVEL3_PS_TRUE@
USE_NLS = @USE_NLS@
+USE_NLS_FALSE = @USE_NLS_FALSE@
+USE_NLS_TRUE = @USE_NLS_TRUE@
VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
YACC = @YACC@
-YACC_PROG = @YACC_PROG@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+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@
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@
+exec_prefix = @exec_prefix@
+gimp2_plug_indir = @gimp2_plug_indir@
gimp_plug_indir = @gimp_plug_indir@
-gimpprint_cflags = @gimpprint_cflags@
-gimpprint_libs = @gimpprint_libs@
-
+gutenprint_cflags = @gutenprint_cflags@
+gutenprint_libs = @gutenprint_libs@
+gutenprintui2_cflags = @gutenprintui2_cflags@
+gutenprintui2_libs = @gutenprintui2_libs@
+gutenprintui_cflags = @gutenprintui_cflags@
+gutenprintui_libs = @gutenprintui_libs@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
AUTOMAKE_OPTIONS = 1.4 gnu
-
MAINT_CHARSET = latin1
-
-AM_CFLAGS = $(GNUCFLAGS)
-INCLUDES = @INCLUDES@ $(LIBGIMPPRINT_CFLAGS) -I$(top_srcdir)/src/main
-LIBPRINTUT = $(top_builddir)/lib/libprintut.la
-LIBS = $(INTLLIBS) @LIBS@
-
-TESTS = run-testdither run-weavetest
-
-@BUILD_TEST_TRUE@noinst_PROGRAMS = testdither escp2-weavetest unprint pcl-unprint bjc-unprint
-
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS)
+LOCAL_CPPFLAGS = -I$(top_srcdir)/src/main $(GUTENPRINT_CFLAGS)
+TESTS = curve run-testdither run-weavetest
escp2_weavetest_SOURCES = escp2-weavetest.c
-escp2_weavetest_LDADD = $(LIBPRINTUT) $(LIBGIMPPRINT_LIBS)
-escp2_weavetest_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
-
+escp2_weavetest_LDADD = $(GUTENPRINT_LIBS)
unprint_SOURCES = unprint.c
-unprint_LDADD = $(LIBPRINTUT)
-
+unprint_LDADD = $(GUTENPRINT_LIBS)
+curve_SOURCES = curve.c
+curve_LDADD = $(GUTENPRINT_LIBS)
pcl_unprint_SOURCES = pcl-unprint.c
-pcl_unprint_LDADD = $(LIBPRINTUT)
-
+pcl_unprint_LDADD = $(GUTENPRINT_LIBS)
bjc_unprint_SOURCES = bjc-unprint.c
-bjc_unprint_LDADD = $(LIBPRINTUT)
-
+bjc_unprint_LDADD = $(GUTENPRINT_LIBS)
testdither_SOURCES = testdither.c
-testdither_LDADD = $(LIBPRINTUT) $(LIBGIMPPRINT_LIBS)
-testdither_DEPENDENCIES = $(LIBGIMPPRINT_LIBS)
+testdither_LDADD = $(GUTENPRINT_LIBS)
+xml_curve_SOURCES = xml-curve.c
+xml_curve_LDADD = $(GUTENPRINT_LIBS)
#run-weavetest: escp2-weavetest
-
CLEANFILES = mixed-color-1bit.ppm
MAINTAINERCLEANFILES = Makefile.in
-
EXTRA_DIST = cyan-sweep.tif parse-escp2 run-weavetest run-testdither
-mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-@BUILD_TEST_TRUE@noinst_PROGRAMS = testdither$(EXEEXT) \
-@BUILD_TEST_TRUE@escp2-weavetest$(EXEEXT) unprint$(EXEEXT) \
-@BUILD_TEST_TRUE@pcl-unprint$(EXEEXT) bjc-unprint$(EXEEXT)
-PROGRAMS = $(noinst_PROGRAMS)
-
+all: all-am
-DEFS = @DEFS@ -I. -I$(srcdir) -I..
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-testdither_OBJECTS = testdither.$(OBJEXT)
-testdither_LDFLAGS =
-escp2_weavetest_OBJECTS = escp2-weavetest.$(OBJEXT)
-escp2_weavetest_LDFLAGS =
-unprint_OBJECTS = unprint.$(OBJEXT)
-unprint_DEPENDENCIES = $(top_builddir)/lib/libprintut.la
-unprint_LDFLAGS =
-pcl_unprint_OBJECTS = pcl-unprint.$(OBJEXT)
-pcl_unprint_DEPENDENCIES = $(top_builddir)/lib/libprintut.la
-pcl_unprint_LDFLAGS =
-bjc_unprint_OBJECTS = bjc-unprint.$(OBJEXT)
-bjc_unprint_DEPENDENCIES = $(top_builddir)/lib/libprintut.la
-bjc_unprint_LDFLAGS =
-CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON = Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP_ENV = --best
-SOURCES = $(testdither_SOURCES) $(escp2_weavetest_SOURCES) $(unprint_SOURCES) $(pcl_unprint_SOURCES) $(bjc_unprint_SOURCES)
-OBJECTS = $(testdither_OBJECTS) $(escp2_weavetest_OBJECTS) $(unprint_OBJECTS) $(pcl_unprint_OBJECTS) $(bjc_unprint_OBJECTS)
-
-all: all-redirect
.SUFFIXES:
-.SUFFIXES: .S .c .lo .o .obj .s
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps test/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-mostlyclean-noinstPROGRAMS:
+.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 test/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu test/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
clean-noinstPROGRAMS:
- -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-
-distclean-noinstPROGRAMS:
-
-maintainer-clean-noinstPROGRAMS:
-
-.c.o:
- $(COMPILE) -c $<
-
-# FIXME: We should only use cygpath when building on Windows,
-# and only if it is available.
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.o:
- $(COMPILE) -c $<
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+bjc-unprint$(EXEEXT): $(bjc_unprint_OBJECTS) $(bjc_unprint_DEPENDENCIES)
+ @rm -f bjc-unprint$(EXEEXT)
+ $(LINK) $(bjc_unprint_LDFLAGS) $(bjc_unprint_OBJECTS) $(bjc_unprint_LDADD) $(LIBS)
+curve$(EXEEXT): $(curve_OBJECTS) $(curve_DEPENDENCIES)
+ @rm -f curve$(EXEEXT)
+ $(LINK) $(curve_LDFLAGS) $(curve_OBJECTS) $(curve_LDADD) $(LIBS)
+escp2-weavetest$(EXEEXT): $(escp2_weavetest_OBJECTS) $(escp2_weavetest_DEPENDENCIES)
+ @rm -f escp2-weavetest$(EXEEXT)
+ $(LINK) $(escp2_weavetest_LDFLAGS) $(escp2_weavetest_OBJECTS) $(escp2_weavetest_LDADD) $(LIBS)
+pcl-unprint$(EXEEXT): $(pcl_unprint_OBJECTS) $(pcl_unprint_DEPENDENCIES)
+ @rm -f pcl-unprint$(EXEEXT)
+ $(LINK) $(pcl_unprint_LDFLAGS) $(pcl_unprint_OBJECTS) $(pcl_unprint_LDADD) $(LIBS)
+testdither$(EXEEXT): $(testdither_OBJECTS) $(testdither_DEPENDENCIES)
+ @rm -f testdither$(EXEEXT)
+ $(LINK) $(testdither_LDFLAGS) $(testdither_OBJECTS) $(testdither_LDADD) $(LIBS)
+unprint$(EXEEXT): $(unprint_OBJECTS) $(unprint_DEPENDENCIES)
+ @rm -f unprint$(EXEEXT)
+ $(LINK) $(unprint_LDFLAGS) $(unprint_OBJECTS) $(unprint_LDADD) $(LIBS)
+xml-curve$(EXEEXT): $(xml_curve_OBJECTS) $(xml_curve_DEPENDENCIES)
+ @rm -f xml-curve$(EXEEXT)
+ $(LINK) $(xml_curve_LDFLAGS) $(xml_curve_OBJECTS) $(xml_curve_LDADD) $(LIBS)
mostlyclean-compile:
- -rm -f *.o core *.core
-rm -f *.$(OBJEXT)
-clean-compile:
-
distclean-compile:
-rm -f *.tab.c
-maintainer-clean-compile:
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjc-unprint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escp2-weavetest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcl-unprint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdither.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unprint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml-curve.Po@am__quote@
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@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 $<
-.s.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@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) '$<'`
-.S.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@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
@@ -324,194 +480,271 @@ clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-
-maintainer-clean-libtool:
-
-testdither$(EXEEXT): $(testdither_OBJECTS) $(testdither_DEPENDENCIES)
- @rm -f testdither$(EXEEXT)
- $(LINK) $(testdither_LDFLAGS) $(testdither_OBJECTS) $(testdither_LDADD) $(LIBS)
-
-escp2-weavetest$(EXEEXT): $(escp2_weavetest_OBJECTS) $(escp2_weavetest_DEPENDENCIES)
- @rm -f escp2-weavetest$(EXEEXT)
- $(LINK) $(escp2_weavetest_LDFLAGS) $(escp2_weavetest_OBJECTS) $(escp2_weavetest_LDADD) $(LIBS)
-
-unprint$(EXEEXT): $(unprint_OBJECTS) $(unprint_DEPENDENCIES)
- @rm -f unprint$(EXEEXT)
- $(LINK) $(unprint_LDFLAGS) $(unprint_OBJECTS) $(unprint_LDADD) $(LIBS)
-
-pcl-unprint$(EXEEXT): $(pcl_unprint_OBJECTS) $(pcl_unprint_DEPENDENCIES)
- @rm -f pcl-unprint$(EXEEXT)
- $(LINK) $(pcl_unprint_LDFLAGS) $(pcl_unprint_OBJECTS) $(pcl_unprint_LDADD) $(LIBS)
-
-bjc-unprint$(EXEEXT): $(bjc_unprint_OBJECTS) $(bjc_unprint_DEPENDENCIES)
- @rm -f bjc-unprint$(EXEEXT)
- $(LINK) $(bjc_unprint_LDFLAGS) $(bjc_unprint_OBJECTS) $(bjc_unprint_LDADD) $(LIBS)
-
+ -rm -f libtool
+uninstall-info-am:
+
+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
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+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; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ 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)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ 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 "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
-clean-tags:
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
- -rm -f TAGS ID
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = test
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list='$(TESTS)'; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
+ $(mkdir_p) $(distdir)/../scripts
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ 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 \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
fi; \
done
-bjc-unprint.o: bjc-unprint.c ../config.h ../lib/libprintut.h \
- ../lib/xmalloc.h
-escp2-weavetest.o: escp2-weavetest.c ../config.h ../lib/libprintut.h \
- ../lib/xmalloc.h ../include/gimp-print/gimp-print.h \
- ../src/main/gimp-print-internal.h
-pcl-unprint.o: pcl-unprint.c ../config.h ../lib/libprintut.h \
- ../lib/xmalloc.h
-testdither.o: testdither.c ../config.h \
- ../include/gimp-print/gimp-print.h ../lib/libprintut.h \
- ../lib/xmalloc.h ../src/main/gimp-print-internal.h
-unprint.o: unprint.c ../config.h ../lib/libprintut.h ../lib/xmalloc.h
-
-check-TESTS: $(TESTS)
- @failed=0; all=0; \
- srcdir=$(srcdir); export srcdir; \
- for tst in $(TESTS); do \
- if test -f $$tst; then dir=.; \
- else dir="$(srcdir)"; fi; \
- if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
- all=`expr $$all + 1`; \
- echo "PASS: $$tst"; \
- elif test $$? -ne 77; then \
- all=`expr $$all + 1`; \
- failed=`expr $$failed + 1`; \
- echo "FAIL: $$tst"; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="$$failed of $$all tests failed"; \
- fi; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am:
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
install-exec: install-exec-am
-
-install-data-am:
install-data: install-data-am
+uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile $(PROGRAMS)
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-
+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:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -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)
-mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \
- mostlyclean-libtool mostlyclean-tags \
- mostlyclean-generic
+clean: clean-am
-mostlyclean: mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
-clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
- clean-generic mostlyclean-am
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
-clean: clean-am
+dvi: dvi-am
-distclean-am: distclean-noinstPROGRAMS distclean-compile \
- distclean-libtool distclean-tags distclean-generic \
- clean-am
- -rm -f libtool
+dvi-am:
-distclean: distclean-am
+html: html-am
-maintainer-clean-am: maintainer-clean-noinstPROGRAMS \
- maintainer-clean-compile maintainer-clean-libtool \
- maintainer-clean-tags maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
-.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
-clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile mostlyclean-libtool distclean-libtool \
-clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir check-TESTS \
-info-am info dvi-am dvi check check-am installcheck-am installcheck \
-install-exec-am install-exec install-data-am install-data install-am \
-install uninstall-am uninstall all-redirect all-am all installdirs \
-mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-generic clean-libtool clean-noinstPROGRAMS 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-exec install-exec-am install-info \
+ install-info-am install-man 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-info-am
@SET_MAKE@
-$(LIBGIMPPRINT_LIBS):
- cd ../src/main ; \
+export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main
+export STP_DATA_PATH = $(top_srcdir)/src/main
+
+# 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/test/bjc-unprint.c b/test/bjc-unprint.c
index eb70301..fbc3ed5 100644
--- a/test/bjc-unprint.c
+++ b/test/bjc-unprint.c
@@ -1,4 +1,4 @@
-/* $Id: bjc-unprint.c,v 1.6 2001/08/13 23:59:13 rlk Exp $ */
+/* $Id: bjc-unprint.c,v 1.10 2004/09/17 18:38:27 rleigh Exp $ */
/*
* Convert BJC-printjobs to xbm files, one for each color channel
*
@@ -23,15 +23,11 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-
-#include "../lib/libprintut.h"
+#include <gutenprint/util.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <malloc.h>
-
-char *outfilename= 0;
char *efnlc= 0,*efnlm= 0,*efnc= 0,*efnm= 0,*efny= 0,*efnk= 0;
int lc_cnt= 0,lm_cnt= 0,ly_cnt= 0,c_cnt= 0,m_cnt= 0,y_cnt= 0,k_cnt= 0;
@@ -86,7 +82,7 @@ int process(FILE *infile, scanline_t *sf[7], int *xmin_, int *xmax_,
bitimage_t *bitimage_new(void)
{
- bitimage_t *tmp= (bitimage_t*) xmalloc (sizeof(bitimage_t));
+ bitimage_t *tmp= (bitimage_t*) stp_malloc (sizeof(bitimage_t));
tmp->buf= 0;
tmp->y0= 0;
tmp->width= 0;
@@ -190,7 +186,7 @@ int rle_decode(unsigned char *inbuf, int n, unsigned char *outbuf,int max)
scanline_t* scanline_new(void)
{
- scanline_t* tmp= (scanline_t*) xmalloc (sizeof(scanline_t));
+ scanline_t* tmp= (scanline_t*) stp_malloc (sizeof(scanline_t));
tmp->size= 0;
tmp->osize= 0;
tmp->buf= 0;
@@ -206,7 +202,7 @@ scanline_t *scanline_store(scanline_t *line, int y, unsigned char *buf, int size
if (!line && !(line= scanline_new()))
return 0;
line->size= size;
- line->buf= (unsigned char *) xmalloc (size);
+ line->buf= (unsigned char *) stp_malloc (size);
memcpy(line->buf,buf,size);
rle_info(buf,size,&line->xmin,&line->xmax,&line->width,&line->osize);
/* fprintf(stderr,"%d %d %d %d ",size,line->xmin,line->xmax,line->width); */
@@ -238,7 +234,7 @@ bitimage_t *scanlines2bitimage(scanline_t *slimg)
img= bitimage_new();
- img->buf= (unsigned char*) xmalloc(h*w);
+ img->buf= (unsigned char*) stp_malloc(h*w);
memset(img->buf,0,h*w);
img->width= w;
img->height= h;
@@ -271,7 +267,7 @@ char conv(char i) {
void save2xbm(const char *filename,char col, bitimage_t *img,
int xmin, int ymin, int xmax, int ymax)
{
- char *outfilename= (char*) xmalloc(strlen(filename)+16);
+ char *outfilename= (char*) stp_malloc(strlen(filename)+16);
FILE *o;
int i,j,k,i0,i1,j0,j1,w,h;
@@ -283,7 +279,7 @@ void save2xbm(const char *filename,char col, bitimage_t *img,
sprintf(outfilename,"%s.xbm",filename);
if (!(o= fopen(outfilename,"w"))) {
- free(outfilename);
+ stp_free(outfilename);
return;
}
@@ -407,7 +403,7 @@ int process(FILE *infile,scanline_t *sf[7],int *xmin_,int *xmax_,int *ymin_,int
sl[col]->next= nsl;
sl[col]= nsl;
} else {
- free (nsl);
+ stp_free (nsl);
nsl= 0;
}
diff --git a/test/curve.c b/test/curve.c
new file mode 100644
index 0000000..74aefd0
--- /dev/null
+++ b/test/curve.c
@@ -0,0 +1,1157 @@
+/*
+ * "$Id: curve.c,v 1.22 2004/09/17 18:38:28 rleigh Exp $"
+ *
+ * Copyright 2002 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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#ifdef __GNU_LIBRARY__
+#include <getopt.h>
+#endif
+
+#define DEBUG_SIGNAL
+#define MIN(x, y) ((x) <= (y) ? (x) : (y))
+#include <gutenprint/gutenprint.h>
+
+int global_test_count = 0;
+int global_error_count = 0;
+int verbose = 0;
+int quiet = 0;
+
+#ifdef __GNU_LIBRARY__
+
+struct option optlist[] =
+{
+ { "quiet", 0, NULL, (int) 'q' },
+ { "verbose", 0, NULL, (int) 'v' },
+ { NULL, 0, NULL, 0 }
+};
+#endif
+
+struct test_failure
+{
+ int test_number;
+ struct test_failure *next;
+};
+
+static struct test_failure *test_failure_head = NULL;
+static struct test_failure *test_failure_tail = NULL;
+
+static void
+TEST_internal(const char *name, int line)
+{
+ global_test_count++;
+ printf("%d.%d: Checking %s... ", global_test_count, line, name);
+ fflush(stdout);
+}
+
+#define TEST(name) TEST_internal(name, __LINE__)
+
+static void
+TEST_PASS(void)
+{
+ printf("PASS\n");
+ fflush(stdout);
+}
+
+static void
+TEST_FAIL(void)
+{
+ struct test_failure *test_failure_tmp = malloc(sizeof(struct test_failure));
+ test_failure_tmp->next = NULL;
+ test_failure_tmp->test_number = global_test_count;
+
+ if (!test_failure_head)
+ {
+ test_failure_head = test_failure_tmp;
+ test_failure_tail = test_failure_head;
+ }
+ else
+ {
+ test_failure_tail->next = test_failure_tmp;
+ test_failure_tail = test_failure_tmp;
+ }
+
+ global_error_count++;
+ printf("FAIL\n");
+ fflush(stdout);
+}
+
+#define SIMPLE_TEST_CHECK(conditional) \
+do { \
+ if ((conditional)) \
+ TEST_PASS(); \
+ else \
+ TEST_FAIL(); \
+} while (0)
+
+static const double standard_sat_adjustment[] =
+{
+ 0.50, 0.6, 0.7, 0.8, 0.9, 0.86, 0.82, 0.79, /* C */
+ 0.78, 0.8, 0.83, 0.87, 0.9, 0.95, 1.05, 1.15, /* B */
+ 1.3, 1.25, 1.2, 1.15, 1.12, 1.09, 1.06, 1.03, /* M */
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, /* R */
+ 1.0, 0.9, 0.8, 0.7, 0.65, 0.6, 0.55, 0.52, /* Y */
+ 0.48, 0.47, 0.47, 0.49, 0.49, 0.49, 0.52, 0.51, /* G */
+};
+
+static const stp_curve_point_t standard_piecewise_sat_adjustment[] =
+{
+ { 0.00, 0.50},
+ { 0.02, 0.6},
+ { 0.04, 0.7},
+ { 0.06, 0.8},
+ { 0.08, 0.9},
+ { 0.10, 0.86},
+ { 0.12, 0.82},
+ { 0.14, 0.79},
+ { 0.16, 0.78},
+ { 0.18, 0.8},
+ { 0.20, 0.83},
+ { 0.22, 0.87},
+ { 0.24, 0.9},
+ { 0.26, 0.95},
+ { 0.28, 1.05},
+ { 0.30, 1.15},
+ { 0.32, 0.05},
+ { 0.34, 3.95},
+ { 0.36, 0.05},
+ { 0.38, 1.15},
+ { 0.40, 1.12},
+ { 0.42, 1.09},
+ { 0.44, 1.06},
+ { 0.46, 1.03},
+ { 0.48, 1.0},
+ { 0.50, 1.0},
+ { 0.52, 1.0},
+ { 0.54, 1.0},
+ { 0.56, 1.0},
+ { 0.58, 1.0},
+ { 0.60, 1.0},
+ { 0.62, 1.0},
+ { 0.64, 1.0},
+ { 0.66, 0.9},
+ { 0.68, 0.8},
+ { 0.70, 0.7},
+ { 0.72, 0.65},
+ { 0.74, 0.6},
+ { 0.76, 0.55},
+ { 0.78, 0.52},
+ { 0.80, 0.48},
+ { 0.82, 0.47},
+ { 0.84, 0.47},
+ { 0.86, 0.49},
+ { 0.88, 0.49},
+ { 0.90, 0.49},
+ { 0.93, 0.52},
+ { 0.96, 0.51},
+ { 1.00, 2},
+};
+
+const char *small_piecewise_curve =
+"<?xml version=\"1.0\"?>\n"
+"<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+"xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+"<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
+"<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
+"0 0.5 0.1 0.6 1.00 0.51\n"
+"</sequence>\n"
+"</curve>\n"
+"</gutenprint>\n";
+
+const char *good_curves[] =
+ {
+ /* Space separated, in same layout as output for comparison */
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+ "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
+ "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
+ "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ /* Space separated, in same layout as output for comparison */
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+ "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
+ "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
+ "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ /* Space separated, in same layout as output for comparison */
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"wrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
+ "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
+ "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
+ "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ /* Space separated, in same layout as output for comparison */
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"nowrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
+ "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
+ "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
+ "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
+ "<sequence count=\"96\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0 0.5 0.02 0.6 0.04 0.7 0.06 0.8 0.08 0.9 0.1 0.86 0.12 0.82 0.14 0.79 0.16\n"
+ "0.78 0.18 0.8 0.2 0.83 0.22 0.87 0.24 0.9 0.26 0.95 0.28 1.05 0.3 1.15 0.32\n"
+ "1.3 0.34 1.25 0.36 1.2 0.38 1.15 0.4 1.12 0.42 1.09 0.44 1.06 0.46 1.03\n"
+ "0.48 1 0.5 1 0.52 1 0.54 1 0.56 1 0.58 1 0.6 1 0.62 1 0.64 1 0.66 0.9 0.68\n"
+ "0.8 0.7 0.7 0.72 0.65 0.74 0.6 0.76 0.55 0.78 0.52 0.8 0.48 0.82 0.47 0.84\n"
+ "0.47 0.86 0.49 0.88 0.49 0.9 0.49 0.93 0.52 0.96 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
+ "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0 0.5 0.02 0.6 0.96 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ /* Gamma curve 1 */
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"1\" piecewise=\"false\">\n"
+ "<sequence count=\"0\" lower-bound=\"0\" upper-bound=\"4\"/>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ /* Gamma curve 2 */
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"1\" piecewise=\"false\">\n"
+ "<sequence count=\"0\" lower-bound=\"0\" upper-bound=\"4\"/>\n"
+ "</curve>\n"
+ "</gutenprint>\n"
+ };
+
+static const int good_curve_count = sizeof(good_curves) / sizeof(const char *);
+
+const char *bad_curves[] =
+ {
+ /* Bad point count */
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+ "<sequence count=\"-1\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8\n"
+ "0.83 0.87 0.9 0.95 1.05 1.15 1.3 1.25 1.2 1.15\n"
+ "1.12 1.09 1.06 1.03 1 1 1 1 1 1\n"
+ "1 1 1 0.9 0.8 0.7 0.65 0.6 0.55 0.52\n"
+ "0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
+ "</sequence></curve></gutenprint>\n",
+
+ /* Bad point count */
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+ "<sequence count=\"200\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8\n"
+ "0.83 0.87 0.9 0.95 1.05 1.15 1.3 1.25 1.2 1.15\n"
+ "1.12 1.09 1.06 1.03 1 1 1 1 1 1\n"
+ "1 1 1 0.9 0.8 0.7 0.65 0.6 0.55 0.52\n"
+ "0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
+ "</sequence></curve></gutenprint>\n",
+
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
+ "<sequence count=\"5\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0 0.5 0.02 0.6 0.96\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
+ "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0 0.5 0.02 0.6 0.96 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ "<?xml version=\"1.0\"?>\n"
+ "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
+ "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
+ "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "0.01 0.5 0.02 0.6 1.0 0.51\n"
+ "</sequence>\n"
+ "</curve>\n"
+ "</gutenprint>\n",
+
+ /* Gamma curves */
+ /* Incorrect wrap mode */
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
+ "<sequence count=\"-1\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "</sequence></curve></gutenprint>\n",
+
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
+ "<sequence count=\"1\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "</sequence></curve></gutenprint>\n",
+
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
+ "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "</sequence></curve></gutenprint>\n",
+
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
+ "<sequence count=\"0\" lower-bound=\"0\" upper-bound=\"4\">\n"
+ "</sequence></curve></gutenprint>\n"
+ };
+
+static const int bad_curve_count = sizeof(bad_curves) / sizeof(const char *);
+
+const char *linear_curve_1 =
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<gutenprint><curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+"<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
+"0 0 0 1 1 1"
+"</sequence></curve></gutenprint>";
+
+const char *linear_curve_2 =
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+"<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
+"0 0 0 1 1 1"
+"</sequence></curve></gutenprint>";
+
+const char *linear_curve_3 =
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<gutenprint><curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+"<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
+"0 0 0 1 1 1"
+"</sequence></curve></gutenprint>";
+
+const char *linear_curve_4 =
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
+"<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
+"0 0 0 1 1 1"
+"</sequence></curve></gutenprint>";
+
+const char *spline_curve_1 =
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<gutenprint><curve wrap=\"nowrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
+"<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
+"0 0 0 1 1 1"
+"</sequence></curve></gutenprint>";
+
+const char *spline_curve_2 =
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<gutenprint><curve wrap=\"wrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
+"<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
+"0 0 0 1 1 1"
+"</sequence></curve></gutenprint>";
+
+static void
+piecewise_curve_checks(stp_curve_t *curve1, int resample_points, int expected)
+{
+ stp_curve_t *curve2;
+ const stp_curve_point_t *curve_points;
+ size_t count;
+ int i;
+ double low;
+
+ TEST("get data points of piecewise curve");
+ curve_points = stp_curve_get_data_points(curve1, &count);
+ if (curve_points)
+ {
+ int bad_compare = 0;
+ TEST_PASS();
+ TEST("Checking count of curve points");
+ if (count == expected)
+ TEST_PASS();
+ else
+ {
+ TEST_FAIL();
+ if (!quiet)
+ printf("Expected %d points, got %d\n", expected, count);
+ }
+ TEST("Comparing data");
+ for (i = 0; i < count; i++)
+ {
+ if (curve_points[i].x != standard_piecewise_sat_adjustment[i].x ||
+ curve_points[i].y - .0000001 > standard_piecewise_sat_adjustment[i].y ||
+ curve_points[i].y + .0000001 < standard_piecewise_sat_adjustment[i].y)
+ {
+ bad_compare = 1;
+ if (!quiet)
+ printf("Miscompare at element %d: (%f, %f) (%f, %f)\n", i,
+ standard_piecewise_sat_adjustment[i].x,
+ standard_piecewise_sat_adjustment[i].y,
+ curve_points[i].x, curve_points[i].y);
+ }
+ }
+ SIMPLE_TEST_CHECK(!bad_compare);
+ }
+ else
+ TEST_FAIL();
+
+ TEST("get sequence of piecewise curve (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!stp_curve_get_sequence(curve1));
+
+ TEST("get data of piecewise curve (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!stp_curve_get_data(curve1, &count));
+
+ TEST("set data point of piecewise curve (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!stp_curve_set_point(curve1, 2, 1.0));
+
+ TEST("get data point of piecewise curve (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!stp_curve_get_point(curve1, 2, &low));
+
+ TEST("interpolate piecewise curve (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!stp_curve_interpolate_value(curve1, .5, &low));
+
+ TEST("rescale piecewise curve");
+ SIMPLE_TEST_CHECK(stp_curve_rescale(curve1, .5, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE));
+
+ TEST("get float data of piecewise curve (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!stp_curve_get_float_data(curve1, &count));
+
+ TEST("get subrange on piecewise curve (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!(curve2 = stp_curve_get_subrange(curve1, 0, 2)));
+ if (!quiet && curve2)
+ stp_curve_write(stdout, curve2);
+
+ TEST("set subrange on piecewise curve (PASS is an expected failure)");
+ curve2 = stp_curve_create_from_string(linear_curve_2);
+ if (stp_curve_set_subrange(curve1, curve2, 1))
+ {
+ TEST_FAIL();
+ if (!quiet)
+ stp_curve_write(stdout, curve2);
+ }
+ else
+ TEST_PASS();
+
+ if (resample_points > 0)
+ {
+ char tmpbuf[64];
+ sprintf(tmpbuf, "resample piecewise curve to %d points", resample_points);
+ TEST(tmpbuf);
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, resample_points));
+
+ TEST("resampled curve is not piecewise");
+ SIMPLE_TEST_CHECK(!stp_curve_is_piecewise(curve1));
+
+ TEST("get data points of piecewise copy (PASS is an expected failure)");
+ SIMPLE_TEST_CHECK(!stp_curve_get_data_points(curve1, &count));
+
+ TEST("get sequence of piecewise copy");
+ SIMPLE_TEST_CHECK(stp_curve_get_sequence(curve1));
+
+ TEST("get data of piecewise copy");
+ SIMPLE_TEST_CHECK(stp_curve_get_data(curve1, &count));
+
+ TEST("set data point of piecewise copy");
+ SIMPLE_TEST_CHECK(stp_curve_set_point(curve1, 2, 0.51));
+
+ TEST("get data point of piecewise copy");
+ SIMPLE_TEST_CHECK(stp_curve_get_point(curve1, 2, &low));
+
+ TEST("interpolate piecewise copy");
+ SIMPLE_TEST_CHECK(stp_curve_interpolate_value(curve1, .5, &low));
+
+ TEST("rescale piecewise copy");
+ SIMPLE_TEST_CHECK(stp_curve_rescale(curve1, 2,
+ STP_CURVE_COMPOSE_MULTIPLY,
+ STP_CURVE_BOUNDS_RESCALE));
+
+ TEST("get float data of piecewise copy");
+ SIMPLE_TEST_CHECK(stp_curve_get_float_data(curve1, &count));
+
+ TEST("get subrange on piecewise copy");
+ SIMPLE_TEST_CHECK((curve2 = stp_curve_get_subrange(curve1, 0, 2)));
+ if (verbose && curve2)
+ stp_curve_write(stdout, curve2);
+
+ if (resample_points > 10)
+ {
+ TEST("set subrange on piecewise copy");
+ curve2 = stp_curve_create_from_string(linear_curve_2);
+ if (verbose)
+ stp_curve_write(stdout, curve1);
+ if (stp_curve_set_subrange(curve1, curve2, 4))
+ {
+ TEST_PASS();
+ if (verbose)
+ stp_curve_write(stdout, curve1);
+ }
+ else
+ TEST_FAIL();
+ }
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ char *tmp;
+ int i;
+ size_t count;
+ double low, high;
+
+ stp_curve_t *curve1;
+ stp_curve_t *curve2;
+ stp_curve_t *curve3;
+ const stp_curve_point_t *curve_points;
+
+ while (1)
+ {
+#ifdef __GNU_LIBRARY__
+ int option_index = 0;
+ int c = getopt_long(argc, argv, "qv", optlist, &option_index);
+#else
+ int c = getopt(argc, argv, "qv");
+#endif
+ if (c == -1)
+ break;
+ switch (c)
+ {
+ case 'q':
+ quiet = 1;
+ verbose = 0;
+ break;
+ case 'v':
+ quiet = 0;
+ verbose = 1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ stp_init();
+
+ TEST("creation of XML string from curve");
+ curve1 = stp_curve_create(STP_CURVE_WRAP_AROUND);
+ stp_curve_set_bounds(curve1, 0.0, 4.0);
+ stp_curve_set_data(curve1, 48, standard_sat_adjustment);
+ tmp = stp_curve_write_string(curve1);
+ stp_curve_destroy(curve1);
+ curve1 = NULL;
+ SIMPLE_TEST_CHECK(tmp);
+ if (verbose)
+ printf("%s\n", tmp);
+
+
+ TEST("creation of curve from XML string (stp_curve_create_from_string)");
+ SIMPLE_TEST_CHECK((curve2 = stp_curve_create_from_string(tmp)));
+ free(tmp);
+
+ TEST("stp_curve_resample");
+ if (curve2 != NULL && stp_curve_resample(curve2, 95) == 0)
+ {
+ TEST_FAIL();
+ }
+ else
+ {
+ TEST_PASS();
+ if (verbose)
+ stp_curve_write(stdout, curve2);
+ }
+ if (curve2)
+ {
+ stp_curve_destroy(curve2);
+ curve2 = NULL;
+ }
+
+ if (!quiet)
+ printf("Testing known bad curves...\n");
+ for (i = 0; i < bad_curve_count; i++)
+ {
+ stp_curve_t *bad = NULL;
+ TEST("BAD curve (PASS is an expected failure)");
+ if ((bad = stp_curve_create_from_string(bad_curves[i])) != NULL)
+ {
+ TEST_FAIL();
+ if (!quiet)
+ {
+ stp_curve_write(stdout, bad);
+ printf("\n");
+ }
+ stp_curve_destroy(bad);
+ bad = NULL;
+ }
+ else
+ TEST_PASS();
+ }
+
+ if (!quiet)
+ printf("Testing known good curves...\n");
+ for (i = 0; i < good_curve_count; i++)
+ {
+ if (curve2)
+ {
+ stp_curve_destroy(curve2);
+ curve2 = NULL;
+ }
+ TEST("GOOD curve");
+ if ((curve2 = stp_curve_create_from_string(good_curves[i])) != NULL)
+ {
+ TEST_PASS();
+ tmp = stp_curve_write_string(curve2);
+ TEST("whether XML curve is identical to original");
+ if (tmp && strcmp((const char *) tmp, good_curves[i]))
+ {
+ TEST_FAIL();
+ if (!quiet)
+ {
+ printf("XML:\n");
+ printf("%s", tmp);
+ printf("Original:\n");
+ printf("%s", good_curves[i]);
+ printf("End:\n");
+ }
+ }
+ else
+ {
+ TEST_PASS();
+ if (verbose)
+ printf("%s", tmp);
+ }
+ free(tmp);
+ }
+ else
+ TEST_FAIL();
+ }
+ if (curve2)
+ {
+ stp_curve_destroy(curve2);
+ curve2 = NULL;
+ }
+ if (verbose)
+ printf("Allocate 1\n");
+ curve1 = stp_curve_create(STP_CURVE_WRAP_NONE);
+ if (verbose)
+ printf("Allocate 2\n");
+ curve2 = stp_curve_create(STP_CURVE_WRAP_NONE);
+ TEST("set curve 1 gamma");
+ SIMPLE_TEST_CHECK(stp_curve_set_gamma(curve1, 1.2));
+ if (verbose)
+ stp_curve_write(stdout, curve1);
+ TEST("set curve 2 gamma");
+ SIMPLE_TEST_CHECK(stp_curve_set_gamma(curve2, -1.2));
+ if (verbose)
+ stp_curve_write(stdout, curve2);
+
+ TEST("compose add from gamma curves");
+ SIMPLE_TEST_CHECK(stp_curve_compose(&curve3, curve1, curve2,
+ STP_CURVE_COMPOSE_ADD, 64));
+ if (verbose && curve3)
+ stp_curve_write(stdout, curve3);
+
+ TEST("resample curve 1");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, 64));
+ if (verbose && curve1)
+ stp_curve_write(stdout, curve1);
+ if (curve3)
+ {
+ stp_curve_destroy(curve3);
+ curve3 = NULL;
+ }
+ TEST("compose multiply from gamma curves");
+ if (!stp_curve_compose(&curve3, curve1, curve2, STP_CURVE_COMPOSE_MULTIPLY, 64))
+ TEST_FAIL();
+ else
+ {
+ TEST_PASS();
+ if (verbose)
+ {
+ stp_curve_write(stdout, curve1);
+ stp_curve_write(stdout, curve2);
+ stp_curve_write(stdout, curve3);
+ }
+ }
+
+ TEST("compose add from non-gamma curves");
+ stp_curve_destroy(curve1);
+ stp_curve_destroy(curve2);
+ stp_curve_destroy(curve3);
+ curve1 = stp_curve_create_from_string(good_curves[0]);
+ curve2 = stp_curve_create_from_string(linear_curve_2);
+ SIMPLE_TEST_CHECK(stp_curve_compose(&curve3, curve1, curve2,
+ STP_CURVE_COMPOSE_ADD, 64));
+ if (verbose && curve3)
+ stp_curve_write(stdout, curve3);
+
+ TEST("resample curve 1");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, 64));
+ if (verbose && curve1)
+ stp_curve_write(stdout, curve1);
+ if (curve3)
+ {
+ stp_curve_destroy(curve3);
+ curve3 = NULL;
+ }
+ TEST("compose multiply from non-gamma curves");
+ if (!stp_curve_compose(&curve3, curve1, curve2, STP_CURVE_COMPOSE_MULTIPLY, 64))
+ TEST_FAIL();
+ else
+ {
+ TEST_PASS();
+ if (verbose)
+ {
+ stp_curve_write(stdout, curve1);
+ stp_curve_write(stdout, curve2);
+ stp_curve_write(stdout, curve3);
+ }
+ }
+ if (curve3)
+ {
+ stp_curve_destroy(curve3);
+ curve3 = NULL;
+ }
+
+ TEST("multiply rescale");
+ SIMPLE_TEST_CHECK(stp_curve_rescale(curve2, -1, STP_CURVE_COMPOSE_MULTIPLY,
+ STP_CURVE_BOUNDS_RESCALE));
+ if (verbose && curve2)
+ stp_curve_write(stdout, curve2);
+ TEST("subtract compose");
+ SIMPLE_TEST_CHECK(stp_curve_compose(&curve3, curve1, curve2,
+ STP_CURVE_COMPOSE_ADD, 64));
+ if (verbose && curve3)
+ stp_curve_write(stdout, curve3);
+
+ if (curve3)
+ {
+ stp_curve_destroy(curve3);
+ curve3 = NULL;
+ }
+ if (curve1)
+ {
+ stp_curve_destroy(curve1);
+ curve1 = NULL;
+ }
+ if (curve2)
+ {
+ stp_curve_destroy(curve2);
+ curve2 = NULL;
+ }
+
+ TEST("spline curve 1 creation");
+ SIMPLE_TEST_CHECK((curve1 = stp_curve_create_from_string(spline_curve_1)));
+ TEST("spline curve 2 creation");
+ SIMPLE_TEST_CHECK((curve2 = stp_curve_create_from_string(spline_curve_2)));
+ if (curve1)
+ {
+ if (verbose)
+ stp_curve_write(stdout, curve1);
+ TEST("spline curve 1 resample 1");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, 41));
+ if (verbose && curve1)
+ stp_curve_write(stdout, curve1);
+ TEST("spline curve 1 resample 2");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, 83));
+ if (verbose && curve1)
+ stp_curve_write(stdout, curve1);
+ }
+ if (curve2)
+ {
+ if (verbose)
+ stp_curve_write(stdout, curve2);
+ TEST("spline curve 2 resample");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve2, 48));
+ if (verbose && curve2)
+ stp_curve_write(stdout, curve2);
+ }
+ TEST("compose add (PASS is an expected failure)");
+ if (curve1 && curve2 &&
+ stp_curve_compose(&curve3, curve1, curve2, STP_CURVE_COMPOSE_MULTIPLY, -1))
+ {
+ TEST_FAIL();
+ if (!quiet)
+ printf("compose with different wrap mode should fail!\n");
+ }
+ else
+ TEST_PASS();
+ if (curve1)
+ {
+ stp_curve_destroy(curve1);
+ curve1 = NULL;
+ }
+ if (curve2)
+ {
+ stp_curve_destroy(curve2);
+ curve2 = NULL;
+ }
+
+ TEST("linear curve 1 creation");
+ SIMPLE_TEST_CHECK((curve1 = stp_curve_create_from_string(linear_curve_1)));
+ TEST("linear curve 2 creation");
+ SIMPLE_TEST_CHECK((curve2 = stp_curve_create_from_string(linear_curve_2)));
+
+ TEST("get data points of dense curve (PASS is an expected failure)");
+ curve_points = stp_curve_get_data_points(curve2, &count);
+ SIMPLE_TEST_CHECK(!curve_points);
+
+ if (curve1)
+ {
+ if (verbose)
+ stp_curve_write(stdout, curve1);
+ TEST("linear curve 1 resample");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, 41));
+ if (verbose && curve1)
+ stp_curve_write(stdout, curve1);
+ stp_curve_destroy(curve1);
+ curve1 = NULL;
+ }
+ if (curve2)
+ {
+ if (verbose)
+ stp_curve_write(stdout, curve2);
+ TEST("linear curve 2 resample");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve2, 48));
+ if (verbose && curve2)
+ stp_curve_write(stdout, curve2);
+ stp_curve_destroy(curve2);
+ curve2 = NULL;
+ }
+
+ curve1 = stp_curve_create(STP_CURVE_WRAP_AROUND);
+ stp_curve_set_interpolation_type(curve1, STP_CURVE_TYPE_SPLINE);
+ stp_curve_set_bounds(curve1, 0.0, 4.0);
+ stp_curve_set_data(curve1, 48, standard_sat_adjustment);
+ TEST("setting curve data");
+ SIMPLE_TEST_CHECK(curve1 && (stp_curve_count_points(curve1) == 48));
+ if (verbose)
+ stp_curve_write(stdout, curve1);
+ TEST("curve resample");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, 384));
+ if (verbose)
+ stp_curve_write(stdout, curve1);
+ TEST("very large curve resample");
+ SIMPLE_TEST_CHECK(stp_curve_resample(curve1, 65535));
+ TEST("offsetting large curve");
+#if 0
+ stp_curve_get_range(curve1, &low, &high);
+ fprintf(stderr, "Result original max %f min %f\n", high, low);
+ stp_curve_get_bounds(curve1, &low, &high);
+ fprintf(stderr, "Bounds original max %f min %f\n", high, low);
+#endif
+ SIMPLE_TEST_CHECK(stp_curve_rescale(curve1, 2.0, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE));
+
+ stp_curve_rescale(curve1, 1.0, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ stp_curve_get_bounds(curve1, &low, &high);
+ stp_curve_rescale(curve1, 0.0, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ stp_curve_get_bounds(curve1, &low, &high);
+ stp_curve_rescale(curve1, 0.0, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ stp_curve_get_bounds(curve1, &low, &high);
+ stp_curve_rescale(curve1, 0.0, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ stp_curve_get_bounds(curve1, &low, &high);
+ TEST("writing very large curve to string");
+ tmp = stp_curve_write_string(curve1);
+ if (tmp == NULL)
+ TEST_FAIL();
+ else
+ TEST_PASS();
+ if (tmp)
+ {
+ TEST("reading back very large curve");
+ curve2 = stp_curve_create_from_string(tmp);
+ SIMPLE_TEST_CHECK(stp_curve_count_points(curve2) == 65535);
+
+ free(tmp);
+ TEST("Rescaling readback");
+ SIMPLE_TEST_CHECK(stp_curve_rescale(curve2, -1.0,
+ STP_CURVE_COMPOSE_MULTIPLY,
+ STP_CURVE_BOUNDS_RESCALE));
+ TEST("Adding curves");
+ SIMPLE_TEST_CHECK(stp_curve_compose(&curve3, curve1, curve2,
+ STP_CURVE_COMPOSE_ADD, 65535));
+
+ stp_curve_get_range(curve3, &low, &high);
+ TEST("Comparing results");
+ SIMPLE_TEST_CHECK(low < .00001 && low > -.00001 &&
+ high < .00001 && high > -.00001);
+
+ if (curve1)
+ {
+ stp_curve_destroy(curve1);
+ curve1 = NULL;
+ }
+ }
+
+ TEST("Creating piecewise wrap-around curve");
+ curve1 = stp_curve_create(STP_CURVE_WRAP_AROUND);
+ stp_curve_set_bounds(curve1, 0.0, 4.0);
+
+ SIMPLE_TEST_CHECK(stp_curve_set_data_points
+ (curve1, 48, standard_piecewise_sat_adjustment));
+
+ TEST("Writing piecewise wrap-around curve to string");
+ tmp = stp_curve_write_string(curve1);
+ SIMPLE_TEST_CHECK(tmp);
+ if (verbose)
+ printf("%s\n", tmp);
+
+ TEST("Check curve is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve1));
+
+ TEST("Create copy of piecewise curve");
+ curve2 = stp_curve_create_copy(curve1);
+ SIMPLE_TEST_CHECK(curve2);
+
+ TEST("Check copy is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve2));
+
+ piecewise_curve_checks(curve1, 0, 48);
+ stp_curve_rescale(curve1, -.5, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ piecewise_curve_checks(curve2, 3, 48);
+
+ TEST("Copy in place piecewise curve");
+ stp_curve_copy(curve2, curve1);
+ SIMPLE_TEST_CHECK(curve1);
+ piecewise_curve_checks(curve2, 10, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 15, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 47, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 48, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 49, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 50, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 100, 48);
+ stp_curve_destroy(curve1);
+
+ TEST("Creating piecewise no-wrap curve with not enough data (PASS is an expected failure)");
+ curve1 = stp_curve_create(STP_CURVE_WRAP_NONE);
+ stp_curve_set_bounds(curve1, 0.0, 4.0);
+ SIMPLE_TEST_CHECK(!stp_curve_set_data_points
+ (curve1, 48, standard_piecewise_sat_adjustment));
+
+ TEST("Creating piecewise no-wrap curve correctly");
+ SIMPLE_TEST_CHECK(stp_curve_set_data_points
+ (curve1, 49, standard_piecewise_sat_adjustment));
+
+ TEST("Writing piecewise no-wrap curve to string");
+ tmp = stp_curve_write_string(curve1);
+ SIMPLE_TEST_CHECK(tmp);
+ if (verbose)
+ printf("%s\n", tmp);
+
+ TEST("Check curve is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve1));
+
+ TEST("Create copy of piecewise curve");
+ curve2 = stp_curve_create_copy(curve1);
+ SIMPLE_TEST_CHECK(curve2);
+ TEST("Check copy is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve2));
+
+ piecewise_curve_checks(curve1, 0, 49);
+ stp_curve_rescale(curve1, -.5, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ piecewise_curve_checks(curve2, 3, 49);
+
+ TEST("Copy in place piecewise curve");
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 10, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 15, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 47, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 48, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 49, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 50, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 100, 49);
+
+
+ TEST("Creating piecewise spline wrap-around curve");
+ curve1 = stp_curve_create(STP_CURVE_WRAP_AROUND);
+ stp_curve_set_interpolation_type(curve1, STP_CURVE_TYPE_SPLINE);
+ stp_curve_set_bounds(curve1, 0.0, 4.0);
+
+ SIMPLE_TEST_CHECK(stp_curve_set_data_points
+ (curve1, 48, standard_piecewise_sat_adjustment));
+
+ TEST("Writing piecewise wrap-around curve to string");
+ tmp = stp_curve_write_string(curve1);
+ SIMPLE_TEST_CHECK(tmp);
+ if (verbose)
+ printf("%s\n", tmp);
+
+ TEST("Check curve is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve1));
+
+ TEST("Create copy of piecewise curve");
+ curve2 = stp_curve_create_copy(curve1);
+ SIMPLE_TEST_CHECK(curve2);
+ TEST("Check copy is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve2));
+
+ piecewise_curve_checks(curve1, 0, 48);
+ stp_curve_rescale(curve1, -.5, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ piecewise_curve_checks(curve2, 3, 48);
+
+ TEST("Copy in place piecewise curve");
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 10, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 15, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 47, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 48, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 49, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 50, 48);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 100, 48);
+ stp_curve_destroy(curve1);
+
+ TEST("Creating piecewise spline wrap-around curve");
+ curve1 = stp_curve_create(STP_CURVE_WRAP_NONE);
+ stp_curve_set_interpolation_type(curve1, STP_CURVE_TYPE_SPLINE);
+ stp_curve_set_bounds(curve1, 0.0, 4.0);
+
+ SIMPLE_TEST_CHECK(stp_curve_set_data_points
+ (curve1, 49, standard_piecewise_sat_adjustment));
+
+ TEST("Writing piecewise no-wrap curve to string");
+ tmp = stp_curve_write_string(curve1);
+ SIMPLE_TEST_CHECK(tmp);
+ if (verbose)
+ printf("%s\n", tmp);
+
+ TEST("Check curve is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve1));
+
+ TEST("Create copy of piecewise curve");
+ curve2 = stp_curve_create_copy(curve1);
+ SIMPLE_TEST_CHECK(curve2);
+ TEST("Check copy is piecewise");
+ SIMPLE_TEST_CHECK(stp_curve_is_piecewise(curve2));
+
+ piecewise_curve_checks(curve1, 0, 49);
+ stp_curve_rescale(curve1, -.5, STP_CURVE_COMPOSE_ADD,
+ STP_CURVE_BOUNDS_RESCALE);
+ piecewise_curve_checks(curve2, 3, 49);
+
+ TEST("Copy in place piecewise curve");
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 10, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 15, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 47, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 48, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 49, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 50, 49);
+ stp_curve_copy(curve2, curve1);
+ piecewise_curve_checks(curve2, 100, 49);
+
+ TEST("Create small piecewise curve");
+ curve1 = stp_curve_create_from_string(small_piecewise_curve);
+ SIMPLE_TEST_CHECK(curve1);
+
+ stp_curve_destroy(curve1);
+ curve1 = NULL;
+ stp_curve_destroy(curve2);
+ curve2 = NULL;
+ stp_curve_destroy(curve3);
+ curve3 = NULL;
+
+ if (global_error_count)
+ {
+ printf("%d/%d tests FAILED.\n", global_error_count, global_test_count);
+ printf("Failures:\n");
+ while (test_failure_head)
+ {
+ printf(" %3d\n", test_failure_head->test_number);
+ test_failure_head = test_failure_head->next;
+ }
+ }
+ else
+ printf("All tests passed successfully.\n");
+ return global_error_count ? 1 : 0;
+}
diff --git a/test/escp2-weavetest.c b/test/escp2-weavetest.c
index 9ac8532..48ebea8 100644
--- a/test/escp2-weavetest.c
+++ b/test/escp2-weavetest.c
@@ -1,5 +1,5 @@
/*
- * "$Id: escp2-weavetest.c,v 1.19.4.2 2002/07/23 00:54:08 rlk Exp $"
+ * "$Id: escp2-weavetest.c,v 1.36 2005/05/27 02:11:51 rlk Exp $"
*
* Print plug-in EPSON ESC/P2 driver for the GIMP.
*
@@ -60,20 +60,16 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "../lib/libprintut.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <limits.h>
#define DEBUG_SIGNAL
#define MIN(x, y) ((x) <= (y) ? (x) : (y))
-#ifdef INCLUDE_GIMP_PRINT_H
-#include INCLUDE_GIMP_PRINT_H
-#else
-#include <gimp-print/gimp-print.h>
-#endif
-#include <gimp-print-internal.h>
+#include <gutenprint/gutenprint.h>
+#include <gutenprint-internal.h>
const char header[] = "Legend:\n"
"A Negative pass number.\n"
@@ -99,9 +95,11 @@ const char header[] = "Legend:\n"
"N Two different active passes are in the same slot.\n"
"O Number of missing start rows is incorrect.\n"
"P Physical row number out of bounds.\n"
-"Q Pass starts earlier than a prior pass.\n";
+"Q Pass starts earlier than a prior pass.\n"
+"R Pass is never flushed.\n"
+"S Pass is flushed but not created.\n";
-stp_vars_t v;
+int *passes_flushed;
static void
print_header(void)
@@ -110,10 +108,9 @@ print_header(void)
}
static void
-flush_pass(stp_softweave_t *sw, int passno, int model, int width,
- int hoffset, int ydpi, int xdpi, int physical_xdpi,
- int vertical_subpass)
+flush_pass(stp_vars_t *v, int passno, int vertical_subpass)
{
+ passes_flushed[passno] = 1;
}
static void
@@ -131,6 +128,7 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
int i;
int j;
stp_weave_t w;
+ stp_vars_t *v;
int errors[26];
char errcodes[26];
int total_errors = 0;
@@ -144,8 +142,14 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
signed char *rowdetail;
int *current_slot;
int vmod;
- void *sw;
int head_offset[8];
+ int last_good_pass;
+
+ v = stp_vars_create();
+ stp_set_outfunc(v, writefunc);
+ stp_set_errfunc(v, writefunc);
+ stp_set_outdata(v, stdout);
+ stp_set_errdata(v, stdout);
memset(errors, 0, sizeof(int) * 26);
#if 0
@@ -158,32 +162,52 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
for(i=0; i<8; i++)
head_offset[i] = 0;
- if(color_jet_arrangement != 0)
+ switch (color_jet_arrangement)
{
+ case 1: /* C80-type */
head_offset[0] = (physjets+1)*physsep;
head_offset[1] = (physjets+1)*physsep;
head_offset[2] = 2*(physjets+1)*physsep;
phys_lines += 2*(physjets+1)*physsep;
+ break;
+ case 2: /* Offset by 1 (f360) */
+ if (physsep % 2 == 0)
+ {
+ head_offset[1] = physsep / 2;
+ head_offset[2] = physsep / 2;
+ phys_lines += physsep / 2;
+ }
+ break;
+ case 3: /* Offset by 1 or 2 (cx3650-type) */
+ if (physsep % 3 == 0)
+ {
+ head_offset[1] = physsep * 2 / 3;
+ head_offset[2] = physsep / 3;
+ phys_lines += physsep * 2 / 3;
+ }
+ break;
+ default: /* Normal */
+ break;
}
- sw = stp_initialize_weave(physjets, physsep, hpasses, vpasses, subpasses,
- 7, 1, 128, nrows, first_line,
- phys_lines, strategy, head_offset, v, flush_pass,
- stp_fill_tiff, stp_pack_tiff,
- stp_compute_tiff_linewidth);
- if (!sw)
- return 1;
- passstarts = xmalloc(sizeof(int) * (nrows + physsep));
- logpassstarts = xmalloc(sizeof(int) * (nrows + physsep));
- passends = xmalloc(sizeof(int) * (nrows + physsep));
- passcounts = xmalloc(sizeof(int) * (nrows + physsep));
+ stp_initialize_weave(v, physjets, physsep, hpasses, vpasses, subpasses,
+ 7, 1, 128, nrows, first_line,
+ phys_lines, head_offset, strategy, flush_pass,
+ stp_fill_tiff, stp_pack_tiff,
+ stp_compute_tiff_linewidth);
+
+ passstarts = stp_malloc(sizeof(int) * (nrows + physsep));
+ logpassstarts = stp_malloc(sizeof(int) * (nrows + physsep));
+ passends = stp_malloc(sizeof(int) * (nrows + physsep));
+ passcounts = stp_malloc(sizeof(int) * (nrows + physsep));
+ passes_flushed = stp_malloc(sizeof(int) * (nrows + physsep));
vmod = 2 * physsep * hpasses * vpasses * subpasses;
if (vmod == 0)
vmod = 1;
- current_slot = xmalloc(sizeof(int) * vmod);
- physpassstuff = xmalloc((nrows + physsep));
- rowdetail = xmalloc((nrows + physsep) * physjets);
+ current_slot = stp_malloc(sizeof(int) * vmod);
+ physpassstuff = stp_malloc((nrows + physsep));
+ rowdetail = stp_malloc((nrows + physsep) * physjets);
memset(rowdetail, 0, (nrows + physsep) * physjets);
memset(physpassstuff, -1, (nrows + physsep));
memset(current_slot, 0, (sizeof(int) * vmod));
@@ -197,6 +221,8 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
current_slot[i] = -1;
for (i = 0; i < (nrows + physsep); i++)
{
+ passes_flushed[i] = 0;
+ logpassstarts[i] = INT_MIN;
passstarts[i] = -1;
passends[i] = -1;
}
@@ -206,7 +232,7 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
for (j = 0; j < hpasses * vpasses * subpasses; j++)
{
int physrow;
- stp_weave_parameters_by_row((stp_softweave_t *)sw, i+first_line, j, &w);
+ stp_weave_parameters_by_row(v, i+first_line, j, &w);
physrow = w.logicalpassstart + physsep * w.jet;
errcodes[0] = (w.pass < 0 ? (errors[0]++, 'A') : ' ');
@@ -254,9 +280,12 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
errcodes[16] = '\0';
if (!quiet)
- printf("%15s%5d %5d %5d %10d %10d %10d %10d\n",
- errcodes, w.row, w.pass, w.jet, w.missingstartrows,
- w.logicalpassstart, w.physpassstart, w.physpassend);
+ {
+ printf("%15s%5d %5d %5d %10d %10d %10d %10d\n",
+ errcodes, w.row, w.pass, w.jet, w.missingstartrows,
+ w.logicalpassstart, w.physpassstart, w.physpassend);
+ fflush(stdout);
+ }
if (w.pass >= 0 && w.pass < (nrows + physsep))
{
if (w.physpassend == w.row)
@@ -284,7 +313,7 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
if (!quiet)
printf("Unterminated passes:\n");
for (i = 0; i <= newestpass; i++)
- if (passends[i] >= -1 && passends[i] < nrows)
+ if (passends[i] >= -1 && passends[i] < nrows && logpassstarts[i] != INT_MIN)
{
if (!quiet)
printf("%d %d\n", i, passends[i]);
@@ -295,115 +324,157 @@ run_one_weavetest(int physjets, int physsep, int hpasses, int vpasses,
printf("Last terminated pass: %d\n", lastpass);
printf("Pass starts:\n");
}
+ last_good_pass = 0;
+ errcodes[3] = '\0';
for (i = 0; i <= newestpass; i++)
{
- char qchar = ' ';
- if (i > 0)
- qchar = logpassstarts[i] < logpassstarts[i - 1] ?
- (errors[17]++, 'Q') : ' ';
- if (!quiet)
- printf("%c %d %d\n", qchar, i, logpassstarts[i]);
+ if (logpassstarts[i] != INT_MIN)
+ {
+ if (i > 0)
+ errcodes[0] = logpassstarts[i] < logpassstarts[last_good_pass] ?
+ (errors[17]++, 'Q') : ' ';
+ errcodes[1] = passes_flushed[i] ? (errors[18]++, 'R') : ' ';
+ errcodes[2] = ' ';
+ if (!quiet)
+ printf("%s %d %d\n", errcodes, i, logpassstarts[i]);
+ last_good_pass = i;
+ }
+ else if (!quiet)
+ {
+ errcodes[0] = ' ';
+ errcodes[1] = ' ';
+ errcodes[2] = '*';
+ printf("%s %d\n", errcodes, i);
+ }
}
for (i = 0; i < 26; i++)
total_errors += errors[i];
- stp_destroy_weave(sw);
- free(rowdetail);
- free(physpassstuff);
- free(current_slot);
- free(passcounts);
- free(passends);
- free(logpassstarts);
- free(passstarts);
+ stp_free(rowdetail);
+ stp_free(physpassstuff);
+ stp_free(current_slot);
+ stp_free(passcounts);
+ stp_free(passends);
+ stp_free(logpassstarts);
+ stp_free(passstarts);
+ stp_free(passes_flushed);
if (!quiet || (quiet == 1 && total_errors > 0))
printf("%d total error%s\n", total_errors, total_errors == 1 ? "" : "s");
- if (total_errors > 0)
- return 1;
- else
- return 0;
+ stp_vars_destroy(v);
+ return total_errors;
}
-
-int
-main(int argc, char **argv)
+static int
+run_weavetest_from_stdin(void)
{
int nrows;
int physjets;
int physsep;
int hpasses, vpasses, subpasses;
int first_line, phys_lines;
- int strategy = 1;
int color_jet_arrangement;
- int quiet = 0;
- int status = 0;
-
- /*
- * Initialise libgimpprint
- */
-
- stp_init();
-
- v = stp_allocate_vars();
- stp_set_outfunc(v, writefunc);
- stp_set_errfunc(v, writefunc);
- stp_set_outdata(v, stdout);
- stp_set_errdata(v, stdout);
-
- if (argc == 1)
+ int strategy;
+ int previous_strategy = -1;
+ int previous_jets = -1;
+ int previous_separation = -1;
+ int total_cases = 0;
+ int failures = 0;
+ char linebuf[4096];
+ while (fgets(linebuf, 4096, stdin))
{
- int total_cases = 0;
- int failures = 0;
- char linebuf[4096];
- while (fgets(linebuf, 4096, stdin))
+ int retval;
+ (void) sscanf(linebuf, "%d%d%d%d%d%d%d%d%d%d", &physjets, &physsep,
+ &hpasses, &vpasses, &subpasses, &nrows, &first_line,
+ &phys_lines, &color_jet_arrangement, &strategy);
+ fflush(stdout);
+ if (vpasses * subpasses > physjets)
+ continue;
+ retval = run_one_weavetest(physjets, physsep, hpasses, vpasses,
+ subpasses, nrows, first_line, phys_lines,
+ color_jet_arrangement, strategy, 2);
+ if (getenv("QUIET"))
+ {
+ /* Assume that we're running within run-weavetest, and */
+ /* print out the heartbeat */
+
+ if (previous_strategy != strategy)
+ {
+ printf("%s%d:", previous_strategy == -1 ? "" : "\n", strategy);
+ previous_jets = -1;
+ previous_separation = -1;
+ }
+ if (previous_jets != physjets)
+ {
+ printf("%d", physjets);
+ previous_separation = -1;
+ }
+ if (previous_separation != physsep)
+ printf(".");
+ previous_strategy = strategy;
+ previous_jets = physjets;
+ previous_separation = physsep;
+ }
+ if (!getenv("QUIET") || retval)
{
- int retval;
- (void) sscanf(linebuf, "%d%d%d%d%d%d%d%d%d", &physjets, &physsep,
- &hpasses, &vpasses, &subpasses, &nrows, &first_line,
- &phys_lines, &color_jet_arrangement);
- fflush(stdout);
- if (vpasses * subpasses > physjets)
- continue;
- printf("%d %d %d %d %d %d %d %d %d ", physjets, physsep, hpasses,
- vpasses, subpasses, nrows, first_line, phys_lines,
- color_jet_arrangement);
- retval = run_one_weavetest(physjets, physsep, hpasses, vpasses,
- subpasses, nrows, first_line, phys_lines,
- color_jet_arrangement, strategy, 1);
- total_cases++;
+ printf("%d %d %d %d %d %d %d %d %d %d ", physjets, physsep,
+ hpasses, vpasses, subpasses, nrows, first_line,
+ phys_lines, color_jet_arrangement, strategy);
if (retval)
- failures++;
- else
- putc('\n', stdout);
- fflush(stdout);
- status |= retval;
+ printf("%d total error%s", retval, retval == 1 ? "" : "s");
+ putc('\n', stdout);
}
- printf("Total cases: %d, failures: %d\n", total_cases, failures);
- return status;
+
+ total_cases++;
+ if (retval)
+ failures++;
+ fflush(stdout);
}
- if (argc != 10)
+ printf("%sTotal cases: %d, failures: %d\n",
+ (getenv("QUIET") ? "\n" : ""), total_cases, failures);
+ return (failures ? 1 : 0);
+}
+
+static int
+run_weavetest_from_cmdline(int argc, char **argv)
+{
+ if (argc != 11)
{
- fprintf(stderr, "Usage: %s jets separation hpasses vpasses subpasses rows start end arrangement\n",
+ fprintf(stderr, "Usage: %s jets separation hpasses vpasses subpasses rows start end arrangement strategy\n",
argv[0]);
return 2;
}
- physjets = atoi(argv[1]);
- physsep = atoi(argv[2]);
- hpasses = atoi(argv[3]);
- vpasses = atoi(argv[4]);
- subpasses = atoi(argv[5]);
- nrows = atoi(argv[6]);
- first_line = atoi(argv[7]);
- phys_lines = atoi(argv[8]);
- color_jet_arrangement = atoi(argv[9]);
-#if 0
- if (physjets < hpasses * vpasses * subpasses)
+ else
{
- fprintf(stderr, "Oversample exceeds jets\n");
- return 1;
+ int quiet = 0;
+ int physjets = atoi(argv[1]);
+ int physsep = atoi(argv[2]);
+ int hpasses = atoi(argv[3]);
+ int vpasses = atoi(argv[4]);
+ int subpasses = atoi(argv[5]);
+ int nrows = atoi(argv[6]);
+ int first_line = atoi(argv[7]);
+ int phys_lines = atoi(argv[8]);
+ int color_jet_arrangement = atoi(argv[9]);
+ int strategy = atoi(argv[10]);
+ int status;
+ if (getenv("QUIET"))
+ quiet = 2;
+ status = run_one_weavetest(physjets, physsep, hpasses, vpasses,
+ subpasses, nrows, first_line, phys_lines,
+ color_jet_arrangement, strategy, quiet);
+ if (status)
+ return 1;
+ else
+ return 0;
}
-#endif
- if (getenv("QUIET"))
- quiet = 2;
- return (run_one_weavetest(physjets, physsep, hpasses, vpasses,
- subpasses, nrows, first_line, phys_lines,
- color_jet_arrangement, strategy, quiet));
+}
+
+int
+main(int argc, char **argv)
+{
+ stp_init();
+
+ if (argc == 1)
+ return run_weavetest_from_stdin();
+ else
+ return run_weavetest_from_cmdline(argc, argv);
}
diff --git a/test/parse-escp2 b/test/parse-escp2
index 50f2c14..39ecf46 100755
--- a/test/parse-escp2
+++ b/test/parse-escp2
@@ -51,7 +51,7 @@ sub do_remote_command {
}
}
substr($stuff, 0, $skipchars) = "";
- $curpos += skipchars;
+ $curpos += $skipchars;
while (substr($stuff, 0, 2) =~ /[A-Z0-9][A-Z0-9]/) {
print "\n";
printf "%08x ", $curpos;
diff --git a/test/pcl-unprint.c b/test/pcl-unprint.c
index ed1f388..c7ef956 100644
--- a/test/pcl-unprint.c
+++ b/test/pcl-unprint.c
@@ -1,5 +1,5 @@
/*
- * "$Id: pcl-unprint.c,v 1.5.6.2 2003/01/17 11:15:58 davehill Exp $"
+ * "$Id: pcl-unprint.c,v 1.11 2004/09/17 18:38:28 rleigh Exp $"
*
* pclunprint.c - convert an HP PCL file into an image file for viewing.
*
@@ -27,13 +27,13 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "../lib/libprintut.h"
+#include <gutenprint/util.h>
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
-static const char *id="@(#) $Id: pcl-unprint.c,v 1.5.6.2 2003/01/17 11:15:58 davehill Exp $";
+static const char *id="@(#) $Id: pcl-unprint.c,v 1.11 2004/09/17 18:38:28 rleigh Exp $";
/*
* Size of buffer used to read file
@@ -58,6 +58,7 @@ int read_pointer;
int read_size;
int eof;
int combined_command = 0;
+int skip_output = 0;
/*
* Data about the image
@@ -94,7 +95,7 @@ typedef struct {
char **lmagenta_bufs;
int lmagenta_data_rows_per_row;
int buffer_length;
- int active_height; /* Height of output data */
+ int active_length; /* Length of output data */
int output_depth;
} output_t;
@@ -104,61 +105,36 @@ typedef struct {
#define PCL_CMYKcm 6
#define PCL_COMPRESSION_NONE 0
-#define PCL_COMPRESSION_RUNHEIGHT 1
+#define PCL_COMPRESSION_RUNLENGTH 1
#define PCL_COMPRESSION_TIFF 2
#define PCL_COMPRESSION_DELTA 3
#define PCL_COMPRESSION_CRDR 9 /* Compressed row delta replacement */
/* PCL COMMANDS */
-#define PCL_RESET 1
-#define PCL_MEDIA_SIZE 2
-#define PCL_PERF_SKIP 3
-#define PCL_TOP_MARGIN 4
-#define PCL_MEDIA_TYPE 5
-#define PCL_MEDIA_SOURCE 6
-#define PCL_SHINGLING 7
-#define PCL_RASTERGRAPHICS_QUALITY 8
-#define PCL_DEPLETION 9
-#define PCL_CONFIGURE 10
-#define PCL_RESOLUTION 11
-#define PCL_COLOURTYPE 12
-#define PCL_COMPRESSIONTYPE 13
-#define PCL_LEFTRASTER_POS 14
-#define PCL_TOPRASTER_POS 15
-#define PCL_RASTER_WIDTH 16
-#define PCL_RASTER_HEIGHT 17
-#define PCL_START_RASTER 18
-#define PCL_END_RASTER 19
-#define PCL_END_COLOUR_RASTER 20
-#define PCL_DATA 21
-#define PCL_DATA_LAST 22
-#define PCL_PRINT_QUALITY 23
-#define PCL_ENTER_PJL 24
-#define PCL_GRAY_BALANCE 25
-#define PCL_DRIVER_CONFIG 26
-#define PCL_PAGE_ORIENTATION 27
-#define PCL_VERTICAL_CURSOR_POSITIONING_BY_DOTS 28
-#define PCL_HORIZONTAL_CURSOR_POSITIONING_BY_DOTS 29
-#define PCL_UNIT_OF_MEASURE 30
-#define PCL_RELATIVE_VERTICAL_PIXEL_MOVEMENT 31
-#define PCL_PALETTE_CONFIGURATION 32
-#define PCL_LPI 33
-#define PCL_CPI 34
-#define PCL_PAGE_LENGTH 35
-#define PCL_NUM_COPIES 36
-#define PCL_DUPLEX 37
-#define PCL_MEDIA_SIDE 38
-#define RTL_CONFIGURE 39
-#define PCL_ENTER_PCL 40
-#define PCL_ENTER_HPGL2 41
-#define PCL_NEGATIVE_MOTION 42
+typedef enum {
+ PCL_RESET = 1,PCL_MEDIA_SIZE,PCL_PERF_SKIP,PCL_TOP_MARGIN,PCL_MEDIA_TYPE,
+ PCL_MEDIA_SOURCE,PCL_SHINGLING,PCL_RASTERGRAPHICS_QUALITY,PCL_DEPLETION,
+ PCL_CONFIGURE,PCL_RESOLUTION,PCL_COLOURTYPE,PCL_COMPRESSIONTYPE,
+ PCL_LEFTRASTER_POS,PCL_TOPRASTER_POS,PCL_RASTER_WIDTH,PCL_RASTER_HEIGHT,
+ PCL_START_RASTER,PCL_END_RASTER,PCL_END_COLOUR_RASTER,PCL_DATA,PCL_DATA_LAST,
+ PCL_PRINT_QUALITY,PCL_ENTER_PJL,PCL_GRAY_BALANCE,PCL_DRIVER_CONFIG,
+ PCL_PAGE_ORIENTATION,PCL_VERTICAL_CURSOR_POSITIONING_BY_DOTS,
+ PCL_HORIZONTAL_CURSOR_POSITIONING_BY_DOTS,PCL_UNIT_OF_MEASURE,
+ PCL_RELATIVE_VERTICAL_PIXEL_MOVEMENT,PCL_PALETTE_CONFIGURATION,
+ PCL_LPI,PCL_CPI,PCL_PAGE_LENGTH,PCL_NUM_COPIES,PCL_DUPLEX,
+ PCL_MEDIA_SIDE,RTL_CONFIGURE,PCL_ENTER_PCL,PCL_ENTER_HPGL2,
+ PCL_NEGATIVE_MOTION,PCL_MEDIA_DEST,PCL_JOB_SEPARATION,
+ PCL_LEFT_OFFSET_REGISTRATION,PCL_TOP_OFFSET_REGISTRATION,
+ PCL_PRINT_DIRECTION,PCL_LEFT_MARGIN,PCL_RIGHT_MARGIN,
+ PCL_RESET_MARGINS,PCL_TEXT_LENGTH
+} command_t;
typedef struct {
const char initial_command[3]; /* First part of command */
const char final_command; /* Last part of command */
- int has_data; /* Data follows */
- int command; /* Command name */
+ int has_data; /* Data follows */
+ command_t command; /* Command name */
const char *description; /* Text for printing */
} commands_t;
@@ -166,14 +142,18 @@ const commands_t pcl_commands[] =
{
/* Two-character sequences ESC <x> */
{ "E", '\0', 0, PCL_RESET, "PCL RESET" },
+ { "9", '\0', 0, PCL_RESET_MARGINS, "Reset Margins" },
{ "%", 'A', 0, PCL_ENTER_PCL, "PCL mode" },
{ "%", 'B', 0, PCL_ENTER_HPGL2, "HPGL/2 mode" },
- { "%", 'X', 0, PCL_ENTER_PJL, "PJL mode" },
+ { "%", 'X', 0, PCL_ENTER_PJL, "UEL/Enter PJL mode" },
/* Parameterised sequences */
/* Raster positioning */
{ "&a", 'G', 0, PCL_MEDIA_SIDE, "Set Media Side" },
{ "&a", 'H', 0, PCL_LEFTRASTER_POS, "Left Raster Position" },
+ { "&a", 'L', 0, PCL_LEFT_MARGIN, "Left Margin by Column" },
+ { "&a", 'M', 0, PCL_RIGHT_MARGIN, "Right Margin by Column" },
{ "&a", 'N', 0, PCL_NEGATIVE_MOTION, "Negative Motion" },
+ { "&a", 'P', 0, PCL_PRINT_DIRECTION, "Print Direction" },
{ "&a", 'V', 0, PCL_TOPRASTER_POS, "Top Raster Position" },
/* Characters */
{ "&k", 'H', 0, PCL_CPI, "Characters per Inch" },
@@ -181,13 +161,18 @@ const commands_t pcl_commands[] =
{ "&l", 'A', 0, PCL_MEDIA_SIZE , "Media Size" },
{ "&l", 'D', 0, PCL_LPI , "Lines per Inch" },
{ "&l", 'E', 0, PCL_TOP_MARGIN , "Top Margin" },
+ { "&l", 'F', 0, PCL_TEXT_LENGTH , "Text Length" },
+ { "&l", 'G', 0, PCL_MEDIA_DEST, "Media Destination" },
{ "&l", 'H', 0, PCL_MEDIA_SOURCE, "Media Source" },
{ "&l", 'L', 0, PCL_PERF_SKIP , "Perf. Skip" },
{ "&l", 'M', 0, PCL_MEDIA_TYPE , "Media Type" },
{ "&l", 'O', 0, PCL_PAGE_ORIENTATION, "Page Orientation" },
{ "&l", 'P', 0, PCL_PAGE_LENGTH, "Page Length in Lines" },
{ "&l", 'S', 0, PCL_DUPLEX, "Duplex mode" },
+ { "&l", 'T', 0, PCL_JOB_SEPARATION, "Job Separation" },
+ { "&l", 'U', 0, PCL_LEFT_OFFSET_REGISTRATION, "Left Offset Registration" },
{ "&l", 'X', 0, PCL_NUM_COPIES, "Number of copies" },
+ { "&l", 'Z', 0, PCL_TOP_OFFSET_REGISTRATION, "Top Offset Registration" },
/* Units */
{ "&u", 'D', 0, PCL_UNIT_OF_MEASURE, "Unit of Measure" }, /* from bpd05446 */
/* Raster data */
@@ -227,7 +212,7 @@ void fill_buffer (void);
void pcl_read_command (void);
void write_grey (output_t *output, image_t *image);
void write_colour (output_t *output, image_t *image);
-int decode_tiff (char *in_buffer, int data_height, char *decode_buf,
+int decode_tiff (char *in_buffer, int data_length, char *decode_buf,
int maxlen);
void pcl_reset (image_t *i);
int depth_to_rows (int depth);
@@ -357,6 +342,8 @@ void pcl_read_command(void)
skipped_chars = 0;
while (c != (char) 0x1b) {
+ if (c == (char) 0x0c)
+ fprintf(stderr, "FF ");
skipped_chars++;
fill_buffer();
if (eof == 1) {
@@ -552,8 +539,8 @@ void write_grey(output_t *output, /* I: data */
char tb[8];
#ifdef DEBUG
- fprintf(stderr, "Data Height: %d, wholebytes: %d, crumbs: %d\n",
- output->active_height, wholebytes, crumbs);
+ fprintf(stderr, "Data Length: %d, wholebytes: %d, crumbs: %d\n",
+ output->active_length, wholebytes, crumbs);
#endif
for (i=0; i < wholebytes; i++) {
@@ -599,27 +586,27 @@ void write_colour(output_t *output, /* I: Data buffers */
black_buf = NULL;
#ifdef DEBUG
- fprintf(stderr, "Data Height: %d, wholebytes: %d, crumbs: %d, planes: %d\n",
- output->active_height, wholebytes, crumbs, image->colour_type);
+ fprintf(stderr, "Data Length: %d, wholebytes: %d, crumbs: %d, planes: %d\n",
+ output->active_length, wholebytes, crumbs, image->colour_type);
fprintf(stderr, "Cyan: ");
- for (i=0; i < output->active_height; i++) {
+ for (i=0; i < output->active_length; i++) {
fprintf(stderr, "%02x ", (unsigned char) cyan_buf[i]);
}
fprintf(stderr, "\n");
fprintf(stderr, "Magenta: ");
- for (i=0; i < output->active_height; i++) {
+ for (i=0; i < output->active_length; i++) {
fprintf(stderr, "%02x ", (unsigned char) magenta_buf[i]);
}
fprintf(stderr, "\n");
fprintf(stderr, "Yellow: ");
- for (i=0; i < output->active_height; i++) {
+ for (i=0; i < output->active_length; i++) {
fprintf(stderr, "%02x ", (unsigned char) yellow_buf[i]);
}
fprintf(stderr, "\n");
if (image->colour_type == PCL_CMYK) {
fprintf(stderr, "Black: ");
- for (i=0; i < output->active_height; i++) {
+ for (i=0; i < output->active_length; i++) {
fprintf(stderr, "%02x ", (unsigned char) black_buf[i]);
}
fprintf(stderr, "\n");
@@ -701,9 +688,9 @@ void write_colour(output_t *output, /* I: Data buffers */
*/
int decode_tiff(char *in_buffer, /* I: Data buffer */
- int data_height, /* I: Height of data */
+ int data_length, /* I: Length of data */
char *decode_buf, /* O: decoded data */
- int maxlen) /* I: Max height of decode_buf */
+ int maxlen) /* I: Max length of decode_buf */
{
/* The TIFF coding consists of either:-
*
@@ -719,7 +706,7 @@ int decode_tiff(char *in_buffer, /* I: Data buffer */
int i;
#endif
- while(pos < data_height ) {
+ while(pos < data_length ) {
count = in_buffer[pos];
@@ -816,7 +803,7 @@ int main(int argc, char *argv[])
{
int command_index;
- int command;
+ command_t command;
int i, j; /* Loop/general variables */
int image_row_counter = -1; /* Count of current row */
int current_data_row = -1; /* Count of data rows received for this output row */
@@ -852,7 +839,7 @@ int main(int argc, char *argv[])
output_data.lmagenta_bufs = NULL;
output_data.lmagenta_data_rows_per_row = 0;
output_data.buffer_length = 0;
- output_data.active_height = 0;
+ output_data.active_length = 0;
output_data.output_depth = 0;
id = id; /* Remove compiler warning */
@@ -900,9 +887,9 @@ int main(int argc, char *argv[])
while (1) {
pcl_read_command();
if (eof == 1) {
-#ifdef DEBUG
+/* #ifdef DEBUG */
fprintf(stderr, "EOF while reading command.\n");
-#endif
+/* #endif */
(void) fclose(read_fd);
(void) fclose(write_fd);
exit(EXIT_SUCCESS);
@@ -959,6 +946,10 @@ int main(int argc, char *argv[])
pcl_reset(&image_data);
break;
+ case PCL_RESET_MARGINS :
+ fprintf(stderr, "%s\n", pcl_commands[command_index].description);
+ break;
+
case PCL_START_RASTER :
fprintf(stderr, "%s\n", pcl_commands[command_index].description);
@@ -1006,188 +997,199 @@ int main(int argc, char *argv[])
}
if (i != 0) {
- fprintf(stderr, "Cannot continue.\n");
- exit (EXIT_FAILURE);
+ fprintf(stderr, "PNM output suppressed, will continue diagnostic output.\n");
+ skip_output = 1;
}
- if (image_data.colour_type == PCL_MONO)
- (void) fputs("P5\n", write_fd); /* Raw, Grey */
- else
- (void) fputs("P6\n", write_fd); /* Raw, RGB */
+ if (skip_output == 0) {
+ if (image_data.colour_type == PCL_MONO)
+ (void) fputs("P5\n", write_fd); /* Raw, Grey */
+ else
+ (void) fputs("P6\n", write_fd); /* Raw, RGB */
- (void) fputs("# Written by pclunprint.\n", write_fd);
+ (void) fputs("# Written by pclunprint.\n", write_fd);
/*
* Remember the file position where we wrote the image width and height
* (you don't want to know why!)
*/
- filepos = ftell(write_fd);
+ filepos = ftell(write_fd);
- fprintf(write_fd, "%10d %10d\n", image_data.image_width,
- image_data.image_height);
+ fprintf(write_fd, "%10d %10d\n", image_data.image_width,
+ image_data.image_height);
/*
* Write the depth of the image
*/
- if (image_data.black_depth != 0)
- output_data.output_depth = image_data.black_depth - 1;
- else
- output_data.output_depth = image_data.cyan_depth - 1;
- fprintf(write_fd, "%d\n", output_data.output_depth);
+ if (image_data.black_depth != 0)
+ output_data.output_depth = image_data.black_depth - 1;
+ else
+ output_data.output_depth = image_data.cyan_depth - 1;
+ fprintf(write_fd, "%d\n", output_data.output_depth);
- image_row_counter = 0;
- current_data_row = 0;
+ image_row_counter = 0;
+ current_data_row = 0;
- output_data.black_data_rows_per_row = depth_to_rows(image_data.black_depth);
- output_data.cyan_data_rows_per_row = depth_to_rows(image_data.cyan_depth);
- output_data.magenta_data_rows_per_row = depth_to_rows(image_data.magenta_depth);
- output_data.yellow_data_rows_per_row = depth_to_rows(image_data.yellow_depth);
- output_data.lcyan_data_rows_per_row = depth_to_rows(image_data.lcyan_depth);
- output_data.lmagenta_data_rows_per_row = depth_to_rows(image_data.lmagenta_depth);
+ output_data.black_data_rows_per_row = depth_to_rows(image_data.black_depth);
+ output_data.cyan_data_rows_per_row = depth_to_rows(image_data.cyan_depth);
+ output_data.magenta_data_rows_per_row = depth_to_rows(image_data.magenta_depth);
+ output_data.yellow_data_rows_per_row = depth_to_rows(image_data.yellow_depth);
+ output_data.lcyan_data_rows_per_row = depth_to_rows(image_data.lcyan_depth);
+ output_data.lmagenta_data_rows_per_row = depth_to_rows(image_data.lmagenta_depth);
/*
* Allocate some storage for the expected planes
*/
- output_data.buffer_length = (image_data.image_width + 7) / 8;
+ output_data.buffer_length = (image_data.image_width + 7) / 8;
- if (output_data.black_data_rows_per_row != 0) {
- output_data.black_bufs = xmalloc(output_data.black_data_rows_per_row * sizeof (char *));
- for (i=0; i < output_data.black_data_rows_per_row; i++) {
- output_data.black_bufs[i] = xmalloc(output_data.buffer_length * sizeof (char));
+ if (output_data.black_data_rows_per_row != 0) {
+ output_data.black_bufs = stp_malloc(output_data.black_data_rows_per_row * sizeof (char *));
+ for (i=0; i < output_data.black_data_rows_per_row; i++) {
+ output_data.black_bufs[i] = stp_malloc(output_data.buffer_length * sizeof (char));
+ }
}
- }
- if (output_data.cyan_data_rows_per_row != 0) {
- output_data.cyan_bufs = xmalloc(output_data.cyan_data_rows_per_row * sizeof (char *));
- for (i=0; i < output_data.cyan_data_rows_per_row; i++) {
- output_data.cyan_bufs[i] = xmalloc(output_data.buffer_length * sizeof (char));
+ if (output_data.cyan_data_rows_per_row != 0) {
+ output_data.cyan_bufs = stp_malloc(output_data.cyan_data_rows_per_row * sizeof (char *));
+ for (i=0; i < output_data.cyan_data_rows_per_row; i++) {
+ output_data.cyan_bufs[i] = stp_malloc(output_data.buffer_length * sizeof (char));
+ }
}
- }
- if (output_data.magenta_data_rows_per_row != 0) {
- output_data.magenta_bufs = xmalloc(output_data.magenta_data_rows_per_row * sizeof (char *));
- for (i=0; i < output_data.magenta_data_rows_per_row; i++) {
- output_data.magenta_bufs[i] = xmalloc(output_data.buffer_length * sizeof (char));
+ if (output_data.magenta_data_rows_per_row != 0) {
+ output_data.magenta_bufs = stp_malloc(output_data.magenta_data_rows_per_row * sizeof (char *));
+ for (i=0; i < output_data.magenta_data_rows_per_row; i++) {
+ output_data.magenta_bufs[i] = stp_malloc(output_data.buffer_length * sizeof (char));
+ }
}
- }
- if (output_data.yellow_data_rows_per_row != 0) {
- output_data.yellow_bufs = xmalloc(output_data.yellow_data_rows_per_row * sizeof (char *));
- for (i=0; i < output_data.yellow_data_rows_per_row; i++) {
- output_data.yellow_bufs[i] = xmalloc(output_data.buffer_length * sizeof (char));
+ if (output_data.yellow_data_rows_per_row != 0) {
+ output_data.yellow_bufs = stp_malloc(output_data.yellow_data_rows_per_row * sizeof (char *));
+ for (i=0; i < output_data.yellow_data_rows_per_row; i++) {
+ output_data.yellow_bufs[i] = stp_malloc(output_data.buffer_length * sizeof (char));
+ }
}
- }
- if (output_data.lcyan_data_rows_per_row != 0) {
- output_data.lcyan_bufs = xmalloc(output_data.lcyan_data_rows_per_row * sizeof (char *));
- for (i=0; i < output_data.lcyan_data_rows_per_row; i++) {
- output_data.lcyan_bufs[i] = xmalloc(output_data.buffer_length * sizeof (char));
+ if (output_data.lcyan_data_rows_per_row != 0) {
+ output_data.lcyan_bufs = stp_malloc(output_data.lcyan_data_rows_per_row * sizeof (char *));
+ for (i=0; i < output_data.lcyan_data_rows_per_row; i++) {
+ output_data.lcyan_bufs[i] = stp_malloc(output_data.buffer_length * sizeof (char));
+ }
}
- }
- if (output_data.lmagenta_data_rows_per_row != 0) {
- output_data.lmagenta_bufs = xmalloc(output_data.lmagenta_data_rows_per_row * sizeof (char *));
- for (i=0; i < output_data.lmagenta_data_rows_per_row; i++) {
- output_data.lmagenta_bufs[i] = xmalloc(output_data.buffer_length * sizeof (char));
+ if (output_data.lmagenta_data_rows_per_row != 0) {
+ output_data.lmagenta_bufs = stp_malloc(output_data.lmagenta_data_rows_per_row * sizeof (char *));
+ for (i=0; i < output_data.lmagenta_data_rows_per_row; i++) {
+ output_data.lmagenta_bufs[i] = stp_malloc(output_data.buffer_length * sizeof (char));
+ }
}
- }
/*
* Now store the pointers in the right order to make life easier in the
* decoding phase
*/
- expected_data_rows_per_row = output_data.black_data_rows_per_row +
- output_data.cyan_data_rows_per_row + output_data.magenta_data_rows_per_row +
- output_data.yellow_data_rows_per_row + output_data.lcyan_data_rows_per_row +
- output_data.lmagenta_data_rows_per_row;
-
- received_rows = xmalloc(expected_data_rows_per_row * sizeof(char *));
- j = 0;
- for (i = 0; i < output_data.black_data_rows_per_row; i++)
- received_rows[j++] = output_data.black_bufs[i];
- for (i = 0; i < output_data.cyan_data_rows_per_row; i++)
- received_rows[j++] = output_data.cyan_bufs[i];
- for (i = 0; i < output_data.magenta_data_rows_per_row; i++)
- received_rows[j++] = output_data.magenta_bufs[i];
- for (i = 0; i < output_data.yellow_data_rows_per_row; i++)
- received_rows[j++] = output_data.yellow_bufs[i];
- for (i = 0; i < output_data.lcyan_data_rows_per_row; i++)
- received_rows[j++] = output_data.lcyan_bufs[i];
- for (i = 0; i < output_data.lmagenta_data_rows_per_row; i++)
- received_rows[j++] = output_data.lmagenta_bufs[i];
-
+ expected_data_rows_per_row = output_data.black_data_rows_per_row +
+ output_data.cyan_data_rows_per_row + output_data.magenta_data_rows_per_row +
+ output_data.yellow_data_rows_per_row + output_data.lcyan_data_rows_per_row +
+ output_data.lmagenta_data_rows_per_row;
+
+ received_rows = stp_malloc(expected_data_rows_per_row * sizeof(char *));
+ j = 0;
+ for (i = 0; i < output_data.black_data_rows_per_row; i++)
+ received_rows[j++] = output_data.black_bufs[i];
+ for (i = 0; i < output_data.cyan_data_rows_per_row; i++)
+ received_rows[j++] = output_data.cyan_bufs[i];
+ for (i = 0; i < output_data.magenta_data_rows_per_row; i++)
+ received_rows[j++] = output_data.magenta_bufs[i];
+ for (i = 0; i < output_data.yellow_data_rows_per_row; i++)
+ received_rows[j++] = output_data.yellow_bufs[i];
+ for (i = 0; i < output_data.lcyan_data_rows_per_row; i++)
+ received_rows[j++] = output_data.lcyan_bufs[i];
+ for (i = 0; i < output_data.lmagenta_data_rows_per_row; i++)
+ received_rows[j++] = output_data.lmagenta_bufs[i];
+ }
break;
case PCL_END_RASTER :
case PCL_END_COLOUR_RASTER :
fprintf(stderr, "%s\n", pcl_commands[command_index].description);
+ if (skip_output == 0) {
+
/*
* Check that we got the correct number of rows of data. If the expected number is
- * -1, invoke MAJOR BODGERY!
+ * -1, we have to go back and fill in the PNM parameters (which is why we remembered
+ * where they were in the file!)
*/
- if (image_data.image_height == -1) {
- image_data.image_height = image_row_counter;
- if (fseek(write_fd, filepos, SEEK_SET) != -1) {
- fprintf(write_fd, "%10d %10d\n", image_data.image_width,
- image_data.image_height);
- fseek(write_fd, 0L, SEEK_END);
+ if (image_data.image_height == -1) {
+ image_data.image_height = image_row_counter;
+ if (fseek(write_fd, filepos, SEEK_SET) != -1) {
+ fprintf(write_fd, "%10d %10d\n", image_data.image_width,
+ image_data.image_height);
+ fseek(write_fd, 0L, SEEK_END);
+ }
}
- }
- if (image_row_counter != image_data.image_height)
- fprintf(stderr, "ERROR: Row count mismatch. Expected %d rows, got %d rows.\n",
- image_data.image_height, image_row_counter);
- else
- fprintf(stderr, "\t%d rows processed.\n", image_row_counter);
+ if (image_row_counter != image_data.image_height)
+ fprintf(stderr, "ERROR: Row count mismatch. Expected %d rows, got %d rows.\n",
+ image_data.image_height, image_row_counter);
+ else
+ fprintf(stderr, "\t%d rows processed.\n", image_row_counter);
- image_data.image_height = -1;
+ image_data.image_height = -1;
+ image_row_counter = -1;
- if (output_data.black_data_rows_per_row != 0) {
- for (i=0; i < output_data.black_data_rows_per_row; i++) {
- free(output_data.black_bufs[i]);
+ if (output_data.black_data_rows_per_row != 0) {
+ for (i=0; i < output_data.black_data_rows_per_row; i++) {
+ stp_free(output_data.black_bufs[i]);
+ }
+ stp_free(output_data.black_bufs);
+ output_data.black_bufs = NULL;
}
- free(output_data.black_bufs);
- output_data.black_bufs = NULL;
- }
- if (output_data.cyan_data_rows_per_row != 0) {
- for (i=0; i < output_data.cyan_data_rows_per_row; i++) {
- free(output_data.cyan_bufs[i]);
+ output_data.black_data_rows_per_row = 0;
+ if (output_data.cyan_data_rows_per_row != 0) {
+ for (i=0; i < output_data.cyan_data_rows_per_row; i++) {
+ stp_free(output_data.cyan_bufs[i]);
+ }
+ stp_free(output_data.cyan_bufs);
+ output_data.cyan_bufs = NULL;
}
- free(output_data.cyan_bufs);
- output_data.cyan_bufs = NULL;
- }
- if (output_data.magenta_data_rows_per_row != 0) {
- for (i=0; i < output_data.magenta_data_rows_per_row; i++) {
- free(output_data.magenta_bufs[i]);
+ output_data.cyan_data_rows_per_row = 0;
+ if (output_data.magenta_data_rows_per_row != 0) {
+ for (i=0; i < output_data.magenta_data_rows_per_row; i++) {
+ stp_free(output_data.magenta_bufs[i]);
+ }
+ stp_free(output_data.magenta_bufs);
+ output_data.magenta_bufs = NULL;
}
- free(output_data.magenta_bufs);
- output_data.magenta_bufs = NULL;
- }
- if (output_data.yellow_data_rows_per_row != 0) {
- for (i=0; i < output_data.yellow_data_rows_per_row; i++) {
- free(output_data.yellow_bufs[i]);
+ output_data.magenta_data_rows_per_row = 0;
+ if (output_data.yellow_data_rows_per_row != 0) {
+ for (i=0; i < output_data.yellow_data_rows_per_row; i++) {
+ stp_free(output_data.yellow_bufs[i]);
+ }
+ stp_free(output_data.yellow_bufs);
+ output_data.yellow_bufs = NULL;
}
- free(output_data.yellow_bufs);
- output_data.yellow_bufs = NULL;
- }
- if (output_data.lcyan_data_rows_per_row != 0) {
- for (i=0; i < output_data.lcyan_data_rows_per_row; i++) {
- free(output_data.lcyan_bufs[i]);
+ output_data.yellow_data_rows_per_row = 0;
+ if (output_data.lcyan_data_rows_per_row != 0) {
+ for (i=0; i < output_data.lcyan_data_rows_per_row; i++) {
+ stp_free(output_data.lcyan_bufs[i]);
+ }
+ stp_free(output_data.lcyan_bufs);
+ output_data.lcyan_bufs = NULL;
}
- free(output_data.lcyan_bufs);
- output_data.lcyan_bufs = NULL;
- }
- if (output_data.lmagenta_data_rows_per_row != 0) {
- for (i=0; i < output_data.lmagenta_data_rows_per_row; i++) {
- free(output_data.lmagenta_bufs[i]);
+ output_data.lcyan_data_rows_per_row = 0;
+ if (output_data.lmagenta_data_rows_per_row != 0) {
+ for (i=0; i < output_data.lmagenta_data_rows_per_row; i++) {
+ stp_free(output_data.lmagenta_bufs[i]);
+ }
+ stp_free(output_data.lmagenta_bufs);
+ output_data.lmagenta_bufs = NULL;
}
- free(output_data.lmagenta_bufs);
- output_data.lmagenta_bufs = NULL;
+ output_data.lmagenta_data_rows_per_row = 0;
+ stp_free(received_rows);
+ received_rows = NULL;
}
- free(received_rows);
- received_rows = NULL;
-
break;
case PCL_MEDIA_SIZE :
@@ -1250,6 +1252,9 @@ int main(int argc, char *argv[])
case PCL_MEDIA_SOURCE :
fprintf(stderr, "%s: ", pcl_commands[command_index].description);
switch (numeric_arg) {
+ case -2 :
+ fprintf(stderr, "FEED CURRENT\n");
+ break;
case 0 :
fprintf(stderr, "EJECT\n");
break;
@@ -1357,27 +1362,48 @@ int main(int argc, char *argv[])
case PCL_RELATIVE_VERTICAL_PIXEL_MOVEMENT :
fprintf(stderr, "%s: %d\n", pcl_commands[command_index].description, numeric_arg);
+ if (skip_output == 0) {
+
/* Check that we are in raster mode */
- if (expected_data_rows_per_row == -1)
- fprintf(stderr, "ERROR: raster data without start raster!\n");
+ if (expected_data_rows_per_row == -1)
+ fprintf(stderr, "ERROR: raster data without start raster!\n");
/*
What we need to do now is to write out "N" rows of all-white data to
simulate the vertical slew
*/
- for (i=0; i<expected_data_rows_per_row; i++)
- {
- memset(received_rows[i], 0, (size_t) output_data.buffer_length * sizeof(char));
+ for (i=0; i<expected_data_rows_per_row; i++)
+ {
+ memset(received_rows[i], 0, (size_t) output_data.buffer_length * sizeof(char));
+ }
+ for (i=0; i<numeric_arg; i++)
+ {
+ if (image_data.colour_type == PCL_MONO)
+ write_grey(&output_data, &image_data);
+ else
+ write_colour(&output_data, &image_data);
+ image_row_counter++;
+ }
}
- for (i=0; i<numeric_arg; i++)
- {
- if (image_data.colour_type == PCL_MONO)
- write_grey(&output_data, &image_data);
- else
- write_colour(&output_data, &image_data);
- image_row_counter++;
+ break;
+
+ case PCL_DUPLEX :
+ fprintf(stderr, "%s: ", pcl_commands[command_index].description);
+ switch (numeric_arg) {
+ case 0 :
+ fprintf(stderr, "None\n");
+ break;
+ case 1 :
+ fprintf(stderr, "Duplex No Tumble (Long Edge)\n");
+ break;
+ case 2 :
+ fprintf(stderr, "Duplex Tumble (Short Edge)\n");
+ break;
+ default :
+ fprintf(stderr, "Unknown (%d)\n", numeric_arg);
+ break;
}
break;
@@ -1396,11 +1422,16 @@ int main(int argc, char *argv[])
case PCL_CPI :
case PCL_PAGE_LENGTH :
case PCL_NUM_COPIES :
- case PCL_DUPLEX :
- case PCL_MEDIA_SIDE :
case RTL_CONFIGURE :
case PCL_ENTER_PCL :
case PCL_NEGATIVE_MOTION :
+ case PCL_JOB_SEPARATION :
+ case PCL_LEFT_OFFSET_REGISTRATION :
+ case PCL_TOP_OFFSET_REGISTRATION :
+ case PCL_PRINT_DIRECTION :
+ case PCL_LEFT_MARGIN :
+ case PCL_RIGHT_MARGIN :
+ case PCL_TEXT_LENGTH :
fprintf(stderr, "%s: %d (ignored)", pcl_commands[command_index].description, numeric_arg);
if (pcl_commands[command_index].has_data == 1) {
fprintf(stderr, " Data: ");
@@ -1445,8 +1476,8 @@ int main(int argc, char *argv[])
case PCL_COMPRESSION_NONE :
fprintf(stderr, "NONE\n");
break;
- case PCL_COMPRESSION_RUNHEIGHT :
- fprintf(stderr, "Runheight\n");
+ case PCL_COMPRESSION_RUNLENGTH :
+ fprintf(stderr, "Runlength\n");
break;
case PCL_COMPRESSION_TIFF :
fprintf(stderr, "TIFF\n");
@@ -1580,17 +1611,17 @@ int main(int argc, char *argv[])
case PCL_DATA :
case PCL_DATA_LAST :
-#ifdef DEBUG
- fprintf(stderr, "%s\n", pcl_commands[command_index].description);
- fprintf(stderr, "Data Height: %d\n", numeric_arg);
-#endif
+ if (skip_output == 1) {
+ fprintf(stderr, "%s, length: %d\n", pcl_commands[command_index].description, numeric_arg);
+ }
+ else {
/*
* Make sure that we have enough data to process this command!
*/
- if (expected_data_rows_per_row == -1)
- fprintf(stderr, "ERROR: raster data without start raster!\n");
+ if (expected_data_rows_per_row == -1)
+ fprintf(stderr, "ERROR: raster data without start raster!\n");
/*
* The last flag indicates that this is the end of the planes for a row
@@ -1598,38 +1629,38 @@ int main(int argc, char *argv[])
* expecting.
*/
- if (command == PCL_DATA_LAST) {
- if (current_data_row != (expected_data_rows_per_row - 1))
- fprintf(stderr, "ERROR: 'Last Plane' set on plane %d of %d!\n",
- current_data_row, expected_data_rows_per_row);
- }
- else {
- if (current_data_row == (expected_data_rows_per_row - 1))
- fprintf(stderr, "ERROR: Expected 'last plane', but not set!\n");
- }
+ if (command == PCL_DATA_LAST) {
+ if (current_data_row != (expected_data_rows_per_row - 1))
+ fprintf(stderr, "ERROR: 'Last Plane' set on plane %d of %d!\n",
+ current_data_row, expected_data_rows_per_row);
+ }
+ else {
+ if (current_data_row == (expected_data_rows_per_row - 1))
+ fprintf(stderr, "ERROR: Expected 'last plane', but not set!\n");
+ }
/*
* Accumulate the data rows for each output row,then write the image.
*/
- if (image_data.compression_type == PCL_COMPRESSION_NONE) {
- memcpy(received_rows[current_data_row], &data_buffer, (size_t) numeric_arg);
- output_data.active_height = numeric_arg;
- }
- else
- output_data.active_height = decode_tiff(data_buffer, numeric_arg, received_rows[current_data_row], output_data.buffer_length);
-
- if (command == PCL_DATA_LAST) {
- if (image_data.colour_type == PCL_MONO)
- write_grey(&output_data, &image_data);
+ if (image_data.compression_type == PCL_COMPRESSION_NONE) {
+ memcpy(received_rows[current_data_row], &data_buffer, (size_t) numeric_arg);
+ output_data.active_length = numeric_arg;
+ }
else
- write_colour(&output_data, &image_data);
- current_data_row = 0;
- image_row_counter++;
+ output_data.active_length = decode_tiff(data_buffer, numeric_arg, received_rows[current_data_row], output_data.buffer_length);
+
+ if (command == PCL_DATA_LAST) {
+ if (image_data.colour_type == PCL_MONO)
+ write_grey(&output_data, &image_data);
+ else
+ write_colour(&output_data, &image_data);
+ current_data_row = 0;
+ image_row_counter++;
+ }
+ else
+ current_data_row++;
}
- else
- current_data_row++;
-
break;
case PCL_ENTER_HPGL2 :
@@ -1685,6 +1716,41 @@ int main(int argc, char *argv[])
fprintf(stderr, " (ignored)\n");
break;
+ case PCL_MEDIA_SIDE :
+ fprintf(stderr, "%s: ", pcl_commands[command_index].description);
+ switch (numeric_arg) {
+ case 0 :
+ fprintf(stderr, "Next side");
+ break;
+ case 1 :
+ fprintf(stderr, "Front side");
+ break;
+ case 2 :
+ fprintf(stderr, "Back side");
+ break;
+ default :
+ fprintf(stderr, "Unknown (%d)", numeric_arg);
+ break;
+ }
+ fprintf(stderr, " (ignored)\n");
+ break;
+
+ case PCL_MEDIA_DEST :
+ fprintf(stderr, "%s: ", pcl_commands[command_index].description);
+ switch (numeric_arg) {
+ case 1 :
+ fprintf(stderr, "Upper Output bin");
+ break;
+ case 2 :
+ fprintf(stderr, "Lower (Rear) Output bin");
+ break;
+ default :
+ fprintf(stderr, "Unknown (%d)", numeric_arg);
+ break;
+ }
+ fprintf(stderr, " (ignored)\n");
+ break;
+
default :
fprintf(stderr, "ERROR: No handler for %s!\n", pcl_commands[command_index].description);
break;
diff --git a/test/run-testdither b/test/run-testdither
index 36b4d11..b217788 100755
--- a/test/run-testdither
+++ b/test/run-testdither
@@ -2,12 +2,16 @@
out_status=0
+if [ $# -eq 0 ] ; then
+ quiet=quiet
+fi
+
if [ -z "$bits" ] ; then
bits='1-bit 2-bit'
fi
if [ -z "$dither_types" ] ; then
- dither_types='monochrome gray color photo cmyk photocmyk'
+ dither_types='gray color photo cmyk photocmyk'
fi
if [ -z "$image_types" ] ; then
@@ -15,26 +19,38 @@ if [ -z "$image_types" ] ; then
fi
if [ -z "$algos" ] ; then
- algos='Adaptive EvenTone Ordered Fast VeryFast Floyd'
+ algos='Adaptive Ordered Fast VeryFast Floyd EvenTone'
fi
if [ -z "$print_image" ] ; then
image='no-image'
fi
-for bits in $bits ; do
- for dither_type in $dither_types ; do
- for image_type in $image_types ; do
- for algo in $algos ; do
- ./testdither $image $bits $dither_type $image_type $algo
+if [ -z "$STP_DATA_PATH" ] ; then
+ STP_DATA_PATH=`pwd`/../src/main
+ export STP_DATA_PATH
+fi
+
+if [ -z "$STP_MODULE_PATH" ] ; then
+ STP_MODULE_PATH=`pwd`/../src/main:`pwd`/../src/main/.libs
+ export STP_MODULE_PATH
+fi
+
+for algo in $algos ; do
+ echo -n "Testing $algo:"
+ for bit in $bits ; do
+ for dither_type in $dither_types ; do
+ for image_type in $image_types ; do
+ ./testdither $quiet $image $bit $dither_type $image_type $algo
status=$?
if [ "$status" -ne 0 ] ; then
- echo ./testdither $image $bits $dither_type $image_type $algo failed
+ echo ./testdither $image $bit $dither_type $image_type $algo failed
out_status=`expr $out_status + 1`
fi
done
done
done
+ echo
done
exit $out_status
diff --git a/test/run-weavetest b/test/run-weavetest
index 15169ca..cde055f 100755
--- a/test/run-weavetest
+++ b/test/run-weavetest
@@ -1,43 +1,91 @@
#!/bin/sh
-echo 'run-weavetest may take over an hour to complete. Please wait...'
+echo "$0 may take a very long time to complete. Please wait..."
-modes='15,3 15,6 21,4 21,8 32,4 32,8 48,3 48,6 59,1 59,2 59,4 60,1 60,2 60,4 64,2 64,4 96,2 96,4 128,1 128,2 128,4 128,8 144,1 144,2 144,4 180,1 180,2 180,4 192,1 192,2'
-passes='1,1,1 2,1,1 1,2,1 1,2,2 1,4,1 4,1,1 4,2,1 2,2,1 1,4,2 2,2,2 2,4,2 8,1,1'
+passes='1,1,1 2,1,1 1,2,1 1,2,2 1,4,1 4,1,1 4,2,1 2,2,1 1,4,2 2,2,2 2,4,2 8,1,1 4,4,2 8,2,1 16,1,1'
-jets='1 2 4 8 15 20 21 24 32 47 48 60 64 96 128 144 180 192'
-separations='1 2 3 4 6 8'
-arrangements='0 1'
-#rows=2000
-head_limit=768
+# All numbers of jets used by any printer.
+jets='1 2 4 8 15 16 20 21 24 29 32 47 48 59 60 64 90 96 128 144 180 192 208 360'
+
+# All nozzle separations used by any printer at any resolution.
+separations='1 2 3 4 6 8 12 16'
+
+# Weave strategies
+strategies='0 1 2 3 4'
+# Strategy 5 is currently broken
+#strategies='5'
+
+# Color head arrangement (for offset-head printers such as the Epson C80)
+arrangements='0 1 2 3'
+
+# Set to the largest possible multiple of the number of heads and
+# the nozzle separation. At present, the PM-970C has 360 heads spaced
+# 1/360" apart, with a maximum resolution of 2880x2880. There's no
+# point right now in testing anything higher than this, and it's very
+# time consuming.
+head_limit=2880
if [ $# -eq 0 ] ; then
- extracmd='grep [a-z]'
-else
- extracmd=cat
+ QUIET=1
+ export QUIET
fi
-(for jet in $jets ; do
- for sep in $separations ; do
- for pass in $passes ; do
- for arrangement in $arrangements; do
- start=`expr $jet \* $sep`
- if [ $start -le $head_limit ] ; then
- rows=`expr $start \* 10`
- if [ $rows -lt 200 ] ; then
- rows=200
- fi
- s1=`expr $start - 1`
- for f in 0 41 $start $s1 ; do
- end=`expr $rows + $f + $start`
- end1=`expr $rows + $f`
- end2=`expr $rows + $f + 35`
- for g in $end $end1 $end2 ; do
- echo "$jet $sep $pass $rows $f $g $arrangement"
+# For valgrind use, use
+# valgrind --partial-loads-ok=no --num-callers=50 --leak-check=yes
+#
+# and use these suppressions:
+#
+#{
+# gettext
+# Addr4
+# fun:__dcigettext
+# fun:__dcgettext
+#}
+#
+#{
+# nl_load_locale
+# Addr4
+# fun:_nl_load_locale
+# fun:_nl_find_locale
+# fun:setlocale
+#}
+#
+#{
+# setlocale
+# Addr4
+# fun:setlocale
+#}
+#
+#{
+# c_strlen
+# Addr4
+# fun:c_strlen
+#}
+
+(
+for strategy in $strategies ; do
+ for jet in $jets ; do
+ for sep in $separations ; do
+ start=`expr $jet \* $sep`
+ if [ $start -le $head_limit ] ; then
+ rows=`expr $start \* 5`
+ if [ $rows -lt 200 ] ; then
+ rows=200
+ fi
+ s1=`expr $start - 1`
+ for f in 0 41 $start $s1 ; do
+ end=`expr $rows + $f + $start`
+ end1=`expr $rows + $f`
+ end2=`expr $rows + $f + 35`
+ for g in $end $end1 $end2 ; do
+ for pass in $passes ; do
+ for arrangement in $arrangements; do
+ echo "$jet $sep $pass $rows $f $g $arrangement $strategy"
+ done
done
done
- fi
- done
+ done
+ fi
done
done
-done) | sed 's/,/ /g' | ./escp2-weavetest | $extracmd
+done) | sed 's/,/ /g' | ./escp2-weavetest
diff --git a/test/testdither.c b/test/testdither.c
index 52c2ea4..de1da06 100644
--- a/test/testdither.c
+++ b/test/testdither.c
@@ -1,5 +1,5 @@
/*
- * "$Id: testdither.c,v 1.11.4.1 2002/05/03 01:30:29 rlk Exp $"
+ * "$Id: testdither.c,v 1.48 2005/05/07 14:46:41 rlk Exp $"
*
* Test/profiling program for dithering code.
*
@@ -23,23 +23,21 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef INCLUDE_GIMP_PRINT_H
-#include INCLUDE_GIMP_PRINT_H
-#else
-#include <gimp-print/gimp-print.h>
-#endif
-#include "../lib/libprintut.h"
-#include "../src/main/gimp-print-internal.h"
+#include <gutenprint/gutenprint.h>
+#define STPI_TESTDITHER
+
+#include "../src/main/gutenprint-internal.h"
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
+#include <string.h>
/*
* Definitions for dither test...
*/
#define IMAGE_WIDTH 5760 /* 8in * 720dpi */
-#define IMAGE_HEIGHT 720 /* 4in * 720dpi */
+#define IMAGE_HEIGHT 2880 /* 4in * 720dpi */
#define BUFFER_SIZE IMAGE_WIDTH
#define IMAGE_MIXED 0 /* Mix of line types */
@@ -51,9 +49,8 @@
#define DITHER_GRAY 0 /* Dither grayscale pixels */
#define DITHER_COLOR 1 /* Dither color pixels */
#define DITHER_PHOTO 2 /* Dither photo pixels */
-#define DITHER_MONOCHROME 3 /* Dither photo pixels */
-#define DITHER_CMYK 4 /* Dither photo pixels */
-#define DITHER_PHOTO_CMYK 5 /* Dither photo pixels */
+#define DITHER_CMYK 3 /* Dither photo pixels */
+#define DITHER_PHOTO_CMYK 4 /* Dither photo pixels */
/*
@@ -61,40 +58,50 @@
*/
int image_type = IMAGE_MIXED;
-int dither_type = DITHER_COLOR;
+int stpi_dither_type = DITHER_COLOR;
const char *dither_name = NULL;
int dither_bits = 1;
-unsigned short white_line[IMAGE_WIDTH * 4],
- black_line[IMAGE_WIDTH * 4],
- color_line[IMAGE_WIDTH * 4],
- random_line[IMAGE_WIDTH * 4];
+unsigned short white_line[IMAGE_WIDTH * 6],
+ black_line[IMAGE_WIDTH * 6],
+ color_line[IMAGE_WIDTH * 6],
+ random_line[IMAGE_WIDTH * 6];
+
+
+#define SHADE(density, name) \
+{ density, sizeof(name)/sizeof(stp_dotsize_t), name }
+static const stp_dotsize_t single_dotsize[] =
+{
+ { 0x1, 1.0 }
+};
-stp_simple_dither_range_t normal_1bit_ranges[] =
+static const stp_dotsize_t variable_dotsizes[] =
{
- { 1.0, 0x1, 0, 1 }
+ { 0x1, 0.28 },
+ { 0x2, 0.58 },
+ { 0x3, 1.0 }
};
-stp_simple_dither_range_t normal_2bit_ranges[] =
+static const stp_shade_t normal_1bit_shades[] =
{
- { 0.45, 0x1, 0, 1 },
- { 0.68, 0x2, 0, 2 },
- { 1.0, 0x3, 0, 3 }
+ SHADE(1.0, single_dotsize)
};
-stp_simple_dither_range_t photo_1bit_ranges[] =
+static const stp_shade_t photo_1bit_shades[] =
{
- { 0.33, 0x1, 1, 1 },
- { 1.0, 0x1, 0, 1 }
+ SHADE(0.33, single_dotsize),
+ SHADE(1.0, single_dotsize)
};
-stp_simple_dither_range_t photo_2bit_ranges[] =
+static const stp_shade_t normal_2bit_shades[] =
{
- { 0.15, 0x1, 1, 1 },
- { 0.227, 0x2, 1, 2 },
- { 0.45, 0x1, 0, 1 },
- { 0.68, 0x2, 0, 2 },
- { 1.0, 0x3, 0, 3 }
+ SHADE(1.0, variable_dotsizes)
+};
+
+static const stp_shade_t photo_2bit_shades[] =
+{
+ SHADE(0.33, variable_dotsizes),
+ SHADE(1.0, variable_dotsizes)
};
@@ -123,6 +130,22 @@ writefunc(void *file, const char *buf, size_t bytes)
fwrite(buf, 1, bytes, prn);
}
+static int
+image_width(stp_image_t *image)
+{
+ return IMAGE_WIDTH;
+}
+
+static stp_image_t theImage =
+{
+ NULL,
+ NULL,
+ image_width,
+ NULL,
+ NULL,
+ NULL,
+};
+
/*
* 'main()' - Test dithering code for performance measurement.
*/
@@ -131,6 +154,7 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
+ int print_progress = 0;
int i, j; /* Looping vars */
unsigned char black[BUFFER_SIZE], /* Black bitmap data */
cyan[BUFFER_SIZE], /* Cyan bitmap data */
@@ -138,19 +162,18 @@ main(int argc, /* I - Number of command-line arguments */
lcyan[BUFFER_SIZE], /* Light cyan bitmap data */
lmagenta[BUFFER_SIZE], /* Light magenta bitmap data */
yellow[BUFFER_SIZE]; /* Yellow bitmap data */
- void *dither; /* Dither data */
- unsigned short rgb[IMAGE_WIDTH * 4], /* RGB buffer */
+ unsigned short rgb[IMAGE_WIDTH * 6], /* RGB buffer */
gray[IMAGE_WIDTH]; /* Grayscale buffer */
int write_image; /* Write the image to disk? */
FILE *fp = NULL; /* PPM/PGM output file */
char filename[1024]; /* Name of file */
- stp_vars_t v; /* Dither variables */
- static const char *dither_types[] = /* Different dithering modes */
+ stp_vars_t *v; /* Dither variables */
+ stp_parameter_t desc;
+ static const char *stpi_dither_types[] = /* Different dithering modes */
{
"gray",
"color",
"photo",
- "monochrome",
"cmyk",
"photocmyk"
};
@@ -163,14 +186,16 @@ main(int argc, /* I - Number of command-line arguments */
"random"
};
struct timeval tv1, tv2;
- stp_dither_data_t *dt;
+ int quiet = 0;
/*
- * Initialise libgimpprint
+ * Initialise libgutenprint
*/
stp_init();
- v = stp_allocate_vars();
+ v = stp_vars_create();
+ stp_set_driver(v, "escp2-ex");
+ stp_describe_parameter(v, "DitherAlgorithm", &desc);
/*
* Get command-line args...
@@ -186,6 +211,12 @@ main(int argc, /* I - Number of command-line arguments */
continue;
}
+ if (strcmp(argv[i], "quiet") == 0)
+ {
+ quiet = 1;
+ continue;
+ }
+
if (strcmp(argv[i], "1-bit") == 0)
{
dither_bits = 1;
@@ -198,13 +229,13 @@ main(int argc, /* I - Number of command-line arguments */
continue;
}
- for (j = 0; j < 6; j ++)
- if (strcmp(argv[i], dither_types[j]) == 0)
+ for (j = 0; j < 5; j ++)
+ if (strcmp(argv[i], stpi_dither_types[j]) == 0)
break;
- if (j < 6)
+ if (j < 5)
{
- dither_type = j;
+ stpi_dither_type = j;
continue;
}
@@ -218,17 +249,12 @@ main(int argc, /* I - Number of command-line arguments */
continue;
}
- for (j = 0; j < stp_dither_algorithm_count(); j ++)
- if (strcmp(argv[i], stp_dither_algorithm_name(j)) == 0)
- break;
-
- if (j < stp_dither_algorithm_count())
- {
- dither_name = stp_dither_algorithm_name(j);
- continue;
- }
+ for (j = 0; j < stp_string_list_count(desc.bounds.str); j ++)
+ if (strcmp(argv[i], stp_string_list_param(desc.bounds.str,j)->name) == 0)
+ dither_name = stp_string_list_param(desc.bounds.str, j)->name;
- printf("Unknown option \"%s\" ignored!\n", argv[i]);
+ if (!dither_name)
+ printf("Unknown option \"%s\" ignored!\n", argv[i]);
}
/*
@@ -246,95 +272,149 @@ main(int argc, /* I - Number of command-line arguments */
*/
if (dither_name)
- stp_set_dither_algorithm(v, dither_name);
+ stp_set_string_parameter(v, "DitherAlgorithm", dither_name);
- switch (dither_type)
+ stp_set_string_parameter(v, "ChannelBitDepth", "8");
+ switch (stpi_dither_type)
{
case DITHER_GRAY:
- stp_set_output_type(v, OUTPUT_GRAY);
- break;
- case DITHER_MONOCHROME:
- stp_set_output_type(v, OUTPUT_MONOCHROME);
+ stp_set_string_parameter(v, "PrintingMode", "BW");
+ stp_set_string_parameter(v, "InputImageType", "Grayscale");
break;
case DITHER_COLOR:
case DITHER_PHOTO:
- stp_set_output_type(v, OUTPUT_COLOR);
+ stp_set_string_parameter(v, "PrintingMode", "Color");
+ stp_set_string_parameter(v, "InputImageType", "RGB");
break;
case DITHER_CMYK:
case DITHER_PHOTO_CMYK:
- stp_set_output_type(v, OUTPUT_RAW_CMYK);
+ stp_set_string_parameter(v, "PrintingMode", "Color");
+ stp_set_string_parameter(v, "InputImageType", "CMYK");
break;
}
- dither = stp_init_dither(IMAGE_WIDTH, IMAGE_WIDTH, 1, 1, v);
+ stp_dither_init(v, &theImage, IMAGE_WIDTH, 1, 1);
- for (i = 0; i < NCOLORS; i++)
- stp_dither_set_black_level(dither, i, 1.0);
+ /*
+ * Now dither the "page"...
+ */
+
+ switch (stpi_dither_type)
+ {
+ case DITHER_PHOTO:
+ stp_dither_add_channel(v, lcyan, STP_ECOLOR_C, 1);
+ stp_dither_add_channel(v, lmagenta, STP_ECOLOR_M, 1);
+ /* FALLTHROUGH */
+ case DITHER_COLOR:
+ stp_dither_add_channel(v, cyan, STP_ECOLOR_C, 0);
+ stp_dither_add_channel(v, magenta, STP_ECOLOR_M, 0);
+ stp_dither_add_channel(v, yellow, STP_ECOLOR_Y, 0);
+ break;
+ case DITHER_PHOTO_CMYK :
+ stp_dither_add_channel(v, lcyan, STP_ECOLOR_C, 1);
+ stp_dither_add_channel(v, lmagenta, STP_ECOLOR_M, 1);
+ /* FALLTHROUGH */
+ case DITHER_CMYK :
+ stp_dither_add_channel(v, cyan, STP_ECOLOR_C, 0);
+ stp_dither_add_channel(v, magenta, STP_ECOLOR_M, 0);
+ stp_dither_add_channel(v, yellow, STP_ECOLOR_Y, 0);
+ /* FALLTHROUGH */
+ case DITHER_GRAY:
+ stp_dither_add_channel(v, black, STP_ECOLOR_K, 0);
+ }
- if (dither_type == DITHER_PHOTO)
- stp_dither_set_black_lower(dither, 0.4 / dither_bits + 0.1);
+ if (stpi_dither_type == DITHER_PHOTO)
+ stp_set_float_parameter(v, "GCRLower", 0.4 / dither_bits + 0.1);
else
- stp_dither_set_black_lower(dither, 0.25 / dither_bits);
+ stp_set_float_parameter(v, "GCRLower", 0.25 / dither_bits);
- stp_dither_set_black_upper(dither, 0.5);
+ stp_set_float_parameter(v, "GCRUpper", .5);
- switch (dither_type)
+ switch (stpi_dither_type)
{
case DITHER_GRAY :
- case DITHER_MONOCHROME :
switch (dither_bits)
{
case 1 :
- stp_dither_set_ranges(dither, ECOLOR_K, 1, normal_1bit_ranges, 1.0);
+ stp_dither_set_inks_full(v, STP_ECOLOR_K, 1, normal_1bit_shades, 1.0, 1.0);
break;
case 2 :
- stp_dither_set_transition(dither, 0.5);
- stp_dither_set_ranges(dither, ECOLOR_K, 3, normal_2bit_ranges, 1.0);
+ stp_dither_set_transition(v, 0.5);
+ stp_dither_set_inks_full(v, STP_ECOLOR_K, 1, normal_2bit_shades, 1.0, 1.0);
break;
}
break;
case DITHER_COLOR :
+ switch (dither_bits)
+ {
+ case 1 :
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 1, normal_1bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 1, normal_1bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_1bit_shades, 1.0, 0.08);
+ break;
+ case 2 :
+ stp_dither_set_transition(v, 0.5);
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 1, normal_2bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 1, normal_2bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_2bit_shades, 1.0, 0.08);
+ break;
+ }
+ break;
case DITHER_CMYK :
switch (dither_bits)
{
case 1 :
- stp_dither_set_ranges(dither, ECOLOR_C, 1, normal_1bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_M, 1, normal_1bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_Y, 1, normal_1bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_K, 1, normal_1bit_ranges, 1.0);
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 1, normal_1bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 1, normal_1bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_1bit_shades, 1.0, 0.08);
+ stp_dither_set_inks_full(v, STP_ECOLOR_K, 1, normal_1bit_shades, 1.0, 1.0);
break;
case 2 :
- stp_dither_set_transition(dither, 0.5);
- stp_dither_set_ranges(dither, ECOLOR_C, 3, normal_2bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_M, 3, normal_2bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_Y, 3, normal_2bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_K, 3, normal_2bit_ranges, 1.0);
+ stp_dither_set_transition(v, 0.5);
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 1, normal_2bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 1, normal_2bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_2bit_shades, 1.0, 0.08);
+ stp_dither_set_inks_full(v, STP_ECOLOR_K, 1, normal_2bit_shades, 1.0, 1.0);
break;
}
break;
case DITHER_PHOTO :
+ switch (dither_bits)
+ {
+ case 1 :
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 2, photo_1bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 2, photo_1bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_1bit_shades, 1.0, 0.08);
+ break;
+ case 2 :
+ stp_dither_set_transition(v, 0.7);
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 2, photo_2bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 2, photo_2bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_2bit_shades, 1.0, 0.08);
+ break;
+ }
+ break;
case DITHER_PHOTO_CMYK :
switch (dither_bits)
{
case 1 :
- stp_dither_set_ranges(dither, ECOLOR_C, 2, photo_1bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_M, 2, photo_1bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_Y, 1, normal_1bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_K, 1, normal_1bit_ranges, 1.0);
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 2, photo_1bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 2, photo_1bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_1bit_shades, 1.0, 0.08);
+ stp_dither_set_inks_full(v, STP_ECOLOR_K, 1, normal_1bit_shades, 1.0, 1.0);
break;
case 2 :
- stp_dither_set_transition(dither, 0.7);
- stp_dither_set_ranges(dither, ECOLOR_C, 5, photo_2bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_M, 5, photo_2bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_Y, 3, normal_2bit_ranges, 1.0);
- stp_dither_set_ranges(dither, ECOLOR_K, 3, normal_2bit_ranges, 1.0);
+ stp_dither_set_transition(v, 0.7);
+ stp_dither_set_inks_full(v, STP_ECOLOR_C, 2, photo_2bit_shades, 1.0, 0.65);
+ stp_dither_set_inks_full(v, STP_ECOLOR_M, 2, photo_2bit_shades, 1.0, 0.6);
+ stp_dither_set_inks_full(v, STP_ECOLOR_Y, 1, normal_2bit_shades, 1.0, 0.08);
+ stp_dither_set_inks_full(v, STP_ECOLOR_K, 1, normal_2bit_shades, 1.0, 1.0);
break;
}
break;
}
- stp_dither_set_ink_spread(dither, 12 + dither_bits);
- stp_dither_set_density(dither, 1.0);
+ stp_dither_set_ink_spread(v, 12 + dither_bits);
/*
* Open the PPM/PGM file...
@@ -342,20 +422,21 @@ main(int argc, /* I - Number of command-line arguments */
sprintf(filename, "%s-%s-%s-%dbit.%s", image_types[image_type],
- dither_types[dither_type],
- dither_name ? dither_name : stp_default_dither_algorithm(),
- dither_bits,
- (dither_type == DITHER_GRAY || dither_type == DITHER_MONOCHROME) ?
- "pgm" : "ppm");
-
- printf("%s ", filename);
-
+ stpi_dither_types[stpi_dither_type],
+ dither_name ? dither_name : desc.deflt.str, dither_bits,
+ (stpi_dither_type == DITHER_GRAY) ? "pgm" : "ppm");
+
+ if (isatty(1))
+ print_progress = 1;
+
+ if (print_progress && !quiet)
+ printf("%s ", filename);
+
if (write_image)
{
if ((fp = fopen(filename, "wb")) != NULL)
{
- puts(filename);
- if (dither_type == DITHER_GRAY || dither_type == DITHER_MONOCHROME)
+ if (stpi_dither_type == DITHER_GRAY)
fputs("P5\n", fp);
else
fputs("P6\n", fp);
@@ -366,59 +447,35 @@ main(int argc, /* I - Number of command-line arguments */
perror("Create");
}
- /*
- * Now dither the "page"...
- */
-
- dt = stp_create_dither_data();
- switch (dither_type)
- {
- case DITHER_PHOTO:
- case DITHER_PHOTO_CMYK :
- stp_add_channel(dt, lcyan, ECOLOR_C, 1);
- stp_add_channel(dt, lmagenta, ECOLOR_M, 1);
- /* FALLTHROUGH */
- case DITHER_COLOR:
- case DITHER_CMYK :
- stp_add_channel(dt, cyan, ECOLOR_C, 0);
- stp_add_channel(dt, magenta, ECOLOR_M, 0);
- stp_add_channel(dt, yellow, ECOLOR_Y, 0);
- /* FALLTHROUGH */
- case DITHER_GRAY:
- case DITHER_MONOCHROME:
- stp_add_channel(dt, black, ECOLOR_K, 0);
- }
-
(void) gettimeofday(&tv1, NULL);
for (i = 0; i < IMAGE_HEIGHT; i ++)
{
- if ((i & 63) == 0)
+ if (print_progress && !quiet && (i & 63) == 0)
{
printf("\rProcessing row %d...", i);
fflush(stdout);
}
- switch (dither_type)
- {
+ switch (stpi_dither_type)
+ {
case DITHER_GRAY :
- case DITHER_MONOCHROME :
image_get_row(gray, i);
- stp_dither(gray, i, dither, dt, 0, 0);
+ stp_dither_internal(v, i, gray, 0, 0, NULL);
if (fp)
write_gray(fp, black);
break;
case DITHER_COLOR :
case DITHER_CMYK :
image_get_row(rgb, i);
- stp_dither(rgb, i, dither, dt, 0, 0);
+ stp_dither_internal(v, i, rgb, 0, 0, NULL);
if (fp)
write_color(fp, cyan, magenta, yellow, black);
break;
case DITHER_PHOTO :
case DITHER_PHOTO_CMYK :
image_get_row(rgb, i);
- stp_dither(rgb, i, dither, dt, 0, 0);
+ stp_dither_internal(v, i, rgb, 0, 0, NULL);
if (fp)
write_photo(fp, cyan, lcyan, magenta, lmagenta, yellow, black);
break;
@@ -427,15 +484,22 @@ main(int argc, /* I - Number of command-line arguments */
(void) gettimeofday(&tv2, NULL);
- stp_free_dither_data(dt);
- stp_free_dither(dither);
+ stp_vars_destroy(v);
if (fp != NULL)
fclose(fp);
- printf("\r%-40s Total dither time for %d pixels is %.3f seconds, or %.2f pixels/sec.\n",
- filename, IMAGE_WIDTH * IMAGE_HEIGHT, compute_interval(&tv1, &tv2),
- (float)(IMAGE_WIDTH * IMAGE_HEIGHT) / compute_interval(&tv1, &tv2));
+ if (quiet)
+ fputc('.', stdout);
+ else
+ {
+ if (print_progress)
+ fputc('\r', stdout);
+ printf("%-30s %d pix %.3f sec %.2f pix/sec\n",
+ filename, IMAGE_WIDTH * IMAGE_HEIGHT, compute_interval(&tv1, &tv2),
+ (float)(IMAGE_WIDTH * IMAGE_HEIGHT) / compute_interval(&tv1, &tv2));
+ fflush(stdout);
+ }
return 0;
}
@@ -482,20 +546,23 @@ image_get_row(unsigned short *data,
break;
}
- switch (dither_type)
+ switch (stpi_dither_type)
{
case DITHER_GRAY:
- case DITHER_MONOCHROME:
memcpy(data, src, IMAGE_WIDTH * 2);
break;
case DITHER_COLOR:
- case DITHER_PHOTO:
memcpy(data, src, IMAGE_WIDTH * 6);
break;
case DITHER_CMYK:
- case DITHER_PHOTO_CMYK:
memcpy(data, src, IMAGE_WIDTH * 8);
break;
+ case DITHER_PHOTO:
+ memcpy(data, src, IMAGE_WIDTH * 10);
+ break;
+ case DITHER_PHOTO_CMYK:
+ memcpy(data, src, IMAGE_WIDTH * 12);
+ break;
}
}
@@ -527,15 +594,13 @@ image_init(void)
j = i / (IMAGE_WIDTH / 64);
- switch (dither_type)
+ switch (stpi_dither_type)
{
case DITHER_GRAY:
- case DITHER_MONOCHROME:
*cptr++ = 65535 * j / 63;
*rptr++ = 65535 * (rand() & 255) / 255;
break;
case DITHER_COLOR:
- case DITHER_PHOTO:
*cptr++ = 65535 * (j >> 4) / 3;
*cptr++ = 65535 * ((j >> 2) & 3) / 3;
*cptr++ = 65535 * (j & 3) / 3;
@@ -544,11 +609,36 @@ image_init(void)
*rptr++ = 65535 * (rand() & 255) / 255;
break;
case DITHER_CMYK:
+ *cptr++ = 65535 * (j >> 4) / 3;
+ *cptr++ = 65535 * ((j >> 2) & 3) / 3;
+ *cptr++ = 65535 * (j & 3) / 3;
+ *cptr++ = 65535 * j / 63;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ break;
+ case DITHER_PHOTO:
+ *cptr++ = 65535 * (j >> 4) / 3;
+ *cptr++ = 65535 * ((j >> 2) & 3) / 3;
+ *cptr++ = 65535 * (j & 3) / 3;
+ *cptr++ = 65535 * j / 63;
+ *cptr++ = 65535 * (j >> 4) / 3;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ break;
case DITHER_PHOTO_CMYK:
*cptr++ = 65535 * (j >> 4) / 3;
*cptr++ = 65535 * ((j >> 2) & 3) / 3;
*cptr++ = 65535 * (j & 3) / 3;
*cptr++ = 65535 * j / 63;
+ *cptr++ = 65535 * (j >> 4) / 3;
+ *cptr++ = 65535 * ((j >> 2) & 3) / 3;
+ *rptr++ = 65535 * (rand() & 255) / 255;
+ *rptr++ = 65535 * (rand() & 255) / 255;
*rptr++ = 65535 * (rand() & 255) / 255;
*rptr++ = 65535 * (rand() & 255) / 255;
*rptr++ = 65535 * (rand() & 255) / 255;
@@ -859,5 +949,5 @@ write_photo(FILE *fp,
/*
- * End of "$Id: testdither.c,v 1.11.4.1 2002/05/03 01:30:29 rlk Exp $".
+ * End of "$Id: testdither.c,v 1.48 2005/05/07 14:46:41 rlk Exp $".
*/
diff --git a/test/unprint.c b/test/unprint.c
index 7de7670..6df4b81 100644
--- a/test/unprint.c
+++ b/test/unprint.c
@@ -1,4 +1,4 @@
-/* $Id: unprint.c,v 1.22.4.2 2003/12/02 01:51:01 rlk Exp $ */
+/* $Id: unprint.c,v 1.35 2004/09/17 18:38:28 rleigh Exp $ */
/*
* Generate PPM files from printer output
*
@@ -24,10 +24,12 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "../lib/libprintut.h"
+#include <gutenprint/util.h>
#include<stdio.h>
#include<stdlib.h>
+#ifdef HAVE_LIMITS_H
#include<limits.h>
+#endif
#include<string.h>
#ifdef __GNUC__
@@ -39,7 +41,7 @@
*/
typedef struct {
unsigned char unidirectional;
- unsigned char interleave;
+ unsigned char printer_weave;
int page_management_units; /* dpi */
int relative_horizontal_units; /* dpi */
int absolute_horizontal_units; /* dpi, assumed to be >= relative */
@@ -85,7 +87,7 @@ typedef struct {
* actually read in the data. This optimization may be worthwhile.
*/
-#define MAX_INKS 7
+#define MAX_INKS 11
typedef struct {
unsigned char *line[MAX_INKS];
int startx[MAX_INKS];
@@ -104,6 +106,7 @@ unsigned short sh;
int eject = 0;
int global_counter = 0;
int global_count = 0;
+unsigned color_mask = 0xffffffff;
pstate_t pstate;
int unweave;
@@ -118,22 +121,62 @@ line_type **page=NULL;
Yellow 4 4 3
L.Mag. 17 257 4
L.Cyan 18 258 5
- L.Yellow NA NA 6
+ L.Black 16 256 6
+ D.Yellow 36 516 7
+ Red 7 N/A 8
+ Blue 8 N/A 9
+ P.Black 64 N/A 0
+ Gloss 9 N/A 10
*/
/* convert either Epson1 or Epson2 color encoding into a sequential encoding */
-#define seqcolor(c) (((c)&3)+(((c)&276)?3:0)) /* Intuitive, huh? */
+static inline int
+seqcolor(int c)
+{
+ switch (c)
+ {
+ case 0:
+ case 64:
+ return 0;
+ case 1:
+ return 1;
+ case 2:
+ return 2;
+ case 4:
+ return 3;
+ case 17:
+ case 257:
+ return 4;
+ case 18:
+ case 258:
+ return 5;
+ case 16:
+ case 256:
+ return 6;
+ case 36:
+ case 516:
+ return 7;
+ case 7:
+ return 8;
+ case 8:
+ return 9;
+ case 9:
+ return 10;
+ default:
+ return 0;
+ }
+}
extern void merge_line(line_type *p, unsigned char *l, int startl, int stopl,
int color);
extern void expand_line (unsigned char *src, unsigned char *dst, int height,
int skip, int left_ignore);
-extern void write_output (FILE *fp_w, int dontwrite);
-extern void find_white (unsigned char *buf,int npix, int *left, int *right);
-extern int update_page (unsigned char *buf, int bufsize, int m, int n,
+extern void write_output (FILE *fp_w, int dontwrite, int allblack);
+extern void find_white (unsigned char *buff,int npix, int *left, int *right);
+extern int update_page (unsigned char *buff, int buffsize, int m, int n,
int color, int density);
extern void parse_escp2 (FILE *fp_r);
-extern void reverse_bit_order (unsigned char *buf, int n);
+extern void reverse_bit_order (unsigned char *buff, int n);
extern int rle_decode (unsigned char *inbuf, int n, int max);
extern void parse_canon (FILE *fp_r);
@@ -142,7 +185,7 @@ unsigned get_mask_2[] = { 6, 4, 2, 0 };
unsigned get_mask_4[] = { 4, 0 };
static inline int
-get_bits(unsigned char *p, int index)
+get_bits(unsigned char *p, int idx)
{
/*
* p is a pointer to a bit stream, ordered MSb first. Extract the
@@ -154,17 +197,17 @@ get_bits(unsigned char *p, int index)
switch (pstate.bpp)
{
case 1:
- return (p[index >> 3] >> (7 - (index & 7))) & 1;
+ return (p[idx >> 3] >> (7 - (idx & 7))) & 1;
case 2:
- b = get_mask_2[index & 3];
- return (p[index >> 2] >> b) & 3;
+ b = get_mask_2[idx & 3];
+ return (p[idx >> 2] >> b) & 3;
case 4:
- b = get_mask_4[index & 1];
- return (p[index >> 1] >> b) & 0xf;
+ b = get_mask_4[idx & 1];
+ return (p[idx >> 1] >> b) & 0xf;
case 8:
- return p[index];
+ return p[idx];
default:
- addr = (index * pstate.bpp);
+ addr = (idx * pstate.bpp);
value = 0;
for (b = 0; b < pstate.bpp; b++)
{
@@ -181,7 +224,7 @@ static unsigned clr_mask_2[] = { 0xfc, 0, 0xf3, 0, 0xcf, 0, 0x3f, 0 };
static unsigned clr_mask_4[] = { 0xf0, 0, 0, 0, 0xf, 0, 0, 0 };
static inline void
-set_bits(unsigned char *p,int index,int value)
+set_bits(unsigned char *p,int idx,int value)
{
/*
@@ -194,48 +237,52 @@ set_bits(unsigned char *p,int index,int value)
switch (pstate.bpp)
{
case 1:
- b = (7 - (index & 7));
- p[index >> 3] &= clr_mask_1[b];
- p[index >> 3] |= value << b;
+ b = (7 - (idx & 7));
+ p[idx >> 3] &= clr_mask_1[b];
+ p[idx >> 3] |= value << b;
break;
case 2:
- b = get_mask_2[index & 3];
- p[index >> 2] &= clr_mask_2[b];
- p[index >> 2] |= value << b;
+ b = get_mask_2[idx & 3];
+ p[idx >> 2] &= clr_mask_2[b];
+ p[idx >> 2] |= value << b;
break;
case 4:
- b = get_mask_4[index & 1];
- p[index >> 1] &= clr_mask_4[b];
- p[index >> 1] |= value << b;
+ b = get_mask_4[idx & 1];
+ p[idx >> 1] &= clr_mask_4[b];
+ p[idx >> 1] |= value << b;
break;
case 8:
- p[index] = value;
+ p[idx] = value;
break;
default:
for (b = pstate.bpp - 1; b >= 0; b--)
{
if (value & 1)
- p[(index * pstate.bpp + b) / 8] |=
- 1 << (7 - ((index * pstate.bpp + b) % 8));
+ p[(idx * pstate.bpp + b) / 8] |=
+ 1 << (7 - ((idx * pstate.bpp + b) % 8));
else
- p[(index * pstate.bpp + b) / 8] &=
- ~(1 << (7 - ((index * pstate.bpp + b) % 8)));
+ p[(idx * pstate.bpp + b) / 8] &=
+ ~(1 << (7 - ((idx * pstate.bpp + b) % 8)));
value/=2;
}
}
}
-static float ink_colors[8][4] =
+static float ink_colors[MAX_INKS][4] =
{{ 0, 0, 0, 1 }, /* K */
{ 1, .1, 1, 1 }, /* M */
- { .1, 1, 1, 1 }, /* C */
+ { .1, .7, .7, 1 }, /* C */
{ 1, 1, .1, 1 }, /* Y */
{ 1, .7, 1, 1 }, /* m */
- { .7, 1, 1, 1 }, /* c */
- { 1, 1, .7, 1 }, /* y */
- { 1, 1, 1, 1 }};
+ { .4, 1, 1, 1 }, /* c */
+ { .7, .7, .7, 1 }, /* k */
+ { .7, .7, 0, 1 }, /* dY */
+ { 1, 0, 0, 1 }, /* R */
+ { 0, 0, 1, 1 }, /* B */
+ { 1, 1, 1, 1 }, /* Gloss */
+};
-static float quadtone_inks[] = { 0.0, .5, .25, .75 };
+static float quadtone_inks[] = { 0.0, .25, .5, .75 };
static float bpp_shift[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
@@ -244,7 +291,7 @@ mix_ink(ppmpixel p, int color, unsigned int amount, float *ink, int quadtone)
{
/* this is pretty crude */
- if (amount)
+ if (((1 << color) & color_mask) && amount)
{
int i;
float size;
@@ -302,7 +349,7 @@ merge_line(line_type *p, unsigned char *l, int startl, int stopl, int color)
{
width = ((p->stopx[color] - p->startx[color] + 1) * pstate.bpp + 7) / 8;
owidth = ((oldstop - p->startx[color] + 1) * pstate.bpp + 7) / 8;
- p->line[color] = xrealloc(p->line[color], width);
+ p->line[color] = stp_realloc(p->line[color], width);
memset((p->line[color] + owidth), 0, (width - owidth));
}
/*
@@ -320,7 +367,7 @@ merge_line(line_type *p, unsigned char *l, int startl, int stopl, int color)
set_bits(p->line[color], i + shift, pvalue);
}
}
- free(l);
+ stp_free(l);
}
void
@@ -361,7 +408,7 @@ expand_line (unsigned char *src, unsigned char *dst, int height, int skip,
int donothing;
void
-write_output(FILE *fp_w, int dontwrite)
+write_output(FILE *fp_w, int dontwrite, int allblack)
{
int c, l, p, left, right, first, last, width, height, i;
unsigned int amount;
@@ -387,7 +434,7 @@ write_output(FILE *fp_w, int dontwrite)
if (width < 0)
width=0;
- out_row = malloc(sizeof(ppmpixel) * width);
+ out_row = stp_malloc(sizeof(ppmpixel) * width);
fprintf(stderr, "Writing output...\n");
/* write out the PPM header */
@@ -402,7 +449,8 @@ write_output(FILE *fp_w, int dontwrite)
{
for (c = 0; c < MAX_INKS; c++)
{
- float *ink = ink_colors[c];
+ int inknum = allblack ? 0 : c;
+ float *ink = ink_colors[inknum];
if (lt->line[c])
{
if (dontwrite)
@@ -424,11 +472,11 @@ write_output(FILE *fp_w, int dontwrite)
for (i = 0; i < oversample; i++)
fwrite(out_row, sizeof(ppmpixel), width, fp_w);
}
- free(out_row);
+ stp_free(out_row);
}
void
-find_white(unsigned char *buf,int npix, int *left, int *right)
+find_white(unsigned char *buff,int npix, int *left, int *right)
{
/*
@@ -443,7 +491,7 @@ find_white(unsigned char *buf,int npix, int *left, int *right)
bits = npix * pstate.bpp;
bytes = bits / 8;
extra = bits % 8;
- words = bytes / sizeof(long);
+ words = bytes / sizeof(int);
/*
* First, find the leftmost pixel. We first identify the word
@@ -451,15 +499,15 @@ find_white(unsigned char *buf,int npix, int *left, int *right)
* the byte. It does seem like this is unnecessarily complex, perhaps?
*/
max = words;
- for (i = 0; (i < max) && (((long *)buf)[i] == 0); i++)
+ for (i = 0; (i < max) && (((int *)buff)[i] == 0); i++)
;
- max = (i < words) ? (i + 1) * sizeof(long) : bytes;
+ max = (i < words) ? (i + 1) * sizeof(int) : bytes;
- i *= sizeof(long); /* Convert from longs to bytes */
- for (; (i < max) && (buf[i] == 0); i++)
+ i *= sizeof(int); /* Convert from ints to bytes */
+ for (; (i < max) && (buff[i] == 0); i++)
;
max = (i < bytes) ? 8 : extra;
- for (j = 0; (j < max) && !(buf[i] & (1 << (7 - j))); j++)
+ for (j = 0; (j < max) && !(buff[i] & (1 << (7 - j))); j++)
;
*left = (i * 8 + j) / pstate.bpp;
*right = 0;
@@ -469,7 +517,7 @@ find_white(unsigned char *buf,int npix, int *left, int *right)
return;
/* right side, this is a little trickier */
- for (i = 0; (i < extra) && !(buf[bytes] & (1 << (i + 8 - extra))); i++)
+ for (i = 0; (i < extra) && !(buff[bytes] & (1 << (i + 8 - extra))); i++)
;
if (i < extra)
{
@@ -478,32 +526,32 @@ find_white(unsigned char *buf,int npix, int *left, int *right)
}
*right = extra; /*temporarily store right in bits to avoid rounding error*/
- for (i = 0; (i < bytes % sizeof(long)) && !(buf[bytes - 1 - i]); i++)
+ for (i = 0; (i < bytes % sizeof(int)) && !(buff[bytes - 1 - i]); i++)
;
- if (i < bytes % sizeof(long))
+ if (i < bytes % sizeof(int))
{
- for (j = 0; (j < 8) && !(buf[bytes - 1 - i] & (1 << j)); j++)
+ for (j = 0; (j < 8) && !(buff[bytes - 1 - i] & (1 << j)); j++)
;
*right = (*right + i * 8 + j) / pstate.bpp;
return;
}
*right += i * 8;
- for (i = 0; (i < words) && !(((int *)buf)[words - 1 - i]); i++)
+ for (i = 0; (i < words) && !(((int *)buff)[words - 1 - i]); i++)
;
if (i < words)
{
- *right += i * sizeof(long) * 8;
+ *right += i * sizeof(int) * 8;
for (j = 0;
- (j < sizeof(long)) && !(buf[(words - i) * sizeof(long) - 1 - j]);
+ (j < sizeof(int)) && !(buff[(words - i) * sizeof(int) - 1 - j]);
j++)
;
- if (j < sizeof(long))
+ if (j < sizeof(int))
{
*right += j * 8;
- max = (words - i) * sizeof(long) - 1 - j;
- for (j = 0; (j < 8) && !(buf[max] & (1 << j)); j++)
+ max = (words - i) * sizeof(int) - 1 - j;
+ for (j = 0; (j < 8) && !(buff[max] & (1 << j)); j++)
;
if (j < 8)
{
@@ -516,8 +564,8 @@ find_white(unsigned char *buf,int npix, int *left, int *right)
}
int
-update_page(unsigned char *buf, /* I - pixel data */
- int bufsize, /* I - size of buf in bytes */
+update_page(unsigned char *buff, /* I - pixel data */
+ int buffsize, /* I - size of buff in bytes */
int m, /* I - height of area in pixels */
int n, /* I - width of area in pixels */
int color, /* I - color of pixel data */
@@ -552,10 +600,11 @@ update_page(unsigned char *buf, /* I - pixel data */
* have unpredictable results. But, that's a pretty acurate statement
* for a real printer, too!
*/
- page = (line_type **) xcalloc(pstate.bottom_margin - pstate.top_margin,
- sizeof(line_type *));
+ page = (line_type **)
+ stp_zalloc((pstate.bottom_margin - pstate.top_margin) *
+ sizeof(line_type *));
}
- if (pstate.interleave)
+ if (pstate.printer_weave)
sep = 1;
else
sep = pstate.nozzle_separation;
@@ -568,13 +617,13 @@ update_page(unsigned char *buf, /* I - pixel data */
pstate.bottom_margin, y);
return(1);
}
- find_white(buf + mi * ((n * pstate.bpp + 7) / 8), n,
+ find_white(buff + mi * ((n * pstate.bpp + 7) / 8), n,
&left_white, &right_white);
if (left_white == n)
continue; /* ignore blank lines */
if (!(page[y]))
{
- page[y] = (line_type *) xcalloc(sizeof(line_type), 1);
+ page[y] = (line_type *) stp_zalloc(sizeof(line_type));
if (y < pstate.top_edge)
pstate.top_edge = y;
if (y > pstate.bottom_edge)
@@ -604,8 +653,8 @@ update_page(unsigned char *buf, /* I - pixel data */
pstate.right_edge = page[y]->stopx[color];
width = page[y]->stopx[color] - page[y]->startx[color];
page[y]->line[color] =
- xcalloc(((width * skip + 1) * pstate.bpp + 7) / 8, 1);
- expand_line(buf + mi * ((n * pstate.bpp + 7) / 8), page[y]->line[color],
+ stp_zalloc(((width * skip + 1) * pstate.bpp + 7) / 8);
+ expand_line(buff + mi * ((n * pstate.bpp + 7) / 8), page[y]->line[color],
width+1, skip, left_white);
if (oldline)
merge_line(page[y], oldline, oldstart, oldstop, color);
@@ -726,7 +775,7 @@ parse_escp2_data(FILE *fp_r)
bandsize = m * ((n * pstate.bpp + 7) / 8);
if (valid_bufsize < bandsize)
{
- buf = realloc(buf, bandsize);
+ buf = stp_realloc(buf, bandsize);
valid_bufsize = bandsize;
}
switch (c)
@@ -815,7 +864,9 @@ parse_escp2_extended(FILE *fp_r)
}
else
{
+/*
fprintf(stderr,"Warning! Commands in unrecognised remote mode %s ignored.\n", buf);
+*/
do
{
while((!eject) && (ch!=0x1b))
@@ -827,7 +878,7 @@ parse_escp2_extended(FILE *fp_r)
break;
case 'G': /* select graphics mode */
/* FIXME: this is supposed to have more side effects */
- pstate.interleave = 0;
+ pstate.printer_weave = 0;
pstate.dotsize = 0;
pstate.bpp = 1;
break;
@@ -864,11 +915,11 @@ parse_escp2_extended(FILE *fp_r)
break;
}
break;
- case 'i': /* set Interleave mode */
+ case 'i': /* set printer weave mode */
if (bufsize != 1)
- fprintf(stderr,"Malformed interleave setting command.\n");
+ fprintf(stderr,"Malformed printer weave setting command.\n");
else
- pstate.interleave = buf[0] % 0x30;
+ pstate.printer_weave = buf[0] % 0x30;
break;
case 'e': /* set dot size */
if ((bufsize != 2) || (buf[0] != 0))
@@ -910,14 +961,15 @@ parse_escp2_extended(FILE *fp_r)
pstate.yposition = 0;
if (pstate.top_margin + pstate.bottom_margin > pstate.page_height)
pstate.page_height = pstate.top_margin + pstate.bottom_margin;
- page = (line_type **) xcalloc(pstate.bottom_margin - pstate.top_margin,
- sizeof(line_type *));
fprintf(stderr, "Setting top margin to %d (%.3f)\n",
pstate.top_margin,
(double) pstate.top_margin / pstate.page_management_units);
fprintf(stderr, "Setting bottom margin to %d (%.3f)\n",
pstate.bottom_margin,
(double) pstate.bottom_margin / pstate.page_management_units);
+ page = (line_type **)
+ stp_zalloc((pstate.bottom_margin - pstate.top_margin) *
+ sizeof(line_type *));
break;
case 'V': /* set absolute vertical position */
i = 0;
@@ -1101,7 +1153,7 @@ parse_escp2_command(FILE *fp_r)
else
{
pstate.unidirectional = 0;
- pstate.interleave = 0;
+ pstate.printer_weave = 0;
pstate.dotsize = 0;
pstate.bpp = 1;
pstate.page_management_units = 360;
@@ -1146,6 +1198,9 @@ parse_escp2_command(FILE *fp_r)
pstate.xposition = sh * (pstate.relative_horizontal_units /
pstate.absolute_horizontal_units);
break;
+ case 0x0: /* Exit remote mode */
+ get2("Error exiting remote mode.\n");
+ break;
case 0x6: /* flush buffers */
/* Woosh. Consider them flushed. */
break;
@@ -1204,15 +1259,15 @@ parse_escp2(FILE *fp_r)
* reverse the bit order in an array of bytes - does not reverse byte order!
*/
void
-reverse_bit_order(unsigned char *buf, int n)
+reverse_bit_order(unsigned char *buff, int n)
{
int i;
unsigned char a;
if (!n) return; /* nothing to do */
for (i= 0; i<n; i++) {
- a= buf[i];
- buf[i]=
+ a= buff[i];
+ buff[i]=
(a & 0x01) << 7 |
(a & 0x02) << 5 |
(a & 0x04) << 3 |
@@ -1284,7 +1339,7 @@ parse_canon(FILE *fp_r)
{
int m=0;
- int currentcolor,currentbpp,density,eject;
+ int currentcolor,currentbpp,density,l_eject;
int cmdcounter;
int delay_c=0, delay_m=0, delay_y=0, delay_C=0,
delay_M=0, delay_Y=0, delay_K=0, currentdelay=0;
@@ -1292,8 +1347,8 @@ parse_canon(FILE *fp_r)
global_counter=0;
page= 0;
- eject=pstate.got_graphics=currentbpp=currentcolor=density=0;
- while ((!eject)&&(fread(&ch,1,1,fp_r))){
+ l_eject=pstate.got_graphics=currentbpp=currentcolor=density=0;
+ while ((!l_eject)&&(fread(&ch,1,1,fp_r))){
global_counter++;
if (ch==0xd) { /* carriage return */
pstate.xposition=0;
@@ -1303,7 +1358,7 @@ parse_canon(FILE *fp_r)
continue;
}
if (ch==0xc) { /* form feed */
- eject=1;
+ l_eject=1;
continue;
}
if (ch=='B') {
@@ -1338,15 +1393,15 @@ parse_canon(FILE *fp_r)
if (ch=='K') /* 0x4b */ {
if (sh!=2 || buf[0]!=0x00 ) {
fprintf(stderr,"Error initializing printer with ESC [ K\n");
- eject=1;
+ l_eject=1;
continue;
}
if (page) {
- eject=1;
+ l_eject=1;
continue;
} else {
pstate.unidirectional=0;
- pstate.interleave=0;
+ pstate.printer_weave=0;
pstate.dotsize=0;
pstate.bpp=1;
pstate.page_management_units=360;
@@ -1373,7 +1428,7 @@ parse_canon(FILE *fp_r)
break;
case '@': /* 0x40 */
- eject=1;
+ l_eject=1;
break;
case '(': /* 0x28 */
@@ -1442,7 +1497,8 @@ parse_canon(FILE *fp_r)
pstate.relative_horizontal_units,
pstate.relative_vertical_units);
- page=(line_type **)xcalloc(pstate.bottom_margin,sizeof(line_type *));
+ page= (line_type **) stp_zalloc(pstate.bottom_margin *
+ sizeof(line_type *));
break;
case 'e': /* 0x65 - vertical head movement */
pstate.yposition+= (buf[1]+256*buf[0]);
@@ -1496,6 +1552,7 @@ main(int argc,char *argv[])
FILE *fp_r, *fp_w;
int force_extraskip = -1;
int no_output = 0;
+ int all_black = 0;
unweave = 0;
pstate.nozzle_separation = 6;
@@ -1512,6 +1569,29 @@ main(int argc,char *argv[])
else
fp_r = stdin;
break;
+ case 'm':
+ if (argv[arg][2])
+ {
+ s = argv[arg] + 2;
+ }
+ else
+ {
+ if (argc <= arg + 1)
+ {
+ fprintf(stderr, "Missing color mask\n");
+ exit(-1);
+ }
+ else
+ {
+ s = argv[++arg];
+ }
+ }
+ if (!sscanf(s, "%x", &color_mask))
+ {
+ fprintf(stderr,"Error parsing mask\n");
+ exit(-1);
+ }
+ break;
case 'n':
if (argv[arg][2])
{
@@ -1558,6 +1638,9 @@ main(int argc,char *argv[])
exit(-1);
}
break;
+ case 'b':
+ all_black = 1;
+ break;
case 'q':
no_output = 1;
break;
@@ -1598,7 +1681,7 @@ main(int argc,char *argv[])
pstate.nozzle_separation = 1;
}
pstate.nozzles = 96;
- buf = malloc(256 * 256);
+ buf = stp_malloc(256 * 256);
valid_bufsize = 256 * 256;
UNPRINT = getenv("UNPRINT");
@@ -1619,7 +1702,7 @@ main(int argc,char *argv[])
parse_escp2(fp_r);
}
fprintf(stderr,"Done reading.\n");
- write_output(fp_w, no_output);
+ write_output(fp_w, no_output, all_black);
fclose(fp_w);
fprintf(stderr,"Image dump complete.\n");
diff --git a/test/xml-curve.c b/test/xml-curve.c
new file mode 100644
index 0000000..f896971
--- /dev/null
+++ b/test/xml-curve.c
@@ -0,0 +1,71 @@
+/*
+ * "$Id: xml-curve.c,v 1.6 2004/09/17 18:38:28 rleigh Exp $"
+ *
+ * Copyright 2002 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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <gutenprint/gutenprint.h>
+
+int main(int argc, char *argv[])
+{
+ stp_curve_t *curve;
+
+ if (argc != 2)
+ {
+ fprintf(stderr, "Usage: %s filename.xml\n", argv[0]);
+ return 1;
+ }
+
+ stp_init();
+
+#ifdef DEBUG
+ fprintf(stderr, "stp-xml-parse: reading `%s'...\n", file);
+#endif
+
+ fprintf(stderr, "Using file: %s\n", argv[1]);
+ curve = stp_curve_create_from_file(argv[1]);
+
+ if (curve)
+ {
+ char *output;
+ if ((stp_curve_write(stdout, curve)) == 0)
+ fprintf(stderr, "curve successfully created\n");
+ else
+ fprintf(stderr, "error creating curve\n");
+ output = stp_curve_write_string(curve);
+ if (output)
+ {
+ fprintf(stderr, "%s", output);
+ fprintf(stderr, "curve string successfully created\n");
+ free(output);
+ }
+ else
+ fprintf(stderr, "error creating curve string\n");
+ stp_curve_destroy(curve);
+ }
+ else
+ printf("curve is NULL!\n");
+
+ return 0;
+}