| 1 | /* |
| 2 | * CUPS Backend common code |
| 3 | * |
| 4 | * (c) 2013-2026 Solomon Peachy <[email protected]> |
| 5 | * |
| 6 | * The latest version of this program can be found at: |
| 7 | * |
| 8 | * https://git.shaftnet.org/gitea/slp/selphy_print.git |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the Free |
| 12 | * Software Foundation; either version 2 of the License, or (at your option) |
| 13 | * any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, but |
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 17 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 18 | * for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | * SPDX-License-Identifier: GPL-2.0+ |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <string.h> |
| 30 | #include <unistd.h> |
| 31 | |
| 32 | #include <time.h> |
| 33 | |
| 34 | #include <sys/types.h> |
| 35 | #include <sys/stat.h> |
| 36 | #include <fcntl.h> |
| 37 | |
| 38 | #include <libusb.h> |
| 39 | |
| 40 | #pragma GCC diagnostic push |
| 41 | #pragma GCC diagnostic ignored "-Wcast-qual" |
| 42 | |
| 43 | /* For Integration into gutenprint */ |
| 44 | #if defined(HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`!) |
| 45 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 46 | #endif |
| 47 | |
| 48 | #ifndef __BACKEND_COMMON_Hcxx . . $ `src/cups/backend_common.h:49:9`! |
| 49 | #define __BACKEND_COMMON_Hcxx . . $ `src/cups/backend_common.h:49:9`! |
| 50 | |
| 51 | #ifdef ERROR |
| 52 | #undef ERROR |
| 53 | #endif |
| 54 | |
| 55 | #define STR_LEN_MAXcxx . . $ `src/cups/backend_common.h:55:9`! 64 |
| 56 | #define STATEcxx . . $ `src/cups/backend_common.h:56:9`!( ... ) do { if (!quiet) fprintf(logger, "STATE: " __VA_ARGS__ ); } while(0) |
| 57 | #define ATTRcxx . . $ `src/cups/backend_common.h:57:9`!( ... ) do { if (!quiet) fprintf(logger, "ATTR: " __VA_ARGS__ ); } while(0) |
| 58 | #define PAGEcxx . . $ `src/cups/backend_common.h:58:9`!( ... ) do { if (!quiet) fprintf(logger, "PAGE: " __VA_ARGS__ ); } while(0) |
| 59 | #define DEBUGcxx . . $ `src/cups/backend_common.h:59:9`!( ... ) do { if (!quiet) fprintf(logger, "DEBUG: " __VA_ARGS__ ); } while(0) |
| 60 | #define DEBUG2cxx . . $ `src/cups/backend_common.h:60:9`!( ... ) do { if (!quiet) fprintf(logger, __VA_ARGS__ ); } while(0) |
| 61 | #define INFOcxx . . $ `src/cups/backend_common.h:61:9`!( ... ) do { if (!quiet) fprintf(logger, "INFO: " __VA_ARGS__ ); } while(0) |
| 62 | #define WARNINGcxx . . $ `src/cups/backend_common.h:62:9`!( ... ) do { if (!quiet) fprintf(logger, "WARNING: " __VA_ARGS__ ); } while(0) |
| 63 | #define ERRORcxx . . $ `src/cups/backend_common.h:63:9`!( ... ) do { fprintf(logger, "ERROR: " __VA_ARGS__ ); sleep(1); } while (0) |
| 64 | #define PPDcxx . . $ `src/cups/backend_common.h:64:9`!( ... ) do { fprintf(logger, "PPD: " __VA_ARGS__ ); } while (0) |
| 65 | |
| 66 | #if (__BYTE_ORDERcxx . . $ `<external>/1758940242695212560/endianness.h:9:9`! == __LITTLE_ENDIANcxx . . $ `<external>/15579718094795539545/endian.h:30:9`!) |
| 67 | #define le16_to_cpucxx . . $ `src/cups/backend_common.h:67:9`!(__x) __x |
| 68 | #define le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`!(__x) __x |
| 69 | #define be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`!(__x) __builtin_bswap16(__x) |
| 70 | #define be32_to_cpucxx . . $ `src/cups/backend_common.h:70:9`!(__x) __builtin_bswap32(__x) |
| 71 | #else |
| 72 | #define le16_to_cpu(__x) __builtin_bswap16(__x) |
| 73 | #define le32_to_cpu(__x) __builtin_bswap32(__x) |
| 74 | #define be32_to_cpu(__x) __x |
| 75 | #define be16_to_cpu(__x) __x |
| 76 | #endif |
| 77 | |
| 78 | #define cpu_to_le16cxx . . $ `src/cups/backend_common.h:78:9`! le16_to_cpucxx . . $ `src/cups/backend_common.h:67:9`! |
| 79 | #define cpu_to_le32cxx . . $ `src/cups/backend_common.h:79:9`! le32_to_cpucxx . . $ `src/cups/backend_common.h:68:9`! |
| 80 | #define cpu_to_be16cxx . . $ `src/cups/backend_common.h:80:9`! be16_to_cpucxx . . $ `src/cups/backend_common.h:69:9`! |
| 81 | #define cpu_to_be32cxx . . $ `src/cups/backend_common.h:81:9`! be32_to_cpu |
| 82 | |
| 83 | /* To cheat the compiler */ |
| 84 | #define UNUSEDcxx . . $ `src/cups/backend_common.h:84:9`!(expr) do { (void)(expr); } while (0) |
| 85 | |
| 86 | /* Compile-time assertions */ |
| 87 | #define STATIC_ASSERTcxx . . $ `src/cups/backend_common.h:87:9`!(test_for_true) _Static_assert((test_for_true), "(" #test_for_true ") failed") |
| 88 | |
| 89 | /* IEEE1284 ID processing */ |
| 90 | struct deviceid_dictcxx . . $ deviceid_dict# { |
| 91 | char *keycxx . . $ deviceid_dict#key.; |
| 92 | char *valcxx . . $ deviceid_dict#val.; |
| 93 | }; |
| 94 | #define MAX_DICTcxx . . $ `src/cups/backend_common.h:94:9`! 32 |
| 95 | int parse1284_datacxx . . $ parse1284_data(70f86c7be5cd5865).(const char *device_id, struct deviceid_dictcxx . . $ deviceid_dict#* dict); |
| 96 | char *dict_findcxx . . $ dict_find(c15dc00ac7194fa9).(const char *key, int dlen, struct deviceid_dictcxx . . $ deviceid_dict#* dict); |
| 97 | char *get_device_idcxx . . $ get_device_id(d6081702c9abc218).(struct libusb_device_handlecxx . . $ libusb_device_handle# *dev, int iface); |
| 98 | |
| 99 | /* To enumerate supported devices */ |
| 100 | enumcxx . . $ $anonymous_type_bfc6052f6a8b8087_0# { |
| 101 | P_UNKNOWNcxx . . $ P_UNKNOWN. = 0, |
| 102 | P_CITIZEN_CW01cxx . . $ P_CITIZEN_CW01., |
| 103 | P_CITIZEN_OP900IIcxx . . $ P_CITIZEN_OP900II., |
| 104 | P_CPGENERICcxx . . $ P_CPGENERIC., |
| 105 | P_CP10cxx . . $ P_CP10., |
| 106 | P_CP790cxx . . $ P_CP790., |
| 107 | P_CP900cxx . . $ P_CP900., |
| 108 | P_CP910cxx . . $ P_CP910., |
| 109 | P_DNP_DS40cxx . . $ P_DNP_DS40., |
| 110 | P_DNP_DS80cxx . . $ P_DNP_DS80., |
| 111 | P_DNP_DS80Dcxx . . $ P_DNP_DS80D., |
| 112 | P_DNP_DS620cxx . . $ P_DNP_DS620., |
| 113 | P_DNP_DS820cxx . . $ P_DNP_DS820., |
| 114 | P_DNP_DSRX1cxx . . $ P_DNP_DSRX1., |
| 115 | P_DNP_QW410cxx . . $ P_DNP_QW410., |
| 116 | P_DNP_DSX80cxx . . $ P_DNP_DSX80., |
| 117 | P_ES1cxx . . $ P_ES1., |
| 118 | P_ES2_20cxx . . $ P_ES2_20., |
| 119 | P_ES3_30cxx . . $ P_ES3_30., |
| 120 | P_ES40cxx . . $ P_ES40., |
| 121 | P_FUJI_ASK300cxx . . $ P_FUJI_ASK300., |
| 122 | P_FUJI_ASK500cxx . . $ P_FUJI_ASK500., |
| 123 | P_HITI_CS2XXcxx . . $ P_HITI_CS2XX., |
| 124 | P_HITI_310cxx . . $ P_HITI_310., |
| 125 | P_HITI_320cxx . . $ P_HITI_320., |
| 126 | P_HITI_461cxx . . $ P_HITI_461., |
| 127 | P_HITI_51Xcxx . . $ P_HITI_51X., |
| 128 | P_HITI_520cxx . . $ P_HITI_520., |
| 129 | P_HITI_525cxx . . $ P_HITI_525., |
| 130 | P_HITI_530cxx . . $ P_HITI_530., |
| 131 | P_HITI_630cxx . . $ P_HITI_630., |
| 132 | P_HITI_720cxx . . $ P_HITI_720., |
| 133 | P_HITI_750cxx . . $ P_HITI_750., |
| 134 | P_HITI_826cxx . . $ P_HITI_826., |
| 135 | P_HITI_910cxx . . $ P_HITI_910., |
| 136 | P_SWIFTFOTO_KSF10cxx . . $ P_SWIFTFOTO_KSF10., |
| 137 | P_KODAK_1400_805cxx . . $ P_KODAK_1400_805., |
| 138 | P_KODAK_305cxx . . $ P_KODAK_305., |
| 139 | P_KODAK_605cxx . . $ P_KODAK_605., |
| 140 | P_KODAK_6800cxx . . $ P_KODAK_6800., |
| 141 | P_KODAK_6850cxx . . $ P_KODAK_6850., |
| 142 | P_KODAK_6900cxx . . $ P_KODAK_6900., |
| 143 | P_KODAK_7000cxx . . $ P_KODAK_7000., |
| 144 | P_KODAK_701Xcxx . . $ P_KODAK_701X., |
| 145 | P_KODAK_8800cxx . . $ P_KODAK_8800., |
| 146 | P_KODAK_8810cxx . . $ P_KODAK_8810., |
| 147 | P_MAGICARDcxx . . $ P_MAGICARD., |
| 148 | P_NDCcxx . . $ P_NDC., |
| 149 | P_MITSU_9500Scxx . . $ P_MITSU_9500S., |
| 150 | P_MITSU_9550cxx . . $ P_MITSU_9550., |
| 151 | P_MITSU_9550Scxx . . $ P_MITSU_9550S., |
| 152 | P_MITSU_9600cxx . . $ P_MITSU_9600., |
| 153 | P_MITSU_9600Scxx . . $ P_MITSU_9600S., |
| 154 | P_MITSU_9800cxx . . $ P_MITSU_9800., |
| 155 | P_MITSU_9800Scxx . . $ P_MITSU_9800S., |
| 156 | P_MITSU_9810cxx . . $ P_MITSU_9810., |
| 157 | P_MITSU_9820Scxx . . $ P_MITSU_9820S., |
| 158 | P_MITSU_D70Xcxx . . $ P_MITSU_D70X., |
| 159 | P_MITSU_D80cxx . . $ P_MITSU_D80., |
| 160 | P_MITSU_D90cxx . . $ P_MITSU_D90., |
| 161 | P_MITSU_K60cxx . . $ P_MITSU_K60., |
| 162 | P_MITSU_M1cxx . . $ P_MITSU_M1., |
| 163 | P_MITSU_W5000cxx . . $ P_MITSU_W5000., |
| 164 | P_MITSU_P93Dcxx . . $ P_MITSU_P93D., |
| 165 | P_MITSU_P95Dcxx . . $ P_MITSU_P95D., |
| 166 | P_MITSU_CP30Dcxx . . $ P_MITSU_CP30D., |
| 167 | P_SHINKO_S1245cxx . . $ P_SHINKO_S1245., |
| 168 | P_SHINKO_S2145cxx . . $ P_SHINKO_S2145., |
| 169 | P_SHINKO_S2245cxx . . $ P_SHINKO_S2245., |
| 170 | P_SHINKO_S6145cxx . . $ P_SHINKO_S6145., |
| 171 | P_SHINKO_S6145Dcxx . . $ P_SHINKO_S6145D., |
| 172 | P_SHINKO_S6245cxx . . $ P_SHINKO_S6245., |
| 173 | P_SONY_UPCR10cxx . . $ P_SONY_UPCR10., |
| 174 | P_SONY_UPCR20Lcxx . . $ P_SONY_UPCR20L., |
| 175 | P_SONY_UPD711cxx . . $ P_SONY_UPD711., |
| 176 | P_SONY_UPD895cxx . . $ P_SONY_UPD895., |
| 177 | P_SONY_UPD897cxx . . $ P_SONY_UPD897., |
| 178 | P_SONY_UPD898cxx . . $ P_SONY_UPD898., |
| 179 | P_SONY_UP9x1cxx . . $ P_SONY_UP9x1., |
| 180 | P_SONY_UPDR150cxx . . $ P_SONY_UPDR150., |
| 181 | P_SONY_UPDR80cxx . . $ P_SONY_UPDR80., |
| 182 | P_ENDcxx . . $ P_END., |
| 183 | }; |
| 184 | |
| 185 | struct device_idcxx . . $ device_id# { |
| 186 | uint16_tcxx . . $ uint16_t# vidcxx . . $ device_id#vid.; |
| 187 | uint16_tcxx . . $ uint16_t# pidcxx . . $ device_id#pid.; |
| 188 | int typecxx . . $ device_id#type.; /* P_** */ |
| 189 | const char *manuf_strcxx . . $ device_id#manuf_str.; |
| 190 | const char *makecxx . . $ device_id#make.; |
| 191 | }; |
| 192 | |
| 193 | struct markercxx . . $ marker# { |
| 194 | const char *colorcxx . . $ marker#color.; /* Eg "#00FFFF" */ |
| 195 | const char *namecxx . . $ marker#name.; /* Eg "CK9015 (4x6)" */ |
| 196 | int levelmaxcxx . . $ marker#levelmax.; /* Max media count, eg '600', or '-1' */ |
| 197 | int levelnowcxx . . $ marker#levelnow.; /* Remaining media, -3, -2, -1, 0..N. See CUPS. */ |
| 198 | int numtypecxx . . $ marker#numtype.; /* Numerical type, (-1 for unknown) */ |
| 199 | }; |
| 200 | |
| 201 | #define DECKS_MAXcxx . . $ `src/cups/backend_common.h:201:9`! 2 |
| 202 | struct printerstatscxx . . $ printerstats# { |
| 203 | time_tcxx . . $ time_t# timestampcxx . . $ printerstats#timestamp.; |
| 204 | const char *mfgcxx . . $ printerstats#mfg.; /* Manufacturer */ |
| 205 | const char *modelcxx . . $ printerstats#model.; /* Model */ |
| 206 | const char *serialcxx . . $ printerstats#serial.; /* Serial Number */ |
| 207 | const char *fwvercxx . . $ printerstats#fwver.; /* Firmware Version */ |
| 208 | uint8_tcxx . . $ uint8_t# deckscxx . . $ printerstats#decks.; /* Number of "decks" (1 or 2) */ |
| 209 | |
| 210 | const char *namecxx . . $ printerstats#name.[DECKS_MAXcxx . . $ `src/cups/backend_common.h:201:9`!]; /* Name */ |
| 211 | char *statuscxx . . $ printerstats#status.[DECKS_MAXcxx . . $ `src/cups/backend_common.h:201:9`!]; /* Status (dynamic) */ |
| 212 | const char *mediatypecxx . . $ printerstats#mediatype.[DECKS_MAXcxx . . $ `src/cups/backend_common.h:201:9`!]; /* Media Type */ |
| 213 | int32_tcxx . . $ int32_t# levelmaxcxx . . $ printerstats#levelmax.[DECKS_MAXcxx . . $ `src/cups/backend_common.h:201:9`!]; /* Max media count (-1 if unknown) */ |
| 214 | int32_tcxx . . $ int32_t# levelnowcxx . . $ printerstats#levelnow.[DECKS_MAXcxx . . $ `src/cups/backend_common.h:201:9`!]; /* Remaining media count (-1 if unknown) */ |
| 215 | int32_tcxx . . $ int32_t# cnt_lifecxx . . $ printerstats#cnt_life.[DECKS_MAXcxx . . $ `src/cups/backend_common.h:201:9`!]; /* Lifetime prints */ |
| 216 | }; |
| 217 | |
| 218 | struct dyesub_connectioncxx . . $ dyesub_connection# { |
| 219 | struct libusb_device_handlecxx . . $ libusb_device_handle# *devcxx . . $ dyesub_connection#dev.; |
| 220 | uint8_tcxx . . $ uint8_t# endp_upcxx . . $ dyesub_connection#endp_up.; |
| 221 | uint8_tcxx . . $ uint8_t# endp_downcxx . . $ dyesub_connection#endp_down.; |
| 222 | uint8_tcxx . . $ uint8_t# ifacecxx . . $ dyesub_connection#iface.; |
| 223 | uint8_tcxx . . $ uint8_t# altsetcxx . . $ dyesub_connection#altset.; |
| 224 | |
| 225 | /* to make our lives easier later */ |
| 226 | uint8_tcxx . . $ uint8_t# bus_numcxx . . $ dyesub_connection#bus_num.; |
| 227 | uint8_tcxx . . $ uint8_t# port_numcxx . . $ dyesub_connection#port_num.; |
| 228 | uint16_tcxx . . $ uint16_t# usb_vidcxx . . $ dyesub_connection#usb_vid.; |
| 229 | uint16_tcxx . . $ uint16_t# usb_pidcxx . . $ dyesub_connection#usb_pid.; |
| 230 | |
| 231 | // TODO: mutex/lock |
| 232 | |
| 233 | int typecxx . . $ dyesub_connection#type.; /* P_XXXX */ |
| 234 | }; |
| 235 | |
| 236 | #define DYESUB_MAX_JOB_ENTRIEScxx . . $ `src/cups/backend_common.h:236:9`! 3 |
| 237 | |
| 238 | struct dyesub_joblistcxx . . $ dyesub_joblist# { |
| 239 | // TODO: mutex/lock |
| 240 | const struct dyesub_backendcxx . . $ dyesub_backend# *backendcxx . . $ dyesub_joblist#backend.; |
| 241 | void *ctxcxx . . $ dyesub_joblist#ctx.; |
| 242 | int num_entriescxx . . $ dyesub_joblist#num_entries.; |
| 243 | int copiescxx . . $ dyesub_joblist#copies.; |
| 244 | const void *entriescxx . . $ dyesub_joblist#entries.[DYESUB_MAX_JOB_ENTRIEScxx . . $ `src/cups/backend_common.h:236:9`!]; |
| 245 | }; |
| 246 | #define MAX_JOBS_FROM_READ_PARSEcxx . . $ `src/cups/backend_common.h:246:9`! 3 |
| 247 | |
| 248 | /* This MUST be the start of every per-printer job struct! */ |
| 249 | struct dyesub_job_commoncxx . . $ dyesub_job_common# { |
| 250 | size_t jobsizecxx . . $ dyesub_job_common#jobsize.; |
| 251 | int copiescxx . . $ dyesub_job_common#copies.; |
| 252 | int can_combinecxx . . $ dyesub_job_common#can_combine.; |
| 253 | }; |
| 254 | |
| 255 | /* Panorama stuff */ |
| 256 | struct panodata_rowcxx . . $ panodata_row# { |
| 257 | uint16_tcxx . . $ uint16_t# start_rowcxx . . $ panodata_row#start_row.; |
| 258 | double rhYMCcxx . . $ panodata_row#rhYMC.[3]; |
| 259 | double lhYMCcxx . . $ panodata_row#lhYMC.[3]; |
| 260 | }; |
| 261 | |
| 262 | #define DNP_PANO_MAXROWScxx . . $ `src/cups/backend_common.h:262:9`! 64 |
| 263 | struct dnp_panodatacxx . . $ dnp_panodata# { |
| 264 | uint16_tcxx . . $ uint16_t# elementscxx . . $ dnp_panodata#elements.; |
| 265 | struct panodata_rowcxx . . $ panodata_row# rowscxx . . $ dnp_panodata#rows.[DNP_PANO_MAXROWScxx . . $ `src/cups/backend_common.h:262:9`!]; |
| 266 | }; |
| 267 | |
| 268 | /* Exported functions */ |
| 269 | int send_datacxx . . $ send_data(b2b51896d93e30f1).(struct dyesub_connectioncxx . . $ dyesub_connection# *conn, const uint8_tcxx . . $ uint8_t# *buf, int len); |
| 270 | int read_datacxx . . $ read_data(b488de55810172b7).(struct dyesub_connectioncxx . . $ dyesub_connection# *conn, |
| 271 | uint8_tcxx . . $ uint8_t# *buf, int buflen, int *readlen); |
| 272 | |
| 273 | void dump_markerscxx . . $ dump_markers(5d6a6527eb135db2).(const struct markercxx . . $ marker# *markers, int marker_count, int full); |
| 274 | |
| 275 | void print_license_blurbcxx . . $ print_license_blurb(49f6e7a06ebc5aa8).(void); |
| 276 | void print_helpcxx . . $ print_help(3cc7b548af069aa6).(const char *argv0, const struct dyesub_backendcxx . . $ dyesub_backend# *backend); |
| 277 | |
| 278 | int dyesub_read_file2cxx . . $ dyesub_read_file2(915904cff5e9dc66).(const char *filename, void *databuf, int datalen, |
| 279 | int *actual_len, int fail_ok); |
| 280 | |
| 281 | #define dyesub_read_filecxx . . $ `src/cups/backend_common.h:281:9`!(__fname, __databuf, __datalen, __actual_len) \ |
| 282 | dyesub_read_file2(__fname, __databuf, __datalen, __actual_len, 0) |
| 283 | |
| 284 | uint16_tcxx . . $ uint16_t# uint16_to_packed_bcdcxx . . $ uint16_to_packed_bcd(a18c05e4017afb3d).(uint16_tcxx . . $ uint16_t# val); |
| 285 | uint32_tcxx . . $ uint32_t# packed_bcd_to_uint32cxx . . $ packed_bcd_to_uint32(cc09747f0f147881).(const char *in, int len); |
| 286 | |
| 287 | void generic_teardowncxx . . $ generic_teardown(5d22bdacc48458e8).(void *vctx); |
| 288 | |
| 289 | /* USB enumeration and attachment */ |
| 290 | #define NUM_CLAIM_ATTEMPTScxx . . $ `src/cups/backend_common.h:290:9`! 10 |
| 291 | int backend_claim_interfacecxx . . $ backend_claim_interface(5cbf58ed2a24bd39).(struct libusb_device_handlecxx . . $ libusb_device_handle# *dev, int iface, |
| 292 | int num_claim_attempts); |
| 293 | |
| 294 | /* Job list manipulation */ |
| 295 | struct dyesub_joblistcxx . . $ dyesub_joblist# *dyesub_joblist_createcxx . . $ dyesub_joblist_create(e14ac9a7f8eb540c).(const struct dyesub_backendcxx . . $ dyesub_backend# *backend, void *ctx); |
| 296 | int dyesub_joblist_appendjobcxx . . $ dyesub_joblist_appendjob(2ac85684fb228585).(struct dyesub_joblistcxx . . $ dyesub_joblist# *list, const void *job); |
| 297 | void dyesub_joblist_cleanupcxx . . $ dyesub_joblist_cleanup(ec9e1c82fde714f2).(const struct dyesub_joblistcxx . . $ dyesub_joblist# *list); |
| 298 | int dyesub_joblist_printcxx . . $ dyesub_joblist_print(e5747901eea0a48c).(const struct dyesub_joblistcxx . . $ dyesub_joblist# *list, int *pagenum); |
| 299 | const void *dyesub_joblist_popjobcxx . . $ dyesub_joblist_popjob(2788cb3b1909c25f).(struct dyesub_joblistcxx . . $ dyesub_joblist# *list); |
| 300 | int dyesub_joblist_canwaitcxx . . $ dyesub_joblist_canwait(2717703e18669690).(struct dyesub_joblistcxx . . $ dyesub_joblist# *list); |
| 301 | |
| 302 | #define BACKEND_FLAG_BADISERIALcxx . . $ `src/cups/backend_common.h:302:9`! 0x00000001 |
| 303 | #define BACKEND_FLAG_DUMMYPRINTcxx . . $ `src/cups/backend_common.h:303:9`! 0x00000002 |
| 304 | |
| 305 | void dyesub_pano_split_rgb8cxx . . $ dyesub_pano_split_rgb8(556a9d83f8847432).(const uint8_tcxx . . $ uint8_t# *src, uint16_tcxx . . $ uint16_t# cols, uint8_tcxx . . $ uint8_t# numpanels, |
| 306 | uint16_tcxx . . $ uint16_t# overlap_rows, uint16_tcxx . . $ uint16_t# pad_rows, |
| 307 | uint16_tcxx . . $ uint16_t# *panel_rows, uint8_tcxx . . $ uint8_t# **panels); |
| 308 | |
| 309 | /* Backend Functions */ |
| 310 | struct dyesub_backendcxx . . $ dyesub_backend# { |
| 311 | /* Required properties */ |
| 312 | const char *namecxx . . $ dyesub_backend#name.; |
| 313 | const char *versioncxx . . $ dyesub_backend#version.; |
| 314 | const char **uri_prefixescxx . . $ dyesub_backend#uri_prefixes.; |
| 315 | const struct device_idcxx . . $ device_id# *devicescxx . . $ dyesub_backend#devices.; |
| 316 | |
| 317 | /* Optional properties */ |
| 318 | const uint32_tcxx . . $ uint32_t# flagscxx . . $ dyesub_backend#flags.; |
| 319 | |
| 320 | /* Required functions */ |
| 321 | void *(*initcxx . . $ dyesub_backend#init.)(void); |
| 322 | int (*attachcxx . . $ dyesub_backend#attach.)(void *ctx, struct dyesub_connectioncxx . . $ dyesub_connection# *conn, uint8_tcxx . . $ uint8_t# jobid); |
| 323 | int (*cmdline_argcxx . . $ dyesub_backend#cmdline_arg.)(void *ctx, int argc, char **argv); |
| 324 | int (*read_parsecxx . . $ dyesub_backend#read_parse.)(void *ctx, const void **job, int data_fd, int copies); |
| 325 | int (*main_loopcxx . . $ dyesub_backend#main_loop.)(void *ctx, const void *job, int wait_on_return); |
| 326 | void (*cleanup_jobcxx . . $ dyesub_backend#cleanup_job.)(const void *job); |
| 327 | |
| 328 | /* Required if backend implemnets job combining */ |
| 329 | void *(*combine_jobscxx . . $ dyesub_backend#combine_jobs.)(const void *job1, const void *job2); |
| 330 | int (*job_polaritycxx . . $ dyesub_backend#job_polarity.)(void *ctx); |
| 331 | |
| 332 | /* Optional stuff */ |
| 333 | void (*teardowncxx . . $ dyesub_backend#teardown.)(void *ctx); |
| 334 | void (*cmdline_usagecxx . . $ dyesub_backend#cmdline_usage.)(void); |
| 335 | int (*query_sernocxx . . $ dyesub_backend#query_serno.)(struct dyesub_connectioncxx . . $ dyesub_connection# *conn, char *buf, int buf_len); |
| 336 | int (*query_markerscxx . . $ dyesub_backend#query_markers.)(void *ctx, struct markercxx . . $ marker# **markers, int *count); |
| 337 | int (*query_statscxx . . $ dyesub_backend#query_stats.)(void *ctx, struct printerstatscxx . . $ printerstats# *stats); |
| 338 | }; |
| 339 | |
| 340 | /* Global data */ |
| 341 | extern int terminatecxx . . $ terminate.; |
| 342 | extern int dyesub_debugcxx . . $ dyesub_debug.; |
| 343 | extern int fast_returncxx . . $ fast_return.; |
| 344 | extern int extra_vidcxx . . $ extra_vid.; |
| 345 | extern int extra_pidcxx . . $ extra_pid.; |
| 346 | extern int extra_typecxx . . $ extra_type.; |
| 347 | extern int ncopiescxx . . $ ncopies.; |
| 348 | extern int collatecxx . . $ collate.; |
| 349 | extern int test_modecxx . . $ test_mode.; |
| 350 | extern int quietcxx . . $ quiet.; |
| 351 | extern const char *corrtable_pathcxx . . $ corrtable_path.; |
| 352 | extern FILEcxx . . $ FILE# *loggercxx . . $ logger.; |
| 353 | extern int stats_onlycxx . . $ stats_only.; |
| 354 | |
| 355 | enumcxx . . $ $anonymous_type_bfc6052f6a8b8087_1# { |
| 356 | TEST_MODE_NONEcxx . . $ TEST_MODE_NONE. = 0, |
| 357 | TEST_MODE_NOPRINTcxx . . $ TEST_MODE_NOPRINT., |
| 358 | TEST_MODE_NOATTACHcxx . . $ TEST_MODE_NOATTACH., |
| 359 | TEST_MODE_MAXcxx . . $ TEST_MODE_MAX., |
| 360 | }; |
| 361 | |
| 362 | #if defined(BACKENDcxx . . $ `src/cups/backend_shinkos2145.c:31:9`!) |
| 363 | extern const struct dyesub_backendcxx . . $ dyesub_backend# BACKENDcxx . . $ shinkos2145_backend.; |
| 364 | #endif |
| 365 | |
| 366 | /* CUPS compatibility */ |
| 367 | #define CUPS_BACKEND_OKcxx . . $ `src/cups/backend_common.h:367:9`! 0 /* Success */ |
| 368 | #define CUPS_BACKEND_FAILEDcxx . . $ `src/cups/backend_common.h:368:9`! 1 /* Failed to print use CUPS policy */ |
| 369 | #define CUPS_BACKEND_AUTH_REQUIREDcxx . . $ `src/cups/backend_common.h:369:9`! 2 /* Auth required */ |
| 370 | #define CUPS_BACKEND_HOLDcxx . . $ `src/cups/backend_common.h:370:9`! 3 /* Hold this job only */ |
| 371 | #define CUPS_BACKEND_STOPcxx . . $ `src/cups/backend_common.h:371:9`! 4 /* Stop the entire queue */ |
| 372 | #define CUPS_BACKEND_CANCELcxx . . $ `src/cups/backend_common.h:372:9`! 5 /* Cancel print job */ |
| 373 | #define CUPS_BACKEND_RETRYcxx . . $ `src/cups/backend_common.h:373:9`! 6 /* Retry later */ |
| 374 | #define CUPS_BACKEND_RETRY_CURRENTcxx . . $ `src/cups/backend_common.h:374:9`! 7 /* Retry immediately */ |
| 375 | |
| 376 | #define CUPS_MARKER_UNAVAILABLEcxx . . $ `src/cups/backend_common.h:376:9`! -1 |
| 377 | #define CUPS_MARKER_UNKNOWNcxx . . $ `src/cups/backend_common.h:377:9`! -2 |
| 378 | #define CUPS_MARKER_UNKNOWN_OKcxx . . $ `src/cups/backend_common.h:378:9`! -3 |
| 379 | |
| 380 | /* Argument processing */ |
| 381 | #define GETOPT_LIST_GLOBALcxx . . $ `src/cups/backend_common.h:381:9`! "d:DfGhv" |
| 382 | #define GETOPT_PROCESS_GLOBALcxx . . $ `src/cups/backend_common.h:382:9`! \ |
| 383 | case 'd': \ |
| 384 | ncopies = atoi(optarg); \ |
| 385 | break; \ |
| 386 | case 'D': \ |
| 387 | dyesub_debug++; \ |
| 388 | break; \ |
| 389 | case 'f': \ |
| 390 | fast_return++; \ |
| 391 | break; \ |
| 392 | case 'G': \ |
| 393 | print_license_blurb(); \ |
| 394 | exit(0); \ |
| 395 | case 'h': \ |
| 396 | print_help(argv[0], &BACKENDcxx . . $ `src/cups/backend_shinkos2145.c:31:9`!); \ |
| 397 | exit(0); \ |
| 398 | case 'v': \ |
| 399 | quiet++; \ |
| 400 | break; |
| 401 | |
| 402 | /* Dynamic library loading */ |
| 403 | #if defined(USE_DLOPENcxx . . $ `config.h:198:9`!) |
| 404 | #define WITH_DYNAMICcxx . . $ `src/cups/backend_common.h:404:9`! |
| 405 | #include <dlfcn.h> |
| 406 | #define DL_INITcxx . . $ `src/cups/backend_common.h:406:9`!() do {} while(0) |
| 407 | #define DL_OPENcxx . . $ `src/cups/backend_common.h:407:9`!(__x) dlopen(__x, RTLD_NOW) |
| 408 | #define DL_SYMcxx . . $ `src/cups/backend_common.h:408:9`!(__x, __y) dlsym(__x, __y) |
| 409 | #define DL_CLOSEcxx . . $ `src/cups/backend_common.h:409:9`!(__x) dlclose(__x) |
| 410 | #define DL_EXITcxx . . $ `src/cups/backend_common.h:410:9`!() do {} while(0) |
| 411 | #elif defined(USE_LTDL) |
| 412 | #define WITH_DYNAMIC |
| 413 | #include <ltdl.h> |
| 414 | #define DL_INIT() lt_dlinit() |
| 415 | #define DL_OPEN(__x) lt_dlopen(__x) |
| 416 | #define DL_SYM(__x, __y) lt_dlsym(__x, __y) |
| 417 | #define DL_CLOSE(__x) do {} while(0) |
| 418 | #define DL_EXIT() lt_dlexit() |
| 419 | #else |
| 420 | #define DL_INIT() do {} while(0) |
| 421 | #define DL_CLOSE(__x) do {} while(0) |
| 422 | #define DL_EXIT() do {} while(0) |
| 423 | #endif |
| 424 | #if defined(_WIN32) |
| 425 | #define DLL_SUFFIX ".dll" |
| 426 | #elif defined(__APPLE__) |
| 427 | #define DLL_SUFFIX ".dylib" |
| 428 | #else |
| 429 | #define DLL_SUFFIXcxx . . $ `src/cups/backend_common.h:429:9`! ".so" |
| 430 | #endif |
| 431 | |
| 432 | #endif /* __BACKEND_COMMON_H */ |