summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-10-26 17:28:54 +0000
committerRoger Leigh <rleigh@debian.org>2008-10-26 17:28:54 +0000
commit33a17feb28af2d2aeabc8c7ab5ef509ea3de15a7 (patch)
treed444cf1a245694bd049a9e6722c41b8f280ad429 /test
parent9d82a443d65ea3e4e015ba6988208231fa8fdc77 (diff)
Imported Upstream version 5.2.1
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in31
-rwxr-xr-xtest/parse-escp2409
-rwxr-xr-xtest/run-testdither2
-rwxr-xr-xtest/run-weavetest8
-rw-r--r--test/unprint.c58
-rw-r--r--test/xml-curve.c4
6 files changed, 286 insertions, 226 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index 25a26a1..8e1e65e 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008 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.
@@ -17,7 +17,7 @@
# Variables
#export STP_MODULE_PATH = $(top_builddir)/src/main/.libs:$(top_builddir)/src/main
-#export STP_DATA_PATH = $(top_srcdir)/src/main
+#export STP_DATA_PATH = $(top_srcdir)/src/xml
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
@@ -50,7 +50,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/isc-posix.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
- $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.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
@@ -84,7 +85,7 @@ unprint_DEPENDENCIES = $(GUTENPRINT_LIBS)
am_xml_curve_OBJECTS = xml-curve.$(OBJEXT)
xml_curve_OBJECTS = $(am_xml_curve_OBJECTS)
xml_curve_DEPENDENCIES = $(GUTENPRINT_LIBS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -138,6 +139,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DIALOG = @DIALOG@
DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
DVIPDF = @DVIPDF@
DVIPS = @DVIPS@
ECHO = @ECHO@
@@ -158,6 +160,7 @@ GIMP2_LIBS = @GIMP2_LIBS@
GIMPTOOL2_CHECK = @GIMPTOOL2_CHECK@
GLIB_MKENUMS = @GLIB_MKENUMS@
GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
GNUCFLAGS = @GNUCFLAGS@
GREP = @GREP@
GTK2_CFLAGS = @GTK2_CFLAGS@
@@ -190,6 +193,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -210,9 +214,10 @@ MAINT = @MAINT@
MAINTAINER_CFLAGS = @MAINTAINER_CFLAGS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
-MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
+NMEDIT = @NMEDIT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -239,6 +244,7 @@ USE_NLS = @USE_NLS@
VERSION = @VERSION@
WHICH_PPDS = @WHICH_PPDS@
XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
@@ -441,8 +447,8 @@ 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; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
@@ -454,8 +460,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
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; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -465,13 +471,12 @@ ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
- here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
diff --git a/test/parse-escp2 b/test/parse-escp2
index ae95a5f..4664955 100755
--- a/test/parse-escp2
+++ b/test/parse-escp2
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# Copyright 2000-2007 Robert Krawitz <rlk@alum.mit.edu>
+# Copyright 2000-2008 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
@@ -26,8 +26,10 @@ use vars qw($atend
$opt_v
$opt_V
$opt_O
+ $curoffset
$curpos
$esc
+ $initial_vertical_position
$page_mgmt_unit
$horizontal_position
$horizontal_unit
@@ -37,9 +39,21 @@ use vars qw($atend
$raster_y
$print_offsets
%seqtable
+ @seqkeys
+ %chartable
+ %xchartable
+ %nchartable
+ %rchartable
+ %keylengths
+ $total_length
@offsets);
$atend = 0;
+%chartable = ();
+%xchartable = ();
+%nchartable = ();
+%rchartable = ();
+%keylengths = ();
%seqtable = ( "@", 0,
"(R", "REMOTE",
@@ -55,37 +69,64 @@ $atend = 0;
"\001", 22
);
+map {
+ my ($xchar) = pack("C", $_);
+ if ($_ >= 32 && $_ < 127) {
+ $chartable{$xchar} = " $xchar";
+ $xchartable{$xchar} = " *$xchar";
+ $rchartable{$xchar} = $xchar;
+ } else {
+ $chartable{$xchar} = sprintf("%02x", $_);
+ $xchartable{$xchar} = sprintf("*%02x", $_);
+ $rchartable{$xchar} = sprintf("%02x ", $_);
+ }
+ $nchartable{$xchar} = $_;
+} (0..255);
+
+@seqkeys = (sort { length $b <=> length $a } keys %seqtable);
+
+map { $keylengths{$_} = length $_ } @seqkeys;
+
$esc = "\033";
$curpos = 0;
+$curoffset = 0;
$page_mgmt_unit = 360;
$horizontal_unit = 180;
$vertical_unit = 360;
+$initial_vertical_position = 0;
$vertical_position = 0;
$horizontal_position = 0;
$print_offsets = 0;
+$total_length = 0;
-sub get_stuff($) {
+sub fill_buffer($) {
my ($where) = @_;
- my ($end) = length $stuff;
+ return 1 if $total_length - $curoffset >= $where;
+ my ($end) = $total_length - $curoffset;
if ($curpos == 0 && $end == 0) {
$stuff = <>; # Need to do this once to "activate" ARGV
- $end = length $stuff;
+ $total_length = length $stuff;
+ $end = $total_length - $curoffset;
}
- my ($old_end) = length $stuff;
+ my ($old_end) = $end;
my ($tmp);
- my ($bytes_to_read) = 4096;
+ my ($bytes_to_read) = 16384;
if ($where - $end > $bytes_to_read) {
$bytes_to_read = $where - $end;
}
+ if ($curoffset >= 16384) {
+ substr($stuff, 0, $curoffset) = "";
+ $total_length -= $curoffset;
+ $curoffset = 0;
+ }
while ($end < $where) {
my $foo = read ARGV, $tmp, $bytes_to_read;
-# print STDERR length $tmp, " ", length $stuff, " $curpos $where $bytes_to_read $foo $!", "\n";
$stuff .= $tmp;
-# print STDERR length $tmp, " ", length $stuff, " $curpos $where $bytes_to_read $foo $!", "\n\n";
- $end = length $stuff;
+ $end += $foo;
+ $total_length += $foo;
if ($old_end == $end) {
$atend = 1;
return 0;
@@ -99,8 +140,18 @@ sub get_stuff($) {
sub increment_curpos($) {
my ($curpos_increment) = @_;
- substr($stuff, 0, $curpos_increment) = "";
$curpos += $curpos_increment;
+ $curoffset += $curpos_increment;
+}
+
+# This slows things down tremendously...
+sub xdata($;$) {
+ my ($start, $end) = @_;
+ if (defined $end) {
+ return substr($stuff, $start + $curoffset, $end);
+ } else {
+ return substr($stuff, $start + $curoffset);
+ }
}
sub do_remote_command() {
@@ -108,73 +159,54 @@ sub do_remote_command() {
printf "%08x ", $curpos;
print "1b ( R ";
increment_curpos(3);
- get_stuff(2);
- my $lchar = substr($stuff, 0, 1);
- my $nlchar = unpack("C", $lchar);
- my $hchar = substr($stuff, 1, 1);
- my $nhchar = unpack("C", $hchar);
- printf "%02x %02x ", $nlchar, $nhchar;
+ fill_buffer(2);
+ my $lchar = substr($stuff, $curoffset + 0, 1);
+ my $nlchar = $nchartable{$lchar};
+ my $hchar = substr($stuff, $curoffset + 1, 1);
+ my $nhchar = $nchartable{$hchar};
+ printf " %02x %02x ", $nlchar, $nhchar;
my $skipchars = ($nhchar * 256) + $nlchar;
increment_curpos(2);
- my $i;
- my $char;
- my $nchar;
- get_stuff($skipchars);
- for ($i = 0; $i < $skipchars; $i++) {
- $char = substr($stuff, $i, 1);
- $nchar = unpack("C", $char);
- if ($nchar >= 32 && $nchar < 127) {
- print $char;
- } else {
- printf "%02x ", $nchar;
- }
+ fill_buffer($skipchars);
+ for (my $i = 0; $i < $skipchars; $i++) {
+ print $rchartable{substr($stuff, $curoffset + $i, 1)};
}
increment_curpos($skipchars);
- while (get_stuff(2) &&
- substr($stuff, 0, 2) =~ /[A-Z0-9][A-Z0-9]/) {
+ while (fill_buffer(2) &&
+ substr($stuff, $curoffset + 0, 2) =~ /[A-Z0-9][A-Z0-9]/) {
print "\n";
printf "%08x ", $curpos;
- my ($cmd) = substr($stuff, 0, 2);
+ my ($cmd) = substr($stuff, $curoffset + 0, 2);
print $cmd;
increment_curpos(2);
- get_stuff(2);
- $lchar = substr($stuff, 0, 1);
- $nlchar = unpack("C", $lchar);
- $hchar = substr($stuff, 1, 1);
- $nhchar = unpack("C", $hchar);
+ fill_buffer(2);
+ $lchar = substr($stuff, $curoffset + 0, 1);
+ $nlchar = $nchartable{$lchar};
+ $hchar = substr($stuff, $curoffset + 1, 1);
+ $nhchar = $nchartable{$hchar};
if ($cmd eq "DF") {
$skipchars = 0;
} else {
$skipchars = ($nhchar * 256) + $nlchar;
}
- printf "%02x %02x ", $nlchar, $nhchar;
+ printf " %02x %02x ", $nlchar, $nhchar;
increment_curpos(2);
- get_stuff($skipchars);
- for ($i = 0; $i < $skipchars; $i++) {
- printf "%02x ", unpack("C", substr($stuff, $i, 1));
- }
+ fill_buffer($skipchars);
+ printf "%*v02x ", " ", substr($stuff, $curoffset, $skipchars);
increment_curpos($skipchars);
}
}
-sub print_prefix_bytes($) {
+sub print_prefix_bytes($$) {
my ($bytes_to_print) = @_;
print "\n";
printf "%08x ", $curpos;
print "1b ";
- my $i;
- my $char;
- my $nchar;
- get_stuff($bytes_to_print);
- for ($i = 1; $i < $bytes_to_print; $i++) {
- $char = substr($stuff, $i, 1);
- $nchar = unpack("C", $char);
- if ($i < 2 && $nchar >= 32 && $nchar < 127) {
- print " $char ";
- } else {
- printf "%02x ", unpack("C", $char);
- }
- }
+ fill_buffer($bytes_to_print);
+ my $char = substr($stuff, $curoffset + 1, 1);
+ print "$chartable{$char} ";
+ printf "%*v02x ", " ", substr($stuff, $curoffset + 2, $bytes_to_print - 2);
+ increment_curpos($bytes_to_print);
}
sub print_output_data($$$$$$) {
@@ -193,25 +225,25 @@ sub print_output_data($$$$$$) {
}
my $savedots = $dots;
if ($comptype == 0) {
+ fill_buffer($dots / 8);
if ($opt_V) {
- get_stuff($dots);
- printf "%*v02x ", " ", substr($stuff, 0, $dots);
+ printf "%*v02x ", " ", substr($stuff, $curoffset + 0, $dots / 8);
}
- increment_curpos($dots);
+ increment_curpos($dots / 8);
} elsif ($comptype == 1) {
foreach $i (0..$rows-1) {
my ($found_something) = 0;
$dots = $savedots;
- my ($tstuff) = "\n $i ";;
+ my ($tstuff) = "\n $i ";
while ($dots > 0) {
- get_stuff(1);
- $counter = ord(substr($stuff, 0, 1));
+ fill_buffer(1);
+ $counter = ord(substr($stuff, $curoffset + 0, 1));
increment_curpos(1);
if ($counter <= 127) {
$counter++;
- get_stuff($counter);
+ fill_buffer($counter);
if ($opt_v || $opt_V) {
- my $tmp = sprintf "%*v02x ", " ", substr($stuff, 0, $counter);
+ my $tmp = sprintf "%*v02x ", " ", substr($stuff, $curoffset + 0, $counter);
if (!($tmp =~ /^[0 ]+$/)) {
$found_something = 1;
$last_row = $i;
@@ -226,9 +258,9 @@ sub print_output_data($$$$$$) {
increment_curpos($counter);
} else {
$counter = 257 - $counter;
- get_stuff(1);
+ fill_buffer(1);
if ($opt_v || $opt_V) {
- $fchar = sprintf "%v02x ", substr($stuff, 0, 1);
+ $fchar = sprintf "%v02x ", substr($stuff, $curoffset + 0, 1);
if ($fchar ne "00 ") {
$found_something = 1;
$last_row = $i;
@@ -248,63 +280,63 @@ sub print_output_data($$$$$$) {
$vstuff .= $tstuff;
}
}
- if ($opt_v) {
- my ($offset) = $offsets[$color];
- my ($first_position) = ($vertical_position / $vertical_unit)
- + ($first_row + $offset) * $raster_y;
- my ($last_position) = ($vertical_position / $vertical_unit)
- + ($last_row + $offset) * $raster_y;
- my ($final_position) = ($vertical_position / $vertical_unit)
- + ($rows + $offset) * $raster_y;
- my ($final_horizontal) = $horizontal_position +
- ($real_dots * $page_mgmt_unit * $raster_x);
- if ($print_offsets) {
- printf (" %d,%d+%d %.4f %d,%d+%d %.4f %.4f) ",
- $horizontal_position, $first_row, $offset, $first_position,
- $final_horizontal, $last_row, $offset, $last_position,
- $final_position);
- } else {
- printf (" %d,%d %.4f %d,%d %.4f %.4f) ",
- $horizontal_position, $first_row, $first_position,
- $final_horizontal, $last_row, $last_position,
- $final_position);
- }
- }
- if ($opt_V) {
- print " $vstuff";
- }
} else {
print "\nUnknown compression type $comptype!\n";
}
+ if ($opt_v) {
+ my ($offset) = $offsets[$color];
+ my ($first_position) = ($vertical_position / $vertical_unit)
+ + ($first_row + $offset) * $raster_y;
+ my ($last_position) = ($vertical_position / $vertical_unit)
+ + ($last_row + $offset) * $raster_y;
+ my ($final_position) = ($vertical_position / $vertical_unit)
+ + ($rows + $offset) * $raster_y;
+ my ($final_horizontal) = $horizontal_position +
+ ($real_dots * $page_mgmt_unit * $raster_x);
+ if ($print_offsets) {
+ printf (" %d,%d+%d %.4f %d,%d+%d %.4f %.4f) ",
+ $horizontal_position, $first_row, $offset, $first_position,
+ $final_horizontal, $last_row, $offset, $last_position,
+ $final_position);
+ } else {
+ printf (" %d,%d %.4f %d,%d %.4f %.4f) ",
+ $horizontal_position, $first_row, $first_position,
+ $final_horizontal, $last_row, $last_position,
+ $final_position);
+ }
+ }
+ if ($opt_V) {
+ print " $vstuff";
+ }
}
sub do_special_command() {
- get_stuff(8);
- my $comptype = unpack("C", substr($stuff, 2, 1));
+ fill_buffer(8);
+ my $comptype = $nchartable{substr($stuff, $curoffset + 2, 1)};
my $color = 0;
- my $dots = unpack("v", substr($stuff, 6, 2));
- my $rows = unpack("C", substr($stuff, 5, 1));
- print_prefix_bytes(8);
- increment_curpos(8);
+ my $dots = unpack("v", substr($stuff, $curoffset + 6, 2));
+ my $rows = $nchartable{substr($stuff, $curoffset + 5, 1)};
+ print_prefix_bytes(8, 2);
print_output_data($comptype, 1, $dots, $rows, 8, $color);
- get_stuff(1);
- while (substr($stuff, 0, 1) eq "\r") {
+ fill_buffer(1);
+ while (substr($stuff, $curoffset + 0, 1) eq "\r") {
+ fill_buffer(1);
increment_curpos(1);
}
}
sub do_special1_command() {
- get_stuff(9);
- my $color = unpack("C", substr($stuff, 2, 1));
- my $comptype = unpack("C", substr($stuff, 3, 1));
- my $bitsperpixel = unpack("C", substr($stuff, 4, 1));
- my $dots = unpack("v", substr($stuff, 5, 2));
- my $rows = unpack("v", substr($stuff, 7, 2));
- print_prefix_bytes(9);
- increment_curpos(9);
+ fill_buffer(9);
+ my $color = $nchartable{substr($stuff, $curoffset + 2, 1)};
+ my $comptype = $nchartable{substr($stuff, $curoffset + 3, 1)};
+ my $bitsperpixel = $nchartable{substr($stuff, $curoffset + 4, 1)};
+ my $dots = unpack("v", substr($stuff, $curoffset + 5, 2));
+ my $rows = unpack("v", substr($stuff, $curoffset + 7, 2));
+ print_prefix_bytes(9, 1);
print_output_data($comptype, $bitsperpixel, $dots, $rows, 1, $color);
- get_stuff(1);
- while (substr($stuff, 0, 1) eq "\r") {
+ fill_buffer(1);
+ while (substr($stuff, $curoffset + 0, 1) eq "\r") {
+ fill_buffer(1);
increment_curpos(1);
}
}
@@ -331,13 +363,13 @@ sub get_short($) {
sub get_byte($) {
my ($string) = @_;
- return unpack("C", $string);
+ return $nchartable{$string};
}
if ($opt_O) {
- my (@stuff) = split /,/, $opt_O;
+ my (@stuff) = split(/,/, $opt_O);
map {
- my ($key, $val) = split /=/;
+ my ($key, $val) = split(/=/, $_);
if ($val) {
$print_offsets = 1;
}
@@ -360,12 +392,15 @@ while (! $atend) {
my $char;
my $nchar;
my $bytes;
- get_stuff(2);
- if (substr($stuff, 0, 1) eq "$esc") {
+ my ($maxklen) = $keylengths{$seqkeys[0]};
+ fill_buffer(1);
+ my $cchar = substr($stuff, $curoffset + 0, 1);
+ if ($cchar eq "$esc") {
$found = 0;
- foreach $key (sort { length $b <=> length $a } keys %seqtable) {
- get_stuff(1 + length $key);
- if (substr($stuff, 1, length $key) eq $key) {
+ fill_buffer(2 + $maxklen);
+ foreach $key (@seqkeys) {
+ my ($klen) = $keylengths{$key};
+ if (substr($stuff, $curoffset + 1, $klen) eq $key) {
$skipchars = $seqtable{$key};
if ($skipchars eq "SPECIAL") {
do_special_command();
@@ -382,77 +417,89 @@ while (! $atend) {
print "1b ";
$startoff = 0;
my $print_stuff = 0;
+ my $print_variable = 0;
if ($skipchars eq "VARIABLE") {
- get_stuff((length $key) + 3);
- $kchar = substr($stuff, (length $key) + 1, 1);
+ fill_buffer(3);
+ $print_variable = 1;
+ $kchar = substr($stuff, $curoffset + $klen + 1, 1);
$nkchar = unpack("C", $kchar);
- $lchar = substr($stuff, (length $key) + 2, 1);
+ $lchar = substr($stuff, $curoffset + $klen + 2, 1);
$nlchar = unpack("C", $lchar);
- $hchar = substr($stuff, (length $key) + 3, 1);
+ $hchar = substr($stuff, $curoffset + $klen + 3, 1);
$nhchar = unpack("C", $hchar);
$skipchars = ($nhchar * 256) + $nlchar;
$startoff = 3;
$print_stuff = 1;
}
- get_stuff($skipchars + (length $key) + $startoff + 1);
- for ($i = 0;
- $i < $skipchars + (length $key) + $startoff;
- $i++) {
- $char = substr($stuff, $i + 1, 1);
- $nchar = unpack("C", $char);
- if ($i < 3 && $nchar >= 32 && $nchar < 127) {
- print " $char ";
- } else {
- printf "%02x ", unpack("C", $char);
+ my ($blen) = $skipchars + $klen + $startoff;
+ fill_buffer($blen + 1);
+ $char = substr($stuff, $curoffset + 1, 1);
+ print "$chartable{$char} ";
+ if ($blen > 1) {
+ $char = substr($stuff, $curoffset + 2, 1);
+ print "$chartable{$char} ";
+ if ($blen > 2) {
+ if ($print_variable && $char eq "d") {
+ printf ("%*v02x ", " ",
+ substr($stuff, $curoffset + 3, 2));
+ } else {
+ printf ("%*v02x ", " ",
+ substr($stuff, $curoffset + 3, $blen - 2));
+ }
}
}
if ($print_stuff) {
- my $xchar = substr($stuff, 2, 1);
+ my $xchar = substr($stuff, $curoffset + 2, 1);
if ($xchar eq "c") {
my ($top, $bottom);
if ($skipchars == 8) {
- $top = get_long(substr($stuff, 5, 4));
- $bottom = get_long(substr($stuff, 9, 4));
+ $top = get_long(substr($stuff, $curoffset + 5, 4));
+ if ($opt_v) {
+ $bottom = get_long(substr($stuff, $curoffset + 9, 4));
+ }
} else {
- $top = get_short(substr($stuff, 5, 2));
- $bottom = get_short(substr($stuff, 7, 2));
+ $top = get_short(substr($stuff, $curoffset + 5, 2));
+ if ($opt_v) {
+ $bottom = get_short(substr($stuff, $curoffset + 7, 2));
+ }
}
if ($opt_v) {
printf (" (page format %d %d %.2f %.2f)",
$top, $bottom, $top / $page_mgmt_unit,
$bottom / $page_mgmt_unit);
}
- $vertical_position =
+ $initial_vertical_position =
$top * $vertical_unit / $page_mgmt_unit;
+ $vertical_position = $initial_vertical_position;
} elsif ($xchar eq "S") {
- my ($width, $height);
- if ($skipchars == 8) {
- $width = get_long(substr($stuff, 5, 4));
- $height = get_long(substr($stuff, 9, 4));
- } else {
- $width = get_short(substr($stuff, 5, 2));
- $height = get_short(substr($stuff, 7, 2));
- }
if ($opt_v) {
+ my ($width, $height);
+ if ($skipchars == 8) {
+ $width = get_long(substr($stuff, $curoffset + 5, 4));
+ $height = get_long(substr($stuff, $curoffset + 9, 4));
+ } else {
+ $width = get_short(substr($stuff, $curoffset + 5, 2));
+ $height = get_short(substr($stuff, $curoffset + 7, 2));
+ }
printf (" (paper size %d %d %.2f %.2f)",
$width, $height, $width / $page_mgmt_unit,
$height / $page_mgmt_unit);
}
} elsif ($xchar eq "C") {
- my ($length);
- if ($skipchars == 4) {
- $length = get_long(substr($stuff, 5, 4));
- } else {
- $length = get_short(substr($stuff, 5, 2));
- }
if ($opt_v) {
+ my ($length);
+ if ($skipchars == 4) {
+ $length = get_long(substr($stuff, $curoffset + 5, 4));
+ } else {
+ $length = get_short(substr($stuff, $curoffset + 5, 2));
+ }
printf (" (page length %d %.2f)",
$length, $length / $page_mgmt_unit);
}
} elsif ($xchar eq "D") {
- my $base = get_short(substr($stuff, 5, 2));
- my $y = get_byte(substr($stuff, 7, 1));
- my $x = get_byte(substr($stuff, 8, 1));
+ my $base = get_short(substr($stuff, $curoffset + 5, 2));
+ my $y = $nchartable{substr($stuff, $curoffset + 7, 1)};
+ my $x = $nchartable{substr($stuff, $curoffset + 8, 1)};
$raster_x = $x / $base;
$raster_y = $y / $base;
if ($opt_v) {
@@ -461,10 +508,10 @@ while (! $atend) {
}
} elsif ($xchar eq "U") {
if ($skipchars == 5) {
- my $page_mgmt = get_byte(substr($stuff, 5, 1));
- my $vertical = get_byte(substr($stuff, 6, 1));
- my $horiz = get_byte(substr($stuff, 7, 1));
- my $scale = get_short(substr($stuff, 8, 2));
+ my $page_mgmt = $nchartable{substr($stuff, $curoffset + 5, 1)};
+ my $vertical = $nchartable{substr($stuff, $curoffset + 6, 1)};
+ my $horiz = $nchartable{substr($stuff, $curoffset + 7, 1)};
+ my $scale = get_short(substr($stuff, $curoffset + 8, 2));
$page_mgmt_unit = $scale / $page_mgmt;
$horizontal_unit = $scale / $horiz;
$vertical_unit = $scale / $vertical;
@@ -474,20 +521,20 @@ while (! $atend) {
$vertical_unit, $horizontal_unit);
}
} else {
- my $page_mgmt = get_byte(substr($stuff, 5, 1));
+ my $page_mgmt = $nchartable{substr($stuff, $curoffset + 5, 1)};
if ($opt_v) {
- printf " (units base = %d/720)", $page_mgmt;
+ printf " (units base = %d/3600)", $page_mgmt;
}
- $page_mgmt_unit = $page_mgmt;
- $horizontal_unit = $page_mgmt;
- $vertical_unit = $page_mgmt;
+ $page_mgmt_unit = 3600 / $page_mgmt;
+ $horizontal_unit = 3600 / $page_mgmt;
+ $vertical_unit = 3600 / $page_mgmt;
}
} elsif ($xchar eq "v") {
my ($length);
if ($skipchars == 4) {
- $length = get_long(substr($stuff, 5, 4));
+ $length = get_long(substr($stuff, $curoffset + 5, 4));
} else {
- $length = get_short(substr($stuff, 5, 2));
+ $length = get_short(substr($stuff, $curoffset + 5, 2));
}
$vertical_position += $length;
if ($opt_v) {
@@ -496,24 +543,25 @@ while (! $atend) {
$vertical_position / $vertical_unit);
}
} elsif ($xchar eq "\$") {
- my ($length);
if ($skipchars == 4) {
$horizontal_position =
- get_long(substr($stuff, 5, 4));
+ get_long(substr($stuff, $curoffset + 5, 4));
} else {
$horizontal_position =
- get_short(substr($stuff, 5, 2));
+ get_short(substr($stuff, $curoffset + 5, 2));
}
if ($opt_v) {
printf (" (horizontal position %d %.4f)",
$horizontal_position,
$horizontal_position / $horizontal_unit);
}
+ } elsif ($xchar eq "d") {
+ printf " (nop)";
}
}
$found = 1;
}
- $bytes = length($key) + 1 + $skipchars + $startoff;
+ $bytes = $klen + 1 + $skipchars + $startoff;
last;
}
}
@@ -525,29 +573,16 @@ while (! $atend) {
} elsif ($found == 1) {
increment_curpos($bytes);
}
- } elsif (substr($stuff, 0, 1) eq "\0" ||
- substr($stuff, 0, 1) eq "\f") {
- get_stuff(1);
- $char = substr($stuff, 0, 1);
- $nchar = unpack("C", $char);
- if ($nchar >= 32 && $nchar < 127) {
- print " $char ";
- } else {
- printf "%02x ", unpack("C", $char);
- }
+ } elsif ($cchar eq "\0" || $cchar eq "\f") {
+ printf "\n%08x ", $curpos;
+ print "$chartable{$cchar} ";
+ $vertical_position = $initial_vertical_position;
increment_curpos(1);
} else {
- get_stuff(1);
- $char = substr($stuff, 0, 1);
- $nchar = unpack("C", $char);
- if ($nchar >= 32 && $nchar < 127) {
- print " *$char ";
- } else {
- printf "*%02x ", unpack("C", $char);
- }
+ print "$xchartable{$cchar} " if ($cchar ne "\021");
increment_curpos(1);
}
}
-print "\n";
+print "\n" if $curpos > 1;
diff --git a/test/run-testdither b/test/run-testdither
index eb24b6c..1ae0db3 100755
--- a/test/run-testdither
+++ b/test/run-testdither
@@ -3,7 +3,7 @@
out_status=0
if [ -z "$STP_DATA_PATH" ] ; then
- STP_DATA_PATH=`pwd`/../src/main
+ STP_DATA_PATH=`pwd`/../src/xml
export STP_DATA_PATH
fi
diff --git a/test/run-weavetest b/test/run-weavetest
index f87315e..e3bf2db 100755
--- a/test/run-weavetest
+++ b/test/run-weavetest
@@ -1,7 +1,7 @@
#!/bin/sh
if [ -z "$STP_DATA_PATH" ] ; then
- STP_DATA_PATH=`pwd`/../src/main
+ STP_DATA_PATH=`pwd`/../src/xml
export STP_DATA_PATH
fi
@@ -13,7 +13,7 @@ fi
passes='1,1,1 2,1,1 1,2,1 1,2,2 1,4,1 4,1,1 4,2,1 2,2,1 1,4,2 2,2,2 2,4,2 8,1,1 4,4,2 8,2,1 16,1,1'
# All numbers of jets used by any printer.
-jets='1 2 4 8 15 16 20 21 24 29 32 47 48 59 60 64 90 96 128 144 180 192 208 360'
+jets='1 2 4 8 15 16 20 21 24 29 32 47 48 59 60 64 90 96 128 144 180 192 208 358 360 384'
# All nozzle separations used by any printer at any resolution.
separations='1 2 3 4 6 8 12 16 24'
@@ -27,11 +27,11 @@ strategies='0 1 2 3 4'
arrangements='0 1 2 3'
# Set to the largest possible multiple of the number of heads and
-# the nozzle separation. At present, the PM-970C has 360 heads spaced
+# the nozzle separation. At present, the WorkForce 40 has 384 heads spaced
# 1/360" apart, with a maximum resolution of 2880x2880. There's no
# point right now in testing anything higher than this, and it's very
# time consuming.
-head_limit=2880
+head_limit=3072
if [ $# -eq 0 ] ; then
QUIET=1
diff --git a/test/unprint.c b/test/unprint.c
index 4422596..cef064b 100644
--- a/test/unprint.c
+++ b/test/unprint.c
@@ -1,4 +1,4 @@
-/* $Id: unprint.c,v 1.39 2008/01/27 21:28:08 rlk Exp $ */
+/* $Id: unprint.c,v 1.42 2008/07/18 02:03:48 rlk Exp $ */
/*
* Generate PPM files from printer output
*
@@ -87,7 +87,7 @@ typedef struct {
* actually read in the data. This optimization may be worthwhile.
*/
-#define MAX_INKS 12
+#define MAX_INKS 20
typedef struct {
unsigned char *line[MAX_INKS];
int startx[MAX_INKS];
@@ -115,10 +115,10 @@ line_type **page=NULL;
/* Color Codes:
color Epson1 Epson2 Sequential
- Black 0 0 0
- Magenta 1 1 1
- Cyan 2 2 2
- Yellow 4 4 3
+ Black 0 0 0/16
+ Magenta 1 1 1/17
+ Cyan 2 2 2/18
+ Yellow 4 4 3/19
L.Mag. 17 257 4
L.Cyan 18 258 5
L.Black 16 256 6
@@ -128,6 +128,7 @@ line_type **page=NULL;
P.Black 64 N/A 0
Gloss 9 N/A 10
LL.Black 48 768 11
+ Orange 10 N/A 12
*/
/* convert either Epson1 or Epson2 color encoding into a sequential encoding */
@@ -137,7 +138,6 @@ seqcolor(int c)
switch (c)
{
case 0:
- case 64:
return 0;
case 1:
return 1;
@@ -166,6 +166,16 @@ seqcolor(int c)
case 48:
case 768:
return 11;
+ case 10:
+ return 12;
+ case 64:
+ return 16;
+ case 65:
+ return 17;
+ case 66:
+ return 18;
+ case 68:
+ return 19;
default:
return 0;
}
@@ -273,18 +283,27 @@ set_bits(unsigned char *p,int idx,int value)
}
static float ink_colors[MAX_INKS][4] =
-{{ 0, 0, 0, 1 }, /* K */
- { 1, .1, 1, 1 }, /* M */
- { .1, .7, .7, 1 }, /* C */
- { 1, 1, .1, 1 }, /* Y */
- { 1, .7, 1, 1 }, /* m */
- { .4, 1, 1, 1 }, /* c */
- { .7, .7, .7, 1 }, /* k */
- { .7, .7, 0, 1 }, /* dY */
- { 1, 0, 0, 1 }, /* R */
- { 0, 0, 1, 1 }, /* B */
- { 1, 1, 1, 1 }, /* Gloss */
- { .8, .8, .8, 1 }, /* llk */
+/* C(R) M(G) Y(B) K(W) */
+{{ 0, 0, 0, 1 }, /* 0 K */
+ { 1, .1, 1, 1 }, /* 1 M */
+ { .1, 1, 1, 1 }, /* 2 C */
+ { 1, 1, .1, 1 }, /* 3 Y */
+ { 1, .7, 1, 1 }, /* 4 m */
+ { .4, 1, 1, 1 }, /* 5 c */
+ { .7, .7, .7, 1 }, /* 6 k */
+ { .7, .7, 0, 1 }, /* 7 dY */
+ { 1, 0, 0, 1 }, /* 8 R */
+ { 0, 0, 1, 1 }, /* 8 B */
+ { 1, 1, 1, 1 }, /* 10 Gloss */
+ { .8, .8, .8, 1 }, /* 11 llk */
+ { .9, .3, 0, 1 }, /* 12 Orange */
+ { 0, 0, 0, 1 }, /* 13 K */
+ { 0, 0, 0, 1 }, /* 14 K */
+ { 0, 0, 0, 1 }, /* 15 K */
+ { 0, 0, 0, 1 }, /* 16 K */
+ { 1, .1, 1, 1 }, /* 17 M */
+ { .1, 1, 1, 1 }, /* 18 C */
+ { 1, 1, .1, 1 }, /* 19 Y */
};
static float quadtone_inks[] = { 0.0, .25, .5, .75 };
@@ -1040,6 +1059,7 @@ parse_escp2_extended(FILE *fp_r)
break;
case 's': /* Set print speed */
+ case 'm': /* Set paper type */
break;
case 'S': /* set paper dimensions */
switch (bufsize)
diff --git a/test/xml-curve.c b/test/xml-curve.c
index f896971..6bebf3a 100644
--- a/test/xml-curve.c
+++ b/test/xml-curve.c
@@ -1,5 +1,5 @@
/*
- * "$Id: xml-curve.c,v 1.6 2004/09/17 18:38:28 rleigh Exp $"
+ * "$Id: xml-curve.c,v 1.7 2008/08/02 15:10:56 rleigh Exp $"
*
* Copyright 2002 Robert Krawitz (rlk@alum.mit.edu)
*
@@ -40,7 +40,7 @@ int main(int argc, char *argv[])
stp_init();
#ifdef DEBUG
- fprintf(stderr, "stp-xml-parse: reading `%s'...\n", file);
+ fprintf(stderr, "stp-xml-parse: reading `%s'...\n", argv[1]);
#endif
fprintf(stderr, "Using file: %s\n", argv[1]);