Debian Codegraph @

src/testpattern/printer_options.c

raw symbols SCIP
1 /*
2 *
3 * Dump the per-printer options for Gutenprint
4 *
5 * Copyright 2000-2018 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 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`!
22 #include <config.h>cxx . . $ `<file>/config.h`/
23 #endif
24 #include <stdio.h>
25 #include <string.h>
26 #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/
27 #include <gutenprint/gutenprint-intl.h>cxx . . $ `<file>/include/gutenprint/gutenprint-intl.h`/
28
29 int
30 maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv)
31 {
32 int i;
33 size_tcxx . . $ size_t# j, k;
34 int first_arg = 1;
35 stp_string_list_tcxx . . $ stp_string_list_t# *printer_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
36 stp_parameter_level_tcxx . . $ stp_parameter_level_t# max_level = STP_PARAMETER_LEVEL_ADVANCED4cxx . . $ STP_PARAMETER_LEVEL_ADVANCED4.;
37 if (argc > 1 && !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[1], "-s"))
38 {
39 max_level = STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC.;
40 first_arg++;
41 }
42
43 stp_initcxx . . $ stp_init(b126dc7c1de90089).();
44
45 if (argc > first_arg)
46 {
47 printer_list = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).();
48 for (i = 1; i < argc; i++)
49 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(printer_list, argv[i], argv[i]);
50 }
51 for (i = 0; i < stp_printer_model_countcxx . . $ stp_printer_model_count(b126dc7c1de90089).(); i++)
52 {
53 stp_parameter_list_tcxx . . $ stp_parameter_list_t# params;
54 unsigned int nparams;
55 stp_parameter_tcxx . . $ stp_parameter_t# desc;
56 const stp_printer_tcxx . . $ stp_printer_t# *printer = stp_get_printer_by_indexcxx . . $ stp_get_printer_by_index(2036101347f379c).(i);
57 const char *driver = stp_printer_get_drivercxx . . $ stp_printer_get_driver(b5d6ef9de7e317aa).(printer);
58 const char *family = stp_printer_get_familycxx . . $ stp_printer_get_family(b5d6ef9de7e317aa).(printer);
59 stp_vars_tcxx . . $ stp_vars_t# *pv;
60 int tcount = 0;
61 size_tcxx . . $ size_t# count;
62 int printer_is_color = 0;
63 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(family, "ps") == 0 || strcmpcxx . . $ strcmp(5ae29d726ae57f88).(family, "raw") == 0)
64 continue;
65 if (printer_list && !stp_string_list_is_presentcxx . . $ stp_string_list_is_present(bf726c32497cc2b).(printer_list, driver))
66 continue;
67
68 pv = stp_vars_create_copycxx . . $ stp_vars_create_copy(d6c73ebbfa1de3f9).(stp_printer_get_defaultscxx . . $ stp_printer_get_defaults(961f21647a798a4c).(printer));
69 /* Set Job Mode to "Job" as this enables the Duplex option */
70 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(pv, "JobMode", "Job");
71
72 stp_describe_parametercxx . . $ stp_describe_parameter(dfd5b9531b51a6d2).(pv, "PrintingMode", &desc);
73 if (stp_string_list_is_presentcxx . . $ stp_string_list_is_present(bf726c32497cc2b).(desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "Color"))
74 printer_is_color = 1;
75 stp_parameter_description_destroycxx . . $ stp_parameter_description_destroy(6259b4d9050bb586).(&desc);
76 if (printer_is_color)
77 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(pv, "PrintingMode", "Color");
78 else
79 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(pv, "PrintingMode", "BW");
80 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(pv, "ChannelBitDepth", "8");
81
82 printfcxx . . $ printf(581fddd72a8db8fc).("# Printer model %s, long name `%s'\n", driver,
83 stp_printer_get_long_namecxx . . $ stp_printer_get_long_name(b5d6ef9de7e317aa).(printer));
84
85 printfcxx . . $ printf(581fddd72a8db8fc).("$families{'%s'} = '%s';\n", driver, family);
86 printfcxx . . $ printf(581fddd72a8db8fc).("$models{'%s'} = '%d';\n", driver, stp_get_model_idcxx . . $ stp_get_model_id(b1be75487ade2f93).(pv));
87
88 params = stp_get_parameter_listcxx . . $ stp_get_parameter_list(817585d40f809196).(pv);
89 nparams = stp_parameter_list_countcxx . . $ stp_parameter_list_count(2e8e543e1193434e).(params);
90
91 for (k = 0; k < nparams; k++)
92 {
93 const stp_parameter_tcxx . . $ stp_parameter_t# *p = stp_parameter_list_paramcxx . . $ stp_parameter_list_param(f24b23997c12c6a6).(params, k);
94 if (p->read_onlycxx . . $ $anonymous_type_c987533f3b833c82_8#read_only. ||
95 (p->p_levelcxx . . $ $anonymous_type_c987533f3b833c82_8#p_level. > max_level && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., "Resolution") != 0) ||
96 (p->p_classcxx . . $ $anonymous_type_c987533f3b833c82_8#p_class. != STP_PARAMETER_CLASS_OUTPUTcxx . . $ STP_PARAMETER_CLASS_OUTPUT. &&
97 p->p_classcxx . . $ $anonymous_type_c987533f3b833c82_8#p_class. != STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE. &&
98 p->p_classcxx . . $ $anonymous_type_c987533f3b833c82_8#p_class. != STP_PARAMETER_CLASS_FEATUREcxx . . $ STP_PARAMETER_CLASS_FEATURE.))
99 continue;
100 count = 0;
101 stp_describe_parametercxx . . $ stp_describe_parameter(dfd5b9531b51a6d2).(pv, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., &desc);
102 if (desc.is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active.)
103 {
104 if (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.)
105 {
106 count = stp_string_list_countcxx . . $ stp_string_list_count(53b7214102d1daf6).(desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str.);
107 if (count > 0)
108 {
109 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., "Resolution") == 0)
110 {
111 for (j = 0; j < count; j++)
112 {
113 const stp_param_string_tcxx . . $ stp_param_string_t# *param =
114 stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., j);
115 stp_resolution_tcxx . . $ stp_resolution_t# x, y;
116 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(pv, "Resolution",
117 param->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.);
118 stp_describe_resolutioncxx . . $ stp_describe_resolution(5883f070c6139f40).(pv, &x, &y);
119 if (x > 0 && y > 0)
120 printfcxx . . $ printf(581fddd72a8db8fc).("$resolutions{'%s'}{'%s'} = [%d, %d];\n",
121 driver, param->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name., (int) x, (int) y);
122 }
123 stp_clear_string_parametercxx . . $ stp_clear_string_parameter(f1526d77388867f8).(pv, "Resolution");
124 }
125 else
126 {
127 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., "PageSize") == 0)
128 {
129 stp_dimension_tcxx . . $ stp_dimension_t# min_area = 7200 * 7200;
130 stp_dimension_tcxx . . $ stp_dimension_t# max_area = 0;
131 const char *min_size_name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
132 const char *max_size_name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
133 for (j = 0; j < count; j++)
134 {
135 const stp_param_string_tcxx . . $ stp_param_string_t# *param =
136 stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., j);
137 const stp_papersize_tcxx . . $ stp_papersize_t# *ps =
138 stp_describe_papersizecxx . . $ stp_describe_papersize(977e5bf217e59ec).(pv, param->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.);
139 if (ps->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. > 0 && ps->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height. > 0 &&
140 (ps->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. * ps->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height.) < min_area)
141 {
142 min_area = ps->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. * ps->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height.;
143 min_size_name = param->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.;
144 }
145 if (ps->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. > 0 && ps->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height. > 0 &&
146 (ps->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. * ps->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height.) > max_area)
147 {
148 max_area = ps->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. * ps->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height.;
149 max_size_name = param->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.;
150 }
151 }
152 if (min_size_name)
153 {
154 printfcxx . . $ printf(581fddd72a8db8fc).("$min_page_size{'%s'} = '%s';\n",
155 driver, min_size_name);
156 printfcxx . . $ printf(581fddd72a8db8fc).("$max_page_size{'%s'} = '%s';\n",
157 driver, max_size_name);
158 }
159 }
160 printfcxx . . $ printf(581fddd72a8db8fc).("$stpdata{'%s'}{'%s'} = [qw(", driver, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.);
161 if (!desc.is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory. && !
162 stp_string_list_is_presentcxx . . $ stp_string_list_is_present(bf726c32497cc2b).(desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "None"))
163 fputscxx . . $ fputs(874fa6a5e59ab9bd).("+None ", stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!);
164 for (j = 0; j < count; j++)
165 {
166 const stp_param_string_tcxx . . $ stp_param_string_t# *param =
167 stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., j);
168 printfcxx . . $ printf(581fddd72a8db8fc).("%s%s ",
169 (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str., param->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.)) ? "" : "+",
170 param->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.);
171 }
172 fputscxx . . $ fputs(874fa6a5e59ab9bd).(")];\n", stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!);
173 }
174 }
175 }
176 else if (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN.)
177 {
178 if (desc.is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory.)
179 printfcxx . . $ printf(581fddd72a8db8fc).("$stp_bools{'%s'}{'%s'} = %d;\n",
180 driver, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..booleancxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#boolean.);
181 else
182 printfcxx . . $ printf(581fddd72a8db8fc).("$stp_bools{'%s'}{'%s'} = %d;\n",
183 driver, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., -1);
184 }
185 else if (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_DOUBLEcxx . . $ STP_PARAMETER_TYPE_DOUBLE.)
186 {
187 if (desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..lowercxx . . $ $anonymous_type_c987533f3b833c82_5#lower. <= desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl. &&
188 desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..uppercxx . . $ $anonymous_type_c987533f3b833c82_5#upper. >= desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl.)
189 printfcxx . . $ printf(581fddd72a8db8fc).("$stp_float_values{'%s'}{'%s'} = [%d, %.3f, %.3f, %.3f];\n",
190 driver, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., desc.is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory.,
191 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl., desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..lowercxx . . $ $anonymous_type_c987533f3b833c82_5#lower.,
192 desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..uppercxx . . $ $anonymous_type_c987533f3b833c82_5#upper.);
193 }
194 else if (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT.)
195 {
196 if (desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..lowercxx . . $ $anonymous_type_c987533f3b833c82_6#lower. <= desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer. &&
197 desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..uppercxx . . $ $anonymous_type_c987533f3b833c82_6#upper. >= desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer.)
198 printfcxx . . $ printf(581fddd72a8db8fc).("$stp_int_values{'%s'}{'%s'} = [%d, %d, %d, %d];\n",
199 driver, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., desc.is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory.,
200 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer., desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..lowercxx . . $ $anonymous_type_c987533f3b833c82_6#lower.,
201 desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..uppercxx . . $ $anonymous_type_c987533f3b833c82_6#upper.);
202 }
203 else if (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. == STP_PARAMETER_TYPE_DIMENSIONcxx . . $ STP_PARAMETER_TYPE_DIMENSION.)
204 {
205 if (desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..lowercxx . . $ $anonymous_type_c987533f3b833c82_7#lower. <= desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension. &&
206 desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..uppercxx . . $ $anonymous_type_c987533f3b833c82_7#upper. >= desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension.)
207 printfcxx . . $ printf(581fddd72a8db8fc).("$stp_dimension_values{'%s'}{'%s'} = [%d, %.3f, %.3f, %.3f];\n",
208 driver, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., desc.is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory.,
209 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension., desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..lowercxx . . $ $anonymous_type_c987533f3b833c82_7#lower.,
210 desc.boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..uppercxx . . $ $anonymous_type_c987533f3b833c82_7#upper.);
211 }
212 tcount += count;
213 }
214 stp_parameter_description_destroycxx . . $ stp_parameter_description_destroy(6259b4d9050bb586).(&desc);
215 }
216 stp_parameter_list_destroycxx . . $ stp_parameter_list_destroy(5d22bdacc48458e8).(params);
217 if (tcount > 0)
218 {
219 printfcxx . . $ printf(581fddd72a8db8fc).("$stpdata{'%s'}{'Color'} = [qw(", driver);
220 if (printer_is_color)
221 fputscxx . . $ fputs(874fa6a5e59ab9bd).("Color RawCMYK ", stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!);
222 fputscxx . . $ fputs(874fa6a5e59ab9bd).("Grayscale BlackAndWhite)];\n", stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!);
223 }
224 stp_vars_destroycxx . . $ stp_vars_destroy(1a97b8462f9f913c).(pv);
225 }
226 if (printer_list)
227 stp_string_list_destroycxx . . $ stp_string_list_destroy(73d8582195bcdbb3).(printer_list);
228 return 0;
229 }