Debian Codegraph @

src/main/generic-options.c

raw symbols SCIP
1 /*
2 *
3 * Copyright 2003 Robert Krawitz ([email protected])
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`!
20 #include <config.h>cxx . . $ `<file>/config.h`/
21 #endif
22 #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/
23 #include "gutenprint-internal.h"cxx . . $ `<file>/src/main/gutenprint-internal.h`/
24 #include <gutenprint/gutenprint-intl-internal.h>cxx . . $ `<file>/include/gutenprint/gutenprint-intl-internal.h`/
25 #include "generic-options.h"cxx . . $ `<file>/src/main/generic-options.h`/
26 #include <string.h>
27 #include <limits.h>
28
29 static const stpi_quality_tcxx . . $ stpi_quality_t# standard_qualitiescxx . . $ standard_qualities.[] =
30 {
31 { "FastEconomy", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Fast Economy"), 0 },
32 { "Economy", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Economy"), 1 },
33 { "Draft", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Draft"), 3 },
34 { "Standard", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Standard"), 5 },
35 { "High", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("High"), 6 },
36 { "Photo", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Photo"), 7 },
37 { "HighPhoto", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Super Photo"), 8 },
38 { "UltraPhoto", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Ultra Photo"), 9 },
39 { "Best", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Best"), 10 },
40 };
41
42 static const stpi_image_type_tcxx . . $ stpi_image_type_t# standard_image_typescxx . . $ standard_image_types.[] =
43 {
44 { "Text", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Text") },
45 { "Graphics", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Graphics") },
46 { "TextGraphics", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Mixed Text and Graphics") },
47 { "Photo", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Photograph") },
48 { "LineArt", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Line Art") },
49 };
50
51 static const stpi_job_mode_tcxx . . $ stpi_job_mode_t# standard_job_modescxx . . $ standard_job_modes.[] =
52 {
53 { "Page", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Page") },
54 { "Job", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Job") },
55 };
56
57 static const stp_parameter_tcxx . . $ stp_parameter_t# the_parameterscxx . . $ the_parameters.[] =
58 {
59 {
60 "Quality", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Print Quality"), "Color=Yes,Category=Basic Output Adjustment",
61 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Print Quality"),
62 STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST., STP_PARAMETER_CLASS_FEATUREcxx . . $ STP_PARAMETER_CLASS_FEATURE.,
63 STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC., 1, 1, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 0, 0
64 },
65 {
66 "ImageType", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Image Type"), "Color=Yes,Category=Basic Image Adjustment",
67 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Type of image being printed"),
68 STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST., STP_PARAMETER_CLASS_OUTPUTcxx . . $ STP_PARAMETER_CLASS_OUTPUT.,
69 STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC., 1, 1, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 0, 0
70 },
71 {
72 "JobMode", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Job Mode"), "Color=No,Category=Job Mode",
73 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Job vs. page mode"),
74 STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST., STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.,
75 STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC., 1, 1, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 0, 0
76 },
77 {
78 "PageNumber", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Page Number"), "Color=No,Category=Job Mode",
79 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Page number"),
80 STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT., STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.,
81 STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC., 1, 1, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 1, 0
82 },
83 {
84 "NumCopies", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Number of Copies"), "Color=No,Category=Job Mode",
85 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Number of Copies"),
86 STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT., STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.,
87 STP_PARAMETER_LEVEL_INTERNALcxx . . $ STP_PARAMETER_LEVEL_INTERNAL., 1, 0, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 1, 0
88 },
89 {
90 "Collate", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Collate the Job"), "Color=No,Category=Job Mode",
91 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Collate the Job"),
92 STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN., STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.,
93 STP_PARAMETER_LEVEL_INTERNALcxx . . $ STP_PARAMETER_LEVEL_INTERNAL., 1, 0, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 1, 0
94 },
95 };
96
97 static const int the_parameter_countcxx . . $ the_parameter_count. =
98 sizeof(the_parameterscxx . . $ the_parameters.) / sizeof(const stp_parameter_tcxx . . $ stp_parameter_t#);
99
100 int
101 stpi_get_qualities_countcxx . . $ stpi_get_qualities_count(b126dc7c1de90089).(void)
102 {
103 return sizeof(standard_qualitiescxx . . $ standard_qualities.) / sizeof(stpi_quality_tcxx . . $ stpi_quality_t#);
104 }
105
106 const stpi_quality_tcxx . . $ stpi_quality_t# *
107 stpi_get_quality_by_indexcxx . . $ stpi_get_quality_by_index(ce796fe7f8a55f56).(int idx)
108 {
109 if (idx < 0 || idx >= stpi_get_qualities_countcxx . . $ stpi_get_qualities_count(b126dc7c1de90089).())
110 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
111 else
112 return &(standard_qualitiescxx . . $ standard_qualities.[idx]);
113 }
114
115 const stpi_quality_tcxx . . $ stpi_quality_t# *
116 stpi_get_quality_by_namecxx . . $ stpi_get_quality_by_name(7488809c3e549f62).(const char *quality)
117 {
118 int i;
119 if (!quality)
120 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
121 for (i = 0; i < stpi_get_qualities_countcxx . . $ stpi_get_qualities_count(b126dc7c1de90089).(); i++)
122 {
123 const stpi_quality_tcxx . . $ stpi_quality_t# *qual = stpi_get_quality_by_indexcxx . . $ stpi_get_quality_by_index(ce796fe7f8a55f56).(i);
124 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(quality, qual->namecxx . . $ $anonymous_type_73fe19d713e4464d_0#name.) == 0)
125 return qual;
126 }
127 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
128 }
129
130 int
131 stpi_get_image_types_countcxx . . $ stpi_get_image_types_count(b126dc7c1de90089).(void)
132 {
133 return sizeof(standard_image_typescxx . . $ standard_image_types.) / sizeof(stpi_image_type_tcxx . . $ stpi_image_type_t#);
134 }
135
136 const stpi_image_type_tcxx . . $ stpi_image_type_t# *
137 stpi_get_image_type_by_indexcxx . . $ stpi_get_image_type_by_index(72d6e5f55e9fdedb).(int idx)
138 {
139 if (idx < 0 || idx >= stpi_get_image_types_countcxx . . $ stpi_get_image_types_count(b126dc7c1de90089).())
140 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
141 else
142 return &(standard_image_typescxx . . $ standard_image_types.[idx]);
143 }
144
145 const stpi_image_type_tcxx . . $ stpi_image_type_t# *
146 stpi_get_image_type_by_namecxx . . $ stpi_get_image_type_by_name(76867d7128efc084).(const char *image_type)
147 {
148 int i;
149 if (!image_type)
150 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
151 for (i = 0; i < stpi_get_image_types_countcxx . . $ stpi_get_image_types_count(b126dc7c1de90089).(); i++)
152 {
153 const stpi_image_type_tcxx . . $ stpi_image_type_t# *itype = stpi_get_image_type_by_indexcxx . . $ stpi_get_image_type_by_index(72d6e5f55e9fdedb).(i);
154 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(image_type, itype->namecxx . . $ $anonymous_type_73fe19d713e4464d_1#name.) == 0)
155 return itype;
156 }
157 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
158 }
159
160 int
161 stpi_get_job_modes_countcxx . . $ stpi_get_job_modes_count(b126dc7c1de90089).(void)
162 {
163 return sizeof(standard_job_modescxx . . $ standard_job_modes.) / sizeof(stpi_job_mode_tcxx . . $ stpi_job_mode_t#);
164 }
165
166 const stpi_job_mode_tcxx . . $ stpi_job_mode_t# *
167 stpi_get_job_mode_by_indexcxx . . $ stpi_get_job_mode_by_index(8f564364d1ac100c).(int idx)
168 {
169 if (idx < 0 || idx >= stpi_get_job_modes_countcxx . . $ stpi_get_job_modes_count(b126dc7c1de90089).())
170 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
171 else
172 return &(standard_job_modescxx . . $ standard_job_modes.[idx]);
173 }
174
175 const stpi_job_mode_tcxx . . $ stpi_job_mode_t# *
176 stpi_get_job_mode_by_namecxx . . $ stpi_get_job_mode_by_name(445f27ca277f0058).(const char *job_mode)
177 {
178 int i;
179 if (!job_mode)
180 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
181 for (i = 0; i < stpi_get_job_modes_countcxx . . $ stpi_get_job_modes_count(b126dc7c1de90089).(); i++)
182 {
183 const stpi_job_mode_tcxx . . $ stpi_job_mode_t# *itype = stpi_get_job_mode_by_indexcxx . . $ stpi_get_job_mode_by_index(8f564364d1ac100c).(i);
184 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(job_mode, itype->namecxx . . $ $anonymous_type_73fe19d713e4464d_2#name.) == 0)
185 return itype;
186 }
187 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
188 }
189
190 stp_parameter_list_tcxx . . $ stp_parameter_list_t#
191 stp_list_generic_parameterscxx . . $ stp_list_generic_parameters(817585d40f809196).(const stp_vars_tcxx . . $ stp_vars_t# *v)
192 {
193 stp_parameter_list_tcxx . . $ stp_parameter_list_t# *ret = stp_parameter_list_createcxx . . $ stp_parameter_list_create(50c7df7de5344ebb).();
194 int i;
195 (void)v;
196 for (i = 0; i < the_parameter_countcxx . . $ the_parameter_count.; i++)
197 stp_parameter_list_add_paramcxx . . $ stp_parameter_list_add_param(9dab94dbd10bbd1f).(ret, &(the_parameterscxx . . $ the_parameters.[i]));
198 return ret;
199 }
200
201 void
202 stpi_describe_generic_parametercxx . . $ stpi_describe_generic_parameter(dfd5b9531b51a6d2).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name,
203 stp_parameter_tcxx . . $ stp_parameter_t# *description)
204 {
205 int i;
206 (void)v;
207
208 description->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. = STP_PARAMETER_TYPE_INVALIDcxx . . $ STP_PARAMETER_TYPE_INVALID.;
209 if (name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
210 return;
211
212 for (i = 0; i < the_parameter_countcxx . . $ the_parameter_count.; i++)
213 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, the_parameterscxx . . $ the_parameters.[i].namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) == 0)
214 {
215 stp_fill_parameter_settingscxx . . $ stp_fill_parameter_settings(bb1f9d668495a4b4).(description, &(the_parameterscxx . . $ the_parameters.[i]));
216 break;
217 }
218
219 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
220
221 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "Quality") == 0)
222 {
223 #if 0
224 description->bounds.str = stp_string_list_create();
225 stp_string_list_add_string(description->bounds.str, "None",
226 _("Manual Control"));
227 for (i = 0; i < stpi_get_qualities_count(); i++)
228 {
229 const stpi_quality_t *qual = stpi_get_quality_by_index(i);
230 stp_string_list_add_string(description->bounds.str, qual->name,
231 gettext(qual->text));
232 }
233 description->deflt.str = "Standard";
234 #else
235 description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str. = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).();
236 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 0;
237 #endif
238 }
239 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "ImageType") == 0)
240 {
241 description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str. = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).();
242 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "None",
243 _cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:58:11`!("Manual Control"));
244 for (i = 0; i < stpi_get_image_types_countcxx . . $ stpi_get_image_types_count(b126dc7c1de90089).(); i++)
245 {
246 const stpi_image_type_tcxx . . $ stpi_image_type_t# *itype = stpi_get_image_type_by_indexcxx . . $ stpi_get_image_type_by_index(72d6e5f55e9fdedb).(i);
247 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., itype->namecxx . . $ $anonymous_type_73fe19d713e4464d_1#name.,
248 gettextcxx . . $ `include/gutenprint/gutenprint-intl-internal.h:61:11`!(itype->text));
249 }
250 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. = "TextGraphics";
251 }
252 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "JobMode") == 0)
253 {
254 description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str. = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).();
255 for (i = 0; i < stpi_get_job_modes_countcxx . . $ stpi_get_job_modes_count(b126dc7c1de90089).(); i++)
256 {
257 const stpi_job_mode_tcxx . . $ stpi_job_mode_t# *itype = stpi_get_job_mode_by_indexcxx . . $ stpi_get_job_mode_by_index(8f564364d1ac100c).(i);
258 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., itype->namecxx . . $ $anonymous_type_73fe19d713e4464d_2#name.,
259 gettextcxx . . $ `include/gutenprint/gutenprint-intl-internal.h:61:11`!(itype->text));
260 }
261 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. = "Page";
262 }
263 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "PageNumber") == 0)
264 {
265 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer. = 0;
266 description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..lowercxx . . $ $anonymous_type_c987533f3b833c82_6#lower. = 0;
267 description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..uppercxx . . $ $anonymous_type_c987533f3b833c82_6#upper. = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!;
268 }
269 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "NumCopies") == 0)
270 {
271 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer. = 1;
272 description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..lowercxx . . $ $anonymous_type_c987533f3b833c82_6#lower. = 1;
273 description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..uppercxx . . $ $anonymous_type_c987533f3b833c82_6#upper. = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!;
274 }
275 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "Collate") == 0)
276 {
277 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..booleancxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#boolean. = 0;
278 }
279 }