| 1 | /* |
| 2 | * Print plug-in header file for the GIMP. |
| 3 | * |
| 4 | * Copyright 1997-2000 Michael Sweet ([email protected]) and |
| 5 | * Robert Krawitz ([email protected]) |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the Free |
| 9 | * Software Foundation; either version 2 of the License, or (at your option) |
| 10 | * any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 | * for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | * |
| 20 | * Revision History: |
| 21 | * |
| 22 | * See ChangeLog |
| 23 | */ |
| 24 | |
| 25 | /* |
| 26 | * This file must include only standard C header files. The core code must |
| 27 | * compile on generic platforms that don't support glib, gimp, gtk, etc. |
| 28 | */ |
| 29 | |
| 30 | #ifndef GUTENPRINT_INTERNAL_INTERNAL_H |
| 31 | #define GUTENPRINT_INTERNAL_INTERNAL_Hcxx . . $ `src/main/gutenprint-internal.h:31:9`! |
| 32 | |
| 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 38 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 39 | #endif |
| 40 | |
| 41 | #include <gutenprint/gutenprint-module.h>cxx . . $ `<file>/include/gutenprint/gutenprint-module.h`/ |
| 42 | #include <time.h> |
| 43 | |
| 44 | /** |
| 45 | * Utility functions (internal). |
| 46 | * |
| 47 | * @defgroup util_internal util-internal |
| 48 | * @{ |
| 49 | */ |
| 50 | |
| 51 | extern void stpi_init_papercxx . . $ stpi_init_paper(49f6e7a06ebc5aa8).(void); |
| 52 | extern void stpi_init_dithercxx . . $ stpi_init_dither(49f6e7a06ebc5aa8).(void); |
| 53 | extern void stpi_init_printercxx . . $ stpi_init_printer(49f6e7a06ebc5aa8).(void); |
| 54 | #define BUFFER_FLAG_FLIP_Xcxx . . $ `src/main/gutenprint-internal.h:54:9`! 0x1 |
| 55 | #define BUFFER_FLAG_FLIP_Ycxx . . $ `src/main/gutenprint-internal.h:55:9`! 0x2 |
| 56 | extern stp_image_tcxx . . $ stp_image_t#* stpi_buffer_imagecxx . . $ stpi_buffer_image(a9d3270e35af0259).(stp_image_tcxx . . $ stp_image_t#* image, unsigned int flags); |
| 57 | |
| 58 | #define STPI_ASSERTcxx . . $ `src/main/gutenprint-internal.h:58:9`!(x,v) \ |
| 59 | do \ |
| 60 | { \ |
| 61 | if (stp_get_debug_level() & STP_DBG_ASSERTIONS) \ |
| 62 | stp_erprintf("DEBUG: Testing assertion %s file %s line %d\n", \ |
| 63 | #x, __FILE__, __LINE__); \ |
| 64 | if (!(x)) \ |
| 65 | { \ |
| 66 | stp_erprintf("\nERROR: ***Gutenprint %s assertion %s failed!" \ |
| 67 | " file %s, line %d. %s\n", PACKAGE_VERSION, \ |
| 68 | #x, __FILE__, __LINE__, "Please report this bug!"); \ |
| 69 | if ((v)) stp_vars_print_error((v), "ERROR"); \ |
| 70 | stp_abort(); \ |
| 71 | } \ |
| 72 | } while (0) |
| 73 | |
| 74 | /** @} */ |
| 75 | |
| 76 | /* Internal printer stuff, moved from printers.h */ |
| 77 | typedef structcxx . . $ $anonymous_type_aea12ced6c6256e6_0# |
| 78 | { |
| 79 | stp_parameter_list_tcxx . . $ stp_parameter_list_t# (*list_parameterscxx . . $ $anonymous_type_aea12ced6c6256e6_0#list_parameters.)(const stp_vars_tcxx . . $ stp_vars_t# *v); |
| 80 | void (*parameterscxx . . $ $anonymous_type_aea12ced6c6256e6_0#parameters.)(const stp_vars_tcxx . . $ stp_vars_t# *v, const char *name, |
| 81 | stp_parameter_tcxx . . $ stp_parameter_t# *); |
| 82 | void (*media_sizecxx . . $ $anonymous_type_aea12ced6c6256e6_0#media_size.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_dimension_tcxx . . $ stp_dimension_t# *width, |
| 83 | stp_dimension_tcxx . . $ stp_dimension_t# *height); |
| 84 | void (*imageable_areacxx . . $ $anonymous_type_aea12ced6c6256e6_0#imageable_area.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_dimension_tcxx . . $ stp_dimension_t# *left, |
| 85 | stp_dimension_tcxx . . $ stp_dimension_t# *right, stp_dimension_tcxx . . $ stp_dimension_t# *bottom, |
| 86 | stp_dimension_tcxx . . $ stp_dimension_t# *top); |
| 87 | void (*maximum_imageable_areacxx . . $ $anonymous_type_aea12ced6c6256e6_0#maximum_imageable_area.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_dimension_tcxx . . $ stp_dimension_t# *left, |
| 88 | stp_dimension_tcxx . . $ stp_dimension_t# *right, stp_dimension_tcxx . . $ stp_dimension_t# *bottom, |
| 89 | stp_dimension_tcxx . . $ stp_dimension_t# *top); |
| 90 | void (*limitcxx . . $ $anonymous_type_aea12ced6c6256e6_0#limit.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_dimension_tcxx . . $ stp_dimension_t# *max_width, |
| 91 | stp_dimension_tcxx . . $ stp_dimension_t# *max_height, stp_dimension_tcxx . . $ stp_dimension_t# *min_width, |
| 92 | stp_dimension_tcxx . . $ stp_dimension_t# *min_height); |
| 93 | int (*printcxx . . $ $anonymous_type_aea12ced6c6256e6_0#print.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_image_tcxx . . $ stp_image_t# *image); |
| 94 | void (*describe_resolutioncxx . . $ $anonymous_type_aea12ced6c6256e6_0#describe_resolution.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_resolution_tcxx . . $ stp_resolution_t# *x, |
| 95 | stp_resolution_tcxx . . $ stp_resolution_t# *y); |
| 96 | const char *(*describe_outputcxx . . $ $anonymous_type_aea12ced6c6256e6_0#describe_output.)(const stp_vars_tcxx . . $ stp_vars_t# *v); |
| 97 | int (*verifycxx . . $ $anonymous_type_aea12ced6c6256e6_0#verify.)(stp_vars_tcxx . . $ stp_vars_t# *v); |
| 98 | int (*start_jobcxx . . $ $anonymous_type_aea12ced6c6256e6_0#start_job.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_image_tcxx . . $ stp_image_t# *image); |
| 99 | int (*end_jobcxx . . $ $anonymous_type_aea12ced6c6256e6_0#end_job.)(const stp_vars_tcxx . . $ stp_vars_t# *v, stp_image_tcxx . . $ stp_image_t# *image); |
| 100 | stp_string_list_tcxx . . $ stp_string_list_t# *(*get_external_optionscxx . . $ $anonymous_type_aea12ced6c6256e6_0#get_external_options.)(const stp_vars_tcxx . . $ stp_vars_t# *v); |
| 101 | const stp_papersize_tcxx . . $ stp_papersize_t# *(*describe_papersizecxx . . $ $anonymous_type_aea12ced6c6256e6_0#describe_papersize.)(const stp_vars_tcxx . . $ stp_vars_t# *v, |
| 102 | const char *name); |
| 103 | } stp_printfuncs_tcxx . . $ stp_printfuncs_t#; |
| 104 | |
| 105 | typedef struct stp_familycxx . . $ stp_family# |
| 106 | { |
| 107 | const stp_printfuncs_tcxx . . $ stp_printfuncs_t# *printfuncscxx . . $ stp_family#printfuncs.; /* printfuncs for the printer */ |
| 108 | stp_list_tcxx . . $ stp_list_t# *printer_listcxx . . $ stp_family#printer_list.; /* list of printers */ |
| 109 | } stp_family_tcxx . . $ stp_family_t#; |
| 110 | |
| 111 | extern int stpi_family_registercxx . . $ stpi_family_register(29ae8ff464c7f7e5).(stp_list_tcxx . . $ stp_list_t# *family); |
| 112 | extern int stpi_family_unregistercxx . . $ stpi_family_unregister(29ae8ff464c7f7e5).(stp_list_tcxx . . $ stp_list_t# *family); |
| 113 | |
| 114 | |
| 115 | /* |
| 116 | * Paper size functions |
| 117 | */ |
| 118 | |
| 119 | typedef stp_list_tcxx . . $ stp_list_t# stp_papersize_list_tcxx . . $ stp_papersize_list_t#; |
| 120 | typedef stp_list_item_tcxx . . $ stp_list_item_t# stp_papersize_list_item_tcxx . . $ stp_papersize_list_item_t#; |
| 121 | #define stpi_papersize_list_get_startcxx . . $ `src/main/gutenprint-internal.h:121:9`! stp_list_get_start |
| 122 | #define stpi_papersize_list_get_endcxx . . $ `src/main/gutenprint-internal.h:122:9`! stp_list_get_end |
| 123 | #define stpi_paperlist_item_nextcxx . . $ `src/main/gutenprint-internal.h:123:9`! stp_list_item_next |
| 124 | #define stpi_paperlist_item_prevcxx . . $ `src/main/gutenprint-internal.h:124:9`! stp_list_item_prev |
| 125 | #define stpi_paperlist_item_get_datacxx . . $ `src/main/gutenprint-internal.h:125:9`!(item) (stp_papersize_t *) (stp_list_item_get_data((item))) |
| 126 | |
| 127 | /** |
| 128 | * Get a named list of paper sizes |
| 129 | * @param name the list of paper sizes to find |
| 130 | * @param file name of the file to load (relative to $STP_XML_PATH) |
| 131 | * if the list does not exist. Empty filename indicates that the system |
| 132 | * should identify the file; NULL indicates that the list should not be |
| 133 | * created if it does not exist. |
| 134 | * @returns a static pointer to the papersize list, or NULL on failure |
| 135 | */ |
| 136 | extern const stp_papersize_list_tcxx . . $ stp_papersize_list_t# *stpi_get_papersize_list_namedcxx . . $ stpi_get_papersize_list_named(81f88378de3f2d3).(const char *name, |
| 137 | const char *file); |
| 138 | |
| 139 | /** |
| 140 | * Create a new list of paper sizes without loading from a file. |
| 141 | * @param name the list of paper sizes to create |
| 142 | * @returns a static pointer to the (mutable) papersize list, |
| 143 | * or NULL if the list already exists |
| 144 | */ |
| 145 | extern stp_papersize_list_tcxx . . $ stp_papersize_list_t# *stpi_new_papersize_listcxx . . $ stpi_new_papersize_list(3c3f43458e8c52b9).(const char *name); |
| 146 | |
| 147 | /** |
| 148 | * Find an existing papersize list, if it exists |
| 149 | * @param name the list of paper sizes to find |
| 150 | * @returns a static pointer to the (mutable) papersize list, |
| 151 | * or NULL if the list does not exist |
| 152 | */ |
| 153 | extern stp_papersize_list_tcxx . . $ stp_papersize_list_t# *stpi_find_papersize_list_namedcxx . . $ stpi_find_papersize_list_named(3c3f43458e8c52b9).(const char *name); |
| 154 | |
| 155 | /** |
| 156 | * Get the standard papersize list. |
| 157 | * @returns a static const pointer to the standard paper list. |
| 158 | */ |
| 159 | extern const stp_papersize_list_tcxx . . $ stp_papersize_list_t# *stpi_get_standard_papersize_listcxx . . $ stpi_get_standard_papersize_list(d3875b0f088d0326).(void); |
| 160 | |
| 161 | /** |
| 162 | * Create and return a new paper list |
| 163 | * @returns a pointer to the new paper list |
| 164 | */ |
| 165 | extern stp_papersize_list_tcxx . . $ stp_papersize_list_t# *stpi_create_papersize_listcxx . . $ stpi_create_papersize_list(728167c67729d082).(void); |
| 166 | |
| 167 | /** |
| 168 | * Get a papersize by its name from a list of papersizes Paper sizes |
| 169 | * @param list the list of papers to search |
| 170 | * @param name the name of the paper to search for |
| 171 | * @returns a static pointer to the papersize, or NULL on failure. |
| 172 | */ |
| 173 | extern const stp_papersize_tcxx . . $ stp_papersize_t# *stpi_get_papersize_by_namecxx . . $ stpi_get_papersize_by_name(6661a5a01ab7b09d).(const stp_papersize_list_tcxx . . $ stp_papersize_list_t# *list, |
| 174 | const char *name); |
| 175 | |
| 176 | /** |
| 177 | * Dispatch to printer-specific call to describe paper size |
| 178 | * @param v the Gutenprint vars object |
| 179 | * @param name the name of the paper size |
| 180 | * @returns a static pointer to the papersize, or NULL on failure. |
| 181 | */ |
| 182 | extern const stp_papersize_tcxx . . $ stp_papersize_t# *stpi_printer_describe_papersizecxx . . $ stpi_printer_describe_papersize(977e5bf217e59ec).(const stp_vars_tcxx . . $ stp_vars_t# *v, |
| 183 | const char *name); |
| 184 | |
| 185 | |
| 186 | /** |
| 187 | * Get a papersize by its name from the standard list of papersizes |
| 188 | * @param v the Gutenprint vars object |
| 189 | * @param name the name of the paper size |
| 190 | * @returns a static pointer to the papersize, or NULL on failure. |
| 191 | */ |
| 192 | extern const stp_papersize_tcxx . . $ stp_papersize_t# *stpi_standard_describe_papersizecxx . . $ stpi_standard_describe_papersize(977e5bf217e59ec).(const stp_vars_tcxx . . $ stp_vars_t# *v, |
| 193 | const char *name); |
| 194 | |
| 195 | /** |
| 196 | * Add a new papersize to a list |
| 197 | * @param list the name of the list to search |
| 198 | * @param papersize the stp_papersize_t to add |
| 199 | * @returns 1 on success, 0 on failure (e. g. already exists) |
| 200 | */ |
| 201 | extern int stpi_papersize_createcxx . . $ stpi_papersize_create(57cbead4fcb67a71).(stp_papersize_list_tcxx . . $ stp_papersize_list_t# *list, |
| 202 | stp_papersize_tcxx . . $ stp_papersize_t# *p); |
| 203 | |
| 204 | /** |
| 205 | * Get a papersize by its name from a list |
| 206 | * @param list the name of the list to search |
| 207 | * @param name the name of the paper size |
| 208 | * @returns a static pointer to the papersize, or NULL on failure. |
| 209 | */ |
| 210 | extern const stp_papersize_tcxx . . $ stp_papersize_t# *stpi_get_listed_papersizecxx . . $ stpi_get_listed_papersize(49f21dd3ffd9359c).(const char *list, |
| 211 | const char *name); |
| 212 | |
| 213 | /** |
| 214 | * Get the number of available papersizes. |
| 215 | * @param list the paper size list |
| 216 | * @returns the number of papersizes. |
| 217 | */ |
| 218 | extern int stpi_papersize_countcxx . . $ stpi_papersize_count(c31cc8fb9e1f67aa).(const stp_list_tcxx . . $ stp_list_t# *paper_size_list); |
| 219 | |
| 220 | /** |
| 221 | * Get a papersize by size. |
| 222 | * The nearest available size to the size requested will be found. |
| 223 | * Only paper sizes within 5 points of width and height will be considered. |
| 224 | * @param v the Gutenprint vars object |
| 225 | * @param length the length of the paper. |
| 226 | * @param width the width of the paper |
| 227 | * @returns a static pointer to the papersize, or NULL on failure. |
| 228 | */ |
| 229 | extern const stp_papersize_tcxx . . $ stp_papersize_t# *stpi_get_papersize_by_sizecxx . . $ stpi_get_papersize_by_size(a19d0c2e517567dd).(const stp_papersize_list_tcxx . . $ stp_papersize_list_t# *l, |
| 230 | stp_dimension_tcxx . . $ stp_dimension_t# length, |
| 231 | stp_dimension_tcxx . . $ stp_dimension_t# width); |
| 232 | |
| 233 | /** |
| 234 | * Get a papersize by size if an exact match is found. |
| 235 | * @param v the Gutenprint vars object |
| 236 | * @param length the length of the paper. |
| 237 | * @param width the width of the paper |
| 238 | * @returns a static pointer to the papersize, or NULL on failure. |
| 239 | */ |
| 240 | extern const stp_papersize_tcxx . . $ stp_papersize_t# *stpi_get_papersize_by_size_exactcxx . . $ stpi_get_papersize_by_size_exact(a19d0c2e517567dd).(const stp_papersize_list_tcxx . . $ stp_papersize_list_t# *l, |
| 241 | stp_dimension_tcxx . . $ stp_dimension_t# length, |
| 242 | stp_dimension_tcxx . . $ stp_dimension_t# width); |
| 243 | |
| 244 | /** |
| 245 | * Check for duplicate printers. Abort if any duplicates are found. |
| 246 | */ |
| 247 | extern void stpi_find_duplicate_printerscxx . . $ stpi_find_duplicate_printers(49f6e7a06ebc5aa8).(void); |
| 248 | |
| 249 | extern time_tcxx . . $ time_t# stpi_timecxx . . $ stpi_time(7f38134db6521d23).(time_tcxx . . $ time_t# *t); |
| 250 | |
| 251 | #define CAST_IS_SAFEcxx . . $ `src/main/gutenprint-internal.h:251:9`! GCC_DIAG_OFF(cast-qual) |
| 252 | #define CAST_IS_UNSAFEcxx . . $ `src/main/gutenprint-internal.h:252:9`! GCC_DIAG_ON(cast-qual) |
| 253 | |
| 254 | #pragma GCC diagnostic ignored "-Woverlength-strings" |
| 255 | #pragma GCC diagnostic push |
| 256 | #pragma GCC diagnostic ignored "-Wcast-qual" |
| 257 | static inline void * |
| 258 | stpi_cast_safecxx . . $ stpi_cast_safe(3343d82129b43479).(const void *ptr) |
| 259 | { |
| 260 | return (void *)ptr; |
| 261 | } |
| 262 | #pragma GCC diagnostic pop |
| 263 | |
| 264 | #ifdef __cplusplus |
| 265 | } |
| 266 | #endif |
| 267 | |
| 268 | #endif /* GUTENPRINT_INTERNAL_INTERNAL_H */ |