summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2011-05-03 10:28:02 +0100
committerRoger Leigh <rleigh@debian.org>2011-05-03 10:28:02 +0100
commit15578e218035547ca17e25ef351fbe56bc55a4ae (patch)
tree06a97de2b9f0d9e04ee05d5ff806ef7c53a2003e /test
parent4bc88c4aa9026d5c679008a4dbbb8ec4d9a901bd (diff)
Imported Upstream version 5.2.7
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in144
-rw-r--r--test/pixma_parse.c246
-rw-r--r--test/pixma_parse.h8
-rw-r--r--test/unprint.c13
4 files changed, 302 insertions, 109 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index 6ff1406..1d6b1a3 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
@@ -21,8 +22,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -63,6 +65,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_bjc_unprint_OBJECTS = bjc-unprint.$(OBJEXT)
bjc_unprint_OBJECTS = $(am_bjc_unprint_OBJECTS)
@@ -91,6 +94,7 @@ xml_curve_DEPENDENCIES = $(GUTENPRINT_LIBS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -110,6 +114,8 @@ DIST_SOURCES = $(bjc_unprint_SOURCES) $(curve_SOURCES) \
$(unprint_SOURCES) $(xml_curve_SOURCES)
ETAGS = etags
CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALL_LINGUAS = @ALL_LINGUAS@
@@ -228,6 +234,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
@@ -348,14 +355,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu test/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu test/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -373,13 +380,16 @@ $(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
+$(am__aclocal_m4_deps):
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
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
bjc-unprint$(EXEEXT): $(bjc_unprint_OBJECTS) $(bjc_unprint_DEPENDENCIES)
@rm -f bjc-unprint$(EXEEXT)
$(LINK) $(bjc_unprint_OBJECTS) $(bjc_unprint_LDADD) $(LIBS)
@@ -422,21 +432,21 @@ distclean-compile:
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
@@ -452,14 +462,14 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -467,37 +477,43 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list=' $(TESTS) '; \
+ $(am__tty_colors); \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -506,49 +522,63 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *$$ws$$tst$$ws*) \
+ *[\ \ ]$$tst[\ \ ]*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- echo "XPASS: $$tst"; \
+ col=$$red; res=XPASS; \
;; \
*) \
- echo "PASS: $$tst"; \
+ col=$$grn; res=PASS; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *$$ws$$tst$$ws*) \
+ *[\ \ ]$$tst[\ \ ]*) \
xfail=`expr $$xfail + 1`; \
- echo "XFAIL: $$tst"; \
+ col=$$lgn; res=XFAIL; \
;; \
*) \
failed=`expr $$failed + 1`; \
- echo "FAIL: $$tst"; \
+ col=$$red; res=FAIL; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- echo "SKIP: $$tst"; \
+ col=$$blu; res=SKIP; \
fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="All $$all tests passed"; \
+ banner="$$All$$all $$tests passed"; \
else \
- banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all tests failed"; \
+ banner="$$failed of $$all $$tests failed"; \
else \
- banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ 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)"; \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
@@ -559,11 +589,15 @@ check-TESTS: $(TESTS)
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- echo "$$dashes"; \
+ if test "$$failed" -eq 0; then \
+ echo "$$grn$$dashes"; \
+ else \
+ echo "$$red$$dashes"; \
+ fi; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
- echo "$$dashes"; \
+ echo "$$dashes$$std"; \
test "$$failed" -eq 0; \
else :; fi
@@ -583,13 +617,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -619,6 +657,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -641,6 +680,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -649,18 +690,28 @@ install-data-am:
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am:
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -683,7 +734,7 @@ ps-am:
uninstall-am:
-.MAKE: install-am install-strip
+.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-generic clean-libtool clean-noinstPROGRAMS ctags \
@@ -715,6 +766,7 @@ $(top_builddir)/src/gutenprintui/libgutenprintui.la:
$(top_builddir)/src/gutenprintui2/libgutenprintui2.la:
cd $(top_builddir)/src/gutenprintui2; \
$(MAKE)
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/test/pixma_parse.c b/test/pixma_parse.c
index ec022e6..5068e61 100644
--- a/test/pixma_parse.c
+++ b/test/pixma_parse.c
@@ -24,10 +24,14 @@
#include <inttypes.h>
-#define MAX_COLORS 8 /* maximum number of Colors: CMYKcmyk */
+#define MAX_COLORS 36 /* was: 8 maximum number of Colors: CMYKcmyk */
#include "pixma_parse.h"
+/*TODO:
+ 1. change color loops to search for each named color rather than using a predefined order.
+ 2. keep iP6700 workaround, but check what happens with the real printer.
+*/
@@ -41,20 +45,38 @@
* cnt: len of the arguments
*
* return values:
- * 0 when a command has been succesfully read
+ * 0 when a command has been successfully read
* 1 when EOF has been reached
- * -1 when an error occureed
+ * -1 when an error occurred
*/
-static int nextcmd( FILE *infile,unsigned char* cmd,unsigned char *buf, unsigned int *cnt)
+static int nextcmd( FILE *infile,unsigned char* cmd,unsigned char *buf, unsigned int *cnt, unsigned int *xml_read)
{
unsigned char c1,c2;
+ unsigned int startxml, endxml;
+ unsigned int xmldata;
if (feof(infile))
return -1;
while (!feof(infile)){
c1 = fgetc(infile);
if(feof(infile)) /* NORMAL EOF */
return 1;
- if (c1 == 27 ){ /* A new ESC command */
+ /* add skip for XML header and footer */
+ if (c1 == 60 ){ /* "<" for XML start */
+ if (*xml_read==0){
+ /* start: */
+ startxml=680;
+ xmldata=fread(buf,1,679,infile); /* 1 less than 680 */
+ printf("nextcmd: read starting XML %d %d\n", *xml_read, startxml);
+ *xml_read=1;
+ }else if (*xml_read==1) {
+ /* end */
+ endxml=263;
+ xmldata=fread(buf,1,262,infile); /* 1 less than 263*/
+ printf("nextcmd: read ending XML %d %d\n", *xml_read, endxml);
+ *xml_read=2;
+ }
+ /* no alternatives yet */
+ }else if (c1 == 27 ){ /* A new ESC command */
c2 = fgetc(infile);
if(feof(infile))
return 1;
@@ -133,7 +155,7 @@ static int Raster(image_t* img,unsigned char* buffer,unsigned int len,unsigned c
unsigned char* dst=malloc(len*256); /* the destination buffer */
unsigned char* dstr=dst;
if(!color){
- printf("no matching color for %c (0x%x) in the database => ignoring %i bytes\n",color_name,color_name,len);
+ printf("no matching color for %c (0x%x, %i) in the database => ignoring %i bytes\n",color_name,color_name,color_name, len);
}
/* decode pack bits */
@@ -154,7 +176,7 @@ static int Raster(image_t* img,unsigned char* buffer,unsigned int len,unsigned c
}
color->head->line = img->height + cur_line;
if(!color->compression){
- color->head->buf=calloc(1,size+8); /* allocat slightly bigger buffer for get_bits */
+ color->head->buf=calloc(1,size+8); /* allocate slightly bigger buffer for get_bits */
memcpy(color->head->buf,dstr,size);
color->head->len=size;
}else{ /* handle 5pixel in 8 bits compression */
@@ -224,14 +246,41 @@ static void write_line(image_t*img,FILE* fp,int pos_y){
unsigned int x;
unsigned int written;
unsigned char* line=malloc(img->width*3);
- color_t* Y=get_color(img,'Y');
color_t* C=get_color(img,'C');
color_t* M=get_color(img,'M');
+ color_t* Y=get_color(img,'Y');
color_t* K=get_color(img,'K');
- color_t* k=get_color(img,'k');
color_t* c=get_color(img,'c');
color_t* m=get_color(img,'m');
color_t* y=get_color(img,'y');
+ color_t* k=get_color(img,'k');
+ color_t* H=get_color(img,'H');
+ color_t* R=get_color(img,'R');
+ color_t* G=get_color(img,'G');
+ /* color_t* A=get_color(img,'A'); */
+ /* color_t* B=get_color(img,'B'); */
+ /* color_t* D=get_color(img,'D'); */
+ /* color_t* E=get_color(img,'E'); */
+ /* color_t* F=get_color(img,'F'); */
+ /* color_t* I=get_color(img,'I'); */
+ /* color_t* J=get_color(img,'J'); */
+ /* color_t* L=get_color(img,'L'); */
+ /* color_t* N=get_color(img,'N'); */
+ /* color_t* O=get_color(img,'O'); */
+ /* color_t* P=get_color(img,'P'); */
+ /* color_t* Q=get_color(img,'Q'); */
+ /* color_t* S=get_color(img,'S'); */
+ /* color_t* T=get_color(img,'T'); */
+ /* color_t* U=get_color(img,'U'); */
+ /* color_t* V=get_color(img,'V'); */
+ /* color_t* W=get_color(img,'W'); */
+ /* color_t* X=get_color(img,'X'); */
+ /* color_t* Z=get_color(img,'Z'); */
+ /* color_t* a=get_color(img,'a'); */
+ /* color_t* b=get_color(img,'b'); */
+ /* color_t* d=get_color(img,'d'); */
+ /* color_t* e=get_color(img,'e'); */
+ /* color_t* f=get_color(img,'f'); */
GetBitContext gb[MAX_COLORS];
/* move iterator */
advance(img,pos_y);
@@ -245,12 +294,14 @@ static void write_line(image_t*img,FILE* fp,int pos_y){
int lK=0,lM=0,lY=0,lC=0;
/* get pixel values */
for(i=0;i<MAX_COLORS;i++){
- if(inside_range(&img->color[i],x,pos_y))
- img->color[i].value = get_bits(&gb[i],img->color[i].bpp);
- else
- img->color[i].value = 0;
- /* update statistics */
- (img->color[i].dots)[img->color[i].value] += 1;
+ if(inside_range(&img->color[i],x,pos_y))
+ img->color[i].value = get_bits(&gb[i],img->color[i].bpp);
+ else
+ img->color[i].value = 0;
+ /* update statistics */
+ (img->color[i].dots)[img->color[i].value] += 1;
+ /* set to 1 if the level is used */
+ (img->color[i].usedlevels)[img->color[i].value]=1;
}
/* calculate CMYK values */
lK=K->density * K->value/(K->level-1) + k->density * k->value/(k->level-1);
@@ -298,7 +349,12 @@ static void write_ppm(image_t* img,FILE* fp){
int i;
/* allocate buffers for dot statistics */
for(i=0;i<MAX_COLORS;i++){
- img->color[i].dots=calloc(1,sizeof(int)*(img->color[i].level+1));
+ /*img->color[i].dots=calloc(1,sizeof(int)*(img->color[i].level+1));*/
+ img->color[i].dots=calloc(1,sizeof(int)*(1<<(img->color[i].bpp)+1));
+ }
+ /* allocate buffers for levels used*/
+ for(i=0;i<MAX_COLORS;i++){
+ img->color[i].usedlevels=calloc(1,sizeof(int)*(1<<(img->color[i].bpp)+1));
}
/* write header */
@@ -316,9 +372,22 @@ static void write_ppm(image_t* img,FILE* fp){
/* output some statistics */
printf("statistics:\n");
for(i=0;i<MAX_COLORS;i++){
- int level;
- for(level=0;level < img->color[i].level;level++)
- printf("color %c level %i dots %i\n",img->color[i].name,level,img->color[i].dots[level]);
+ int level;
+ if (img->color[i].bpp > 0) {
+ /*for(level=0;level < img->color[i].level;level++)*/
+ for(level=0;level < 1<<(img->color[i].bpp);level++)
+ printf("color %c level %i dots %i\n",img->color[i].name,level,img->color[i].dots[level]);
+ }
+ }
+ printf("Level values actually used:\n");
+ for(i=0;i<MAX_COLORS;i++){
+ int level;
+ if (img->color[i].bpp > 0) {
+ printf("color %c bpp %i available levels %i declared levels %i --- actual level values used:\n",img->color[i].name,img->color[i].bpp,1<<(img->color[i].bpp),img->color[i].level);
+ for(level=0;level < 1<<(img->color[i].bpp);level++)
+ printf("%i",img->color[i].usedlevels[level]);
+ printf("\n");
+ }
}
/* translate area coordinates to 1/72 in (the gutenprint unit)*/
img->image_top = img->image_top * 72.0 / img->yres ;
@@ -348,11 +417,14 @@ static int process(FILE* in, FILE* out,int verbose,unsigned int maxw,unsigned in
unsigned char* buf=malloc(0xFFFF);
int returnv=0;
int i;
+ unsigned int xml_read;
+ xml_read=0;
+
printf("------- parsing the printjob -------\n");
while(!returnv && !feof(in)){
unsigned char cmd;
unsigned int cnt = 0;
- if((returnv = nextcmd(in,&cmd,buf,&cnt)))
+ if((returnv = nextcmd(in,&cmd,buf,&cnt,&xml_read)))
break;
switch(cmd){
case 'c':
@@ -382,7 +454,7 @@ static int process(FILE* in, FILE* out,int verbose,unsigned int maxw,unsigned in
printf("ESC (I select data transmission (len=%i): ",cnt);
if(buf[0]==0)printf("default");
else if(buf[0]==1)printf("multi raster");
- else printf("unknown 0x%x",buf[0]);
+ else printf("unknown 0x%x %i",buf[0],buf[0]);
printf("\n");
break;
case 'l':
@@ -400,64 +472,111 @@ static int process(FILE* in, FILE* out,int verbose,unsigned int maxw,unsigned in
case 't':
printf("ESC (t set image cnt %i\n",cnt);
if(buf[0]>>7){
- char order[]="CMYKcmyk";
+ /* usual order */
+ char order[]="CMYKcmykHRGABDEFIJLMNOPQSTUVWXZabdef";
+ /* MP960 photo modes: k instead of K */
+ /* char order[]="CMYkcmyKHRGABDEFIJLMNOPQSTUVWXZabdef";*/
+ /* T-shirt transfer mode: y changed to k --- no y, no K */
+ /*char order[]="CMYKcmkyHRGABDEFIJLMNOPQSTUVWXZabdef";*/
+ /* MP990, MG6100, MG8100 plain modes */
+ /*char order[]="KCcMmYykRHGABDEFIJLMNOPQSTUVWXZabdef";*/
+ /* MP990 etc. photo modes */
+ /* char order[]="KCcMmYykRHGABDEFIJLMNOPQSTUVWXZabdef"; */
int black_found = 0;
int num_colors = (cnt - 3)/3;
printf(" bit_info: using detailed color settings for max %i colors\n",num_colors);
if(buf[1]==0x80)
printf(" format: BJ indexed color image format\n");
+ else if(buf[1]==0x00)
+ printf(" format: iP8500 flag set, BJ indexed color image format\n");
+ else if(buf[1]==0x90)
+ printf(" format: Pro9500 flag set, BJ indexed color image format\n");
else{
printf(" format: settings not supported 0x%x\n",buf[1]);
- returnv = -2;
+ /* returnv = -2; */
}
- if(buf[2] != 0x1){
+ if(buf[2]==0x1)
+ printf(" ink: BJ indexed setting, also for iP8500 flag\n");
+ else if(buf[2]==0x4)
+ printf(" ink: Pro series setting \n");
+ else{
printf(" ink: settings not supported 0x%x\n",buf[2]);
- returnv = -2;
+ /* returnv = -2; */
}
for(i=0;i<num_colors;i++){
- if(i<MAX_COLORS){
- img->color[i].name=order[i];
- img->color[i].compression=buf[3+i*3] >> 5;
- img->color[i].bpp=buf[3+i*3] & 31;
- img->color[i].level=(buf[3+i*3+1] << 8) + buf[3+i*3+2];
- /* this is not supposed to give accurate images */
- if(i<4)
- img->color[i].density = 255;
- else
- img->color[i].density = 128;
- if((order[i] == 'K' || order[i] =='k') && img->color[i].bpp)
- black_found = 1;
- if(order[i] == 'y' && !black_found && img->color[i].level){
- printf("iP6700 hack: treating colordefinition at the y position as k\n");
- img->color[i].name = 'k';
- order[i] = 'k';
- order[i+1] = 'y';
- black_found = 1;
- img->color[i].density = 255;
- }
- printf(" Color %c Compression: %i bpp %i level %i\n",img->color[i].name,
- img->color[i].compression,img->color[i].bpp,img->color[i].level);
- }else{
- printf(" Color ignoring setting %x %x %x\n",buf[3+i*3],buf[3+i*3+1],buf[3+i*3+2]);
- }
-
+ if(i<MAX_COLORS){
+ img->color[i].name=order[i];
+ img->color[i].compression=buf[3+i*3] >> 5;
+ img->color[i].bpp=buf[3+i*3] & 31;
+ img->color[i].level=(buf[3+i*3+1] << 8) + buf[3+i*3+2];/* check this carefully */
+
+ /* work around for levels not matching (bpp gives more) */
+ /*if ((img->color[i].level == 3) && (img->color[i].bpp == 2)) {
+ printf("WARNING: color %c bpp %i declared levels %i, setting to 4 for testing \n",img->color[i].name,img->color[i].bpp,img->color[i].level);
+ img->color[i].level = 4;
+ } */
+ /*else if ((img->color[i].level == 4) && (img->color[i].bpp == 4)) {*/
+ /* levels is 16 but only each 2nd level is used */
+ /* printf("WARNING: color %c bpp %i declared levels %i, setting to 16 for testing \n",img->color[i].name,img->color[i].bpp,img->color[i].level);
+ img->color[i].level = 16;
+ } */
+
+ /* this is not supposed to give accurate images */
+ /* if(i<4) */ /* set to actual colors CMYK */
+ if((img->color[i].name =='K')||(img->color[i].name =='C')||(img->color[i].name =='M')||(img->color[i].name =='Y') )
+ img->color[i].density = 255;
+ else
+ img->color[i].density = 128; /*128+96;*/ /* try to add 0x80 to sub-channels for MP450 hi-quality mode */
+ if((order[i] == 'K' || order[i] == 'k') && img->color[i].bpp)
+ black_found = 1;
+ if(order[i] == 'y' && !black_found && img->color[i].level){
+ printf("iP6700 hack: treating color definition at the y position as k\n");
+ img->color[i].name = 'k';
+ order[i] = 'k';
+ order[i+1] = 'y';
+ black_found = 1;
+ img->color[i].density = 255;
+ } /* %c*/
+ printf(" Color %c Compression: %i bpp %i level %i\n",img->color[i].name,
+ img->color[i].compression,img->color[i].bpp,img->color[i].level);
+ }else{
+ printf(" Color %c Compression: %i bpp %i level %i\n",img->color[i].name,
+ img->color[i].compression,img->color[i].bpp,img->color[i].level);
+ /*printf(" Color ignoring setting %x %x %x\n",buf[3+i*3],buf[3+i*3+1],buf[3+i*3+2]);*/
+ }
+
}
-
-
+
+
}else if(buf[0]==0x1 && buf[1]==0x0 && buf[2]==0x1){
printf(" 1bit-per pixel\n");
- for(i=0;i<MAX_COLORS;i++){
- const char order[]="CMYKcmyk";
+ int num_colors = cnt*3; /*no idea yet! 3 for iP4000 */
+ /*num_colors=9;*/
+ /*for(i=0;i<MAX_COLORS;i++){*/
+ for(i=0;i<num_colors;i++){
+ if(i<MAX_COLORS){
+ /* usual */
+ const char order[]="CMYKcmykHRGABDEFIJLMNOPQSTUVWXZabdef";
+ /* MP990, MG6100, MG8100 plain modes */
+ /*const char order[]="KCcMmYykRHGABDEFIJLMNOPQSTUVWXZabdef";*/
img->color[i].name=order[i];
img->color[i].compression=0;
img->color[i].bpp=1;
img->color[i].level=2;
img->color[i].density = 255;
+ /*add color printout for this type also %c */
+ printf(" Color %c Compression: %i bpp %i level %i\n",img->color[i].name,
+ img->color[i].compression,img->color[i].bpp,img->color[i].level);
+ }else{
+ printf(" Color %c Compression: %i bpp %i level %i\n",img->color[i].name,
+ img->color[i].compression,img->color[i].bpp,img->color[i].level);
+ /*printf(" Color ignoring setting %x %x %x\n",buf[3+i*3],buf[3+i*3+1],buf[3+i*3+2]);*/
+ }
}
}else{
printf(" bit_info: unknown settings 0x%x 0x%x 0x%x\n",buf[0],buf[1],buf[2]);
- returnv=-2;
+ /* returnv=-2; */
}
break;
case 'L':
@@ -465,8 +584,17 @@ static int process(FILE* in, FILE* out,int verbose,unsigned int maxw,unsigned in
img->color_order=calloc(1,cnt+1);
/* check if the colors are sane => the iP4000 driver appends invalid bytes in the highest resolution mode */
for(i=0;i<cnt;i++){
- if(!valid_color(buf[i]))
- break;
+ if (!valid_color(buf[i]))
+ if (!(valid_color(buf[i]-0x80))) {
+ printf("invalid color char [failed on initial]\n");
+ break;
+ }
+ else {
+ buf[i]=buf[i]-0x80;
+ printf("subtracting 0x80 to give [corrected]: %c\n", buf[i]);
+ }
+ else
+ printf("found valid color char: %c\n",buf[i]);
}
cnt = i;
memcpy(img->color_order,buf,cnt);
@@ -563,7 +691,7 @@ static int process(FILE* in, FILE* out,int verbose,unsigned int maxw,unsigned in
}
printf("-------- finished parsing --------\n");
- if(returnv < 0){
+ if(returnv < -2){ /* was < 0 : work around to see what we get */
printf("error: parsing the printjob failed error %i\n",returnv);
} else {
diff --git a/test/pixma_parse.h b/test/pixma_parse.h
index 1be8549..5faebd9 100644
--- a/test/pixma_parse.h
+++ b/test/pixma_parse.h
@@ -225,13 +225,14 @@ typedef struct rasterline_s {
typedef struct color_s {
- char name; /* name (one of CMYKcmyk) */
+ char name; /* name (one of CMYKcmykRGH) */
int bpp; /* number of bits */
int level; /* number of levels */
int density; /* relative density to the other colors*/
unsigned int value;/* last used dot value */
unsigned int* dots; /* number of dots for every level */
- int compression; /* bits are compressed */
+ unsigned int* usedlevels; /* actual levels used. Array of length 2^bpp */
+ int compression; /* bits are compressed */
rasterline_t* head; /* end of linked list */
rasterline_t* tail; /* start of linked list */
rasterline_t* pos; /* iterator position */
@@ -258,7 +259,8 @@ typedef struct image_s {
} image_t;
/* FIXME what are the 0xa3 and 0xad for? they are used in the PIXMA iP4200 CD mode */
-static const unsigned char valid_colors[] = {'C','M','Y','K','c','m','y','k',0xa3,0xad};
+/*static const unsigned char valid_colors[] = {'C','M','Y','K','c','m','y','k',0xa3,0xad}; */
+static const unsigned char valid_colors[] = {'C','M','Y','K','c','m','y','k','R','G','H','A','B','D','E','F','I','J','L','M','N','O','P','Q','S','T','U','V','W','X','Z','a','b','d','e','f'};
#endif
diff --git a/test/unprint.c b/test/unprint.c
index ceca18d..ee02562 100644
--- a/test/unprint.c
+++ b/test/unprint.c
@@ -1,4 +1,4 @@
-/* $Id: unprint.c,v 1.45 2010/01/16 20:00:29 rlk Exp $ */
+/* $Id: unprint.c,v 1.46 2011/04/01 02:20:09 rlk Exp $ */
/*
* Generate PPM files from printer output
*
@@ -1613,6 +1613,17 @@ main(int argc,char *argv[])
else
fp_r = stdin;
break;
+ case 'h':
+ fprintf(stderr, "Usage: %s [-m mask] [-n nozzle_sep] [-s extra] [-b] [-q] [-Q] [-M] [-u] [in [out]]\n", argv[0]);
+ fprintf(stderr, " -m mask Color mask to unprint\n");
+ fprintf(stderr, " -n nozzle_sep Nozzle separation in vertical units for old printers\n");
+ fprintf(stderr, " -s extra Extra feed requirement for old printers (typically 1)\n");
+ fprintf(stderr, " -b Unprint everything in black\n");
+ fprintf(stderr, " -q Don't produce output\n");
+ fprintf(stderr, " -Q Assume quadtone inks\n");
+ fprintf(stderr, " -M Assume MIS quadtone inks\n");
+ fprintf(stderr, " -u Unweave\n");
+ return 1;
case 'm':
if (argv[arg][2])
{