diff options
author | Roger Leigh <rleigh@debian.org> | 2008-10-26 16:11:41 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2008-10-26 16:11:41 +0000 |
commit | dfae5860833782af557deb35e286d7e186fe3cf5 (patch) | |
tree | e3b4282ae08e120f78cd0c097f7cb3b570e94da2 /src/testpattern | |
parent | 3b59bb0a607ec27ea60f07d1cd5d1bbb4483c832 (diff) |
Imported Upstream version 4.3.99+cvs20050702
Diffstat (limited to 'src/testpattern')
-rw-r--r-- | src/testpattern/Makefile.am | 42 | ||||
-rw-r--r-- | src/testpattern/Makefile.in | 940 | ||||
-rw-r--r-- | src/testpattern/extended.sample | 117 | ||||
-rw-r--r-- | src/testpattern/printers.c | 44 | ||||
-rwxr-xr-x | src/testpattern/run-testpattern | 169 | ||||
-rwxr-xr-x | src/testpattern/run-testpattern-1 | 286 | ||||
-rw-r--r-- | src/testpattern/testpattern.c | 1087 | ||||
-rw-r--r-- | src/testpattern/testpattern.h | 78 | ||||
-rw-r--r-- | src/testpattern/testpattern.sample | 153 | ||||
-rw-r--r-- | src/testpattern/testpatternl.c | 1925 | ||||
-rw-r--r-- | src/testpattern/testpatternl.l | 114 | ||||
-rw-r--r-- | src/testpattern/testpatterny.c | 2481 | ||||
-rw-r--r-- | src/testpattern/testpatterny.h | 163 | ||||
-rw-r--r-- | src/testpattern/testpatterny.y | 593 |
14 files changed, 5589 insertions, 2603 deletions
diff --git a/src/testpattern/Makefile.am b/src/testpattern/Makefile.am index addd64c..8733129 100644 --- a/src/testpattern/Makefile.am +++ b/src/testpattern/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.5.4.3 2002/06/05 23:52:05 rlk Exp $ +## $Id: Makefile.am,v 1.22 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,45 +23,43 @@ AUTOMAKE_OPTIONS = 1.4 gnu MAINT_CHARSET = latin1 +include $(top_srcdir)/scripts/global.mk + ## Variables -AM_CFLAGS = $(GNUCFLAGS) -INCLUDES = @INCLUDES@ $(LIBGIMPPRINT_CFLAGS) -LIBPRINTUT = $(top_builddir)/lib/libprintut.la -LIBS = @LIBS@ $(INTLLIBS) +pkgdatadir = $(datadir)/$(PACKAGE)/samples -## Programs +TESTS = run-testpattern run-testpattern-1 -TESTPATTERN_BIN = testpattern -bin_PROGRAMS = @TESTPATTERN_BIN@ +## Programs -EXTRA_PROGRAMS = testpattern +if BUILD_TESTPATTERN +bin_PROGRAMS = testpattern +noinst_PROGRAMS = printers +endif -LFLAGS = -i -YFLAGS = -d +AM_LFLAGS = -i +AM_YFLAGS = -d testpattern_SOURCES = testpattern.c testpatterny.y testpatternl.l testpattern.h -testpattern_LDADD = $(LIBPRINTUT) $(LIBGIMPPRINT_LIBS) -testpattern_DEPENDENCIES = $(LIBGIMPPRINT_LIBS) +testpattern_LDADD = $(GUTENPRINT_LIBS) testpatternl.o: testpatterny.o testpattern.o: testpatterny.o -$(LIBGIMPPRINT_LIBS): - cd ../main ; \ - $(MAKE) +printers_LDADD = $(GUTENPRINT_LIBS) -SAMPLE_IMAGES = testpattern.sample -pkgdatadir = $(datadir)/$(PACKAGE)/samples +## Data + +pkgdata_DATA = testpattern.sample extended.sample -pkgdata_DATA = @SAMPLE_IMAGES@ ## Clean -MAINTAINERCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in testpatternl.c testpatterny.c testpatterny.h + +EXTRA_DIST = testpatterny.h $(pkgdata_DATA) run-testpattern run-testpattern-1 -DISTCLEANFILES = testpatternl.c testpatterny.c testpatterny.h -EXTRA_DIST = testpatterny.h testpattern.sample diff --git a/src/testpattern/Makefile.in b/src/testpattern/Makefile.in index b0193ed..856b313 100644 --- a/src/testpattern/Makefile.in +++ b/src/testpattern/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,492 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +@SET_MAKE@ -SHELL = @SHELL@ +# Variables + + +SOURCES = printers.c $(testpattern_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 = 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 testpatternl.c testpatterny.c \ + testpatterny.h +@BUILD_TESTPATTERN_TRUE@bin_PROGRAMS = testpattern$(EXEEXT) +@BUILD_TESTPATTERN_TRUE@noinst_PROGRAMS = printers$(EXEEXT) +subdir = src/testpattern +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gimp.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/stp.m4 $(top_srcdir)/m4/stp_cups.m4 \ + $(top_srcdir)/m4/stp_gimp.m4 $(top_srcdir)/m4/stp_option.m4 \ + $(top_srcdir)/m4/stp_release.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgdatadir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +printers_SOURCES = printers.c +printers_OBJECTS = printers.$(OBJEXT) +am__DEPENDENCIES_1 = $(top_builddir)/src/main/libgutenprint.la +printers_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_testpattern_OBJECTS = testpattern.$(OBJEXT) testpatterny.$(OBJEXT) \ + testpatternl.$(OBJEXT) +testpattern_OBJECTS = $(am_testpattern_OBJECTS) +testpattern_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 $@ +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +LTLEXCOMPILE = $(LIBTOOL) --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS) +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \ + $(AM_YFLAGS) +SOURCES = printers.c $(testpattern_SOURCES) +DIST_SOURCES = printers.c $(testpattern_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +pkgdataDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pkgdata_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkgdatadir = $(datadir)/$(PACKAGE)/samples +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@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ -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) -LIBPRINTUT = $(top_builddir)/lib/libprintut.la -LIBS = @LIBS@ $(INTLLIBS) - -TESTPATTERN_BIN = testpattern - -bin_PROGRAMS = @TESTPATTERN_BIN@ - -EXTRA_PROGRAMS = testpattern - -LFLAGS = -i -YFLAGS = -d - +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) +TESTS = run-testpattern run-testpattern-1 +AM_LFLAGS = -i +AM_YFLAGS = -d testpattern_SOURCES = testpattern.c testpatterny.y testpatternl.l testpattern.h -testpattern_LDADD = $(LIBPRINTUT) $(LIBGIMPPRINT_LIBS) -testpattern_DEPENDENCIES = $(LIBGIMPPRINT_LIBS) - -SAMPLE_IMAGES = testpattern.sample - -pkgdatadir = $(datadir)/$(PACKAGE)/samples - -pkgdata_DATA = @SAMPLE_IMAGES@ - -MAINTAINERCLEANFILES = Makefile.in +testpattern_LDADD = $(GUTENPRINT_LIBS) +printers_LDADD = $(GUTENPRINT_LIBS) +pkgdata_DATA = testpattern.sample extended.sample +MAINTAINERCLEANFILES = Makefile.in testpatternl.c testpatterny.c testpatterny.h +EXTRA_DIST = testpatterny.h $(pkgdata_DATA) run-testpattern run-testpattern-1 +all: all-am -DISTCLEANFILES = testpatternl.c testpatterny.c testpatterny.h -EXTRA_DIST = testpatterny.h testpattern.sample -mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs -CONFIG_HEADER = ../../config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = @TESTPATTERN_BIN@ -PROGRAMS = $(bin_PROGRAMS) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I../.. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -testpattern_OBJECTS = testpattern.$(OBJEXT) testpatterny.$(OBJEXT) \ -testpatternl.$(OBJEXT) -testpattern_LDFLAGS = -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LEXLIB = @LEXLIB@ -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 $@ -DATA = $(pkgdata_DATA) - -DIST_COMMON = Makefile.am Makefile.in testpatternl.c testpatterny.c - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(testpattern_SOURCES) -OBJECTS = $(testpattern_OBJECTS) - -all: all-redirect .SUFFIXES: -.SUFFIXES: .S .c .l .lo .o .obj .s .y -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/testpattern/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -distclean-binPROGRAMS: - -maintainer-clean-binPROGRAMS: - +.SUFFIXES: .c .l .lo .o .obj .y +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/scripts/global.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testpattern/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/testpattern/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) - list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done -.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 $< +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done -.S.o: - $(COMPILE) -c $< +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +printers$(EXEEXT): $(printers_OBJECTS) $(printers_DEPENDENCIES) + @rm -f printers$(EXEEXT) + $(LINK) $(printers_LDFLAGS) $(printers_OBJECTS) $(printers_LDADD) $(LIBS) +testpatterny.h: testpatterny.c + @if test ! -f $@; then \ + rm -f testpatterny.c; \ + $(MAKE) testpatterny.c; \ + else :; fi +testpattern$(EXEEXT): $(testpattern_OBJECTS) $(testpattern_DEPENDENCIES) + @rm -f testpattern$(EXEEXT) + $(LINK) $(testpattern_LDFLAGS) $(testpattern_OBJECTS) $(testpattern_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)/printers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testpattern.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testpatternl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testpatterny.Po@am__quote@ + +.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 $< + +.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) '$<'` .c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +@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 $@ $< -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +.l.c: + $(LEXCOMPILE) $< + sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@ + rm -f $(LEX_OUTPUT_ROOT).c -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +.y.c: + $(YACCCOMPILE) $< + if test -f y.tab.h; then \ + to=`echo "$*_H" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \ + sed -e "/^#/!b" -e "s/Y_TAB_H/$$to/g" -e "s|y\.tab\.h|$*.h|" \ + y.tab.h >$*.ht; \ + rm -f y.tab.h; \ + if cmp -s $*.ht $*.h; then \ + rm -f $*.ht ;\ + else \ + mv $*.ht $*.h; \ + fi; \ + fi + if test -f y.output; then \ + mv y.output $*.output; \ + fi + sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@ + rm -f y.tab.c mostlyclean-libtool: -rm -f *.lo @@ -324,183 +506,299 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: - -maintainer-clean-libtool: - -testpattern$(EXEEXT): $(testpattern_OBJECTS) $(testpattern_DEPENDENCIES) - @rm -f testpattern$(EXEEXT) - $(LINK) $(testpattern_LDFLAGS) $(testpattern_OBJECTS) $(testpattern_LDADD) $(LIBS) -.l.c: - $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ -.y.c: - $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c - if test -f y.tab.h; then \ - if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ - else :; fi -testpatterny.h: testpatterny.c - - + -rm -f libtool +uninstall-info-am: install-pkgdataDATA: $(pkgdata_DATA) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) + test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)" @list='$(pkgdata_DATA)'; for p in $$list; do \ - if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p"; \ - $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p; \ - else if test -f $$p; then \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p; \ - fi; fi; \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \ + $(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \ done uninstall-pkgdataDATA: @$(NORMAL_UNINSTALL) - list='$(pkgdata_DATA)'; for p in $$list; do \ - rm -f $(DESTDIR)$(pkgdatadir)/$$p; \ + @list='$(pkgdata_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique tags: TAGS -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 - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = src/testpattern + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +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 -printers.o: printers.c ../../config.h \ - ../../include/gimp-print/gimp-print.h ../../lib/libprintut.h \ - ../../lib/xmalloc.h -testpattern.o: testpattern.c ../../config.h \ - ../../include/gimp-print/gimp-print.h testpattern.h \ - testpatterny.h -testpatternl.o: testpatternl.c ../../config.h testpattern.h \ - testpatterny.h -testpatterny.o: testpatterny.c ../../config.h testpattern.h \ - testpatterny.h - -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: install-binPROGRAMS +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgdatadir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am install-exec: install-exec-am - -install-data-am: install-pkgdataDATA 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-binPROGRAMS uninstall-pkgdataDATA -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir) - +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: - -test -z "testpatternlltestpatternyhtestpatternyc$(MAINTAINERCLEANFILES)" || rm -f testpatternll testpatternyh testpatternyc $(MAINTAINERCLEANFILES) -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-libtool mostlyclean-tags \ - mostlyclean-generic + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f testpatternl.c + -rm -f testpatterny.c + -rm -f testpatterny.h + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am -clean-am: clean-binPROGRAMS 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-binPROGRAMS 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-binPROGRAMS \ - 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-pkgdataDATA + +install-exec-am: install-binPROGRAMS + +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 + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool uninstall-pkgdataDATA \ -install-pkgdataDATA tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir 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 +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ + uninstall-pkgdataDATA + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-binPROGRAMS 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-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-pkgdataDATA 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-binPROGRAMS uninstall-info-am \ + uninstall-pkgdataDATA @SET_MAKE@ -testpatternl.o: testpatterny.o -testpattern.o: testpatterny.o +export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main +export STP_DATA_PATH = $(top_srcdir)/src/main + +# Rules -$(LIBGIMPPRINT_LIBS): - cd ../main ; \ +$(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) + +testpatternl.o: testpatterny.o +testpattern.o: testpatterny.o # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/src/testpattern/extended.sample b/src/testpattern/extended.sample new file mode 100644 index 0000000..8e9d0be --- /dev/null +++ b/src/testpattern/extended.sample @@ -0,0 +1,117 @@ +# Sample test pattern file, for use with Gimp-Print test pattern generator + +# Printer/driver settings. Please see src/ghost/README for appropriate +# values for each of these settings +# Printer model +printer escp2-2200; +mode extended 7; +# Resolution, or print quality +parameter Resolution 720sw; +# Media source (if appropriate for your printer) +#parameter InputSlot Standard; +# Media type (what kind of paper) +parameter MediaType Plain; +# ink_type +parameter InkType "CMYK"; +# Paper size +parameter PageSize Letter; +# Dither algorithm +parameter DitherAlgorithm Adaptive; + +# Note that due to limitations in the lexical analyzer and parser, all +# floating point values must be specified with a decimal point. + +# Placement settings +# Horizontal size, as fraction of paper width (defaults to 1.0) +hsize 0.08; +# Vertical size, as fraction of paper width (defaults to 1.0) +vsize 0.08; +# Left margin, as fraction of paper width (defaults to 0) +left 0.0; +# Top margin, as fraction of paper width (defaults to 0) +top 0.0; + +# Output settings +# These settings are used as the base values for all ramps. These settings +# are multiplied by the appropriate values in each pattern definition +# to compute the effective gamma and conversion values. All of these +# default to 1.0. +# Gamma value applied to all inks +gamma 2.0; +# Additional gamma correction applied to cyan, magenta, yellow, and black inks +gamma cyan 1.0; +gamma l_cyan 1.0; +gamma magenta 1.0; +gamma l_magenta 1.0; +gamma yellow 1.0; +gamma d_yellow 1.0; +gamma black 1.0; +# Amount of each ink that should be used when black is converted to CMY. +# These values must be greater than 0 and must not exceed 10. +level cyan 1.0; +level magenta 1.0; +level yellow 1.0; + +# Maximum amount of ink that will be printed, relative to solid coverage. +# 1.0 means that every dot position that can be printed will be. Normally +# at high resolutions less ink should be printed. This is similar to +# density in normal RGB mode, but does not affect photo ink conversion. +ink_limit 1.0; + +# Density. Unlike normal RGB mode, the CMYK16 input mode used by the +# test pattern generator does not automatically scale the amount of ink +# used by the resolution and paper type (see ink_limit above). The test +# driver separates the functions of ink limiting and photo ink conversion +# to allow maximum control over the output. +density 1.0; + +# Do we want a thin black line between each band? (default yes) +blackline 1; + +# Number of steps in each ramp (default 256) +steps 256; + +# 0) White band +pattern 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ; +# 1) C sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ; +# 2) M sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +# 3) Y sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; +# 4) K sweep +xpattern 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +# 5) c sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +# 6) m sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; +# 7) k sweep +xpattern 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +# 8) CM (blue) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +# 9) CY (green) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +# 10) MY (red) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +# 11) cY (yellow-green) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +# 12) cY (light green) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +# 13) mY (orange) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; +# 14) mY (light red) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0; +# 15) cm (light blue) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0; +# 16) CMY (gray) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.33 1.0 0.0 0.0 1.0 0.0 0.33 1.0 0.0 0.0 1.0 0.0 0.33 1.0; +# 17) cmY sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.33 1.0 0.0 0.0 1.0 0.0 0.33 1.0 0.0 0.33 1.0; +# 18) cmY (light gray) sweep +xpattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.43 1.0 0.0 0.0 1.0 0.0 0.43 1.0 0.0 0.14 1.0; +# 19) CMYK sweep +xpattern 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +# 20) cmYk sweep +xpattern 0.0 0.0 1.0 0.0 0.29 1.0 0.0 0.0 1.0 0.0 0.29 1.0 0.0 0.0 1.0 0.0 0.29 1.0 0.0 0.14 1.0; +# 21) cmYK sweep +xpattern 0.0 0.125 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.375 1.0 0.0 0.0 1.0 0.0 0.375 1.0 0.0 0.125 1.0; diff --git a/src/testpattern/printers.c b/src/testpattern/printers.c new file mode 100644 index 0000000..d9c5286 --- /dev/null +++ b/src/testpattern/printers.c @@ -0,0 +1,44 @@ +/* + * "$Id: printers.c,v 1.6 2004/09/17 18:38:27 rleigh Exp $" + * + * Dump the per-printer options for Grant Taylor's *-omatic database + * + * Copyright 2000 Robert Krawitz (rlk@alum.mit.edu) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <stdio.h> +#include <gutenprint/gutenprint.h> +#include <string.h> + +int +main(int argc, char **argv) +{ + int i; + + stp_init(); + for (i = 0; i < stp_printer_model_count(); i++) + { + const stp_printer_t *p = stp_get_printer_by_index(i); + if (strcmp(stp_printer_get_family(p), "ps") && + strcmp(stp_printer_get_family(p), "raw")) + printf("%s\n", stp_printer_get_driver(p)); + } + return 0; +} diff --git a/src/testpattern/run-testpattern b/src/testpattern/run-testpattern new file mode 100755 index 0000000..eea5754 --- /dev/null +++ b/src/testpattern/run-testpattern @@ -0,0 +1,169 @@ +#!/bin/sh + +retval=0; + +if [ -z "$STP_DATA_PATH" ] ; then + STP_DATA_PATH=`pwd`/../main + export STP_DATA_PATH +fi + +if [ -z "$STP_MODULE_PATH" ] ; then + STP_MODULE_PATH=`pwd`/../main:`pwd`/../main/.libs + export STP_MODULE_PATH +fi + +valgrind=0 +valopts='' +extra='' +dontrun= + +set_opt() { + opt=`echo $1 | awk -F= '{print $1}'` + val=`echo $1 | awk -F= '{print $2}'` + extra="`printf '%s\nparameter \"%s\" \"%s\";' \"$extra\" $opt $val`" +} + +set_message() { + the_message="`printf '%s\nmessage \"%s\";' \"$the_message\" \"$@\"`" +} + +usage() { + echo "Usage: run-testpattern [-v|--valgrind]" + echo " [-p|--parameter parameter=value]" + echo " [-n|--dontrun]" + echo " [--] [printers...]" + exit 0; +} + +set_args() { + while true ; do + case "$1" in + -h*|--h*) usage ;; + -v|--valgrind) valopts='--tool=memcheck' ; valgrind=`expr $valgrind + 1` ;; + -c|--cachegrind) valopts='--tool=cachegrind'; valgrind=4 ;; + -g|--gdb-attach) valopts='--gdb-attach=yes' ;; + -p|--parameter) shift; set_opt "$1" ;; + -n|--dontrun) dontrun=1 ;; + --) shift; args="$@"; return ;; + *) return ;; + esac + shift + done +} + +print_one_testpattern() { + printer=$1 + shift + stuff="$@" + cat <<EOF +printer "$printer"; +$stuff +hsize 0.1; +vsize 0.1; +left 0.15; +top 0.15; +blackline 0; +steps 16; +mode rgb 8; +pattern 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.3 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.7 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.5 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.3 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.7 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.5 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; +end; +EOF +} + +run_testpattern() { + case "$valgrind" in + 1) valgrind $valopts -q --num-callers=100 --leak-check=yes ./testpattern -n ;; + 2) valgrind $valopts --num-callers=100 --show-reachable=yes --leak-resolution=high --leak-check=yes ./testpattern -n ;; + 3) valgrind $valopts --error-limit=no --num-callers=100 --show-reachable=yes --leak-resolution=high --leak-check=yes ./testpattern -n ;; + 4) valgrind $valopts ./testpattern -n ;; + *) ./testpattern -n ;; + esac + if [ $? -ne 0 ] ; then + retval=1 + fi +} + +set_args `getopt hgvp:nc "$@"` + +if [ -z "$args" ] ; then + args=`./printers` +fi + +#StandardDithers="EvenTone HybridEvenTone UniTone HybridUniTone Adaptive Ordered Fast VeryFast Floyd Predithered" + +StandardDithers="EvenTone HybridEvenTone Adaptive Ordered Fast VeryFast Floyd Predithered" + +the_message='' + +print_all_testpatterns() { + if [ -z "`echo $extra |grep DitherAlgorithm`" ] ; then + for p in $args ; do + set_message "$p +" + for d in $StandardDithers ; do + set_message " $d" + print_one_testpattern "$p" "`printf '%s\n' \"parameter \\\"DitherAlgorithm\\\" \\\"$d\\\";\"`" "$extra" "$the_message" + the_message='' + done + done + else + for p in $args ; do + the_message='' + set_message "$p" + print_one_testpattern "$p" "$extra" "$the_message" + done + fi +} + +if [ -z "$dontrun" ] ; then + print_all_testpatterns | run_testpattern +else + print_all_testpatterns +fi + +exit $? diff --git a/src/testpattern/run-testpattern-1 b/src/testpattern/run-testpattern-1 new file mode 100755 index 0000000..ee3af8c --- /dev/null +++ b/src/testpattern/run-testpattern-1 @@ -0,0 +1,286 @@ +#!/bin/sh + +retval=0; + +if [ -z "$STP_DATA_PATH" ] ; then + STP_DATA_PATH=`pwd`/../main + export STP_DATA_PATH +fi + +if [ -z "$STP_MODULE_PATH" ] ; then + STP_MODULE_PATH=`pwd`/../main:`pwd`/../main/.libs + export STP_MODULE_PATH +fi + +valgrind=0 +valopts='' +extra='' +dontrun= + +set_opt() { + opt=`echo $1 | awk -F= '{print $1}'` + val=`echo $1 | awk -F= '{print $2}'` + extra="`printf '%s\nparameter \"%s\" \"%s\";' \"$extra\" $opt $val`" +} + +set_message() { + the_message="`printf '%s\nmessage \"%s\";' \"$the_message\" \"$@\"`" +} + +usage() { + echo "Usage: run-testpattern [-v|--valgrind]" + echo " [-p|--parameter parameter=value]" + echo " [-n|--dontrun]" + echo " [--] [printers...]" + exit 0; +} + +print_command=cat + +set_args() { + while true ; do + case "$1" in + -h*|--h*) usage ;; + -v|--valgrind) valopts='--tool=memcheck' ; valgrind=`expr $valgrind + 1` ;; + -c|--cachegrind) valopts='--skin=cachegrind'; valgrind=4 ;; + -g|--gdb-attach) valopts='--gdb-attach=yes' ;; + -p|--parameter) shift; set_opt "$1" ;; + -n|--dontrun) dontrun=1 ;; + -o|--one) print_command=run_testpattern; dontrun=1 ;; + --) shift; args="$@"; return ;; + *) return ;; + esac + shift + done +} + +print_one_testpattern() { + printer=$1 + mode=$2 + bits=$3 + inktype=$4 + correction=$5 + printingmode=$6 + shift + shift + shift + shift + shift + shift + stuff="$@" + cat <<EOF +printer "$printer"; +$stuff +parameter "InkType" "$inktype"; +parameter "ColorCorrection" "$correction"; +parameter "PrintingMode" "$printingmode"; +parameter "DitherAlgorithm" "VeryFast"; +hsize 0.1; +vsize 0.1; +left 0.15; +top 0.15; +blackline 0; +steps 16; +mode $mode $bits; +pattern 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.3 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.7 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.5 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.3 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.7 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.5 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; +end; +EOF +} + +print_one_raw_testpattern() { + printer=$1 + mode=$2 + bits=$3 + inktype=$4 + correction=$5 + printingmode=$6 + shift + shift + shift + shift + shift + shift + stuff="$@" + cat <<EOF +printer "$printer"; +$stuff +parameter "InkType" "$inktype"; +parameter "ColorCorrection" "$correction"; +parameter "PrintingMode" "$printingmode"; +page_size 256 256; +blackline 0; +steps 256; +mode $mode $bits; +pattern 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.3 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.7 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.5 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.3 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.7 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.1 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.3 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 0.5 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; +end; +EOF +} + +run_testpattern() { + case "$valgrind" in + 1) valgrind $valopts -q --num-callers=100 --leak-check=yes ./testpattern -n ;; + 2) valgrind $valopts --num-callers=100 --show-reachable=yes --leak-resolution=high --leak-check=yes ./testpattern -n ;; + 3) valgrind $valopts --error-limit=no --num-callers=100 --show-reachable=yes --leak-resolution=high --leak-check=yes ./testpattern -n ;; + 4) valgrind $valopts ./testpattern -n ;; + 5) LD_PRELOAD=libefence.so.0.0 ./testpattern -n ;; + *) ./testpattern -n ;; + esac + if [ $? -ne 0 ] ; then + retval=1 + fi +} + +set_args `getopt hgvp:nco "$@"` + +if [ -z "$args" ] ; then + args=`./printers` +fi + +StandardBitDepths="8 16" +StandardModes="rgb kcmy cmyk cmy gray white" +StandardColorCorrections="None Density Desaturated Accurate Bright Uncorrected Threshold Raw Predithered" +StandardInkTypes="CMYKRB CMYK RGB" +StandardPrintingModes="BW Color" + +RawBitDepths="8 16" +RawTypes="raw-data-8 raw-data-16" +RawModes="rgb kcmy cmyk cmy gray white" +RawColorCorrections="None Density Desaturated Accurate Bright Uncorrected Threshold Raw Predithered" +RawInkTypes="CMYK RGB CMY KCMY RGBGray CMYGray" +RawPrintingModes="Color BW" + +the_message='' + +print_all_testpatterns() { + for a in $RawPrintingModes ; do + for b in $RawInkTypes ; do + for c in $RawColorCorrections ; do + for d in $RawModes ; do + for e in $RawBitDepths ; do + set_message "$a $b $c $d $e" + print_one_raw_testpattern "raw-data-8" $d $e $b $c $a "$extra" "$the_message" | $print_command + the_message="" + done + done + done + done + done + for a in $StandardPrintingModes ; do + for b in $StandardInkTypes ; do + for c in $StandardColorCorrections ; do + for d in $StandardModes ; do + for e in $StandardBitDepths ; do + set_message "$a $b $c $d $e" + print_one_testpattern "escp2-r800" $d $e $b $c $a "$extra" "$the_message" | $print_command + the_message="" + done + done + done + done + done + for a in $StandardColorCorrections ; do + for b in $StandardBitDepths ; do + set_message "Color extended 8 CMYKRB $a $b" + print_one_testpattern "escp2-r800" "extended 8" $b CMYKRB $a Color "$extra" "$the_message" | $print_command + the_message="" + done + done +} + +if [ -z "$dontrun" ] ; then + (print_all_testpatterns | run_testpattern) +else + (print_all_testpatterns) +fi + +exit $? diff --git a/src/testpattern/testpattern.c b/src/testpattern/testpattern.c index d34821f..2ebb6df 100644 --- a/src/testpattern/testpattern.c +++ b/src/testpattern/testpattern.c @@ -1,5 +1,5 @@ /* - * "$Id: testpattern.c,v 1.6.4.1 2002/07/23 00:54:08 rlk Exp $" + * "$Id: testpattern.c,v 1.42 2004/06/08 02:51:42 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -33,11 +33,6 @@ * black and white). */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gimp-print/gimp-print.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> @@ -48,501 +43,818 @@ extern int yyparse(void); static const char *Image_get_appname(stp_image_t *image); -static void Image_progress_conclude(stp_image_t *image); -static void Image_note_progress(stp_image_t *image, - double current, double total); -static void Image_progress_init(stp_image_t *image); +static void Image_conclude(stp_image_t *image); +static void Image_init(stp_image_t *image); static stp_image_status_t Image_get_row(stp_image_t *image, - unsigned char *data, int row); + unsigned char *data, + size_t byte_limit, int row); static int Image_height(stp_image_t *image); static int Image_width(stp_image_t *image); -static int Image_bpp(stp_image_t *image); -static void Image_init(stp_image_t *image); static stp_image_t theImage = { Image_init, NULL, /* reset */ - NULL, /* transpose */ - NULL, /* hflip */ - NULL, /* vflip */ - NULL, /* crop */ - NULL, /* ccw */ - NULL, /* cw */ - NULL, /* 180 */ - Image_bpp, Image_width, Image_height, Image_get_row, Image_get_appname, - Image_progress_init, - Image_note_progress, - Image_progress_conclude, + Image_conclude, NULL }; +stp_vars_t *global_vars; + +double global_levels[STP_CHANNEL_LIMIT]; +double global_gammas[STP_CHANNEL_LIMIT]; +double global_gamma; +int global_steps; +double global_ink_limit; +int global_noblackline; +int global_printer_width; +int global_printer_height; +int global_band_height; +int global_n_testpatterns; +char *global_printer = NULL; +double global_density; +double global_xtop; +double global_xleft; +double global_hsize; +double global_vsize; +const char *global_image_type; +int global_bit_depth; +int global_channel_depth; +int global_invert_data = 0; +int global_use_raw_cmyk; +int global_did_something; +int global_suppress_output = 0; + +static testpattern_t *static_testpatterns; + +static size_t +c_strlen(const char *s) +{ + return strlen(s); +} -double global_c_level = 1.0; -double global_c_gamma = 1.0; -double global_m_level = 1.0; -double global_m_gamma = 1.0; -double global_y_level = 1.0; -double global_y_gamma = 1.0; -double global_k_gamma = 1.0; -double global_gamma = 1.0; -int levels = 256; -double ink_limit = 1.0; -char *printer = 0; -char *ink_type = 0; -char *resolution = 0; -char *media_source = 0; -char *media_type = 0; -char *media_size = 0; -char *dither_algorithm = 0; -double density = 1.0; -double xtop = 0; -double xleft = 0; -double hsize = 1.0; -double vsize = 1.0; -int noblackline = 0; -int printer_width, printer_height, bandheight; -int n_testpatterns = 0; - -testpattern_t *the_testpatterns = NULL; +static char * +c_strndup(const char *s, int n) +{ + char *ret; + if (!s || n < 0) + { + ret = stp_malloc(1); + ret[0] = 0; + return ret; + } + else + { + ret = stp_malloc(n + 1); + memcpy(ret, s, n); + ret[n] = 0; + return ret; + } +} char * c_strdup(const char *s) { - int l = strlen(s); char *ret; - if (s[0] == '"' && s[l - 1] == '"') + if (!s) { - ret = malloc(l - 1); - strncpy(ret, s + 1, l - 2); - ret[l - 2] = '\0'; + ret = stp_malloc(1); + ret[0] = 0; + return ret; } else + return c_strndup(s, c_strlen(s)); +} + +static void +clear_testpattern(testpattern_t *p) +{ + int i; + for (i = 0; i < STP_CHANNEL_LIMIT; i++) { - ret = malloc(strlen(s) + 1); - strcpy(ret, s); + p->d.p.mins[i] = 0; + p->d.p.vals[i] = 0; + p->d.p.gammas[i] = 1; + p->d.p.levels[i] = 0; } - return ret; } + testpattern_t * get_next_testpattern(void) { static int internal_n_testpatterns = 0; - if (n_testpatterns == 0) + if (global_n_testpatterns == -1) { - the_testpatterns = malloc(sizeof(testpattern_t)); - n_testpatterns = internal_n_testpatterns = 1; - return &(the_testpatterns[0]); + static_testpatterns = stp_malloc(sizeof(testpattern_t)); + global_n_testpatterns = 0; + internal_n_testpatterns = 1; + clear_testpattern(&(static_testpatterns[0])); + return &(static_testpatterns[0]); } - else if (n_testpatterns >= internal_n_testpatterns) + else if (global_n_testpatterns + 1 >= internal_n_testpatterns) { internal_n_testpatterns *= 2; - the_testpatterns = - realloc(the_testpatterns, - internal_n_testpatterns * sizeof(testpattern_t)); + static_testpatterns = + stp_realloc(static_testpatterns, + internal_n_testpatterns * sizeof(testpattern_t)); } - return &(the_testpatterns[n_testpatterns++]); + global_n_testpatterns++; + clear_testpattern(&(static_testpatterns[global_n_testpatterns])); + return &(static_testpatterns[global_n_testpatterns]); } static void -do_help(void) +writefunc(void *file, const char *buf, size_t bytes) { - fprintf(stderr, "%s", "\ -Usage: testpattern -p printer [-n ramp_levels] [-I ink_limit] [-i ink_type]\n\ - [-r resolution] [-s media_source] [-t media_type]\n\ - [-z media_size] [-d dither_algorithm] [-e density]\n\ - [-c cyan_level] [-m magenta_level] [-y yellow_level]\n\ - [-C cyan_gamma] [-M magenta_gamma] [-Y yellow_gamma]\n\ - [-K black_gamma] [-G gamma] [-q]\n\ - [-H width] [-V height] [-T top] [-L left]\n\ - -H, -V, -T, -L expressed as fractions of the printable paper size\n\ - 0.0 < ink_limit <= 1.0\n\ - 1 < ramp_levels <= 4096\n\ - 0.1 <= density <= 2.0\n\ - 0.0 < cyan_level <= 10.0 same for magenta and yellow.\n"); - exit(1); + FILE *prn = (FILE *)file; + if (!global_suppress_output || (file == stderr)) + { + fwrite(buf, 1, bytes, prn); + } } static void -writefunc(void *file, const char *buf, size_t bytes) +initialize_global_parameters(void) { - FILE *prn = (FILE *)file; - fwrite(buf, 1, bytes, prn); + int i; + for (i = 0; i < STP_CHANNEL_LIMIT; i++) + { + global_levels[i] = 1.0; + global_gammas[i] = 1.0; + } + global_gamma = 1.0; + global_steps = 256; + global_ink_limit = 1.0; + global_noblackline = 0; + global_printer_width = 0; + global_printer_height = 0; + global_band_height = 0; + global_n_testpatterns = -1; + if (global_printer) + free(global_printer); /* Allocated with strdup() */ + global_printer = NULL; + global_density = 1.0; + global_xtop = 0; + global_xleft = 0; + global_hsize = 1.0; + global_vsize = 1.0; + global_bit_depth = 16; + global_channel_depth = 0; + global_image_type = "CMYK"; + global_use_raw_cmyk = 0; + global_did_something = 0; + global_invert_data = 0; + if (static_testpatterns) + stp_free(static_testpatterns); + static_testpatterns = NULL; + if (global_vars) + stp_vars_destroy(global_vars); + global_vars = NULL; + if (global_printer) + free(global_printer); /* Allocated with strdup() */ + global_printer = NULL; } -int -main(int argc, char **argv) +static int +do_print(void) { - int c; - stp_vars_t v; - stp_printer_t the_printer; - stp_papersize_t pt; + stp_vars_t *v; + const stp_printer_t *the_printer; int left, right, top, bottom; - const stp_printfuncs_t *printfuncs; - int x, y, owidth; + int x, y; int width, height; + int retval; + stp_parameter_list_t params; + int count; + int i; + char tmp[32]; - int retval = yyparse(); + initialize_global_parameters(); + global_vars = stp_vars_create(); + stp_set_outfunc(global_vars, writefunc); + stp_set_errfunc(global_vars, writefunc); + stp_set_outdata(global_vars, stdout); + stp_set_errdata(global_vars, stderr); + + retval = yyparse(); if (retval) - return retval; + return retval + 1; - while (1) - { - c = getopt(argc, argv, "qp:n:l:I:r:s:t:z:d:hC:M:Y:K:e:T:L:H:V:c:m:y:G:"); - if (c == -1) - break; - switch (c) - { - case 'C': - global_c_gamma = strtod(optarg, 0); - break; - case 'I': - ink_limit = strtod(optarg, 0); - break; - case 'G': - global_gamma = strtod(optarg, 0); - break; - case 'H': - hsize = strtod(optarg, 0); - break; - case 'K': - global_k_gamma = strtod(optarg, 0); - break; - case 'L': - xleft = strtod(optarg, 0); - break; - case 'M': - global_m_gamma = strtod(optarg, 0); - break; - case 'T': - xtop = strtod(optarg, 0); - break; - case 'V': - vsize = strtod(optarg, 0); - break; - case 'Y': - global_y_gamma = strtod(optarg, 0); - break; - case 'c': - global_c_level = strtod(optarg, 0); - break; - case 'd': - dither_algorithm = c_strdup(optarg); - break; - case 'e': - density = strtod(optarg, 0); - break; - case 'h': - do_help(); - break; - case 'i': - ink_type = c_strdup(optarg); - break; - case 'm': - global_m_level = strtod(optarg, 0); - break; - case 'n': - levels = atoi(optarg); - break; - case 'p': - printer = c_strdup(optarg); - break; - case 'q': - noblackline = 1; - break; - case 'r': - resolution = c_strdup(optarg); - break; - case 's': - media_source = c_strdup(optarg); - break; - case 't': - media_type = c_strdup(optarg); - break; - case 'y': - global_y_level = strtod(optarg, 0); - break; - case 'z': - media_size = c_strdup(optarg); - break; - default: - fprintf(stderr, "Unknown option '-%c'\n", c); - do_help(); - break; - } - } - if (!printer || - ink_limit <= 0 || ink_limit > 1.0 || - levels < 1 || levels > 4096 || - global_c_level <= 0 || global_c_level > 10 || - global_m_level <= 0 || global_m_level > 10 || - global_y_level <= 0 || global_y_level > 10 || - xtop < 0 || xtop > 1 || xleft < 0 || xleft > 1 || - xtop + vsize > 1 || xleft + hsize > 1 || - hsize < 0 || hsize > 1 || vsize < 0 || vsize > 1) - do_help(); - stp_init(); - v = stp_allocate_vars(); - the_printer = stp_get_printer_by_driver(printer); + if (!global_did_something) + return 1; + + v = stp_vars_create(); + the_printer = stp_get_printer_by_driver(global_printer); if (!the_printer) { - the_printer = stp_get_printer_by_long_name(printer); - if (!the_printer) + int j; + fprintf(stderr, "Unknown printer %s\nValid printers are:\n", + global_printer); + for (j = 0; j < stp_printer_model_count(); j++) { - int i; - fprintf(stderr, "Unknown printer %s\nValid printers are:\n",printer); - for (i = 0; i < stp_known_printers(); i++) - { - the_printer = stp_get_printer_by_index(i); - fprintf(stderr, "%-16s%s\n", stp_printer_get_driver(the_printer), - stp_printer_get_long_name(the_printer)); - } - return 1; + the_printer = stp_get_printer_by_index(j); + fprintf(stderr, "%-16s%s\n", stp_printer_get_driver(the_printer), + stp_printer_get_long_name(the_printer)); } + return 2; } - stp_set_printer_defaults(v, the_printer, NULL); + stp_set_printer_defaults(v, the_printer); stp_set_outfunc(v, writefunc); stp_set_errfunc(v, writefunc); stp_set_outdata(v, stdout); stp_set_errdata(v, stderr); - printfuncs = stp_printer_get_printfuncs(the_printer); - stp_set_density(v, density); - if (resolution) - stp_set_resolution(v, resolution); - if (ink_type) - stp_set_ink_type(v, ink_type); - if (media_type) - stp_set_media_type(v, media_type); - if (media_source) - stp_set_media_source(v, media_source); - if (media_size) - stp_set_media_size(v, media_size); - if (dither_algorithm) - stp_set_dither_algorithm(v, dither_algorithm); - - /* - * Most programs will not use OUTPUT_RAW_CMYK; OUTPUT_COLOR or - * OUTPUT_GRAYSCALE are more useful for most purposes. - */ - stp_set_output_type(v, OUTPUT_RAW_CMYK); - - pt = stp_get_papersize_by_name(stp_get_media_size(v)); - if (!pt) + stp_set_string_parameter(v, "InputImageType", global_image_type); + sprintf(tmp, "%d", global_bit_depth); + stp_set_string_parameter(v, "ChannelBitDepth", tmp); + sprintf(tmp, "%d", global_channel_depth); + stp_set_string_parameter(v, "RawChannels", tmp); + stp_set_float_parameter(v, "Density", global_density); + stp_set_string_parameter(v, "Quality", "None"); + stp_set_string_parameter(v, "ImageType", "None"); + + params = stp_get_parameter_list(v); + count = stp_parameter_list_count(params); + for (i = 0; i < count; i++) { - fprintf(stderr, "Papersize %s unknown\n", media_size); - return 1; + const stp_parameter_t *p = stp_parameter_list_param(params, i); + const char *val = stp_get_string_parameter(global_vars, p->name); + if (p->p_type == STP_PARAMETER_TYPE_STRING_LIST && val && strlen(val) > 0) + stp_set_string_parameter(v, p->name, val); + stp_set_page_width(v, stp_get_page_width(global_vars)); + stp_set_page_height(v, stp_get_page_height(global_vars)); } + stp_parameter_list_destroy(params); - (printfuncs->imageable_area)(the_printer, v, &left, &right, &bottom, &top); - (printfuncs->describe_resolution)(the_printer, stp_get_resolution(v),&x, &y); + stp_get_imageable_area(v, &left, &right, &bottom, &top); + stp_describe_resolution(v, &x, &y); if (x < 0) x = 300; if (y < 0) y = 300; width = right - left; - height = top - bottom; - top -= stp_papersize_get_height(pt); - top = top + height * xtop; - left = width * xleft; - owidth = width; - if (levels > width) - levels = width; - - width = (width / levels) * levels; - height = (height / n_testpatterns) * n_testpatterns; - if (hsize > vsize) + height = bottom - top; + top += height * global_xtop; + left += width * global_xleft; + if (global_steps > width) + global_steps = width; + +#if 0 + width = (width / global_steps) * global_steps; + height = (height / global_n_testpatterns) * global_n_testpatterns; +#endif + stp_set_width(v, width * global_hsize); + stp_set_height(v, height * global_vsize); + + global_printer_width = width * x / 72; + global_printer_height = height * y / 72; + + global_band_height = global_printer_height / global_n_testpatterns; + stp_set_left(v, left); + stp_set_top(v, top); + + stp_merge_printvars(v, stp_printer_get_defaults(the_printer)); + if (stp_print(v, &theImage) != 1) + return 2; + stp_vars_destroy(v); + stp_free(static_testpatterns); + static_testpatterns = NULL; + return 0; +} + +int +main(int argc, char **argv) +{ + int c; + int status; + while (1) { - stp_set_scaling(v, 100 * hsize); - printer_width = width * x / 72; - printer_height = vsize / hsize * height * y / 72; + c = getopt(argc, argv, "n"); + if (c == -1) + break; + switch (c) + { + case 'n': + global_suppress_output = 1; + default: + break; + } } - else + + stp_init(); + while (1) { - stp_set_scaling(v, 100 * vsize); - printer_width = hsize / vsize * width * x / 72; - printer_height = height * y / 72; + status = do_print(); + if (status != 0) + break; } + return status - 1; +} - bandheight = printer_height / n_testpatterns; - stp_set_left(v, left + (hsize * (owidth - width) / 2)); - stp_set_top(v, top); - stp_set_orientation(v, ORIENT_PORTRAIT); +static void +invert_data(unsigned char *data, size_t byte_depth) +{ + int i; + size_t total_bytes; + total_bytes = global_printer_width * global_channel_depth * byte_depth; + for (i = 0; i < total_bytes; i++) + data[i] = 0xff ^ data[i]; +} - stp_merge_printvars(v, stp_printer_get_printvars(the_printer)); - if (stp_printer_get_printfuncs(the_printer)->verify(the_printer, v)) - (stp_printer_get_printfuncs(the_printer)->print)(the_printer, &theImage, v); - else - return 1; - return 0; +/* + * Emulate templates with macros -- rlk 20031014 + */ + +#define FILL_BLACK_FUNCTION(T, bits) \ +static void \ +fill_black_##bits(unsigned char *data, size_t len, size_t scount) \ +{ \ + int i; \ + T *s_data = (T *) data; \ + unsigned black_val = global_ink_limit * ((1 << bits) - 1); \ + if (strcmp(global_image_type, "Raw") == 0) \ + { \ + for (i = 0; i < (len / scount) * scount; i++) \ + { \ + memset(s_data, 0, sizeof(T) * global_channel_depth); \ + s_data[0] = black_val; \ + if (global_channel_depth == 3) \ + { \ + s_data[1] = black_val; \ + s_data[2] = black_val; \ + } \ + else if (global_channel_depth == 5) \ + { \ + s_data[2] = black_val; \ + s_data[4] = black_val; \ + } \ + s_data += global_channel_depth; \ + } \ + } \ + else if (strcmp(global_image_type, "CMYK") == 0) \ + { \ + for (i = 0; i < (len / scount) * scount; i++) \ + { \ + memset(s_data, 0, sizeof(T) * 4); \ + s_data[3] = black_val; \ + s_data += 4; \ + } \ + } \ + else if (strcmp(global_image_type, "KCMY") == 0) \ + { \ + for (i = 0; i < (len / scount) * scount; i++) \ + { \ + memset(s_data, 0, sizeof(T) * 4); \ + s_data[0] = black_val; \ + s_data += 4; \ + } \ + } \ + else if (strcmp(global_image_type, "Grayscale") == 0) \ + { \ + for (i = 0; i < (len / scount) * scount; i++) \ + { \ + memset(s_data, 0, sizeof(T) * 1); \ + s_data[0] = black_val; \ + s_data += 1; \ + } \ + } \ } +FILL_BLACK_FUNCTION(unsigned short, 16) +FILL_BLACK_FUNCTION(unsigned char, 8) + static void -fill_black(unsigned short *data, size_t len, size_t scount) +fill_black(unsigned char *data, size_t len, size_t scount, size_t bytes) { - int i; - for (i = 0; i < (len / scount) * scount; i++) + switch (bytes) { - data[3] = ink_limit * 65535; - data += 4; + case 1: + fill_black_8(data, len, scount); + break; + case 2: + fill_black_16(data, len, scount); + break; } + if (global_invert_data) + invert_data(data, bytes); } +#define FILL_WHITE_FUNCTION(T, bits) \ +static void \ +fill_white_##bits(unsigned char *data, size_t len, size_t scount) \ +{ \ + T *s_data = (T *) data; \ + memset(s_data, 0, sizeof(T) * global_channel_depth * \ + ((len / scount) * scount)); \ +} + +FILL_WHITE_FUNCTION(unsigned short, 16) +FILL_WHITE_FUNCTION(unsigned char, 8) + static void -fill_colors(unsigned short *data, size_t len, size_t scount, testpattern_t *p) +fill_white(unsigned char *data, size_t len, size_t scount, size_t bytes) { - double c_min = p->d.p.c_min == -2 ? global_c_level : p->d.p.c_min; - double m_min = p->d.p.m_min == -2 ? global_m_level : p->d.p.m_min; - double y_min = p->d.p.y_min == -2 ? global_y_level : p->d.p.y_min; - double k_min = p->d.p.k_min; - double c = p->d.p.c == -2 ? global_c_level : p->d.p.c; - double m = p->d.p.m == -2 ? global_m_level : p->d.p.m; - double y = p->d.p.y == -2 ? global_y_level : p->d.p.y; - double c_gamma = p->d.p.c_gamma * global_gamma * global_c_gamma; - double m_gamma = p->d.p.m_gamma * global_gamma * global_m_gamma; - double y_gamma = p->d.p.y_gamma * global_gamma * global_y_gamma; - double k_gamma = p->d.p.k_gamma * global_gamma * global_k_gamma; - double k = p->d.p.k; - double c_level = p->d.p.c_level == -2 ? global_c_level : p->d.p.c_level; - double m_level = p->d.p.m_level == -2 ? global_m_level : p->d.p.m_level; - double y_level = p->d.p.y_level == -2 ? global_y_level : p->d.p.y_level; - double lower = p->d.p.lower; - double upper = p->d.p.upper; - int i; - int j; - int pixels; - c -= c_min; - m -= m_min; - y -= y_min; - k -= k_min; - if (scount > len) - scount = len; - pixels = len / scount; - for (i = 0; i < scount; i++) + switch (bytes) + { + case 1: + fill_white_8(data, len, scount); + break; + case 2: + fill_white_16(data, len, scount); + break; + } + if (global_invert_data) + invert_data(data, bytes); +} + +#define FILL_GRID_FUNCTION(T, bits) \ +static void \ +fill_grid_##bits(unsigned char *data, size_t len, size_t scount, \ + testpattern_t *p) \ +{ \ + int i; \ + int xlen = (len / scount) * scount; \ + int errdiv = (p->d.g.ticks) / (xlen - 1); \ + int errmod = (p->d.g.ticks) % (xlen - 1); \ + int errval = 0; \ + int errlast = -1; \ + int errline = 0; \ + T *s_data = (T *) data; \ + unsigned multiplier = (1 << bits) - 1; \ + \ + for (i = 0; i < xlen; i++) \ + { \ + if (errline != errlast) \ + { \ + errlast = errline; \ + s_data[0] = multiplier; \ + } \ + errval += errmod; \ + errline += errdiv; \ + if (errval >= xlen - 1) \ + { \ + errval -= xlen - 1; \ + errline++; \ + } \ + s_data += global_channel_depth; \ + } \ +} + +FILL_GRID_FUNCTION(unsigned short, 16) +FILL_GRID_FUNCTION(unsigned char, 8) + +static void +fill_grid(unsigned char *data, size_t len, size_t scount, + testpattern_t *p, size_t bytes) +{ + switch (bytes) + { + case 1: + fill_grid_8(data, len, scount, p); + break; + case 2: + fill_grid_16(data, len, scount, p); + break; + } +} + +#define FILL_COLORS_EXTENDED_FUNCTION(T, bits) \ +static void \ +fill_colors_extended_##bits(unsigned char *data, size_t len, \ + size_t scount, testpattern_t *p) \ +{ \ + double mins[STP_CHANNEL_LIMIT]; \ + double vals[STP_CHANNEL_LIMIT]; \ + double gammas[STP_CHANNEL_LIMIT]; \ + int i; \ + int j; \ + int k; \ + int pixels; \ + int channel_limit = global_channel_depth <= 7 ? 7 : global_channel_depth; \ + T *s_data = (T *) data; \ + unsigned multiplier = (1 << bits) - 1; \ + \ + for (j = 0; j < channel_limit; j++) \ + { \ + mins[j] = p->d.p.mins[j] == -2 ? global_levels[j] : p->d.p.mins[j]; \ + vals[j] = p->d.p.vals[j] == -2 ? global_levels[j] : p->d.p.vals[j]; \ + gammas[j] = p->d.p.gammas[j] * global_gamma * global_gammas[j]; \ + vals[j] -= mins[j]; \ + } \ + if (scount > len) \ + scount = len; \ + pixels = len / scount; \ + for (i = 0; i < scount; i++) \ + { \ + double where = (double) i / ((double) scount - 1); \ + double val = where; \ + double xvals[STP_CHANNEL_LIMIT]; \ + \ + for (j = 0; j < channel_limit; j++) \ + { \ + xvals[j] = mins[j] + val * vals[j]; \ + xvals[j] = pow(xvals[j], gammas[j]); \ + xvals[j] *= global_ink_limit * multiplier; \ + } \ + for (k = 0; k < pixels; k++) \ + { \ + switch (global_channel_depth) \ + { \ + case 1: \ + s_data[0] = xvals[0]; \ + break; \ + case 2: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[4]; \ + break; \ + case 3: \ + s_data[0] = xvals[1]; \ + s_data[1] = xvals[2]; \ + s_data[2] = xvals[3]; \ + break; \ + case 4: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[1]; \ + s_data[2] = xvals[2]; \ + s_data[3] = xvals[3]; \ + break; \ + case 5: \ + s_data[0] = xvals[1]; \ + s_data[1] = xvals[5]; \ + s_data[2] = xvals[2]; \ + s_data[3] = xvals[6]; \ + s_data[4] = xvals[3]; \ + break; \ + case 6: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[1]; \ + s_data[2] = xvals[5]; \ + s_data[3] = xvals[2]; \ + s_data[4] = xvals[6]; \ + s_data[5] = xvals[3]; \ + break; \ + case 7: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[4]; \ + s_data[2] = xvals[1]; \ + s_data[3] = xvals[5]; \ + s_data[4] = xvals[2]; \ + s_data[5] = xvals[6]; \ + s_data[6] = xvals[3]; \ + break; \ + default: \ + for (j = 0; j < global_channel_depth; j++) \ + s_data[j] = xvals[j]; \ + } \ + s_data += global_channel_depth; \ + } \ + } \ +} + +FILL_COLORS_EXTENDED_FUNCTION(unsigned short, 16) +FILL_COLORS_EXTENDED_FUNCTION(unsigned char, 8) + +static void +fill_colors_extended(unsigned char *data, size_t len, size_t scount, + testpattern_t *p, size_t bytes) +{ + switch (bytes) { - double where = (double) i / ((double) scount - 1); - double cmyv; - double kv; - double val = where; - double cc = c_min + val * c; - double mm = m_min + val * m; - double yy = y_min + val * y; - double kk = k_min + k; - cc = pow(cc, c_gamma); - mm = pow(mm, m_gamma); - yy = pow(yy, y_gamma); - kk = pow(kk, k_gamma); - if (where <= lower) - kv = 0; - else if (where > upper) - kv = where; - else - kv = (where - lower) * upper / (upper - lower); - cmyv = k * (where - kv); - kk *= kv; - cc += cmyv * c_level; - mm += cmyv * m_level; - yy += cmyv * y_level; - if (cc > 1.0) - cc = 1.0; - if (mm > 1.0) - mm = 1.0; - if (yy > 1.0) - yy = 1.0; - if (kk > 1.0) - kk = 1.0; - cc *= ink_limit * 65535; - mm *= ink_limit * 65535; - yy *= ink_limit * 65535; - kk *= ink_limit * 65535; - for (j = 0; j < pixels; j++) + case 1: + fill_colors_extended_8(data, len, scount, p); + break; + case 2: + fill_colors_extended_16(data, len, scount, p); + break; + } +} + +#define FILL_COLORS_FUNCTION(T, bits) \ +static void \ +fill_colors_##bits(unsigned char *data, size_t len, size_t scount, \ + testpattern_t *p) \ +{ \ + double mins[4]; \ + double vals[4]; \ + double gammas[4]; \ + double levels[4]; \ + double lower = p->d.p.lower; \ + double upper = p->d.p.upper; \ + int i; \ + int j; \ + int pixels; \ + T *s_data = (T *) data; \ + unsigned multiplier = (1 << bits) - 1; \ + \ + vals[0] = p->d.p.vals[0]; \ + mins[0] = p->d.p.mins[0]; \ + \ + for (j = 1; j < 4; j++) \ + { \ + vals[j] = p->d.p.vals[j] == -2 ? global_levels[j] : p->d.p.vals[j]; \ + mins[j] = p->d.p.mins[j] == -2 ? global_levels[j] : p->d.p.mins[j]; \ + levels[j] = p->d.p.levels[j] == \ + -2 ? global_levels[j] : p->d.p.levels[j]; \ + } \ + for (j = 0; j < 4; j++) \ + { \ + gammas[j] = p->d.p.gammas[j] * global_gamma * global_gammas[j]; \ + vals[j] -= mins[j]; \ + } \ + \ + if (scount > len) \ + scount = len; \ + pixels = len / scount; \ + for (i = 0; i < scount; i++) \ + { \ + int k; \ + double where = (double) i / ((double) scount - 1); \ + double cmyv; \ + double kv; \ + double val = where; \ + double xvals[4]; \ + for (j = 0; j < 4; j++) \ + { \ + if (j > 0) \ + xvals[j] = mins[j] + val * vals[j]; \ + else \ + xvals[j] = mins[j] + vals[j]; \ + xvals[j] = pow(xvals[j], gammas[j]); \ + } \ + \ + if (where <= lower) \ + kv = 0; \ + else if (where > upper) \ + kv = where; \ + else \ + kv = (where - lower) * upper / (upper - lower); \ + cmyv = vals[0] * (where - kv); \ + xvals[0] *= kv; \ + for (j = 1; j < 4; j++) \ + xvals[j] += cmyv * levels[j]; \ + for (j = 0; j < 4; j++) \ + { \ + if (xvals[j] > 1) \ + xvals[j] = 1; \ + xvals[j] *= global_ink_limit * multiplier; \ + } \ + for (k = 0; k < pixels; k++) \ + { \ + switch (global_channel_depth) \ + { \ + case 0: \ + for (j = 0; j < 4; j++) \ + s_data[j] = xvals[(j + 1) % 4]; \ + s_data += 4; \ + break; \ + case 1: \ + s_data[0] = xvals[0]; \ + break; \ + case 2: \ + s_data[0] = xvals[0]; \ + s_data[1] = 0; \ + break; \ + case 3: \ + for (j = 1; j < 4; j++) \ + s_data[j - 1] = xvals[j]; \ + break; \ + case 4: \ + for (j = 0; j < 4; j++) \ + s_data[j] = xvals[j]; \ + break; \ + case 6: \ + s_data[0] = xvals[0]; \ + s_data[1] = xvals[1]; \ + s_data[2] = 0; \ + s_data[3] = xvals[2]; \ + s_data[4] = 0; \ + s_data[5] = xvals[3]; \ + break; \ + case 7: \ + for (j = 0; j < 4; j++) \ + s_data[j * 2] = xvals[j]; \ + for (j = 1; j < 6; j += 2) \ + s_data[j] = 0; \ + break; \ + } \ + s_data += global_channel_depth; \ + } \ + } \ +} + +FILL_COLORS_FUNCTION(unsigned short, 16) +FILL_COLORS_FUNCTION(unsigned char, 8) + +static void +fill_colors(unsigned char *data, size_t len, size_t scount, + testpattern_t *p, size_t bytes) +{ + if (strcmp(global_image_type, "RGB") == 0) + fill_colors_extended(data, len, scount, p, bytes); + else + { + switch (bytes) { - data[0] = cc; - data[1] = mm; - data[2] = yy; - data[3] = kk; - data += 4; + case 1: + fill_colors_8(data, len, scount, p); + break; + case 2: + fill_colors_16(data, len, scount, p); + break; } } } extern FILE *yyin; +static void +fill_pattern(testpattern_t *p, unsigned char *data, size_t width, + size_t s_count, size_t image_depth, size_t byte_depth) +{ + memset(data, 0, global_printer_width * image_depth * byte_depth); + switch (p->t) + { + case E_PATTERN: + fill_colors(data, width, s_count, p, byte_depth); + break; + case E_XPATTERN: + fill_colors_extended(data, width, s_count, p, byte_depth); + break; + case E_GRID: + fill_grid(data, width, s_count, p, byte_depth); + break; + default: + break; + } +} + + static stp_image_status_t -Image_get_row(stp_image_t *image, unsigned char *data, int row) +Image_get_row(stp_image_t *image, unsigned char *data, + size_t byte_limit, int row) { - if (the_testpatterns[0].t == E_IMAGE) + int depth = global_channel_depth; + if (static_testpatterns[0].t == E_IMAGE) { - testpattern_t *t = &(the_testpatterns[0]); - int total_read = fread(data, 1, t->d.i.x * 8, yyin); - if (total_read != t->d.i.x * 8) + testpattern_t *t = &(static_testpatterns[0]); + int total_read = fread(data, 1, t->d.i.x * depth * global_bit_depth / 8, + yyin); + if (total_read != t->d.i.x * depth * global_bit_depth / 8) { fprintf(stderr, "Read failed!\n"); - return STP_IMAGE_ABORT; + return STP_IMAGE_STATUS_ABORT; } + fprintf(stderr, "."); } else { static int previous_band = -1; - int band = row / bandheight; - if (previous_band == -2) + int band = row / global_band_height; + if (previous_band == -1) { - memset(data, 0, printer_width * 4 * sizeof(unsigned short)); - fill_colors((unsigned short *)data, printer_width, levels, - &(the_testpatterns[band])); + fill_pattern(&(static_testpatterns[band]), data, + global_printer_width, global_steps, depth, + global_bit_depth / 8); previous_band = band; + fprintf(stderr, "."); } - else if (row == printer_height - 1) + else if (row == global_printer_height - 1) + fill_black(data, global_printer_width, global_steps, + global_bit_depth / 8); + else if (band >= global_n_testpatterns) + fill_white(data, global_printer_width, global_steps, + global_bit_depth / 8); + else if (band != previous_band && band >= 0) { - memset(data, 0, printer_width * 4 * sizeof(unsigned short)); - fill_black((unsigned short *)data, printer_width, levels); - } - else if (band >= n_testpatterns) - memset(data, 0, printer_width * 4 * sizeof(unsigned short)); - else if (band != previous_band && band > 0) - { - memset(data, 0, printer_width * 4 * sizeof(unsigned short)); - if (noblackline) - { - fill_colors((unsigned short *)data, printer_width, levels, - &(the_testpatterns[band])); - previous_band = band; - } - else - { - fill_black((unsigned short *)data, printer_width, levels); - previous_band = -2; - } + fill_pattern(&(static_testpatterns[band]), data, + global_printer_width, global_steps, depth, + global_bit_depth / 8); + previous_band = band; + fprintf(stderr, "."); } } - return STP_IMAGE_OK; -} - -static int -Image_bpp(stp_image_t *image) -{ - return 8; + return STP_IMAGE_STATUS_OK; } static int Image_width(stp_image_t *image) { - if (the_testpatterns[0].t == E_IMAGE) - return the_testpatterns[0].d.i.x; + if (static_testpatterns[0].t == E_IMAGE) + return static_testpatterns[0].d.i.x; else - return printer_width; + return global_printer_width; } static int Image_height(stp_image_t *image) { - if (the_testpatterns[0].t == E_IMAGE) - return the_testpatterns[0].d.i.y; + if (static_testpatterns[0].t == E_IMAGE) + return static_testpatterns[0].d.i.y; else - return printer_height; + return global_printer_height; } static void @@ -552,20 +864,7 @@ Image_init(stp_image_t *image) } static void -Image_progress_init(stp_image_t *image) -{ - /* dummy function */ -} - -/* progress display */ -static void -Image_note_progress(stp_image_t *image, double current, double total) -{ - fprintf(stderr, "."); -} - -static void -Image_progress_conclude(stp_image_t *image) +Image_conclude(stp_image_t *image) { fprintf(stderr, "\n"); } diff --git a/src/testpattern/testpattern.h b/src/testpattern/testpattern.h index 679e4f4..8b288a2 100644 --- a/src/testpattern/testpattern.h +++ b/src/testpattern/testpattern.h @@ -1,5 +1,5 @@ /* - * "$Id: testpattern.h,v 1.2.6.1 2002/07/23 00:54:08 rlk Exp $" + * "$Id: testpattern.h,v 1.15 2004/09/17 18:38:27 rleigh Exp $" * * Test pattern generator for Gimp-Print * @@ -20,33 +20,33 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gutenprint/gutenprint.h> + typedef struct { enum { E_PATTERN, - E_IMAGE + E_XPATTERN, + E_IMAGE, + E_GRID } t; union { struct { - double c_min; - double c; - double c_gamma; - double m_min; - double m; - double m_gamma; - double y_min; - double y; - double y_gamma; - double k_min; - double k; - double k_gamma; - double c_level; - double m_level; - double y_level; + double mins[32]; + double vals[32]; + double gammas[32]; + double levels[32]; double lower; double upper; } p; struct { + int ticks; + } g; + struct { int x; int y; int bits; @@ -61,29 +61,27 @@ typedef struct */ #define YY_ALWAYS_INTERACTIVE 1 -extern double global_c_level; -extern double global_c_gamma; -extern double global_m_level; -extern double global_m_gamma; -extern double global_y_level; -extern double global_y_gamma; -extern double global_k_gamma; +extern stp_vars_t *global_vars; +extern double global_levels[]; +extern double global_gammas[]; extern double global_gamma; -extern int levels; -extern double ink_limit; -extern char *printer; -extern char *ink_type; -extern char *resolution; -extern char *media_source; -extern char *media_type; -extern char *media_size; -extern char *dither_algorithm; -extern double density; -extern double xtop; -extern double xleft; -extern double hsize; -extern double vsize; -extern int noblackline; +extern int global_steps; +extern double global_ink_limit; +extern char *global_printer; +extern double global_density; +extern double global_xtop; +extern double global_xleft; +extern double global_hsize; +extern double global_vsize; +extern int global_noblackline; +extern const char *global_image_type; +extern int global_color_model; +extern int global_bit_depth; +extern int global_channel_depth; +extern int global_did_something; +extern int global_invert_data; + + extern char *c_strdup(const char *s); extern testpattern_t *get_next_testpattern(void); @@ -93,7 +91,7 @@ typedef union yylv { char *sval; } YYSTYPE; -extern YYSTYPE yylval; +#define YYSTYPE_IS_DECLARED 1 #include "testpatterny.h" diff --git a/src/testpattern/testpattern.sample b/src/testpattern/testpattern.sample index 6897962..8ddeaac 100644 --- a/src/testpattern/testpattern.sample +++ b/src/testpattern/testpattern.sample @@ -3,32 +3,35 @@ # Printer/driver settings. Please see src/ghost/README for appropriate # values for each of these settings # Printer model -printer escp2-870 +printer escp2-870; # Resolution, or print quality -resolution 360sw +parameter Resolution 720sw; # Media source (if appropriate for your printer) -media_source Standard +parameter InputSlot Standard; # Media type (what kind of paper) -media_type Photo +parameter MediaType Photo; # ink_type -ink_type PhotoCMYK +parameter InkType PhotoCMYK; # Paper size -media_size Letter +parameter PageSize Letter; # Dither algorithm -dither_algorithm Ordered +#parameter DitherAlgorithm Ordered; +parameter DitherAlgorithm UniTone; + +mode RGB 8; # Note that due to limitations in the lexical analyzer and parser, all # floating point values must be specified with a decimal point. # Placement settings # Horizontal size, as fraction of paper width (defaults to 1.0) -hsize 0.33 +hsize 0.33; # Vertical size, as fraction of paper width (defaults to 1.0) -vsize 0.33 +vsize 0.33; # Left margin, as fraction of paper width (defaults to 0) -left 0.66 +left 0.66; # Top margin, as fraction of paper width (defaults to 0) -top 0.66 +top 0.66; # Output settings # These settings are used as the base values for all ramps. These settings @@ -36,133 +39,133 @@ top 0.66 # to compute the effective gamma and conversion values. All of these # default to 1.0. # Gamma value applied to all inks -gamma 1.0 +gamma 1.0; # Additional gamma correction applied to cyan, magenta, yellow, and black inks -c_gamma 1.0 -m_gamma 1.0 -y_gamma 1.0 -k_gamma 1.0 +gamma cyan 1.0; +gamma magenta 1.0; +gamma yellow 1.0; +gamma black 1.0; # Amount of each ink that should be used when black is converted to CMY. # These values must be greater than 0 and must not exceed 10. -c_level 1.0 -m_level 1.0 -y_level 1.0 +level cyan 1.0; +level magenta 1.0; +level yellow 1.0; # Maximum amount of ink that will be printed, relative to solid coverage. # 1.0 means that every dot position that can be printed will be. Normally # at high resolutions less ink should be printed. This is similar to # density in normal RGB mode, but does not affect photo ink conversion. -ink_limit 1.0 +ink_limit 1.0; # Density. Unlike normal RGB mode, the CMYK16 input mode used by the # test pattern generator does not automatically scale the amount of ink # used by the resolution and paper type (see ink_limit above). The test # driver separates the functions of ink limiting and photo ink conversion # to allow maximum control over the output. -density 1.0 +density 1.0; # Do we want a thin black line between each band? (default yes) -blackline 0 +blackline 0; -# Number of levels in each ramp (default 256) -levels 16 +# Number of steps in each ramp (default 256) +steps 16; # Pattern specifiers -# CYAN MAGENTA YELLOW BLACK BLACK BLACK RAMP ENDPOINTS -# CONVERSION -# Min Min Min Min Cyan Lower -# Max Max Max Max Magenta Upper -# Gamma Gamma Gamma Gamma Yellow +# BLACK RAMP BLACK BLACK CYAN MAGENTA YELLOW +# ENDPOINTS CONVERSION +# Lower Cyan Min Min Min Min +# Upper Magenta Max Max Max Max +# Yellow Gamma Gamma Gamma Gamma # 0) White band -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 +pattern 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 1) C sweep -pattern 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 2) M sweep -pattern 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; # 3) Y sweep -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; # 4) Pure CMY sweep -pattern 0.0 1.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; # 5) K sweep -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 6) Adjusted CMY sweep -pattern 0.0 -2.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0 0.0 -2.0 1.0; # 7) Pure CMY sweep -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 8) Adjusted CMY sweep -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 -2.0 -2.0 -2.0 1.0 1.0 +pattern 1.0 1.0 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 9) CMYK, transition band 10-30% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 0.1 0.3 +pattern 0.1 0.3 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 10) Adjusted CMYK, transition band 30-70% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 -2.0 -2.0 -2.0 0.3 0.7 +pattern 0.3 0.7 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 11) CMYK, transition band 10-99.9% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 0.1 0.999 +pattern 0.1 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 12) CMYK, transition band 30-99.9% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 0.3 0.999 +pattern 0.3 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 13) CMYK, transition band 50-99.9% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 0.5 0.999 +pattern 0.5 0.999 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 14) Adjusted CMYK, transition band 10-30% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 -2.0 -2.0 -2.0 0.1 0.3 +pattern 0.1 0.3 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 15) CMYK, transition band 30-70% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 0.3 0.7 +pattern 0.3 0.7 1.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 16) Adjusted CMYK, transition band 10-99.9% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 -2.0 -2.0 -2.0 0.1 0.999 +pattern 0.1 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 17) Adjusted CMYK, transition band 30-99.9% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 -2.0 -2.0 -2.0 0.3 0.999 +pattern 0.3 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 18) Adjusted CMYK, transition band 50-99.9% -pattern 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 -2.0 -2.0 -2.0 0.5 0.999 +pattern 0.5 0.999 -2.0 -2.0 -2.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0; # 19) Y+M (R) sweep -pattern 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0; # 20) Y+M+.25C sweep -pattern 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.25 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; # 21) Y+M+.25C sweep (using K) -pattern 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.25 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.75 1.0; # 22) Y+M+.5C sweep -pattern 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; # 23) Y+M+.5C sweep (using K) -pattern 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0; # 24) Y+M+.75C sweep -pattern 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.75 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; # 25) Y+M+.75C sweep (using K) -pattern 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.75 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.25 1.0; # 26) Y+M+.9C sweep -pattern 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.9 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; # 27) Y+M+.9C sweep (using K) -pattern 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.9 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.1 1.0; # 28) C+Y (G) sweep -pattern 0.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0; # 29) C+Y+.25M sweep -pattern 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; # 30) C+Y+.25M sweep (using K) -pattern 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.75 1.0; # 31) C+Y+.5M sweep -pattern 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; # 32) C+Y+.5M sweep (using K) -pattern 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0; # 33) C+Y+.75M sweep -pattern 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; # 34) C+Y+.75M sweep (using K) -pattern 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.25 1.0; # 35) C+Y+.9M sweep -pattern 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.9 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; # 36) C+Y+.9M sweep (using K) -pattern 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0 0.0 0.9 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.1 1.0; # 37) C+M (B) sweep -pattern 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0; # 38) C+M+.25Y sweep -pattern 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; # 39) C+M+.25Y sweep (using K) -pattern 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0 0.0 0.25 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.25 1.0 0.0 0.75 1.0 0.0 0.75 1.0 0.0 0.0 1.0; # 40) C+M+.5Y sweep -pattern 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; # 41) C+M+.5Y sweep (using K) -pattern 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0 0.0 0.5 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.5 1.0 0.0 0.0 1.0; # 42) C+M+.75Y sweep -pattern 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; # 43) C+M+.75Y sweep (using K) -pattern 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0 0.0 0.75 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.75 1.0 0.0 0.25 1.0 0.0 0.25 1.0 0.0 0.0 1.0; # 44) C+M+.9Y sweep -pattern 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.9 1.0 1.0 1.0 1.0 1.0 1.0 +pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; # 45) C+M+.9Y sweep (using K) -pattern 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0 0.0 0.9 1.0 1.0 1.0 1.0 0.0 0.0 +pattern 0.0 0.0 1.0 1.0 1.0 0.0 0.9 1.0 0.0 0.1 1.0 0.0 0.1 1.0 0.0 0.0 1.0; diff --git a/src/testpattern/testpatternl.c b/src/testpattern/testpatternl.c index c4abf5a..6ad6563 100644 --- a/src/testpattern/testpatternl.c +++ b/src/testpattern/testpatternl.c @@ -1,32 +1,85 @@ -/* A lexical scanner generated by flex */ -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ +#line 3 "testpatternl.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) #endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) #endif +#endif /* ! FLEXINT_H */ #ifdef __cplusplus -#include <stdlib.h> -#include <unistd.h> - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -34,34 +87,17 @@ #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -76,71 +112,71 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif extern int yyleng; + extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ -typedef unsigned int yy_size_t; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -177,12 +213,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -196,23 +236,33 @@ struct yy_buffer_state * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ -static YY_BUFFER_STATE yy_current_buffer = 0; +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - int yyleng; /* Points to current character in buffer. */ @@ -225,108 +275,138 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) -#define yywrap() 1 +#define yywrap(n) 1 #define YY_SKIP_YYWRAP + typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + extern char *yytext; #define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 33 -#define YY_END_OF_BUFFER 34 -static yyconst short int yy_accept[187] = +#define YY_NUM_RULES 49 +#define YY_END_OF_BUFFER 50 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[233] = { 0, - 0, 0, 34, 29, 30, 32, 33, 29, 29, 27, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 30, 0, 29, 31, - 27, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 28, 29, 28, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 20, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 21, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - - 29, 29, 29, 29, 29, 29, 5, 22, 26, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 23, - 11, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 9, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 1, 6, 19, 29, 29, 29, 4, 2, 7, - 29, 29, 25, 12, 29, 3, 8, 29, 29, 29, - 13, 29, 29, 29, 29, 24, 29, 10, 29, 29, - 29, 29, 29, 17, 29, 16, 14, 29, 29, 29, - 15, 29, 29, 29, 18, 0 + 0, 0, 50, 49, 46, 48, 49, 47, 49, 49, + 43, 32, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 46, 0, 47, 0, 45, 43, 45, 0, 43, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 0, + 44, 0, 45, 44, 45, 45, 37, 45, 45, 45, + 42, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + + 45, 45, 36, 45, 20, 45, 45, 45, 45, 44, + 45, 45, 34, 1, 45, 45, 45, 45, 39, 38, + 29, 45, 45, 45, 35, 45, 45, 45, 21, 45, + 45, 45, 33, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 7, 45, 45, 45, 45, 9, 22, 27, + 45, 45, 45, 45, 10, 45, 45, 45, 45, 45, + 45, 11, 23, 40, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 2, 45, 45, 45, 45, 45, 45, + 45, 45, 5, 45, 30, 45, 19, 45, 45, 8, + 45, 3, 41, 45, 45, 25, 13, 45, 45, 6, + + 28, 45, 45, 45, 45, 26, 24, 12, 4, 31, + 14, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 15, 45, 45, 45, 45, 18, 17, 45, + 16, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, - 1, 1, 6, 1, 6, 7, 1, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, - 1, 1, 1, 1, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 1, 19, 20, 21, 22, 23, 24, - 1, 25, 26, 27, 28, 29, 30, 1, 31, 32, - 1, 1, 1, 1, 9, 1, 10, 11, 12, 13, - - 14, 15, 16, 17, 18, 1, 19, 20, 21, 22, - 23, 24, 1, 25, 26, 27, 28, 29, 30, 1, - 31, 32, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 5, 1, 1, 1, 6, 1, + 1, 1, 7, 1, 8, 9, 1, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 1, 11, 1, + 1, 1, 1, 1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 22, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 1, 1, 1, 1, 12, 1, 13, 14, 15, 16, + + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 22, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -343,127 +423,200 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[33] = +static yyconst flex_int32_t yy_meta[38] = { 0, - 1, 2, 3, 4, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1 + 1, 1, 2, 3, 1, 1, 1, 4, 4, 4, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst short int yy_base[191] = +static yyconst flex_int16_t yy_base[237] = { 0, - 0, 0, 211, 0, 208, 212, 0, 31, 201, 29, - 188, 198, 20, 196, 179, 18, 195, 189, 32, 32, - 188, 178, 174, 181, 189, 0, 195, 192, 43, 0, - 41, 187, 44, 184, 38, 171, 165, 170, 172, 179, - 169, 171, 36, 40, 173, 158, 166, 157, 158, 163, - 167, 43, 212, 53, 171, 170, 165, 166, 161, 148, - 156, 151, 139, 154, 160, 158, 140, 152, 155, 150, - 145, 135, 139, 137, 0, 127, 131, 147, 142, 136, - 133, 124, 134, 137, 140, 135, 134, 42, 126, 0, - 126, 124, 115, 133, 128, 114, 120, 125, 121, 116, - - 107, 115, 113, 119, 105, 106, 0, 0, 0, 112, - 98, 107, 101, 105, 111, 115, 98, 108, 93, 0, - 0, 99, 105, 100, 107, 96, 84, 105, 92, 88, - 101, 0, 100, 89, 44, 86, 82, 79, 95, 84, - 81, 0, 0, 0, 92, 83, 86, 0, 0, 0, - 50, 68, 0, 0, 80, 0, 0, 83, 76, 68, - 0, 62, 65, 68, 68, 0, 74, 0, 75, 63, - 73, 64, 62, 0, 72, 0, 0, 57, 64, 54, - 0, 39, 47, 32, 0, 212, 43, 73, 75, 79 + 0, 0, 468, 469, 465, 469, 0, 0, 460, 455, + 29, 469, 455, 31, 32, 33, 34, 35, 40, 47, + 38, 42, 49, 52, 58, 54, 62, 65, 66, 69, + 70, 461, 458, 0, 455, 469, 73, 451, 449, 82, + 93, 71, 85, 79, 95, 84, 87, 96, 97, 98, + 101, 100, 116, 107, 102, 117, 115, 125, 108, 127, + 126, 128, 132, 130, 131, 141, 142, 143, 144, 157, + 144, 448, 160, 162, 151, 149, 164, 165, 167, 168, + 448, 169, 170, 171, 172, 173, 174, 181, 176, 183, + 185, 184, 188, 187, 193, 195, 194, 196, 197, 208, + + 206, 190, 447, 213, 446, 214, 216, 217, 218, 444, + 220, 219, 444, 443, 222, 223, 224, 221, 442, 441, + 440, 240, 243, 229, 439, 226, 227, 245, 438, 246, + 247, 249, 437, 254, 250, 252, 256, 258, 259, 262, + 263, 265, 269, 268, 271, 272, 273, 436, 435, 434, + 275, 282, 274, 281, 433, 277, 290, 292, 293, 295, + 296, 432, 431, 430, 297, 298, 302, 303, 306, 307, + 308, 309, 312, 429, 310, 317, 311, 320, 322, 328, + 329, 330, 428, 331, 427, 333, 426, 335, 339, 425, + 337, 424, 423, 336, 338, 422, 421, 340, 347, 420, + + 419, 341, 352, 353, 354, 418, 417, 416, 409, 406, + 362, 360, 367, 368, 370, 371, 375, 373, 376, 377, + 378, 380, 400, 382, 388, 379, 386, 392, 385, 389, + 343, 469, 412, 416, 420, 115 } ; -static yyconst short int yy_def[191] = +static yyconst flex_int16_t yy_def[237] = { 0, - 186, 1, 186, 187, 186, 186, 188, 189, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 186, 188, 189, 190, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 186, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 187, 0, 186, 186, 186, 186 + 232, 1, 232, 232, 232, 232, 233, 234, 235, 232, + 236, 232, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 232, 233, 234, 235, 232, 232, 236, 232, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 232, + 232, 232, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + + 236, 236, 236, 236, 236, 236, 236, 236, 236, 232, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, + 236, 0, 232, 232, 232, 232 } ; -static yyconst short int yy_nxt[245] = +static yyconst flex_int16_t yy_nxt[507] = { 0, - 4, 5, 6, 7, 8, 9, 4, 10, 4, 4, - 11, 12, 13, 4, 4, 14, 15, 16, 17, 18, - 19, 4, 4, 20, 21, 4, 22, 4, 23, 24, - 25, 4, 30, 36, 30, 32, 31, 37, 40, 41, - 44, 46, 33, 26, 30, 45, 30, 32, 31, 55, - 67, 56, 185, 58, 33, 69, 47, 59, 78, 70, - 54, 110, 79, 184, 68, 183, 33, 162, 111, 151, - 152, 182, 163, 28, 28, 29, 29, 181, 29, 30, - 30, 180, 30, 179, 178, 177, 176, 175, 174, 173, - 172, 171, 170, 169, 168, 167, 166, 165, 164, 161, - - 160, 159, 158, 157, 156, 155, 154, 153, 150, 149, - 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, - 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, - 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, - 118, 117, 116, 115, 114, 113, 112, 109, 108, 107, - 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, - 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, - 86, 85, 84, 83, 82, 81, 80, 56, 56, 77, - 76, 75, 74, 73, 72, 71, 66, 65, 64, 63, - 62, 61, 60, 57, 54, 53, 27, 52, 51, 50, - - 49, 48, 43, 42, 39, 38, 35, 34, 31, 27, - 186, 3, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186 + 4, 5, 6, 7, 8, 9, 10, 10, 4, 11, + 12, 13, 13, 14, 15, 16, 17, 13, 18, 19, + 20, 13, 21, 22, 23, 13, 13, 24, 25, 26, + 27, 13, 28, 29, 30, 31, 13, 39, 40, 232, + 232, 232, 232, 232, 46, 41, 232, 50, 232, 47, + 232, 43, 55, 56, 42, 232, 44, 232, 57, 48, + 232, 58, 232, 51, 61, 59, 232, 45, 49, 52, + 232, 53, 54, 232, 232, 60, 63, 232, 232, 232, + 62, 39, 37, 75, 64, 67, 69, 232, 65, 70, + 39, 40, 232, 232, 66, 232, 68, 76, 41, 72, + + 73, 232, 74, 232, 232, 232, 232, 78, 232, 232, + 232, 81, 80, 84, 77, 232, 232, 85, 38, 79, + 87, 86, 83, 232, 232, 232, 90, 82, 88, 89, + 91, 92, 94, 232, 232, 232, 232, 97, 232, 232, + 232, 93, 98, 96, 99, 103, 104, 95, 102, 232, + 232, 232, 232, 71, 100, 108, 101, 232, 105, 232, + 70, 106, 107, 72, 72, 111, 110, 109, 232, 74, + 232, 74, 232, 232, 112, 232, 232, 232, 232, 232, + 232, 232, 232, 115, 232, 117, 113, 124, 121, 232, + 114, 232, 232, 232, 118, 232, 232, 116, 232, 123, + + 128, 232, 232, 232, 232, 232, 119, 120, 126, 130, + 122, 131, 133, 134, 232, 137, 232, 129, 125, 127, + 135, 232, 232, 132, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 148, 232, 232, 136, 232, 152, 153, + 138, 142, 143, 146, 144, 145, 140, 141, 232, 147, + 139, 232, 151, 232, 232, 232, 149, 232, 232, 150, + 232, 157, 232, 154, 232, 158, 232, 232, 160, 155, + 232, 232, 156, 232, 159, 163, 232, 232, 164, 232, + 232, 232, 232, 232, 168, 232, 161, 162, 171, 232, + 232, 166, 167, 165, 169, 172, 173, 175, 232, 174, + + 232, 232, 170, 232, 232, 232, 232, 176, 177, 179, + 232, 232, 181, 182, 232, 232, 232, 232, 232, 232, + 232, 178, 184, 180, 188, 232, 185, 193, 232, 192, + 232, 183, 186, 189, 190, 191, 232, 232, 232, 232, + 194, 232, 187, 232, 232, 232, 232, 232, 232, 232, + 201, 232, 195, 196, 205, 232, 199, 197, 198, 202, + 232, 232, 232, 207, 209, 206, 200, 203, 232, 210, + 232, 208, 204, 212, 213, 232, 232, 214, 232, 232, + 215, 232, 211, 232, 232, 232, 232, 232, 232, 216, + 232, 218, 226, 232, 232, 219, 232, 232, 217, 222, + + 232, 220, 227, 221, 228, 224, 223, 231, 232, 229, + 225, 230, 33, 33, 232, 33, 34, 232, 34, 34, + 35, 35, 35, 35, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 110, 232, 232, 232, 110, 71, 232, + 36, 36, 32, 232, 37, 36, 32, 232, 3, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + + 232, 232, 232, 232, 232, 232 } ; -static yyconst short int yy_chk[245] = +static yyconst flex_int16_t yy_chk[507] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 8, 13, 8, 10, 10, 13, 16, 16, - 19, 20, 10, 187, 29, 19, 29, 31, 31, 33, - 43, 33, 184, 35, 31, 44, 20, 35, 52, 44, - 54, 88, 52, 183, 43, 182, 54, 151, 88, 135, - 135, 180, 151, 188, 188, 189, 189, 179, 189, 190, - 190, 178, 190, 175, 173, 172, 171, 170, 169, 167, - 165, 164, 163, 162, 160, 159, 158, 155, 152, 147, - - 146, 145, 141, 140, 139, 138, 137, 136, 134, 133, - 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, - 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, - 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, - 96, 95, 94, 93, 92, 91, 89, 87, 86, 85, - 84, 83, 82, 81, 80, 79, 78, 77, 76, 74, - 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, - 63, 62, 61, 60, 59, 58, 57, 56, 55, 51, - 50, 49, 48, 47, 46, 45, 42, 41, 40, 39, - 38, 37, 36, 34, 32, 28, 27, 25, 24, 23, - - 22, 21, 18, 17, 15, 14, 12, 11, 9, 5, - 3, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186 + 1, 1, 1, 1, 1, 1, 1, 11, 11, 14, + 15, 16, 17, 18, 16, 11, 21, 18, 19, 16, + 22, 15, 21, 22, 14, 20, 15, 23, 22, 17, + 24, 23, 26, 18, 24, 23, 25, 15, 17, 19, + 27, 20, 20, 28, 29, 23, 25, 30, 31, 42, + 24, 37, 37, 42, 26, 29, 31, 44, 27, 37, + 40, 40, 46, 43, 28, 47, 30, 43, 40, 41, + + 41, 41, 41, 45, 48, 49, 50, 45, 52, 51, + 55, 48, 47, 51, 44, 54, 59, 51, 236, 46, + 52, 51, 50, 57, 53, 56, 55, 49, 53, 54, + 56, 56, 57, 58, 61, 60, 62, 59, 64, 65, + 63, 56, 60, 58, 61, 63, 64, 57, 62, 66, + 67, 68, 69, 71, 61, 68, 61, 76, 65, 75, + 71, 66, 67, 70, 70, 75, 70, 69, 73, 73, + 74, 74, 77, 78, 76, 79, 80, 82, 83, 84, + 85, 86, 87, 79, 89, 82, 77, 89, 86, 88, + 78, 90, 92, 91, 83, 94, 93, 80, 102, 88, + + 93, 95, 97, 96, 98, 99, 84, 85, 91, 95, + 87, 96, 98, 99, 101, 102, 100, 94, 90, 92, + 100, 104, 106, 97, 107, 108, 109, 112, 111, 118, + 115, 116, 117, 118, 126, 127, 101, 124, 126, 127, + 104, 109, 111, 116, 112, 115, 107, 108, 122, 117, + 106, 123, 124, 128, 130, 131, 122, 132, 135, 123, + 136, 132, 134, 128, 137, 134, 138, 139, 136, 130, + 140, 141, 131, 142, 135, 139, 144, 143, 140, 145, + 146, 147, 153, 151, 144, 156, 137, 138, 147, 154, + 152, 142, 143, 141, 145, 151, 152, 154, 157, 153, + + 158, 159, 146, 160, 161, 165, 166, 156, 157, 159, + 167, 168, 161, 165, 169, 170, 171, 172, 175, 177, + 173, 158, 167, 160, 171, 176, 168, 177, 178, 176, + 179, 166, 169, 172, 173, 175, 180, 181, 182, 184, + 178, 186, 170, 188, 194, 191, 195, 189, 198, 202, + 188, 231, 179, 180, 195, 199, 184, 181, 182, 189, + 203, 204, 205, 199, 203, 198, 186, 191, 212, 204, + 211, 202, 194, 211, 212, 213, 214, 212, 215, 216, + 212, 218, 205, 217, 219, 220, 221, 226, 222, 212, + 224, 214, 222, 229, 227, 215, 225, 230, 213, 218, + + 228, 216, 224, 217, 225, 220, 219, 230, 223, 226, + 221, 227, 233, 233, 210, 233, 234, 209, 234, 234, + 235, 235, 235, 235, 208, 207, 206, 201, 200, 197, + 196, 193, 192, 190, 187, 185, 183, 174, 164, 163, + 162, 155, 150, 149, 148, 133, 129, 125, 121, 120, + 119, 114, 113, 110, 105, 103, 81, 72, 39, 38, + 35, 33, 32, 13, 10, 9, 5, 3, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + + 232, 232, 232, 232, 232, 232 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int yy_flex_debug; +int yy_flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -473,9 +626,8 @@ static char *yy_last_accepting_cpos; #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "testpatternl.l" -#define INITIAL 0 /* - * "$Id: testpatternl.l,v 1.2.6.1 2002/07/23 00:54:08 rlk Exp $" + * "$Id: testpatternl.l,v 1.16 2004/04/14 02:21:21 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -510,13 +662,46 @@ char *yytext; int mylineno = 1; -#if 0 -#define DBG(x) fprintf(stderr, "'%s'%s\n", yytext, #x); -#else -#define DBG(x) +static char * +c_strstrip(char *s) +{ + size_t len = strlen(s); + if (len >= 2 && ((s[0] == '"' && s[len - 1] == '"') || + (s[0] == '\'' && s[len - 1] == '\''))) + { + char *sn = malloc(len - 1); + memcpy(sn, s + 1, len - 2); + sn[len - 2] = '\0'; + return sn; + } + else + return (char *) s; +} + +#define DBG(x) \ +do \ + { \ + if (getenv("STP_TESTPATTERN_DEBUG")) \ + fprintf(stderr, "'%s' => %s\n", yytext, #x); \ + } \ + while (0) + + +#line 691 "testpatternl.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> #endif -#line 520 "lex.yy.c" +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif /* Macros after this point can all be overridden by user definitions in * section 1. @@ -524,65 +709,30 @@ int mylineno = 1; #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int yywrap (void ); #else -extern int yywrap YY_PROTO(( void )); -#endif +extern int yywrap (void ); #endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif + static void yyunput (int c,char *buf_ptr ); + #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); +static int input (void ); #endif -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -591,7 +741,6 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -604,9 +753,10 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -616,9 +766,22 @@ YY_MALLOC_DECL YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -639,12 +802,18 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. @@ -661,27 +830,29 @@ YY_MALLOC_DECL #define YY_RULE_SETUP \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - -#line 54 "testpatternl.l" + +#line 73 "testpatternl.l" -#line 674 "lex.yy.c" +#line 845 "testpatternl.c" - if ( yy_init ) + if ( (yy_init) ) { - yy_init = 0; + (yy_init) = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; @@ -689,262 +860,344 @@ YY_DECL if ( ! yyout ) yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); /* Support of yytext. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 187 ) + if ( yy_current_state >= 233 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 212 ); + while ( yy_base[yy_current_state] != 469 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP -#line 56 "testpatternl.l" -DBG(C_GAMMA) return C_GAMMA; +#line 75 "testpatternl.l" +yylval.sval = yytext;DBG(CYAN); return CYAN; YY_BREAK case 2: YY_RULE_SETUP -#line 57 "testpatternl.l" -DBG(M_GAMMA) return M_GAMMA; +#line 76 "testpatternl.l" +yylval.sval = yytext;DBG(L_CYAN); return L_CYAN; YY_BREAK case 3: YY_RULE_SETUP -#line 58 "testpatternl.l" -DBG(Y_GAMMA) return Y_GAMMA; +#line 77 "testpatternl.l" +yylval.sval = yytext;DBG(MAGENTA); return MAGENTA; YY_BREAK case 4: YY_RULE_SETUP -#line 59 "testpatternl.l" -DBG(K_GAMMA) return K_GAMMA; +#line 78 "testpatternl.l" +yylval.sval = yytext;DBG(L_MAGENTA); return L_MAGENTA; YY_BREAK case 5: YY_RULE_SETUP -#line 60 "testpatternl.l" -DBG(GAMMA) return GAMMA; +#line 79 "testpatternl.l" +yylval.sval = yytext;DBG(YELLOW); return YELLOW; YY_BREAK case 6: YY_RULE_SETUP -#line 61 "testpatternl.l" -DBG(C_LEVEL) return C_LEVEL; +#line 80 "testpatternl.l" +yylval.sval = yytext;DBG(D_YELLOW); return D_YELLOW; YY_BREAK case 7: YY_RULE_SETUP -#line 62 "testpatternl.l" -DBG(M_LEVEL) return M_LEVEL; +#line 81 "testpatternl.l" +yylval.sval = yytext;DBG(BLACK); return BLACK; YY_BREAK case 8: YY_RULE_SETUP -#line 63 "testpatternl.l" -DBG(Y_LEVEL) return Y_LEVEL; +#line 82 "testpatternl.l" +yylval.sval = yytext;DBG(L_BLACK); return L_BLACK; YY_BREAK case 9: YY_RULE_SETUP -#line 64 "testpatternl.l" -DBG(LEVELS) return LEVELS; +#line 83 "testpatternl.l" +DBG(GAMMA); return GAMMA; YY_BREAK case 10: YY_RULE_SETUP -#line 65 "testpatternl.l" -DBG(INK_LIMIT) return INK_LIMIT; +#line 84 "testpatternl.l" +DBG(LEVEL); return LEVEL; YY_BREAK case 11: YY_RULE_SETUP -#line 66 "testpatternl.l" -DBG(WIDTH) return WIDTH; +#line 85 "testpatternl.l" +DBG(STEPS); return STEPS; YY_BREAK case 12: YY_RULE_SETUP -#line 67 "testpatternl.l" -DBG(PRINTER) return PRINTER; +#line 86 "testpatternl.l" +DBG(INK_LIMIT); return INK_LIMIT; YY_BREAK case 13: YY_RULE_SETUP -#line 68 "testpatternl.l" -DBG(INK_TYPE) return INK_TYPE; +#line 87 "testpatternl.l" +DBG(PRINTER); return PRINTER; YY_BREAK case 14: YY_RULE_SETUP -#line 69 "testpatternl.l" -DBG(RESOLUTION) return RESOLUTION; +#line 88 "testpatternl.l" +DBG(PARAMETER); return PARAMETER; YY_BREAK case 15: YY_RULE_SETUP -#line 70 "testpatternl.l" -DBG(MEDIA_SOURCE) return MEDIA_SOURCE; +#line 89 "testpatternl.l" +DBG(PARAMETER_INT); return PARAMETER_INT; YY_BREAK case 16: YY_RULE_SETUP -#line 71 "testpatternl.l" -DBG(MEDIA_TYPE) return MEDIA_TYPE; +#line 90 "testpatternl.l" +DBG(PARAMETER); return PARAMETER; YY_BREAK case 17: YY_RULE_SETUP -#line 72 "testpatternl.l" -DBG(MEDIA_SIZE) return MEDIA_SIZE; +#line 91 "testpatternl.l" +DBG(PARAMETER_FLOAT); return PARAMETER_FLOAT; YY_BREAK case 18: YY_RULE_SETUP -#line 73 "testpatternl.l" -DBG(DITHER_ALGORITHM) return DITHER_ALGORITHM; +#line 92 "testpatternl.l" +DBG(PARAMETER_CURVE); return PARAMETER_CURVE; YY_BREAK case 19: YY_RULE_SETUP -#line 74 "testpatternl.l" -DBG(DENSITY) return DENSITY; +#line 93 "testpatternl.l" +DBG(DENSITY); return DENSITY; YY_BREAK case 20: YY_RULE_SETUP -#line 75 "testpatternl.l" -DBG(TOP) return TOP; +#line 94 "testpatternl.l" +DBG(TOP); return TOP; YY_BREAK case 21: YY_RULE_SETUP -#line 76 "testpatternl.l" -DBG(LEFT) return LEFT; +#line 95 "testpatternl.l" +DBG(LEFT); return LEFT; YY_BREAK case 22: YY_RULE_SETUP -#line 77 "testpatternl.l" -DBG(HSIZE) return HSIZE; +#line 96 "testpatternl.l" +DBG(HSIZE); return HSIZE; YY_BREAK case 23: YY_RULE_SETUP -#line 78 "testpatternl.l" -DBG(VSIZE) return VSIZE; +#line 97 "testpatternl.l" +DBG(VSIZE); return VSIZE; YY_BREAK case 24: YY_RULE_SETUP -#line 79 "testpatternl.l" -DBG(BLACKLINE) return BLACKLINE; +#line 98 "testpatternl.l" +DBG(BLACKLINE); return BLACKLINE; YY_BREAK case 25: YY_RULE_SETUP -#line 80 "testpatternl.l" -DBG(PATTERN) return PATTERN; +#line 99 "testpatternl.l" +DBG(PATTERN); return PATTERN; YY_BREAK case 26: YY_RULE_SETUP -#line 81 "testpatternl.l" -DBG(IMAGE) return IMAGE; +#line 100 "testpatternl.l" +DBG(XPATTERN); return XPATTERN; YY_BREAK case 27: YY_RULE_SETUP -#line 83 "testpatternl.l" -yylval.ival = atoi(yytext); DBG(tINT) return tINT; +#line 101 "testpatternl.l" +DBG(IMAGE); return IMAGE; YY_BREAK case 28: YY_RULE_SETUP -#line 84 "testpatternl.l" -yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE) return tDOUBLE; +#line 102 "testpatternl.l" +DBG(EXTENDED); return EXTENDED; YY_BREAK case 29: YY_RULE_SETUP -#line 85 "testpatternl.l" -yylval.sval = c_strdup(yytext); DBG(tSTRING) return tSTRING; +#line 103 "testpatternl.l" +DBG(GRID); return GRID; YY_BREAK case 30: YY_RULE_SETUP -#line 86 "testpatternl.l" -DBG(whitespace1) /* Skip blanks/tabs */ +#line 104 "testpatternl.l" +DBG(CHANNEL); return CHANNEL; YY_BREAK case 31: YY_RULE_SETUP -#line 87 "testpatternl.l" -DBG(comment1) /* Skip comments */ +#line 105 "testpatternl.l" +DBG(PAGESIZE); return PAGESIZE; YY_BREAK case 32: YY_RULE_SETUP -#line 88 "testpatternl.l" -DBG(newline) mylineno++; +#line 106 "testpatternl.l" +DBG(SEMI); return SEMI; YY_BREAK case 33: YY_RULE_SETUP -#line 89 "testpatternl.l" +#line 107 "testpatternl.l" +DBG(MODE); return MODE; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 108 "testpatternl.l" +yylval.ival = CMYK;DBG(CMYK); return CMYK; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 109 "testpatternl.l" +yylval.ival = CMYK;DBG(KCMY); return KCMY; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 110 "testpatternl.l" +yylval.ival = RGB;DBG(RGB); return RGB; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 111 "testpatternl.l" +yylval.ival = RGB;DBG(CMY); return CMY; + YY_BREAK +case 38: +YY_RULE_SETUP +#line 112 "testpatternl.l" +yylval.ival = GRAY;DBG(GRAY); return GRAY; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 113 "testpatternl.l" +yylval.ival = GRAY;DBG(GRAY); return GRAY; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 114 "testpatternl.l" +yylval.ival = WHITE;DBG(WHITE); return WHITE; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 115 "testpatternl.l" +DBG(MESSAGE); return MESSAGE; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 116 "testpatternl.l" +DBG(END); return END; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 119 "testpatternl.l" +yylval.ival = atoi(yytext); DBG(tINT); return tINT; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 120 "testpatternl.l" +yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; + YY_BREAK +case 45: +/* rule 45 can match eol */ +YY_RULE_SETUP +#line 121 "testpatternl.l" +yylval.sval = c_strstrip(yytext); DBG(tSTRING); return tSTRING; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 122 "testpatternl.l" +DBG(whitespace); /* Skip blanks/tabs */ + YY_BREAK +case 47: +YY_RULE_SETUP +#line 123 "testpatternl.l" +DBG(comment); /* Skip comments */ + YY_BREAK +case 48: +/* rule 48 can match eol */ +YY_RULE_SETUP +#line 124 "testpatternl.l" +DBG(newline); mylineno++; + YY_BREAK +case 49: +YY_RULE_SETUP +#line 125 "testpatternl.l" ECHO; YY_BREAK -#line 922 "lex.yy.c" +#line 1175 "testpatternl.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -954,13 +1207,13 @@ case YY_STATE_EOF(INITIAL): * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -973,30 +1226,30 @@ case YY_STATE_EOF(INITIAL): yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1007,7 +1260,7 @@ case YY_STATE_EOF(INITIAL): * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1015,30 +1268,30 @@ case YY_STATE_EOF(INITIAL): else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -1049,8 +1302,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1059,21 +1311,20 @@ case YY_STATE_EOF(INITIAL): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1093,34 +1344,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -1133,8 +1380,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1144,35 +1390,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1180,152 +1426,137 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; - } - +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; + + yy_current_state = (yy_start); - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 187 ) + if ( yy_current_state >= 233 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 187 ) + if ( yy_current_state >= 233 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 186); + yy_is_jam = (yy_current_state == 232); return yy_is_jam ? 0 : yy_current_state; - } - +} -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { - int c; - *yy_c_buf_p = yy_hold_char; +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1339,16 +1570,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( yywrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1358,90 +1589,92 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +} +#endif /* ifndef YY_NO_INPUT */ - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); } + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1450,80 +1683,75 @@ int size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b,file ); return b; - } +} - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - + yyfree((void *) b->yy_ch_buf ); -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif + yyfree((void *) b ); +} -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -1540,29 +1768,121 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } +} +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); @@ -1576,47 +1896,42 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b ); return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) +{ + + return yy_scan_bytes(yy_str,strlen(yy_str) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; - buf = (char *) yy_flex_alloc( n ); + buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); @@ -1625,7 +1940,7 @@ int len; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -1635,78 +1950,17 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} /* Redefine yyless() so it works in section 3 code. */ @@ -1715,68 +1969,145 @@ char msg[]; do \ { \ /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; -/* Internal utility routines. */ + return 0; +} + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; - for ( i = 0; i < n; ++i ) + for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; - for ( n = 0; s[n]; ++n ) + for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *yyalloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *yyrealloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1785,23 +2116,25 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} -#if YY_MAIN -int main() - { - yylex(); - return 0; - } +#define YYTABLES_NAME "yytables" + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL #endif -#line 89 "testpatternl.l" +#line 125 "testpatternl.l" diff --git a/src/testpattern/testpatternl.l b/src/testpattern/testpatternl.l index b096d4c..96eb976 100644 --- a/src/testpattern/testpatternl.l +++ b/src/testpattern/testpatternl.l @@ -1,5 +1,5 @@ /* - * "$Id: testpatternl.l,v 1.2.6.1 2002/07/23 00:54:08 rlk Exp $" + * "$Id: testpatternl.l,v 1.16 2004/04/14 02:21:21 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -35,11 +35,30 @@ int mylineno = 1; -#if 0 -#define DBG(x) fprintf(stderr, "'%s'%s\n", yytext, #x); -#else -#define DBG(x) -#endif +static char * +c_strstrip(char *s) +{ + size_t len = strlen(s); + if (len >= 2 && ((s[0] == '"' && s[len - 1] == '"') || + (s[0] == '\'' && s[len - 1] == '\''))) + { + char *sn = malloc(len - 1); + memcpy(sn, s + 1, len - 2); + sn[len - 2] = '\0'; + return sn; + } + else + return (char *) s; +} + +#define DBG(x) \ +do \ + { \ + if (getenv("STP_TESTPATTERN_DEBUG")) \ + fprintf(stderr, "'%s' => %s\n", yytext, #x); \ + } \ + while (0) + %} @@ -48,41 +67,58 @@ int mylineno = 1; digit [0-9] integer [-+]?{digit}+ float [-+]?{digit}+(\.{digit}+)?([eE][-+]?{digit}+)? -string ([\"][^\"\n]+[\"])|([^ \t\n"]+) +string ([\"][^\"]+[\"])|([a-zA-Z0-9_][-a-zA-Z0-9_]*)|([\'][^\']*[\']) ws [ \t]+ %% -c_gamma DBG(C_GAMMA) return C_GAMMA; -m_gamma DBG(M_GAMMA) return M_GAMMA; -y_gamma DBG(Y_GAMMA) return Y_GAMMA; -k_gamma DBG(K_GAMMA) return K_GAMMA; -gamma DBG(GAMMA) return GAMMA; -c_level DBG(C_LEVEL) return C_LEVEL; -m_level DBG(M_LEVEL) return M_LEVEL; -y_level DBG(Y_LEVEL) return Y_LEVEL; -levels DBG(LEVELS) return LEVELS; -ink_limit DBG(INK_LIMIT) return INK_LIMIT; -width DBG(WIDTH) return WIDTH; -printer DBG(PRINTER) return PRINTER; -ink_type DBG(INK_TYPE) return INK_TYPE; -resolution DBG(RESOLUTION) return RESOLUTION; -media_source DBG(MEDIA_SOURCE) return MEDIA_SOURCE; -media_type DBG(MEDIA_TYPE) return MEDIA_TYPE; -media_size DBG(MEDIA_SIZE) return MEDIA_SIZE; -dither_algorithm DBG(DITHER_ALGORITHM) return DITHER_ALGORITHM; -density DBG(DENSITY) return DENSITY; -top DBG(TOP) return TOP; -left DBG(LEFT) return LEFT; -hsize DBG(HSIZE) return HSIZE; -vsize DBG(VSIZE) return VSIZE; -blackline DBG(BLACKLINE) return BLACKLINE; -pattern DBG(PATTERN) return PATTERN; -image DBG(IMAGE) return IMAGE; +cyan yylval.sval = yytext;DBG(CYAN); return CYAN; +l_cyan yylval.sval = yytext;DBG(L_CYAN); return L_CYAN; +magenta yylval.sval = yytext;DBG(MAGENTA); return MAGENTA; +l_magenta yylval.sval = yytext;DBG(L_MAGENTA); return L_MAGENTA; +yellow yylval.sval = yytext;DBG(YELLOW); return YELLOW; +d_yellow yylval.sval = yytext;DBG(D_YELLOW); return D_YELLOW; +black yylval.sval = yytext;DBG(BLACK); return BLACK; +l_black yylval.sval = yytext;DBG(L_BLACK); return L_BLACK; +gamma DBG(GAMMA); return GAMMA; +level DBG(LEVEL); return LEVEL; +steps DBG(STEPS); return STEPS; +ink_limit DBG(INK_LIMIT); return INK_LIMIT; +printer DBG(PRINTER); return PRINTER; +parameter DBG(PARAMETER); return PARAMETER; +parameter_int DBG(PARAMETER_INT); return PARAMETER_INT; +parameter_string DBG(PARAMETER); return PARAMETER; +parameter_float DBG(PARAMETER_FLOAT); return PARAMETER_FLOAT; +parameter_curve DBG(PARAMETER_CURVE); return PARAMETER_CURVE; +density DBG(DENSITY); return DENSITY; +top DBG(TOP); return TOP; +left DBG(LEFT); return LEFT; +hsize DBG(HSIZE); return HSIZE; +vsize DBG(VSIZE); return VSIZE; +blackline DBG(BLACKLINE); return BLACKLINE; +pattern DBG(PATTERN); return PATTERN; +xpattern DBG(XPATTERN); return XPATTERN; +image DBG(IMAGE); return IMAGE; +extended DBG(EXTENDED); return EXTENDED; +grid DBG(GRID); return GRID; +channel DBG(CHANNEL); return CHANNEL; +page_size DBG(PAGESIZE); return PAGESIZE; +; DBG(SEMI); return SEMI; +mode DBG(MODE); return MODE; +cmyk yylval.ival = CMYK;DBG(CMYK); return CMYK; +kcmy yylval.ival = CMYK;DBG(KCMY); return KCMY; +rgb yylval.ival = RGB;DBG(RGB); return RGB; +cmy yylval.ival = RGB;DBG(CMY); return CMY; +grey yylval.ival = GRAY;DBG(GRAY); return GRAY; +gray yylval.ival = GRAY;DBG(GRAY); return GRAY; +white yylval.ival = WHITE;DBG(WHITE); return WHITE; +message DBG(MESSAGE); return MESSAGE; +end DBG(END); return END; + -{integer} yylval.ival = atoi(yytext); DBG(tINT) return tINT; -{float} yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE) return tDOUBLE; -{string} yylval.sval = c_strdup(yytext); DBG(tSTRING) return tSTRING; -{ws} DBG(whitespace1) /* Skip blanks/tabs */ -#[^\n]* DBG(comment1) /* Skip comments */ -\n DBG(newline) mylineno++; +{integer} yylval.ival = atoi(yytext); DBG(tINT); return tINT; +{float} yylval.dval = strtod(yytext, NULL); DBG(tDOUBLE); return tDOUBLE; +{string} yylval.sval = c_strstrip(yytext); DBG(tSTRING); return tSTRING; +{ws} DBG(whitespace); /* Skip blanks/tabs */ +#[^\n]* DBG(comment); /* Skip comments */ +\n DBG(newline); mylineno++; diff --git a/src/testpattern/testpatterny.c b/src/testpattern/testpatterny.c index c6d3542..073282d 100644 --- a/src/testpattern/testpatterny.c +++ b/src/testpattern/testpatterny.c @@ -1,41 +1,153 @@ +/* A Bison parser, made by GNU Bison 1.875d. */ -/* A Bison parser, made from testpatterny.y - by GNU Bison version 1.25 - */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define tINT 258 -#define tDOUBLE 259 -#define tSTRING 260 -#define C_GAMMA 261 -#define M_GAMMA 262 -#define Y_GAMMA 263 -#define K_GAMMA 264 -#define GAMMA 265 -#define C_LEVEL 266 -#define M_LEVEL 267 -#define Y_LEVEL 268 -#define LEVELS 269 -#define INK_LIMIT 270 -#define INK 271 -#define WIDTH 272 -#define PRINTER 273 -#define INK_TYPE 274 -#define RESOLUTION 275 -#define MEDIA_SOURCE 276 -#define MEDIA_TYPE 277 -#define MEDIA_SIZE 278 -#define DITHER_ALGORITHM 279 -#define DENSITY 280 -#define TOP 281 -#define LEFT 282 -#define HSIZE 283 -#define VSIZE 284 -#define BLACKLINE 285 -#define PATTERN 286 -#define IMAGE 287 +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tINT = 258, + tDOUBLE = 259, + tSTRING = 260, + CYAN = 261, + L_CYAN = 262, + MAGENTA = 263, + L_MAGENTA = 264, + YELLOW = 265, + D_YELLOW = 266, + BLACK = 267, + L_BLACK = 268, + GAMMA = 269, + LEVEL = 270, + STEPS = 271, + INK_LIMIT = 272, + PRINTER = 273, + PARAMETER = 274, + PARAMETER_INT = 275, + PARAMETER_FLOAT = 276, + PARAMETER_CURVE = 277, + DENSITY = 278, + TOP = 279, + LEFT = 280, + HSIZE = 281, + VSIZE = 282, + BLACKLINE = 283, + PATTERN = 284, + XPATTERN = 285, + EXTENDED = 286, + IMAGE = 287, + GRID = 288, + SEMI = 289, + CHANNEL = 290, + CMYK = 291, + KCMY = 292, + RGB = 293, + CMY = 294, + GRAY = 295, + WHITE = 296, + RAW = 297, + MODE = 298, + PAGESIZE = 299, + MESSAGE = 300, + END = 301 + }; +#endif +#define tINT 258 +#define tDOUBLE 259 +#define tSTRING 260 +#define CYAN 261 +#define L_CYAN 262 +#define MAGENTA 263 +#define L_MAGENTA 264 +#define YELLOW 265 +#define D_YELLOW 266 +#define BLACK 267 +#define L_BLACK 268 +#define GAMMA 269 +#define LEVEL 270 +#define STEPS 271 +#define INK_LIMIT 272 +#define PRINTER 273 +#define PARAMETER 274 +#define PARAMETER_INT 275 +#define PARAMETER_FLOAT 276 +#define PARAMETER_CURVE 277 +#define DENSITY 278 +#define TOP 279 +#define LEFT 280 +#define HSIZE 281 +#define VSIZE 282 +#define BLACKLINE 283 +#define PATTERN 284 +#define XPATTERN 285 +#define EXTENDED 286 +#define IMAGE 287 +#define GRID 288 +#define SEMI 289 +#define CHANNEL 290 +#define CMYK 291 +#define KCMY 292 +#define RGB 293 +#define CMY 294 +#define GRAY 295 +#define WHITE 296 +#define RAW 297 +#define MODE 298 +#define PAGESIZE 299 +#define MESSAGE 300 +#define END 301 + + + + +/* Copy the first part of user declarations. */ #line 23 "testpatterny.y" @@ -54,7 +166,6 @@ extern int yylex(void); char *quotestrip(const char *i); char *endstrip(const char *i); -extern int mylineno; extern char* yytext; static int yyerror( const char *s ) @@ -63,464 +174,925 @@ static int yyerror( const char *s ) return 0; } -#include <stdio.h> +typedef struct +{ + const char *name; + int channel; +} color_t; + +static color_t color_map[] = + { + { "black", 0 }, + { "cyan", 1 }, + { "red", 1 }, + { "magenta", 2 }, + { "green", 2 }, + { "yellow", 3 }, + { "blue", 3 }, + { "l_black", 4 }, + { "l_cyan", 5 }, + { "l_magenta", 6 }, + { "d_yellow", 4 }, + { NULL, -1 } + }; + +static int current_index = 0; +static testpattern_t *current_testpattern; +extern FILE *yyin; + +static int +find_color(const char *name) +{ + int i = 0; + while (color_map[i].name) + { + if (strcmp(color_map[i].name, name) == 0) + return color_map[i].channel; + i++; + } + return -1; +} -#ifndef __cplusplus -#ifndef __STDC__ -#define const + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 #endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 #endif +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif -#define YYFINAL 103 -#define YYFLAG -32768 -#define YYNTBASE 33 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 287 ? yytranslate[x] : 65) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32 -}; -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, - 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, - 60, 63, 66, 69, 88, 92, 93, 95, 97, 99, - 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, - 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, - 142, 144, 146, 149, 151, 153, 155 -}; +/* Copy the second part of user declarations. */ -static const short yyrhs[] = { 11, - 4, 0, 12, 4, 0, 13, 4, 0, 6, 4, - 0, 7, 4, 0, 8, 4, 0, 9, 4, 0, - 10, 4, 0, 14, 3, 0, 15, 4, 0, 18, - 5, 0, 19, 5, 0, 20, 5, 0, 21, 5, - 0, 22, 5, 0, 23, 5, 0, 24, 5, 0, - 25, 4, 0, 26, 4, 0, 27, 4, 0, 28, - 4, 0, 29, 4, 0, 30, 3, 0, 31, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 0, 32, 3, 3, - 0, 0, 33, 0, 34, 0, 35, 0, 36, 0, - 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, - 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, - 47, 0, 48, 0, 49, 0, 50, 0, 51, 0, - 52, 0, 53, 0, 54, 0, 55, 0, 60, 56, - 0, 58, 0, 57, 0, 62, 59, 0, 58, 0, - 60, 0, 61, 0, 62, 63, 58, 0 -}; -#endif +/* Line 214 of yacc.c. */ +#line 245 "testpatterny.c" -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, - 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, - 147, 150, 153, 157, 183, 197, 199, 199, 199, 200, - 200, 200, 200, 201, 201, 201, 201, 201, 201, 202, - 202, 202, 202, 202, 203, 203, 203, 203, 203, 205, - 205, 207, 209, 209, 211, 211, 213 -}; -#endif +#if ! defined (yyoverflow) || YYERROR_VERBOSE +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# endif +# else +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined (__GNUC__) && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) -static const char * const yytname[] = { "$","error","$undefined.","tINT","tDOUBLE", -"tSTRING","C_GAMMA","M_GAMMA","Y_GAMMA","K_GAMMA","GAMMA","C_LEVEL","M_LEVEL", -"Y_LEVEL","LEVELS","INK_LIMIT","INK","WIDTH","PRINTER","INK_TYPE","RESOLUTION", -"MEDIA_SOURCE","MEDIA_TYPE","MEDIA_SIZE","DITHER_ALGORITHM","DENSITY","TOP", -"LEFT","HSIZE","VSIZE","BLACKLINE","PATTERN","IMAGE","global_c_level","global_m_level", -"global_y_level","global_c_gamma","global_m_gamma","global_y_gamma","global_k_gamma", -"global_gamma","levels","ink_limit","printer","ink_type","resolution","media_source", -"media_type","media_size","dither_algorithm","density","top","left","hsize", -"vsize","blackline","pattern","image","Empty","Rule","Patterns","Image","Rules", -"Output","Thing", NULL -}; #endif -static const short yyr1[] = { 0, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 60, - 60, 61, 62, 62, 63, 63, 64 -}; +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif -static const short yyr2[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 18, 3, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 2, 1, 1, 1, 3 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 52 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 131 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 47 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 65 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 115 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 170 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 301 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46 }; -static const short yydefact[] = { 26, - 54, 26, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 52, - 51, 53, 55, 56, 26, 4, 5, 6, 7, 8, - 1, 2, 3, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 0, 0, - 50, 57, 25, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, - 0, 0, 0 +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short int yyprhs[] = +{ + 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, + 19, 22, 25, 28, 31, 34, 37, 41, 43, 45, + 47, 49, 51, 53, 55, 58, 62, 66, 70, 74, + 77, 80, 83, 86, 89, 93, 95, 97, 101, 105, + 109, 111, 113, 115, 118, 121, 124, 127, 130, 133, + 137, 139, 142, 143, 145, 148, 153, 159, 161, 163, + 165, 168, 169, 171, 173, 175, 181, 185, 188, 191, + 195, 198, 202, 207, 213, 220, 222, 224, 226, 228, + 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, + 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, + 271, 273, 275, 277, 279, 282, 283, 286, 288, 289, + 292, 294, 296, 297, 300, 301 }; -static const short yydefgoto[] = { 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 81, 50, 1, 52, 53, 54, 2, 55, - 101 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 110, 0, -1, 6, -1, 7, -1, 8, -1, 9, + -1, 10, -1, 11, -1, 12, -1, 13, -1, 36, + 3, -1, 37, 3, -1, 38, 3, -1, 39, 3, + -1, 40, 3, -1, 41, 3, -1, 31, 3, 3, + -1, 49, -1, 50, -1, 51, -1, 52, -1, 53, + -1, 54, -1, 55, -1, 43, 56, -1, 15, 48, + 4, -1, 15, 3, 4, -1, 14, 48, 4, -1, + 14, 3, 4, -1, 14, 4, -1, 16, 3, -1, + 17, 4, -1, 18, 5, -1, 44, 5, -1, 44, + 3, 3, -1, 66, -1, 67, -1, 19, 5, 5, + -1, 20, 5, 3, -1, 21, 5, 4, -1, 69, + -1, 70, -1, 71, -1, 23, 4, -1, 24, 4, + -1, 25, 4, -1, 26, 4, -1, 27, 4, -1, + 28, 3, -1, 4, 4, 4, -1, 79, -1, 80, + 79, -1, -1, 80, -1, 79, 81, -1, 48, 4, + 4, 4, -1, 35, 3, 4, 4, 4, -1, 83, + -1, 84, -1, 85, -1, 86, 85, -1, -1, 86, + -1, 82, -1, 87, -1, 4, 4, 4, 4, 4, + -1, 29, 89, 88, -1, 30, 88, -1, 33, 3, + -1, 32, 3, 3, -1, 45, 5, -1, 45, 5, + 5, -1, 45, 5, 5, 5, -1, 45, 5, 5, + 5, 5, -1, 45, 5, 5, 5, 5, 5, -1, + 94, -1, 95, -1, 96, -1, 97, -1, 98, -1, + 99, -1, 60, -1, 61, -1, 58, -1, 59, -1, + 62, -1, 63, -1, 64, -1, 65, -1, 72, -1, + 73, -1, 74, -1, 75, -1, 76, -1, 77, -1, + 78, -1, 57, -1, 68, -1, 100, -1, 101, 34, + -1, 90, -1, 91, -1, 92, -1, 100, -1, 103, + 34, -1, -1, 105, 104, -1, 93, -1, -1, 107, + 102, -1, 105, -1, 106, -1, -1, 46, 34, -1, + -1, 107, 111, 108, 109, -1 }; -static const short yypact[] = {-32768, --32768, -5, 7, 8, 22, 24, 25, 26, 27, 28, - 30, 31, 29, 32, 33, 34, 35, 36, 37, 39, - 40, 41, 42, 43, 45, 46,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 5,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 47, 48, --32768,-32768,-32768, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65,-32768, - 70, 71,-32768 +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 139, 139, 139, 139, 139, 140, 140, 140, 140, + 143, 155, 167, 179, 191, 203, 215, 227, 227, 227, + 227, 227, 227, 227, 230, 233, 243, 252, 262, 271, + 278, 285, 292, 301, 310, 319, 319, 322, 332, 341, + 364, 364, 364, 366, 373, 380, 387, 394, 401, 409, + 424, 424, 427, 427, 430, 433, 447, 460, 460, 463, + 463, 466, 466, 469, 469, 472, 487, 490, 505, 516, + 533, 539, 546, 554, 563, 574, 574, 574, 574, 574, + 577, 580, 580, 580, 580, 580, 580, 581, 581, 581, + 581, 581, 581, 581, 582, 582, 582, 582, 582, 585, + 589, 589, 589, 589, 592, 596, 596, 599, 603, 603, + 606, 606, 609, 609, 614, 613 }; +#endif -static const short yypgoto[] = {-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768, -2,-32768,-32768,-32768,-32768,-32768, --32768 +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "tINT", "tDOUBLE", "tSTRING", "CYAN", + "L_CYAN", "MAGENTA", "L_MAGENTA", "YELLOW", "D_YELLOW", "BLACK", + "L_BLACK", "GAMMA", "LEVEL", "STEPS", "INK_LIMIT", "PRINTER", + "PARAMETER", "PARAMETER_INT", "PARAMETER_FLOAT", "PARAMETER_CURVE", + "DENSITY", "TOP", "LEFT", "HSIZE", "VSIZE", "BLACKLINE", "PATTERN", + "XPATTERN", "EXTENDED", "IMAGE", "GRID", "SEMI", "CHANNEL", "CMYK", + "KCMY", "RGB", "CMY", "GRAY", "WHITE", "RAW", "MODE", "PAGESIZE", + "MESSAGE", "END", "$accept", "COLOR", "cmykspec", "kcmyspec", "rgbspec", + "cmyspec", "grayspec", "whitespec", "extendedspec", "modespec", + "inputspec", "level", "channel_level", "gamma", "channel_gamma", + "global_gamma", "steps", "ink_limit", "printer", "page_size_name", + "page_size_custom", "page_size", "parameter_string", "parameter_int", + "parameter_float", "parameter", "density", "top", "left", "hsize", + "vsize", "blackline", "color_block1", "color_blocks1a", "color_blocks1b", + "color_blocks1", "color_block2a", "color_block2b", "color_block2", + "color_blocks2a", "color_blocks2", "color_blocks", "patvars", "pattern", + "xpattern", "grid", "image", "Message0", "Message1", "Message2", + "Message3", "Message4", "A_Message", "message", "A_Rule", "Rule", + "A_Pattern", "Pattern", "Patterns", "Image", "Rules", "Output", "EOF", + "Thing", "@1", 0 }; +#endif +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301 +}; +# endif -#define YYLAST 71 - +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 47, 48, 48, 48, 48, 48, 48, 48, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 56, 56, + 56, 56, 56, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 68, 69, 70, 71, + 72, 72, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 80, 81, 81, 82, 83, 84, 85, 85, 86, + 86, 87, 87, 88, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 99, 99, 99, 99, + 100, 101, 101, 101, 101, 101, 101, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, + 103, 103, 103, 103, 104, 105, 105, 106, 107, 107, + 108, 108, 109, 109, 111, 110 +}; -static const short yytable[] = { 51, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 56, 57, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 58, 26, 59, 60, 61, - 62, 63, 64, 66, 65, 80, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 83, - 0, 84, 82, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 102, - 103 +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, + 1, 1, 1, 1, 2, 3, 3, 3, 3, 2, + 2, 2, 2, 2, 3, 1, 1, 3, 3, 3, + 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, + 1, 2, 0, 1, 2, 4, 5, 1, 1, 1, + 2, 0, 1, 1, 1, 5, 3, 2, 2, 3, + 2, 3, 4, 5, 6, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 2, 0, 2, 1, 0, 2, + 1, 1, 0, 2, 0, 4 }; -static const short yycheck[] = { 2, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 4, 4, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 4, 32, 4, 4, 4, - 4, 4, 3, 5, 4, 31, 5, 5, 5, 5, - 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, - -1, 4, 55, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, - 0 +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 108, 114, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 96, 83, 84, 81, 82, 85, 86, 87, 88, 35, + 36, 97, 40, 41, 42, 89, 90, 91, 92, 93, + 94, 95, 75, 76, 77, 78, 79, 80, 98, 0, + 109, 105, 1, 0, 29, 2, 3, 4, 5, 6, + 7, 8, 9, 0, 0, 0, 30, 31, 32, 0, + 0, 0, 43, 44, 45, 46, 47, 48, 0, 0, + 0, 0, 0, 0, 0, 17, 18, 19, 20, 21, + 22, 23, 24, 0, 33, 70, 99, 0, 107, 110, + 111, 112, 28, 27, 26, 25, 37, 38, 39, 0, + 10, 11, 12, 13, 14, 15, 34, 71, 0, 0, + 61, 0, 100, 101, 102, 103, 0, 106, 0, 115, + 16, 72, 69, 0, 61, 0, 0, 0, 52, 63, + 57, 58, 59, 62, 64, 67, 68, 104, 113, 73, + 0, 66, 0, 0, 0, 50, 53, 54, 60, 74, + 0, 49, 0, 0, 51, 0, 0, 55, 65, 56 }; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = +{ + -1, 137, 85, 86, 87, 88, 89, 90, 91, 92, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 138, 156, 157, 139, 140, 141, 142, 143, + 144, 145, 134, 122, 123, 124, 98, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 126, 127, 99, 100, + 1, 101, 129, 2, 51 +}; - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -131 +static const short int yypact[] = +{ + -131, -14, 16, 56, 41, 25, 36, 38, 53, 66, + 67, 69, 70, 77, 78, 79, 81, 39, 22, 80, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, 54, + -131, 55, -131, 82, -131, -131, -131, -131, -131, -131, + -131, -131, -131, 85, 86, 87, -131, -131, -131, 88, + 89, 90, -131, -131, -131, -131, -131, -131, 92, 93, + 94, 95, 96, 97, 98, -131, -131, -131, -131, -131, + -131, -131, -131, 99, -131, 100, -131, 101, -131, 12, + -131, 57, -131, -131, -131, -131, -131, -131, -131, 103, + -131, -131, -131, -131, -131, -131, -131, 102, 105, 106, + 11, 108, -131, -131, -131, -131, 75, -131, 83, -131, + -131, 107, -131, 109, 11, 110, 112, 114, 115, -131, + -131, -131, -131, 26, -131, -131, -131, -131, -131, 111, + 116, -131, 117, 118, 119, -131, 115, -131, -131, -131, + 120, -131, 121, 122, -131, 123, 124, -131, -131, -131 +}; - 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. +/* YYPGOTO[NTERM-NUM]. */ +static const short int yypgoto[] = +{ + -131, 52, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -130, -131, -131, -131, -131, -131, -13, -131, + -131, -5, -131, -131, -131, -131, -131, -131, -131, -131, + -131, -131, -131, 32, -131, -131, -131, -131, -131, -131, + -131, -131, -131, -131, -131 +}; - 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const unsigned char yytable[] = +{ + 3, 4, 5, 6, 7, 8, 9, 10, 155, 11, + 12, 13, 14, 15, 16, 135, 52, 55, 56, 57, + 58, 59, 60, 61, 62, 93, 164, 94, 66, 17, + 18, 19, 55, 56, 57, 58, 59, 60, 61, 62, + 67, 119, 120, 68, 64, 121, 136, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 65, 19, 69, 53, + 54, 136, 55, 56, 57, 58, 59, 60, 61, 62, + 78, 70, 71, 72, 73, 79, 80, 81, 82, 83, + 84, 74, 75, 76, 77, 95, 102, 97, 96, 103, + 104, 105, 107, 106, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 128, 118, 117, 130, 131, 132, 147, + 133, 146, 149, 150, 152, 153, 159, 148, 154, 135, + 160, 161, 162, 163, 165, 166, 167, 168, 169, 151, + 158, 125 +}; -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +static const unsigned char yycheck[] = +{ + 14, 15, 16, 17, 18, 19, 20, 21, 138, 23, + 24, 25, 26, 27, 28, 4, 0, 6, 7, 8, + 9, 10, 11, 12, 13, 3, 156, 5, 3, 43, + 44, 45, 6, 7, 8, 9, 10, 11, 12, 13, + 4, 29, 30, 5, 3, 33, 35, 6, 7, 8, + 9, 10, 11, 12, 13, 3, 4, 45, 5, 3, + 4, 35, 6, 7, 8, 9, 10, 11, 12, 13, + 31, 5, 5, 4, 4, 36, 37, 38, 39, 40, + 41, 4, 4, 4, 3, 5, 4, 32, 34, 4, + 4, 4, 3, 5, 4, 3, 3, 3, 3, 3, + 3, 3, 3, 46, 3, 5, 3, 5, 3, 34, + 4, 3, 5, 4, 4, 3, 5, 34, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 134, + 143, 99 +}; -#ifndef alloca -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) -#include <alloca.h> -#else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) -#include <malloc.h> -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -#include <malloc.h> - #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#ifdef __cplusplus -extern "C" { -void *alloca (unsigned int); +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 107, 110, 14, 15, 16, 17, 18, 19, 20, + 21, 23, 24, 25, 26, 27, 28, 43, 44, 45, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 111, 0, 3, 4, 6, 7, 8, 9, 10, + 11, 12, 13, 48, 3, 48, 3, 4, 5, 5, + 5, 5, 4, 4, 4, 4, 4, 3, 31, 36, + 37, 38, 39, 40, 41, 49, 50, 51, 52, 53, + 54, 55, 56, 3, 5, 5, 34, 32, 93, 105, + 106, 108, 4, 4, 4, 4, 5, 3, 4, 3, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 29, + 30, 33, 90, 91, 92, 100, 103, 104, 46, 109, + 3, 5, 3, 4, 89, 4, 35, 48, 79, 82, + 83, 84, 85, 86, 87, 88, 3, 34, 34, 5, + 4, 88, 4, 3, 4, 79, 80, 81, 85, 5, + 4, 4, 4, 4, 79, 4, 4, 4, 4, 4 }; -#else /* not __cplusplus */ -void *alloca (); -#endif /* not __cplusplus */ -#endif /* __hpux */ -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#endif /* alloca not defined. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 +#define YYEMPTY (-2) #define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ + +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX yylex() -#endif +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + ((Current).first_line = (Rhs)[1].first_line, \ + (Current).first_column = (Rhs)[1].first_column, \ + (Current).last_line = (Rhs)[N].last_line, \ + (Current).last_column = (Rhs)[N].last_column) #endif -#else /* not YYLSP_NEEDED */ + +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +# define YYLEX yylex (YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +# define YYLEX yylex () #endif -#endif /* not YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here */ -#ifndef YYPURE +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; #endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif -/* YYINITDEPTH indicates the initial size of the parser's stacks */ +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH +#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 +# undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif -#ifndef YYPARSE_RETURN_TYPE -#define YYPARSE_RETURN_TYPE int -#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# endif +# endif + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -YYPARSE_RETURN_TYPE yyparse (void); -#endif -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else static void -__yy_memcpy (to, from, count) - char *to; - char *from; - int count; +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif { - register char *f = from; - register char *t = to; - register int i = count; + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - while (i-- > 0) - *t++ = *f++; + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); } -#else /* __cplusplus */ +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (int yytype, YYSTYPE *yyvaluep) +#else static void -__yy_memcpy (char *to, char *from, int count) +yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; +#endif { - register char *f = from; - register char *t = to; - register int i = count; + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { - while (i-- > 0) - *t++ = *f++; + default: + break; + } } + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int yyparse (void); +#else +int yyparse (); #endif -#endif - -#line 196 "/usr/share/bison.simple" +#endif /* ! YYPARSE_PARAM */ + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ + +/*----------. +| yyparse. | +`----------*/ #ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -YYPARSE_RETURN_TYPE -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif { + register int yystate; register int yyn; - register short *yyssp; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else #define YYPOPSTACK (yyvsp--, yyssp--) -#endif - int yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize = YYINITDEPTH; -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ int yylen; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -532,96 +1104,97 @@ yyparse(YYPARSE_PARAM_ARG) so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - *++yyssp = yystate; + goto yysetstate; - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short int *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); -#endif + + { + short int *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ @@ -630,460 +1203,784 @@ yynewstate: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) + if (yyn <= 0) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; yystate = yyn; goto yynewstate; -/* Do the default action for the current state. */ -yydefault: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; + -/* Do a reduction. yyn is the number of a rule to reduce with. */ +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ -#if YYDEBUG != 0 - if (yydebug) + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 10: +#line 144 "testpatterny.y" { - int i; + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>cmykspec %d\n", yyvsp[0].ival); + global_image_type = "CMYK"; + global_channel_depth = 4; + global_invert_data = 0; + if (yyvsp[0].ival == 8 || yyvsp[0].ival == 16) + global_bit_depth = yyvsp[0].ival; + } + break; - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + case 11: +#line 156 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>kcmyspec %d\n", yyvsp[0].ival); + global_image_type = "KCMY"; + global_channel_depth = 4; + global_invert_data = 0; + if (yyvsp[0].ival == 8 || yyvsp[0].ival == 16) + global_bit_depth = yyvsp[0].ival; + } + break; - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif + case 12: +#line 168 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>rgbspec %d\n", yyvsp[0].ival); + global_image_type = "RGB"; + global_channel_depth = 3; + global_invert_data = 1; + if (yyvsp[0].ival == 8 || yyvsp[0].ival == 16) + global_bit_depth = yyvsp[0].ival; + } + break; + case 13: +#line 180 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>cmyspec %d\n", yyvsp[0].ival); + global_image_type = "CMY"; + global_channel_depth = 3; + global_invert_data = 0; + if (yyvsp[0].ival == 8 || yyvsp[0].ival == 16) + global_bit_depth = yyvsp[0].ival; + } + break; - switch (yyn) { - -case 1: -#line 88 "testpatterny.y" -{ global_c_level = yyvsp[0].dval; ; - break;} -case 2: -#line 91 "testpatterny.y" -{ global_m_level = yyvsp[0].dval; ; - break;} -case 3: -#line 94 "testpatterny.y" -{ global_y_level = yyvsp[0].dval; ; - break;} -case 4: -#line 97 "testpatterny.y" -{ global_c_gamma = yyvsp[0].dval; ; - break;} -case 5: -#line 100 "testpatterny.y" -{ global_m_gamma = yyvsp[0].dval; ; - break;} -case 6: -#line 103 "testpatterny.y" -{ global_y_gamma = yyvsp[0].dval; ; - break;} -case 7: -#line 106 "testpatterny.y" -{ global_k_gamma = yyvsp[0].dval; ; - break;} -case 8: -#line 109 "testpatterny.y" -{ global_gamma = yyvsp[0].dval; ; - break;} -case 9: -#line 112 "testpatterny.y" -{ levels = yyvsp[0].ival; ; - break;} -case 10: -#line 115 "testpatterny.y" -{ ink_limit = yyvsp[0].dval; ; - break;} -case 11: -#line 118 "testpatterny.y" -{ printer = c_strdup(yyvsp[0].sval); ; - break;} -case 12: -#line 121 "testpatterny.y" -{ ink_type = c_strdup(yyvsp[0].sval); ; - break;} -case 13: -#line 124 "testpatterny.y" -{ resolution = c_strdup(yyvsp[0].sval); ; - break;} -case 14: -#line 127 "testpatterny.y" -{ media_source = c_strdup(yyvsp[0].sval); ; - break;} -case 15: -#line 130 "testpatterny.y" -{ media_type = c_strdup(yyvsp[0].sval); ; - break;} -case 16: -#line 133 "testpatterny.y" -{ media_size = c_strdup(yyvsp[0].sval); ; - break;} -case 17: -#line 136 "testpatterny.y" -{ dither_algorithm = c_strdup(yyvsp[0].sval); ; - break;} -case 18: -#line 139 "testpatterny.y" -{ density = yyvsp[0].dval; ; - break;} -case 19: -#line 142 "testpatterny.y" -{ xtop = yyvsp[0].dval; ; - break;} -case 20: -#line 145 "testpatterny.y" -{ xleft = yyvsp[0].dval; ; - break;} -case 21: -#line 148 "testpatterny.y" -{ hsize = yyvsp[0].dval; ; - break;} -case 22: -#line 151 "testpatterny.y" -{ vsize = yyvsp[0].dval; ; - break;} -case 23: -#line 154 "testpatterny.y" -{ noblackline = !(yyvsp[0].ival); ; - break;} -case 24: -#line 160 "testpatterny.y" -{ - testpattern_t *t = get_next_testpattern(); - t->t = E_PATTERN; - t->d.p.c_min = yyvsp[-16].dval; - t->d.p.c = yyvsp[-15].dval; - t->d.p.c_gamma = yyvsp[-14].dval; - t->d.p.m_min = yyvsp[-13].dval; - t->d.p.m = yyvsp[-12].dval; - t->d.p.m_gamma = yyvsp[-11].dval; - t->d.p.y_min = yyvsp[-10].dval; - t->d.p.y = yyvsp[-9].dval; - t->d.p.y_gamma = yyvsp[-8].dval; - t->d.p.k_min = yyvsp[-7].dval; - t->d.p.k = yyvsp[-6].dval; - t->d.p.k_gamma = yyvsp[-5].dval; - t->d.p.c_level = yyvsp[-4].dval; - t->d.p.m_level = yyvsp[-3].dval; - t->d.p.y_level = yyvsp[-2].dval; - t->d.p.lower = yyvsp[-1].dval; - t->d.p.upper = yyvsp[0].dval; - ; - break;} -case 25: -#line 184 "testpatterny.y" -{ - testpattern_t *t = get_next_testpattern(); - t->t = E_IMAGE; - t->d.i.x = yyvsp[-1].ival; - t->d.i.y = yyvsp[0].ival; - if (t->d.i.x <= 0 || t->d.i.y <= 0) + case 14: +#line 192 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>grayspec %d\n", yyvsp[0].ival); + global_image_type = "Grayscale"; + global_channel_depth = 1; + global_invert_data = 0; + if (yyvsp[0].ival == 8 || yyvsp[0].ival == 16) + global_bit_depth = yyvsp[0].ival; + } + break; + + case 15: +#line 204 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>whitespec %d\n", yyvsp[0].ival); + global_image_type = "Whitescale"; + global_channel_depth = 1; + global_invert_data = 1; + if (yyvsp[0].ival == 8 || yyvsp[0].ival == 16) + global_bit_depth = yyvsp[0].ival; + } + break; + + case 16: +#line 216 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>extendedspec %d\n", yyvsp[-1].ival); + global_image_type = "Raw"; + global_invert_data = 0; + global_channel_depth = yyvsp[-1].ival; + if (yyvsp[-1].ival == 8 || yyvsp[-1].ival == 16) + global_bit_depth = yyvsp[0].ival; + } + break; + + case 25: +#line 234 "testpatterny.y" + { + int channel = find_color(yyvsp[-1].sval); + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>level %s %f\n", yyvsp[-1].sval, yyvsp[0].dval); + if (channel >= 0) + global_levels[channel] = yyvsp[0].dval; + } + break; + + case 26: +#line 244 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>channel_level %d %f\n", yyvsp[-1].ival, yyvsp[0].dval); + if (yyvsp[-1].ival >= 0 && yyvsp[-1].ival <= STP_CHANNEL_LIMIT) + global_levels[yyvsp[-1].ival] = yyvsp[0].dval; + } + break; + + case 27: +#line 253 "testpatterny.y" + { + int channel = find_color(yyvsp[-1].sval); + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>gamma %s %f\n", yyvsp[-1].sval, yyvsp[0].dval); + if (channel >= 0) + global_gammas[channel] = yyvsp[0].dval; + } + break; + + case 28: +#line 263 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>channel_gamma %d %f\n", yyvsp[-1].ival, yyvsp[0].dval); + if (yyvsp[-1].ival >= 0 && yyvsp[-1].ival <= STP_CHANNEL_LIMIT) + global_gammas[yyvsp[-1].ival] = yyvsp[0].dval; + } + break; + + case 29: +#line 272 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>global_gamma %f\n", yyvsp[0].dval); + global_gamma = yyvsp[0].dval; + } + break; + + case 30: +#line 279 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>steps %d\n", yyvsp[0].ival); + global_steps = yyvsp[0].ival; + } + break; + + case 31: +#line 286 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>ink_limit %f\n", yyvsp[0].dval); + global_ink_limit = yyvsp[0].dval; + } + break; + + case 32: +#line 293 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>printer %s\n", yyvsp[0].sval); + global_printer = strdup(yyvsp[0].sval); + free(yyvsp[0].sval); + } + break; + + case 33: +#line 302 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>page_size_name %s\n", yyvsp[0].sval); + stp_set_string_parameter(global_vars, "PageSize", yyvsp[0].sval); + free(yyvsp[0].sval); + } + break; + + case 34: +#line 311 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>page_size_custom %d %d\n", yyvsp[-1].ival, yyvsp[0].ival); + stp_set_page_width(global_vars, yyvsp[-1].ival); + stp_set_page_height(global_vars, yyvsp[0].ival); + } + break; + + case 37: +#line 323 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>parameter_string %s %s\n", yyvsp[-1].sval, yyvsp[0].sval); + stp_set_string_parameter(global_vars, yyvsp[-1].sval, yyvsp[0].sval); + free(yyvsp[-1].sval); + free(yyvsp[0].sval); + } + break; + + case 38: +#line 333 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>parameter_int %s %d\n", yyvsp[-1].sval, yyvsp[0].ival); + stp_set_int_parameter(global_vars, yyvsp[-1].sval, yyvsp[0].ival); + free(yyvsp[-1].sval); + } + break; + + case 39: +#line 342 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>parameter_float %s %f\n", yyvsp[-1].sval, yyvsp[0].dval); + stp_set_float_parameter(global_vars, yyvsp[-1].sval, yyvsp[0].dval); + free(yyvsp[-1].sval); + } + break; + + case 43: +#line 367 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>density %f\n", yyvsp[0].dval); + global_density = yyvsp[0].dval; + } + break; + + case 44: +#line 374 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>top %f\n", yyvsp[0].dval); + global_xtop = yyvsp[0].dval; + } + break; + + case 45: +#line 381 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>left %f\n", yyvsp[0].dval); + global_xleft = yyvsp[0].dval; + } + break; + + case 46: +#line 388 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>hsize %f\n", yyvsp[0].dval); + global_hsize = yyvsp[0].dval; + } + break; + + case 47: +#line 395 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>vsize %f\n", yyvsp[0].dval); + global_vsize = yyvsp[0].dval; + } + break; + + case 48: +#line 402 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>blackline %d\n", yyvsp[0].ival); + global_noblackline = !(yyvsp[0].ival); + } + break; + + case 49: +#line 410 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", yyvsp[-2].dval, yyvsp[-1].dval, yyvsp[0].dval, + current_index); + if (current_index < STP_CHANNEL_LIMIT) + { + current_testpattern->d.p.mins[current_index] = yyvsp[-2].dval; + current_testpattern->d.p.vals[current_index] = yyvsp[-1].dval; + current_testpattern->d.p.gammas[current_index] = yyvsp[0].dval; + current_index++; + } + } + break; + + case 55: +#line 434 "testpatterny.y" + { + int channel = find_color(yyvsp[-3].sval); + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>color_block2a %s %f %f %f\n", yyvsp[-3].sval, yyvsp[-2].dval, yyvsp[-1].dval, yyvsp[0].dval); + if (channel >= 0 && channel < STP_CHANNEL_LIMIT) + { + current_testpattern->d.p.mins[channel] = yyvsp[-2].dval; + current_testpattern->d.p.vals[channel] = yyvsp[-1].dval; + current_testpattern->d.p.gammas[channel] = yyvsp[0].dval; + } + } + break; + + case 56: +#line 448 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>color_block2b %d %f %f %f\n", yyvsp[-3].ival, yyvsp[-2].dval, yyvsp[-1].dval, yyvsp[0].dval); + if (yyvsp[-3].ival >= 0 && yyvsp[-3].ival < STP_CHANNEL_LIMIT) + { + current_testpattern->d.p.mins[yyvsp[-3].ival] = yyvsp[-2].dval; + current_testpattern->d.p.vals[yyvsp[-3].ival] = yyvsp[-1].dval; + current_testpattern->d.p.gammas[yyvsp[-3].ival] = yyvsp[0].dval; + } + } + break; + + case 65: +#line 473 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>patvars %f %f %f %f %f\n", yyvsp[-4].dval, yyvsp[-3].dval, yyvsp[-2].dval, yyvsp[-1].dval, yyvsp[0].dval); + current_testpattern->t = E_PATTERN; + current_testpattern->d.p.lower = yyvsp[-4].dval; + current_testpattern->d.p.upper = yyvsp[-3].dval; + current_testpattern->d.p.levels[1] = yyvsp[-2].dval; + current_testpattern->d.p.levels[2] = yyvsp[-1].dval; + current_testpattern->d.p.levels[3] = yyvsp[0].dval; + current_testpattern = get_next_testpattern(); + current_index = 0; + } + break; + + case 67: +#line 491 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>xpattern\n"); + if (global_channel_depth == 0) + { + fprintf(stderr, "xpattern may only be used with extended color depth\n"); + exit(1); + } + current_testpattern->t = E_XPATTERN; + current_testpattern = get_next_testpattern(); + current_index = 0; + } + break; + + case 68: +#line 506 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>grid %d\n", yyvsp[0].ival); + current_testpattern->t = E_GRID; + current_testpattern->d.g.ticks = yyvsp[0].ival; + current_testpattern = get_next_testpattern(); + current_index = 0; + } + break; + + case 69: +#line 517 "testpatterny.y" + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>image %d %d\n", yyvsp[-1].ival, yyvsp[0].ival); + current_testpattern->t = E_IMAGE; + current_testpattern->d.i.x = yyvsp[-1].ival; + current_testpattern->d.i.y = yyvsp[0].ival; + if (current_testpattern->d.i.x <= 0 || + current_testpattern->d.i.y <= 0) { fprintf(stderr, "image width and height must be greater than zero\n"); exit(1); } return 0; - ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 498 "/usr/share/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif + } + break; -#if YYDEBUG != 0 - if (yydebug) + case 70: +#line 534 "testpatterny.y" { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif + fprintf(stderr, yyvsp[0].sval); + free(yyvsp[0].sval); + } + break; - *++yyvsp = yyval; + case 71: +#line 540 "testpatterny.y" + { + fprintf(stderr, yyvsp[-1].sval, yyvsp[0].sval); + free(yyvsp[-1].sval); + free(yyvsp[0].sval); + } + break; -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) + case 72: +#line 547 "testpatterny.y" { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else + fprintf(stderr, yyvsp[-2].sval, yyvsp[-1].sval, yyvsp[0].sval); + free(yyvsp[-2].sval); + free(yyvsp[-1].sval); + free(yyvsp[0].sval); + } + break; + + case 73: +#line 555 "testpatterny.y" { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; + fprintf(stderr, yyvsp[-3].sval, yyvsp[-2].sval, yyvsp[-1].sval, yyvsp[0].sval); + free(yyvsp[-3].sval); + free(yyvsp[-2].sval); + free(yyvsp[-1].sval); + free(yyvsp[0].sval); + } + break; + + case 74: +#line 564 "testpatterny.y" + { + fprintf(stderr, yyvsp[-4].sval, yyvsp[-3].sval, yyvsp[-2].sval, yyvsp[-1].sval, yyvsp[0].sval); + free(yyvsp[-4].sval); + free(yyvsp[-3].sval); + free(yyvsp[-2].sval); + free(yyvsp[-1].sval); + free(yyvsp[0].sval); + } + break; + + case 99: +#line 586 "testpatterny.y" + { global_did_something = 1; } + break; + + case 104: +#line 593 "testpatterny.y" + { global_did_something = 1; } + break; + + case 107: +#line 600 "testpatterny.y" + { global_did_something = 1; } + break; + + case 113: +#line 610 "testpatterny.y" + { return 0; } + break; + + case 114: +#line 614 "testpatterny.y" + { + current_testpattern = get_next_testpattern(); + } + break; + + } -#endif - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ +/* Line 1010 of yacc.c. */ +#line 1760 "testpatterny.c" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) + if (YYPACT_NINF < yyn && yyn < YYLAST) { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + const char* yyprefix; + char *yymsg; + int yyx; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) { - strcpy(msg, "parse error"); + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); - if (count < 5) + if (yycount < 5) { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; + yyp = yystpcpy (yyp, yyprefix); + yyp = yystpcpy (yyp, yytname[yyx]); + yyprefix = " or "; } } - yyerror(msg); - free(msg); + yyerror (yymsg); + YYSTACK_FREE (yymsg); } else - yyerror ("parse error; also virtual memory exceeded"); + yyerror ("syntax error; also virtual memory exhausted"); } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); + yyerror ("syntax error"); } - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + } + } + else + { + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; - yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; - goto yyerrhandle; -yyerrdefault: /* current state does not do anything special for the error token. */ +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; #endif -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif + yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif -yyerrhandle: +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - else if (yyn == 0) - goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif + YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + yystate = yyn; goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; } -#line 215 "testpatterny.y" + + +#line 620 "testpatterny.y" + diff --git a/src/testpattern/testpatterny.h b/src/testpattern/testpatterny.h index 710b310..989d144 100644 --- a/src/testpattern/testpatterny.h +++ b/src/testpattern/testpatterny.h @@ -1,33 +1,136 @@ -#define tINT 258 -#define tDOUBLE 259 -#define tSTRING 260 -#define C_GAMMA 261 -#define M_GAMMA 262 -#define Y_GAMMA 263 -#define K_GAMMA 264 -#define GAMMA 265 -#define C_LEVEL 266 -#define M_LEVEL 267 -#define Y_LEVEL 268 -#define LEVELS 269 -#define INK_LIMIT 270 -#define INK 271 -#define WIDTH 272 -#define PRINTER 273 -#define INK_TYPE 274 -#define RESOLUTION 275 -#define MEDIA_SOURCE 276 -#define MEDIA_TYPE 277 -#define MEDIA_SIZE 278 -#define DITHER_ALGORITHM 279 -#define DENSITY 280 -#define TOP 281 -#define LEFT 282 -#define HSIZE 283 -#define VSIZE 284 -#define BLACKLINE 285 -#define PATTERN 286 -#define IMAGE 287 +/* A Bison parser, made by GNU Bison 1.875d. */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tINT = 258, + tDOUBLE = 259, + tSTRING = 260, + CYAN = 261, + L_CYAN = 262, + MAGENTA = 263, + L_MAGENTA = 264, + YELLOW = 265, + D_YELLOW = 266, + BLACK = 267, + L_BLACK = 268, + GAMMA = 269, + LEVEL = 270, + STEPS = 271, + INK_LIMIT = 272, + PRINTER = 273, + PARAMETER = 274, + PARAMETER_INT = 275, + PARAMETER_FLOAT = 276, + PARAMETER_CURVE = 277, + DENSITY = 278, + TOP = 279, + LEFT = 280, + HSIZE = 281, + VSIZE = 282, + BLACKLINE = 283, + PATTERN = 284, + XPATTERN = 285, + EXTENDED = 286, + IMAGE = 287, + GRID = 288, + SEMI = 289, + CHANNEL = 290, + CMYK = 291, + KCMY = 292, + RGB = 293, + CMY = 294, + GRAY = 295, + WHITE = 296, + RAW = 297, + MODE = 298, + PAGESIZE = 299, + MESSAGE = 300, + END = 301 + }; +#endif +#define tINT 258 +#define tDOUBLE 259 +#define tSTRING 260 +#define CYAN 261 +#define L_CYAN 262 +#define MAGENTA 263 +#define L_MAGENTA 264 +#define YELLOW 265 +#define D_YELLOW 266 +#define BLACK 267 +#define L_BLACK 268 +#define GAMMA 269 +#define LEVEL 270 +#define STEPS 271 +#define INK_LIMIT 272 +#define PRINTER 273 +#define PARAMETER 274 +#define PARAMETER_INT 275 +#define PARAMETER_FLOAT 276 +#define PARAMETER_CURVE 277 +#define DENSITY 278 +#define TOP 279 +#define LEFT 280 +#define HSIZE 281 +#define VSIZE 282 +#define BLACKLINE 283 +#define PATTERN 284 +#define XPATTERN 285 +#define EXTENDED 286 +#define IMAGE 287 +#define GRID 288 +#define SEMI 289 +#define CHANNEL 290 +#define CMYK 291 +#define KCMY 292 +#define RGB 293 +#define CMY 294 +#define GRAY 295 +#define WHITE 296 +#define RAW 297 +#define MODE 298 +#define PAGESIZE 299 +#define MESSAGE 300 +#define END 301 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif extern YYSTYPE yylval; + + + diff --git a/src/testpattern/testpatterny.y b/src/testpattern/testpatterny.y index 36bb996..6d92bad 100644 --- a/src/testpattern/testpatterny.y +++ b/src/testpattern/testpatterny.y @@ -1,5 +1,5 @@ /* - * "$Id: testpatterny.y,v 1.3.2.1 2002/07/23 00:54:08 rlk Exp $" + * "$Id: testpatterny.y,v 1.26 2004/08/21 22:35:18 rlk Exp $" * * Test pattern generator for Gimp-Print * @@ -37,7 +37,6 @@ extern int yylex(void); char *quotestrip(const char *i); char *endstrip(const char *i); -extern int mylineno; extern char* yytext; static int yyerror( const char *s ) @@ -46,31 +45,68 @@ static int yyerror( const char *s ) return 0; } +typedef struct +{ + const char *name; + int channel; +} color_t; + +static color_t color_map[] = + { + { "black", 0 }, + { "cyan", 1 }, + { "red", 1 }, + { "magenta", 2 }, + { "green", 2 }, + { "yellow", 3 }, + { "blue", 3 }, + { "l_black", 4 }, + { "l_cyan", 5 }, + { "l_magenta", 6 }, + { "d_yellow", 4 }, + { NULL, -1 } + }; + +static int current_index = 0; +static testpattern_t *current_testpattern; +extern FILE *yyin; + +static int +find_color(const char *name) +{ + int i = 0; + while (color_map[i].name) + { + if (strcmp(color_map[i].name, name) == 0) + return color_map[i].channel; + i++; + } + return -1; +} + %} %token <ival> tINT %token <dval> tDOUBLE %token <sval> tSTRING -%token C_GAMMA -%token M_GAMMA -%token Y_GAMMA -%token K_GAMMA +%token CYAN +%token L_CYAN +%token MAGENTA +%token L_MAGENTA +%token YELLOW +%token D_YELLOW +%token BLACK +%token L_BLACK %token GAMMA -%token C_LEVEL -%token M_LEVEL -%token Y_LEVEL -%token LEVELS +%token LEVEL +%token STEPS %token INK_LIMIT -%token INK -%token WIDTH %token PRINTER -%token INK_TYPE -%token RESOLUTION -%token MEDIA_SOURCE -%token MEDIA_TYPE -%token MEDIA_SIZE -%token DITHER_ALGORITHM +%token PARAMETER +%token PARAMETER_INT +%token PARAMETER_FLOAT +%token PARAMETER_CURVE %token DENSITY %token TOP %token LEFT @@ -78,138 +114,507 @@ static int yyerror( const char *s ) %token VSIZE %token BLACKLINE %token PATTERN +%token XPATTERN +%token EXTENDED %token IMAGE +%token GRID +%token SEMI +%token CHANNEL +%token CMYK +%token KCMY +%token RGB +%token CMY +%token GRAY +%token WHITE +%token RAW +%token MODE +%token PAGESIZE +%token MESSAGE +%token END %start Thing %% -global_c_level: C_LEVEL tDOUBLE - { global_c_level = $2; } +COLOR: CYAN | L_CYAN | MAGENTA | L_MAGENTA + | YELLOW | D_YELLOW | BLACK | L_BLACK ; -global_m_level: M_LEVEL tDOUBLE - { global_m_level = $2; } + +cmykspec: CMYK tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>cmykspec %d\n", $2); + global_image_type = "CMYK"; + global_channel_depth = 4; + global_invert_data = 0; + if ($2 == 8 || $2 == 16) + global_bit_depth = $2; + } ; -global_y_level: Y_LEVEL tDOUBLE - { global_y_level = $2; } + +kcmyspec: KCMY tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>kcmyspec %d\n", $2); + global_image_type = "KCMY"; + global_channel_depth = 4; + global_invert_data = 0; + if ($2 == 8 || $2 == 16) + global_bit_depth = $2; + } ; -global_c_gamma: C_GAMMA tDOUBLE - { global_c_gamma = $2; } + +rgbspec: RGB tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>rgbspec %d\n", $2); + global_image_type = "RGB"; + global_channel_depth = 3; + global_invert_data = 1; + if ($2 == 8 || $2 == 16) + global_bit_depth = $2; + } ; -global_m_gamma: M_GAMMA tDOUBLE - { global_m_gamma = $2; } + +cmyspec: CMY tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>cmyspec %d\n", $2); + global_image_type = "CMY"; + global_channel_depth = 3; + global_invert_data = 0; + if ($2 == 8 || $2 == 16) + global_bit_depth = $2; + } ; -global_y_gamma: Y_GAMMA tDOUBLE - { global_y_gamma = $2; } + +grayspec: GRAY tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>grayspec %d\n", $2); + global_image_type = "Grayscale"; + global_channel_depth = 1; + global_invert_data = 0; + if ($2 == 8 || $2 == 16) + global_bit_depth = $2; + } +; + +whitespec: WHITE tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>whitespec %d\n", $2); + global_image_type = "Whitescale"; + global_channel_depth = 1; + global_invert_data = 1; + if ($2 == 8 || $2 == 16) + global_bit_depth = $2; + } +; + +extendedspec: EXTENDED tINT tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>extendedspec %d\n", $2); + global_image_type = "Raw"; + global_invert_data = 0; + global_channel_depth = $2; + if ($2 == 8 || $2 == 16) + global_bit_depth = $3; + } +; + +modespec: cmykspec | kcmyspec | rgbspec | cmyspec | grayspec | whitespec | extendedspec +; + +inputspec: MODE modespec +; + +level: LEVEL COLOR tDOUBLE + { + int channel = find_color($2.sval); + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>level %s %f\n", $2.sval, $3); + if (channel >= 0) + global_levels[channel] = $3; + } +; + +channel_level: LEVEL tINT tDOUBLE + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>channel_level %d %f\n", $2, $3); + if ($2 >= 0 && $2 <= STP_CHANNEL_LIMIT) + global_levels[$2] = $3; + } +; + +gamma: GAMMA COLOR tDOUBLE + { + int channel = find_color($2.sval); + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>gamma %s %f\n", $2.sval, $3); + if (channel >= 0) + global_gammas[channel] = $3; + } ; -global_k_gamma: K_GAMMA tDOUBLE - { global_k_gamma = $2; } + +channel_gamma: GAMMA tINT tDOUBLE + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>channel_gamma %d %f\n", $2, $3); + if ($2 >= 0 && $2 <= STP_CHANNEL_LIMIT) + global_gammas[$2] = $3; + } ; + global_gamma: GAMMA tDOUBLE - { global_gamma = $2; } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>global_gamma %f\n", $2); + global_gamma = $2; + } ; -levels: LEVELS tINT - { levels = $2; } +steps: STEPS tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>steps %d\n", $2); + global_steps = $2; + } ; ink_limit: INK_LIMIT tDOUBLE - { ink_limit = $2; } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>ink_limit %f\n", $2); + global_ink_limit = $2; + } ; printer: PRINTER tSTRING - { printer = c_strdup($2); } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>printer %s\n", $2); + global_printer = strdup($2); + free($2); + } ; -ink_type: INK_TYPE tSTRING - { ink_type = c_strdup($2); } + +page_size_name: PAGESIZE tSTRING + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>page_size_name %s\n", $2); + stp_set_string_parameter(global_vars, "PageSize", $2); + free($2); + } ; -resolution: RESOLUTION tSTRING - { resolution = c_strdup($2); } + +page_size_custom: PAGESIZE tINT tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>page_size_custom %d %d\n", $2, $3); + stp_set_page_width(global_vars, $2); + stp_set_page_height(global_vars, $3); + } ; -media_source: MEDIA_SOURCE tSTRING - { media_source = c_strdup($2); } + +page_size: page_size_name | page_size_custom ; -media_type: MEDIA_TYPE tSTRING - { media_type = c_strdup($2); } + +parameter_string: PARAMETER tSTRING tSTRING + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>parameter_string %s %s\n", $2, $3); + stp_set_string_parameter(global_vars, $2, $3); + free($2); + free($3); + } +; + +parameter_int: PARAMETER_INT tSTRING tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>parameter_int %s %d\n", $2, $3); + stp_set_int_parameter(global_vars, $2, $3); + free($2); + } ; -media_size: MEDIA_SIZE tSTRING - { media_size = c_strdup($2); } + +parameter_float: PARAMETER_FLOAT tSTRING tDOUBLE + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>parameter_float %s %f\n", $2, $3); + stp_set_float_parameter(global_vars, $2, $3); + free($2); + } +; + +parameter_curve: PARAMETER_CURVE tSTRING tSTRING + { + stp_curve_t *curve = stp_curve_create_from_string($3); + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>parameter_curve %s %s\n", $2, $3); + if (curve) + { + stp_set_curve_parameter(global_vars, $2, curve); + stp_curve_destroy(curve); + } + free($2); + } ; -dither_algorithm: DITHER_ALGORITHM tSTRING - { dither_algorithm = c_strdup($2); } + +parameter: parameter_string | parameter_int | parameter_float ; density: DENSITY tDOUBLE - { density = $2; } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>density %f\n", $2); + global_density = $2; + } ; top: TOP tDOUBLE - { xtop = $2; } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>top %f\n", $2); + global_xtop = $2; + } ; left: LEFT tDOUBLE - { xleft = $2; } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>left %f\n", $2); + global_xleft = $2; + } ; hsize: HSIZE tDOUBLE - { hsize = $2; } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>hsize %f\n", $2); + global_hsize = $2; + } ; vsize: VSIZE tDOUBLE - { vsize = $2; } + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>vsize %f\n", $2); + global_vsize = $2; + } ; blackline: BLACKLINE tINT - { noblackline = !($2); } -; - -pattern: PATTERN tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE - tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE - tDOUBLE tDOUBLE - { - testpattern_t *t = get_next_testpattern(); - t->t = E_PATTERN; - t->d.p.c_min = $2; - t->d.p.c = $3; - t->d.p.c_gamma = $4; - t->d.p.m_min = $5; - t->d.p.m = $6; - t->d.p.m_gamma = $7; - t->d.p.y_min = $8; - t->d.p.y = $9; - t->d.p.y_gamma = $10; - t->d.p.k_min = $11; - t->d.p.k = $12; - t->d.p.k_gamma = $13; - t->d.p.c_level = $14; - t->d.p.m_level = $15; - t->d.p.y_level = $16; - t->d.p.lower = $17; - t->d.p.upper = $18; + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>blackline %d\n", $2); + global_noblackline = !($2); + } +; + +color_block1: tDOUBLE tDOUBLE tDOUBLE + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", $1, $2, $3, + current_index); + if (current_index < STP_CHANNEL_LIMIT) + { + current_testpattern->d.p.mins[current_index] = $1; + current_testpattern->d.p.vals[current_index] = $2; + current_testpattern->d.p.gammas[current_index] = $3; + current_index++; + } + } +; + +color_blocks1a: color_block1 | color_blocks1a color_block1 +; + +color_blocks1b: /* empty */ | color_blocks1a +; + +color_blocks1: color_block1 color_blocks1b +; + +color_block2a: COLOR tDOUBLE tDOUBLE tDOUBLE + { + int channel = find_color($1.sval); + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>color_block2a %s %f %f %f\n", $1.sval, $2, $3, $4); + if (channel >= 0 && channel < STP_CHANNEL_LIMIT) + { + current_testpattern->d.p.mins[channel] = $2; + current_testpattern->d.p.vals[channel] = $3; + current_testpattern->d.p.gammas[channel] = $4; + } + } +; + +color_block2b: CHANNEL tINT tDOUBLE tDOUBLE tDOUBLE + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>color_block2b %d %f %f %f\n", $2, $3, $4, $5); + if ($2 >= 0 && $2 < STP_CHANNEL_LIMIT) + { + current_testpattern->d.p.mins[$2] = $3; + current_testpattern->d.p.vals[$2] = $4; + current_testpattern->d.p.gammas[$2] = $5; + } + } +; + +color_block2: color_block2a | color_block2b +; + +color_blocks2a: color_block2 | color_blocks2a color_block2 +; + +color_blocks2: /* empty */ | color_blocks2a +; + +color_blocks: color_blocks1 | color_blocks2 +; + +patvars: tDOUBLE tDOUBLE tDOUBLE tDOUBLE tDOUBLE + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>patvars %f %f %f %f %f\n", $1, $2, $3, $4, $5); + current_testpattern->t = E_PATTERN; + current_testpattern->d.p.lower = $1; + current_testpattern->d.p.upper = $2; + current_testpattern->d.p.levels[1] = $3; + current_testpattern->d.p.levels[2] = $4; + current_testpattern->d.p.levels[3] = $5; + current_testpattern = get_next_testpattern(); + current_index = 0; + } +; + +pattern: PATTERN patvars color_blocks +; + +xpattern: XPATTERN color_blocks + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>xpattern\n"); + if (global_channel_depth == 0) + { + fprintf(stderr, "xpattern may only be used with extended color depth\n"); + exit(1); + } + current_testpattern->t = E_XPATTERN; + current_testpattern = get_next_testpattern(); + current_index = 0; + } +; + +grid: GRID tINT + { + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>grid %d\n", $2); + current_testpattern->t = E_GRID; + current_testpattern->d.g.ticks = $2; + current_testpattern = get_next_testpattern(); + current_index = 0; } ; image: IMAGE tINT tINT { - testpattern_t *t = get_next_testpattern(); - t->t = E_IMAGE; - t->d.i.x = $2; - t->d.i.y = $3; - if (t->d.i.x <= 0 || t->d.i.y <= 0) + if (getenv("STP_TESTPATTERN_DEBUG")) + fprintf(stderr, ">>>image %d %d\n", $2, $3); + current_testpattern->t = E_IMAGE; + current_testpattern->d.i.x = $2; + current_testpattern->d.i.y = $3; + if (current_testpattern->d.i.x <= 0 || + current_testpattern->d.i.y <= 0) { fprintf(stderr, "image width and height must be greater than zero\n"); exit(1); } return 0; } +; + +Message0: MESSAGE tSTRING + { + fprintf(stderr, $2); + free($2); + } +; +Message1: MESSAGE tSTRING tSTRING + { + fprintf(stderr, $2, $3); + free($2); + free($3); + } +; +Message2: MESSAGE tSTRING tSTRING tSTRING + { + fprintf(stderr, $2, $3, $4); + free($2); + free($3); + free($4); + } +; +Message3: MESSAGE tSTRING tSTRING tSTRING tSTRING + { + fprintf(stderr, $2, $3, $4, $5); + free($2); + free($3); + free($4); + free($5); + } +; +Message4: MESSAGE tSTRING tSTRING tSTRING tSTRING tSTRING + { + fprintf(stderr, $2, $3, $4, $5, $6); + free($2); + free($3); + free($4); + free($5); + free($6); + } +; + +A_Message: Message0 | Message1 | Message2 | Message3 | Message4 +; + +message: A_Message +; + +A_Rule: gamma | channel_gamma | level | channel_level | global_gamma | steps + | ink_limit | printer | parameter | density | top | left | hsize + | vsize | blackline | inputspec | page_size | message +; + +Rule: A_Rule SEMI + { global_did_something = 1; } +; -Empty: +A_Pattern: pattern | xpattern | grid | message +; -Rule: global_c_level | global_m_level | global_y_level - | global_c_gamma | global_m_gamma | global_y_gamma | global_k_gamma - | global_gamma | levels | ink_limit | printer | ink_type | resolution - | media_source | media_type | media_size | dither_algorithm | density - | top | left | hsize | vsize | blackline +Pattern: A_Pattern SEMI + { global_did_something = 1; } +; -Patterns: Patterns pattern | Empty +Patterns: /* empty */ | Patterns Pattern +; Image: image + { global_did_something = 1; } +; -Rules: Rules Rule | Empty +Rules: /* empty */ | Rules Rule +; Output: Patterns | Image +; -Thing: Rules Output Empty +EOF: /* empty */ | END SEMI + { return 0; } +; + +Thing: Rules + { + current_testpattern = get_next_testpattern(); + } + Output EOF +; %% |