libgimpprint API Reference: sequence.c File Reference

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

# src/main/sequence.c File Reference

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

Go to the source code of this file.

## Data Structures
struct | stp_sequence
## Defines
#define | DEFINE_DATA_SETTER(t, name)
#define | DEFINE_DATA_ACCESSOR(t, lb, ub, name)
#define | HUGE_VALF 3.402823466E+38F
## Functions
void | check_sequence (const stp_sequence_t *v)
void | sequence_ctor (stp_sequence_t *sequence)
stp_sequence_t * | stp_sequence_create (void)
| Create a new sequence.
void | invalidate_auxilliary_data (stp_sequence_t *sequence)
void | sequence_dtor (stp_sequence_t *sequence)
void | stp_sequence_destroy (stp_sequence_t *sequence)
| Destroy a sequence.
void | stp_sequence_copy (stp_sequence_t *dest, const stp_sequence_t *source)
| Copy an sequence.
stp_sequence_t * | stp_sequence_create_copy (const stp_sequence_t *sequence)
| Copy and allocate an sequence.
int | stp_sequence_set_bounds (stp_sequence_t *sequence, double low, double high)
| Set the lower and upper bounds.
void | stp_sequence_get_bounds (const stp_sequence_t *sequence, double *low, double *high)
| Get the lower and upper bounds.
void | scan_sequence_range (stp_sequence_t *sequence)
void | stp_sequence_get_range (const stp_sequence_t *sequence, double *low, double *high)
| Get range of values stored in the sequence.
int | stp_sequence_set_size (stp_sequence_t *sequence, size_t size)
| Set the sequence size.
size_t | stp_sequence_get_size (const stp_sequence_t *sequence)
| Get the sequence size.
int | stp_sequence_set_data (stp_sequence_t *sequence, size_t size, const double *data)
| Set the data in a sequence.
int | stp_sequence_set_subrange (stp_sequence_t *sequence, size_t where, size_t size, const double *data)
| Set the data in a subrange of a sequence.
void | stp_sequence_get_data (const stp_sequence_t *sequence, size_t *size, const double **data)
| Get the data in a sequence.
int | stp_sequence_set_point (stp_sequence_t *sequence, size_t where, double data)
| Set the data at a single point in a sequence.
int | stp_sequence_get_point (const stp_sequence_t *sequence, size_t where, double *data)
| Get the data at a single point in a sequence.
stp_sequence_t * | stp_sequence_create_from_xmltree (stp_mxml_node_t *da)
stp_mxml_node_t * | stp_xmltree_create_from_sequence (const stp_sequence_t *seq)

## Define Documentation

#define DEFINE_DATA_ACCESSOR | ( | t,
|  | lb,
|  | ub,
|  | name |  | ) |

| Value:
    const t *                                                                    \
    stp_sequence_get_##name##_data(const stp_sequence_t *sequence, size_t *count) \
    {                                                                            \
      int i;                                                                     \
      if (sequence->blo < (double) lb || sequence->bhi > (double) ub)            \
        return NULL;                                                             \
      if (!sequence->name##_data)                                                \
        {                                                                        \
          ((stp_sequence_t *)sequence)->name##_data = stp_zalloc(sizeof(t) * sequence->size);            \
          for (i = 0; i < sequence->size; i++)                                   \
            ((stp_sequence_t *)sequence)->name##_data[i] = (t) sequence->data[i];                \
        }                                                                        \
      *count = sequence->size;                                                   \
      return sequence->name##_data;                                              \
    }
Definition at line 500 of file sequence.c.

#define DEFINE_DATA_SETTER | ( | t,
|  | name |  | ) |

| Value:
    int                                                                          \
    stp_sequence_set_##name##_data(stp_sequence_t *sequence,                     \
                                   size_t count, const t *data)                  \
    {                                                                            \
      int i;                                                                     \
      check_sequence(sequence);                                                          \
      if (count < 2)                                                             \
        return 0;                                                                \
                                                                                 \
      /* Validate the data before we commit to it. */                            \
      for (i = 0; i < count; i++)                                                \
        if (! finite(data[i]) ||                                                 \
            data[i] < sequence->blo ||                                           \
            data[i] > sequence->bhi)                                             \
          return 0;                                                              \
      stp_sequence_set_size(sequence, count);                                    \
      for (i = 0; i < count; i++)                                                \
        stp_sequence_set_point(sequence, i, (double) data[i]);                   \
      return 1;                                                                  \
    }
