| 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 eral 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 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 23 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 24 | #endif |
| 25 | #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/ |
| 26 | #include "gutenprint-internal.h"cxx . . $ `<file>/src/main/gutenprint-internal.h`/ |
| 27 | #include <gutenprint/gutenprint-intl-internal.h>cxx . . $ `<file>/include/gutenprint/gutenprint-intl-internal.h`/ |
| 28 | #include <strings.h> |
| 29 | #include "print-escp2.h"cxx . . $ `<file>/src/main/print-escp2.h`/ |
| 30 | |
| 31 | static stp_mxml_node_tcxx . . $ stp_mxml_node_t# * |
| 32 | get_media_size_xmlcxx . . $ get_media_size_xml(4499d7fd62d041e8).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 33 | { |
| 34 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 35 | return printdef->media_sizescxx . . $ escp2_printer#media_sizes.; |
| 36 | } |
| 37 | |
| 38 | int |
| 39 | stpi_escp2_load_media_sizescxx . . $ stpi_escp2_load_media_sizes(b1e629819c29df09).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name) |
| 40 | { |
| 41 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 42 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = |
| 43 | stp_xml_parse_file_from_path_safecxx . . $ stp_xml_parse_file_from_path_safe(5a8029715312b5a0).(name, "escp2MediaSizes", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 44 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# **xnode = (stp_mxml_node_tcxx . . $ stp_mxml_node_t# **) &(printdef->media_sizescxx . . $ escp2_printer#media_sizes.); |
| 45 | *xnode = node; |
| 46 | return 1; |
| 47 | } |
| 48 | |
| 49 | void |
| 50 | stpi_escp2_set_media_sizecxx . . $ stpi_escp2_set_media_size(352fcd689be2d739).(stp_vars_tcxx . . $ stp_vars_t# *v, const stp_vars_tcxx . . $ stp_vars_t# *src) |
| 51 | { |
| 52 | const char *name = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(src, "PageSize"); |
| 53 | if (name) |
| 54 | { |
| 55 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = get_media_size_xmlcxx . . $ get_media_size_xml(4499d7fd62d041e8).(src); |
| 56 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *xnode = stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(node, node, "MediaSize", |
| 57 | "name", name, STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 58 | if (xnode) |
| 59 | { |
| 60 | stp_vars_fill_from_xmltree_refcxx . . $ stp_vars_fill_from_xmltree_ref(3a5b38a25339ac9d).(xnode->childcxx . . $ stp_mxml_node_s#child., node, v); |
| 61 | return; |
| 62 | } |
| 63 | xnode = stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(node, node, "MediaSize", "type", "default", |
| 64 | STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 65 | if (xnode) |
| 66 | { |
| 67 | stp_vars_fill_from_xmltree_refcxx . . $ stp_vars_fill_from_xmltree_ref(3a5b38a25339ac9d).(xnode->childcxx . . $ stp_mxml_node_s#child., node, v); |
| 68 | return; |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | static const char * |
| 74 | paper_namefunccxx . . $ paper_namefunc(6271d96ae060557f).(const void *item) |
| 75 | { |
| 76 | const paper_tcxx . . $ paper_t# *p = (const paper_tcxx . . $ paper_t# *) (item); |
| 77 | return p->cnamecxx . . $ $anonymous_type_2c59c6ae4581c18b_1#cname.; |
| 78 | } |
| 79 | |
| 80 | int |
| 81 | stpi_escp2_load_mediacxx . . $ stpi_escp2_load_media(b1e629819c29df09).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name) |
| 82 | { |
| 83 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 84 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = |
| 85 | stp_xml_parse_file_from_path_safecxx . . $ stp_xml_parse_file_from_path_safe(5a8029715312b5a0).(name, "escp2Papers", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 86 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# **xnode = (stp_mxml_node_tcxx . . $ stp_mxml_node_t# **) &(printdef->mediacxx . . $ escp2_printer#media.); |
| 87 | stp_list_tcxx . . $ stp_list_t# **xcache = (stp_list_tcxx . . $ stp_list_t# **) &(printdef->media_cachecxx . . $ escp2_printer#media_cache.); |
| 88 | stp_string_list_tcxx . . $ stp_string_list_t# **xpapers = (stp_string_list_tcxx . . $ stp_string_list_t# **) &(printdef->paperscxx . . $ escp2_printer#papers.); |
| 89 | static const char *xcache_cache = "escp2Papers_xcache"; |
| 90 | static const char *xpapers_cache = "escp2Papers_xpapers"; |
| 91 | *xnode = node->parentcxx . . $ stp_mxml_node_s#parent.; |
| 92 | *xcache = (stp_list_tcxx . . $ stp_list_t# *) stp_refcache_find_itemcxx . . $ stp_refcache_find_item(12e6862c879384a7).(xcache_cache, name); |
| 93 | if (! *xcache) |
| 94 | { |
| 95 | *xcache = stp_list_createcxx . . $ stp_list_create(728167c67729d082).(); |
| 96 | stp_list_set_namefunccxx . . $ stp_list_set_namefunc(83503c4472347457).(*xcache, paper_namefunccxx . . $ paper_namefunc(6271d96ae060557f).); |
| 97 | stp_refcache_add_itemcxx . . $ stp_refcache_add_item(285a709643be31b2).(xcache_cache, name, *xcache); |
| 98 | } |
| 99 | *xpapers = (stp_string_list_tcxx . . $ stp_string_list_t# *) stp_refcache_find_itemcxx . . $ stp_refcache_find_item(12e6862c879384a7).(xpapers_cache, name); |
| 100 | if (! *xpapers) |
| 101 | { |
| 102 | *xpapers = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).(); |
| 103 | stp_refcache_add_itemcxx . . $ stp_refcache_add_item(285a709643be31b2).(xpapers_cache, name, *xpapers); |
| 104 | node = node->childcxx . . $ stp_mxml_node_s#child.; |
| 105 | while (node) |
| 106 | { |
| 107 | if (node->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 108 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(node->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "paper") == 0) |
| 109 | stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(*xpapers, |
| 110 | stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"), |
| 111 | stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "text")); |
| 112 | node = node->nextcxx . . $ stp_mxml_node_s#next.; |
| 113 | } |
| 114 | } |
| 115 | return 1; |
| 116 | } |
| 117 | |
| 118 | static stp_mxml_node_tcxx . . $ stp_mxml_node_t# * |
| 119 | get_media_xmlcxx . . $ get_media_xml(4499d7fd62d041e8).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 120 | { |
| 121 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 122 | return printdef->mediacxx . . $ escp2_printer#media.; |
| 123 | } |
| 124 | |
| 125 | static stp_list_tcxx . . $ stp_list_t# * |
| 126 | get_media_cachecxx . . $ get_media_cache(5e6f71de429136ff).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 127 | { |
| 128 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 129 | return printdef->media_cachecxx . . $ escp2_printer#media_cache.; |
| 130 | } |
| 131 | |
| 132 | int |
| 133 | stpi_escp2_has_media_featurecxx . . $ stpi_escp2_has_media_feature(b1e629819c29df09).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name) |
| 134 | { |
| 135 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *doc = get_media_xmlcxx . . $ get_media_xml(4499d7fd62d041e8).(v); |
| 136 | if (doc) |
| 137 | return (stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(doc, doc, "feature", "name", name, |
| 138 | STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 139 | else |
| 140 | return 0; |
| 141 | } |
| 142 | |
| 143 | |
| 144 | static paper_tcxx . . $ paper_t# * |
| 145 | build_media_typecxx . . $ build_media_type(475986576c8ea52c).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name, const inklist_tcxx . . $ inklist_t# *ink, |
| 146 | const res_tcxx . . $ res_t# *res) |
| 147 | { |
| 148 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node; |
| 149 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *doc = get_media_xmlcxx . . $ get_media_xml(4499d7fd62d041e8).(v); |
| 150 | const char *pclass; |
| 151 | paper_tcxx . . $ paper_t# *answer; |
| 152 | stp_vars_tcxx . . $ stp_vars_t# *vv = stp_vars_createcxx . . $ stp_vars_create(ca9164ca858eeb6f).(); |
| 153 | if (!doc) |
| 154 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 155 | node = stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(doc, doc, "paper", "name", name, STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 156 | if (!node) |
| 157 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 158 | answer = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(paper_tcxx . . $ paper_t#)); |
| 159 | answer->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_1#name. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"); |
| 160 | answer->textcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#text. = gettextcxx . . $ `include/gutenprint/gutenprint-intl-internal.h:61:11`!(stp_mxmlElementGetAttr(node, "text")); |
| 161 | pclass = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "class"); |
| 162 | answer->vcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#v. = vv; |
| 163 | if (! pclass || strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(pclass, "plain") == 0) |
| 164 | answer->paper_classcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#paper_class. = PAPER_PLAINcxx . . $ PAPER_PLAIN.; |
| 165 | else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(pclass, "good") == 0) |
| 166 | answer->paper_classcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#paper_class. = PAPER_GOODcxx . . $ PAPER_GOOD.; |
| 167 | else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(pclass, "photo") == 0) |
| 168 | answer->paper_classcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#paper_class. = PAPER_PHOTOcxx . . $ PAPER_PHOTO.; |
| 169 | else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(pclass, "premium") == 0) |
| 170 | answer->paper_classcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#paper_class. = PAPER_PREMIUM_PHOTOcxx . . $ PAPER_PREMIUM_PHOTO.; |
| 171 | else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(pclass, "transparency") == 0) |
| 172 | answer->paper_classcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#paper_class. = PAPER_TRANSPARENCYcxx . . $ PAPER_TRANSPARENCY.; |
| 173 | else |
| 174 | answer->paper_classcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#paper_class. = PAPER_PLAINcxx . . $ PAPER_PLAIN.; |
| 175 | answer->preferred_ink_typecxx . . $ $anonymous_type_2c59c6ae4581c18b_1#preferred_ink_type. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "PreferredInktype"); |
| 176 | answer->preferred_ink_setcxx . . $ $anonymous_type_2c59c6ae4581c18b_1#preferred_ink_set. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "PreferredInkset"); |
| 177 | stp_vars_fill_from_xmltree_refcxx . . $ stp_vars_fill_from_xmltree_ref(3a5b38a25339ac9d).(node->childcxx . . $ stp_mxml_node_s#child., doc, vv); |
| 178 | if (ink && ink->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#name.) |
| 179 | { |
| 180 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *inknode = stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(node, node, "ink", |
| 181 | "name", ink->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#name., |
| 182 | STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 183 | STPI_ASSERTcxx . . $ `src/main/gutenprint-internal.h:58:9`!(inknode, v); |
| 184 | stp_vars_fill_from_xmltree_refcxx . . $ stp_vars_fill_from_xmltree_ref(3a5b38a25339ac9d).(inknode->childcxx . . $ stp_mxml_node_s#child., doc, vv); |
| 185 | } |
| 186 | if (res && res->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_3#name.) |
| 187 | { |
| 188 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *resnode = stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(node, node, "resolution", |
| 189 | "name", res->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_3#name., |
| 190 | STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 191 | if (resnode) |
| 192 | stp_vars_fill_from_xmltree_refcxx . . $ stp_vars_fill_from_xmltree_ref(3a5b38a25339ac9d).(resnode->childcxx . . $ stp_mxml_node_s#child., doc, vv); |
| 193 | } |
| 194 | return answer; |
| 195 | } |
| 196 | |
| 197 | static char * |
| 198 | build_media_idcxx . . $ build_media_id(42b5a6eb31882b58).(const char *name, const inklist_tcxx . . $ inklist_t# *ink, const res_tcxx . . $ res_t# *res) |
| 199 | { |
| 200 | char *answer; |
| 201 | stp_asprintfcxx . . $ stp_asprintf(816f0239e6d49b84).(&answer, "%s %s %s", |
| 202 | name, |
| 203 | ink ? ink->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#name. : "", |
| 204 | res ? res->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_3#name. : ""); |
| 205 | return answer; |
| 206 | } |
| 207 | |
| 208 | static const paper_tcxx . . $ paper_t# * |
| 209 | get_media_type_namedcxx . . $ get_media_type_named(6b011b374639c080).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name, |
| 210 | int ignore_res) |
| 211 | { |
| 212 | paper_tcxx . . $ paper_t# *answer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 213 | int i; |
| 214 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 215 | const stp_string_list_tcxx . . $ stp_string_list_t# *p = printdef->paperscxx . . $ escp2_printer#papers.; |
| 216 | const res_tcxx . . $ res_t# *res = ignore_res ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! : stpi_escp2_find_resolutioncxx . . $ stpi_escp2_find_resolution(55b4fe1aaf711d8c).(v); |
| 217 | const inklist_tcxx . . $ inklist_t# *inklist = stpi_escp2_inklistcxx . . $ stpi_escp2_inklist(da36bbf87ae9f85d).(v); |
| 218 | char *media_id = build_media_idcxx . . $ build_media_id(42b5a6eb31882b58).(name, inklist, res); |
| 219 | stp_list_tcxx . . $ stp_list_t# *cache = get_media_cachecxx . . $ get_media_cache(5e6f71de429136ff).(v); |
| 220 | stp_list_item_tcxx . . $ stp_list_item_t# *li = stp_list_get_item_by_namecxx . . $ stp_list_get_item_by_name(27765cfe86595311).(cache, media_id); |
| 221 | if (li) |
| 222 | { |
| 223 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(media_id); |
| 224 | answer = (paper_tcxx . . $ paper_t# *) stp_list_item_get_datacxx . . $ stp_list_item_get_data(9a5daa75441a53b5).(li); |
| 225 | } |
| 226 | else |
| 227 | { |
| 228 | int paper_type_count = stp_string_list_countcxx . . $ stp_string_list_count(53b7214102d1daf6).(p); |
| 229 | for (i = 0; i < paper_type_count; i++) |
| 230 | { |
| 231 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(p, i)->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.)) |
| 232 | { |
| 233 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 234 | answer = build_media_typecxx . . $ build_media_type(475986576c8ea52c).(v, name, inklist, res); |
| 235 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 236 | break; |
| 237 | } |
| 238 | } |
| 239 | if (answer) |
| 240 | { |
| 241 | answer->cnamecxx . . $ $anonymous_type_2c59c6ae4581c18b_1#cname. = media_id; |
| 242 | stp_list_item_createcxx . . $ stp_list_item_create(54f08bf465e39eec).(cache, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, answer); |
| 243 | } |
| 244 | } |
| 245 | return answer; |
| 246 | } |
| 247 | |
| 248 | const paper_tcxx . . $ paper_t# * |
| 249 | stpi_escp2_get_media_typecxx . . $ stpi_escp2_get_media_type(6cc0b3da11fb7968).(const stp_vars_tcxx . . $ stp_vars_t# *v, int ignore_res) |
| 250 | { |
| 251 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 252 | const stp_string_list_tcxx . . $ stp_string_list_t# *p = printdef->paperscxx . . $ escp2_printer#papers.; |
| 253 | if (p) |
| 254 | { |
| 255 | const char *name = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "MediaType"); |
| 256 | if (name) |
| 257 | return get_media_type_namedcxx . . $ get_media_type_named(6b011b374639c080).(v, name, ignore_res); |
| 258 | } |
| 259 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 260 | } |
| 261 | |
| 262 | const paper_tcxx . . $ paper_t# * |
| 263 | stpi_escp2_get_default_media_typecxx . . $ stpi_escp2_get_default_media_type(20073b5b5be389a1).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 264 | { |
| 265 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 266 | const stp_string_list_tcxx . . $ stp_string_list_t# *p = printdef->paperscxx . . $ escp2_printer#papers.; |
| 267 | if (p) |
| 268 | { |
| 269 | int paper_type_count = stp_string_list_countcxx . . $ stp_string_list_count(53b7214102d1daf6).(p); |
| 270 | if (paper_type_count >= 0) |
| 271 | return get_media_type_namedcxx . . $ get_media_type_named(6b011b374639c080).(v, stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(p, 0)->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name., 1); |
| 272 | } |
| 273 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 274 | } |
| 275 | |
| 276 | |
| 277 | static const char * |
| 278 | slots_namefunccxx . . $ slots_namefunc(6271d96ae060557f).(const void *item) |
| 279 | { |
| 280 | const input_slot_tcxx . . $ input_slot_t# *p = (const input_slot_tcxx . . $ input_slot_t# *) (item); |
| 281 | return p->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#name.; |
| 282 | } |
| 283 | |
| 284 | int |
| 285 | stpi_escp2_load_input_slotscxx . . $ stpi_escp2_load_input_slots(b1e629819c29df09).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name) |
| 286 | { |
| 287 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 288 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = |
| 289 | stp_xml_parse_file_from_path_safecxx . . $ stp_xml_parse_file_from_path_safe(5a8029715312b5a0).(name, "escp2InputSlots", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 290 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# **xnode = (stp_mxml_node_tcxx . . $ stp_mxml_node_t# **) &(printdef->slotscxx . . $ escp2_printer#slots.); |
| 291 | stp_list_tcxx . . $ stp_list_t# **xcache = (stp_list_tcxx . . $ stp_list_t# **) &(printdef->slots_cachecxx . . $ escp2_printer#slots_cache.); |
| 292 | stp_string_list_tcxx . . $ stp_string_list_t# **xslots = (stp_string_list_tcxx . . $ stp_string_list_t# **) &(printdef->input_slotscxx . . $ escp2_printer#input_slots.); |
| 293 | static const char *xcache_cache = "escp2InputSlots_xcache"; |
| 294 | static const char *xslots_cache = "escp2InputSlots_slots"; |
| 295 | |
| 296 | *xnode = node->parentcxx . . $ stp_mxml_node_s#parent.; |
| 297 | *xcache = (stp_list_tcxx . . $ stp_list_t# *) stp_refcache_find_itemcxx . . $ stp_refcache_find_item(12e6862c879384a7).(xcache_cache, name); |
| 298 | if (! *xcache) |
| 299 | { |
| 300 | *xcache = stp_list_createcxx . . $ stp_list_create(728167c67729d082).(); |
| 301 | stp_list_set_namefunccxx . . $ stp_list_set_namefunc(83503c4472347457).(*xcache, slots_namefunccxx . . $ slots_namefunc(6271d96ae060557f).); |
| 302 | stp_refcache_add_itemcxx . . $ stp_refcache_add_item(285a709643be31b2).(xcache_cache, name, *xcache); |
| 303 | } |
| 304 | |
| 305 | *xslots = (stp_string_list_tcxx . . $ stp_string_list_t# *) stp_refcache_find_itemcxx . . $ stp_refcache_find_item(12e6862c879384a7).(xslots_cache, name); |
| 306 | if (! *xslots) |
| 307 | { |
| 308 | *xslots = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).(); |
| 309 | stp_refcache_add_itemcxx . . $ stp_refcache_add_item(285a709643be31b2).(xslots_cache, name, *xslots); |
| 310 | node = node->childcxx . . $ stp_mxml_node_s#child.; |
| 311 | while (node) |
| 312 | { |
| 313 | if (node->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 314 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(node->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "slot") == 0) |
| 315 | stp_string_list_add_stringcxx . . $ stp_string_list_add_string(61ec312b340c2952).(*xslots, |
| 316 | stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"), |
| 317 | stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "text")); |
| 318 | node = node->nextcxx . . $ stp_mxml_node_s#next.; |
| 319 | } |
| 320 | } |
| 321 | return 1; |
| 322 | } |
| 323 | |
| 324 | static stp_mxml_node_tcxx . . $ stp_mxml_node_t# * |
| 325 | get_slots_xmlcxx . . $ get_slots_xml(4499d7fd62d041e8).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 326 | { |
| 327 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 328 | return printdef->slotscxx . . $ escp2_printer#slots.; |
| 329 | } |
| 330 | |
| 331 | static stp_list_tcxx . . $ stp_list_t# * |
| 332 | get_slots_cachecxx . . $ get_slots_cache(5e6f71de429136ff).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 333 | { |
| 334 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 335 | return printdef->slots_cachecxx . . $ escp2_printer#slots_cache.; |
| 336 | } |
| 337 | |
| 338 | static input_slot_tcxx . . $ input_slot_t# * |
| 339 | build_input_slotcxx . . $ build_input_slot(e421c8e33b480653).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name) |
| 340 | { |
| 341 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, *n1; |
| 342 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *doc = get_slots_xmlcxx . . $ get_slots_xml(4499d7fd62d041e8).(v); |
| 343 | input_slot_tcxx . . $ input_slot_t# *answer; |
| 344 | if (!doc) |
| 345 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 346 | node = stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(doc, doc, "slot", "name", name, STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 347 | if (!node) |
| 348 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 349 | answer = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(input_slot_tcxx . . $ input_slot_t#)); |
| 350 | answer->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#name. = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"); |
| 351 | answer->textcxx . . $ $anonymous_type_2c59c6ae4581c18b_16#text. = gettextcxx . . $ `include/gutenprint/gutenprint-intl-internal.h:61:11`!(stp_mxmlElementGetAttr(node, "text")); |
| 352 | n1 = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "CD", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 353 | if (n1) |
| 354 | answer->is_cdcxx . . $ $anonymous_type_2c59c6ae4581c18b_16#is_cd. = 1; |
| 355 | n1 = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "RollFeed", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 356 | if (n1) |
| 357 | { |
| 358 | answer->is_roll_feedcxx . . $ $anonymous_type_2c59c6ae4581c18b_16#is_roll_feed. = 1; |
| 359 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(n1, "CutAll", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 360 | answer->roll_feed_cut_flagscxx . . $ $anonymous_type_2c59c6ae4581c18b_16#roll_feed_cut_flags. |= ROLL_FEED_CUT_ALLcxx . . $ `src/main/print-escp2.h:234:9`!; |
| 361 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(n1, "CutLast", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 362 | answer->roll_feed_cut_flagscxx . . $ $anonymous_type_2c59c6ae4581c18b_16#roll_feed_cut_flags. |= ROLL_FEED_CUT_LASTcxx . . $ `src/main/print-escp2.h:235:9`!; |
| 363 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(n1, "DontEject", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 364 | answer->roll_feed_cut_flagscxx . . $ $anonymous_type_2c59c6ae4581c18b_16#roll_feed_cut_flags. |= ROLL_FEED_DONT_EJECTcxx . . $ `src/main/print-escp2.h:236:9`!; |
| 365 | } |
| 366 | n1 = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "Duplex", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 367 | if (n1) |
| 368 | { |
| 369 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(n1, "Tumble", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 370 | answer->duplexcxx . . $ $anonymous_type_2c59c6ae4581c18b_16#duplex. |= DUPLEX_TUMBLEcxx . . $ `src/main/print-escp2.h:239:9`!; |
| 371 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(n1, "NoTumble", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 372 | answer->duplexcxx . . $ $anonymous_type_2c59c6ae4581c18b_16#duplex. |= DUPLEX_NO_TUMBLEcxx . . $ `src/main/print-escp2.h:238:9`!; |
| 373 | } |
| 374 | n1 = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "InitSequence", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 375 | if (n1 && n1->childcxx . . $ stp_mxml_node_s#child. && n1->childcxx . . $ stp_mxml_node_s#child.->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 376 | answer->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#init_sequence. = stp_xmlstrtorawcxx . . $ stp_xmlstrtoraw(62ebf526a09225cc).(n1->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string.); |
| 377 | n1 = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "DeinitSequence", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 378 | if (n1 && n1->childcxx . . $ stp_mxml_node_s#child. && n1->childcxx . . $ stp_mxml_node_s#child.->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 379 | answer->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_16#deinit_sequence. = stp_xmlstrtorawcxx . . $ stp_xmlstrtoraw(62ebf526a09225cc).(n1->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string.); |
| 380 | n1 = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "ExtraHeight", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 381 | if (n1 && n1->childcxx . . $ stp_mxml_node_s#child. && n1->childcxx . . $ stp_mxml_node_s#child.->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 382 | answer->extra_heightcxx . . $ $anonymous_type_2c59c6ae4581c18b_16#extra_height. = stp_xmlstrtoulcxx . . $ stp_xmlstrtoul(751346f8406fd082).(n1->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string.); |
| 383 | return answer; |
| 384 | } |
| 385 | |
| 386 | int |
| 387 | stpi_escp2_printer_supports_rollfeedcxx . . $ stpi_escp2_printer_supports_rollfeed(b1be75487ade2f93).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 388 | { |
| 389 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = get_slots_xmlcxx . . $ get_slots_xml(4499d7fd62d041e8).(v); |
| 390 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "RollFeed", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 391 | return 1; |
| 392 | else |
| 393 | return 0; |
| 394 | } |
| 395 | |
| 396 | int |
| 397 | stpi_escp2_printer_supports_print_to_cdcxx . . $ stpi_escp2_printer_supports_print_to_cd(b1be75487ade2f93).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 398 | { |
| 399 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = get_slots_xmlcxx . . $ get_slots_xml(4499d7fd62d041e8).(v); |
| 400 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "CD", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 401 | return 1; |
| 402 | else |
| 403 | return 0; |
| 404 | } |
| 405 | |
| 406 | int |
| 407 | stpi_escp2_printer_supports_duplexcxx . . $ stpi_escp2_printer_supports_duplex(b1be75487ade2f93).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 408 | { |
| 409 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = get_slots_xmlcxx . . $ get_slots_xml(4499d7fd62d041e8).(v); |
| 410 | if (stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(node, "Duplex", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 411 | return 1; |
| 412 | else |
| 413 | return 0; |
| 414 | } |
| 415 | |
| 416 | static const input_slot_tcxx . . $ input_slot_t# * |
| 417 | get_input_slot_namedcxx . . $ get_input_slot_named(22f8d97ef382354f).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name) |
| 418 | { |
| 419 | input_slot_tcxx . . $ input_slot_t# *answer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 420 | int i; |
| 421 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 422 | const stp_string_list_tcxx . . $ stp_string_list_t# *p = printdef->input_slotscxx . . $ escp2_printer#input_slots.; |
| 423 | stp_list_tcxx . . $ stp_list_t# *cache = get_slots_cachecxx . . $ get_slots_cache(5e6f71de429136ff).(v); |
| 424 | stp_list_item_tcxx . . $ stp_list_item_t# *li = stp_list_get_item_by_namecxx . . $ stp_list_get_item_by_name(27765cfe86595311).(cache, name); |
| 425 | if (li) |
| 426 | answer = (input_slot_tcxx . . $ input_slot_t# *) stp_list_item_get_datacxx . . $ stp_list_item_get_data(9a5daa75441a53b5).(li); |
| 427 | else |
| 428 | { |
| 429 | int slot_count = stp_string_list_countcxx . . $ stp_string_list_count(53b7214102d1daf6).(p); |
| 430 | for (i = 0; i < slot_count; i++) |
| 431 | { |
| 432 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, stp_string_list_paramcxx . . $ stp_string_list_param(1d71fb1c8ad3926a).(p, i)->namecxx . . $ $anonymous_type_cb0224bbe5755622_0#name.)) |
| 433 | { |
| 434 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 435 | answer = build_input_slotcxx . . $ build_input_slot(e421c8e33b480653).(v, name); |
| 436 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 437 | break; |
| 438 | } |
| 439 | } |
| 440 | if (answer) |
| 441 | stp_list_item_createcxx . . $ stp_list_item_create(54f08bf465e39eec).(cache, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, answer); |
| 442 | } |
| 443 | return answer; |
| 444 | } |
| 445 | |
| 446 | const input_slot_tcxx . . $ input_slot_t# * |
| 447 | stpi_escp2_get_input_slotcxx . . $ stpi_escp2_get_input_slot(e79071fa35beaeea).(const stp_vars_tcxx . . $ stp_vars_t# *v) |
| 448 | { |
| 449 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 450 | const stp_string_list_tcxx . . $ stp_string_list_t# *p = printdef->input_slotscxx . . $ escp2_printer#input_slots.; |
| 451 | if (p) |
| 452 | { |
| 453 | const char *name = stp_get_string_parametercxx . . $ stp_get_string_parameter(3e3ce5d385745545).(v, "InputSlot"); |
| 454 | if (name) |
| 455 | return get_input_slot_namedcxx . . $ get_input_slot_named(22f8d97ef382354f).(v, name); |
| 456 | } |
| 457 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 458 | } |