Debian Codegraph @

src/main/print-ps.c

raw symbols SCIP
1 /*
2 *
3 * Print plug-in Adobe PostScript driver for the GIMP.
4 *
5 * Copyright 1997-2002 Michael Sweet ([email protected]) and
6 * Robert Krawitz ([email protected])
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 /*
23 * This file must include only standard C header files. The core code must
24 * compile on generic platforms that don't support glib, gimp, gtk, etc.
25 */
26
27 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
28 #include <config.h>cxx . . $ `<file>/config.h`/
29 #endif
30 #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/
31 #include <gutenprint/gutenprint-intl-internal.h>cxx . . $ `<file>/include/gutenprint/gutenprint-intl-internal.h`/
32 #include "gutenprint-internal.h"cxx . . $ `<file>/src/main/gutenprint-internal.h`/
33 #include <time.h>
34 #include <string.h>
35 #include <math.h>
36 #ifdef HAVE_LIMITS_Hcxx . . $ `config.h:94:9`!
37 #include <limits.h>
38 #endif
39 #include <stdio.h>
40 #include <unistd.h>
41 #include <strings.h>
42 #include "xmlppd.h"cxx . . $ `<file>/src/main/xmlppd.h`/
43
44 #ifdef _MSC_VER
45 #define strncasecmp(s,t,n) _strnicmp(s,t,n)
46 #define strcasecmp(s,t) _stricmp(s,t)
47 #endif
48
49 /*
50 * Local variables...
51 */
52
53 static char *m_ppd_filecxx . . $ m_ppd_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
54 static stp_mxml_node_tcxx . . $ stp_mxml_node_t# *m_ppdcxx . . $ m_ppd. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
55
56
57 /*
58 * Local functions...
59 */
60
61 static void ps_hexcxx . . $ ps_hex(7495ad52598bc6d2).(const stp_vars_tcxx . . $ stp_vars_t# *, unsigned short *, int);
62 static void ps_ascii85cxx . . $ ps_ascii85(314bda581488b0fb).(const stp_vars_tcxx . . $ stp_vars_t# *, unsigned short *, int, int);
63
64 static const stp_parameter_tcxx . . $ stp_parameter_t# the_parameterscxx . . $ the_parameters.[] =
65 {
66 {
67 "PPDFile", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("PPDFile"), "Color=Yes,Category=Basic Printer Setup",
68 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("PPD File"),
69 STP_PARAMETER_TYPE_FILEcxx . . $ STP_PARAMETER_TYPE_FILE., STP_PARAMETER_CLASS_FEATUREcxx . . $ STP_PARAMETER_CLASS_FEATURE.,
70 STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC., 1, 1, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 1, 0
71 },
72 {
73 "PageSize", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Page Size"), "Color=No,Category=Basic Printer Setup",
74 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Size of the paper being printed to"),
75 STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST., STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.,
76 STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC., 1, 1, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 1, 0
77 },
78 {
79 "ModelName", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Model Name"), "Color=Yes,Category=Basic Printer Setup",
80 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("PPD File Model Name"),
81 STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST., STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.,
82 STP_PARAMETER_LEVEL_INTERNALcxx . . $ STP_PARAMETER_LEVEL_INTERNAL., 0, 0, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 0, 0
83 },
84 {
85 "PrintingMode", N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Printing Mode"), "Color=Yes,Category=Core Parameter",
86 N_cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:67:17`!("Printing Output Mode"),
87 STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST., STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.,
88 STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC., 1, 1, STP_CHANNEL_NONEcxx . . $ `include/gutenprint/vars.h:154:9`!, 1, 0
89 },
90 };
91
92 static const int the_parameter_countcxx . . $ the_parameter_count. =
93 sizeof(the_parameterscxx . . $ the_parameters.) / sizeof(const stp_parameter_tcxx . . $ stp_parameter_t#);
94
95 static int
96 ps_option_to_paramcxx . . $ ps_option_to_param(907fb578f6a9015c).(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_parameter_tcxx . . $ stp_parameter_t# *param,
97 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *option)
98 {
99 const char *group_text = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "grouptext");
100
101 if (group_text != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
102 param->categorycxx . . $ $anonymous_type_c987533f3b833c82_8#category. = group_text;
103 else
104 param->categorycxx . . $ $anonymous_type_c987533f3b833c82_8#category. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
105
106 param->textcxx . . $ $anonymous_type_c987533f3b833c82_8#text. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "text");
107 param->helpcxx . . $ $anonymous_type_c987533f3b833c82_8#help. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "text");
108 if (stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stptype"))
109 {
110 const char *default_value = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "default");
111 double stp_default_value = strtodcxx . . $ strtod(3dfe5620a0d3160e).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stpdefault"), 0);
112 double lower_bound = strtodcxx . . $ strtod(3dfe5620a0d3160e).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stplower"), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
113 double upper_bound = strtodcxx . . $ strtod(3dfe5620a0d3160e).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stpupper"), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
114 param->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stptype"));
115 param->is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory. = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stpmandatory"));
116 param->p_classcxx . . $ $anonymous_type_c987533f3b833c82_8#p_class. = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stpclass"));
117 param->p_levelcxx . . $ $anonymous_type_c987533f3b833c82_8#p_level. = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stplevel"));
118 param->channelcxx . . $ $anonymous_type_c987533f3b833c82_8#channel. = (unsigned char) atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stpchannel"));
119 param->read_onlycxx . . $ $anonymous_type_c987533f3b833c82_8#read_only. = 0;
120 param->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 1;
121 param->verify_this_parametercxx . . $ $anonymous_type_c987533f3b833c82_8#verify_this_parameter. = 1;
122 param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "stpname");
123 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v,
124 "Gutenprint parameter %s type %d mandatory %d class %d level %d channel %d default %s %f",
125 param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., param->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type., param->is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory.,
126 param->p_classcxx . . $ $anonymous_type_c987533f3b833c82_8#p_class., param->p_levelcxx . . $ $anonymous_type_c987533f3b833c82_8#p_level., param->channelcxx . . $ $anonymous_type_c987533f3b833c82_8#channel.,
127 default_value, stp_default_value);
128 switch (param->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type.)
129 {
130 case STP_PARAMETER_TYPE_DOUBLEcxx . . $ STP_PARAMETER_TYPE_DOUBLE.:
131 param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl. = stp_default_value;
132 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..uppercxx . . $ $anonymous_type_c987533f3b833c82_5#upper. = upper_bound;
133 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..lowercxx . . $ $anonymous_type_c987533f3b833c82_5#lower. = lower_bound;
134 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, " %.3f %.3f %.3f\n",
135 param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl., param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..uppercxx . . $ $anonymous_type_c987533f3b833c82_5#upper.,
136 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dbl..lowercxx . . $ $anonymous_type_c987533f3b833c82_5#lower.);
137 break;
138 case STP_PARAMETER_TYPE_DIMENSIONcxx . . $ STP_PARAMETER_TYPE_DIMENSION.:
139 param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension. = atoicxx . . $ atoi(5c4306d8553b3696).(default_value);
140 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..uppercxx . . $ $anonymous_type_c987533f3b833c82_7#upper. = (stp_dimension_tcxx . . $ stp_dimension_t#) upper_bound;
141 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..lowercxx . . $ $anonymous_type_c987533f3b833c82_7#lower. = (stp_dimension_tcxx . . $ stp_dimension_t#) lower_bound;
142 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, " %f %f %f\n",
143 param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension., param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..uppercxx . . $ $anonymous_type_c987533f3b833c82_7#upper.,
144 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#dimension..lowercxx . . $ $anonymous_type_c987533f3b833c82_7#lower.);
145 break;
146 case STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT.:
147 param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer. = atoicxx . . $ atoi(5c4306d8553b3696).(default_value);
148 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..uppercxx . . $ $anonymous_type_c987533f3b833c82_6#upper. = (int) upper_bound;
149 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..lowercxx . . $ $anonymous_type_c987533f3b833c82_6#lower. = (int) lower_bound;
150 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, " %d %d %d\n",
151 param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer., param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..uppercxx . . $ $anonymous_type_c987533f3b833c82_6#upper.,
152 param->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#integer..lowercxx . . $ $anonymous_type_c987533f3b833c82_6#lower.);
153 break;
154 case STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN.:
155 param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..booleancxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#boolean. = strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(default_value, "true") == 0 ? 1 : 0;
156 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, " %d\n", param->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..booleancxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#boolean.);
157 break;
158 default:
159 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "\n");
160 break;
161 }
162 }
163 else
164 {
165 const char *ui = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "ui");
166 param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "name");
167 if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(ui, "Boolean") == 0)
168 param->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. = STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN.;
169 else
170 param->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. = STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.;
171 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., "PageSize") == 0)
172 param->p_classcxx . . $ $anonymous_type_c987533f3b833c82_8#p_class. = STP_PARAMETER_CLASS_COREcxx . . $ STP_PARAMETER_CLASS_CORE.;
173 else
174 param->p_classcxx . . $ $anonymous_type_c987533f3b833c82_8#p_class. = STP_PARAMETER_CLASS_FEATUREcxx . . $ STP_PARAMETER_CLASS_FEATURE.;
175 param->p_levelcxx . . $ $anonymous_type_c987533f3b833c82_8#p_level. = STP_PARAMETER_LEVEL_BASICcxx . . $ STP_PARAMETER_LEVEL_BASIC.;
176 param->is_mandatorycxx . . $ $anonymous_type_c987533f3b833c82_8#is_mandatory. = 1;
177 param->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 1;
178 param->channelcxx . . $ $anonymous_type_c987533f3b833c82_8#channel. = -1;
179 param->verify_this_parametercxx . . $ $anonymous_type_c987533f3b833c82_8#verify_this_parameter. = 1;
180 param->read_onlycxx . . $ $anonymous_type_c987533f3b833c82_8#read_only. = 0;
181 }
182
183 return 0;
184 }
185
186 /*
187 * 'ps_parameters()' - Return the parameter values for the given parameter.
188 */
189
190 static int
191 ppd_whitespace_callbackcxx . . $ ppd_whitespace_callback(90e46f0b0341a80e).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, int where)
192 {
193 (void)node;
194 (void)where;
195 return 0;
196 }
197
198 static int
199 check_ppd_filecxx . . $ check_ppd_file(b1be75487ade2f93).(const stp_vars_tcxx . . $ stp_vars_t# *v)
200 {
201 const char *ppd_file = stp_get_file_parametercxx . . $ stp_get_file_parameter(3e3ce5d385745545).(v, "PPDFile");
202
203 if (ppd_file == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || ppd_file[0] == 0)
204 {
205 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Empty PPD file\n");
206 return 0;
207 }
208 else if (m_ppd_filecxx . . $ m_ppd_file. && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(m_ppd_filecxx . . $ m_ppd_file., ppd_file) == 0)
209 {
210 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Not replacing PPD file %s\n", m_ppd_filecxx . . $ m_ppd_file.);
211 return 1;
212 }
213 else
214 {
215 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Replacing PPD file %s with %s\n",
216 m_ppd_filecxx . . $ m_ppd_file. ? m_ppd_filecxx . . $ m_ppd_file. : "(null)",
217 ppd_file ? ppd_file : "(null)");
218 if (m_ppdcxx . . $ m_ppd. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
219 stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(m_ppdcxx . . $ m_ppd.);
220 m_ppdcxx . . $ m_ppd. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
221
222 if (m_ppd_filecxx . . $ m_ppd_file.)
223 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(m_ppd_filecxx . . $ m_ppd_file.);
224 m_ppd_filecxx . . $ m_ppd_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
225
226 if ((m_ppdcxx . . $ m_ppd. = stpi_xmlppd_read_ppd_filecxx . . $ stpi_xmlppd_read_ppd_file(bf16e72c8c0a696c).(ppd_file)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
227 {
228 stp_eprintfcxx . . $ stp_eprintf(7aef7aa9b820d38).(v, "Unable to open PPD file %s\n", ppd_file);
229 return 0;
230 }
231 if (stp_get_debug_levelcxx . . $ stp_get_debug_level(f708dce9a8856c70).() & STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!)
232 {
233 char *ppd_stuff = stp_mxmlSaveAllocStringcxx . . $ stp_mxmlSaveAllocString(a1f48baf55c04762).(m_ppdcxx . . $ m_ppd., ppd_whitespace_callbackcxx . . $ ppd_whitespace_callback(90e46f0b0341a80e).);
234 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "%s", ppd_stuff);
235 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(ppd_stuff);
236 }
237
238 m_ppd_filecxx . . $ m_ppd_file. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(ppd_file);
239 return 1;
240 }
241 }
242
243
244 static stp_parameter_list_tcxx . . $ stp_parameter_list_t#
245 ps_list_parameterscxx . . $ ps_list_parameters(817585d40f809196).(const stp_vars_tcxx . . $ stp_vars_t# *v)
246 {
247 stp_parameter_list_tcxx . . $ stp_parameter_list_t# *ret = stp_parameter_list_createcxx . . $ stp_parameter_list_create(50c7df7de5344ebb).();
248 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *option;
249 int i;
250 int status = check_ppd_filecxx . . $ check_ppd_file(b1be75487ade2f93).(v);
251 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Adding parameters from %s (%d)\n",
252 m_ppd_filecxx . . $ m_ppd_file. ? m_ppd_filecxx . . $ m_ppd_file. : "(null)", status);
253
254 for (i = 0; i < the_parameter_countcxx . . $ the_parameter_count.; i++)
255 stp_parameter_list_add_paramcxx . . $ stp_parameter_list_add_param(9dab94dbd10bbd1f).(ret, &(the_parameterscxx . . $ the_parameters.[i]));
256
257 if (status)
258 {
259 int num_options = stpi_xmlppd_find_option_countcxx . . $ stpi_xmlppd_find_option_count(9003748477915f72).(m_ppdcxx . . $ m_ppd.);
260 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Found %d parameters\n", num_options);
261 for (i=0; i < num_options; i++)
262 {
263 /* MEMORY LEAK!!! */
264 stp_parameter_tcxx . . $ stp_parameter_t# *param = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(stp_parameter_tcxx . . $ stp_parameter_t#));
265 option = stpi_xmlppd_find_option_indexcxx . . $ stpi_xmlppd_find_option_index(617c7ca5462143a5).(m_ppdcxx . . $ m_ppd., i);
266 if (option)
267 {
268 ps_option_to_paramcxx . . $ ps_option_to_param(907fb578f6a9015c).(v, param, option);
269 if (param->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. != STP_PARAMETER_TYPE_INVALIDcxx . . $ STP_PARAMETER_TYPE_INVALID. &&
270 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., "PageRegion") != 0 &&
271 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., "PageSize") != 0)
272 {
273 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Adding parameter %s %s\n",
274 param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., param->textcxx . . $ $anonymous_type_c987533f3b833c82_8#text.);
275 stp_parameter_list_add_paramcxx . . $ stp_parameter_list_add_param(9dab94dbd10bbd1f).(ret, param);
276 }
277 else
278 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(param);
279 }
280 }
281 }
282 return ret;
283 }
284
285 static void
286 ps_parameters_internalcxx . . $ ps_parameters_internal(dfd5b9531b51a6d2).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name,
287 stp_parameter_tcxx . . $ stp_parameter_t# *description)
288 {
289 unsigned int i;
290 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *option;
291 int status = 0;
292 unsigned int num_choices;
293 const char *defchoice;
294
295 description->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. = STP_PARAMETER_TYPE_INVALIDcxx . . $ STP_PARAMETER_TYPE_INVALID.;
296 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. = 0;
297 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 0;
298
299 if (name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
300 return;
301
302 status = check_ppd_filecxx . . $ check_ppd_file(b1be75487ade2f93).(v);
303
304 for (i = 0; i < the_parameter_countcxx . . $ the_parameter_count.; i++)
305 {
306 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, the_parameterscxx . . $ the_parameters.[i].namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) == 0)
307 {
308 stp_fill_parameter_settingscxx . . $ stp_fill_parameter_settings(bb1f9d668495a4b4).(description, &(the_parameterscxx . . $ the_parameters.[i]));
309 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "PPDFile") == 0)
310 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 1;
311 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "ModelName") == 0)
312 {
313 const char *nickname;
314 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).();
315 if (m_ppdcxx . . $ m_ppd. && stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(m_ppdcxx . . $ m_ppd., "nickname"))
316 nickname = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(m_ppdcxx . . $ m_ppd., "nickname");
317 else
318 nickname = _cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:58:11`!("None; please provide a PPD file");
319 stp_string_list_add_string_unsafecxx . . $ stp_string_list_add_string_unsafe(61ec312b340c2952).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str.,
320 nickname, nickname);
321 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. = nickname;
322 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 1;
323 return;
324 }
325 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "PrintingMode") == 0)
326 {
327 if (! m_ppdcxx . . $ m_ppd. || strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(m_ppdcxx . . $ m_ppd., "color"), "1") == 0)
328 {
329 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).();
330 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).
331 (description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "Color", _cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:58:11`!("Color"));
332 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).
333 (description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "BW", _cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:58:11`!("Black and White"));
334 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. =
335 stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., 0)->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.;
336 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 1;
337 }
338 else
339 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 0;
340 return;
341 }
342 }
343 }
344
345 if (!status && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "PageSize") != 0)
346 return;
347 if ((option = stpi_xmlppd_find_option_namedcxx . . $ stpi_xmlppd_find_option_named(85c1b86a85cbb6d).(m_ppdcxx . . $ m_ppd., name)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
348 {
349 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "PageSize") == 0)
350 {
351 /* Provide a default set of page sizes */
352 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).();
353 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).
354 (description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "Letter", _cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:58:11`!("Letter"));
355 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).
356 (description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "A4", _cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:58:11`!("A4"));
357 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).
358 (description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., "Custom", _cxx . . $ `include/gutenprint/gutenprint-intl-internal.h:58:11`!("Custom"));
359 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. =
360 stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., 0)->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.;
361 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 1;
362 return;
363 }
364 else
365 {
366 int tmplen = strlencxx . . $ strlen(751346f8406fd082).(name) + 3;
367 char *tmp = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(tmplen + 1);
368 strcpycxx . . $ strcpy(b7b3a83273496486).(tmp, "Stp");
369 strncatcxx . . $ strncat(255158a415b673b0).(tmp, name, tmplen);
370 if ((option = stpi_xmlppd_find_option_namedcxx . . $ stpi_xmlppd_find_option_named(85c1b86a85cbb6d).(m_ppdcxx . . $ m_ppd., tmp)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
371 {
372 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "no parameter %s", name);
373 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
374 return;
375 }
376 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
377 }
378 }
379
380 ps_option_to_paramcxx . . $ ps_option_to_param(907fb578f6a9015c).(v, description, option);
381 if (description->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type. != STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.)
382 return;
383 num_choices = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "num_choices"));
384 defchoice = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(option, "default");
385 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).();
386
387 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "describe parameter %s, output name=[%s] text=[%s] category=[%s] choices=[%d] default=[%s]\n",
388 name, description->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., description->textcxx . . $ $anonymous_type_c987533f3b833c82_8#text.,
389 description->categorycxx . . $ $anonymous_type_c987533f3b833c82_8#category., num_choices, defchoice);
390
391 /* Describe all choices for specified option. */
392 for (i=0; i < num_choices; i++)
393 {
394 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *choice = stpi_xmlppd_find_choice_indexcxx . . $ stpi_xmlppd_find_choice_index(617c7ca5462143a5).(option, i);
395 const char *choice_name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(choice, "name");
396 const char *choice_text = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(choice, "text");
397 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., choice_name, choice_text);
398 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, " parameter %s, choice %d [%s] [%s]",
399 name, i, choice_name, choice_text);
400 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(choice_name, defchoice) == 0)
401 {
402 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v,
403 " parameter %s, choice %d [%s] DEFAULT\n",
404 name, i, choice_name);
405 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. = choice_name;
406 }
407 }
408
409 if (!description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str.)
410 {
411 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v,
412 " parameter %s, defaulting to [%s]",
413 name, stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., 0)->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.);
414 description->defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str. = stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str., 0)->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.;
415 }
416 if (stp_string_list_countcxx . . $ stp_string_list_count(53b7214102d1daf6).(description->boundscxx . . $ $anonymous_type_c987533f3b833c82_8#bounds..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_9#str.) > 0)
417 description->is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active. = 1;
418 return;
419 }
420
421 static void
422 ps_parameterscxx . . $ ps_parameters(dfd5b9531b51a6d2).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name,
423 stp_parameter_tcxx . . $ stp_parameter_t# *description)
424 {
425 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
426 char *locale = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
427 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C");
428 #endif
429 ps_parameters_internalcxx . . $ ps_parameters_internal(dfd5b9531b51a6d2).(v, name, description);
430 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
431 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, locale);
432 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(locale);
433 #endif
434 }
435
436 /*
437 * 'ps_media_size()' - Return the size of the page.
438 */
439
440 static void
441 ps_media_size_internalcxx . . $ ps_media_size_internal(2eafa46ec96dc268).(const stp_vars_tcxx . . $ stp_vars_t# *v, /* I */
442 stp_dimension_tcxx . . $ stp_dimension_t# *width, /* O - Width in points */
443 stp_dimension_tcxx . . $ stp_dimension_t# *height) /* O - Height in points */
444 {
445 const char *pagesize = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "PageSize");
446 int status = check_ppd_filecxx . . $ check_ppd_file(b1be75487ade2f93).(v);
447 if (!pagesize)
448 pagesize = "";
449
450 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v,
451 "ps_media_size(%d, \'%s\', \'%s\', %p, %p)\n",
452 stp_get_model_idcxx . . $ stp_get_model_id(b1be75487ade2f93).(v), m_ppd_filecxx . . $ m_ppd_file., pagesize,
453 (void *) width, (void *) height);
454
455 stp_default_media_sizecxx . . $ stp_default_media_size(2eafa46ec96dc268).(v, width, height);
456
457 if (status)
458 {
459 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *paper = stpi_xmlppd_find_page_sizecxx . . $ stpi_xmlppd_find_page_size(85c1b86a85cbb6d).(m_ppdcxx . . $ m_ppd., pagesize);
460 if (paper)
461 {
462 *width = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "width"));
463 *height = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "height"));
464 }
465 else
466 {
467 *width = 0;
468 *height = 0;
469 }
470 }
471
472 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "dimensions %f %f\n", *width, *height);
473 return;
474 }
475
476 static const stp_papersize_tcxx . . $ stp_papersize_t# *
477 ps_describe_papersizecxx . . $ ps_describe_papersize(977e5bf217e59ec).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name)
478 {
479 int status = check_ppd_filecxx . . $ check_ppd_file(b1be75487ade2f93).(v);
480 if (status)
481 {
482 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *paper = stpi_xmlppd_find_page_sizecxx . . $ stpi_xmlppd_find_page_size(85c1b86a85cbb6d).(m_ppdcxx . . $ m_ppd., name);
483 if (paper)
484 {
485 const char *papersize_list_name = m_ppd_filecxx . . $ m_ppd_file. ? m_ppd_filecxx . . $ m_ppd_file. : "NOPPD";
486 stp_papersize_list_tcxx . . $ stp_papersize_list_t# *ourlist =
487 stpi_find_papersize_list_namedcxx . . $ stpi_find_papersize_list_named(3c3f43458e8c52b9).(papersize_list_name);
488 const stp_papersize_tcxx . . $ stp_papersize_t# *papersize;
489 const stp_papersize_tcxx . . $ stp_papersize_t# *standard_papersize =
490 stpi_get_listed_papersizecxx . . $ stpi_get_listed_papersize(49f21dd3ffd9359c).(name, "standard");
491
492 if (! ourlist)
493 ourlist = stpi_new_papersize_listcxx . . $ stpi_new_papersize_list(3c3f43458e8c52b9).(papersize_list_name);
494
495 papersize = stpi_get_papersize_by_namecxx . . $ stpi_get_papersize_by_name(6661a5a01ab7b09d).(ourlist, name);
496 if (! papersize)
497 {
498 stp_papersize_tcxx . . $ stp_papersize_t# *npapersize = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(stp_papersize_tcxx . . $ stp_papersize_t#));
499 npapersize->namecxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name);
500 npapersize->textcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#text. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name);
501 npapersize->commentcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#comment. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
502 /*
503 * Note that we used the width and height from the PPD file,
504 * not from the standard definition. This is so that if the
505 * PPD file is for another driver that uses slightly different
506 * dimensions than we do that our description matches that of
507 * driver in use.
508 */
509 npapersize->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. = atofcxx . . $ atof(9a18bdb0e56c1bc2).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "width"));
510 npapersize->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height. = atofcxx . . $ atof(9a18bdb0e56c1bc2).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "height"));
511 /*
512 * Only use auxiliary information from our list if our paper size
513 * really is substantially the same as what the PPD file says!
514 */
515 if (standard_papersize &&
516 fabscxx . . $ fabs(447c67c6676f75c3).(npapersize->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width. - standard_papersize->widthcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#width.) < 1 &&
517 fabscxx . . $ fabs(447c67c6676f75c3).(npapersize->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height. - standard_papersize->heightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#height.) < 1)
518 {
519 npapersize->paper_unitcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#paper_unit. = standard_papersize->paper_unitcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#paper_unit.;
520 npapersize->paper_size_typecxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#paper_size_type. = standard_papersize->paper_size_typecxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#paper_size_type.;
521 npapersize->topcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#top. = standard_papersize->topcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#top.;
522 npapersize->leftcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#left. = standard_papersize->leftcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#left.;
523 npapersize->bottomcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#bottom. = standard_papersize->bottomcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#bottom.;
524 npapersize->rightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#right. = standard_papersize->rightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#right.;
525 }
526 else
527 {
528 npapersize->topcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#top. = 0;
529 npapersize->leftcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#left. = 0;
530 npapersize->bottomcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#bottom. = 0;
531 npapersize->rightcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#right. = 0;
532 npapersize->paper_unitcxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#paper_unit. = PAPERSIZE_ENGLISH_STANDARDcxx . . $ PAPERSIZE_ENGLISH_STANDARD.;
533 npapersize->paper_size_typecxx . . $ $anonymous_type_51fd7f0ef3c7bff0_2#paper_size_type. = PAPERSIZE_TYPE_STANDARDcxx . . $ PAPERSIZE_TYPE_STANDARD.;
534 }
535 if (stpi_papersize_createcxx . . $ stpi_papersize_create(57cbead4fcb67a71).(ourlist, npapersize))
536 return npapersize;
537 }
538 return papersize;
539 }
540 }
541 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
542 }
543
544 static void
545 ps_media_sizecxx . . $ ps_media_size(2eafa46ec96dc268).(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_dimension_tcxx . . $ stp_dimension_t# *width, stp_dimension_tcxx . . $ stp_dimension_t# *height)
546 {
547 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
548 char *locale = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
549 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C");
550 #endif
551 ps_media_size_internalcxx . . $ ps_media_size_internal(2eafa46ec96dc268).(v, width, height);
552 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
553 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, locale);
554 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(locale);
555 #endif
556 }
557
558 /*
559 * 'ps_imageable_area()' - Return the imageable area of the page.
560 */
561
562 static void
563 ps_imageable_area_internalcxx . . $ ps_imageable_area_internal(a6092833ba136695).(const stp_vars_tcxx . . $ stp_vars_t# *v, /* I */
564 int use_max_area, /* I - Use maximum area */
565 stp_dimension_tcxx . . $ stp_dimension_t# *left, /* O - Left position in points */
566 stp_dimension_tcxx . . $ stp_dimension_t# *right, /* O - Right position in points */
567 stp_dimension_tcxx . . $ stp_dimension_t# *bottom, /* O - Bottom position in points */
568 stp_dimension_tcxx . . $ stp_dimension_t# *top) /* O - Top position in points */
569 {
570 stp_dimension_tcxx . . $ stp_dimension_t# width, height;
571 const char *pagesize = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "PageSize");
572 if (!pagesize)
573 pagesize = "";
574
575 /* Set some defaults. */
576 ps_media_size_internalcxx . . $ ps_media_size_internal(2eafa46ec96dc268).(v, &width, &height);
577 *left = 0;
578 *right = width;
579 *top = 0;
580 *bottom = height;
581
582 if (check_ppd_filecxx . . $ check_ppd_file(b1be75487ade2f93).(v))
583 {
584 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *paper = stpi_xmlppd_find_page_sizecxx . . $ stpi_xmlppd_find_page_size(85c1b86a85cbb6d).(m_ppdcxx . . $ m_ppd., pagesize);
585 if (paper)
586 {
587 double pleft = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "left"));
588 double pright = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "right"));
589 double ptop = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "top"));
590 double pbottom = atoicxx . . $ atoi(5c4306d8553b3696).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(paper, "bottom"));
591 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "size=l %f r %f b %f t %f h %f w %f\n",
592 pleft, pright, pbottom, ptop, height, width);
593 *left = (stp_dimension_tcxx . . $ stp_dimension_t#) pleft;
594 *right = (stp_dimension_tcxx . . $ stp_dimension_t#) pright;
595 *top = height - (stp_dimension_tcxx . . $ stp_dimension_t#) ptop;
596 *bottom = height - (stp_dimension_tcxx . . $ stp_dimension_t#) pbottom;
597 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, ">>>> l %f r %f b %f t %f h %f w %f\n",
598 *left, *right, *bottom, *top, height, width);
599 }
600 }
601
602 if (use_max_area)
603 {
604 if (*left > 0)
605 *left = 0;
606 if (*right < width)
607 *right = width;
608 if (*top > 0)
609 *top = 0;
610 if (*bottom < height)
611 *bottom = height;
612 }
613
614 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "pagesize %s max_area=%d l %f r %f b %f t %f h %f w %f\n",
615 pagesize ? pagesize : "(null)",
616 use_max_area, *left, *right, *bottom, *top, width, height);
617
618 return;
619 }
620
621 static void
622 ps_imageable_areacxx . . $ ps_imageable_area(25e50967534aa153).(const stp_vars_tcxx . . $ stp_vars_t# *v, /* I */
623 stp_dimension_tcxx . . $ stp_dimension_t# *left, /* O - Left position in points */
624 stp_dimension_tcxx . . $ stp_dimension_t# *right, /* O - Right position in points */
625 stp_dimension_tcxx . . $ stp_dimension_t# *bottom, /* O - Bottom position in points */
626 stp_dimension_tcxx . . $ stp_dimension_t# *top) /* O - Top position in points */
627 {
628 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
629 char *locale = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
630 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C");
631 #endif
632 ps_imageable_area_internalcxx . . $ ps_imageable_area_internal(a6092833ba136695).(v, 0, left, right, bottom, top);
633 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
634 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, locale);
635 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(locale);
636 #endif
637 }
638
639 static void
640 ps_maximum_imageable_areacxx . . $ ps_maximum_imageable_area(25e50967534aa153).(const stp_vars_tcxx . . $ stp_vars_t# *v, /* I */
641 stp_dimension_tcxx . . $ stp_dimension_t# *left, /* O - Left position in points */
642 stp_dimension_tcxx . . $ stp_dimension_t# *right, /* O - Right position in points */
643 stp_dimension_tcxx . . $ stp_dimension_t# *bottom, /* O - Bottom position in points */
644 stp_dimension_tcxx . . $ stp_dimension_t# *top) /* O - Top position in points */
645 {
646 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
647 char *locale = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
648 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C");
649 #endif
650 ps_imageable_area_internalcxx . . $ ps_imageable_area_internal(a6092833ba136695).(v, 1, left, right, bottom, top);
651 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
652 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, locale);
653 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(locale);
654 #endif
655 }
656
657 static void
658 ps_limitcxx . . $ ps_limit(25e50967534aa153).(const stp_vars_tcxx . . $ stp_vars_t# *v, /* I */
659 stp_dimension_tcxx . . $ stp_dimension_t# *width,
660 stp_dimension_tcxx . . $ stp_dimension_t# *height,
661 stp_dimension_tcxx . . $ stp_dimension_t# *min_width,
662 stp_dimension_tcxx . . $ stp_dimension_t# *min_height)
663 {
664 (void)v;
665 *width = (stp_dimension_tcxx . . $ stp_dimension_t#) INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!;
666 *height = (stp_dimension_tcxx . . $ stp_dimension_t#) INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!;
667 *min_width = 1;
668 *min_height = 1;
669 }
670
671 /*
672 * This is really bogus...
673 */
674 static void
675 ps_describe_resolution_internalcxx . . $ ps_describe_resolution_internal(5883f070c6139f40).(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_resolution_tcxx . . $ stp_resolution_t# *x, stp_resolution_tcxx . . $ stp_resolution_t# *y)
676 {
677 const char *resolution = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "Resolution");
678 *x = -1;
679 *y = -1;
680 if (resolution)
681 {
682 int tx = -1;
683 int ty = -1;
684 sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(resolution, "%dx%d", &tx, &ty);
685 *x = (stp_resolution_tcxx . . $ stp_resolution_t#) tx;
686 *y = (stp_resolution_tcxx . . $ stp_resolution_t#) ty;
687 }
688 return;
689 }
690
691 static void
692 ps_describe_resolutioncxx . . $ ps_describe_resolution(5883f070c6139f40).(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_resolution_tcxx . . $ stp_resolution_t# *x, stp_resolution_tcxx . . $ stp_resolution_t# *y)
693 {
694 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
695 char *locale = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
696 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C");
697 #endif
698 ps_describe_resolution_internalcxx . . $ ps_describe_resolution_internal(5883f070c6139f40).(v, x, y);
699 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
700 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, locale);
701 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(locale);
702 #endif
703 }
704
705 static const char *
706 ps_describe_outputcxx . . $ ps_describe_output(4be828c28602b542).(const stp_vars_tcxx . . $ stp_vars_t# *v)
707 {
708 const char *print_mode = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "PrintingMode");
709 const char *input_image_type = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "InputImageType");
710 if (print_mode && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(print_mode, "Color") == 0)
711 {
712 if (input_image_type && (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(input_image_type, "CMYK") == 0 ||
713 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(input_image_type, "KCMY") == 0))
714 return "CMYK";
715 else
716 return "RGB";
717 }
718 else
719 return "Whitescale";
720 }
721
722 static stp_string_list_tcxx . . $ stp_string_list_t# *
723 ps_external_optionscxx . . $ ps_external_options(bdc37f1d9ffbc204).(const stp_vars_tcxx . . $ stp_vars_t# *v)
724 {
725 stp_parameter_list_tcxx . . $ stp_parameter_list_t# param_list = ps_list_parameterscxx . . $ ps_list_parameters(817585d40f809196).(v);
726 stp_string_list_tcxx . . $ stp_string_list_t# *answer;
727 char *tmp;
728 char *ppd_name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
729 unsigned int i;
730 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
731 char *locale;
732 #endif
733 if (! param_list)
734 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
735 answer = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).();
736 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
737 locale = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
738 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C");
739 #endif
740 for (i = 0; i < stp_parameter_list_countcxx . . $ stp_parameter_list_count(2e8e543e1193434e).(param_list); i++)
741 {
742 const stp_parameter_tcxx . . $ stp_parameter_t# *param = stp_parameter_list_paramcxx . . $ stp_parameter_list_param(f24b23997c12c6a6).(param_list, i);
743 stp_parameter_tcxx . . $ stp_parameter_t# desc;
744 stp_describe_parametercxx . . $ stp_describe_parameter(dfd5b9531b51a6d2).(v, param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., &desc);
745 if (desc.is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active.)
746 {
747 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *option;
748 if (m_ppdcxx . . $ m_ppd. &&
749 (option = stpi_xmlppd_find_option_namedcxx . . $ stpi_xmlppd_find_option_named(85c1b86a85cbb6d).(m_ppdcxx . . $ m_ppd., desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
750 {
751 int tmplen = strlencxx . . $ strlen(751346f8406fd082).(desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) + 3;
752 ppd_name = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(tmplen + 1);
753 strcpycxx . . $ strcpy(b7b3a83273496486).(ppd_name, "Stp");
754 strncatcxx . . $ strncat(255158a415b673b0).(ppd_name, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., tmplen);
755 if ((option = stpi_xmlppd_find_option_namedcxx . . $ stpi_xmlppd_find_option_named(85c1b86a85cbb6d).(m_ppdcxx . . $ m_ppd., ppd_name)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
756 {
757 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "no parameter %s", desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.);
758 STP_SAFE_FREEcxx . . $ `include/gutenprint/util.h:210:9`!(ppd_name);
759 }
760 }
761 switch (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type.)
762 {
763 case STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.:
764 if (stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) &&
765 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.),
766 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str.))
767 {
768 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Adding string parameter %s (%s): %s %s\n",
769 desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., ppd_name ? ppd_name : "(null)",
770 stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.),
771 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str.);
772 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(answer,
773 ppd_name ? ppd_name : desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
774 stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
775 }
776 break;
777 case STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT.:
778 if (stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) != desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer.)
779 {
780 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Adding integer parameter %s (%s): %d %d\n",
781 desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., ppd_name ? ppd_name : "(null)",
782 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.),
783 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer.);
784 stp_asprintfcxx . . $ stp_asprintf(816f0239e6d49b84).(&tmp, "%d", stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
785 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(answer,
786 ppd_name ? ppd_name : desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
787 tmp);
788 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
789 }
790 break;
791 case STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN.:
792 if (stp_get_boolean_parametercxx . . $ stp_get_boolean_parameter(b1e629819c29df09).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) != desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..booleancxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#boolean.)
793 {
794 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Adding boolean parameter %s (%s): %d %d\n",
795 desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., ppd_name ? ppd_name : "(null)",
796 stp_get_boolean_parametercxx . . $ stp_get_boolean_parameter(b1e629819c29df09).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.),
797 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..booleancxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#boolean.);
798 stp_asprintfcxx . . $ stp_asprintf(816f0239e6d49b84).(&tmp, "%s",
799 stp_get_boolean_parametercxx . . $ stp_get_boolean_parameter(b1e629819c29df09).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) ?
800 "True" : "False");
801 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(answer,
802 ppd_name ? ppd_name : desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
803 tmp);
804 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
805 }
806 break;
807 case STP_PARAMETER_TYPE_DOUBLEcxx . . $ STP_PARAMETER_TYPE_DOUBLE.:
808 if (fabscxx . . $ fabs(447c67c6676f75c3).(stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) - desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl.) > .00001)
809 {
810 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Adding float parameter %s (%s): %.3f %.3f\n",
811 desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., ppd_name ? ppd_name : "(null)",
812 stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.),
813 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl.);
814 stp_asprintfcxx . . $ stp_asprintf(816f0239e6d49b84).(&tmp, "%.3f",
815 stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
816 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(answer,
817 ppd_name ? ppd_name : desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
818 tmp);
819 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
820 }
821 break;
822 case STP_PARAMETER_TYPE_DIMENSIONcxx . . $ STP_PARAMETER_TYPE_DIMENSION.:
823 if (stp_get_dimension_parametercxx . . $ stp_get_dimension_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) !=
824 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension.)
825 {
826 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "Adding dimension parameter %s (%s): %f %f\n",
827 desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., ppd_name ? ppd_name : "(null)",
828 stp_get_dimension_parametercxx . . $ stp_get_dimension_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.),
829 desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension.);
830 stp_asprintfcxx . . $ stp_asprintf(816f0239e6d49b84).(&tmp, "%f",
831 stp_get_dimension_parametercxx . . $ stp_get_dimension_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
832 stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(answer,
833 ppd_name ? ppd_name : desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
834 tmp);
835 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
836 }
837 break;
838 default:
839 break;
840 }
841 STP_SAFE_FREEcxx . . $ `include/gutenprint/util.h:210:9`!(ppd_name);
842 }
843 stp_parameter_description_destroycxx . . $ stp_parameter_description_destroy(6259b4d9050bb586).(&desc);
844 }
845 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
846 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, locale);
847 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(locale);
848 #endif
849 return answer;
850 }
851
852 /*
853 * 'ps_print_device_settings()' - output postscript code from PPD into the
854 * postscript stream.
855 */
856
857 static void
858 ps_print_device_settingscxx . . $ ps_print_device_settings(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
859 {
860 unsigned int i;
861 stp_parameter_list_tcxx . . $ stp_parameter_list_t# param_list = ps_list_parameterscxx . . $ ps_list_parameters(817585d40f809196).(v);
862 if (! param_list)
863 return;
864 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%BeginSetup\n", v);
865 for (i = 0; i < stp_parameter_list_countcxx . . $ stp_parameter_list_count(2e8e543e1193434e).(param_list); i++)
866 {
867 const stp_parameter_tcxx . . $ stp_parameter_t# *param = stp_parameter_list_paramcxx . . $ stp_parameter_list_param(f24b23997c12c6a6).(param_list, i);
868 stp_parameter_tcxx . . $ stp_parameter_t# desc;
869 stp_describe_parametercxx . . $ stp_describe_parameter(dfd5b9531b51a6d2).(v, param->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., &desc);
870 if (desc.is_activecxx . . $ $anonymous_type_c987533f3b833c82_8#is_active.)
871 {
872 switch (desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type.)
873 {
874 case STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.:
875 case STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN.:
876 {
877 const char *val=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
878 const char *defval=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
879
880 /* If this is a bool parameter, set val to "True" or "False" - otherwise fetch from string parameter. */
881 if(desc.p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type.==STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN.)
882 {
883 val=stp_get_boolean_parametercxx . . $ stp_get_boolean_parameter(b1e629819c29df09).(v,desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.) ? "True" : "False";
884 defval=desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..booleancxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#boolean. ? "True" : "False";
885 }
886 else
887 {
888 val=stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v,desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.);
889 defval=desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..strcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#str.;
890 }
891
892 /* We only include the option's code if it's set to a value other than the default. */
893 if(val && defval && (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(val,defval)!=0))
894 {
895 if(m_ppdcxx . . $ m_ppd.)
896 {
897 /* If we have a PPD xml tree we hunt for the appropriate "option" and "choice"... */
898 stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node=m_ppdcxx . . $ m_ppd.;
899 node=stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(node,node, "option", "name", desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!);
900 if(node)
901 {
902 node=stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(node,node, "choice", "name", val, STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!);
903 if(node && node->childcxx . . $ stp_mxml_node_s#child.)
904 {
905 if(node->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..opaquecxx . . $ stp_mxml_value_u#opaque. && (strlencxx . . $ strlen(751346f8406fd082).(node->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..opaquecxx . . $ stp_mxml_value_u#opaque.)>1))
906 {
907 /* If we have opaque data for the child, we use %%BeginFeature and copy the code verbatim. */
908 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("[{\n", v);
909 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%BeginFeature: *%s %s\n", desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., val);
910 if(node->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..opaquecxx . . $ stp_mxml_value_u#opaque.)
911 stp_putscxx . . $ stp_puts(35a89ecf160f646a).(node->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..opaquecxx . . $ stp_mxml_value_u#opaque.,v);
912 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\n%%EndFeature\n", v);
913 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("} stopped cleartomark\n", v);
914 }
915 else
916 {
917 /* If we don't have code, we use %%IncludeFeature instead. */
918 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("[{\n", v);
919 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%IncludeFeature: *%s %s\n", desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., val);
920 if(node->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..opaquecxx . . $ stp_mxml_value_u#opaque.)
921 stp_putscxx . . $ stp_puts(35a89ecf160f646a).(node->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..opaquecxx . . $ stp_mxml_value_u#opaque.,v);
922 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("} stopped cleartomark\n", v);
923 }
924 }
925 }
926 }
927 }
928 }
929 break;
930 case STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT.:
931 if(stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(v,desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.)!=desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..integercxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#integer.)
932 {
933 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("[{\n", v);
934 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%IncludeFeature: *%s %d\n", desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
935 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
936 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("} stopped cleartomark\n", v);
937 }
938 break;
939 case STP_PARAMETER_TYPE_DOUBLEcxx . . $ STP_PARAMETER_TYPE_DOUBLE.:
940 if(stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(v,desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.)!=desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dblcxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dbl.)
941 {
942 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("[{\n", v);
943 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%IncludeFeature: *%s %f\n", desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
944 stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
945 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("} stopped cleartomark\n", v);
946 }
947 break;
948 case STP_PARAMETER_TYPE_DIMENSIONcxx . . $ STP_PARAMETER_TYPE_DIMENSION.:
949 if(stp_get_dimension_parametercxx . . $ stp_get_dimension_parameter(ac3b1c02c916f219).(v,desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.)!=desc.defltcxx . . $ $anonymous_type_c987533f3b833c82_8#deflt..dimensioncxx . . $ $anonymous_type_c987533f3b833c82_8#$anonymous_type_10#dimension.)
950 {
951 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("[{\n", v);
952 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%IncludeFeature: *%s %f\n", desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
953 stp_get_dimension_parametercxx . . $ stp_get_dimension_parameter(ac3b1c02c916f219).(v, desc.namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
954 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("} stopped cleartomark\n", v);
955 }
956 break;
957 default:
958 break;
959 }
960 }
961 stp_parameter_description_destroycxx . . $ stp_parameter_description_destroy(6259b4d9050bb586).(&desc);
962 }
963 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%EndSetup\n", v);
964 stp_parameter_list_destroycxx . . $ stp_parameter_list_destroy(5d22bdacc48458e8).(param_list);
965 }
966
967 /*
968 * 'ps_print()' - Print an image to a PostScript printer.
969 */
970
971 static int
972 ps_print_internalcxx . . $ ps_print_internal(54c0568b42af3904).(stp_vars_tcxx . . $ stp_vars_t# *v, stp_image_tcxx . . $ stp_image_t# *image)
973 {
974 int status = 1;
975 int model = stp_get_model_idcxx . . $ stp_get_model_id(b1be75487ade2f93).(v);
976 const char *print_mode = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "PrintingMode");
977 const char *input_image_type = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "InputImageType");
978 unsigned short *out = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
979 stp_dimension_tcxx . . $ stp_dimension_t# top = stp_get_topcxx . . $ stp_get_top(7f9a8d44e8193bba).(v);
980 stp_dimension_tcxx . . $ stp_dimension_t# left = stp_get_leftcxx . . $ stp_get_left(7f9a8d44e8193bba).(v);
981 int y; /* Looping vars */
982 stp_dimension_tcxx . . $ stp_dimension_t# page_left, /* Left margin of page */
983 page_right, /* Right margin of page */
984 page_top, /* Top of page */
985 page_bottom, /* Bottom of page */
986 page_width, /* Width of page */
987 page_height, /* Height of page */
988 paper_width, /* Width of physical page */
989 paper_height; /* Height of physical page */
990 int out_width, /* Width of image on page */
991 out_height, /* Height of image on page */
992 out_channels, /* Output bytes per pixel */
993 out_ps_height, /* Output height (Level 2 output) */
994 out_offset; /* Output offset (Level 2 output) */
995 time_tcxx . . $ time_t# curtime; /* Current time of day */
996 unsigned zero_mask;
997 int image_height,
998 image_width;
999 int color_out = 0;
1000 int cmyk_out = 0;
1001
1002 if (print_mode && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(print_mode, "Color") == 0)
1003 color_out = 1;
1004 if (color_out &&
1005 input_image_type && (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(input_image_type, "CMYK") == 0 ||
1006 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(input_image_type, "KCMY") == 0))
1007 cmyk_out = 1;
1008
1009 stp_image_initcxx . . $ stp_image_init(7010b42a94b47a79).(image);
1010
1011 /*
1012 * Compute the output size...
1013 */
1014
1015 out_width = stp_get_widthcxx . . $ stp_get_width(7f9a8d44e8193bba).(v);
1016 out_height = stp_get_heightcxx . . $ stp_get_height(7f9a8d44e8193bba).(v);
1017
1018 ps_imageable_area_internalcxx . . $ ps_imageable_area_internal(a6092833ba136695).(v, 0, &page_left, &page_right, &page_bottom, &page_top);
1019 ps_media_size_internalcxx . . $ ps_media_size_internal(2eafa46ec96dc268).(v, &paper_width, &paper_height);
1020 page_width = page_right - page_left;
1021 page_height = page_bottom - page_top;
1022
1023 image_height = stp_image_heightcxx . . $ stp_image_height(ba31fd85910919f2).(image);
1024 image_width = stp_image_widthcxx . . $ stp_image_width(ba31fd85910919f2).(image);
1025
1026 /*
1027 * Output a standard PostScript header with DSC comments...
1028 */
1029
1030 curtime = stpi_timecxx . . $ stpi_time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1031
1032 top = paper_height - top;
1033
1034 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v,
1035 "out_width = %d, out_height = %d\n", out_width, out_height);
1036 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v,
1037 "page_left = %f, page_right = %f, page_bottom = %f, page_top = %f\n",
1038 page_left, page_right, page_bottom, page_top);
1039 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "left = %f, top = %f\n", left, top);
1040 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "page_width = %f, page_height = %f\n",
1041 page_width, page_height);
1042
1043 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_PScxx . . $ `include/gutenprint/util.h:169:9`!, v, "bounding box l %f b %f r %f t %f\n",
1044 page_left, paper_height - page_bottom,
1045 page_right, paper_height - page_top);
1046
1047 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%!PS-Adobe-3.0\n", v);
1048 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
1049 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%Creator: %s/Gutenprint %s (%s)\n",
1050 stp_image_get_appnamecxx . . $ stp_image_get_appname(97b8a1c82bcbc822).(image), VERSIONcxx . . $ `config.h:204:9`!, RELEASE_DATEcxx . . $ `config.h:190:9`!);
1051 #else
1052 stp_zprintf(v, "%%%%Creator: %s/Gutenprint\n", stp_image_get_appname(image));
1053 #endif
1054 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%CreationDate: %s", ctimecxx . . $ ctime(4e4bbfda8d4b3d77).(&curtime));
1055 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%BoundingBox: %f %f %f %f\n",
1056 page_left, paper_height - page_bottom,
1057 page_right, paper_height - page_top);
1058 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%DocumentData: Clean7Bit\n", v);
1059 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%%%%LanguageLevel: %d\n", model + 1);
1060 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%Pages: 1\n", v);
1061 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%Orientation: Portrait\n", v);
1062 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%EndComments\n", v);
1063
1064 ps_print_device_settingscxx . . $ ps_print_device_settings(1a97b8462f9f913c).(v);
1065
1066 /*
1067 * Output the page...
1068 */
1069
1070 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%Page: 1 1\n", v);
1071 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("gsave\n", v);
1072
1073 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%f %f translate\n", left, top);
1074
1075 /* Force locale to "C", because decimal numbers in Postscript must
1076 always be printed with a decimal point rather than the
1077 locale-specific setting. */
1078
1079 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%.3f %.3f scale\n",
1080 (double)out_width / ((double)image_width),
1081 (double)out_height / ((double)image_height));
1082
1083 stp_channel_resetcxx . . $ stp_channel_reset(1a97b8462f9f913c).(v);
1084 stp_channel_addcxx . . $ stp_channel_add(be410e6e969dd53f).(v, 0, 0, 1.0);
1085 if (color_out)
1086 {
1087 stp_channel_addcxx . . $ stp_channel_add(be410e6e969dd53f).(v, 1, 0, 1.0);
1088 stp_channel_addcxx . . $ stp_channel_add(be410e6e969dd53f).(v, 2, 0, 1.0);
1089 if (cmyk_out)
1090 {
1091 stp_channel_addcxx . . $ stp_channel_add(be410e6e969dd53f).(v, 3, 0, 1.0);
1092 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "STPIOutputType", "CMYK");
1093 }
1094 else
1095 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "STPIOutputType", "RGB");
1096 }
1097 else
1098 stp_set_string_parametercxx . . $ stp_set_string_parameter(7405204ff890c7b8).(v, "STPIOutputType", "Whitescale");
1099
1100 stp_set_boolean_parametercxx . . $ stp_set_boolean_parameter(8ec0183b6ab8ae2d).(v, "SimpleGamma", 1);
1101
1102 out_channels = stp_color_initcxx . . $ stp_color_init(8474e95f5358b69d).(v, image, 256);
1103
1104 if (model == 0)
1105 {
1106 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "/picture %d string def\n", image_width * out_channels);
1107
1108 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "%d %d 8\n", image_width, image_height);
1109
1110 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("[ 1 0 0 -1 0 1 ]\n", v);
1111
1112 if (cmyk_out)
1113 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("{currentfile picture readhexstring pop} false 4 colorimage\n", v);
1114 else if (color_out)
1115 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("{currentfile picture readhexstring pop} false 3 colorimage\n", v);
1116 else
1117 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("{currentfile picture readhexstring pop} image\n", v);
1118
1119 for (y = 0; y < image_height; y ++)
1120 {
1121 if (stp_color_get_rowcxx . . $ stp_color_get_row(ba7b466a9562988e).(v, image, y, &zero_mask))
1122 {
1123 status = 2;
1124 break;
1125 }
1126
1127 out = stp_channel_get_inputcxx . . $ stp_channel_get_input(58f317534f8c8659).(v);
1128
1129 /* Convert from KCMY to CMYK */
1130 if (cmyk_out)
1131 {
1132 int x;
1133 unsigned short *pos = out;
1134 for (x = 0; x < image_width; x++, pos += 4)
1135 {
1136 unsigned short p0 = pos[0];
1137 pos[0] = pos[1];
1138 pos[1] = pos[2];
1139 pos[2] = pos[3];
1140 pos[3] = p0;
1141 }
1142 }
1143 ps_hexcxx . . $ ps_hex(7495ad52598bc6d2).(v, out, image_width * out_channels);
1144 }
1145 }
1146 else
1147 {
1148 unsigned short *tmp_buf =
1149 stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(unsigned short) * (image_width * out_channels + 4));
1150 if (cmyk_out)
1151 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("/DeviceCMYK setcolorspace\n", v);
1152 else if (color_out)
1153 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("/DeviceRGB setcolorspace\n", v);
1154 else
1155 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("/DeviceGray setcolorspace\n", v);
1156
1157 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("<<\n", v);
1158 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/ImageType 1\n", v);
1159
1160 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "\t/Width %d\n", image_width);
1161 stp_zprintfcxx . . $ stp_zprintf(7aef7aa9b820d38).(v, "\t/Height %d\n", image_height);
1162 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/BitsPerComponent 8\n", v);
1163
1164 if (cmyk_out)
1165 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/Decode [ 0 1 0 1 0 1 0 1 ]\n", v);
1166 else if (color_out)
1167 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/Decode [ 0 1 0 1 0 1 ]\n", v);
1168 else
1169 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/Decode [ 0 1 ]\n", v);
1170
1171 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/DataSource currentfile /ASCII85Decode filter\n", v);
1172
1173 if ((image_width * 72 / out_width) < 100)
1174 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/Interpolate true\n", v);
1175
1176 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\t/ImageMatrix [ 1 0 0 -1 0 1 ]\n", v);
1177
1178 stp_putscxx . . $ stp_puts(35a89ecf160f646a).(">>\n", v);
1179 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("image\n", v);
1180
1181 for (y = 0, out_offset = 0; y < image_height; y ++)
1182 {
1183 unsigned short *where;
1184 /* FIXME!!! */
1185 if (stp_color_get_rowcxx . . $ stp_color_get_row(ba7b466a9562988e).(v, image, y /*, out + out_offset */ , &zero_mask))
1186 {
1187 status = 2;
1188 break;
1189 }
1190 out = stp_channel_get_inputcxx . . $ stp_channel_get_input(58f317534f8c8659).(v);
1191 if (out_offset > 0)
1192 {
1193 memcpycxx . . $ memcpy(cc817cb175f282d).(tmp_buf + out_offset, out,
1194 image_width * out_channels * sizeof(unsigned short));
1195 where = tmp_buf;
1196 }
1197 else
1198 where = out;
1199
1200 /* Convert from KCMY to CMYK */
1201 if (cmyk_out)
1202 {
1203 int x;
1204 unsigned short *pos = where;
1205 for (x = 0; x < image_width; x++, pos += 4)
1206 {
1207 unsigned short p0 = pos[0];
1208 pos[0] = pos[1];
1209 pos[1] = pos[2];
1210 pos[2] = pos[3];
1211 pos[3] = p0;
1212 }
1213 }
1214
1215 out_ps_height = out_offset + image_width * out_channels;
1216
1217 if (y < (image_height - 1))
1218 {
1219 ps_ascii85cxx . . $ ps_ascii85(314bda581488b0fb).(v, where, out_ps_height & ~3, 0);
1220 out_offset = out_ps_height & 3;
1221 }
1222 else
1223 {
1224 ps_ascii85cxx . . $ ps_ascii85(314bda581488b0fb).(v, where, out_ps_height, 1);
1225 out_offset = 0;
1226 }
1227
1228 if (out_offset > 0)
1229 memcpycxx . . $ memcpy(cc817cb175f282d).(tmp_buf, where + out_ps_height - out_offset,
1230 out_offset * sizeof(unsigned short));
1231 }
1232 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp_buf);
1233 }
1234 stp_image_concludecxx . . $ stp_image_conclude(7010b42a94b47a79).(image);
1235
1236 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("grestore\n", v);
1237 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("showpage\n", v);
1238 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%Trailer\n", v);
1239 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("%%EOF\n", v);
1240 return status;
1241 }
1242
1243 static int
1244 ps_printcxx . . $ ps_print(be5d09c432b01f95).(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_image_tcxx . . $ stp_image_t# *image)
1245 {
1246 int status;
1247 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
1248 char *locale;
1249 #endif
1250 stp_vars_tcxx . . $ stp_vars_t# *nv = stp_vars_create_copycxx . . $ stp_vars_create_copy(d6c73ebbfa1de3f9).(v);
1251 if (!stp_verifycxx . . $ stp_verify(60b55b6a36641e80).(nv))
1252 {
1253 stp_eprintfcxx . . $ stp_eprintf(7aef7aa9b820d38).(nv, "Print options not verified; cannot print.\n");
1254 return 0;
1255 }
1256 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
1257 locale = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!));
1258 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, "C");
1259 #endif
1260 status = ps_print_internalcxx . . $ ps_print_internal(54c0568b42af3904).(nv, image);
1261 #ifdef HAVE_LOCALE_Hcxx . . $ `config.h:97:9`!
1262 setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, locale);
1263 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(locale);
1264 #endif
1265 stp_vars_destroycxx . . $ stp_vars_destroy(1a97b8462f9f913c).(nv);
1266 return status;
1267 }
1268
1269
1270 /*
1271 * 'ps_hex()' - Print binary data as a series of hexadecimal numbers.
1272 */
1273
1274 static void
1275 ps_hexcxx . . $ ps_hex(7495ad52598bc6d2).(const stp_vars_tcxx . . $ stp_vars_t# *v, /* I - File to print to */
1276 unsigned short *data, /* I - Data to print */
1277 int length) /* I - Number of bytes to print */
1278 {
1279 int col; /* Current column */
1280 static const char *hex = "0123456789ABCDEF";
1281
1282 col = 0;
1283 while (length > 0)
1284 {
1285 unsigned char pixel = (*data & 0xff00) >> 8;
1286 /*
1287 * Put the hex chars out to the file; note that we don't use stp_zprintf()
1288 * for speed reasons...
1289 */
1290
1291 stp_putccxx . . $ stp_putc(a57e1a3820493fb).(hex[pixel >> 4], v);
1292 stp_putccxx . . $ stp_putc(a57e1a3820493fb).(hex[pixel & 15], v);
1293
1294 data ++;
1295 length --;
1296
1297 col += 2;
1298 if (col >= 72)
1299 {
1300 col = 0;
1301 stp_putccxx . . $ stp_putc(a57e1a3820493fb).('\n', v);
1302 }
1303 }
1304
1305 if (col > 0)
1306 stp_putccxx . . $ stp_putc(a57e1a3820493fb).('\n', v);
1307 }
1308
1309
1310 /*
1311 * 'ps_ascii85()' - Print binary data as a series of base-85 numbers.
1312 */
1313
1314 static void
1315 ps_ascii85cxx . . $ ps_ascii85(314bda581488b0fb).(const stp_vars_tcxx . . $ stp_vars_t# *v, /* I - File to print to */
1316 unsigned short *data, /* I - Data to print */
1317 int length, /* I - Number of bytes to print */
1318 int last_line) /* I - Last line of raster data? */
1319 {
1320 int i; /* Looping var */
1321 unsigned b; /* Binary data word */
1322 unsigned char c[5]; /* ASCII85 encoded chars */
1323 static int column = 0; /* Current column */
1324
1325 #define OUTBUF_SIZEcxx . . $ `src/main/print-ps.c:1325:9`! 4096
1326 unsigned char outbuffer[OUTBUF_SIZEcxx . . $ `src/main/print-ps.c:1325:9`!+10];
1327 int outp=0;
1328
1329 while (length > 3)
1330 {
1331 unsigned char d0 = (data[0] & 0xff00) >> 8;
1332 unsigned char d1 = (data[1] & 0xff00) >> 8;
1333 unsigned char d2 = (data[2] & 0xff00) >> 8;
1334 unsigned char d3 = (data[3] & 0xff00) >> 8;
1335 b = (((((d0 << 8) | d1) << 8) | d2) << 8) | d3;
1336
1337 if (b == 0)
1338 {
1339 outbuffer[outp++]='z';
1340 column ++;
1341 }
1342 else
1343 {
1344 outbuffer[outp+4] = (b % 85) + '!';
1345 b /= 85;
1346 outbuffer[outp+3] = (b % 85) + '!';
1347 b /= 85;
1348 outbuffer[outp+2] = (b % 85) + '!';
1349 b /= 85;
1350 outbuffer[outp+1] = (b % 85) + '!';
1351 b /= 85;
1352 outbuffer[outp] = b + '!';
1353
1354 outp+=5;
1355 column += 5;
1356 }
1357
1358 if (column > 72)
1359 {
1360 outbuffer[outp++]='\n';
1361 column = 0;
1362 }
1363
1364 if(outp>=OUTBUF_SIZEcxx . . $ `src/main/print-ps.c:1325:9`!)
1365 {
1366 stp_zfwritecxx . . $ stp_zfwrite(e7e85bda1a353e8c).((const char *)outbuffer, outp, 1, v);
1367 outp=0;
1368 }
1369
1370 data += 4;
1371 length -= 4;
1372 }
1373
1374 if(outp)
1375 stp_zfwritecxx . . $ stp_zfwrite(e7e85bda1a353e8c).((const char *)outbuffer, outp, 1, v);
1376
1377 if (last_line)
1378 {
1379 if (length > 0)
1380 {
1381 for (b = 0, i = length; i > 0; b = (b << 8) | data[0], data ++, i --);
1382
1383 c[4] = (b % 85) + '!';
1384 b /= 85;
1385 c[3] = (b % 85) + '!';
1386 b /= 85;
1387 c[2] = (b % 85) + '!';
1388 b /= 85;
1389 c[1] = (b % 85) + '!';
1390 b /= 85;
1391 c[0] = b + '!';
1392
1393 stp_zfwritecxx . . $ stp_zfwrite(e7e85bda1a353e8c).((const char *)c, length + 1, 1, v);
1394 }
1395
1396 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("~>\n", v);
1397 column = 0;
1398 }
1399 }
1400
1401
1402 static const stp_printfuncs_tcxx . . $ stp_printfuncs_t# print_ps_printfuncscxx . . $ print_ps_printfuncs. =
1403 {
1404 ps_list_parameterscxx . . $ ps_list_parameters(817585d40f809196).,
1405 ps_parameterscxx . . $ ps_parameters(dfd5b9531b51a6d2).,
1406 ps_media_sizecxx . . $ ps_media_size(2eafa46ec96dc268).,
1407 ps_imageable_areacxx . . $ ps_imageable_area(25e50967534aa153).,
1408 ps_maximum_imageable_areacxx . . $ ps_maximum_imageable_area(25e50967534aa153).,
1409 ps_limitcxx . . $ ps_limit(25e50967534aa153).,
1410 ps_printcxx . . $ ps_print(be5d09c432b01f95).,
1411 ps_describe_resolutioncxx . . $ ps_describe_resolution(5883f070c6139f40).,
1412 ps_describe_outputcxx . . $ ps_describe_output(4be828c28602b542).,
1413 stp_verify_printer_paramscxx . . $ stp_verify_printer_params(60b55b6a36641e80).,
1414 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1415 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1416 ps_external_optionscxx . . $ ps_external_options(bdc37f1d9ffbc204).,
1417 ps_describe_papersizecxx . . $ ps_describe_papersize(977e5bf217e59ec).
1418 };
1419
1420
1421 static stp_family_tcxx . . $ stp_family_t# print_ps_module_datacxx . . $ print_ps_module_data. =
1422 {
1423 &print_ps_printfuncscxx . . $ print_ps_printfuncs.,
1424 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!
1425 };
1426
1427
1428 static int
1429 print_ps_module_initcxx . . $ print_ps_module_init(b126dc7c1de90089).(void)
1430 {
1431 return stpi_family_registercxx . . $ stpi_family_register(29ae8ff464c7f7e5).(print_ps_module_datacxx . . $ print_ps_module_data..printer_listcxx . . $ stp_family#printer_list.);
1432 }
1433
1434
1435 static int
1436 print_ps_module_exitcxx . . $ print_ps_module_exit(b126dc7c1de90089).(void)
1437 {
1438 return stpi_family_unregistercxx . . $ stpi_family_unregister(29ae8ff464c7f7e5).(print_ps_module_datacxx . . $ print_ps_module_data..printer_listcxx . . $ stp_family#printer_list.);
1439 }
1440
1441
1442 /* Module header */
1443 #define stp_module_versioncxx . . $ `src/main/print-ps.c:1443:9`! print_ps_LTX_stp_module_version
1444 #define stp_module_datacxx . . $ `src/main/print-ps.c:1444:9`! print_ps_LTX_stp_module_data
1445
1446 stp_module_version_tcxx . . $ stp_module_version_t# stp_module_versioncxx . . $ `src/main/print-ps.c:1443:9`! = {0, 0};
1447
1448 stp_module_tcxx . . $ stp_module_t# stp_module_datacxx . . $ `src/main/print-ps.c:1444:9`! =
1449 {
1450 "ps",
1451 VERSIONcxx . . $ `config.h:204:9`!,
1452 "Postscript family driver",
1453 STP_MODULE_CLASS_FAMILYcxx . . $ STP_MODULE_CLASS_FAMILY.,
1454 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1455 print_ps_module_initcxx . . $ print_ps_module_init(b126dc7c1de90089).,
1456 print_ps_module_exitcxx . . $ print_ps_module_exit(b126dc7c1de90089).,
1457 (void *) &print_ps_module_datacxx . . $ print_ps_module_data.
1458 };