Debian Codegraph @

src/main/escp2-driver.c

raw symbols SCIP
1 /*
2 *
3 * Print plug-in EPSON ESC/P2 driver for the GIMP.
4 *
5 * Copyright 1997-2000 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>:411: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 <string.h>
34 #include "print-escp2.h"cxx . . $ `<file>/src/main/print-escp2.h`/
35
36 #ifdef __GNUC__cxx . . $ `<built-in>:8:9`!
37 #define inlinecxx . . $ `src/main/escp2-driver.c:37:9`! __inline__
38 #endif
39
40 static escp2_privdata_tcxx . . $ escp2_privdata_t# *
41 get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(stp_vars_tcxx . . $ stp_vars_t# *v)
42 {
43 return (escp2_privdata_tcxx . . $ escp2_privdata_t# *) stp_get_component_datacxx . . $ stp_get_component_data(2bc0070dfdce2f04).(v, "Driver");
44 }
45
46 static void
47 escp2_reset_printercxx . . $ escp2_reset_printer(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
48 {
49 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
50 /*
51 * Magic initialization string that's needed to take printer out of
52 * packet mode.
53 */
54 if (pd->preinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#preinit_sequence.)
55 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->preinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#preinit_sequence., v);
56
57 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033@", "");
58 }
59
60 static void
61 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(stp_vars_tcxx . . $ stp_vars_t# *v, const char *param, const char *value)
62 {
63 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(R", "bcscs", '\0', param, ':',
64 value ? value : "NULL");
65 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033", "ccc", 0, 0, 0);
66 }
67
68 static void
69 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(stp_vars_tcxx . . $ stp_vars_t# *v, const char *param, int value)
70 {
71 char buf[64];
72 (void) snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, 64, "%d", value);
73 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, param, buf);
74 }
75
76 static void
77 print_remote_float_paramcxx . . $ print_remote_float_param(bd523a1c1fbe60d3).(stp_vars_tcxx . . $ stp_vars_t# *v, const char *param, double value)
78 {
79 char buf[64];
80 (void) snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, 64, "%f", value);
81 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, param, buf);
82 }
83
84 static void
85 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(stp_vars_tcxx . . $ stp_vars_t# *v, const char *param, double value)
86 {
87 print_remote_float_paramcxx . . $ print_remote_float_param(bd523a1c1fbe60d3).(v, param, value);
88 }
89
90 static void
91 print_debug_paramscxx . . $ print_debug_params(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
92 {
93 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
94 stp_parameter_list_tcxx . . $ stp_parameter_list_t# params = stp_get_parameter_listcxx . . $ stp_get_parameter_list(817585d40f809196).(v);
95 int count = stp_parameter_list_countcxx . . $ stp_parameter_list_count(2e8e543e1193434e).(params);
96 int i;
97 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, "Package", PACKAGEcxx . . $ `../../config.h:169:9`!);
98 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, "Version", VERSIONcxx . . $ `../../config.h:204:9`!);
99 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, "Release Date", RELEASE_DATEcxx . . $ `../../config.h:190:9`!);
100 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, "Driver", stp_get_drivercxx . . $ stp_get_driver(4be828c28602b542).(v));
101 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Left", stp_get_leftcxx . . $ stp_get_left(7f9a8d44e8193bba).(v));
102 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Top", stp_get_topcxx . . $ stp_get_top(7f9a8d44e8193bba).(v));
103 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page Width", stp_get_page_widthcxx . . $ stp_get_page_width(7f9a8d44e8193bba).(v));
104 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page Height", stp_get_page_heightcxx . . $ stp_get_page_height(7f9a8d44e8193bba).(v));
105 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Model", stp_get_model_idcxx . . $ stp_get_model_id(b1be75487ade2f93).(v));
106 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Ydpi", pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vres.);
107 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Xdpi", pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#hres.);
108 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Printed_ydpi", pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_vres.);
109 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Printed_xdpi", pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_hres.);
110 /*
111 print_remote_int_param(v, "Use_softweave", pd->res->softweave);
112 print_remote_int_param(v, "Printer_weave", pd->res->printer_weave);
113 */
114 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Use_printer_weave", pd->use_printer_weavecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_printer_weave.);
115 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Duplex", pd->duplexcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#duplex.);
116 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_left", pd->page_leftcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_left.);
117 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_right", pd->page_rightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_right.);
118 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_top", pd->page_topcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_top.);
119 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_bottom", pd->page_bottomcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_bottom.);
120 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_width", pd->page_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_width.);
121 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_height", pd->page_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_height.);
122 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_true_height", pd->page_true_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_true_height.);
123 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Page_extra_height", pd->page_extra_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_extra_height.);
124 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Paper_extra_bottom", pd->paper_extra_bottomcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#paper_extra_bottom.);
125 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Image_left", pd->image_leftcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_left.);
126 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Image_top", pd->image_topcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_top.);
127 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Image_width", pd->image_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_width.);
128 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "Image_height", pd->image_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_height.);
129 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "CD_X_offset", pd->cd_x_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#cd_x_offset.);
130 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "CD_Y_offset", pd->cd_y_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#cd_y_offset.);
131 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "CD_inner_radius", pd->cd_inner_radiuscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#cd_inner_radius.);
132 print_remote_dim_paramcxx . . $ print_remote_dim_param(bd523a1c1fbe60d3).(v, "CD_outer_radius", pd->cd_outer_radiuscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#cd_outer_radius.);
133 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Image_scaled_width", pd->image_scaled_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_scaled_width.);
134 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Image_scaled_height", pd->image_scaled_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_scaled_height.);
135 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Image_printed_width", pd->image_printed_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_printed_width.);
136 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Image_printed_height", pd->image_printed_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_printed_height.);
137 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Image_left_position", pd->image_left_positioncxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_left_position.);
138 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Nozzles", pd->nozzlescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzles.);
139 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Nozzle_separation", pd->nozzle_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzle_separation.);
140 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Horizontal_passes", pd->horizontal_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_passes.);
141 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Vertical_passes", pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vertical_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vertical_passes.);
142 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Physical_xdpi", pd->physical_xdpicxx . . $ $anonymous_type_2c59c6ae4581c18b_18#physical_xdpi.);
143 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Page_management_units", pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units.);
144 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Vertical_units", pd->vertical_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#vertical_units.);
145 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Horizontal_units", pd->horizontal_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_units.);
146 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Micro_units", pd->micro_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#micro_units.);
147 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Unit_scale", pd->unit_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#unit_scale.);
148 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Zero_advance", pd->send_zero_pass_advancecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#send_zero_pass_advance.);
149 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Bits", pd->bitwidthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bitwidth.);
150 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Drop Size", pd->drop_sizecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#drop_size.);
151 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Initial_vertical_offset", pd->initial_vertical_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#initial_vertical_offset.);
152 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Printing_initial_vertical_offset", pd->printing_initial_vertical_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printing_initial_vertical_offset.);
153 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Channels_in_use", pd->channels_in_usecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#channels_in_use.);
154 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Logical_channels", pd->logical_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#logical_channels.);
155 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Physical_channels", pd->physical_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#physical_channels.);
156 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Use_black_parameters", pd->use_black_parameterscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_black_parameters.);
157 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Use_fast_360", pd->use_fast_360cxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_fast_360.);
158 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Command_set", pd->command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#command_set.);
159 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Variable_dots", pd->variable_dotscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#variable_dots.);
160 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Has_graymode", pd->has_graymodecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#has_graymode.);
161 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Base_separation", pd->base_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#base_separation.);
162 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Resolution_scale", pd->resolution_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#resolution_scale.);
163 #if 0
164 print_remote_int_param(v, "Printing_resolution", pd->printing_resolution);
165 #endif
166 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Separation_rows", pd->separation_rowscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#separation_rows.);
167 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Pseudo_separation_rows", pd->pseudo_separation_rowscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#pseudo_separation_rows.);
168 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Extra_720dpi_separation", pd->extra_720dpi_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#extra_720dpi_separation.);
169 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, "Use_aux_channels", pd->use_aux_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_aux_channels.);
170 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, "Ink name", pd->inknamecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#inkname.->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#name.);
171 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, " channels", pd->inknamecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#inkname.->channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#channel_count.);
172 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, " inkset", pd->inknamecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#inkname.->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset.);
173 for (i = 0; i < count; i++)
174 {
175 const stp_parameter_tcxx . . $ stp_parameter_t# *p = stp_parameter_list_paramcxx . . $ stp_parameter_list_param(f24b23997c12c6a6).(params, i);
176 switch (p->p_typecxx . . $ $anonymous_type_c987533f3b833c82_8#p_type.)
177 {
178 case STP_PARAMETER_TYPE_DOUBLEcxx . . $ STP_PARAMETER_TYPE_DOUBLE.:
179 if (stp_check_float_parametercxx . . $ stp_check_float_parameter(cff2817d3dcc2695).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_DEFAULTEDcxx . . $ STP_PARAMETER_DEFAULTED.))
180 print_remote_float_paramcxx . . $ print_remote_float_param(bd523a1c1fbe60d3).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
181 stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
182 break;
183 case STP_PARAMETER_TYPE_INTcxx . . $ STP_PARAMETER_TYPE_INT.:
184 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_DEFAULTEDcxx . . $ STP_PARAMETER_DEFAULTED.))
185 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
186 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
187 break;
188 case STP_PARAMETER_TYPE_DIMENSIONcxx . . $ STP_PARAMETER_TYPE_DIMENSION.:
189 if (stp_check_dimension_parametercxx . . $ stp_check_dimension_parameter(cff2817d3dcc2695).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_DEFAULTEDcxx . . $ STP_PARAMETER_DEFAULTED.))
190 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
191 stp_get_dimension_parametercxx . . $ stp_get_dimension_parameter(ac3b1c02c916f219).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
192 break;
193 case STP_PARAMETER_TYPE_BOOLEANcxx . . $ STP_PARAMETER_TYPE_BOOLEAN.:
194 if (stp_check_boolean_parametercxx . . $ stp_check_boolean_parameter(cff2817d3dcc2695).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_DEFAULTEDcxx . . $ STP_PARAMETER_DEFAULTED.))
195 print_remote_int_paramcxx . . $ print_remote_int_param(8ec0183b6ab8ae2d).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
196 stp_get_boolean_parametercxx . . $ stp_get_boolean_parameter(b1e629819c29df09).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
197 break;
198 case STP_PARAMETER_TYPE_STRING_LISTcxx . . $ STP_PARAMETER_TYPE_STRING_LIST.:
199 if (stp_check_string_parametercxx . . $ stp_check_string_parameter(cff2817d3dcc2695).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_DEFAULTEDcxx . . $ STP_PARAMETER_DEFAULTED.))
200 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.,
201 stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
202 break;
203 case STP_PARAMETER_TYPE_CURVEcxx . . $ STP_PARAMETER_TYPE_CURVE.:
204 if (stp_check_curve_parametercxx . . $ stp_check_curve_parameter(cff2817d3dcc2695).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., STP_PARAMETER_DEFAULTEDcxx . . $ STP_PARAMETER_DEFAULTED.))
205 {
206 char *curve =
207 stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(stp_get_curve_parametercxx . . $ stp_get_curve_parameter(702e9bffd3dd1409).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name.));
208 print_remote_paramcxx . . $ print_remote_param(7405204ff890c7b8).(v, p->namecxx . . $ $anonymous_type_c987533f3b833c82_8#name., curve);
209 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(curve);
210 }
211 break;
212 default:
213 break;
214 }
215 }
216 stp_parameter_list_destroycxx . . $ stp_parameter_list_destroy(5d22bdacc48458e8).(params);
217 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033", "ccc", 0, 0, 0);
218 }
219
220 static void
221 escp2_set_remote_sequencecxx . . $ escp2_set_remote_sequence(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
222 {
223 /* Magic remote mode commands, whatever they do */
224 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
225 const stp_vars_tcxx . . $ stp_vars_t# *pv = pd->media_settingscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#media_settings.;
226
227 if (stp_get_debug_levelcxx . . $ stp_get_debug_level(f708dce9a8856c70).() & STP_DBG_MARK_FILEcxx . . $ `include/gutenprint/util.h:176:9`!)
228 print_debug_paramscxx . . $ print_debug_params(1a97b8462f9f913c).(v);
229 if (pd->advanced_command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#advanced_command_set. || pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.)
230 {
231 /* Enter remote mode */
232 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(R", "bcs", 0, "REMOTE1");
233 /* Per the manual, job setup comes first, then SN command */
234 if (pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot. &&
235 pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->roll_feed_cut_flagscxx . . $ $anonymous_type_2c59c6ae4581c18b_16#roll_feed_cut_flags. == ROLL_FEED_CUT_ALLcxx . . $ `src/main/print-escp2.h:234:9`!)
236 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "JS", "bh", 0);
237 if (pd->preinit_remote_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#preinit_remote_sequence.)
238 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->preinit_remote_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#preinit_remote_sequence., v);
239 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "FeedAdjustment", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
240 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "SN", "bccc", 0, 4,
241 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "FeedAdjustment"));
242 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "VacuumIntensity", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
243 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "SN", "bccc", 0, 5,
244 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "VacuumIntensity"));
245 if (stp_check_float_parametercxx . . $ stp_check_float_parameter(cff2817d3dcc2695).(pv, "ScanDryTime", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
246 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "DR", "bcch", 0, 0,
247 (int) (stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(pv, "ScanDryTime") * 1000));
248 if (stp_check_float_parametercxx . . $ stp_check_float_parameter(cff2817d3dcc2695).(pv, "ScanMinDryTime", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
249 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "DR", "bcch", 0, 0x40,
250 (int) (stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(pv, "ScanMinDryTime") * 1000));
251 if (stp_check_float_parametercxx . . $ stp_check_float_parameter(cff2817d3dcc2695).(pv, "PageDryTime", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
252 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "DR", "bcch", 0, 1,
253 (int) stp_get_float_parametercxx . . $ stp_get_float_parameter(ac3b1c02c916f219).(pv, "PageDryTime"));
254 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "escp2_roll_lb", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
255 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "LB", "bccc", 0, 1,
256 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "escp2_roll_lb"));
257 /* Next comes paper path */
258 if (pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.)
259 {
260 int divisor = pd->base_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#base_separation. / 360;
261 int height = pd->page_true_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_true_height. * 5 / divisor;
262 if (pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#init_sequence.)
263 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#init_sequence., v);
264 switch (pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->roll_feed_cut_flagscxx . . $ $anonymous_type_2c59c6ae4581c18b_16#roll_feed_cut_flags.)
265 {
266 case ROLL_FEED_CUT_ALLcxx . . $ `src/main/print-escp2.h:234:9`!:
267 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "CO", "bccccl", 0, 0, 1, 0, 0);
268 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "CO", "bccccl", 0, 0, 0, 0, height);
269 break;
270 case ROLL_FEED_CUT_LASTcxx . . $ `src/main/print-escp2.h:235:9`!:
271 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "CO", "bccccl", 0, 0, 1, 0, 0);
272 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "CO", "bccccl", 0, 0, 2, 0, height);
273 break;
274 default:
275 break;
276 }
277 }
278 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "PaperMedia", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
279 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "MI", "bcccc", 0, 1,
280 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "PaperMedia"),
281 (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "PaperMediaSize", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.) ?
282 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "PaperMediaSize") :
283 99)); /* User-defined size (for now!) */
284 if (pd->duplexcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#duplex.)
285 {
286 /* If there's ever duplex no tumble, we'll need to special
287 case it, too */
288 if (pd->duplexcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#duplex. == DUPLEX_TUMBLEcxx . . $ `src/main/print-escp2.h:239:9`! && pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot. && (pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->duplexcxx . . $ $anonymous_type_2c59c6ae4581c18b_16#duplex. & DUPLEX_TUMBLEcxx . . $ `src/main/print-escp2.h:239:9`!))
289 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "DP", "bcc", 0, 2); /* Auto duplex */
290 else
291 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "DP", "bcc", 0, 2); /* Auto duplex */
292 }
293 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "PaperThickness", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
294 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "PH", "bcc", 0,
295 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "PaperThickness"));
296 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "FeedSequence", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
297 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "SN", "bccc", 0, 0,
298 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "FeedSequence"));
299 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "PlatenGap", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
300 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "US", "bccc", 0, 1,
301 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "PlatenGap"));
302 if (stp_get_boolean_parametercxx . . $ stp_get_boolean_parameter(b1e629819c29df09).(v, "FullBleed"))
303 {
304 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "FP", "bch", 0,
305 (unsigned short) -pd->zero_margin_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#zero_margin_offset.);
306 if (pd->borderless_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#borderless_sequence.)
307 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->borderless_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#borderless_sequence., v);
308 }
309 if (pd->inknamecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#inkname.->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#init_sequence.)
310 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->inknamecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#inkname.->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#init_sequence., v);
311 /* Exit remote mode */
312
313 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033", "ccc", 0, 0, 0);
314 }
315 }
316
317 static void
318 escp2_set_graphics_modecxx . . $ escp2_set_graphics_mode(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
319 {
320 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(G", "bc", 1);
321 }
322
323 static void
324 escp2_set_resolutioncxx . . $ escp2_set_resolution(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
325 {
326 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
327 if (pd->use_extended_commandscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_extended_commands.)
328 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(U", "bccch",
329 pd->unit_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#unit_scale. / pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units.,
330 pd->unit_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#unit_scale. / pd->vertical_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#vertical_units.,
331 pd->unit_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#unit_scale. / pd->horizontal_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_units.,
332 pd->unit_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#unit_scale.);
333 else
334 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(U", "bc",
335 pd->unit_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#unit_scale. / pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units.);
336 }
337
338 static void
339 escp2_set_colorcxx . . $ escp2_set_color(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
340 {
341 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
342 if (pd->use_fast_360cxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_fast_360.)
343 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(K", "bcc", 0, 3);
344 else if (pd->has_graymodecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#has_graymode.)
345 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(K", "bcc", 0,
346 (pd->use_black_parameterscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_black_parameters. ? 1 : 2));
347 }
348
349 static void
350 escp2_set_printer_weavecxx . . $ escp2_set_printer_weave(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
351 {
352 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
353 if (pd->printer_weavecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printer_weave.)
354 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->printer_weavecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printer_weave., v);
355 else
356 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(i", "bc", 0);
357 }
358
359 static void
360 escp2_set_printhead_speedcxx . . $ escp2_set_printhead_speed(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
361 {
362 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
363 const char *direction = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "PrintingDirection");
364 int unidirectional = -1;
365 if (direction && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(direction, "Unidirectional") == 0)
366 unidirectional = 1;
367 else if (direction && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(direction, "Bidirectional") == 0)
368 unidirectional = 0;
369 else if (pd->bidirectional_upper_limitcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bidirectional_upper_limit. >= 0 &&
370 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_hres. * pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_vres. *
371 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vertical_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vertical_passes. >= pd->bidirectional_upper_limitcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bidirectional_upper_limit.)
372 {
373 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_ESCP2cxx . . $ `include/gutenprint/util.h:171:9`!, v,
374 "Setting unidirectional: hres %d vres %d passes %d total %d limit %d\n",
375 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_hres., pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_vres.,
376 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vertical_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vertical_passes.,
377 (pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_hres. * pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_vres. *
378 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vertical_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vertical_passes.),
379 pd->bidirectional_upper_limitcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bidirectional_upper_limit.);
380 unidirectional = 1;
381 }
382 else if (pd->bidirectional_upper_limitcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bidirectional_upper_limit. >= 0)
383 {
384 stp_dprintfcxx . . $ stp_dprintf(13526ca24396f6ac).(STP_DBG_ESCP2cxx . . $ `include/gutenprint/util.h:171:9`!, v,
385 "Setting bidirectional: hres %d vres %d passes %d total %d limit %d\n",
386 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_hres., pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_vres.,
387 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vertical_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vertical_passes.,
388 (pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_hres. * pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_vres. *
389 pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vertical_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vertical_passes.),
390 pd->bidirectional_upper_limitcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bidirectional_upper_limit.);
391 unidirectional = 0;
392 }
393 if (unidirectional == 1)
394 {
395 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033U", "c", 1);
396 if (pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#hres. > pd->physical_xdpicxx . . $ $anonymous_type_2c59c6ae4581c18b_18#physical_xdpi.)
397 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(s", "bc", 2);
398 }
399 else if (unidirectional == 0)
400 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033U", "c", 0);
401 }
402
403 static void
404 escp2_set_dot_sizecxx . . $ escp2_set_dot_size(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
405 {
406 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
407 /* Dot size */
408 if (pd->drop_sizecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#drop_size. >= 0)
409 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(e", "bcc", 0, pd->drop_sizecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#drop_size.);
410 }
411
412 static void
413 escp2_set_cuttercxx . . $ escp2_set_cutter(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
414 {
415 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
416
417 if (pd->roll_onlycxx . . $ $anonymous_type_2c59c6ae4581c18b_18#roll_only.)
418 {
419 int l = pd->page_true_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_true_height. * 2880 / 72;
420 /* always 2880, independent of configured resolutions */
421
422 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(g", "bl", l);
423 }
424 }
425
426 static void
427 escp2_set_page_heightcxx . . $ escp2_set_page_height(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
428 {
429 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
430 int l = (pd->page_true_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_true_height. + pd->paper_extra_bottomcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#paper_extra_bottom.) *
431 pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units. / 72;
432
433 if (pd->roll_onlycxx . . $ $anonymous_type_2c59c6ae4581c18b_18#roll_only.) return;
434
435 if (pd->use_extended_commandscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_extended_commands.)
436 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(C", "bl", l);
437 else
438 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(C", "bh", l);
439 }
440
441 static void
442 escp2_set_marginscxx . . $ escp2_set_margins(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
443 {
444 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
445 int bot = pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units. * pd->page_bottomcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_bottom. / 72;
446 int top = pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units. * pd->page_topcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_top. / 72;
447
448 if (pd->roll_onlycxx . . $ $anonymous_type_2c59c6ae4581c18b_18#roll_only.) return;
449
450 top += pd->initial_vertical_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#initial_vertical_offset.;
451 top -= pd->page_extra_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_extra_height.;
452 bot += pd->page_extra_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_extra_height.;
453 if (pd->use_extended_commandscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_extended_commands. &&
454 (pd->command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#command_set. == MODEL_COMMAND_2000cxx . . $ `src/main/print-escp2.h:265:9`! ||
455 pd->command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#command_set. == MODEL_COMMAND_PROcxx . . $ `src/main/print-escp2.h:266:9`!))
456 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(c", "bll", top, bot);
457 else
458 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(c", "bhh", top, bot);
459 }
460
461 static void
462 escp2_set_paper_dimensionscxx . . $ escp2_set_paper_dimensions(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
463 {
464 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
465 if (pd->advanced_command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#advanced_command_set.)
466 {
467 const stp_vars_tcxx . . $ stp_vars_t# *pv = pd->media_settingscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#media_settings.;
468 int w = pd->page_true_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_true_width. * pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units. / 72;
469 int h = (pd->page_true_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_true_height. + pd->paper_extra_bottomcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#paper_extra_bottom.) *
470 pd->page_management_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#page_management_units. / 72;
471 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(S", "bll", w, h);
472 if (stp_check_int_parametercxx . . $ stp_check_int_parameter(cff2817d3dcc2695).(pv, "PrintMethod", STP_PARAMETER_ACTIVEcxx . . $ STP_PARAMETER_ACTIVE.))
473 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(m", "bc",
474 stp_get_int_parametercxx . . $ stp_get_int_parameter(b1e629819c29df09).(pv, "PrintMethod"));
475 }
476 }
477
478 static void
479 escp2_set_printhead_resolutioncxx . . $ escp2_set_printhead_resolution(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
480 {
481 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
482 if (pd->use_extended_commandscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_extended_commands.)
483 {
484 int xres;
485 int yres = pd->resolution_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#resolution_scale.;
486
487 xres = pd->resolution_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#resolution_scale. / pd->physical_xdpicxx . . $ $anonymous_type_2c59c6ae4581c18b_18#physical_xdpi.;
488
489 if (pd->command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#command_set. == MODEL_COMMAND_PROcxx . . $ `src/main/print-escp2.h:266:9`! && pd->printer_weavecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printer_weave.)
490 yres = yres / pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#vres.;
491 else if (pd->split_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channel_count. > 1)
492 yres = yres * pd->nozzle_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzle_separation. / pd->base_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#base_separation. *
493 pd->split_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channel_count.;
494 else
495 yres = yres * pd->nozzle_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzle_separation. / pd->base_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#base_separation.;
496
497 /* Magic resolution cookie */
498 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(D", "bhcc", pd->resolution_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#resolution_scale., yres, xres);
499 }
500 }
501
502 static void
503 set_vertical_positioncxx . . $ set_vertical_position(32ea1875d035c7d1).(stp_vars_tcxx . . $ stp_vars_t# *v, stp_pass_tcxx . . $ stp_pass_t# *pass)
504 {
505 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
506 int advance = pass->logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_1#logicalpassstart. - pd->last_pass_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#last_pass_offset. -
507 (pd->separation_rowscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#separation_rows. - 1);
508 advance = advance * pd->vertical_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#vertical_units. / pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->printed_vrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#printed_vres.;
509 if (pass->logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_1#logicalpassstart. > pd->last_pass_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#last_pass_offset. ||
510 (pd->send_zero_pass_advancecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#send_zero_pass_advance. && pass->passcxx . . $ $anonymous_type_bcaa485bbb542c91_1#pass. > pd->last_passcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#last_pass.) ||
511 pd->printing_initial_vertical_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printing_initial_vertical_offset. != 0)
512 {
513 advance += pd->printing_initial_vertical_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printing_initial_vertical_offset.;
514 pd->printing_initial_vertical_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printing_initial_vertical_offset. = 0;
515 if (pd->use_extended_commandscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_extended_commands.)
516 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(v", "bl", advance);
517 else
518 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(v", "bh", advance);
519 pd->last_pass_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#last_pass_offset. = pass->logicalpassstartcxx . . $ $anonymous_type_bcaa485bbb542c91_1#logicalpassstart.;
520 pd->last_passcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#last_pass. = pass->passcxx . . $ $anonymous_type_bcaa485bbb542c91_1#pass.;
521 }
522 }
523
524 static void
525 set_colorcxx . . $ set_color(c75d0875dd895bfc).(stp_vars_tcxx . . $ stp_vars_t# *v, stp_pass_tcxx . . $ stp_pass_t# *pass, int color)
526 {
527 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
528 (void)pass;
529
530 if (pd->last_colorcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#last_color. != color && ! pd->use_extended_commandscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#use_extended_commands.)
531 {
532 int ncolor = pd->channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#channels.[color]->colorcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#color.;
533 int subchannel = pd->channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#channels.[color]->subchannelcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#subchannel.;
534 if (subchannel >= 0)
535 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(r", "bcc", subchannel, ncolor);
536 else
537 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033r", "c", ncolor);
538 pd->last_colorcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#last_color. = color;
539 }
540 }
541
542 static void
543 set_horizontal_positioncxx . . $ set_horizontal_position(c75d0875dd895bfc).(stp_vars_tcxx . . $ stp_vars_t# *v, stp_pass_tcxx . . $ stp_pass_t# *pass, int vertical_subpass)
544 {
545 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
546 int microoffset = (vertical_subpass & (pd->horizontal_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_passes. - 1)) *
547 pd->image_scaled_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_scaled_width. / pd->image_printed_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_printed_width.;
548 int pos = pd->image_left_positioncxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_left_position. + microoffset;
549 (void)pass;
550
551 if (pos != 0)
552 {
553 if (pd->command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#command_set. == MODEL_COMMAND_PROcxx . . $ `src/main/print-escp2.h:266:9`! || pd->variable_dotscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#variable_dots.)
554 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033($", "bl", pos);
555 else if (pd->advanced_command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#advanced_command_set. || pd->rescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#res.->hrescxx . . $ $anonymous_type_2c59c6ae4581c18b_3#hres. > 720)
556 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(\\", "bhh", pd->micro_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#micro_units., pos);
557 else
558 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033\\", "h", pos);
559 }
560 }
561
562 static void
563 send_print_commandcxx . . $ send_print_command(b733e48ee5cc2882).(stp_vars_tcxx . . $ stp_vars_t# *v, stp_pass_tcxx . . $ stp_pass_t# *pass, int ncolor, int nlines)
564 {
565 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
566 (void)pass;
567
568 int lwidth = (pd->image_printed_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_printed_width. + (pd->horizontal_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_passes. - 1)) /
569 pd->horizontal_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_passes.;
570 if (pd->command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#command_set. == MODEL_COMMAND_PROcxx . . $ `src/main/print-escp2.h:266:9`! || pd->variable_dotscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#variable_dots.)
571 {
572 int nwidth = pd->bitwidthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bitwidth. * ((lwidth + 7) / 8);
573 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033i", "ccchh", ncolor,
574 (stp_get_debug_levelcxx . . $ stp_get_debug_level(f708dce9a8856c70).() & STP_DBG_NO_COMPRESSIONcxx . . $ `include/gutenprint/util.h:188:9`!) ? 0 : 1,
575 pd->bitwidthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bitwidth., nwidth, nlines);
576 }
577 else
578 {
579 int ygap = 3600 / pd->vertical_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#vertical_units.;
580 int xgap = 3600 / pd->physical_xdpicxx . . $ $anonymous_type_2c59c6ae4581c18b_18#physical_xdpi.;
581 if (pd->nozzlescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzles. == 1)
582 {
583 if (pd->vertical_unitscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#vertical_units. == 720 && pd->extra_720dpi_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#extra_720dpi_separation.)
584 ygap *= pd->extra_720dpi_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#extra_720dpi_separation.;
585 }
586 else if (pd->extra_720dpi_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#extra_720dpi_separation.)
587 ygap *= pd->extra_720dpi_separationcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#extra_720dpi_separation.;
588 else if (pd->pseudo_separation_rowscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#pseudo_separation_rows. > 0)
589 ygap *= pd->pseudo_separation_rowscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#pseudo_separation_rows.;
590 else
591 ygap *= pd->separation_rowscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#separation_rows.;
592 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033.", "cccch",
593 (stp_get_debug_levelcxx . . $ stp_get_debug_level(f708dce9a8856c70).() & STP_DBG_NO_COMPRESSIONcxx . . $ `include/gutenprint/util.h:188:9`!) ? 0 : 1,
594 ygap, xgap, nlines, lwidth);
595 }
596 }
597
598 static void
599 send_extra_datacxx . . $ send_extra_data(c8b26ae77f1a10bd).(stp_vars_tcxx . . $ stp_vars_t# *v, int extralines)
600 {
601 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
602 int lwidth = (pd->image_printed_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#image_printed_width. + (pd->horizontal_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_passes. - 1)) /
603 pd->horizontal_passescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#horizontal_passes.;
604 if (stp_get_debug_levelcxx . . $ stp_get_debug_level(f708dce9a8856c70).() & STP_DBG_NO_COMPRESSIONcxx . . $ `include/gutenprint/util.h:188:9`!)
605 {
606 int i, k;
607 for (k = 0; k < extralines; k++)
608 for (i = 0; i < pd->bitwidthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bitwidth. * (lwidth + 7) / 8; i++)
609 stp_putccxx . . $ stp_putc(a57e1a3820493fb).(0, v);
610 }
611 else
612 {
613 int k, l;
614 int bytes_to_fill = pd->bitwidthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#bitwidth. * ((lwidth + 7) / 8);
615 int full_blocks = bytes_to_fill / 128;
616 int leftover = bytes_to_fill % 128;
617 int total_bytes = extralines * (full_blocks + 1) * 2;
618 unsigned char *buf = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(total_bytes);
619 total_bytes = 0;
620 for (k = 0; k < extralines; k++)
621 {
622 for (l = 0; l < full_blocks; l++)
623 {
624 buf[total_bytes++] = 129;
625 buf[total_bytes++] = 0;
626 }
627 if (leftover == 1)
628 {
629 buf[total_bytes++] = 1;
630 buf[total_bytes++] = 0;
631 }
632 else if (leftover > 0)
633 {
634 buf[total_bytes++] = 257 - leftover;
635 buf[total_bytes++] = 0;
636 }
637 }
638 stp_zfwritecxx . . $ stp_zfwrite(e7e85bda1a353e8c).((const char *) buf, total_bytes, 1, v);
639 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(buf);
640 }
641 }
642
643 void
644 stpi_escp2_init_printercxx . . $ stpi_escp2_init_printer(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
645 {
646 escp2_reset_printercxx . . $ escp2_reset_printer(1a97b8462f9f913c).(v);
647 escp2_set_remote_sequencecxx . . $ escp2_set_remote_sequence(1a97b8462f9f913c).(v);
648 escp2_set_graphics_modecxx . . $ escp2_set_graphics_mode(1a97b8462f9f913c).(v);
649 escp2_set_resolutioncxx . . $ escp2_set_resolution(1a97b8462f9f913c).(v);
650 escp2_set_colorcxx . . $ escp2_set_color(1a97b8462f9f913c).(v);
651 escp2_set_printer_weavecxx . . $ escp2_set_printer_weave(1a97b8462f9f913c).(v);
652 escp2_set_printhead_speedcxx . . $ escp2_set_printhead_speed(1a97b8462f9f913c).(v);
653 escp2_set_dot_sizecxx . . $ escp2_set_dot_size(1a97b8462f9f913c).(v);
654 escp2_set_cuttercxx . . $ escp2_set_cutter(1a97b8462f9f913c).(v);
655 escp2_set_printhead_resolutioncxx . . $ escp2_set_printhead_resolution(1a97b8462f9f913c).(v);
656 escp2_set_page_heightcxx . . $ escp2_set_page_height(1a97b8462f9f913c).(v);
657 escp2_set_marginscxx . . $ escp2_set_margins(1a97b8462f9f913c).(v);
658 escp2_set_paper_dimensionscxx . . $ escp2_set_paper_dimensions(1a97b8462f9f913c).(v);
659 }
660
661 void
662 stpi_escp2_deinit_printercxx . . $ stpi_escp2_deinit_printer(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
663 {
664 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
665 stp_putscxx . . $ stp_puts(35a89ecf160f646a).("\033@", v); /* ESC/P2 reset */
666 if (pd->advanced_command_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#advanced_command_set. || pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.)
667 {
668 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033(R", "bcs", 0, "REMOTE1");
669 if (pd->inknamecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#inkname.->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#deinit_sequence.)
670 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->inknamecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#inkname.->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#deinit_sequence., v);
671 if (pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot. && pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#deinit_sequence.)
672 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#deinit_sequence., v);
673 /* Load settings from NVRAM */
674 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "LD", "b");
675
676 /* Magic deinit sequence reported by Simone Falsini */
677 if (pd->deinit_remote_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#deinit_remote_sequence.)
678 stp_write_rawcxx . . $ stp_write_raw(9db79402c27454b9).(pd->deinit_remote_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#deinit_remote_sequence., v);
679 /* Exit remote mode */
680 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\033", "ccc", 0, 0, 0);
681 }
682 }
683
684 void
685 stpi_escp2_flush_passcxx . . $ stpi_escp2_flush_pass(9e1f5dddaee1574e).(stp_vars_tcxx . . $ stp_vars_t# *v, int passno, int vertical_subpass)
686 {
687 int j;
688 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
689 stp_lineoff_tcxx . . $ stp_lineoff_t# *lineoffs = stp_get_lineoffsets_by_passcxx . . $ stp_get_lineoffsets_by_pass(76405e8e39d7c090).(v, passno);
690 stp_lineactive_tcxx . . $ stp_lineactive_t# *lineactive = stp_get_lineactive_by_passcxx . . $ stp_get_lineactive_by_pass(9c74d4d92755b24).(v, passno);
691 const stp_linebufs_tcxx . . $ stp_linebufs_t# *bufs = stp_get_linebases_by_passcxx . . $ stp_get_linebases_by_pass(bb0e838850c47750).(v, passno);
692 stp_pass_tcxx . . $ stp_pass_t# *pass = stp_get_pass_by_passcxx . . $ stp_get_pass_by_pass(497f042961eb7c51).(v, passno);
693 stp_linecount_tcxx . . $ stp_linecount_t# *linecount = stp_get_linecount_by_passcxx . . $ stp_get_linecount_by_pass(609db6c57e04d78).(v, passno);
694 int minlines = pd->min_nozzlescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#min_nozzles.;
695 int nozzle_start = pd->nozzle_startcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzle_start.;
696
697 for (j = 0; j < pd->channels_in_usecxx . . $ $anonymous_type_2c59c6ae4581c18b_18#channels_in_use.; j++)
698 {
699 if (lineactive->vcxx . . $ $anonymous_type_bcaa485bbb542c91_3#v.[j] > 0)
700 {
701 int ncolor = pd->channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#channels.[j]->colorcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#color.;
702 int subchannel = pd->channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#channels.[j]->subchannelcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#subchannel.;
703 int nlines = linecount->vcxx . . $ $anonymous_type_bcaa485bbb542c91_4#v.[j];
704 int extralines = 0;
705 set_vertical_positioncxx . . $ set_vertical_position(32ea1875d035c7d1).(v, pass);
706 set_colorcxx . . $ set_color(c75d0875dd895bfc).(v, pass, j);
707 if (subchannel >= 0)
708 ncolor |= (subchannel << 4);
709
710 if (pd->split_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channels.)
711 {
712 int sc = pd->split_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channel_count.;
713 int k, l;
714 int minlines_lo, nozzle_start_lo;
715 minlines /= sc;
716 nozzle_start /= sc;
717 minlines_lo = pd->min_nozzlescxx . . $ $anonymous_type_2c59c6ae4581c18b_18#min_nozzles. - (minlines * sc);
718 nozzle_start_lo = pd->nozzle_startcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzle_start. - (nozzle_start * sc);
719 for (k = 0; k < sc; k++)
720 {
721 int ml = minlines + (k < minlines_lo ? 1 : 0);
722 int ns = nozzle_start + (k < nozzle_start_lo ? 1 : 0);
723 int lc = ((nlines + (sc - k - 1)) / sc);
724 int base = (pd->nozzle_startcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#nozzle_start. + k) % sc;
725 if (lc < ml)
726 extralines = ml - lc;
727 else
728 extralines = 0;
729 extralines -= ns;
730 if (extralines < 0)
731 extralines = 0;
732 if (lc + extralines > 0)
733 {
734 int sc_off = k + j * sc;
735 set_horizontal_positioncxx . . $ set_horizontal_position(c75d0875dd895bfc).(v, pass, vertical_subpass);
736 send_print_commandcxx . . $ send_print_command(b733e48ee5cc2882).(v, pass, pd->split_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channels.[sc_off],
737 lc + extralines + ns);
738 if (ns > 0)
739 send_extra_datacxx . . $ send_extra_data(c8b26ae77f1a10bd).(v, ns);
740 for (l = 0; l < lc; l++)
741 {
742 int sp = (l * sc) + base;
743 unsigned long offset = sp * pd->split_channel_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channel_width.;
744 if (!(stp_get_debug_levelcxx . . $ stp_get_debug_level(f708dce9a8856c70).() & STP_DBG_NO_COMPRESSIONcxx . . $ `include/gutenprint/util.h:188:9`!))
745 {
746 unsigned char *comp_ptr;
747 stp_pack_tiffcxx . . $ stp_pack_tiff(89b35e14f2325ba5).(v, bufs->vcxx . . $ $anonymous_type_bcaa485bbb542c91_5#v.[j] + offset,
748 pd->split_channel_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channel_width.,
749 pd->comp_bufcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#comp_buf., &comp_ptr, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
750 stp_zfwritecxx . . $ stp_zfwrite(e7e85bda1a353e8c).((const char *) pd->comp_bufcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#comp_buf.,
751 comp_ptr - pd->comp_bufcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#comp_buf., 1, v);
752 }
753 else
754 stp_zfwritecxx . . $ stp_zfwrite(e7e85bda1a353e8c).((const char *) bufs->vcxx . . $ $anonymous_type_bcaa485bbb542c91_5#v.[j] + offset,
755 pd->split_channel_widthcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#split_channel_width., 1, v);
756 }
757 if (extralines > 0)
758 send_extra_datacxx . . $ send_extra_data(c8b26ae77f1a10bd).(v, extralines);
759 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\r", "");
760 }
761 }
762 }
763 else
764 {
765 set_horizontal_positioncxx . . $ set_horizontal_position(c75d0875dd895bfc).(v, pass, vertical_subpass);
766 if (nlines < minlines)
767 {
768 extralines = minlines - nlines;
769 nlines = minlines;
770 }
771 send_print_commandcxx . . $ send_print_command(b733e48ee5cc2882).(v, pass, ncolor, nlines);
772 extralines -= nozzle_start;
773 /*
774 * Send the data
775 */
776 if (nozzle_start)
777 send_extra_datacxx . . $ send_extra_data(c8b26ae77f1a10bd).(v, nozzle_start);
778 stp_zfwritecxx . . $ stp_zfwrite(e7e85bda1a353e8c).((const char *)bufs->vcxx . . $ $anonymous_type_bcaa485bbb542c91_5#v.[j], lineoffs->vcxx . . $ $anonymous_type_bcaa485bbb542c91_2#v.[j], 1, v);
779 if (extralines > 0)
780 send_extra_datacxx . . $ send_extra_data(c8b26ae77f1a10bd).(v, extralines);
781 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\r", "");
782 }
783 pd->printed_somethingcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printed_something. = 1;
784 }
785 lineoffs->vcxx . . $ $anonymous_type_bcaa485bbb542c91_2#v.[j] = 0;
786 linecount->vcxx . . $ $anonymous_type_bcaa485bbb542c91_4#v.[j] = 0;
787 }
788 }
789
790 void
791 stpi_escp2_terminate_pagecxx . . $ stpi_escp2_terminate_page(1a97b8462f9f913c).(stp_vars_tcxx . . $ stp_vars_t# *v)
792 {
793 escp2_privdata_tcxx . . $ escp2_privdata_t# *pd = get_privdatacxx . . $ get_privdata(813564ee0a5bc36f).(v);
794 if (!pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot. ||
795 !(pd->input_slotcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#input_slot.->roll_feed_cut_flagscxx . . $ $anonymous_type_2c59c6ae4581c18b_16#roll_feed_cut_flags. & ROLL_FEED_DONT_EJECTcxx . . $ `src/main/print-escp2.h:236:9`!))
796 {
797 if (!pd->printed_somethingcxx . . $ $anonymous_type_2c59c6ae4581c18b_18#printed_something.)
798 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\n", "");
799 stp_send_commandcxx . . $ stp_send_command(6c1d4952f19f3c82).(v, "\f", ""); /* Eject page */
800 }
801 }