| 1 | /* |
| 2 | * |
| 3 | * Print plug-in EPSON ESC/P2 driver for the GIMP. |
| 4 | * |
| 5 | * Copyright 1999-2000 Robert Krawitz ([email protected]) |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the Free |
| 9 | * Software Foundation; either version 2 of the License, or (at your option) |
| 10 | * any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 | * for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | * |
| 20 | * Test for the soft weave algorithm. This program calculates the weave |
| 21 | * parameters for each input line and verifies that a number of conditions |
| 22 | * are met. Currently, the conditions checked are: |
| 23 | * |
| 24 | * 1) Pass # is >= 0 |
| 25 | * 2) The nozzle is within the physical bounds of the printer |
| 26 | * 3) The computed starting row of the pass is not greater than the row |
| 27 | * index itself. |
| 28 | * 4) The computed end of the pass is not less than the row index itself. |
| 29 | * 5) If this row is the last row of a pass, that the last pass completed |
| 30 | * was one less than the current pass that we're just completing. |
| 31 | * 6) For a given pass, the computed starting row of the pass is the same |
| 32 | * for all rows comprising the pass. |
| 33 | * 7) For a given pass, the computed last row of the pass is the same |
| 34 | * for all rows comprising the pass. |
| 35 | * 8) The input row is the same as the row computed by the algorithm. |
| 36 | * 9) If there are phantom rows within the pass (unused jets before the |
| 37 | * first jet that is actually printing anything), then the number of |
| 38 | * phantom rows is not less than zero nor greater than or equal to the |
| 39 | * number of physical jets in the printer. |
| 40 | * 10) The physical starting row of the pass (disregarding any phantom |
| 41 | * rows) is at least zero. |
| 42 | * 11) If there are phantom rows, the number of phantom rows is less than |
| 43 | * the current nozzle number. |
| 44 | * 12) If we are using multiple subpasses for each row, that each row within |
| 45 | * this pass is part of the same logical subpass. Thus, if the pass in |
| 46 | * question is the first subpass for a given row, that it is the first |
| 47 | * subpass for ALL rows comprising the pass. This doesn't matter if we're |
| 48 | * simply overlaying data; it's important if we have to shift the print head |
| 49 | * slightly between each pass to accomplish high-resolution printing. |
| 50 | * 13) We are not overprinting a specified (row, subpass) pair. |
| 51 | * |
| 52 | * In addition to these per-row checks, we calculate the following global |
| 53 | * correctness checks: |
| 54 | * |
| 55 | * 1) No pass starts (logically) at a later row than an earlier pass. |
| 56 | */ |
| 57 | |
| 58 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`! |
| 59 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 60 | #endif |
| 61 | #include <stdlib.h> |
| 62 | #include <stdio.h> |
| 63 | #include <unistd.h> |
| 64 | #include <string.h> |
| 65 | #include <limits.h> |
| 66 | |
| 67 | #define DEBUG_SIGNALcxx . . $ `test/escp2-weavetest.c:67:9`! |
| 68 | #define MINcxx . . $ `test/escp2-weavetest.c:68:9`!(x, y) ((x) <= (y) ? (x) : (y)) |
| 69 | #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/ |
| 70 | #include <gutenprint-internal.h>cxx . . $ `<file>/src/main/gutenprint-internal.h`/ |
| 71 | |
| 72 | const char headercxx . . $ header.[] = "Legend:\n" |
| 73 | "A Negative pass number.\n" |
| 74 | "B Jet number out of range.\n" |
| 75 | "C Starting row of this pass after the current row.\n" |
| 76 | "D Ending row of this pass before the current row.\n" |
| 77 | "E Current row is the ending row of the pass, and the pass number is not\n" |
| 78 | " one greater than the previous completed pass.\n" |
| 79 | "F The current pass's starting row is not consistent with the previously\n" |
| 80 | " observed starting row of this pass.\n" |
| 81 | "G The current pass's ending row is not consistent with the previously\n" |
| 82 | " observed ending row of this pass.\n" |
| 83 | "H The current row does not match the computed current row based on jet and\n" |
| 84 | " start of pass.\n" |
| 85 | "I The number of missing start rows is less than zero or greater than or\n" |
| 86 | " equal to the actual number of jets.\n" |
| 87 | "J The first printed row of this pass is less than zero.\n" |
| 88 | "K The number of missing start rows of this pass is greater than the\n" |
| 89 | " jet used to print the current row.\n" |
| 90 | "L The subpass printed by the current pass is not consistent with an earlier\n" |
| 91 | " record of the subpass printed by this pass.\n" |
| 92 | "M The same physical row is being printed more than once.\n" |
| 93 | "N Two different active passes are in the same slot.\n" |
| 94 | "O Number of missing start rows is incorrect.\n" |
| 95 | "P Physical row number out of bounds.\n" |
| 96 | "Q Pass starts earlier than a prior pass.\n" |
| 97 | "R Pass is never flushed.\n" |
| 98 | "S Pass is flushed but not created.\n"; |
| 99 | |
| 100 | int *passes_flushedcxx . . $ passes_flushed.; |
| 101 | |
| 102 | static void |
| 103 | print_headercxx . . $ print_header(49f6e7a06ebc5aa8).(void) |
| 104 | { |
| 105 | printfcxx . . $ printf(581fddd72a8db8fc).("%s", headercxx . . $ header.); |
| 106 | } |
| 107 | |
| 108 | static void |
| 109 | flush_passcxx . . $ flush_pass(9e1f5dddaee1574e).(stp_vars_tcxx . . $ stp_vars_t# *v, int passno, int vertical_subpass) |
| 110 | { |
| 111 | (void)v; |
| 112 | (void)vertical_subpass; |
| 113 | passes_flushedcxx . . $ passes_flushed.[passno] = 1; |
| 114 | } |
| 115 | |
| 116 | static void |
| 117 | writefunccxx . . $ writefunc(8e4e5e8cac233c6a).(void *file, const char *buf, size_t bytes) |
| 118 | { |
| 119 | FILEcxx . . $ FILE# *prn = (FILEcxx . . $ FILE# *)file; |
| 120 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(buf, 1, bytes, prn); |
| 121 | } |
| 122 | |
| 123 | static int |
| 124 | run_one_weavetestcxx . . $ run_one_weavetest(6c603a2d304f3eec).(int physjets, int physsep, int hpasses, int vpasses, |
| 125 | int subpasses, int nrows, int first_line, int phys_lines, |
| 126 | int color_jet_arrangement, int strategy, int quiet) |
| 127 | { |
| 128 | int i; |
| 129 | int j; |
| 130 | stp_weave_tcxx . . $ stp_weave_t# w; |
| 131 | stp_vars_tcxx . . $ stp_vars_t# *v; |
| 132 | int errors[26]; |
| 133 | char errcodes[26]; |
| 134 | int total_errors = 0; |
| 135 | int lastpass = -1; |
| 136 | int newestpass = -1; |
| 137 | int *passstarts; |
| 138 | int *logpassstarts; |
| 139 | int *passends; |
| 140 | int *passcounts; |
| 141 | signed char *physpassstuff; |
| 142 | signed char *rowdetail; |
| 143 | int *current_slot; |
| 144 | int vmod; |
| 145 | int head_offset[8]; |
| 146 | int last_good_pass; |
| 147 | |
| 148 | v = stp_vars_createcxx . . $ stp_vars_create(ca9164ca858eeb6f).(); |
| 149 | stp_set_outfunccxx . . $ stp_set_outfunc(d4e9cdcd927ed799).(v, writefunccxx . . $ writefunc(8e4e5e8cac233c6a).); |
| 150 | stp_set_errfunccxx . . $ stp_set_errfunc(d4e9cdcd927ed799).(v, writefunccxx . . $ writefunc(8e4e5e8cac233c6a).); |
| 151 | stp_set_outdatacxx . . $ stp_set_outdata(da98ca80e19bc349).(v, stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 152 | stp_set_errdatacxx . . $ stp_set_errdata(da98ca80e19bc349).(v, stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 153 | |
| 154 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(errors, 0, sizeof(int) * 26); |
| 155 | #if 0 |
| 156 | if (physjets < hpasses * vpasses * subpasses) |
| 157 | { |
| 158 | return 0; |
| 159 | } |
| 160 | #endif |
| 161 | |
| 162 | for(i=0; i<8; i++) |
| 163 | head_offset[i] = 0; |
| 164 | |
| 165 | switch (color_jet_arrangement) |
| 166 | { |
| 167 | case 1: /* C80-type */ |
| 168 | head_offset[0] = (physjets+1)*physsep; |
| 169 | head_offset[1] = (physjets+1)*physsep; |
| 170 | head_offset[2] = 2*(physjets+1)*physsep; |
| 171 | phys_lines += 2*(physjets+1)*physsep; |
| 172 | break; |
| 173 | case 2: /* Offset by 1 (f360) */ |
| 174 | if (physsep % 2 == 0) |
| 175 | { |
| 176 | head_offset[1] = physsep / 2; |
| 177 | head_offset[2] = physsep / 2; |
| 178 | phys_lines += physsep / 2; |
| 179 | } |
| 180 | break; |
| 181 | case 3: /* Offset by 1 or 2 (cx3650-type) */ |
| 182 | if (physsep % 3 == 0) |
| 183 | { |
| 184 | head_offset[1] = physsep * 2 / 3; |
| 185 | head_offset[2] = physsep / 3; |
| 186 | phys_lines += physsep * 2 / 3; |
| 187 | } |
| 188 | break; |
| 189 | default: /* Normal */ |
| 190 | break; |
| 191 | } |
| 192 | |
| 193 | |
| 194 | stp_initialize_weavecxx . . $ stp_initialize_weave(21970b5590b16727).(v, physjets, physsep, hpasses, vpasses, subpasses, |
| 195 | 7, 1, 128, nrows, first_line, |
| 196 | phys_lines, head_offset, strategy, flush_passcxx . . $ flush_pass(9e1f5dddaee1574e)., |
| 197 | stp_fill_tiffcxx . . $ stp_fill_tiff(7a0514de46275760)., stp_pack_tiffcxx . . $ stp_pack_tiff(89b35e14f2325ba5)., |
| 198 | stp_compute_tiff_linewidthcxx . . $ stp_compute_tiff_linewidth(91704a15f9368999).); |
| 199 | |
| 200 | passstarts = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(int) * (nrows + physsep)); |
| 201 | logpassstarts = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(int) * (nrows + physsep)); |
| 202 | passends = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(int) * (nrows + physsep)); |
| 203 | passcounts = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(int) * (nrows + physsep)); |
| 204 | passes_flushedcxx . . $ passes_flushed. = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(int) * (nrows + physsep)); |
| 205 | vmod = 2 * physsep * hpasses * vpasses * subpasses; |
| 206 | if (vmod == 0) |
| 207 | vmod = 1; |
| 208 | current_slot = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(int) * vmod); |
| 209 | physpassstuff = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).((nrows + physsep)); |
| 210 | rowdetail = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).((nrows + physsep) * physjets); |
| 211 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(rowdetail, 0, (nrows + physsep) * physjets); |
| 212 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(physpassstuff, -1, (nrows + physsep)); |
| 213 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(current_slot, 0, (sizeof(int) * vmod)); |
| 214 | if (!quiet) |
| 215 | { |
| 216 | print_headercxx . . $ print_header(49f6e7a06ebc5aa8).(); |
| 217 | printfcxx . . $ printf(581fddd72a8db8fc).("%15s %5s %5s %5s %10s %10s %10s %10s\n", "", "row", "pass", |
| 218 | "jet", "missing", "logical", "physstart", "physend"); |
| 219 | } |
| 220 | for (i = 0; i < vmod; i++) |
| 221 | current_slot[i] = -1; |
| 222 | for (i = 0; i < (nrows + physsep); i++) |
| 223 | { |
| 224 | passes_flushedcxx . . $ passes_flushed.[i] = 0; |
| 225 | logpassstarts[i] = INT_MINcxx . . $ `<external>/67164224788392828/limits.h:118:9`!; |
| 226 | passstarts[i] = -1; |
| 227 | passends[i] = -1; |
| 228 | } |
| 229 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(errcodes, ' ', 26); |
| 230 | for (i = 0; i < nrows; i++) |
| 231 | { |
| 232 | for (j = 0; j < hpasses * vpasses * subpasses; j++) |
| 233 | { |
| 234 | int physrow; |
| 235 | stp_weave_parameters_by_rowcxx . . $ stp_weave_parameters_by_row(f905154d6ace42ae).(v, i+first_line, j, &w); |
| 236 | physrow = w.logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#logicalpassstart. + physsep * w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet.; |
| 237 | |
| 238 | errcodes[0] = (w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. < 0 ? (errors[0]++, 'A') : ' '); |
| 239 | errcodes[1] = (w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. < 0 || w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. > physjets - 1 ? |
| 240 | (errors[1]++, 'B') : ' '); |
| 241 | errcodes[2] = (w.physpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassstart. > w.rowcxx . . $ $anonymous_type_bcaa485bbb542c91_0#row. ? (errors[2]++, 'C') : ' '); |
| 242 | errcodes[3] = (w.physpassendcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassend. < w.rowcxx . . $ $anonymous_type_bcaa485bbb542c91_0#row. ? (errors[3]++, 'D') : ' '); |
| 243 | #if 0 |
| 244 | errcodes[4] = (w.physpassend == w.row && lastpass + 1 != w.pass ? |
| 245 | (errors[4]++, 'E') : ' '); |
| 246 | #endif |
| 247 | errcodes[5] = (w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. >= 0 && w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. < nrows && |
| 248 | passstarts[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] != -1 && |
| 249 | passstarts[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] != w.physpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassstart. ? |
| 250 | (errors[5]++, 'F') : ' '); |
| 251 | errcodes[6] = (w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. >= 0 && w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. < nrows && |
| 252 | passends[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] != -1 && |
| 253 | passends[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] != w.physpassendcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassend. ? |
| 254 | (errors[6]++, 'G') : ' '); |
| 255 | errcodes[7] = (w.rowcxx . . $ $anonymous_type_bcaa485bbb542c91_0#row. != physrow ? (errors[7]++, 'H') : ' '); |
| 256 | errcodes[8] = (w.missingstartrowscxx . . $ $anonymous_type_bcaa485bbb542c91_0#missingstartrows. < 0 || |
| 257 | w.missingstartrowscxx . . $ $anonymous_type_bcaa485bbb542c91_0#missingstartrows. > physjets - 1 ? |
| 258 | (errors[8]++, 'I') : ' '); |
| 259 | errcodes[9] = (w.physpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassstart. < 0 ? (errors[9]++, 'J') : ' '); |
| 260 | errcodes[10] = (w.missingstartrowscxx . . $ $anonymous_type_bcaa485bbb542c91_0#missingstartrows. > w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. ? |
| 261 | (errors[10]++, 'K') : ' '); |
| 262 | errcodes[11] = (w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. >= 0 && w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. < nrows && |
| 263 | physpassstuff[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] >= 0 && |
| 264 | physpassstuff[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] != j ? |
| 265 | (errors[11]++, 'L') : ' '); |
| 266 | errcodes[12] = (w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. >= 0 && w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. < nrows && w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. >= 0 && |
| 267 | w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. < physjets && |
| 268 | rowdetail[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. * physjets + w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet.] == 1 ? |
| 269 | (errors[12]++, 'M') : ' '); |
| 270 | errcodes[13] = (current_slot[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. % vmod] != -1 && |
| 271 | current_slot[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. % vmod] != w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. ? |
| 272 | (errors[13]++, 'N') : ' '); |
| 273 | errcodes[14] = (w.physpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassstart. == w.rowcxx . . $ $anonymous_type_bcaa485bbb542c91_0#row. && |
| 274 | w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. != w.missingstartrowscxx . . $ $anonymous_type_bcaa485bbb542c91_0#missingstartrows. ? |
| 275 | (errors[14]++, 'O') : ' '); |
| 276 | errcodes[15] = ((w.logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#logicalpassstart. < 0) || |
| 277 | (w.logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#logicalpassstart. + physsep * (physjets - 1) >= |
| 278 | phys_lines) ? |
| 279 | (errors[15]++, 'P') : ' '); |
| 280 | errcodes[16] = '\0'; |
| 281 | |
| 282 | if (!quiet) |
| 283 | { |
| 284 | printfcxx . . $ printf(581fddd72a8db8fc).("%15s%5d %5d %5d %10d %10d %10d %10d\n", |
| 285 | errcodes, w.rowcxx . . $ $anonymous_type_bcaa485bbb542c91_0#row., w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass., w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet., w.missingstartrowscxx . . $ $anonymous_type_bcaa485bbb542c91_0#missingstartrows., |
| 286 | w.logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#logicalpassstart., w.physpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassstart., w.physpassendcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassend.); |
| 287 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 288 | } |
| 289 | if (w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. >= 0 && w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. < (nrows + physsep)) |
| 290 | { |
| 291 | if (w.physpassendcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassend. == w.rowcxx . . $ $anonymous_type_bcaa485bbb542c91_0#row.) |
| 292 | { |
| 293 | lastpass = w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.; |
| 294 | passends[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] = -2; |
| 295 | current_slot[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. % vmod] = -1; |
| 296 | } |
| 297 | else |
| 298 | { |
| 299 | passends[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] = w.physpassendcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassend.; |
| 300 | current_slot[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. % vmod] = w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.; |
| 301 | } |
| 302 | passstarts[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] = w.physpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#physpassstart.; |
| 303 | logpassstarts[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] = w.logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_0#logicalpassstart.; |
| 304 | if (w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. >= 0 && w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet. < physjets) |
| 305 | rowdetail[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. * physjets + w.jetcxx . . $ $anonymous_type_bcaa485bbb542c91_0#jet.] = 1; |
| 306 | if (physpassstuff[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] == -1) |
| 307 | physpassstuff[w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.] = j; |
| 308 | if (w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass. > newestpass) |
| 309 | newestpass = w.passcxx . . $ $anonymous_type_bcaa485bbb542c91_0#pass.; |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | if (!quiet) |
| 314 | printfcxx . . $ printf(581fddd72a8db8fc).("Unterminated passes:\n"); |
| 315 | for (i = 0; i <= newestpass; i++) |
| 316 | if (passends[i] >= -1 && passends[i] < nrows && logpassstarts[i] != INT_MINcxx . . $ `<external>/67164224788392828/limits.h:118:9`!) |
| 317 | { |
| 318 | if (!quiet) |
| 319 | printfcxx . . $ printf(581fddd72a8db8fc).("%d %d\n", i, passends[i]); |
| 320 | errors[16]++; |
| 321 | } |
| 322 | if (!quiet) |
| 323 | { |
| 324 | printfcxx . . $ printf(581fddd72a8db8fc).("Last terminated pass: %d\n", lastpass); |
| 325 | printfcxx . . $ printf(581fddd72a8db8fc).("Pass starts:\n"); |
| 326 | } |
| 327 | last_good_pass = 0; |
| 328 | errcodes[3] = '\0'; |
| 329 | for (i = 0; i <= newestpass; i++) |
| 330 | { |
| 331 | if (logpassstarts[i] != INT_MINcxx . . $ `<external>/67164224788392828/limits.h:118:9`!) |
| 332 | { |
| 333 | if (i > 0) |
| 334 | errcodes[0] = logpassstarts[i] < logpassstarts[last_good_pass] ? |
| 335 | (errors[17]++, 'Q') : ' '; |
| 336 | errcodes[1] = passes_flushedcxx . . $ passes_flushed.[i] ? (errors[18]++, 'R') : ' '; |
| 337 | errcodes[2] = ' '; |
| 338 | if (!quiet) |
| 339 | printfcxx . . $ printf(581fddd72a8db8fc).("%s %d %d\n", errcodes, i, logpassstarts[i]); |
| 340 | last_good_pass = i; |
| 341 | } |
| 342 | else if (!quiet) |
| 343 | { |
| 344 | errcodes[0] = ' '; |
| 345 | errcodes[1] = ' '; |
| 346 | errcodes[2] = '*'; |
| 347 | printfcxx . . $ printf(581fddd72a8db8fc).("%s %d\n", errcodes, i); |
| 348 | } |
| 349 | } |
| 350 | for (i = 0; i < 26; i++) |
| 351 | total_errors += errors[i]; |
| 352 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(rowdetail); |
| 353 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(physpassstuff); |
| 354 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(current_slot); |
| 355 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(passcounts); |
| 356 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(passends); |
| 357 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(logpassstarts); |
| 358 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(passstarts); |
| 359 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(passes_flushedcxx . . $ passes_flushed.); |
| 360 | if (!quiet || (quiet == 1 && total_errors > 0)) |
| 361 | printfcxx . . $ printf(581fddd72a8db8fc).("%d total error%s\n", total_errors, total_errors == 1 ? "" : "s"); |
| 362 | stp_vars_destroycxx . . $ stp_vars_destroy(1a97b8462f9f913c).(v); |
| 363 | return total_errors; |
| 364 | } |
| 365 | |
| 366 | static int |
| 367 | run_weavetest_from_stdincxx . . $ run_weavetest_from_stdin(b126dc7c1de90089).(void) |
| 368 | { |
| 369 | int nrows; |
| 370 | int physjets; |
| 371 | int physsep; |
| 372 | int hpasses, vpasses, subpasses; |
| 373 | int first_line, phys_lines; |
| 374 | int color_jet_arrangement; |
| 375 | int strategy; |
| 376 | int previous_strategy = -1; |
| 377 | int previous_jets = -1; |
| 378 | int previous_separation = -1; |
| 379 | int total_cases = 0; |
| 380 | int failures = 0; |
| 381 | char linebuf[4096]; |
| 382 | const char *spinner = "/-\\|"; |
| 383 | int rotor = 0; |
| 384 | int do_spinner = isattycxx . . $ isatty(7864480464b09eea).(filenocxx . . $ fileno(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!)); |
| 385 | while (fgetscxx . . $ fgets(efb0aaba7ac866ae).(linebuf, 4096, stdincxx . . $ `<external>/232824719582829767/stdio.h:153:9`!)) |
| 386 | { |
| 387 | int retval; |
| 388 | (void) sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(linebuf, "%d%d%d%d%d%d%d%d%d%d", &physjets, &physsep, |
| 389 | &hpasses, &vpasses, &subpasses, &nrows, &first_line, |
| 390 | &phys_lines, &color_jet_arrangement, &strategy); |
| 391 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 392 | if (vpasses * subpasses > physjets) |
| 393 | continue; |
| 394 | retval = run_one_weavetestcxx . . $ run_one_weavetest(6c603a2d304f3eec).(physjets, physsep, hpasses, vpasses, |
| 395 | subpasses, nrows, first_line, phys_lines, |
| 396 | color_jet_arrangement, strategy, 2); |
| 397 | if (getenvcxx . . $ getenv(a8b8e32347182212).("QUIET")) |
| 398 | { |
| 399 | /* Assume that we're running within run-weavetest, and */ |
| 400 | /* print out the heartbeat */ |
| 401 | |
| 402 | if (previous_strategy != strategy) |
| 403 | { |
| 404 | printfcxx . . $ printf(581fddd72a8db8fc).("%s%d:", previous_strategy == -1 ? "" : "\n", strategy); |
| 405 | previous_jets = -1; |
| 406 | previous_separation = -1; |
| 407 | } |
| 408 | if (previous_jets != physjets) |
| 409 | { |
| 410 | printfcxx . . $ printf(581fddd72a8db8fc).("%d", physjets); |
| 411 | previous_separation = -1; |
| 412 | } |
| 413 | if (previous_separation != physsep) |
| 414 | printfcxx . . $ printf(581fddd72a8db8fc).("."); |
| 415 | if (do_spinner) |
| 416 | { |
| 417 | putcharcxx . . $ putchar(7864480464b09eea).((int) (spinner[rotor++])); |
| 418 | putcharcxx . . $ putchar(7864480464b09eea).((int) '\b'); |
| 419 | rotor &= 3; |
| 420 | } |
| 421 | previous_strategy = strategy; |
| 422 | previous_jets = physjets; |
| 423 | previous_separation = physsep; |
| 424 | } |
| 425 | if (!getenvcxx . . $ getenv(a8b8e32347182212).("QUIET") || retval) |
| 426 | { |
| 427 | printfcxx . . $ printf(581fddd72a8db8fc).("%d %d %d %d %d %d %d %d %d %d ", physjets, physsep, |
| 428 | hpasses, vpasses, subpasses, nrows, first_line, |
| 429 | phys_lines, color_jet_arrangement, strategy); |
| 430 | if (retval) |
| 431 | printfcxx . . $ printf(581fddd72a8db8fc).("%d total error%s", retval, retval == 1 ? "" : "s"); |
| 432 | putccxx . . $ putc(b1cd03d6c470d1bd).('\n', stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 433 | } |
| 434 | |
| 435 | total_cases++; |
| 436 | if (retval) |
| 437 | failures++; |
| 438 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 439 | } |
| 440 | printfcxx . . $ printf(581fddd72a8db8fc).("%sTotal cases: %d, failures: %d\n", |
| 441 | (getenvcxx . . $ getenv(a8b8e32347182212).("QUIET") ? "\n" : ""), total_cases, failures); |
| 442 | return (failures ? 1 : 0); |
| 443 | } |
| 444 | |
| 445 | static int |
| 446 | run_weavetest_from_cmdlinecxx . . $ run_weavetest_from_cmdline(afcd3168fc1188a4).(int argc, char **argv) |
| 447 | { |
| 448 | if (argc != 11) |
| 449 | { |
| 450 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Usage: %s jets separation hpasses vpasses subpasses rows start end arrangement strategy\n", |
| 451 | argv[0]); |
| 452 | return 2; |
| 453 | } |
| 454 | else |
| 455 | { |
| 456 | int quiet = 0; |
| 457 | int physjets = atoicxx . . $ atoi(5c4306d8553b3696).(argv[1]); |
| 458 | int physsep = atoicxx . . $ atoi(5c4306d8553b3696).(argv[2]); |
| 459 | int hpasses = atoicxx . . $ atoi(5c4306d8553b3696).(argv[3]); |
| 460 | int vpasses = atoicxx . . $ atoi(5c4306d8553b3696).(argv[4]); |
| 461 | int subpasses = atoicxx . . $ atoi(5c4306d8553b3696).(argv[5]); |
| 462 | int nrows = atoicxx . . $ atoi(5c4306d8553b3696).(argv[6]); |
| 463 | int first_line = atoicxx . . $ atoi(5c4306d8553b3696).(argv[7]); |
| 464 | int phys_lines = atoicxx . . $ atoi(5c4306d8553b3696).(argv[8]); |
| 465 | int color_jet_arrangement = atoicxx . . $ atoi(5c4306d8553b3696).(argv[9]); |
| 466 | int strategy = atoicxx . . $ atoi(5c4306d8553b3696).(argv[10]); |
| 467 | int status; |
| 468 | if (getenvcxx . . $ getenv(a8b8e32347182212).("QUIET")) |
| 469 | quiet = 2; |
| 470 | status = run_one_weavetestcxx . . $ run_one_weavetest(6c603a2d304f3eec).(physjets, physsep, hpasses, vpasses, |
| 471 | subpasses, nrows, first_line, phys_lines, |
| 472 | color_jet_arrangement, strategy, quiet); |
| 473 | if (status) |
| 474 | return 1; |
| 475 | else |
| 476 | return 0; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | int |
| 481 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) |
| 482 | { |
| 483 | stp_initcxx . . $ stp_init(b126dc7c1de90089).(); |
| 484 | |
| 485 | if (argc == 1) |
| 486 | return run_weavetest_from_stdincxx . . $ run_weavetest_from_stdin(b126dc7c1de90089).(); |
| 487 | else |
| 488 | return run_weavetest_from_cmdlinecxx . . $ run_weavetest_from_cmdline(afcd3168fc1188a4).(argc, argv); |
| 489 | } |