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

printers.c File Reference

#include <gutenprint/gutenprint.h>
#include "gutenprint-internal.h"
#include <gutenprint/gutenprint-intl-internal.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

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

static void stpi_printer_freefunc (void *item)
static const char * stpi_printer_namefunc (const void *item)
static const char * stpi_printer_long_namefunc (const void *item)
static int stpi_init_printer_list (void)
int stp_printer_model_count (void)
 Get the number of available printer models.
static void null_printer (void)
static void check_printer (const stp_printer_t *p)
const stp_printer_tstp_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.
static const stp_printfuncs_tstpi_get_printfuncs (const stp_printer_t *printer)
const stp_vars_tstp_printer_get_defaults (const stp_printer_t *printer)
 Get the default vars for a particular printer model.
const stp_printer_tstp_get_printer_by_long_name (const char *long_name)
 Get a printer model by its long (translated) name.
const stp_printer_tstp_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_tstp_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)
static 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.
static int verify_string_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
static int verify_double_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
static int verify_int_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
static int verify_dimension_param (const stp_vars_t *v, const char *parameter, stp_parameter_t *desc, int quiet)
static 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)
static 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)
static stp_printer_tstp_printer_create_from_xmltree (stp_mxml_node_t *printer, const char *family, const stp_printfuncs_t *printfuncs)
static void stpi_xml_process_family (stp_mxml_node_t *family)
static int stpi_xml_process_printdef (stp_mxml_node_t *printdef, const char *file)
void stpi_init_printer (void)

Variables

static stp_list_tprinter_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,
 )     ((a) < (b) ? (a) : (b))
 

Definition at line 42 of file printers.c.


Function Documentation

static void check_printer const stp_printer_t p  )  [inline, static]
 

Definition at line 96 of file printers.c.

References null_printer().

static 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().

static void null_printer void   )  [static]
 

Definition at line 89 of file printers.c.

References stp_abort(), and stp_erprintf().

Referenced by check_printer().

static void set_printer_defaults stp_vars_t v,
int  core_only
[static]
 

Definition at line 261 of file printers.c.

References stp_parameter_t::array, stp_parameter_t::boolean, stp_parameter_t::curve, stp_parameter_t::dbl, stp_parameter_t::deflt, stp_parameter_t::dimension, stp_parameter_t::integer, 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_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_parameter_t::str.

Referenced by stp_initialize_printer_defaults(), and stp_set_printer_defaults().

static 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_curve_create_from_xmltree(), stp_curve_destroy(), STP_DBG_XML, stp_erprintf(), stp_free(), stp_get_debug_level(), stp_get_driver(), STP_MXML_ELEMENT, STP_MXML_TEXT, stp_mxmlElementGetAttr(), 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().

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

Definition at line 172 of file printers.c.

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().

static int stpi_init_printer_list void   )  [static]
 

Definition at line 63 of file printers.c.

References printer_list, 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().

static void stpi_printer_freefunc void *  item  )  [static]
 

Definition at line 119 of file printers.c.

References stp_printer::family, stp_printer::long_name, and stp_free().

Referenced by stpi_init_printer_list().

static const char * stpi_printer_long_namefunc const void *  item  )  [static]
 

Definition at line 147 of file printers.c.

References stp_printer::long_name.

Referenced by stpi_init_printer_list().

static const char * stpi_printer_namefunc const void *  item  )  [static]
 

Definition at line 134 of file printers.c.

References stp_printer::driver.

Referenced by stpi_init_printer_list().

static 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_list_create(), stp_list_destroy(), stp_list_get_start(), stp_list_item_create(), stp_list_item_get_data(), stp_list_item_next(), STP_MODULE_CLASS_FAMILY, stp_module_get_class(), STP_MXML_ELEMENT, stp_mxmlElementGetAttr(), stp_printer_create_from_xmltree(), stp_module::syms, stp_mxml_node_s::type, and stp_mxml_node_s::value.

Referenced by stpi_xml_process_printdef().

static 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, stpi_xml_process_family(), stp_mxml_node_s::type, and stp_mxml_node_s::value.

Referenced by stpi_init_printer().

static 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 _, PARAMETER_BAD, stp_check_curve_parameter(), stp_curve_get_bounds(), stp_curve_get_wrap(), STP_CURVE_WRAP_NONE, STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_curve_parameter(), STP_PARAMETER_ACTIVE, and stp_parameter_description_destroy().

Referenced by stp_verify_parameter().

static 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 _, PARAMETER_BAD, PARAMETER_OK, stp_check_dimension_parameter(), STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_dimension_parameter(), STP_PARAMETER_ACTIVE, and stp_parameter_description_destroy().

Referenced by stp_verify_parameter().

static 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 _, PARAMETER_BAD, PARAMETER_OK, stp_check_float_parameter(), STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_float_parameter(), and STP_PARAMETER_ACTIVE.

Referenced by stp_verify_parameter().

static 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 _, PARAMETER_BAD, PARAMETER_OK, stp_check_int_parameter(), STP_DBG_VARS, stp_dprintf(), stp_eprintf(), stp_get_int_parameter(), STP_PARAMETER_ACTIVE, and stp_parameter_description_destroy().

Referenced by stp_verify_parameter().

static 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 _, 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_string_list_count(), and stp_string_list_param().

Referenced by stp_verify_parameter().


Variable Documentation

stp_list_t* printer_list = NULL [static]
 

Definition at line 49 of file printers.c.

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(), stp_printer_model_count(), and stpi_init_printer_list().


Generated on Thu Feb 10 19:29:31 2005 for libgutenprint API Reference by  doxygen 1.4.1