| 1 | /* |
| 2 | * |
| 3 | * Test pattern generator for Gutenprint |
| 4 | * |
| 5 | * Copyright 2001 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 | |
| 21 | /* |
| 22 | * This sample program may be used to generate test patterns. It also |
| 23 | * serves as an example of how to use the Gutenprint API. |
| 24 | * |
| 25 | * As the purpose of this program is to allow fine grained control over |
| 26 | * the output, it uses the raw CMYK output type. This feeds 16 bits each |
| 27 | * of CMYK to the driver. This mode performs no correction on the data; |
| 28 | * it passes it directly to the dither engine, performing no color, |
| 29 | * density, gamma, etc. correction. Most programs will use one of the |
| 30 | * other modes (RGB, density and gamma corrected 8-bit CMYK, grayscale, or |
| 31 | * black and white). |
| 32 | */ |
| 33 | |
| 34 | #include <stdlib.h> |
| 35 | #include <unistd.h> |
| 36 | #include <stdio.h> |
| 37 | #include <math.h> |
| 38 | #include <string.h> |
| 39 | #include "testpattern.h"cxx . . $ `<file>/src/testpattern/testpattern.h`/ |
| 40 | #include <gutenprint/gutenprint-intl.h>cxx . . $ `<file>/include/gutenprint/gutenprint-intl.h`/ |
| 41 | #include <errno.h> |
| 42 | |
| 43 | #pragma GCC diagnostic ignored "-Wredundant-decls" |
| 44 | |
| 45 | extern int yyparsecxx . . $ yyparse(b126dc7c1de90089).(void); |
| 46 | |
| 47 | static const char *Image_get_appnamecxx . . $ Image_get_appname(97b8a1c82bcbc822).(stp_image_tcxx . . $ stp_image_t# *image); |
| 48 | static void Image_concludecxx . . $ Image_conclude(7010b42a94b47a79).(stp_image_tcxx . . $ stp_image_t# *image); |
| 49 | static void Image_initcxx . . $ Image_init(7010b42a94b47a79).(stp_image_tcxx . . $ stp_image_t# *image); |
| 50 | static stp_image_status_tcxx . . $ stp_image_status_t# Image_get_rowcxx . . $ Image_get_row(c6bbe34ec0bddcf0).(stp_image_tcxx . . $ stp_image_t# *image, |
| 51 | unsigned char *data, |
| 52 | size_t byte_limit, int row); |
| 53 | static int Image_heightcxx . . $ Image_height(ba31fd85910919f2).(stp_image_tcxx . . $ stp_image_t# *image); |
| 54 | static void Image_resetcxx . . $ Image_reset(7010b42a94b47a79).(stp_image_tcxx . . $ stp_image_t# *image); |
| 55 | static int Image_widthcxx . . $ Image_width(ba31fd85910919f2).(stp_image_tcxx . . $ stp_image_t# *image); |
| 56 | static int Image_is_validcxx . . $ Image_is_valid. = 0; |
| 57 | static stp_image_tcxx . . $ stp_image_t# theImagecxx . . $ theImage. = |
| 58 | { |
| 59 | Image_initcxx . . $ Image_init(7010b42a94b47a79)., |
| 60 | Image_resetcxx . . $ Image_reset(7010b42a94b47a79)., |
| 61 | Image_widthcxx . . $ Image_width(ba31fd85910919f2)., |
| 62 | Image_heightcxx . . $ Image_height(ba31fd85910919f2)., |
| 63 | Image_get_rowcxx . . $ Image_get_row(c6bbe34ec0bddcf0)., |
| 64 | Image_get_appnamecxx . . $ Image_get_appname(97b8a1c82bcbc822)., |
| 65 | Image_concludecxx . . $ Image_conclude(7010b42a94b47a79)., |
| 66 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! |
| 67 | }; |
| 68 | stp_vars_tcxx . . $ stp_vars_t# *global_varscxx . . $ global_vars. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 69 | |
| 70 | double global_levelscxx . . $ global_levels.[STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!]; |
| 71 | double global_gammascxx . . $ global_gammas.[STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!]; |
| 72 | double global_gammacxx . . $ global_gamma.; |
| 73 | int global_stepscxx . . $ global_steps.; |
| 74 | int global_halt_on_errorcxx . . $ global_halt_on_error. = 0; |
| 75 | double global_ink_limitcxx . . $ global_ink_limit.; |
| 76 | int global_noblacklinecxx . . $ global_noblackline.; |
| 77 | int global_colorlinecxx . . $ global_colorline.; |
| 78 | int global_printer_widthcxx . . $ global_printer_width.; |
| 79 | int global_printer_heightcxx . . $ global_printer_height.; |
| 80 | int global_band_heightcxx . . $ global_band_height.; |
| 81 | int global_n_testpatternscxx . . $ global_n_testpatterns.; |
| 82 | char *global_printercxx . . $ global_printer. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 83 | double global_densitycxx . . $ global_density.; |
| 84 | double global_xtopcxx . . $ global_xtop.; |
| 85 | double global_xleftcxx . . $ global_xleft.; |
| 86 | size_mode_tcxx . . $ size_mode_t# global_size_modecxx . . $ global_size_mode.; |
| 87 | double global_hsizecxx . . $ global_hsize.; |
| 88 | double global_vsizecxx . . $ global_vsize.; |
| 89 | const char *global_image_typecxx . . $ global_image_type.; |
| 90 | int global_bit_depthcxx . . $ global_bit_depth.; |
| 91 | int global_channel_depthcxx . . $ global_channel_depth.; |
| 92 | int global_invert_datacxx . . $ global_invert_data. = 0; |
| 93 | int global_use_raw_cmykcxx . . $ global_use_raw_cmyk.; |
| 94 | int global_did_somethingcxx . . $ global_did_something.; |
| 95 | int global_noscalecxx . . $ global_noscale. = 0; |
| 96 | int global_suppress_outputcxx . . $ global_suppress_output. = 0; |
| 97 | int global_quietcxx . . $ global_quiet. = 0; |
| 98 | int global_fail_verify_okcxx . . $ global_fail_verify_ok. = 0; |
| 99 | int global_round_sizecxx . . $ global_round_size. = 0; |
| 100 | char *global_outputcxx . . $ global_output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 101 | FILEcxx . . $ FILE# *outputcxx . . $ output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 102 | int write_to_processcxx . . $ write_to_process. = 0; |
| 103 | int start_jobcxx . . $ start_job. = 0; |
| 104 | int end_jobcxx . . $ end_job. = 0; |
| 105 | int passescxx . . $ passes. = 0; |
| 106 | int failurescxx . . $ failures. = 0; |
| 107 | int skippedcxx . . $ skipped. = 0; |
| 108 | size_t bytes_writtencxx . . $ bytes_written. = 0; |
| 109 | |
| 110 | static testpattern_tcxx . . $ testpattern_t# *static_testpatternscxx . . $ static_testpatterns.; |
| 111 | |
| 112 | static size_t |
| 113 | c_strlencxx . . $ c_strlen(751346f8406fd082).(const char *s) |
| 114 | { |
| 115 | return strlencxx . . $ strlen(751346f8406fd082).(s); |
| 116 | } |
| 117 | |
| 118 | static double |
| 119 | roundtocxx . . $ roundto(447c67c6676f75c3).(double n) |
| 120 | { |
| 121 | if (global_round_sizecxx . . $ global_round_size.) |
| 122 | return (double) ((int) n); |
| 123 | else |
| 124 | return n; |
| 125 | } |
| 126 | |
| 127 | static char * |
| 128 | c_strndupcxx . . $ c_strndup(2050848944e00d54).(const char *s, int n) |
| 129 | { |
| 130 | char *ret; |
| 131 | if (!s || n < 0) |
| 132 | { |
| 133 | ret = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(1); |
| 134 | ret[0] = 0; |
| 135 | return ret; |
| 136 | } |
| 137 | else |
| 138 | { |
| 139 | ret = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(n + 1); |
| 140 | memcpycxx . . $ memcpy(cc817cb175f282d).(ret, s, n); |
| 141 | ret[n] = 0; |
| 142 | return ret; |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | char * |
| 147 | c_strdupcxx . . $ c_strdup(a8b8e32347182212).(const char *s) |
| 148 | { |
| 149 | char *ret; |
| 150 | if (!s) |
| 151 | { |
| 152 | ret = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(1); |
| 153 | ret[0] = 0; |
| 154 | return ret; |
| 155 | } |
| 156 | else |
| 157 | return c_strndupcxx . . $ c_strndup(2050848944e00d54).(s, c_strlencxx . . $ c_strlen(751346f8406fd082).(s)); |
| 158 | } |
| 159 | |
| 160 | static void |
| 161 | clear_testpatterncxx . . $ clear_testpattern(d78e5810b80cc8a5).(testpattern_tcxx . . $ testpattern_t# *p) |
| 162 | { |
| 163 | int i; |
| 164 | for (i = 0; i < STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!; i++) |
| 165 | { |
| 166 | p->dcxx . . $ $anonymous_type_790f627673a290a_0#d..patterncxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#pattern..minscxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_3#mins.[i] = 0; |
| 167 | p->dcxx . . $ $anonymous_type_790f627673a290a_0#d..patterncxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#pattern..valscxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_3#vals.[i] = 0; |
| 168 | p->dcxx . . $ $anonymous_type_790f627673a290a_0#d..patterncxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#pattern..gammascxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_3#gammas.[i] = 1; |
| 169 | p->dcxx . . $ $anonymous_type_790f627673a290a_0#d..patterncxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#pattern..levelscxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_3#levels.[i] = 0; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | |
| 174 | testpattern_tcxx . . $ testpattern_t# * |
| 175 | get_next_testpatterncxx . . $ get_next_testpattern(db92c50458ac7521).(void) |
| 176 | { |
| 177 | static int internal_n_testpatterns = 0; |
| 178 | if (global_n_testpatternscxx . . $ global_n_testpatterns. == -1) |
| 179 | { |
| 180 | static_testpatternscxx . . $ static_testpatterns. = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(testpattern_tcxx . . $ testpattern_t#)); |
| 181 | global_n_testpatternscxx . . $ global_n_testpatterns. = 0; |
| 182 | internal_n_testpatterns = 1; |
| 183 | clear_testpatterncxx . . $ clear_testpattern(d78e5810b80cc8a5).(&(static_testpatternscxx . . $ static_testpatterns.[0])); |
| 184 | return &(static_testpatternscxx . . $ static_testpatterns.[0]); |
| 185 | } |
| 186 | else if (global_n_testpatternscxx . . $ global_n_testpatterns. + 1 >= internal_n_testpatterns) |
| 187 | { |
| 188 | internal_n_testpatterns *= 2; |
| 189 | static_testpatternscxx . . $ static_testpatterns. = |
| 190 | stp_realloccxx . . $ stp_realloc(417ab160f6baadc6).(static_testpatternscxx . . $ static_testpatterns., |
| 191 | internal_n_testpatterns * sizeof(testpattern_tcxx . . $ testpattern_t#)); |
| 192 | } |
| 193 | global_n_testpatternscxx . . $ global_n_testpatterns.++; |
| 194 | clear_testpatterncxx . . $ clear_testpattern(d78e5810b80cc8a5).(&(static_testpatternscxx . . $ static_testpatterns.[global_n_testpatternscxx . . $ global_n_testpatterns.])); |
| 195 | return &(static_testpatternscxx . . $ static_testpatterns.[global_n_testpatternscxx . . $ global_n_testpatterns.]); |
| 196 | } |
| 197 | |
| 198 | static void |
| 199 | writefunccxx . . $ writefunc(8e4e5e8cac233c6a).(void *file, const char *buf, size_t bytes) |
| 200 | { |
| 201 | FILEcxx . . $ FILE# *prn = (FILEcxx . . $ FILE# *)file; |
| 202 | bytes_writtencxx . . $ bytes_written. += bytes; |
| 203 | if (! file) |
| 204 | return; |
| 205 | if (file == stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!) |
| 206 | { |
| 207 | if (!global_quietcxx . . $ global_quiet.) |
| 208 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(buf, 1, bytes, prn); |
| 209 | } |
| 210 | else if (!global_suppress_outputcxx . . $ global_suppress_output.) |
| 211 | { |
| 212 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(buf, 1, bytes, prn); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | void |
| 217 | close_outputcxx . . $ close_output(49f6e7a06ebc5aa8).(void) |
| 218 | { |
| 219 | if (outputcxx . . $ output. && outputcxx . . $ output. != stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!) |
| 220 | { |
| 221 | if (write_to_processcxx . . $ write_to_process.) |
| 222 | (void) pclosecxx . . $ pclose(89bc1efcdac0ca22).(outputcxx . . $ output.); |
| 223 | else |
| 224 | (void) fclosecxx . . $ fclose(89bc1efcdac0ca22).(outputcxx . . $ output.); |
| 225 | outputcxx . . $ output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | static void |
| 230 | initialize_global_parameterscxx . . $ initialize_global_parameters(49f6e7a06ebc5aa8).(void) |
| 231 | { |
| 232 | int i; |
| 233 | for (i = 0; i < STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!; i++) |
| 234 | { |
| 235 | global_levelscxx . . $ global_levels.[i] = 1.0; |
| 236 | global_gammascxx . . $ global_gammas.[i] = 1.0; |
| 237 | } |
| 238 | global_gammacxx . . $ global_gamma. = 1.0; |
| 239 | global_stepscxx . . $ global_steps. = 256; |
| 240 | global_ink_limitcxx . . $ global_ink_limit. = 1.0; |
| 241 | global_noblacklinecxx . . $ global_noblackline. = 0; |
| 242 | global_printer_widthcxx . . $ global_printer_width. = 0; |
| 243 | global_printer_heightcxx . . $ global_printer_height. = 0; |
| 244 | global_band_heightcxx . . $ global_band_height. = 0; |
| 245 | global_n_testpatternscxx . . $ global_n_testpatterns. = -1; |
| 246 | if (global_printercxx . . $ global_printer.) |
| 247 | freecxx . . $ free(5d22bdacc48458e8).(global_printercxx . . $ global_printer.); /* Allocated with strdup() */ |
| 248 | global_printercxx . . $ global_printer. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 249 | global_densitycxx . . $ global_density. = 1.0; |
| 250 | global_xtopcxx . . $ global_xtop. = 0; |
| 251 | global_xleftcxx . . $ global_xleft. = 0; |
| 252 | global_hsizecxx . . $ global_hsize. = 1.0; |
| 253 | global_vsizecxx . . $ global_vsize. = 1.0; |
| 254 | global_bit_depthcxx . . $ global_bit_depth. = 16; |
| 255 | global_channel_depthcxx . . $ global_channel_depth. = 0; |
| 256 | global_image_typecxx . . $ global_image_type. = "CMYK"; |
| 257 | global_use_raw_cmykcxx . . $ global_use_raw_cmyk. = 0; |
| 258 | global_did_somethingcxx . . $ global_did_something. = 0; |
| 259 | global_invert_datacxx . . $ global_invert_data. = 0; |
| 260 | if (static_testpatternscxx . . $ static_testpatterns.) |
| 261 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(static_testpatternscxx . . $ static_testpatterns.); |
| 262 | static_testpatternscxx . . $ static_testpatterns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 263 | if (global_varscxx . . $ global_vars.) |
| 264 | stp_vars_destroycxx . . $ stp_vars_destroy(1a97b8462f9f913c).(global_varscxx . . $ global_vars.); |
| 265 | global_varscxx . . $ global_vars. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 266 | if (global_printercxx . . $ global_printer.) |
| 267 | freecxx . . $ free(5d22bdacc48458e8).(global_printercxx . . $ global_printer.); /* Allocated with strdup() */ |
| 268 | global_printercxx . . $ global_printer. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 269 | start_jobcxx . . $ start_job. = 0; |
| 270 | end_jobcxx . . $ end_job. = 0; |
| 271 | } |
| 272 | |
| 273 | static int |
| 274 | do_printcxx . . $ do_print(b126dc7c1de90089).(void) |
| 275 | { |
| 276 | int status = 0; |
| 277 | stp_vars_tcxx . . $ stp_vars_t# *v; |
| 278 | const stp_printer_tcxx . . $ stp_printer_t# *the_printer; |
| 279 | stp_dimension_tcxx . . $ stp_dimension_t# left, right, top, bottom; |
| 280 | stp_resolution_tcxx . . $ stp_resolution_t# x, y; |
| 281 | stp_dimension_tcxx . . $ stp_dimension_t# width, height; |
| 282 | int retval; |
| 283 | stp_parameter_list_tcxx . . $ stp_parameter_list_t# params; |
| 284 | int count; |
| 285 | int i; |
| 286 | char tmp[32]; |
| 287 | |
| 288 | initialize_global_parameterscxx . . $ initialize_global_parameters(49f6e7a06ebc5aa8).(); |
| 289 | global_varscxx . . $ global_vars. = stp_vars_createcxx . . $ stp_vars_create(ca9164ca858eeb6f).(); |
| 290 | stp_set_outfunccxx . . $ stp_set_outfunc(d4e9cdcd927ed799).(global_varscxx . . $ global_vars., writefunccxx . . $ writefunc(8e4e5e8cac233c6a).); |
| 291 | stp_set_errfunccxx . . $ stp_set_errfunc(d4e9cdcd927ed799).(global_varscxx . . $ global_vars., writefunccxx . . $ writefunc(8e4e5e8cac233c6a).); |
| 292 | stp_set_outdatacxx . . $ stp_set_outdata(da98ca80e19bc349).(global_varscxx . . $ global_vars., stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 293 | stp_set_errdatacxx . . $ stp_set_errdata(da98ca80e19bc349).(global_varscxx . . $ global_vars., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 294 | |
| 295 | setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C"); |
| 296 | retval = yyparsecxx . . $ yyparse(b126dc7c1de90089).(); |
| 297 | setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, ""); |
| 298 | if (retval) |
| 299 | return retval + 1; |
| 300 | |
| 301 | if (!global_did_somethingcxx . . $ global_did_something.) |
| 302 | return 1; |
| 303 | |
| 304 | v = stp_vars_createcxx . . $ stp_vars_create(ca9164ca858eeb6f).(); |
| 305 | the_printer = stp_get_printer_by_drivercxx . . $ stp_get_printer_by_driver(5594043bc706389b).(global_printercxx . . $ global_printer.); |
| 306 | if (!the_printer) |
| 307 | { |
| 308 | int j; |
| 309 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unknown printer %s\nValid printers are:\n", |
| 310 | global_printercxx . . $ global_printer.); |
| 311 | for (j = 0; j < stp_printer_model_countcxx . . $ stp_printer_model_count(b126dc7c1de90089).(); j++) |
| 312 | { |
| 313 | the_printer = stp_get_printer_by_indexcxx . . $ stp_get_printer_by_index(2036101347f379c).(j); |
| 314 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%-16s%s\n", stp_printer_get_drivercxx . . $ stp_printer_get_driver(b5d6ef9de7e317aa).(the_printer), |
| 315 | stp_printer_get_long_namecxx . . $ stp_printer_get_long_name(b5d6ef9de7e317aa).(the_printer)); |
| 316 | } |
| 317 | return 2; |
| 318 | } |
| 319 | bytes_writtencxx . . $ bytes_written. = 0; |
| 320 | if (global_outputcxx . . $ global_output.) |
| 321 | { |
| 322 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(global_outputcxx . . $ global_output., "-") == 0) |
| 323 | outputcxx . . $ output. = stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!; |
| 324 | else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(global_outputcxx . . $ global_output., "") == 0) |
| 325 | outputcxx . . $ output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 326 | else if (global_outputcxx . . $ global_output.[0] == '|') |
| 327 | { |
| 328 | close_outputcxx . . $ close_output(49f6e7a06ebc5aa8).(); |
| 329 | write_to_processcxx . . $ write_to_process. = 1; |
| 330 | outputcxx . . $ output. = popencxx . . $ popen(82ec0787cd37e0a3).(global_outputcxx . . $ global_output.+1, "w"); |
| 331 | if (! outputcxx . . $ output.) |
| 332 | { |
| 333 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "popen '%s' failed: %s\n", global_outputcxx . . $ global_output., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 334 | outputcxx . . $ output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 335 | } |
| 336 | freecxx . . $ free(5d22bdacc48458e8).(global_outputcxx . . $ global_output.); |
| 337 | global_outputcxx . . $ global_output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 338 | } |
| 339 | else |
| 340 | { |
| 341 | close_outputcxx . . $ close_output(49f6e7a06ebc5aa8).(); |
| 342 | outputcxx . . $ output. = fopencxx . . $ fopen(82ec0787cd37e0a3).(global_outputcxx . . $ global_output., "wb"); |
| 343 | if (! outputcxx . . $ output.) |
| 344 | { |
| 345 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Create %s failed: %s\n", global_outputcxx . . $ global_output., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 346 | outputcxx . . $ output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 347 | } |
| 348 | freecxx . . $ free(5d22bdacc48458e8).(global_outputcxx . . $ global_output.); |
| 349 | global_outputcxx . . $ global_output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 350 | } |
| 351 | } |
| 352 | stp_set_printer_defaultscxx . . $ stp_set_printer_defaults(34fc32b65e92740).(v, the_printer); |
| 353 | stp_set_outfunccxx . . $ stp_set_outfunc(d4e9cdcd927ed799).(v, writefunccxx . . $ writefunc(8e4e5e8cac233c6a).); |
| 354 | stp_set_errfunccxx . . $ stp_set_errfunc(d4e9cdcd927ed799).(v, writefunccxx . . $ writefunc(8e4e5e8cac233c6a).); |
| 355 | stp_set_outdatacxx . . $ stp_set_outdata(da98ca80e19bc349).(v, outputcxx . . $ output.); |
| 356 | stp_set_errdatacxx . . $ stp_set_errdata(da98ca80e19bc349).(v, stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 357 | stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "InputImageType", global_image_typecxx . . $ global_image_type.); |
| 358 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(tmp, "%d", global_bit_depthcxx . . $ global_bit_depth.); |
| 359 | stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "ChannelBitDepth", tmp); |
| 360 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(global_image_typecxx . . $ global_image_type., "Raw") == 0) |
| 361 | { |
| 362 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(tmp, "%d", global_channel_depthcxx . . $ global_channel_depth.); |
| 363 | stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "RawChannels", tmp); |
| 364 | } |
| 365 | stp_set_float_parametercxx . . $ stp_set_float_parameter(bd523a1c1fbe60d3).(v, "Density", global_densitycxx . . $ global_density.); |
| 366 | stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "Quality", "None"); |
| 367 | stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "ImageType", "None"); |
| 368 | |
| 369 | params = stp_get_parameter_listcxx . . $ stp_get_parameter_list(817585d40f809196).(v); |
| 370 | count = stp_parameter_list_countcxx . . $ stp_parameter_list_count(2e8e543e1193434e).(params); |
| 371 | for (i = 0; i < count; i++) |
| 372 | { |
| 373 | const stp_parameter_tcxx . . $ stp_parameter_t# *p = stp_parameter_list_paramcxx . . $ stp_parameter_list_param(f24b23997c12c6a6).(params, i); |
| 374 | if (p->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.) |
| 375 | { |
| 376 | const char *val = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.); |
| 377 | if (val && strlencxx . . $ strlen(751346f8406fd082).(val) > 0) |
| 378 | { |
| 379 | stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., val); |
| 380 | } |
| 381 | } |
| 382 | else if (p->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT. && |
| 383 | stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.)) |
| 384 | { |
| 385 | int val = stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.); |
| 386 | stp_set_int_parametercxx . . $ stp_set_int_parameter(8ec0183b6ab8ae2d).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., val); |
| 387 | } |
| 388 | else if (p->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN. && |
| 389 | stp_check_boolean_parametercxx . . $ stp_check_boolean_parameter(cff2817d3dcc2695).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.)) |
| 390 | { |
| 391 | int val = stp_get_boolean_parametercxx . . $ stp_get_boolean_parameter(b1e629819c29df09).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.); |
| 392 | stp_set_boolean_parametercxx . . $ stp_set_boolean_parameter(8ec0183b6ab8ae2d).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., val); |
| 393 | } |
| 394 | else if (p->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_CURVEcxx . . $ STP_PARAMETER_TYPE_CURVE. && |
| 395 | stp_check_curve_parametercxx . . $ stp_check_curve_parameter(cff2817d3dcc2695).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.)) |
| 396 | { |
| 397 | const stp_curve_tcxx . . $ stp_curve_t# *val = stp_get_curve_parametercxx . . $ stp_get_curve_parameter(702e9bffd3dd1409).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.); |
| 398 | stp_set_curve_parametercxx . . $ stp_set_curve_parameter(434798a77903eb98).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., val); |
| 399 | } |
| 400 | else if (p->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_DOUBLEcxx . . $ STP_PARAMETER_TYPE_DOUBLE. && |
| 401 | stp_check_float_parametercxx . . $ stp_check_float_parameter(cff2817d3dcc2695).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.)) |
| 402 | { |
| 403 | double val = stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(global_varscxx . . $ global_vars., p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.); |
| 404 | stp_set_float_parametercxx . . $ stp_set_float_parameter(bd523a1c1fbe60d3).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., val); |
| 405 | } |
| 406 | } |
| 407 | stp_set_page_widthcxx . . $ stp_set_page_width(8ce3003bda9b93be).(v, stp_get_page_widthcxx . . $ stp_get_page_width(7f9a8d44e8193bba).(global_varscxx . . $ global_vars.)); |
| 408 | stp_set_page_heightcxx . . $ stp_set_page_height(8ce3003bda9b93be).(v, stp_get_page_heightcxx . . $ stp_get_page_height(7f9a8d44e8193bba).(global_varscxx . . $ global_vars.)); |
| 409 | stp_parameter_list_destroycxx . . $ stp_parameter_list_destroy(5d22bdacc48458e8).(params); |
| 410 | if (stp_check_string_parametercxx . . $ stp_check_string_parameter(cff2817d3dcc2695).(v, "PageSize", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.) && |
| 411 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "PageSize"), "Auto")) |
| 412 | { |
| 413 | stp_parameter_tcxx . . $ stp_parameter_t# desc; |
| 414 | stp_describe_parametercxx . . $ stp_describe_parameter(dfd5b9531b51a6d2).(v, "PageSize", &desc); |
| 415 | if (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.) |
| 416 | stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "PageSize", desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str.); |
| 417 | stp_parameter_description_destroycxx . . $ stp_parameter_description_destroy(6259b4d9050bb586).(&desc); |
| 418 | } |
| 419 | stp_set_printer_defaults_softcxx . . $ stp_set_printer_defaults_soft(34fc32b65e92740).(v, the_printer); |
| 420 | |
| 421 | stp_get_imageable_areacxx . . $ stp_get_imageable_area(25e50967534aa153).(v, &left, &right, &bottom, &top); |
| 422 | left = roundtocxx . . $ roundto(447c67c6676f75c3).(left); |
| 423 | right = roundtocxx . . $ roundto(447c67c6676f75c3).(right); |
| 424 | bottom = roundtocxx . . $ roundto(447c67c6676f75c3).(bottom); |
| 425 | top = roundtocxx . . $ roundto(447c67c6676f75c3).(top); |
| 426 | stp_describe_resolutioncxx . . $ stp_describe_resolution(5883f070c6139f40).(v, &x, &y); |
| 427 | if (x < 0) |
| 428 | x = 300; |
| 429 | if (y < 0) |
| 430 | y = 300; |
| 431 | |
| 432 | width = roundtocxx . . $ roundto(447c67c6676f75c3).(right - left); |
| 433 | height = roundtocxx . . $ roundto(447c67c6676f75c3).(bottom - top); |
| 434 | |
| 435 | switch (global_size_modecxx . . $ global_size_mode.) |
| 436 | { |
| 437 | case SIZE_PTcxx . . $ SIZE_PT.: |
| 438 | top += roundtocxx . . $ roundto(447c67c6676f75c3).((int) (global_xtopcxx . . $ global_xtop. + .5)); |
| 439 | left += roundtocxx . . $ roundto(447c67c6676f75c3).((int) (global_xleftcxx . . $ global_xleft. + .5)); |
| 440 | width = roundtocxx . . $ roundto(447c67c6676f75c3).((int) (global_hsizecxx . . $ global_hsize. + .5)); |
| 441 | height = roundtocxx . . $ roundto(447c67c6676f75c3).((int) (global_vsizecxx . . $ global_vsize. + .5)); |
| 442 | break; |
| 443 | case SIZE_INcxx . . $ SIZE_IN.: |
| 444 | top += roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_xtopcxx . . $ global_xtop. * 72) + .5)); |
| 445 | left += roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_xleftcxx . . $ global_xleft. * 72) + .5)); |
| 446 | width = roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_hsizecxx . . $ global_hsize. * 72) + .5)); |
| 447 | height = roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_vsizecxx . . $ global_vsize. * 72) + .5)); |
| 448 | break; |
| 449 | case SIZE_MMcxx . . $ SIZE_MM.: |
| 450 | top += roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_xtopcxx . . $ global_xtop. * 72 / 25.4) + .5)); |
| 451 | left += roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_xleftcxx . . $ global_xleft. * 72 / 25.4) + .5)); |
| 452 | width = roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_hsizecxx . . $ global_hsize. * 72 / 25.4) + .5)); |
| 453 | height = roundtocxx . . $ roundto(447c67c6676f75c3).((int) ((global_vsizecxx . . $ global_vsize. * 72 / 25.4) + .5)); |
| 454 | break; |
| 455 | case SIZE_RELATIVEcxx . . $ SIZE_RELATIVE.: |
| 456 | default: |
| 457 | top = roundtocxx . . $ roundto(447c67c6676f75c3).(top + (height * global_xtopcxx . . $ global_xtop.)); |
| 458 | left = roundtocxx . . $ roundto(447c67c6676f75c3).(left + (width * global_xleftcxx . . $ global_xleft.)); |
| 459 | width = roundtocxx . . $ roundto(447c67c6676f75c3).(width * global_hsizecxx . . $ global_hsize.); |
| 460 | height = roundtocxx . . $ roundto(447c67c6676f75c3).(height * global_vsizecxx . . $ global_vsize.); |
| 461 | break; |
| 462 | } |
| 463 | if (width < 1) |
| 464 | width = 1; |
| 465 | if (height < 1) |
| 466 | height = 1; |
| 467 | |
| 468 | stp_set_widthcxx . . $ stp_set_width(8ce3003bda9b93be).(v, width); |
| 469 | stp_set_heightcxx . . $ stp_set_height(8ce3003bda9b93be).(v, height); |
| 470 | #if 0 |
| 471 | width = (width / global_steps) * global_steps; |
| 472 | height = (height / global_n_testpatterns) * global_n_testpatterns; |
| 473 | #endif |
| 474 | if (global_stepscxx . . $ global_steps. > width) |
| 475 | global_stepscxx . . $ global_steps. = width; |
| 476 | |
| 477 | global_printer_widthcxx . . $ global_printer_width. = width * x / 72; |
| 478 | global_printer_heightcxx . . $ global_printer_height. = height * y / 72; |
| 479 | |
| 480 | global_band_heightcxx . . $ global_band_height. = global_printer_heightcxx . . $ global_printer_height. / global_n_testpatternscxx . . $ global_n_testpatterns.; |
| 481 | if (global_band_heightcxx . . $ global_band_height. == 0) |
| 482 | global_band_heightcxx . . $ global_band_height. = 1; |
| 483 | stp_set_leftcxx . . $ stp_set_left(8ce3003bda9b93be).(v, left); |
| 484 | stp_set_topcxx . . $ stp_set_top(8ce3003bda9b93be).(v, top); |
| 485 | |
| 486 | stp_merge_printvarscxx . . $ stp_merge_printvars(352fcd689be2d739).(v, stp_printer_get_defaultscxx . . $ stp_printer_get_defaults(961f21647a798a4c).(the_printer)); |
| 487 | if (stp_verifycxx . . $ stp_verify(60b55b6a36641e80).(v)) |
| 488 | { |
| 489 | bytes_writtencxx . . $ bytes_written. = 0; |
| 490 | if (start_jobcxx . . $ start_job.) |
| 491 | { |
| 492 | stp_start_jobcxx . . $ stp_start_job(be5d09c432b01f95).(v, &theImagecxx . . $ theImage.); |
| 493 | start_jobcxx . . $ start_job. = 0; |
| 494 | } |
| 495 | if (stp_printcxx . . $ stp_print(be5d09c432b01f95).(v, &theImagecxx . . $ theImage.) != 1) |
| 496 | { |
| 497 | if (!global_quietcxx . . $ global_quiet.) |
| 498 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("FAILED", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 499 | failurescxx . . $ failures.++; |
| 500 | status = 2; |
| 501 | if (global_halt_on_errorcxx . . $ global_halt_on_error.) |
| 502 | return status; |
| 503 | } |
| 504 | else if (bytes_writtencxx . . $ bytes_written. == 0) |
| 505 | { |
| 506 | if (!global_quietcxx . . $ global_quiet.) |
| 507 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("FAILED: No output", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 508 | failurescxx . . $ failures.++; |
| 509 | status = 2; |
| 510 | if (global_halt_on_errorcxx . . $ global_halt_on_error.) |
| 511 | return status; |
| 512 | } |
| 513 | else |
| 514 | passescxx . . $ passes.++; |
| 515 | if (end_jobcxx . . $ end_job.) |
| 516 | { |
| 517 | stp_end_jobcxx . . $ stp_end_job(be5d09c432b01f95).(v, &theImagecxx . . $ theImage.); |
| 518 | end_jobcxx . . $ end_job. = 0; |
| 519 | } |
| 520 | } |
| 521 | else |
| 522 | { |
| 523 | if (! global_fail_verify_okcxx . . $ global_fail_verify_ok.) |
| 524 | { |
| 525 | if (!global_quietcxx . . $ global_quiet.) |
| 526 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("FAILED", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 527 | failurescxx . . $ failures.++; |
| 528 | status = 2; |
| 529 | if (global_halt_on_errorcxx . . $ global_halt_on_error.) |
| 530 | return status; |
| 531 | } |
| 532 | else |
| 533 | { |
| 534 | if (!global_quietcxx . . $ global_quiet.) |
| 535 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("(skipped)", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 536 | skippedcxx . . $ skipped.++; |
| 537 | } |
| 538 | } |
| 539 | if (!global_quietcxx . . $ global_quiet.) |
| 540 | fputccxx . . $ fputc(b1cd03d6c470d1bd).('\n', stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 541 | stp_vars_destroycxx . . $ stp_vars_destroy(1a97b8462f9f913c).(v); |
| 542 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(static_testpatternscxx . . $ static_testpatterns.); |
| 543 | static_testpatternscxx . . $ static_testpatterns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 544 | return status; |
| 545 | } |
| 546 | |
| 547 | int |
| 548 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) |
| 549 | { |
| 550 | int c; |
| 551 | int status; |
| 552 | int global_status = 0; |
| 553 | while (1) |
| 554 | { |
| 555 | c = getoptcxx . . $ getopt(2483c31ff9bab884).(argc, argv, "nqyH"); |
| 556 | if (c == -1) |
| 557 | break; |
| 558 | switch (c) |
| 559 | { |
| 560 | case 'n': |
| 561 | global_suppress_outputcxx . . $ global_suppress_output. = 1; |
| 562 | break; |
| 563 | case 'q': |
| 564 | global_quietcxx . . $ global_quiet. = 1; |
| 565 | break; |
| 566 | case 'y': |
| 567 | global_fail_verify_okcxx . . $ global_fail_verify_ok. = 1; |
| 568 | break; |
| 569 | case 'H': |
| 570 | global_halt_on_errorcxx . . $ global_halt_on_error. = 1; |
| 571 | break; |
| 572 | default: |
| 573 | break; |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | stp_initcxx . . $ stp_init(b126dc7c1de90089).(); |
| 578 | outputcxx . . $ output. = stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!; |
| 579 | while (1) |
| 580 | { |
| 581 | status = do_printcxx . . $ do_print(b126dc7c1de90089).(); |
| 582 | if (status == 1) |
| 583 | break; |
| 584 | else if (status != 0) |
| 585 | global_status = 1; |
| 586 | } |
| 587 | close_outputcxx . . $ close_output(49f6e7a06ebc5aa8).(); |
| 588 | if (passescxx . . $ passes. + failurescxx . . $ failures. + skippedcxx . . $ skipped. > 1) |
| 589 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%d pass, %d fail, %d skipped\n", passescxx . . $ passes., failurescxx . . $ failures., skippedcxx . . $ skipped.); |
| 590 | return global_status; |
| 591 | } |
| 592 | |
| 593 | static void |
| 594 | invert_datacxx . . $ invert_data(6165b45f45ef689c).(unsigned char *data, size_t byte_depth) |
| 595 | { |
| 596 | size_t i; |
| 597 | size_t total_bytes; |
| 598 | total_bytes = global_printer_widthcxx . . $ global_printer_width. * global_channel_depthcxx . . $ global_channel_depth. * byte_depth; |
| 599 | for (i = 0; i < total_bytes; i++) |
| 600 | data[i] = 0xff ^ data[i]; |
| 601 | } |
| 602 | |
| 603 | /* |
| 604 | * Emulate templates with macros -- rlk 20031014 |
| 605 | */ |
| 606 | |
| 607 | #define FILL_CHANNELS_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:607:9`!(T, bits) \ |
| 608 | static void \ |
| 609 | fill_channels_##bits(unsigned char *data, size_t len, size_t scount) \ |
| 610 | { \ |
| 611 | size_t i; \ |
| 612 | size_t c; \ |
| 613 | scount = global_channel_depth; \ |
| 614 | T *s_data = (T *) data; \ |
| 615 | unsigned black_val = global_ink_limit * ((1 << bits) - 1); \ |
| 616 | unsigned blocksize = len / scount; \ |
| 617 | unsigned blocks = blocksize * scount; \ |
| 618 | unsigned extra = len - blocks; \ |
| 619 | memset(s_data, 0, sizeof(T) * len * scount); \ |
| 620 | for (c = 0; c < scount; c++) \ |
| 621 | { \ |
| 622 | for (i = 0; i < blocksize; i++) \ |
| 623 | { \ |
| 624 | s_data[c] = black_val; \ |
| 625 | s_data += global_channel_depth; \ |
| 626 | } \ |
| 627 | } \ |
| 628 | memset(s_data, 0xff, sizeof(T) * extra * \ |
| 629 | global_channel_depth); \ |
| 630 | } |
| 631 | |
| 632 | FILL_CHANNELS_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:607:9`!(unsigned short, 16) |
| 633 | FILL_CHANNELS_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:607:9`!(unsigned char, 8) |
| 634 | |
| 635 | static void |
| 636 | fill_channelscxx . . $ fill_channels(5983bf68a24b84b4).(unsigned char *data, size_t len, size_t scount, size_t bytes) |
| 637 | { |
| 638 | switch (bytes) |
| 639 | { |
| 640 | case 1: |
| 641 | fill_channels_8cxx . . $ fill_channels_8(73a68661ce58eed2).(data, len, scount); |
| 642 | break; |
| 643 | case 2: |
| 644 | fill_channels_16cxx . . $ fill_channels_16(73a68661ce58eed2).(data, len, scount); |
| 645 | break; |
| 646 | } |
| 647 | if (global_invert_datacxx . . $ global_invert_data.) |
| 648 | invert_datacxx . . $ invert_data(6165b45f45ef689c).(data, bytes); |
| 649 | } |
| 650 | |
| 651 | #define FILL_BLACK_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:651:9`!(T, bits) \ |
| 652 | static void \ |
| 653 | fill_black_##bits(unsigned char *data, size_t len, size_t scount) \ |
| 654 | { \ |
| 655 | size_t i; \ |
| 656 | (void)scount; \ |
| 657 | T *s_data = (T *) data; \ |
| 658 | unsigned black_val = global_ink_limit * ((1 << bits) - 1); \ |
| 659 | unsigned blocks = (len / scount) * scount; \ |
| 660 | unsigned extra = len - blocks; \ |
| 661 | if (strcmp(global_image_type, "Raw") == 0) \ |
| 662 | { \ |
| 663 | for (i = 0; i < (len / scount) * scount; i++) \ |
| 664 | { \ |
| 665 | memset(s_data, 0, sizeof(T) * global_channel_depth); \ |
| 666 | s_data[0] = black_val; \ |
| 667 | if (global_channel_depth == 3) \ |
| 668 | { \ |
| 669 | s_data[1] = black_val; \ |
| 670 | s_data[2] = black_val; \ |
| 671 | } \ |
| 672 | else if (global_channel_depth == 5) \ |
| 673 | { \ |
| 674 | s_data[2] = black_val; \ |
| 675 | s_data[4] = black_val; \ |
| 676 | } \ |
| 677 | s_data += global_channel_depth; \ |
| 678 | } \ |
| 679 | memset(s_data, 0xff, sizeof(T) * extra * \ |
| 680 | global_channel_depth); \ |
| 681 | } \ |
| 682 | else if (strcmp(global_image_type, "RGB") == 0) \ |
| 683 | { \ |
| 684 | for (i = 0; i < (len / scount) * scount; i++) \ |
| 685 | { \ |
| 686 | memset(s_data, 0, sizeof(T) * 3); \ |
| 687 | s_data += 3; \ |
| 688 | } \ |
| 689 | memset(s_data, 0, sizeof(T) * extra * 3); \ |
| 690 | } \ |
| 691 | else if (strcmp(global_image_type, "CMY") == 0) \ |
| 692 | { \ |
| 693 | for (i = 0; i < (len / scount) * scount; i++) \ |
| 694 | { \ |
| 695 | s_data[0] = black_val; \ |
| 696 | s_data[1] = black_val; \ |
| 697 | s_data[2] = black_val; \ |
| 698 | s_data += 3; \ |
| 699 | } \ |
| 700 | memset(s_data, 0, sizeof(T) * extra * 3); \ |
| 701 | } \ |
| 702 | else if (strcmp(global_image_type, "CMYK") == 0) \ |
| 703 | { \ |
| 704 | for (i = 0; i < (len / scount) * scount; i++) \ |
| 705 | { \ |
| 706 | memset(s_data, 0, sizeof(T) * 4); \ |
| 707 | s_data[3] = black_val; \ |
| 708 | s_data += 4; \ |
| 709 | } \ |
| 710 | memset(s_data, 0, sizeof(T) * extra * 4); \ |
| 711 | } \ |
| 712 | else if (strcmp(global_image_type, "KCMY") == 0) \ |
| 713 | { \ |
| 714 | for (i = 0; i < (len / scount) * scount; i++) \ |
| 715 | { \ |
| 716 | memset(s_data, 0, sizeof(T) * 4); \ |
| 717 | s_data[0] = black_val; \ |
| 718 | s_data += 4; \ |
| 719 | } \ |
| 720 | memset(s_data, 0, sizeof(T) * extra * 4); \ |
| 721 | } \ |
| 722 | else if (strcmp(global_image_type, "Grayscale") == 0) \ |
| 723 | { \ |
| 724 | for (i = 0; i < (len / scount) * scount; i++) \ |
| 725 | { \ |
| 726 | memset(s_data, 0, sizeof(T) * 1); \ |
| 727 | s_data[0] = black_val; \ |
| 728 | s_data += 1; \ |
| 729 | } \ |
| 730 | memset(s_data, 0, sizeof(T) * extra); \ |
| 731 | } \ |
| 732 | else if (strcmp(global_image_type, "Whitescale") == 0) \ |
| 733 | { \ |
| 734 | for (i = 0; i < (len / scount) * scount; i++) \ |
| 735 | { \ |
| 736 | memset(s_data, 0, sizeof(T) * 1); \ |
| 737 | s_data += 1; \ |
| 738 | } \ |
| 739 | memset(s_data, 0xff, sizeof(T) * extra); \ |
| 740 | } \ |
| 741 | } |
| 742 | |
| 743 | FILL_BLACK_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:651:9`!(unsigned short, 16) |
| 744 | FILL_BLACK_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:651:9`!(unsigned char, 8) |
| 745 | |
| 746 | static void |
| 747 | fill_blackcxx . . $ fill_black(5983bf68a24b84b4).(unsigned char *data, size_t len, size_t scount, size_t bytes) |
| 748 | { |
| 749 | if (global_colorlinecxx . . $ global_colorline.) |
| 750 | fill_channelscxx . . $ fill_channels(5983bf68a24b84b4).(data, len, global_channel_depthcxx . . $ global_channel_depth., bytes); |
| 751 | else |
| 752 | { |
| 753 | switch (bytes) |
| 754 | { |
| 755 | case 1: |
| 756 | fill_black_8cxx . . $ fill_black_8(73a68661ce58eed2).(data, len, scount); |
| 757 | break; |
| 758 | case 2: |
| 759 | fill_black_16cxx . . $ fill_black_16(73a68661ce58eed2).(data, len, scount); |
| 760 | break; |
| 761 | } |
| 762 | if (global_invert_datacxx . . $ global_invert_data.) |
| 763 | invert_datacxx . . $ invert_data(6165b45f45ef689c).(data, bytes); |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | #define FILL_WHITE_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:767:9`!(T, bits) \ |
| 768 | static void \ |
| 769 | fill_white_##bits(unsigned char *data, size_t len, size_t scount) \ |
| 770 | { \ |
| 771 | size_t i; \ |
| 772 | (void)scount; \ |
| 773 | T *s_data = (T *) data; \ |
| 774 | if (strcmp(global_image_type, "Raw") == 0) \ |
| 775 | { \ |
| 776 | for (i = 0; i < len; i++) \ |
| 777 | { \ |
| 778 | memset(s_data, 0, sizeof(T) * global_channel_depth); \ |
| 779 | s_data += global_channel_depth; \ |
| 780 | } \ |
| 781 | } \ |
| 782 | else if (strcmp(global_image_type, "RGB") == 0) \ |
| 783 | { \ |
| 784 | for (i = 0; i < len; i++) \ |
| 785 | { \ |
| 786 | memset(s_data, 0xff, sizeof(T) * 3); \ |
| 787 | s_data += 3; \ |
| 788 | } \ |
| 789 | } \ |
| 790 | else if (strcmp(global_image_type, "CMY") == 0) \ |
| 791 | { \ |
| 792 | for (i = 0; i < len; i++) \ |
| 793 | { \ |
| 794 | memset(s_data, 0, sizeof(T) * 3); \ |
| 795 | s_data += 3; \ |
| 796 | } \ |
| 797 | } \ |
| 798 | else if (strcmp(global_image_type, "CMYK") == 0) \ |
| 799 | { \ |
| 800 | for (i = 0; i < len; i++) \ |
| 801 | { \ |
| 802 | memset(s_data, 0, sizeof(T) * 4); \ |
| 803 | s_data += 4; \ |
| 804 | } \ |
| 805 | } \ |
| 806 | else if (strcmp(global_image_type, "KCMY") == 0) \ |
| 807 | { \ |
| 808 | for (i = 0; i < len; i++) \ |
| 809 | { \ |
| 810 | memset(s_data, 0, sizeof(T) * 4); \ |
| 811 | s_data += 4; \ |
| 812 | } \ |
| 813 | } \ |
| 814 | else if (strcmp(global_image_type, "Grayscale") == 0) \ |
| 815 | { \ |
| 816 | for (i = 0; i < len; i++) \ |
| 817 | { \ |
| 818 | memset(s_data, 0, sizeof(T) * 1); \ |
| 819 | s_data += 1; \ |
| 820 | } \ |
| 821 | } \ |
| 822 | else if (strcmp(global_image_type, "Whitescale") == 0) \ |
| 823 | { \ |
| 824 | for (i = 0; i < len; i++) \ |
| 825 | { \ |
| 826 | memset(s_data, 0xff, sizeof(T) * 1); \ |
| 827 | s_data += 1; \ |
| 828 | } \ |
| 829 | } \ |
| 830 | } |
| 831 | |
| 832 | FILL_WHITE_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:767:9`!(unsigned short, 16) |
| 833 | FILL_WHITE_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:767:9`!(unsigned char, 8) |
| 834 | |
| 835 | static void |
| 836 | fill_whitecxx . . $ fill_white(5983bf68a24b84b4).(unsigned char *data, size_t len, size_t scount, size_t bytes) |
| 837 | { |
| 838 | switch (bytes) |
| 839 | { |
| 840 | case 1: |
| 841 | fill_white_8cxx . . $ fill_white_8(73a68661ce58eed2).(data, len, scount); |
| 842 | break; |
| 843 | case 2: |
| 844 | fill_white_16cxx . . $ fill_white_16(73a68661ce58eed2).(data, len, scount); |
| 845 | break; |
| 846 | } |
| 847 | if (global_invert_datacxx . . $ global_invert_data.) |
| 848 | invert_datacxx . . $ invert_data(6165b45f45ef689c).(data, bytes); |
| 849 | } |
| 850 | |
| 851 | #define FILL_GRID_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:851:9`!(T, bits) \ |
| 852 | static void \ |
| 853 | fill_grid_##bits(unsigned char *data, size_t len, size_t scount, \ |
| 854 | testpattern_t *p) \ |
| 855 | { \ |
| 856 | int i; \ |
| 857 | int xlen = (len / scount) * scount; \ |
| 858 | int errdiv = (p->d.grid.ticks) / (xlen - 1); \ |
| 859 | int errmod = (p->d.grid.ticks) % (xlen - 1); \ |
| 860 | int errval = 0; \ |
| 861 | int errlast = -1; \ |
| 862 | int errline = 0; \ |
| 863 | T *s_data = (T *) data; \ |
| 864 | unsigned multiplier = (1 << bits) - 1; \ |
| 865 | \ |
| 866 | for (i = 0; i < xlen; i++) \ |
| 867 | { \ |
| 868 | if (errline != errlast) \ |
| 869 | { \ |
| 870 | errlast = errline; \ |
| 871 | s_data[0] = multiplier; \ |
| 872 | } \ |
| 873 | else \ |
| 874 | s_data[0] = 0; \ |
| 875 | errval += errmod; \ |
| 876 | errline += errdiv; \ |
| 877 | if (errval >= xlen - 1) \ |
| 878 | { \ |
| 879 | errval -= xlen - 1; \ |
| 880 | errline++; \ |
| 881 | } \ |
| 882 | s_data += global_channel_depth; \ |
| 883 | } \ |
| 884 | } |
| 885 | |
| 886 | FILL_GRID_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:851:9`!(unsigned short, 16) |
| 887 | FILL_GRID_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:851:9`!(unsigned char, 8) |
| 888 | |
| 889 | static void |
| 890 | fill_gridcxx . . $ fill_grid(b7110f566fb8c408).(unsigned char *data, size_t len, size_t scount, |
| 891 | testpattern_tcxx . . $ testpattern_t# *p, size_t bytes) |
| 892 | { |
| 893 | switch (bytes) |
| 894 | { |
| 895 | case 1: |
| 896 | fill_grid_8cxx . . $ fill_grid_8(e97314a31eb1c539).(data, len, scount, p); |
| 897 | break; |
| 898 | case 2: |
| 899 | fill_grid_16cxx . . $ fill_grid_16(e97314a31eb1c539).(data, len, scount, p); |
| 900 | break; |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | #define FILL_COLORS_EXTENDED_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:904:9`!(T, bits) \ |
| 905 | static void \ |
| 906 | fill_colors_extended_##bits(unsigned char *data, size_t len, \ |
| 907 | size_t scount, testpattern_t *p) \ |
| 908 | { \ |
| 909 | double mins[STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!]; \ |
| 910 | double vals[STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!]; \ |
| 911 | double gammas[STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!]; \ |
| 912 | size_t i; \ |
| 913 | int j; \ |
| 914 | int k; \ |
| 915 | int pixels; \ |
| 916 | int channel_limit = \ |
| 917 | global_channel_depth <= 7 ? 7 : global_channel_depth; \ |
| 918 | T *s_data = (T *) data; \ |
| 919 | unsigned multiplier = global_noscale ? 1 : (1 << bits) - 1; \ |
| 920 | \ |
| 921 | for (j = 0; j < channel_limit; j++) \ |
| 922 | { \ |
| 923 | mins[j] = p->d.pattern.mins[j] == -2 ? \ |
| 924 | global_levels[j] : p->d.pattern.mins[j]; \ |
| 925 | vals[j] = p->d.pattern.vals[j] == -2 ? \ |
| 926 | global_levels[j] : p->d.pattern.vals[j]; \ |
| 927 | gammas[j] = \ |
| 928 | p->d.pattern.gammas[j] * global_gamma * global_gammas[j]; \ |
| 929 | vals[j] -= mins[j]; \ |
| 930 | } \ |
| 931 | if (scount > len) \ |
| 932 | scount = len; \ |
| 933 | pixels = len / scount; \ |
| 934 | for (i = 0; i < scount; i++) \ |
| 935 | { \ |
| 936 | double where = (double) i / ((double) scount - 1); \ |
| 937 | double val = where; \ |
| 938 | double xvals[STP_CHANNEL_LIMITcxx . . $ `include/gutenprint/image.h:48:9`!]; \ |
| 939 | \ |
| 940 | for (j = 0; j < channel_limit; j++) \ |
| 941 | { \ |
| 942 | xvals[j] = mins[j] + val * vals[j]; \ |
| 943 | xvals[j] = pow(xvals[j], gammas[j]); \ |
| 944 | xvals[j] *= global_ink_limit * multiplier; \ |
| 945 | xvals[j] += 0.9; \ |
| 946 | } \ |
| 947 | for (k = 0; k < pixels; k++) \ |
| 948 | { \ |
| 949 | switch (global_channel_depth) \ |
| 950 | { \ |
| 951 | case 1: \ |
| 952 | s_data[0] = xvals[0]; \ |
| 953 | break; \ |
| 954 | case 2: \ |
| 955 | s_data[0] = xvals[0]; \ |
| 956 | s_data[1] = xvals[4]; \ |
| 957 | break; \ |
| 958 | case 3: \ |
| 959 | s_data[0] = xvals[1]; \ |
| 960 | s_data[1] = xvals[2]; \ |
| 961 | s_data[2] = xvals[3]; \ |
| 962 | break; \ |
| 963 | case 4: \ |
| 964 | s_data[0] = xvals[0]; \ |
| 965 | s_data[1] = xvals[1]; \ |
| 966 | s_data[2] = xvals[2]; \ |
| 967 | s_data[3] = xvals[3]; \ |
| 968 | break; \ |
| 969 | case 5: \ |
| 970 | s_data[0] = xvals[1]; \ |
| 971 | s_data[1] = xvals[5]; \ |
| 972 | s_data[2] = xvals[2]; \ |
| 973 | s_data[3] = xvals[6]; \ |
| 974 | s_data[4] = xvals[3]; \ |
| 975 | break; \ |
| 976 | case 6: \ |
| 977 | s_data[0] = xvals[0]; \ |
| 978 | s_data[1] = xvals[1]; \ |
| 979 | s_data[2] = xvals[5]; \ |
| 980 | s_data[3] = xvals[2]; \ |
| 981 | s_data[4] = xvals[6]; \ |
| 982 | s_data[5] = xvals[3]; \ |
| 983 | break; \ |
| 984 | case 7: \ |
| 985 | s_data[0] = xvals[0]; \ |
| 986 | s_data[1] = xvals[4]; \ |
| 987 | s_data[2] = xvals[1]; \ |
| 988 | s_data[3] = xvals[5]; \ |
| 989 | s_data[4] = xvals[2]; \ |
| 990 | s_data[5] = xvals[6]; \ |
| 991 | s_data[6] = xvals[3]; \ |
| 992 | break; \ |
| 993 | default: \ |
| 994 | for (j = 0; j < global_channel_depth; j++) \ |
| 995 | s_data[j] = xvals[j]; \ |
| 996 | } \ |
| 997 | s_data += global_channel_depth; \ |
| 998 | } \ |
| 999 | } \ |
| 1000 | } |
| 1001 | |
| 1002 | FILL_COLORS_EXTENDED_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:904:9`!(unsigned short, 16) |
| 1003 | FILL_COLORS_EXTENDED_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:904:9`!(unsigned char, 8) |
| 1004 | |
| 1005 | static void |
| 1006 | fill_colors_extendedcxx . . $ fill_colors_extended(b7110f566fb8c408).(unsigned char *data, size_t len, size_t scount, |
| 1007 | testpattern_tcxx . . $ testpattern_t# *p, size_t bytes) |
| 1008 | { |
| 1009 | switch (bytes) |
| 1010 | { |
| 1011 | case 1: |
| 1012 | fill_colors_extended_8cxx . . $ fill_colors_extended_8(e97314a31eb1c539).(data, len, scount, p); |
| 1013 | break; |
| 1014 | case 2: |
| 1015 | fill_colors_extended_16cxx . . $ fill_colors_extended_16(e97314a31eb1c539).(data, len, scount, p); |
| 1016 | break; |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | #define FILL_COLORS_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:1020:9`!(T, bits) \ |
| 1021 | static void \ |
| 1022 | fill_colors_##bits(unsigned char *data, size_t len, size_t scount, \ |
| 1023 | testpattern_t *p) \ |
| 1024 | { \ |
| 1025 | double mins[4]; \ |
| 1026 | double vals[4]; \ |
| 1027 | double gammas[4]; \ |
| 1028 | double levels[4]; \ |
| 1029 | double lower = p->d.pattern.lower; \ |
| 1030 | double upper = p->d.pattern.upper; \ |
| 1031 | size_t i; \ |
| 1032 | size_t j; \ |
| 1033 | int pixels; \ |
| 1034 | T *s_data = (T *) data; \ |
| 1035 | unsigned multiplier = global_noscale ? 1 : (1 << bits) - 1; \ |
| 1036 | \ |
| 1037 | vals[0] = p->d.pattern.vals[0]; \ |
| 1038 | mins[0] = p->d.pattern.mins[0]; \ |
| 1039 | \ |
| 1040 | for (j = 1; j < 4; j++) \ |
| 1041 | { \ |
| 1042 | vals[j] = p->d.pattern.vals[j] == -2 ? global_levels[j] : \ |
| 1043 | p->d.pattern.vals[j]; \ |
| 1044 | mins[j] = p->d.pattern.mins[j] == -2 ? global_levels[j] : \ |
| 1045 | p->d.pattern.mins[j]; \ |
| 1046 | levels[j] = p->d.pattern.levels[j] == \ |
| 1047 | -2 ? global_levels[j] : p->d.pattern.levels[j]; \ |
| 1048 | } \ |
| 1049 | for (j = 0; j < 4; j++) \ |
| 1050 | { \ |
| 1051 | gammas[j] = \ |
| 1052 | p->d.pattern.gammas[j] * global_gamma * global_gammas[j]; \ |
| 1053 | vals[j] -= mins[j]; \ |
| 1054 | } \ |
| 1055 | \ |
| 1056 | if (scount > len) \ |
| 1057 | scount = len; \ |
| 1058 | pixels = len / scount; \ |
| 1059 | for (i = 0; i < scount; i++) \ |
| 1060 | { \ |
| 1061 | int k; \ |
| 1062 | double where = (double) i / ((double) scount - 1); \ |
| 1063 | double cmyv; \ |
| 1064 | double kv; \ |
| 1065 | double val = where; \ |
| 1066 | double xvals[4]; \ |
| 1067 | for (j = 0; j < 4; j++) \ |
| 1068 | { \ |
| 1069 | if (j > 0) \ |
| 1070 | xvals[j] = mins[j] + val * vals[j]; \ |
| 1071 | else \ |
| 1072 | xvals[j] = mins[j] + vals[j]; \ |
| 1073 | xvals[j] = pow(xvals[j], gammas[j]); \ |
| 1074 | } \ |
| 1075 | \ |
| 1076 | if (where <= lower) \ |
| 1077 | kv = 0; \ |
| 1078 | else if (where > upper) \ |
| 1079 | kv = where; \ |
| 1080 | else \ |
| 1081 | kv = (where - lower) * upper / (upper - lower); \ |
| 1082 | cmyv = vals[0] * (where - kv); \ |
| 1083 | xvals[0] *= kv; \ |
| 1084 | for (j = 1; j < 4; j++) \ |
| 1085 | xvals[j] += cmyv * levels[j]; \ |
| 1086 | for (j = 0; j < 4; j++) \ |
| 1087 | { \ |
| 1088 | if (xvals[j] > 1) \ |
| 1089 | xvals[j] = 1; \ |
| 1090 | xvals[j] *= global_ink_limit * multiplier; \ |
| 1091 | xvals[j] += 0.9; \ |
| 1092 | } \ |
| 1093 | for (k = 0; k < pixels; k++) \ |
| 1094 | { \ |
| 1095 | switch (global_channel_depth) \ |
| 1096 | { \ |
| 1097 | case 0: \ |
| 1098 | for (j = 0; j < 4; j++) \ |
| 1099 | s_data[j] = xvals[(j + 1) % 4]; \ |
| 1100 | s_data += 4; \ |
| 1101 | break; \ |
| 1102 | case 1: \ |
| 1103 | s_data[0] = xvals[0]; \ |
| 1104 | break; \ |
| 1105 | case 2: \ |
| 1106 | s_data[0] = xvals[0]; \ |
| 1107 | s_data[1] = 0; \ |
| 1108 | break; \ |
| 1109 | case 3: \ |
| 1110 | for (j = 1; j < 4; j++) \ |
| 1111 | s_data[j - 1] = xvals[j]; \ |
| 1112 | break; \ |
| 1113 | case 4: \ |
| 1114 | for (j = 0; j < 4; j++) \ |
| 1115 | s_data[j] = xvals[j]; \ |
| 1116 | break; \ |
| 1117 | case 6: \ |
| 1118 | s_data[0] = xvals[0]; \ |
| 1119 | s_data[1] = xvals[1]; \ |
| 1120 | s_data[2] = 0; \ |
| 1121 | s_data[3] = xvals[2]; \ |
| 1122 | s_data[4] = 0; \ |
| 1123 | s_data[5] = xvals[3]; \ |
| 1124 | break; \ |
| 1125 | case 7: \ |
| 1126 | for (j = 0; j < 4; j++) \ |
| 1127 | s_data[j * 2] = xvals[j]; \ |
| 1128 | for (j = 1; j < 6; j += 2) \ |
| 1129 | s_data[j] = 0; \ |
| 1130 | break; \ |
| 1131 | } \ |
| 1132 | s_data += global_channel_depth; \ |
| 1133 | } \ |
| 1134 | } \ |
| 1135 | } |
| 1136 | |
| 1137 | FILL_COLORS_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:1020:9`!(unsigned short, 16) |
| 1138 | FILL_COLORS_FUNCTIONcxx . . $ `src/testpattern/testpattern.c:1020:9`!(unsigned char, 8) |
| 1139 | |
| 1140 | static void |
| 1141 | fill_colorscxx . . $ fill_colors(b7110f566fb8c408).(unsigned char *data, size_t len, size_t scount, |
| 1142 | testpattern_tcxx . . $ testpattern_t# *p, size_t bytes) |
| 1143 | { |
| 1144 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(global_image_typecxx . . $ global_image_type., "RGB") == 0) |
| 1145 | fill_colors_extendedcxx . . $ fill_colors_extended(b7110f566fb8c408).(data, len, scount, p, bytes); |
| 1146 | else |
| 1147 | { |
| 1148 | switch (bytes) |
| 1149 | { |
| 1150 | case 1: |
| 1151 | fill_colors_8cxx . . $ fill_colors_8(e97314a31eb1c539).(data, len, scount, p); |
| 1152 | break; |
| 1153 | case 2: |
| 1154 | fill_colors_16cxx . . $ fill_colors_16(e97314a31eb1c539).(data, len, scount, p); |
| 1155 | break; |
| 1156 | } |
| 1157 | } |
| 1158 | } |
| 1159 | |
| 1160 | extern FILEcxx . . $ FILE# *yyincxx . . $ yyin.; |
| 1161 | |
| 1162 | static void |
| 1163 | fill_patterncxx . . $ fill_pattern(31d552f4bea0ec7).(testpattern_tcxx . . $ testpattern_t# *p, unsigned char *data, size_t width, |
| 1164 | size_t s_count, size_t image_depth, size_t byte_depth) |
| 1165 | { |
| 1166 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(data, 0, global_printer_widthcxx . . $ global_printer_width. * image_depth * byte_depth); |
| 1167 | switch (p->typecxx . . $ $anonymous_type_790f627673a290a_0#type.) |
| 1168 | { |
| 1169 | case E_PATTERNcxx . . $ $anonymous_type_790f627673a290a_0#E_PATTERN.: |
| 1170 | fill_colorscxx . . $ fill_colors(b7110f566fb8c408).(data, width, s_count, p, byte_depth); |
| 1171 | break; |
| 1172 | case E_XPATTERNcxx . . $ $anonymous_type_790f627673a290a_0#E_XPATTERN.: |
| 1173 | fill_colors_extendedcxx . . $ fill_colors_extended(b7110f566fb8c408).(data, width, s_count, p, byte_depth); |
| 1174 | break; |
| 1175 | case E_GRIDcxx . . $ $anonymous_type_790f627673a290a_0#E_GRID.: |
| 1176 | fill_gridcxx . . $ fill_grid(b7110f566fb8c408).(data, width, s_count, p, byte_depth); |
| 1177 | break; |
| 1178 | default: |
| 1179 | break; |
| 1180 | } |
| 1181 | } |
| 1182 | |
| 1183 | |
| 1184 | static stp_image_status_tcxx . . $ stp_image_status_t# |
| 1185 | Image_get_rowcxx . . $ Image_get_row(c6bbe34ec0bddcf0).(stp_image_tcxx . . $ stp_image_t# *image, unsigned char *data, |
| 1186 | size_t byte_limit, int row) |
| 1187 | { |
| 1188 | (void)image; |
| 1189 | (void)byte_limit; |
| 1190 | int depth = global_channel_depthcxx . . $ global_channel_depth.; |
| 1191 | if (! Image_is_validcxx . . $ Image_is_valid.) |
| 1192 | { |
| 1193 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("Calling Image_get_row with invalid image!\n", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 1194 | abortcxx . . $ abort(8df32a62017fbbf6).(); |
| 1195 | } |
| 1196 | if (static_testpatternscxx . . $ static_testpatterns.[0].typecxx . . $ $anonymous_type_790f627673a290a_0#type. == E_IMAGEcxx . . $ $anonymous_type_790f627673a290a_0#E_IMAGE.) |
| 1197 | { |
| 1198 | testpattern_tcxx . . $ testpattern_t# *t = &(static_testpatternscxx . . $ static_testpatterns.[0]); |
| 1199 | int total_read = freadcxx . . $ fread(738fc8ac1d711e58).(data, 1, t->dcxx . . $ $anonymous_type_790f627673a290a_0#d..imagecxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#image..xcxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_5#x. * depth * global_bit_depthcxx . . $ global_bit_depth. / 8, |
| 1200 | yyincxx . . $ yyin.); |
| 1201 | if (total_read != t->dcxx . . $ $anonymous_type_790f627673a290a_0#d..imagecxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#image..xcxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_5#x. * depth * global_bit_depthcxx . . $ global_bit_depth. / 8) |
| 1202 | { |
| 1203 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("Read failed!\n", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 1204 | return STP_IMAGE_STATUS_ABORTcxx . . $ STP_IMAGE_STATUS_ABORT.; |
| 1205 | } |
| 1206 | if (!global_quietcxx . . $ global_quiet.) |
| 1207 | fputccxx . . $ fputc(b1cd03d6c470d1bd).('.', stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 1208 | } |
| 1209 | else |
| 1210 | { |
| 1211 | static int previous_band = -1; |
| 1212 | static int printed_blackline = 0; |
| 1213 | int band = row / global_band_heightcxx . . $ global_band_height.; |
| 1214 | if (row == global_printer_heightcxx . . $ global_printer_height. - 1 && ! global_noblacklinecxx . . $ global_noblackline.) |
| 1215 | fill_blackcxx . . $ fill_black(5983bf68a24b84b4).(data, global_printer_widthcxx . . $ global_printer_width., global_stepscxx . . $ global_steps., |
| 1216 | global_bit_depthcxx . . $ global_bit_depth. / 8); |
| 1217 | else if (band >= global_n_testpatternscxx . . $ global_n_testpatterns.) |
| 1218 | fill_whitecxx . . $ fill_white(5983bf68a24b84b4).(data, global_printer_widthcxx . . $ global_printer_width., global_stepscxx . . $ global_steps., |
| 1219 | global_bit_depthcxx . . $ global_bit_depth. / 8); |
| 1220 | else |
| 1221 | { |
| 1222 | if (band != previous_band) |
| 1223 | { |
| 1224 | if (! global_noblacklinecxx . . $ global_noblackline. && printed_blackline == 0) |
| 1225 | { |
| 1226 | fill_blackcxx . . $ fill_black(5983bf68a24b84b4).(data, global_printer_widthcxx . . $ global_printer_width., global_stepscxx . . $ global_steps., |
| 1227 | global_bit_depthcxx . . $ global_bit_depth. / 8); |
| 1228 | printed_blackline = 1; |
| 1229 | return STP_IMAGE_STATUS_OKcxx . . $ STP_IMAGE_STATUS_OK.; |
| 1230 | } |
| 1231 | else |
| 1232 | { |
| 1233 | previous_band = band; |
| 1234 | printed_blackline = 0; |
| 1235 | if (! global_quietcxx . . $ global_quiet.) |
| 1236 | fputccxx . . $ fputc(b1cd03d6c470d1bd).('.', stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 1237 | } |
| 1238 | } |
| 1239 | fill_patterncxx . . $ fill_pattern(31d552f4bea0ec7).(&(static_testpatternscxx . . $ static_testpatterns.[band]), data, |
| 1240 | global_printer_widthcxx . . $ global_printer_width., global_stepscxx . . $ global_steps., depth, |
| 1241 | global_bit_depthcxx . . $ global_bit_depth. / 8); |
| 1242 | } |
| 1243 | } |
| 1244 | return STP_IMAGE_STATUS_OKcxx . . $ STP_IMAGE_STATUS_OK.; |
| 1245 | } |
| 1246 | |
| 1247 | static void |
| 1248 | check_valid_imagecxx . . $ check_valid_image(85c52e162fed56f9).(const char *s) |
| 1249 | { |
| 1250 | if (! Image_is_validcxx . . $ Image_is_valid.) |
| 1251 | { |
| 1252 | fputscxx . . $ fputs(874fa6a5e59ab9bd).(s, stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 1253 | abortcxx . . $ abort(8df32a62017fbbf6).(); |
| 1254 | } |
| 1255 | } |
| 1256 | |
| 1257 | static int |
| 1258 | Image_widthcxx . . $ Image_width(ba31fd85910919f2).(stp_image_tcxx . . $ stp_image_t# *image) |
| 1259 | { |
| 1260 | (void)image; |
| 1261 | check_valid_imagecxx . . $ check_valid_image(85c52e162fed56f9).("Calling Image_width with invalid image!\n"); |
| 1262 | if (static_testpatternscxx . . $ static_testpatterns.[0].typecxx . . $ $anonymous_type_790f627673a290a_0#type. == E_IMAGEcxx . . $ $anonymous_type_790f627673a290a_0#E_IMAGE.) |
| 1263 | return static_testpatternscxx . . $ static_testpatterns.[0].dcxx . . $ $anonymous_type_790f627673a290a_0#d..imagecxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#image..xcxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_5#x.; |
| 1264 | else |
| 1265 | return global_printer_widthcxx . . $ global_printer_width.; |
| 1266 | } |
| 1267 | |
| 1268 | static int |
| 1269 | Image_heightcxx . . $ Image_height(ba31fd85910919f2).(stp_image_tcxx . . $ stp_image_t# *image) |
| 1270 | { |
| 1271 | (void)image; |
| 1272 | check_valid_imagecxx . . $ check_valid_image(85c52e162fed56f9).("Calling Image_height with invalid image!\n"); |
| 1273 | if (static_testpatternscxx . . $ static_testpatterns.[0].typecxx . . $ $anonymous_type_790f627673a290a_0#type. == E_IMAGEcxx . . $ $anonymous_type_790f627673a290a_0#E_IMAGE.) |
| 1274 | return static_testpatternscxx . . $ static_testpatterns.[0].dcxx . . $ $anonymous_type_790f627673a290a_0#d..imagecxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#image..ycxx . . $ $anonymous_type_790f627673a290a_0#$anonymous_type_2#$anonymous_type_5#y.; |
| 1275 | else |
| 1276 | return global_printer_heightcxx . . $ global_printer_height.; |
| 1277 | } |
| 1278 | |
| 1279 | static void |
| 1280 | Image_initcxx . . $ Image_init(7010b42a94b47a79).(stp_image_tcxx . . $ stp_image_t# *image) |
| 1281 | { |
| 1282 | (void)image; |
| 1283 | if (Image_is_validcxx . . $ Image_is_valid.) |
| 1284 | { |
| 1285 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("Calling Image_init with already valid image!\n", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 1286 | abortcxx . . $ abort(8df32a62017fbbf6).(); |
| 1287 | } |
| 1288 | Image_is_validcxx . . $ Image_is_valid. = 1; |
| 1289 | /* dummy function */ |
| 1290 | } |
| 1291 | |
| 1292 | static void |
| 1293 | Image_resetcxx . . $ Image_reset(7010b42a94b47a79).(stp_image_tcxx . . $ stp_image_t# *image) |
| 1294 | { |
| 1295 | (void)image; |
| 1296 | check_valid_imagecxx . . $ check_valid_image(85c52e162fed56f9).("Calling Image_reset with invalid image!\n"); |
| 1297 | /* dummy function */ |
| 1298 | } |
| 1299 | |
| 1300 | static void |
| 1301 | Image_concludecxx . . $ Image_conclude(7010b42a94b47a79).(stp_image_tcxx . . $ stp_image_t# *image) |
| 1302 | { |
| 1303 | (void)image; |
| 1304 | check_valid_imagecxx . . $ check_valid_image(85c52e162fed56f9).("Calling Image_conclude with invalid image!\n"); |
| 1305 | Image_is_validcxx . . $ Image_is_valid. = 0; |
| 1306 | } |
| 1307 | |
| 1308 | static const char * |
| 1309 | Image_get_appnamecxx . . $ Image_get_appname(97b8a1c82bcbc822).(stp_image_tcxx . . $ stp_image_t# *image) |
| 1310 | { |
| 1311 | (void)image; |
| 1312 | check_valid_imagecxx . . $ check_valid_image(85c52e162fed56f9).("Calling Image_get_appname with invalid image!\n"); |
| 1313 | return "Test Pattern"; |
| 1314 | } |