| 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 | #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 "print-escp2.h"cxx . . $ `<file>/src/main/print-escp2.h`/ |
| 29 | |
| 30 | static inkgroup_tcxx . . $ inkgroup_t# *default_black_inkgroupcxx . . $ default_black_inkgroup.; |
| 31 | |
| 32 | static void |
| 33 | load_subchannelcxx . . $ load_subchannel(79235e85d1db68d).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, stp_mxml_node_tcxx . . $ stp_mxml_node_t# *root, physical_subchannel_tcxx . . $ physical_subchannel_t# *icl) |
| 34 | { |
| 35 | const char *name; |
| 36 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 37 | (void)root; |
| 38 | |
| 39 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "color"); |
| 40 | if (name) |
| 41 | icl->colorcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#color. = stp_xmlstrtolcxx . . $ stp_xmlstrtol(3c95bd14d5d5d286).(name); |
| 42 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "subchannel"); |
| 43 | if (name) |
| 44 | icl->subchannelcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#subchannel. = stp_xmlstrtolcxx . . $ stp_xmlstrtol(3c95bd14d5d5d286).(name); |
| 45 | else |
| 46 | icl->subchannelcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#subchannel. = -1; |
| 47 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "headOffset"); |
| 48 | if (name) |
| 49 | icl->head_offsetcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#head_offset. = stp_xmlstrtolcxx . . $ stp_xmlstrtol(3c95bd14d5d5d286).(name); |
| 50 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"); |
| 51 | if (name) |
| 52 | icl->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_9#name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 53 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "text"); |
| 54 | if (name) |
| 55 | icl->textcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#text. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 56 | while (child) |
| 57 | { |
| 58 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 59 | { |
| 60 | const char *param = child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name.; |
| 61 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(child, "name"); |
| 62 | if (name && !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param, "ChannelDensityParam")) |
| 63 | icl->channel_densitycxx . . $ $anonymous_type_2c59c6ae4581c18b_9#channel_density. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 64 | else if (name && !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param, "SubchannelTransitionParam")) |
| 65 | icl->subchannel_transitioncxx . . $ $anonymous_type_2c59c6ae4581c18b_9#subchannel_transition. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 66 | else if (name && !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param, "SubchannelValueParam")) |
| 67 | icl->subchannel_valuecxx . . $ $anonymous_type_2c59c6ae4581c18b_9#subchannel_value. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 68 | else if (name && !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param, "SubchannelScaleParam")) |
| 69 | icl->subchannel_scalecxx . . $ $anonymous_type_2c59c6ae4581c18b_9#subchannel_scale. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 70 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(param, "SplitChannels")) |
| 71 | { |
| 72 | if (stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(child, "count")) |
| 73 | icl->split_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#split_channel_count. = |
| 74 | stp_xmlstrtoulcxx . . $ stp_xmlstrtoul(751346f8406fd082).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(child, "count")); |
| 75 | if (icl->split_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#split_channel_count. > 0) |
| 76 | { |
| 77 | char *endptr; |
| 78 | int count = 0; |
| 79 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cchild = child->childcxx . . $ stp_mxml_node_s#child.; |
| 80 | icl->split_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_9#split_channels. = |
| 81 | stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(short) * icl->split_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#split_channel_count.); |
| 82 | while (cchild && count < icl->split_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_9#split_channel_count.) |
| 83 | { |
| 84 | if (cchild->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 85 | { |
| 86 | unsigned val = |
| 87 | strtoulcxx . . $ strtoul(31746e8d6ec49860).(cchild->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string., &endptr, 0); |
| 88 | if (endptr) |
| 89 | icl->split_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_9#split_channels.[count++] = val; |
| 90 | } |
| 91 | cchild = cchild->nextcxx . . $ stp_mxml_node_s#next.; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | static void |
| 101 | load_channelcxx . . $ load_channel(4f4e966bcf8821e9).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, stp_mxml_node_tcxx . . $ stp_mxml_node_t# *root, ink_channel_tcxx . . $ ink_channel_t# *icl) |
| 102 | { |
| 103 | const char *name; |
| 104 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 105 | int count = 0; |
| 106 | while (child) |
| 107 | { |
| 108 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 109 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "subchannel")) |
| 110 | count++; |
| 111 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 112 | } |
| 113 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"); |
| 114 | if (name) |
| 115 | icl->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_10#name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 116 | icl->n_subchannelscxx . . $ $anonymous_type_2c59c6ae4581c18b_10#n_subchannels. = count; |
| 117 | icl->subchannelscxx . . $ $anonymous_type_2c59c6ae4581c18b_10#subchannels. = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(physical_subchannel_tcxx . . $ physical_subchannel_t#) * count); |
| 118 | count = 0; |
| 119 | child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 120 | while (child) |
| 121 | { |
| 122 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 123 | { |
| 124 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "subchannel")) |
| 125 | load_subchannelcxx . . $ load_subchannel(79235e85d1db68d).(child, root, &(icl->subchannelscxx . . $ $anonymous_type_2c59c6ae4581c18b_10#subchannels.[count++])); |
| 126 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "HueCurve")) |
| 127 | { |
| 128 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cchild = child->childcxx . . $ stp_mxml_node_s#child.; |
| 129 | stp_curve_tcxx . . $ stp_curve_t# *curve; |
| 130 | const char *cref = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(child, "ref"); |
| 131 | if (cref) |
| 132 | { |
| 133 | cchild = stp_mxmlFindElementcxx . . $ stp_mxmlFindElement(9d3a1ee0d733a1fa).(root, root, "curve", "name", |
| 134 | cref, STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 135 | STPI_ASSERTcxx . . $ `src/main/gutenprint-internal.h:58:9`!(cchild, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 136 | } |
| 137 | else |
| 138 | { |
| 139 | while (cchild && cchild->typecxx . . $ stp_mxml_node_s#type. != STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 140 | cchild = cchild->nextcxx . . $ stp_mxml_node_s#next.; |
| 141 | STPI_ASSERTcxx . . $ `src/main/gutenprint-internal.h:58:9`!(cchild, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 142 | } |
| 143 | curve = stp_curve_create_from_xmltreecxx . . $ stp_curve_create_from_xmltree(43c00d17ff70fe89).(cchild); |
| 144 | icl->hue_curvecxx . . $ $anonymous_type_2c59c6ae4581c18b_10#hue_curve. = curve; |
| 145 | } |
| 146 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "HueCurveParam")) |
| 147 | { |
| 148 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(child, "name"); |
| 149 | if (name) |
| 150 | icl->hue_curve_namecxx . . $ $anonymous_type_2c59c6ae4581c18b_10#hue_curve_name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 151 | } |
| 152 | } |
| 153 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | static void |
| 158 | load_inknamecxx . . $ load_inkname(f8e9599b49485fc9).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, stp_mxml_node_tcxx . . $ stp_mxml_node_t# *root, inkname_tcxx . . $ inkname_t# *inl, |
| 159 | inklist_tcxx . . $ inklist_t# *ikl) |
| 160 | { |
| 161 | const char *name; |
| 162 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 163 | unsigned int channel_count = 0; |
| 164 | unsigned int aux_channel_count = 0; |
| 165 | |
| 166 | while (child) |
| 167 | { |
| 168 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 169 | { |
| 170 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "Channels")) |
| 171 | { |
| 172 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cchild = child->childcxx . . $ stp_mxml_node_s#child.; |
| 173 | while (cchild) |
| 174 | { |
| 175 | if (cchild->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 176 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(cchild->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "channel")) |
| 177 | { |
| 178 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(cchild, "index"); |
| 179 | if (name) |
| 180 | { |
| 181 | unsigned idx = stp_xmlstrtoulcxx . . $ stp_xmlstrtoul(751346f8406fd082).(name); |
| 182 | if (idx + 1 > channel_count) |
| 183 | channel_count = idx + 1; |
| 184 | } |
| 185 | } |
| 186 | cchild = cchild->nextcxx . . $ stp_mxml_node_s#next.; |
| 187 | } |
| 188 | } |
| 189 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "AuxChannels")) |
| 190 | { |
| 191 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cchild = child->childcxx . . $ stp_mxml_node_s#child.; |
| 192 | while (cchild) |
| 193 | { |
| 194 | if (cchild->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 195 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(cchild->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "channel")) |
| 196 | { |
| 197 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(cchild, "index"); |
| 198 | if (name) |
| 199 | { |
| 200 | unsigned idx = stp_xmlstrtoulcxx . . $ stp_xmlstrtoul(751346f8406fd082).(name); |
| 201 | if (idx + 1 > aux_channel_count) |
| 202 | aux_channel_count = idx + 1; |
| 203 | } |
| 204 | } |
| 205 | cchild = cchild->nextcxx . . $ stp_mxml_node_s#next.; |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 210 | } |
| 211 | inl->channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#channel_count. = channel_count; |
| 212 | if (channel_count > 0) |
| 213 | inl->channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_12#channels. = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(ink_channel_tcxx . . $ ink_channel_t#) * channel_count); |
| 214 | inl->aux_channel_countcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#aux_channel_count. = aux_channel_count; |
| 215 | if (aux_channel_count > 0) |
| 216 | inl->aux_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_12#aux_channels. = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(ink_channel_tcxx . . $ ink_channel_t#) * aux_channel_count); |
| 217 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"); |
| 218 | if (name) |
| 219 | inl->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 220 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "text"); |
| 221 | if (name) |
| 222 | inl->textcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#text. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 223 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "InkID"); |
| 224 | if (name) |
| 225 | { |
| 226 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "CMYK")) |
| 227 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_CMYKcxx . . $ INKSET_CMYK.; |
| 228 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "CcMmYK")) |
| 229 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_CcMmYKcxx . . $ INKSET_CcMmYK.; |
| 230 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "CcMmYyK")) |
| 231 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_CcMmYyKcxx . . $ INKSET_CcMmYyK.; |
| 232 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "CcMmYKk")) |
| 233 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_CcMmYKkcxx . . $ INKSET_CcMmYKk.; |
| 234 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "Quadtone")) |
| 235 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_QUADTONEcxx . . $ INKSET_QUADTONE.; |
| 236 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "Hextone")) |
| 237 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_HEXTONEcxx . . $ INKSET_HEXTONE.; |
| 238 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "OTHER")) |
| 239 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_OTHERcxx . . $ INKSET_OTHER.; |
| 240 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "Extended")) |
| 241 | inl->inksetcxx . . $ $anonymous_type_2c59c6ae4581c18b_12#inkset. = INKSET_EXTENDEDcxx . . $ INKSET_EXTENDED.; |
| 242 | } |
| 243 | |
| 244 | channel_count = 0; |
| 245 | aux_channel_count = 0; |
| 246 | child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 247 | while (child) |
| 248 | { |
| 249 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 250 | { |
| 251 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "Channels")) |
| 252 | { |
| 253 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cchild = child->childcxx . . $ stp_mxml_node_s#child.; |
| 254 | while (cchild) |
| 255 | { |
| 256 | if (cchild->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 257 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(cchild->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "channel")) |
| 258 | { |
| 259 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(cchild, "index"); |
| 260 | if (name) |
| 261 | { |
| 262 | unsigned idx = stp_xmlstrtoulcxx . . $ stp_xmlstrtoul(751346f8406fd082).(name); |
| 263 | load_channelcxx . . $ load_channel(4f4e966bcf8821e9).(cchild, root, &(inl->channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_12#channels.[idx])); |
| 264 | } |
| 265 | } |
| 266 | cchild = cchild->nextcxx . . $ stp_mxml_node_s#next.; |
| 267 | } |
| 268 | } |
| 269 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "AuxChannels")) |
| 270 | { |
| 271 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cchild = child->childcxx . . $ stp_mxml_node_s#child.; |
| 272 | while (cchild) |
| 273 | { |
| 274 | if (cchild->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 275 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(cchild->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "channel")) |
| 276 | { |
| 277 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(cchild, "index"); |
| 278 | if (name) |
| 279 | { |
| 280 | unsigned idx = stp_xmlstrtoulcxx . . $ stp_xmlstrtoul(751346f8406fd082).(name); |
| 281 | load_channelcxx . . $ load_channel(4f4e966bcf8821e9).(cchild, root, &(inl->aux_channelscxx . . $ $anonymous_type_2c59c6ae4581c18b_12#aux_channels.[idx])); |
| 282 | } |
| 283 | } |
| 284 | cchild = cchild->nextcxx . . $ stp_mxml_node_s#next.; |
| 285 | } |
| 286 | } |
| 287 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "initSequence") && |
| 288 | child->childcxx . . $ stp_mxml_node_s#child. && child->childcxx . . $ stp_mxml_node_s#child.->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 289 | ikl->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#init_sequence. = stp_xmlstrtorawcxx . . $ stp_xmlstrtoraw(62ebf526a09225cc).(child->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string.); |
| 290 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "deinitSequence") && |
| 291 | child->childcxx . . $ stp_mxml_node_s#child. && child->childcxx . . $ stp_mxml_node_s#child.->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 292 | ikl->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#deinit_sequence. = stp_xmlstrtorawcxx . . $ stp_xmlstrtoraw(62ebf526a09225cc).(child->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string.); |
| 293 | } |
| 294 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | static void |
| 299 | load_shadescxx . . $ load_shades(dfb87c2f626c876e).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, stp_mxml_node_tcxx . . $ stp_mxml_node_t# *root, inklist_tcxx . . $ inklist_t# *ikl) |
| 300 | { |
| 301 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 302 | int count = 0; |
| 303 | (void)root; |
| 304 | |
| 305 | while (child) |
| 306 | { |
| 307 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 308 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "shade")) |
| 309 | count++; |
| 310 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 311 | } |
| 312 | ikl->n_shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#n_shades. = count; |
| 313 | ikl->shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#shades. = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(shade_tcxx . . $ shade_t#) * count); |
| 314 | count = 0; |
| 315 | child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 316 | while (child) |
| 317 | { |
| 318 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 319 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "shade")) |
| 320 | { |
| 321 | if (stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(child, "count")) |
| 322 | { |
| 323 | unsigned nshades = |
| 324 | stp_xmlstrtoulcxx . . $ stp_xmlstrtoul(751346f8406fd082).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(child, "count")); |
| 325 | ikl->shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#shades.[count].n_shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_13#n_shades. = nshades; |
| 326 | if (nshades > 0) |
| 327 | { |
| 328 | char *endptr; |
| 329 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cchild = child->childcxx . . $ stp_mxml_node_s#child.; |
| 330 | ikl->shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#shades.[count].shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_13#shades. = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(double) * nshades); |
| 331 | nshades = 0; |
| 332 | while (cchild && nshades < ikl->shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#shades.[count].n_shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_13#n_shades.) |
| 333 | { |
| 334 | if (cchild->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 335 | { |
| 336 | double val = |
| 337 | strtodcxx . . $ strtod(3dfe5620a0d3160e).(cchild->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string., &endptr); |
| 338 | if (endptr) |
| 339 | ikl->shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#shades.[count].shadescxx . . $ $anonymous_type_2c59c6ae4581c18b_13#shades.[nshades++] = val; |
| 340 | } |
| 341 | cchild = cchild->nextcxx . . $ stp_mxml_node_s#next.; |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | count++; |
| 346 | } |
| 347 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | static void |
| 352 | load_inklistcxx . . $ load_inklist(dfb87c2f626c876e).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, stp_mxml_node_tcxx . . $ stp_mxml_node_t# *root, inklist_tcxx . . $ inklist_t# *ikl) |
| 353 | { |
| 354 | const char *name; |
| 355 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 356 | int count = 0; |
| 357 | |
| 358 | while (child) |
| 359 | { |
| 360 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 361 | { |
| 362 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "InkName")) |
| 363 | count++; |
| 364 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "initSequence") && |
| 365 | child->childcxx . . $ stp_mxml_node_s#child. && child->childcxx . . $ stp_mxml_node_s#child.->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 366 | ikl->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#init_sequence. = stp_xmlstrtorawcxx . . $ stp_xmlstrtoraw(62ebf526a09225cc).(child->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string.); |
| 367 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "deinitSequence") && |
| 368 | child->childcxx . . $ stp_mxml_node_s#child. && child->childcxx . . $ stp_mxml_node_s#child.->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_TEXTcxx . . $ STP_MXML_TEXT.) |
| 369 | ikl->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#deinit_sequence. = stp_xmlstrtorawcxx . . $ stp_xmlstrtoraw(62ebf526a09225cc).(child->childcxx . . $ stp_mxml_node_s#child.->valuecxx . . $ stp_mxml_node_s#value..textcxx . . $ stp_mxml_value_u#text..stringcxx . . $ stp_mxml_text_s#string.); |
| 370 | } |
| 371 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 372 | } |
| 373 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name"); |
| 374 | if (name) |
| 375 | ikl->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 376 | name = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "text"); |
| 377 | if (name) |
| 378 | ikl->textcxx . . $ $anonymous_type_2c59c6ae4581c18b_14#text. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 379 | ikl->n_inkscxx . . $ $anonymous_type_2c59c6ae4581c18b_14#n_inks. = count; |
| 380 | ikl->inknamescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#inknames. = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(inkname_tcxx . . $ inkname_t#) * count); |
| 381 | count = 0; |
| 382 | child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 383 | while (child) |
| 384 | { |
| 385 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 386 | { |
| 387 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "InkName")) |
| 388 | { |
| 389 | inkname_tcxx . . $ inkname_t# *inl = &(ikl->inknamescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#inknames.[count++]); |
| 390 | inl->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#init_sequence. = ikl->init_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#init_sequence.; |
| 391 | inl->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_12#deinit_sequence. = ikl->deinit_sequencecxx . . $ $anonymous_type_2c59c6ae4581c18b_14#deinit_sequence.; |
| 392 | load_inknamecxx . . $ load_inkname(f8e9599b49485fc9).(child, root, inl, ikl); |
| 393 | } |
| 394 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "Shades")) |
| 395 | load_shadescxx . . $ load_shades(dfb87c2f626c876e).(child, root, ikl); |
| 396 | } |
| 397 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | /* |
| 402 | * This is structured differently from the other XML loaders because of |
| 403 | * the default black inkset |
| 404 | */ |
| 405 | static inkgroup_tcxx . . $ inkgroup_t# * |
| 406 | load_inkgroupcxx . . $ load_inkgroup(49d6fe912462aa97).(const char *name) |
| 407 | { |
| 408 | inkgroup_tcxx . . $ inkgroup_t# *igl = (inkgroup_tcxx . . $ inkgroup_t# *) stp_refcache_find_itemcxx . . $ stp_refcache_find_item(12e6862c879384a7).("escp2Inkgroup", name); |
| 409 | if (! igl) |
| 410 | { |
| 411 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node = |
| 412 | stp_xml_parse_file_from_path_uncached_safecxx . . $ stp_xml_parse_file_from_path_uncached_safe(5a8029715312b5a0).(name, "escp2InkGroup", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 413 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 414 | igl = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(inkgroup_tcxx . . $ inkgroup_t#)); |
| 415 | stp_refcache_add_itemcxx . . $ stp_refcache_add_item(285a709643be31b2).("escp2Inkgroup", name, igl); |
| 416 | size_t count = 0; |
| 417 | while (child) |
| 418 | { |
| 419 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 420 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "InkList")) |
| 421 | count++; |
| 422 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 423 | } |
| 424 | igl->n_inklistscxx . . $ $anonymous_type_2c59c6ae4581c18b_15#n_inklists. = count; |
| 425 | if (stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name")) |
| 426 | igl->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_15#name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "name")); |
| 427 | else |
| 428 | igl->namecxx . . $ $anonymous_type_2c59c6ae4581c18b_15#name. = stp_strdupcxx . . $ stp_strdup(a8b8e32347182212).(name); |
| 429 | igl->inklistscxx . . $ $anonymous_type_2c59c6ae4581c18b_15#inklists. = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(inklist_tcxx . . $ inklist_t#) * count); |
| 430 | child = node->childcxx . . $ stp_mxml_node_s#child.; |
| 431 | count = 0; |
| 432 | while (child) |
| 433 | { |
| 434 | if (child->typecxx . . $ stp_mxml_node_s#type. == STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT. && |
| 435 | !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(child->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "InkList")) |
| 436 | load_inklistcxx . . $ load_inklist(dfb87c2f626c876e).(child, node, &(igl->inklistscxx . . $ $anonymous_type_2c59c6ae4581c18b_15#inklists.[count++])); |
| 437 | child = child->nextcxx . . $ stp_mxml_node_s#next.; |
| 438 | } |
| 439 | stp_xml_free_parsed_filecxx . . $ stp_xml_free_parsed_file(6927777f14b5e2a1).(node); |
| 440 | } |
| 441 | return igl; |
| 442 | } |
| 443 | |
| 444 | int |
| 445 | stpi_escp2_load_inkgroupcxx . . $ stpi_escp2_load_inkgroup(b1e629819c29df09).(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name) |
| 446 | { |
| 447 | stpi_escp2_printer_tcxx . . $ stpi_escp2_printer_t# *printdef = stpi_escp2_get_printercxx . . $ stpi_escp2_get_printer(d94ed1084d556691).(v); |
| 448 | inkgroup_tcxx . . $ inkgroup_t# *igl = load_inkgroupcxx . . $ load_inkgroup(49d6fe912462aa97).(name); |
| 449 | printdef->inkgroupcxx . . $ escp2_printer#inkgroup. = igl; |
| 450 | return 1; |
| 451 | } |
| 452 | |
| 453 | const inkname_tcxx . . $ inkname_t# * |
| 454 | stpi_escp2_get_default_black_inksetcxx . . $ stpi_escp2_get_default_black_inkset(2e485fb79db197c1).(void) |
| 455 | { |
| 456 | if (! default_black_inkgroupcxx . . $ default_black_inkgroup.) |
| 457 | { |
| 458 | default_black_inkgroupcxx . . $ default_black_inkgroup. = load_inkgroupcxx . . $ load_inkgroup(49d6fe912462aa97).("escp2/inks/defaultblack.xml"); |
| 459 | STPI_ASSERTcxx . . $ `src/main/gutenprint-internal.h:58:9`!(default_black_inkgroup && |
| 460 | default_black_inkgroup->n_inklists >= 1 && |
| 461 | default_black_inkgroup->inklists[0].n_inks >= 1, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!); |
| 462 | } |
| 463 | return &(default_black_inkgroupcxx . . $ default_black_inkgroup.->inklistscxx . . $ $anonymous_type_2c59c6ae4581c18b_15#inklists.[0].inknamescxx . . $ $anonymous_type_2c59c6ae4581c18b_14#inknames.[0]); |
| 464 | } |