libgutenprint API Reference 5.3.6-2026-02-01T02-18-9b0bdf87

Macros | Functions
util

Utility functions. More...

## Macros
#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_DYESUB 0x40000
#define | STP_DBG_CURVE 0x80000
#define | STP_DBG_CURVE_ERRORS 0x100000
#define | STP_DBG_PPD 0x200000
#define | STP_DBG_NO_COMPRESSION 0x400000
#define | STP_DBG_ASSERTIONS 0x800000
#define | STP_DBG_DPL 0x1000000
#define | STP_DBG_ESCP2_XML 0x2000000
#define | STP_DBG_ARRAY_ERRORS 0x4000000
#define | STP_DBG_STATIC_TIME 0x8000000
#define | STP_SAFE_FREE(x)

## Functions
int | stp_init (void)
| Initialise libgimpprint.
void | stp_set_global_errfunc (stp_outfunc_t val)
| Set global error output function.
stp_outfunc_t | stp_get_global_errfunc (void)
| Get global error output function.
void | stp_set_global_dbgfunc (stp_outfunc_t val)
| Set global debug output function.
stp_outfunc_t | stp_get_global_dbgfunc (void)
| Get global debug output function.
void | stp_set_global_errdata (void *val)
| Set global error output data.
void * | stp_get_global_errdata (void)
| Get global error output data.
void | stp_set_global_dbgdata (void *val)
| Set global debug output data.
void * | stp_get_global_dbgdata (void)
| Get global debug output data.
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 void | stp_zfwrite (const char *buf, size_t bytes, size_t nitems, const stp_vars_t *v)
void | stp_write_raw (const stp_raw_t *raw, 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_putraw (const stp_raw_t *r, 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 void | stp_erprintf (const char *format,...) __attribute__((format(__printf__
void void void | stp_asprintf (char **strp, const char *format,...) __attribute__((format(__printf__
void void void 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 void | stp_deprintf (unsigned long level, const char *format,...) __attribute__((format(__printf__
void void 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)
const char * | stp_get_version (void)
| Get the library version string (x.y.z)
const char * | stp_get_release_version (void)
| Get the library release version string (x.y)

## Detailed Description

Utility functions.

## Macro Definition Documentation

## ◆ STP_DBG_ARRAY_ERRORS

#define STP_DBG_ARRAY_ERRORS 0x4000000

## ◆ STP_DBG_ASSERTIONS

#define STP_DBG_ASSERTIONS 0x800000

## ◆ STP_DBG_CANON

#define STP_DBG_CANON 0x40

## ◆ STP_DBG_COLORFUNC

#define STP_DBG_COLORFUNC 0x2

## ◆ STP_DBG_CURVE

#define STP_DBG_CURVE 0x80000

## ◆ STP_DBG_CURVE_ERRORS

#define STP_DBG_CURVE_ERRORS 0x100000

## ◆ STP_DBG_DPL

#define STP_DBG_DPL 0x1000000

## ◆ STP_DBG_DYESUB

#define STP_DBG_DYESUB 0x40000

## ◆ STP_DBG_ESCP2

#define STP_DBG_ESCP2 0x20

## ◆ STP_DBG_ESCP2_XML

#define STP_DBG_ESCP2_XML 0x2000000

## ◆ STP_DBG_INK

#define STP_DBG_INK 0x4

## ◆ STP_DBG_LEXMARK

#define STP_DBG_LEXMARK 0x80

## ◆ STP_DBG_LIST

#define STP_DBG_LIST 0x800

## ◆ STP_DBG_LUT

#define STP_DBG_LUT 0x1

## ◆ STP_DBG_MARK_FILE

#define STP_DBG_MARK_FILE 0x400

## ◆ STP_DBG_MODULE

#define STP_DBG_MODULE 0x1000

## ◆ STP_DBG_NO_COMPRESSION

#define STP_DBG_NO_COMPRESSION 0x400000

## ◆ STP_DBG_PAPER

#define STP_DBG_PAPER 0x4000

## ◆ STP_DBG_PATH

#define STP_DBG_PATH 0x2000

## ◆ STP_DBG_PCL

#define STP_DBG_PCL 0x10

## ◆ STP_DBG_PPD

#define STP_DBG_PPD 0x200000

## ◆ STP_DBG_PRINTERS

#define STP_DBG_PRINTERS 0x8000

## ◆ STP_DBG_PS

#define STP_DBG_PS 0x8

## ◆ STP_DBG_ROWS

#define STP_DBG_ROWS 0x200

## ◆ STP_DBG_STATIC_TIME

#define STP_DBG_STATIC_TIME 0x8000000

## ◆ STP_DBG_VARS

#define STP_DBG_VARS 0x20000

## ◆ STP_DBG_WEAVE_PARAMS

#define STP_DBG_WEAVE_PARAMS 0x100

## ◆ STP_DBG_XML

#define STP_DBG_XML 0x10000

## ◆ STP_SAFE_FREE

#define STP_SAFE_FREE | ( |  | x | ) |

Value:
do \
{ \
if ((x)) \
stp_free((char *)(x)); \
((x)) = NULL; \
} while (0)

## Function Documentation

## ◆ stp_abort()

void stp_abort | ( | void |  | ) |
| extern

## ◆ stp_asprintf()

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

References __attribute__, and stp_asprintf().

Referenced by stp_asprintf().

## ◆ stp_catprintf()

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

References __attribute__, and stp_catprintf().

Referenced by stp_catprintf().

## ◆ stp_deprintf()

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

References __attribute__, and stp_deprintf().

Referenced by stp_deprintf().

## ◆ stp_dprintf()

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

References __attribute__.

## ◆ stp_eprintf()

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

References __attribute__, and stp_eprintf().

Referenced by stp_eprintf().

## ◆ stp_erprintf()

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

References __attribute__, and stp_erprintf().

Referenced by stp_erprintf().

## ◆ stp_erputc()

void stp_erputc | ( | int | ch | ) |
| extern

References stp_erputc().

Referenced by stp_erputc().

## ◆ stp_flush_debug_messages()

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

References stp_flush_debug_messages().

Referenced by stp_flush_debug_messages().

## ◆ stp_free()

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

References stp_free().

Referenced by stp_free().

## ◆ stp_get_debug_level()

unsigned long stp_get_debug_level | ( | void |  | ) |
| extern

## ◆ stp_get_global_dbgdata()

void * stp_get_global_dbgdata | ( | void |  | ) |
| extern

Get global debug output data.

This may be called prior to stp_init().

Returns
  current global output data; null if default.

## ◆ stp_get_global_dbgfunc()

stp_outfunc_t stp_get_global_dbgfunc | ( | void |  | ) |
| extern

Get global debug output function.

This may be called prior to stp_init().

Returns
  current global output function; null if default.

## ◆ stp_get_global_errdata()

void * stp_get_global_errdata | ( | void |  | ) |
| extern

Get global error output data.

This may be called prior to stp_init().

Returns
  current global output data; null if default.

## ◆ stp_get_global_errfunc()

stp_outfunc_t stp_get_global_errfunc | ( | void |  | ) |
| extern

Get global error output function.

This may be called prior to stp_init().

Returns
  current global output function; null if default.

## ◆ stp_get_release_version()

const char * stp_get_release_version | ( | void |  | ) |
| extern

Get the library release version string (x.y)

Returns
  a pointer to the release name of the package, which must not be modified or freed.

## ◆ stp_get_version()

const char * stp_get_version | ( | void |  | ) |
| extern

Get the library version string (x.y.z)

Returns
  a pointer to the version name of the package, which must not be modified or freed.

## ◆ stp_init()

int stp_init | ( | void |  | ) |
| extern

Initialise libgimpprint.

This function must be called prior to any other use of the library except as specifically noted. It is responsible for loading modules and XML data and initialising internal data structures.

Returns
  0 on success, 1 on failure.

## ◆ stp_init_debug_messages()

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

References stp_init_debug_messages().

Referenced by stp_init_debug_messages().

## ◆ stp_malloc()

void * stp_malloc | ( | size_t |  | ) |
| extern

References stp_malloc().

Referenced by stp_malloc().

## ◆ stp_prune_inactive_options()

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

## ◆ stp_put16_be()

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

References stp_put16_be().

Referenced by stp_put16_be().

## ◆ stp_put16_le()

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

References stp_put16_le().

Referenced by stp_put16_le().

## ◆ stp_put32_be()

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

References stp_put32_be().

Referenced by stp_put32_be().

## ◆ stp_put32_le()

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

References stp_put32_le().

Referenced by stp_put32_le().

## ◆ stp_putc()

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

References stp_putc().

Referenced by stp_putc().

## ◆ stp_putraw()

void stp_putraw | ( | const stp_raw_t * | r,
|  | const stp_vars_t * | v )
| extern

References stp_putraw().

Referenced by stp_putraw().

## ◆ stp_puts()

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

References stp_puts().

Referenced by stp_puts().

## ◆ stp_read_and_compose_curves()

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

## ◆ stp_realloc()

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

References stp_realloc().

Referenced by stp_realloc().

## ◆ stp_send_command()

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

References stp_send_command().

Referenced by stp_send_command().

## ◆ stp_set_global_dbgdata()

void stp_set_global_dbgdata | ( | void * | val | ) |
| extern

Set global debug output data.

This may be called prior to stp_init().

Parameters

  val | data (e. g. FILE * or file descriptor) to perform debug output.

## ◆ stp_set_global_dbgfunc()

void stp_set_global_dbgfunc | ( | stp_outfunc_t | val | ) |
| extern

Set global debug output function.

This may be called prior to stp_init().

Parameters

  val | function to perform debug output. Default is to write to stderr

## ◆ stp_set_global_errdata()

void stp_set_global_errdata | ( | void * | val | ) |
| extern

Set global error output data.

This may be called prior to stp_init().

Parameters

  val | data (e. g. FILE * or file descriptor) to perform error output.

## ◆ stp_set_global_errfunc()

void stp_set_global_errfunc | ( | stp_outfunc_t | val | ) |
| extern

Set global error output function.

This may be called prior to stp_init().

Parameters

  val | function to perform error output. Default is to write to stderr.

## ◆ stp_set_output_codeset()

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

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

## ◆ stp_strdup()

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

## ◆ stp_strlen()

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

## ◆ stp_strndup()

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

## ◆ stp_write_raw()

void stp_write_raw | ( | const stp_raw_t * | raw,
|  | const stp_vars_t * | v )
| extern

References stp_write_raw().

Referenced by stp_write_raw().

## ◆ stp_zalloc()

void * stp_zalloc | ( | size_t |  | ) |
| extern

References stp_zalloc().

Referenced by stp_zalloc().

## ◆ stp_zfwrite()

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

References stp_zfwrite().

Referenced by stp_zfwrite().

## ◆ stp_zprintf()

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

References __attribute__.