libgimpprint API Reference: printers.c File Reference

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

# src/main/printers.c File Reference

`#include <gimp-print/gimp-print.h>`
`#include "gimp-print-internal.h"`
`#include <gimp-print/gimp-print-intl-internal.h>`
`#include <math.h>`
`#include <string.h>`
`#include <stdlib.h>`

Go to the source code of this file.

## Data Structures
struct | stp_printer
struct | errbuf_t
## Defines
#define | FMIN(a, b) ((a) < (b) ? (a) : (b))
#define | CHECK_INT_RANGE(v, component, min, max)
#define | CHECK_INT_RANGE_INTERNAL(v, component, min, max)
## Functions
void | stpi_printer_freefunc (void *item)
const char * | stpi_printer_namefunc (const void *item)
const char * | stpi_printer_long_namefunc (const void *item)
int | stpi_init_printer_list (void)
int | stp_printer_model_count (void)
| Get the number of available printer models.
void | null_printer (void)
void | check_printer (const stp_printer_t *p)
const stp_printer_t * | stp_get_printer_by_index (int idx)
| Get a printer model by its index number.
const char * | stp_printer_get_driver (const stp_printer_t *printer)
| Get a printer model's short (driver) name.
const char * | stp_printer_get_long_name (const stp_printer_t *printer)
| Get a printer model's long (translated) name.
const char * | stp_printer_get_family (const stp_printer_t *printer)
| Get a printer model's family name.
const char * | stp_printer_get_manufacturer (const stp_printer_t *printer)
| Get a printer model's manufacturer's name.
int | stp_printer_get_model (const stp_printer_t *printer)
| Get a printer model's model number.
const stp_printfuncs_t * | stpi_get_printfuncs (const stp_printer_t *printer)
const stp_vars_t * | stp_printer_get_defaults (const stp_printer_t *printer)
| Get the default vars for a particular printer model.
const stp_printer_t * | stp_get_printer_by_long_name (const char *long_name)
| Get a printer model by its long (translated) name.
const stp_printer_t * | stp_get_printer_by_driver (const char *driver)
| Get a printer model by its short name.
int | stp_get_printer_index_by_driver (const char *driver)
| Get the printer index number from the printer model short (driver) name.
const stp_printer_t * | stp_get_printer (const stp_vars_t *v)
| Get the printer model from a vars object.
int | stp_get_model_id (const stp_vars_t *v)
stp_parameter_list_t | stp_printer_list_parameters (const stp_vars_t *v)
void | stp_printer_describe_parameter (const stp_vars_t *v, const char *name, stp_parameter_t *description)
void | set_printer_defaults (stp_vars_t *v, int core_only)
void | stp_set_printer_defaults (stp_vars_t *v, const stp_printer_t *printer)
| Set a vars object to use a particular driver, and set the parameter to its defaults.
void | stp_initialize_printer_defaults (void)
void | stp_get_media_size (const stp_vars_t *v, int *width, int *height)
| Get the media (paper) size.
void | stp_get_imageable_area (const stp_vars_t *v, int *left, int *right, int *bottom, int *top)
| Get the imagable area of the page.
void | stp_get_size_limit (const stp_vars_t *v, int *max_width, int *max_height, int *min_width, int *min_height)
| Get the media size limits.
void | stp_describe_resolution (const stp_vars_t *v, int *x, int *y)
| Retrieve the printing resolution of the selected resolution.
const char * | stp_describe_output (const stp_vars_t *v)
int | stp_verify (stp_vars_t *v)
| Verify parameters.
int | stp_print (const stp_vars_t *v, stp_image_t *image)
| Print the image.
int | stp_start_job (const stp_vars_t *v, stp_image_t *image)
| Start a print job.
int | stp_end_job (const stp_vars_t *v, stp_image_t *image)
| End a print job.
int | verify_string_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
int | verify_double_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
int | verify_int_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
int | verify_dimension_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
int | verify_curve_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
stp_parameter_verify_t | stp_verify_parameter (const stp_vars_t *v, const char *parameter, int quiet)
void | fill_buffer_writefunc (void *priv, const char *buffer, size_t bytes)
int | stp_verify_printer_params (stp_vars_t *v)
int | stp_family_register (stp_list_t *family)
int | stp_family_unregister (stp_list_t *family)
stp_printer_t * | stp_printer_create_from_xmltree (stp_mxml_node_t *printer, const char *family, const stp_printfuncs_t *printfuncs)
void | stpi_xml_process_family (stp_mxml_node_t *family)
int | stpi_xml_process_printdef (stp_mxml_node_t *printdef, const char *file)
void | stpi_init_printer (void)
## Variables
stp_list_t * | printer_list = NULL

