libgimpprint API Reference: util

Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

# util

Utility functions. More...

## Defines
#define | STP_DBG_LUT 0x1
#define | STP_DBG_COLORFUNC 0x2
#define | STP_DBG_INK 0x4
#define | STP_DBG_PS 0x8
#define | STP_DBG_PCL 0x10
#define | STP_DBG_ESCP2 0x20
#define | STP_DBG_CANON 0x40
#define | STP_DBG_LEXMARK 0x80
#define | STP_DBG_WEAVE_PARAMS 0x100
#define | STP_DBG_ROWS 0x200
#define | STP_DBG_MARK_FILE 0x400
#define | STP_DBG_LIST 0x800
#define | STP_DBG_MODULE 0x1000
#define | STP_DBG_PATH 0x2000
#define | STP_DBG_PAPER 0x4000
#define | STP_DBG_PRINTERS 0x8000
#define | STP_DBG_XML 0x10000
#define | STP_DBG_VARS 0x20000
#define | STP_DBG_OLYMPUS 0x40000
#define | STP_DBG_CURVE 0x80000
#define | STP_DBG_CURVE_ERRORS 0x100000
#define | STP_SAFE_FREE(x)
## Functions
int | stp_init (void)
| Initialise libgimpprint.
const char * | stp_set_output_codeset (const char *codeset)
| Set the output encoding.
stp_curve_t * | stp_read_and_compose_curves (const char *s1, const char *s2, stp_curve_compose_t comp, size_t piecewise_point_count)
void | stp_abort (void)
void | stp_prune_inactive_options (stp_vars_t *v)
void | stp_zprintf (const stp_vars_t *v, const char *format,...) __attribute__((format(__printf__
void | stp_zfwrite (const char *buf, size_t bytes, size_t nitems, const stp_vars_t *v)
void | stp_putc (int ch, const stp_vars_t *v)
void | stp_put16_le (unsigned short sh, const stp_vars_t *v)
void | stp_put16_be (unsigned short sh, const stp_vars_t *v)
void | stp_put32_le (unsigned int sh, const stp_vars_t *v)
void | stp_put32_be (unsigned int sh, const stp_vars_t *v)
void | stp_puts (const char *s, const stp_vars_t *v)
void | stp_send_command (const stp_vars_t *v, const char *command, const char *format,...)
void | stp_erputc (int ch)
void | stp_eprintf (const stp_vars_t *v, const char *format,...) __attribute__((format(__printf__
void | stp_erprintf (const char *format,...) __attribute__((format(__printf__
void | stp_asprintf (char **strp, const char *format,...) __attribute__((format(__printf__
void | stp_catprintf (char **strp, const char *format,...) __attribute__((format(__printf__
unsigned long | stp_get_debug_level (void)
void | stp_dprintf (unsigned long level, const stp_vars_t *v, const char *format,...) __attribute__((format(__printf__
void | stp_deprintf (unsigned long level, const char *format,...) __attribute__((format(__printf__
void | stp_init_debug_messages (stp_vars_t *v)
void | stp_flush_debug_messages (stp_vars_t *v)
void * | stp_malloc (size_t)
void * | stp_zalloc (size_t)
void * | stp_realloc (void *ptr, size_t)
void | stp_free (void *ptr)
size_t | stp_strlen (const char *s)
char * | stp_strndup (const char *s, int n)
char * | stp_strdup (const char *s)

## Detailed Description

Utility functions.

## Define Documentation

#define STP_DBG_CANON 0x40

| Definition at line 111 of file util.h. Referenced by canon_density(), canon_inks(), and canon_write().

#define STP_DBG_COLORFUNC 0x2

| Definition at line 106 of file util.h. Referenced by stp_color_register(), and stp_color_unregister().

#define STP_DBG_CURVE 0x80000

| Definition at line 124 of file util.h. Referenced by compute_spline_deltas_piecewise(), and interpolate_gamma_internal().

#define STP_DBG_CURVE_ERRORS 0x100000

| Definition at line 125 of file util.h. Referenced by interpolate_points(), stp_curve_create_from_file(), stp_curve_create_from_xmltree(), stp_curve_set_data(), stp_curve_set_data_points(), stp_xmltree_create_from_curve(), stpi_curve_check_parameters(), xml_doc_get_curve(), and xmldoc_create_from_curve().

#define STP_DBG_ESCP2 0x20

| Definition at line 110 of file util.h. Referenced by escp2_find_resolution().

#define STP_DBG_INK 0x4

| Definition at line 107 of file util.h. Referenced by set_raw_ink_type(), stp_channel_set_black_channel(), stp_channel_set_cutoff_adjustment(), stp_channel_set_density_adjustment(), stp_channel_set_ink_limit(), stp_dither_set_inks_full(), stpi_dither_finalize_ranges(), and stpi_dither_set_ranges().

#define STP_DBG_LEXMARK 0x80

| Definition at line 112 of file util.h.

#define STP_DBG_LIST 0x800

| Definition at line 116 of file util.h. Referenced by stp_list_create(), stp_list_destroy(), stp_list_item_create(), stp_list_item_destroy(), and stp_list_node_free_data().

#define STP_DBG_LUT 0x1

| Definition at line 105 of file util.h. Referenced by setup_channel(), and stpi_compute_lut().

#define STP_DBG_MARK_FILE 0x400

| Definition at line 115 of file util.h. Referenced by escp2_set_remote_sequence().

#define STP_DBG_MODULE 0x1000

| Definition at line 117 of file util.h. Referenced by stp_module_init(), stp_module_open(), and stp_module_register().

#define STP_DBG_OLYMPUS 0x40000

| Definition at line 123 of file util.h. Referenced by cx400_printer_init_func(), olympus_do_print(), olympus_get_cached_output(), olympus_get_model_capabilities(), p300_block_init_func(), p300_plane_end_func(), and p440_block_end_func().

#define STP_DBG_PAPER 0x4000

| Definition at line 119 of file util.h. Referenced by stp_verify_printer_params(), and stpi_paper_create().

#define STP_DBG_PATH 0x2000

| Definition at line 118 of file util.h. Referenced by stp_path_search(), and stpi_path_check().

#define STP_DBG_PCL 0x10

| Definition at line 109 of file util.h. Referenced by pcl_printfunc(), pcl_string_to_val(), and pcl_val_to_string().

#define STP_DBG_PRINTERS 0x8000

| Definition at line 120 of file util.h. Referenced by stp_family_register(), stp_family_unregister(), and stp_initialize_printer_defaults().

#define STP_DBG_PS 0x8

| Definition at line 108 of file util.h. Referenced by ps_imageable_area_internal(), ps_media_size_internal(), and ps_print_internal().

#define STP_DBG_ROWS 0x200

| Definition at line 114 of file util.h. Referenced by finalize_row().

#define STP_DBG_VARS 0x20000

| Definition at line 122 of file util.h. Referenced by stp_set_default_string_parameter(), stp_set_string_parameter(), stp_set_string_parameter_n(), stp_verify_parameter(), stp_verify_printer_params(), verify_curve_param(), verify_dimension_param(), verify_double_param(), verify_int_param(), and verify_string_param().

#define STP_DBG_WEAVE_PARAMS 0x100

| Definition at line 113 of file util.h. Referenced by calculate_pass_map(), and weave_parameters_by_row().

#define STP_DBG_XML 0x10000

| Definition at line 121 of file util.h. Referenced by stp_curve_create_from_file(), stp_curve_create_from_stream(), stp_curve_create_from_string(), stp_printer_create_from_xmltree(), stp_sequence_create_from_xmltree(), stp_xml_dither_cache_get(), stp_xml_dither_cache_set(), stp_xml_init_defaults(), stp_xml_parse_file(), stp_xml_parse_file_named(), stp_xml_process_dither_matrix(), stp_xml_process_paper(), stpi_dither_array_create_from_file(), and stpi_xml_process_family().

#define STP_SAFE_FREE | ( | x |  | ) |

| Value:
    do                                              \
    {                                               \
      if ((x))                                      \
        stp_free((char *)(x));                      \
      ((x)) = NULL;                                 \
    } while (0)
Definition at line 142 of file util.h. Referenced by clear_a_channel(), free_eventone_data(), free_lut(), invalidate_auxiliary_data(), invalidate_auxilliary_data(), shared_ed_deinitializer(), stp_dither_set_ink_spread(), stp_vars_destroy(), stpi_channel_clear(), stpi_dither_channel_destroy(), stpi_dither_free(), stpi_dither_set_ranges(), and stpi_paper_freefunc().

## Function Documentation

void stp_abort | ( | void |  | ) |

| Definition at line 627 of file print-util.c. Referenced by add_to_row(), check_array(), check_color(), check_curve(), check_sequence(), compute_gcr_curve(), null_list(), null_printer(), null_vars(), stp_dither_init(), stp_malloc(), and stp_realloc().

void stp_asprintf | ( | char ** | strp,
|  | const char * | format,
|  |  | ...
| ) |

void stp_catprintf | ( | char ** | strp,
|  | const char * | format,
|  |  | ...
| ) |

void stp_deprintf | ( | unsigned long | level,
|  | const char * | format,
|  |  | ...
| ) |

| Referenced by stp_color_register(), stp_color_unregister(), stp_family_register(), stp_family_unregister(), and stp_initialize_printer_defaults().

void stp_dprintf | ( | unsigned long | level,
|  | const stp_vars_t * | v,
|  | const char * | format,
|  |  | ...
| ) |

void stp_eprintf | ( | const stp_vars_t * | v,
|  | const char * | format,
|  |  | ...
| ) |

| Referenced by set_raw_ink_type().

void stp_erprintf | ( | const char * | format,
|  |  | ...
| ) |

| Referenced by stp_get_boolean_parameter(), stp_get_dimension_parameter(), stp_get_float_parameter(), stp_get_int_parameter(), stp_sequence_create_from_xmltree(), and stp_xml_parse_file().

void stp_erputc | ( | int | ch | ) |

| Definition at line 287 of file print-util.c.

void stp_flush_debug_messages | ( | stp_vars_t * | v | ) |

| Definition at line 379 of file print-util.c. References debug_msgbuf_t::bytes, debug_msgbuf_t::data, debug_msgbuf_t::odata, debug_msgbuf_t::ofunc, stp_eprintf(), stp_free(), stp_get_errdata(), stp_get_verified(), stp_set_errdata(), stp_set_errfunc(), stp_set_verified(), and stp_vars_t. Referenced by setup_inks(), and stpi_dither_set_ranges().

void stp_free | ( | void * | ptr | ) |

| Definition at line 435 of file print-util.c. References stpi_free_func. Referenced by canon_cmd(), compdata_freefunc(), compute_a_curve_fast(), compute_a_curve_full(), compute_gcr_curve(), compute_intervals(), compute_spline_deltas_dense(), compute_spline_deltas_piecewise(), compute_user_correction(), escp2_do_print(), escp2_print_data(), escp2_print_page(), free_list_element(), free_lut(), insert_subchannel(), invert_curve(), invert_map(), olympus_do_print(), print_debug_params(), ps_print_internal(), raw_print(), send_extra_data(), sequence_dtor(), set_long_name_cache(), set_name_cache(), set_raw_parameter(), stp_array_destroy(), stp_catprintf(), stp_curve_compose(), stp_curve_destroy(), stp_curve_resample(), stp_curve_rescale(), stp_dither_matrix_destroy(), stp_dither_matrix_shear(), stp_dither_set_inks(), stp_dither_set_inks_simple(), stp_dprintf(), stp_eprintf(), stp_flush_debug_messages(), stp_initialize_weave(), stp_list_destroy(), stp_list_item_create(), stp_list_item_destroy(), stp_list_node_free_data(), stp_printer_create_from_xmltree(), stp_sequence_destroy(), stp_sequence_set_data(), stp_sequence_set_size(), stp_vars_destroy(), stp_verify_printer_params(), stp_xml_process_paper(), stp_xmltree_create_from_array(), stp_xmltree_create_from_curve(), stp_xmltree_create_from_sequence(), stp_zprintf(), stpi_channel_free(), stpi_destroy_weave(), stpi_destroy_weave_params(), stpi_dither_free(), stpi_dither_predithered(), stpi_dither_very_fast(), stpi_path_check(), stpi_printer_freefunc(), value_freefunc(), xml_preload_freefunc(), and xml_registry_freefunc().

unsigned long stp_get_debug_level | ( | void |  | ) |

| Definition at line 320 of file print-util.c. References stpi_debug_level, and stpi_init_debug(). Referenced by escp2_set_remote_sequence(), stp_printer_create_from_xmltree(), and stp_xml_process_paper().

int stp_init | ( | void |  | ) |

| Initialise libgimpprint. This function must be called prior to any other use of the library. It is responsible for loading modules and XML data and initialising internal data structures. Returns: 0 on success, 1 on failure. Definition at line 441 of file print-util.c. References bindtextdomain, stp_initialize_printer_defaults(), stp_module_init(), stp_module_load(), stp_xml_init_defaults(), stp_xml_preinit(), stpi_init_debug(), stpi_init_dither(), stpi_init_paper(), and stpi_init_printer().

void stp_init_debug_messages | ( | stp_vars_t * | v | ) |

| Definition at line 365 of file print-util.c. References debug_msgbuf_t::bytes, debug_msgbuf_t::data, fill_buffer_writefunc(), debug_msgbuf_t::odata, debug_msgbuf_t::ofunc, stp_get_errdata(), stp_get_errfunc(), stp_get_verified(), stp_malloc(), stp_set_errdata(), stp_set_errfunc(), stp_set_verified(), and stp_vars_t. Referenced by setup_inks(), and stpi_dither_set_ranges().

void* stp_malloc | ( | size_t |  | ) |

| Definition at line 401 of file print-util.c. References stp_abort(), and stp_malloc_func. Referenced by allocate_lineactive(), allocate_linebounds(), allocate_linebuf(), allocate_linecount(), allocate_lineoff(), compute_a_curve_fast(), compute_a_curve_full(), compute_gcr_curve(), compute_linear_deltas(), compute_spline_deltas_dense(), compute_spline_deltas_piecewise(), compute_user_correction(), copy_lut(), copy_to_raw(), copyfunc(), escp2_print_data(), et_setup(), fill_buffer_writefunc(), initialize_weave_params(), insert_subchannel(), invert_curve(), invert_map(), make_passmap(), olympus_do_print(), olympus_get_cached_output(), ps_print_internal(), raw_print(), send_extra_data(), set_default_raw_parameter(), set_raw_parameter(), shared_ed_initializer(), stp_allocate_component_data(), stp_channel_initialize(), stp_curve_compose(), stp_curve_rescale(), stp_dither_matrix_copy(), stp_dither_matrix_init(), stp_dither_matrix_init_from_dither_array(), stp_dither_matrix_init_short(), stp_dither_matrix_iterated_init(), stp_dither_matrix_shear(), stp_dither_set_ink_spread(), stp_dither_set_inks(), stp_dither_set_inks_simple(), stp_init_debug_messages(), stp_list_create(), stp_list_item_create(), stp_path_split(), stp_register_xml_parser(), stp_set_array_parameter(), stp_set_boolean_parameter(), stp_set_curve_parameter(), stp_set_default_array_parameter(), stp_set_default_boolean_parameter(), stp_set_default_curve_parameter(), stp_set_default_dimension_parameter(), stp_set_default_float_parameter(), stp_set_default_int_parameter(), stp_set_dimension_parameter(), stp_set_float_parameter(), stp_set_int_parameter(), stp_strdup(), stp_string_list_add_string(), stp_strndup(), stp_xml_dither_cache_set(), stp_zalloc(), stpi_color_traditional_init(), stpi_path_merge(), and value_copy().

void stp_prune_inactive_options | ( | stp_vars_t * | v | ) |

| Definition at line 1308 of file print-vars.c. References value_t::active, value_t::name, stp_vars::params, stp_get_parameter_list(), stp_list_get_start(), stp_list_item_destroy(), stp_list_item_get_data(), stp_list_item_next(), stp_list_item_t, stp_list_t, STP_PARAMETER_DEFAULTED, stp_parameter_find(), stp_parameter_list_destroy(), stp_parameter_list_t, STP_PARAMETER_TYPE_INVALID, and stp_vars_t. Referenced by escp2_job_end(), escp2_job_start(), escp2_print(), olympus_print(), ps_print_internal(), raw_print(), and stp_verify().

void stp_put16_be | ( | unsigned short | sh,
|  | const stp_vars_t * | v
| ) |

| Definition at line 144 of file print-util.c. References BYTE, stp_putc(), and stp_vars_t. Referenced by canon_write(), cpx00_plane_init_func(), cpx00_printer_init_func(), p300_block_init_func(), p300_printer_init_func(), p400_block_init_func(), p400_printer_init_func(), p440_block_init_func(), p440_printer_init_func(), stp_send_command(), updp10_printer_end_func(), and updp10_printer_init_func().

void stp_put16_le | ( | unsigned short | sh,
|  | const stp_vars_t * | v
| ) |

| Definition at line 137 of file print-util.c. References BYTE, stp_putc(), and stp_vars_t. Referenced by canon_cmd(), canon_write(), cpx00_plane_init_func(), cx400_printer_init_func(), p10_block_init_func(), and stp_send_command().

void stp_put32_be | ( | unsigned int | sh,
|  | const stp_vars_t * | v
| ) |

| Definition at line 160 of file print-util.c. References BYTE, stp_putc(), and stp_vars_t. Referenced by p200_plane_init_func(), stp_send_command(), and updp10_printer_init_func().

void stp_put32_le | ( | unsigned int | sh,
|  | const stp_vars_t * | v
| ) |

| Definition at line 151 of file print-util.c. References BYTE, stp_putc(), and stp_vars_t. Referenced by cpx00_plane_init_func(), stp_send_command(), and updp10_printer_init_func().

void stp_putc | ( | int | ch,
|  | const stp_vars_t * | v
| ) |

| Definition at line 128 of file print-util.c. References stp_get_outdata(), stp_get_outfunc(), and stp_vars_t. Referenced by canon_cmd(), canon_write(), cpx00_printer_init_func(), cx400_printer_init_func(), p400_printer_init_func(), p440_printer_init_func(), ps_ascii85(), ps_hex(), send_extra_data(), stp_put16_be(), stp_put16_le(), stp_put32_be(), stp_put32_le(), and stp_send_command().

void stp_puts | ( | const char * | s,
|  | const stp_vars_t * | v
| ) |

| Definition at line 169 of file print-util.c. References stp_get_outdata(), stp_get_outfunc(), and stp_vars_t. Referenced by canon_init_resetPrinter(), ps_ascii85(), ps_print_internal(), stp_send_command(), and stpi_escp2_deinit_printer().

stp_curve_t* stp_read_and_compose_curves | ( | const char * | s1,
|  | const char * | s2,
|  | stp_curve_compose_t | comp,
|  | size_t | piecewise_point_count
| ) |

| Definition at line 524 of file print-util.c. References stp_curve_compose(), stp_curve_create_from_string(), stp_curve_destroy(), stp_curve_is_piecewise(), stp_curve_resample(), and stp_curve_t.

void* stp_realloc | ( | void * | ptr,
|  | size_t |
| ) |

| Definition at line 422 of file print-util.c. References stp_abort(), and stpi_realloc_func. Referenced by fill_buffer_writefunc(), insert_channel(), and stp_channel_add().

void stp_send_command | ( | const stp_vars_t * | v,
|  | const char * | command,
|  | const char * | format,
|  |  | ...
| ) |

| Definition at line 175 of file print-util.c. References stp_put16_be(), stp_put16_le(), stp_put32_be(), stp_put32_le(), stp_putc(), stp_puts(), and stp_vars_t. Referenced by escp2_reset_printer(), escp2_set_color(), escp2_set_dot_size(), escp2_set_form_factor(), escp2_set_graphics_mode(), escp2_set_margins(), escp2_set_page_height(), escp2_set_printer_weave(), escp2_set_printhead_resolution(), escp2_set_printhead_speed(), escp2_set_remote_sequence(), escp2_set_resolution(), print_debug_params(), print_remote_param(), send_print_command(), set_color(), set_horizontal_position(), set_vertical_position(), stpi_escp2_deinit_printer(), stpi_escp2_flush_pass(), and stpi_escp2_terminate_page().

const char* stp_set_output_codeset | ( | const char * | codeset | ) |

  | Set the output encoding. This function sets the encoding that all strings translated by gettext are output in. It is a wrapper around the gettext bind_textdomain_codeset() function. Parameters:
  codeset | the standard name of the encoding, which must be usable with iconv_open(). For example, "US-ASCII" or "UTF-8". If NULL, the currently-selected codeset will be returned (or NULL if no codeset has been selected yet).
Returns: a string containing the selected codeset, or NULL on failure (errno is set accordingly). Definition at line 514 of file print-util.c.

char* stp_strdup | ( | const char * | s | ) |

| Definition at line 500 of file print-util.c. References stp_malloc(), stp_strlen(), and stp_strndup(). Referenced by copyfunc(), initialize_standard_vars(), set_default_raw_parameter(), set_long_name_cache(), set_name_cache(), set_raw_parameter(), stp_allocate_component_data(), stp_printer_create_from_xmltree(), stp_register_xml_parser(), stp_register_xml_preload(), stp_set_array_parameter(), stp_set_boolean_parameter(), stp_set_curve_parameter(), stp_set_default_array_parameter(), stp_set_default_boolean_parameter(), stp_set_default_curve_parameter(), stp_set_default_dimension_parameter(), stp_set_default_float_parameter(), stp_set_default_int_parameter(), stp_set_dimension_parameter(), stp_set_float_parameter(), stp_set_int_parameter(), stp_string_list_add_string(), stp_xml_dither_cache_set(), stp_xml_process_paper(), and value_copy().

size_t stp_strlen | ( | const char * | s | ) |

| Definition at line 475 of file print-util.c. Referenced by stp_strdup().

char* stp_strndup | ( | const char * | s,
|  | int | n
| ) |

| Definition at line 481 of file print-util.c. References stp_malloc(). Referenced by stp_strdup().

void* stp_zalloc | ( | size_t |  | ) |

| Definition at line 414 of file print-util.c. References stp_malloc(). Referenced by allocate_channels(), allocate_lineactive(), allocate_linebounds(), allocate_linebuf(), allocate_linecount(), allocate_lineoff(), allocate_lut(), canon_cmd(), check_linebases(), escp2_do_print(), et_setup(), olympus_do_print(), ppd_find(), setup_head_offset(), stp_array_create(), stp_channel_add(), stp_channel_initialize(), stp_curve_create(), stp_dither_init(), stp_initialize_weave(), stp_printer_create_from_xmltree(), stp_sequence_copy(), stp_sequence_create(), stp_sequence_set_data(), stp_sequence_set_size(), stp_vars_create(), stp_write_weave(), stp_xml_process_paper(), stpi_dither_get_errline(), stpi_dither_predithered(), stpi_dither_set_ranges(), and stpi_dither_very_fast().

void stp_zfwrite | ( | const char * | buf,
|  | size_t | bytes,
|  | size_t | nitems,
|  | const stp_vars_t * | v
| ) |

| Definition at line 122 of file print-util.c. References stp_get_outdata(), stp_get_outfunc(), and stp_vars_t. Referenced by canon_cmd(), canon_write(), cpx00_plane_init_func(), cpx00_printer_init_func(), cx400_printer_init_func(), escp2_reset_printer(), escp2_set_remote_sequence(), lexmark_init_printer(), lexmark_write(), olympus_do_print(), p10_printer_end_func(), p10_printer_init_func(), p200_printer_init_func(), p300_printer_init_func(), p400_block_init_func(), p400_plane_end_func(), p400_plane_init_func(), p400_printer_init_func(), p440_block_end_func(), p440_block_init_func(), p440_printer_end_func(), p440_printer_init_func(), ps_ascii85(), raw_print(), send_extra_data(), stpi_escp2_deinit_printer(), stpi_escp2_flush_pass(), updp10_printer_end_func(), and updp10_printer_init_func().

void stp_zprintf | ( | const stp_vars_t * | v,
|  | const char * | format,
|  |  | ...
| ) |