Definition at line 469 of file sequence.c.

#define HUGE_VALF 3.402823466E+38F

| Definition at line 518 of file sequence.c.

## Function Documentation

void check_sequence | ( | const stp_sequence_t * | v | ) | `[inline, static]`

| Definition at line 64 of file sequence.c. References stp_abort(), stp_erprintf(), and stp_sequence_t. Referenced by stp_sequence_copy(), stp_sequence_create_copy(), stp_sequence_destroy(), stp_sequence_get_bounds(), stp_sequence_get_data(), stp_sequence_get_point(), stp_sequence_get_size(), stp_sequence_set_bounds(), stp_sequence_set_data(), stp_sequence_set_point(), stp_sequence_set_size(), and stp_sequence_set_subrange().

void invalidate_auxilliary_data | ( | stp_sequence_t * | sequence | ) | `[static]`

| Definition at line 93 of file sequence.c. References stp_sequence::float_data, stp_sequence::int_data, stp_sequence::long_data, stp_sequence::short_data, STP_SAFE_FREE, stp_sequence_t, stp_sequence::uint_data, stp_sequence::ulong_data, and stp_sequence::ushort_data. Referenced by sequence_dtor(), stp_sequence_set_data(), stp_sequence_set_point(), stp_sequence_set_size(), and stp_sequence_set_subrange().

void scan_sequence_range | ( | stp_sequence_t * | sequence | ) | `[static]`

| Definition at line 173 of file sequence.c. References stp_sequence::bhi, stp_sequence::blo, stp_sequence::data, stp_sequence::recompute_range, stp_sequence::rhi, stp_sequence::rlo, stp_sequence::size, and stp_sequence_t. Referenced by stp_sequence_get_range().

void sequence_ctor | ( | stp_sequence_t * | sequence | ) | `[static]`

| Definition at line 74 of file sequence.c. References stp_sequence::bhi, stp_sequence::blo, stp_sequence::data, stp_sequence::recompute_range, stp_sequence::rhi, stp_sequence::rlo, stp_sequence::size, and stp_sequence_t. Referenced by stp_sequence_create().

void sequence_dtor | ( | stp_sequence_t * | sequence | ) | `[static]`

| Definition at line 105 of file sequence.c. References stp_sequence::data, invalidate_auxilliary_data(), stp_free(), and stp_sequence_t. Referenced by stp_sequence_destroy().

stp_sequence_t* stp_sequence_create_from_xmltree | ( | stp_mxml_node_t * | da | ) |

| Definition at line 302 of file sequence.c. References stp_mxml_node_s::child, stp_mxml_node_s::next, STP_DBG_XML, stp_deprintf(), stp_erprintf(), stp_mxml_node_t, STP_MXML_TEXT, stp_mxmlElementGetAttr(), stp_sequence_create(), stp_sequence_destroy(), stp_sequence_set_bounds(), stp_sequence_set_point(), stp_sequence_set_size(), stp_sequence_t, stp_xmlstrtod(), stp_xmlstrtol(), stp_xmlstrtoul(), stp_mxml_text_s::string, stp_mxml_value_u::text, stp_mxml_node_s::type, and stp_mxml_node_s::value. Referenced by stp_array_create_from_xmltree(), and stp_curve_create_from_xmltree().

stp_mxml_node_t* stp_xmltree_create_from_sequence | ( | const stp_sequence_t * | seq | ) |

| Definition at line 411 of file sequence.c. References stp_asprintf(), stp_free(), stp_mxml_node_t, stp_mxmlDelete(), stp_mxmlElementSetAttr(), stp_mxmlNewElement(), stp_mxmlNewText(), stp_sequence_get_bounds(), stp_sequence_get_point(), stp_sequence_get_size(), and stp_sequence_t. Referenced by stp_xmltree_create_from_array(), and stp_xmltree_create_from_curve().