## Define Documentation

#define CHECK_INT_RANGE | ( | v,
|  | component,
|  | min,
|  | max |  | ) |

| Value:
    do                                                                          \
    {                                                                           \
      if (stp_get_##component((v)) < (min) || stp_get_##component((v)) > (max)) \
        {                                                                       \
          answer = 0;                                                           \
          stp_eprintf(v, _("%s out of range (value %d, min %d, max %d)\n"),     \
                      #component, stp_get_##component(v), min, max);            \
        }                                                                       \
    } while (0)
Definition at line 636 of file printers.c.

#define CHECK_INT_RANGE_INTERNAL | ( | v,
|  | component,
|  | min,
|  | max |  | ) |

| Value:
    do                                                                            \
    {                                                                             \
      if (stpi_get_##component((v)) < (min) || stpi_get_##component((v)) > (max)) \
        {                                                                         \
          answer = 0;                                                             \
          stp_eprintf(v, _("%s out of range (value %d, min %d, max %d)\n"),       \
                      #component, stpi_get_##component(v), min, max);             \
        }                                                                         \
    } while (0)
Definition at line 647 of file printers.c.

#define FMIN | ( | a,
|  | b |  | ) | ((a) < (b) ? (a) : (b))

| Definition at line 42 of file printers.c.

## Function Documentation

void check_printer | ( | const stp_printer_t * | p | ) | `[inline, static]`

| Definition at line 96 of file printers.c. References null_printer(), and stp_printer_t.

void fill_buffer_writefunc | ( | void * | priv,
|  | const char * | buffer,
|  | size_t | bytes
| ) | `[static]`

| Definition at line 665 of file printers.c. References errbuf_t::bytes, errbuf_t::data, stp_malloc(), and stp_realloc(). Referenced by stp_verify_printer_params().

void null_printer | ( | void |  | ) | `[static]`

| Definition at line 89 of file printers.c. References stp_abort(), and stp_erprintf(). Referenced by check_printer().

void set_printer_defaults | ( | stp_vars_t * | v,
|  | int | core_only
| ) | `[static]`

| Definition at line 261 of file printers.c. References stp_parameter_t::deflt, stp_parameter_t::is_mandatory, stp_parameter_t::name, stp_parameter_t::p_class, stp_parameter_t::p_type, stp_describe_parameter(), stp_get_parameter_list(), STP_PARAMETER_ACTIVE, STP_PARAMETER_CLASS_CORE, stp_parameter_description_destroy(), stp_parameter_list_count(), stp_parameter_list_destroy(), stp_parameter_list_param(), stp_parameter_list_t, STP_PARAMETER_TYPE_ARRAY, STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_TYPE_CURVE, STP_PARAMETER_TYPE_DIMENSION, STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_TYPE_INT, STP_PARAMETER_TYPE_STRING_LIST, stp_set_array_parameter(), stp_set_array_parameter_active(), stp_set_boolean_parameter(), stp_set_boolean_parameter_active(), stp_set_curve_parameter(), stp_set_curve_parameter_active(), stp_set_dimension_parameter(), stp_set_dimension_parameter_active(), stp_set_float_parameter(), stp_set_float_parameter_active(), stp_set_int_parameter(), stp_set_int_parameter_active(), stp_set_string_parameter(), stp_set_string_parameter_active(), and stp_vars_t. Referenced by stp_initialize_printer_defaults(), and stp_set_printer_defaults().

stp_printer_t* stp_printer_create_from_xmltree | ( | stp_mxml_node_t * | printer,
|  | const char * | family,
|  | const stp_printfuncs_t * | printfuncs
| ) | `[static]`

| Definition at line 862 of file printers.c. References stp_mxml_node_s::child, stp_printer::driver, stp_mxml_value_u::element, stp_printer::family, stp_printer::long_name, stp_printer::manufacturer, stp_printer::model, stp_mxml_value_s::name, stp_mxml_node_s::next, stp_printer::printfuncs, stp_printer::printvars, stp_array_create_from_xmltree(), stp_array_destroy(), stp_array_t, stp_curve_create_from_xmltree(), stp_curve_destroy(), stp_curve_t, STP_DBG_XML, stp_erprintf(), stp_free(), stp_get_debug_level(), stp_get_driver(), STP_MXML_ELEMENT, stp_mxml_node_t, STP_MXML_TEXT, stp_mxmlElementGetAttr(), stp_printer_t, stp_set_array_parameter(), stp_set_boolean_parameter(), stp_set_curve_parameter(), stp_set_driver(), stp_set_float_parameter(), stp_set_int_parameter(), stp_set_string_parameter(), stp_strdup(), stp_vars_create(), stp_xmlstrtod(), stp_xmlstrtol(), stp_zalloc(), stp_mxml_text_s::string, stp_mxml_value_u::text, stp_mxml_node_s::type, and stp_mxml_node_s::value. Referenced by stpi_xml_process_family().

const stp_printfuncs_t* stpi_get_printfuncs | ( | const stp_printer_t * | printer | ) | `[inline, static]`

| Definition at line 172 of file printers.c. References stp_printer::printfuncs, and stp_printer_t. Referenced by stp_describe_output(), stp_describe_resolution(), stp_end_job(), stp_get_imageable_area(), stp_get_media_size(), stp_get_size_limit(), stp_print(), stp_printer_describe_parameter(), stp_printer_list_parameters(), stp_start_job(), and stp_verify().

int stpi_init_printer_list | ( | void |  | ) | `[static]`

| Definition at line 63 of file printers.c. References stp_list_create(), stp_list_destroy(), stp_list_set_freefunc(), stp_list_set_long_namefunc(), stp_list_set_namefunc(), stpi_printer_freefunc(), stpi_printer_long_namefunc(), and stpi_printer_namefunc(). Referenced by stp_family_register(), stp_family_unregister(), stp_get_printer_by_driver(), stp_get_printer_by_index(), stp_get_printer_by_long_name(), stp_initialize_printer_defaults(), and stp_printer_model_count().

void stpi_printer_freefunc | ( | void * | item | ) | `[static]`

| Definition at line 119 of file printers.c. References stp_printer::family, stp_printer::long_name, stp_free(), and stp_printer_t. Referenced by stpi_init_printer_list().

const char * stpi_printer_long_namefunc | ( | const void * | item | ) | `[static]`

| Definition at line 147 of file printers.c. References stp_printer::long_name, and stp_printer_t. Referenced by stpi_init_printer_list().

const char * stpi_printer_namefunc | ( | const void * | item | ) | `[static]`

| Definition at line 134 of file printers.c. References stp_printer::driver, and stp_printer_t. Referenced by stpi_init_printer_list().

void stpi_xml_process_family | ( | stp_mxml_node_t * | family | ) | `[static]`

| Definition at line 987 of file printers.c. References stp_mxml_node_s::child, stp_mxml_value_u::element, stp_mxml_value_s::name, stp_module::name, stp_mxml_node_s::next, stp_family::printer_list, stp_family::printfuncs, STP_DBG_XML, stp_deprintf(), stp_family_t, stp_list_create(), stp_list_destroy(), stp_list_get_start(), stp_list_item_create(), stp_list_item_get_data(), stp_list_item_next(), stp_list_item_t, stp_list_t, STP_MODULE_CLASS_FAMILY, stp_module_get_class(), stp_module_t, STP_MXML_ELEMENT, stp_mxml_node_t, stp_mxmlElementGetAttr(), stp_printer_create_from_xmltree(), stp_printer_t, stp_module::syms, stp_mxml_node_s::type, and stp_mxml_node_s::value. Referenced by stpi_xml_process_printdef().

int stpi_xml_process_printdef | ( | stp_mxml_node_t * | printdef,
|  | const char * | file
| ) | `[static]`

| Definition at line 1048 of file printers.c. References stp_mxml_node_s::child, stp_mxml_value_u::element, stp_mxml_value_s::name, stp_mxml_node_s::next, STP_MXML_ELEMENT, stp_mxml_node_t, stpi_xml_process_family(), stp_mxml_node_s::type, and stp_mxml_node_s::value. Referenced by stpi_init_printer().

int verify_curve_param | ( | const stp_vars_t * | v,
|  | const char * | parameter,
|  | stp_parameter_t * | desc,
|  | int | quiet
| ) | `[static]`

| Definition at line 554 of file printers.c. References _, stp_parameter_t::bounds, stp_parameter_t::is_mandatory, PARAMETER_BAD, stp_check_curve_parameter(), stp_curve_get_bounds(), stp_curve_get_wrap(), stp_curve_t, STP_CURVE_WRAP_NONE, STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_curve_parameter(), STP_PARAMETER_ACTIVE, stp_parameter_description_destroy(), stp_parameter_verify_t, and stp_vars_t. Referenced by stp_verify_parameter().

int verify_dimension_param | ( | const stp_vars_t * | v,
|  | const char * | parameter,
|  | stp_parameter_t * | desc,
|  | int | quiet
| ) | `[static]`

| Definition at line 530 of file printers.c. References _, stp_parameter_t::bounds, stp_parameter_t::is_mandatory, PARAMETER_BAD, PARAMETER_OK, stp_check_dimension_parameter(), STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_dimension_parameter(), STP_PARAMETER_ACTIVE, stp_parameter_description_destroy(), and stp_vars_t. Referenced by stp_verify_parameter().

int verify_double_param | ( | const stp_vars_t * | v,
|  | const char * | parameter,
|  | stp_parameter_t * | desc,
|  | int | quiet
| ) | `[static]`

| Definition at line 484 of file printers.c. References _, stp_parameter_t::bounds, stp_parameter_t::is_mandatory, PARAMETER_BAD, PARAMETER_OK, stp_check_float_parameter(), STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_float_parameter(), STP_PARAMETER_ACTIVE, and stp_vars_t. Referenced by stp_verify_parameter().

int verify_int_param | ( | const stp_vars_t * | v,
|  | const char * | parameter,
|  | stp_parameter_t * | desc,
|  | int | quiet
| ) | `[static]`

| Definition at line 506 of file printers.c. References _, stp_parameter_t::bounds, stp_parameter_t::is_mandatory, PARAMETER_BAD, PARAMETER_OK, stp_check_int_parameter(), STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_int_parameter(), STP_PARAMETER_ACTIVE, stp_parameter_description_destroy(), and stp_vars_t. Referenced by stp_verify_parameter().

int verify_string_param | ( | const stp_vars_t * | v,
|  | const char * | parameter,
|  | stp_parameter_t * | desc,
|  | int | quiet
| ) | `[static]`

| Definition at line 435 of file printers.c. References _, stp_parameter_t::bounds, stp_parameter_t::is_mandatory, PARAMETER_BAD, PARAMETER_OK, stp_check_string_parameter(), STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_string_parameter(), STP_PARAMETER_ACTIVE, stp_parameter_description_destroy(), stp_parameter_verify_t, stp_string_list_count(), stp_string_list_param(), stp_string_list_t, and stp_vars_t. Referenced by stp_verify_parameter().

## Variable Documentation

stp_list_t* printer_list = NULL`[static]`

| Definition at line 49 of file printers.c.