diff options
author | Didier Raboud <odyx@debian.org> | 2016-10-05 09:16:08 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2016-10-05 09:16:08 +0200 |
commit | d69d392d8c45cdcc93e58f0e1bdbb2b66d6b9566 (patch) | |
tree | fbd96013c3d605249b167a97c8862f38f8a1cdee /src/testpattern | |
parent | 7f5731038556e5b03d2a886163ca2c873c77333d (diff) |
New upstream version 5.2.12~pre3
Diffstat (limited to 'src/testpattern')
-rw-r--r-- | src/testpattern/Makefile.am | 21 | ||||
-rw-r--r-- | src/testpattern/Makefile.in | 31 | ||||
-rwxr-xr-x | src/testpattern/compare-checksums.in | 80 | ||||
-rw-r--r-- | src/testpattern/compress-checksums.in | 121 | ||||
-rw-r--r-- | src/testpattern/run-testpattern-2.in | 1 | ||||
-rw-r--r-- | src/testpattern/testpatternl.c | 2 | ||||
-rw-r--r-- | src/testpattern/testpatternl.l | 2 | ||||
-rw-r--r-- | src/testpattern/testpatterny.c | 143 | ||||
-rw-r--r-- | src/testpattern/testpatterny.y | 3 | ||||
-rw-r--r-- | src/testpattern/uncompress-checksums.in | 47 |
10 files changed, 349 insertions, 102 deletions
diff --git a/src/testpattern/Makefile.am b/src/testpattern/Makefile.am index b02ac4a..8e3089d 100644 --- a/src/testpattern/Makefile.am +++ b/src/testpattern/Makefile.am @@ -33,7 +33,7 @@ TESTS = run-testpattern-1 run-testpattern-2 if BUILD_TESTPATTERN bin_PROGRAMS = testpattern noinst_PROGRAMS = printers printer_options -noinst_SCRIPTS = run-testpattern-2 compare-checksums +noinst_SCRIPTS = run-testpattern-2 compare-checksums compress-checksums uncompress-checksums endif AM_LFLAGS = -i @@ -55,10 +55,25 @@ if INSTALL_SAMPLES pkgdata_DATA = testpattern.sample extended.sample endif +## Generate checksums + +if BUILD_TESTPATTERN +checksums: testpattern run-testpattern-2 ./compress-checksums + $(MKDIR_P) Checksums + ./run-testpattern-2 -q -M Checksums/sums.@GUTENPRINT_VERSION@.in + ./compress-checksums < Checksums/sums.@GUTENPRINT_VERSION@.in |$(BZIP2) -c > Checksums/sums.@GUTENPRINT_VERSION@.bz2 + rm -f Checksums/sums.@GUTENPRINT_VERSION@.in +endif ## Clean MAINTAINERCLEANFILES = Makefile.in testpatternl.c testpatterny.c testpatterny.h -EXTRA_DIST = testpatterny.h $(pkgdata_DATA) run-testpattern run-testpattern-1 compare-checksums.in - +EXTRA_DIST = \ + testpatterny.h \ + $(pkgdata_DATA) \ + run-testpattern \ + run-testpattern-1 \ + compare-checksums.in \ + compress-checksums.in \ + uncompress-checksums.in diff --git a/src/testpattern/Makefile.in b/src/testpattern/Makefile.in index 9003446..9b44a91 100644 --- a/src/testpattern/Makefile.in +++ b/src/testpattern/Makefile.in @@ -86,8 +86,9 @@ build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/scripts/global.mk $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/run-testpattern-2.in \ - $(srcdir)/compare-checksums.in testpatterny.h testpatterny.c \ - testpatternl.c $(top_srcdir)/scripts/depcomp \ + $(srcdir)/compare-checksums.in $(srcdir)/compress-checksums.in \ + $(srcdir)/uncompress-checksums.in testpatterny.h \ + testpatterny.c testpatternl.c $(top_srcdir)/scripts/depcomp \ $(top_srcdir)/scripts/ylwrap $(top_srcdir)/scripts/test-driver @BUILD_TESTPATTERN_TRUE@bin_PROGRAMS = testpattern$(EXEEXT) @BUILD_TESTPATTERN_TRUE@noinst_PROGRAMS = printers$(EXEEXT) \ @@ -108,7 +109,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = run-testpattern-2 compare-checksums +CONFIG_CLEAN_FILES = run-testpattern-2 compare-checksums \ + compress-checksums uncompress-checksums CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgdatadir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) @@ -424,6 +426,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_CUPS_PPDS = @BUILD_CUPS_PPDS@ +BZIP2 = @BZIP2@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -631,7 +634,7 @@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la TESTS = run-testpattern-1 run-testpattern-2 -@BUILD_TESTPATTERN_TRUE@noinst_SCRIPTS = run-testpattern-2 compare-checksums +@BUILD_TESTPATTERN_TRUE@noinst_SCRIPTS = run-testpattern-2 compare-checksums compress-checksums uncompress-checksums AM_LFLAGS = -i AM_YFLAGS = -d testpattern_SOURCES = testpattern.c testpatterny.y testpatternl.l testpattern.h @@ -640,7 +643,15 @@ printers_LDADD = $(GUTENPRINT_LIBS) printer_options_LDADD = $(GUTENPRINT_LIBS) @INSTALL_SAMPLES_TRUE@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 compare-checksums.in +EXTRA_DIST = \ + testpatterny.h \ + $(pkgdata_DATA) \ + run-testpattern \ + run-testpattern-1 \ + compare-checksums.in \ + compress-checksums.in \ + uncompress-checksums.in + all: all-am .SUFFIXES: @@ -680,6 +691,10 @@ run-testpattern-2: $(top_builddir)/config.status $(srcdir)/run-testpattern-2.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ compare-checksums: $(top_builddir)/config.status $(srcdir)/compare-checksums.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +compress-checksums: $(top_builddir)/config.status $(srcdir)/compress-checksums.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +uncompress-checksums: $(top_builddir)/config.status $(srcdir)/uncompress-checksums.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ @@ -1226,6 +1241,12 @@ $(top_builddir)/src/gutenprintui2/libgutenprintui2.la: testpatternl.o: testpatterny.o testpattern.o: testpatterny.o +@BUILD_TESTPATTERN_TRUE@checksums: testpattern run-testpattern-2 ./compress-checksums +@BUILD_TESTPATTERN_TRUE@ $(MKDIR_P) Checksums +@BUILD_TESTPATTERN_TRUE@ ./run-testpattern-2 -q -M Checksums/sums.@GUTENPRINT_VERSION@.in +@BUILD_TESTPATTERN_TRUE@ ./compress-checksums < Checksums/sums.@GUTENPRINT_VERSION@.in |$(BZIP2) -c > Checksums/sums.@GUTENPRINT_VERSION@.bz2 +@BUILD_TESTPATTERN_TRUE@ rm -f Checksums/sums.@GUTENPRINT_VERSION@.in + # 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/compare-checksums.in b/src/testpattern/compare-checksums.in index c27ffdf..1d7e1ea 100755 --- a/src/testpattern/compare-checksums.in +++ b/src/testpattern/compare-checksums.in @@ -1,4 +1,19 @@ #!@PERL@ +## Copyright (C) 2016 Robert Krawitz +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use strict; @@ -14,9 +29,6 @@ if ($#ARGV != 1) { die "Usage: $0 old_checksum_file new_checksum_file\n"; } -open(OLD, $ARGV[0]) or die("Can't open old checksum file $ARGV[0]: $!\n"); -open(NEW, $ARGV[1]) or die("Can't open new checksum file $ARGV[1]: $!\n"); - sub get_printer($) { my ($mode) = @_; $mode =~ s/_PrintingMode.*//; @@ -29,25 +41,53 @@ sub get_mode($) { return $mode; } -while (<OLD>) { - chomp; - my ($sum, $mode) = split(/ +[*]?/); - $mode =~ s/\.prn$//; - $old_modes{$mode} = $sum; - my ($printer) = get_printer($mode); - $old_printers{$printer} = 1; +sub load_file($\%\%) { + my ($file, $modes, $printers) = @_; + if ($file =~ /\.bz2$/) { + open(IN, "bunzip2 -c $file|") or die("Can't open checksum file $file: $!\n"); + } elsif ($file =~ /.gz$/) { + open(IN, "gunzip -c $file|") or die("Can't open checksum file $file: $!\n"); + } else { + open(IN, "$file") or die("Can't open checksum file $file: $!\n"); + } + my ($inline); + while ($inline = <IN>) { + chomp $inline; + my ($sum, @okeys) = split(/ /, $inline); + my @keys = map { + s/\.prn$//; + s/^\*//; + $_; + } @okeys; + my (@pchunks) = (); + foreach my $k (@keys) { + $k =~ s/=/________/g; + $k =~ s/!/_______/g; + $k =~ s/"/______/g; + $k =~ s/,/_____/g; + $k =~ s/'/____/g; + $k =~ s/%/___/g; + $k =~ s/>/__/g; + my (@chunks) = split(/_/, $k, -1); + foreach my $i (0..$#chunks) { + if ($chunks[$i] eq '') { + $chunks[$i] = $pchunks[$i]; + } elsif ($chunks[$i] =~ /^([0-9]+)\+(.*)/) { + $chunks[$i] = substr($pchunks[$i], 0, $1) . $2; + } + } + my ($val) = join('_', @chunks); + $val =~ s/(^[^:]*)_:(.*)/$2_$1/; + $$modes{$val} = $sum; + $$printers{get_printer($val)} = 1; + @pchunks = @chunks; + } + } + close IN; } -close OLD; - -while (<NEW>) { - chomp; - my ($sum, $mode) = split(/ +[*]?/); - $mode =~ s/\.prn$//; - $new_modes{$mode} = $sum; - my ($printer) = get_printer($mode); - $new_printers{$printer} = 1; -} +load_file($ARGV[0], %old_modes, %old_printers); +load_file($ARGV[1], %new_modes, %new_printers); my (%only_old_printers, %only_new_printers); diff --git a/src/testpattern/compress-checksums.in b/src/testpattern/compress-checksums.in new file mode 100644 index 0000000..5ecfee3 --- /dev/null +++ b/src/testpattern/compress-checksums.in @@ -0,0 +1,121 @@ +#!@PERL@ +## Copyright (C) 2016 Robert Krawitz +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +use strict; + +my (%checksums); + +while (<>) { + chomp; + my ($sum, @keys) = split; + my (@pchunks) = (); + foreach my $k (@keys) { + my (@chunks) = split(/_/, $k, -1); + foreach my $i (0..$#chunks) { + if ($chunks[$i] eq '') { + $chunks[$i] = $pchunks[$i]; + } elsif ($chunks[$i] =~ /^([0-9]+)\+(.*)/) { + $chunks[$i] = substr($pchunks[$i], 0, $1) . $2; + } + } + my $key = join('_', @chunks), '.prn'; + if (! defined $checksums{$sum}) { + $checksums{$sum} = []; + } + push @{$checksums{$sum}}, $key; + } +} + +sub min($$) { + my ($a, $b) = @_; + if ($a < $b) { + return $a; + } else { + return $b; + } +} + +sub get_printer($) { + my ($mode) = @_; + $mode =~ s/_PrintingMode.*//; + return $mode; +} + +sub get_mode($) { + my ($mode) = @_; + $mode =~ s/.*_PrintingMode/PrintingMode/; + return $mode; +} + +foreach my $sum (sort keys %checksums) { + my ($out) = $sum; + my ($prun) = ""; + my (@pchunks) = (); + my ($plen) = 0; + my (@runs) = sort map { + s/^\*//; + s/\.prn$//; + my ($printer) = get_printer($_); + my ($mode) = get_mode($_); + "${mode}_:$printer" + } @{$checksums{$sum}}; + foreach my $run (@runs) { + my (@chunks) = split(/_/, $run); + my ($mchunks) = min(scalar @pchunks, scalar @chunks); + my ($i) = 0; + $out .= " "; + while ($i < $mchunks) { + if ($i > 0) { + $out .= '_'; + } + if ($chunks[$i] ne $pchunks[$i]) { + my ($plen) = length $pchunks[$i]; + my ($len) = length $chunks[$i]; + my ($maxc) = min($len, $plen); + my ($dup) = 0; + while ($dup < $maxc) { + last if (substr($pchunks[$i], $dup, 1) ne + substr($chunks[$i], $dup, 1)); + $dup++; + } + if ($dup > 2) { + $out .= "$dup+" . substr($chunks[$i], $dup); + } else { + $out .= "$chunks[$i]"; + } + } else { + $out .= ""; + } + $i++; + } + if ($i < scalar @chunks) { + if ($i > 0) { + $out .= '_'; + } + $out .= join("_", @chunks[$i..$#chunks]); + } + $out =~ s/________/=/g; + $out =~ s/_______/!/g; + $out =~ s/______/"/g; + $out =~ s/_____/,/g; + $out =~ s/____/'/g; + $out =~ s/___/%/g; + $out =~ s/__/>/g; + @pchunks = @chunks; + } + print "$out\n"; +} diff --git a/src/testpattern/run-testpattern-2.in b/src/testpattern/run-testpattern-2.in index 48d84d2..8df73b8 100644 --- a/src/testpattern/run-testpattern-2.in +++ b/src/testpattern/run-testpattern-2.in @@ -8,6 +8,7 @@ use strict; my $valgrind = 0; my $callgrind = 0; my $gdb_attach = 0; +my $compress_checksums = 0; my $csum_file = undef; my $csum_dir = undef; my $csum_type = 'sha512'; diff --git a/src/testpattern/testpatternl.c b/src/testpattern/testpatternl.c index 3a6e90e..c042918 100644 --- a/src/testpattern/testpatternl.c +++ b/src/testpattern/testpatternl.c @@ -804,7 +804,7 @@ c_strstrip(char *s) return sn; } else - return strdup(s); + return stp_strdup(s); } #define DBG(x) \ diff --git a/src/testpattern/testpatternl.l b/src/testpattern/testpatternl.l index 21f1530..a340ce6 100644 --- a/src/testpattern/testpatternl.l +++ b/src/testpattern/testpatternl.l @@ -52,7 +52,7 @@ c_strstrip(char *s) return sn; } else - return strdup(s); + return stp_strdup(s); } #define DBG(x) \ diff --git a/src/testpattern/testpatterny.c b/src/testpattern/testpatterny.c index 47bd3bf..da90dcc 100644 --- a/src/testpattern/testpatterny.c +++ b/src/testpattern/testpatterny.c @@ -71,6 +71,7 @@ #endif #include <string.h> +#include <strings.h> #include <stdio.h> #include <stdlib.h> #include "testpattern.h" @@ -131,7 +132,7 @@ find_color(const char *name) /* Line 371 of yacc.c */ -#line 135 "testpatterny.c" +#line 136 "testpatterny.c" # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus @@ -292,7 +293,7 @@ int yyparse (); /* Copy the second part of user declarations. */ /* Line 390 of yacc.c */ -#line 296 "testpatterny.c" +#line 297 "testpatterny.c" #ifdef short # undef short @@ -628,20 +629,20 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 143, 143, 143, 148, 158, 168, 178, 188, 198, - 208, 218, 218, 218, 218, 218, 218, 218, 221, 229, - 229, 232, 235, 245, 254, 264, 273, 280, 287, 294, - 303, 312, 321, 321, 324, 334, 343, 352, 361, 375, - 375, 375, 375, 375, 377, 384, 391, 398, 405, 412, - 419, 426, 426, 426, 426, 428, 430, 437, 444, 452, - 460, 475, 475, 478, 478, 481, 484, 498, 511, 511, - 514, 514, 517, 517, 520, 520, 523, 538, 541, 556, - 567, 584, 591, 591, 594, 597, 607, 613, 613, 616, - 620, 624, 624, 624, 624, 624, 624, 625, 625, 625, - 625, 625, 625, 625, 626, 626, 626, 626, 626, 626, - 627, 627, 627, 627, 630, 634, 634, 634, 634, 637, - 641, 641, 644, 648, 648, 651, 651, 654, 654, 659, - 658 + 0, 144, 144, 144, 149, 159, 169, 179, 189, 199, + 209, 219, 219, 219, 219, 219, 219, 219, 222, 230, + 230, 233, 236, 246, 255, 265, 274, 281, 288, 295, + 304, 313, 322, 322, 325, 335, 344, 353, 362, 376, + 376, 376, 376, 376, 378, 385, 392, 399, 406, 413, + 420, 427, 427, 427, 427, 429, 431, 438, 445, 453, + 461, 476, 476, 479, 479, 482, 485, 499, 512, 512, + 515, 515, 518, 518, 521, 521, 524, 539, 542, 557, + 568, 585, 592, 592, 595, 598, 608, 614, 614, 617, + 621, 625, 625, 625, 625, 625, 625, 626, 626, 626, + 626, 626, 626, 626, 627, 627, 627, 627, 627, 627, + 628, 628, 628, 628, 631, 635, 635, 635, 635, 638, + 642, 642, 645, 649, 649, 652, 652, 655, 655, 660, + 659 }; #endif @@ -1682,14 +1683,14 @@ yyreduce: { case 3: /* Line 1792 of yacc.c */ -#line 144 "testpatterny.y" +#line 145 "testpatterny.y" { } break; case 4: /* Line 1792 of yacc.c */ -#line 149 "testpatterny.y" +#line 150 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>cmykspec\n"); @@ -1701,7 +1702,7 @@ yyreduce: case 5: /* Line 1792 of yacc.c */ -#line 159 "testpatterny.y" +#line 160 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>kcmyspec\n"); @@ -1713,7 +1714,7 @@ yyreduce: case 6: /* Line 1792 of yacc.c */ -#line 169 "testpatterny.y" +#line 170 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>rgbspec\n"); @@ -1725,7 +1726,7 @@ yyreduce: case 7: /* Line 1792 of yacc.c */ -#line 179 "testpatterny.y" +#line 180 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>cmyspec\n"); @@ -1737,7 +1738,7 @@ yyreduce: case 8: /* Line 1792 of yacc.c */ -#line 189 "testpatterny.y" +#line 190 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>grayspec\n"); @@ -1749,7 +1750,7 @@ yyreduce: case 9: /* Line 1792 of yacc.c */ -#line 199 "testpatterny.y" +#line 200 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>whitespec\n"); @@ -1761,7 +1762,7 @@ yyreduce: case 10: /* Line 1792 of yacc.c */ -#line 209 "testpatterny.y" +#line 210 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>extendedspec %d\n", (yyvsp[(2) - (2)].ival)); @@ -1773,7 +1774,7 @@ yyreduce: case 18: /* Line 1792 of yacc.c */ -#line 222 "testpatterny.y" +#line 223 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>modespec2 %d\n", (yyvsp[(2) - (2)].ival)); @@ -1784,7 +1785,7 @@ yyreduce: case 22: /* Line 1792 of yacc.c */ -#line 236 "testpatterny.y" +#line 237 "testpatterny.y" { int channel = find_color((yyvsp[(2) - (3)].sval)); if (getenv("STP_TESTPATTERN_DEBUG")) @@ -1796,7 +1797,7 @@ yyreduce: case 23: /* Line 1792 of yacc.c */ -#line 246 "testpatterny.y" +#line 247 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>channel_level %d %f\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].dval)); @@ -1807,7 +1808,7 @@ yyreduce: case 24: /* Line 1792 of yacc.c */ -#line 255 "testpatterny.y" +#line 256 "testpatterny.y" { int channel = find_color((yyvsp[(2) - (3)].sval)); if (getenv("STP_TESTPATTERN_DEBUG")) @@ -1819,7 +1820,7 @@ yyreduce: case 25: /* Line 1792 of yacc.c */ -#line 265 "testpatterny.y" +#line 266 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>channel_gamma %d %f\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].dval)); @@ -1830,7 +1831,7 @@ yyreduce: case 26: /* Line 1792 of yacc.c */ -#line 274 "testpatterny.y" +#line 275 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>global_gamma %f\n", (yyvsp[(2) - (2)].dval)); @@ -1840,7 +1841,7 @@ yyreduce: case 27: /* Line 1792 of yacc.c */ -#line 281 "testpatterny.y" +#line 282 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>steps %d\n", (yyvsp[(2) - (2)].ival)); @@ -1850,7 +1851,7 @@ yyreduce: case 28: /* Line 1792 of yacc.c */ -#line 288 "testpatterny.y" +#line 289 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>ink_limit %f\n", (yyvsp[(2) - (2)].dval)); @@ -1860,18 +1861,18 @@ yyreduce: case 29: /* Line 1792 of yacc.c */ -#line 295 "testpatterny.y" +#line 296 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>printer %s\n", (yyvsp[(2) - (2)].sval)); - global_printer = strdup((yyvsp[(2) - (2)].sval)); + global_printer = stp_strdup((yyvsp[(2) - (2)].sval)); free((yyvsp[(2) - (2)].sval)); } break; case 30: /* Line 1792 of yacc.c */ -#line 304 "testpatterny.y" +#line 305 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>page_size_name %s\n", (yyvsp[(2) - (2)].sval)); @@ -1882,7 +1883,7 @@ yyreduce: case 31: /* Line 1792 of yacc.c */ -#line 313 "testpatterny.y" +#line 314 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>page_size_custom %d %d\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].ival)); @@ -1893,7 +1894,7 @@ yyreduce: case 34: /* Line 1792 of yacc.c */ -#line 325 "testpatterny.y" +#line 326 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>parameter_string %s %s\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].sval)); @@ -1905,7 +1906,7 @@ yyreduce: case 35: /* Line 1792 of yacc.c */ -#line 335 "testpatterny.y" +#line 336 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>parameter_int %s %d\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].ival)); @@ -1916,7 +1917,7 @@ yyreduce: case 36: /* Line 1792 of yacc.c */ -#line 344 "testpatterny.y" +#line 345 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>parameter_bool %s %d\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].ival)); @@ -1927,7 +1928,7 @@ yyreduce: case 37: /* Line 1792 of yacc.c */ -#line 353 "testpatterny.y" +#line 354 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>parameter_float %s %f\n", (yyvsp[(2) - (3)].sval), (yyvsp[(3) - (3)].dval)); @@ -1938,7 +1939,7 @@ yyreduce: case 38: /* Line 1792 of yacc.c */ -#line 362 "testpatterny.y" +#line 363 "testpatterny.y" { stp_curve_t *curve = stp_curve_create_from_string((yyvsp[(3) - (3)].sval)); if (getenv("STP_TESTPATTERN_DEBUG")) @@ -1954,7 +1955,7 @@ yyreduce: case 44: /* Line 1792 of yacc.c */ -#line 378 "testpatterny.y" +#line 379 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>density %f\n", (yyvsp[(2) - (2)].dval)); @@ -1964,7 +1965,7 @@ yyreduce: case 45: /* Line 1792 of yacc.c */ -#line 385 "testpatterny.y" +#line 386 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>top %f\n", (yyvsp[(2) - (2)].dval)); @@ -1974,7 +1975,7 @@ yyreduce: case 46: /* Line 1792 of yacc.c */ -#line 392 "testpatterny.y" +#line 393 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>left %f\n", (yyvsp[(2) - (2)].dval)); @@ -1984,7 +1985,7 @@ yyreduce: case 47: /* Line 1792 of yacc.c */ -#line 399 "testpatterny.y" +#line 400 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>relative size\n"); @@ -1994,7 +1995,7 @@ yyreduce: case 48: /* Line 1792 of yacc.c */ -#line 406 "testpatterny.y" +#line 407 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>size inches\n"); @@ -2004,7 +2005,7 @@ yyreduce: case 49: /* Line 1792 of yacc.c */ -#line 413 "testpatterny.y" +#line 414 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>size pt\n"); @@ -2014,7 +2015,7 @@ yyreduce: case 50: /* Line 1792 of yacc.c */ -#line 420 "testpatterny.y" +#line 421 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>size mm\n"); @@ -2024,7 +2025,7 @@ yyreduce: case 56: /* Line 1792 of yacc.c */ -#line 431 "testpatterny.y" +#line 432 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>hsize %f\n", (yyvsp[(2) - (2)].dval)); @@ -2034,7 +2035,7 @@ yyreduce: case 57: /* Line 1792 of yacc.c */ -#line 438 "testpatterny.y" +#line 439 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>vsize %f\n", (yyvsp[(2) - (2)].dval)); @@ -2044,7 +2045,7 @@ yyreduce: case 58: /* Line 1792 of yacc.c */ -#line 445 "testpatterny.y" +#line 446 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>blackline %d\n", (yyvsp[(2) - (2)].ival)); @@ -2054,7 +2055,7 @@ yyreduce: case 59: /* Line 1792 of yacc.c */ -#line 453 "testpatterny.y" +#line 454 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>noscale %d\n", (yyvsp[(2) - (2)].ival)); @@ -2064,7 +2065,7 @@ yyreduce: case 60: /* Line 1792 of yacc.c */ -#line 461 "testpatterny.y" +#line 462 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>color_block1 %f %f %f (%d)\n", (yyvsp[(1) - (3)].dval), (yyvsp[(2) - (3)].dval), (yyvsp[(3) - (3)].dval), @@ -2081,7 +2082,7 @@ yyreduce: case 66: /* Line 1792 of yacc.c */ -#line 485 "testpatterny.y" +#line 486 "testpatterny.y" { int channel = find_color((yyvsp[(1) - (4)].sval)); if (getenv("STP_TESTPATTERN_DEBUG")) @@ -2097,7 +2098,7 @@ yyreduce: case 67: /* Line 1792 of yacc.c */ -#line 499 "testpatterny.y" +#line 500 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>color_block2b %d %f %f %f\n", (yyvsp[(2) - (5)].ival), (yyvsp[(3) - (5)].dval), (yyvsp[(4) - (5)].dval), (yyvsp[(5) - (5)].dval)); @@ -2112,7 +2113,7 @@ yyreduce: case 76: /* Line 1792 of yacc.c */ -#line 524 "testpatterny.y" +#line 525 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>patvars %f %f %f %f %f\n", (yyvsp[(1) - (5)].dval), (yyvsp[(2) - (5)].dval), (yyvsp[(3) - (5)].dval), (yyvsp[(4) - (5)].dval), (yyvsp[(5) - (5)].dval)); @@ -2129,7 +2130,7 @@ yyreduce: case 78: /* Line 1792 of yacc.c */ -#line 542 "testpatterny.y" +#line 543 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>xpattern\n"); @@ -2146,7 +2147,7 @@ yyreduce: case 79: /* Line 1792 of yacc.c */ -#line 557 "testpatterny.y" +#line 558 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>grid %d\n", (yyvsp[(2) - (2)].ival)); @@ -2159,7 +2160,7 @@ yyreduce: case 80: /* Line 1792 of yacc.c */ -#line 568 "testpatterny.y" +#line 569 "testpatterny.y" { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>image %d %d\n", (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].ival)); @@ -2178,7 +2179,7 @@ yyreduce: case 81: /* Line 1792 of yacc.c */ -#line 585 "testpatterny.y" +#line 586 "testpatterny.y" { fprintf(stderr,"%s",(yyvsp[(1) - (1)].sval)); free((yyvsp[(1) - (1)].sval)); @@ -2187,7 +2188,7 @@ yyreduce: case 85: /* Line 1792 of yacc.c */ -#line 598 "testpatterny.y" +#line 599 "testpatterny.y" { close_output(); if (global_output) @@ -2199,7 +2200,7 @@ yyreduce: case 86: /* Line 1792 of yacc.c */ -#line 608 "testpatterny.y" +#line 609 "testpatterny.y" { global_output = (yyvsp[(2) - (2)].sval); } @@ -2207,43 +2208,43 @@ yyreduce: case 89: /* Line 1792 of yacc.c */ -#line 617 "testpatterny.y" +#line 618 "testpatterny.y" { start_job = 1; } break; case 90: /* Line 1792 of yacc.c */ -#line 621 "testpatterny.y" +#line 622 "testpatterny.y" { end_job = 1; } break; case 114: /* Line 1792 of yacc.c */ -#line 631 "testpatterny.y" +#line 632 "testpatterny.y" { global_did_something = 1; } break; case 119: /* Line 1792 of yacc.c */ -#line 638 "testpatterny.y" +#line 639 "testpatterny.y" { global_did_something = 1; } break; case 122: /* Line 1792 of yacc.c */ -#line 645 "testpatterny.y" +#line 646 "testpatterny.y" { global_did_something = 1; } break; case 128: /* Line 1792 of yacc.c */ -#line 655 "testpatterny.y" +#line 656 "testpatterny.y" { return 0; } break; case 129: /* Line 1792 of yacc.c */ -#line 659 "testpatterny.y" +#line 660 "testpatterny.y" { current_testpattern = get_next_testpattern(); } @@ -2251,7 +2252,7 @@ yyreduce: /* Line 1792 of yacc.c */ -#line 2255 "testpatterny.c" +#line 2256 "testpatterny.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2483,5 +2484,5 @@ yyreturn: /* Line 2055 of yacc.c */ -#line 665 "testpatterny.y" +#line 666 "testpatterny.y" diff --git a/src/testpattern/testpatterny.y b/src/testpattern/testpatterny.y index 4f921e6..3b89160 100644 --- a/src/testpattern/testpatterny.y +++ b/src/testpattern/testpatterny.y @@ -26,6 +26,7 @@ #endif #include <string.h> +#include <strings.h> #include <stdio.h> #include <stdlib.h> #include "testpattern.h" @@ -295,7 +296,7 @@ printer: PRINTER tSTRING { if (getenv("STP_TESTPATTERN_DEBUG")) fprintf(stderr, ">>>printer %s\n", $2); - global_printer = strdup($2); + global_printer = stp_strdup($2); free($2); } ; diff --git a/src/testpattern/uncompress-checksums.in b/src/testpattern/uncompress-checksums.in new file mode 100644 index 0000000..e97fe25 --- /dev/null +++ b/src/testpattern/uncompress-checksums.in @@ -0,0 +1,47 @@ +#!@PERL@ +## Copyright (C) 2016 Robert Krawitz +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +use strict; + +my (%checksums); + +while (<>) { + chomp; + my ($sum, @keys) = split; + my (@pchunks) = (); + foreach my $k (@keys) { + $k =~ s/=/________/g; + $k =~ s/!/_______/g; + $k =~ s/"/______/g; + $k =~ s/,/_____/g; + $k =~ s/'/____/g; + $k =~ s/%/___/g; + $k =~ s/>/__/g; + my (@chunks) = split(/_/, $k, -1); + foreach my $i (0..$#chunks) { + if ($chunks[$i] eq '') { + $chunks[$i] = $pchunks[$i]; + } elsif ($chunks[$i] =~ /^([0-9]+)\+(.*)/) { + $chunks[$i] = substr($pchunks[$i], 0, $1) . $2; + } + } + my ($answer) = join('_', @chunks); + $answer =~ s/(^[^:]*)_:(.*)/$2_$1/; + print "$sum *$answer.prn\n"; + @pchunks = @chunks; + } +} |