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

print-list.c File Reference

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

Go to the source code of this file.

Defines

#define check_list(List)   assert(List != NULL)
 Check the validity of a list.

Functions

static void set_name_cache (stp_list_t *list, const char *name, stp_list_item_t *cache)
 Cache a list node by its short name.
static void set_long_name_cache (stp_list_t *list, const char *long_name, stp_list_item_t *cache)
 Cache a list node by its long name.
static void clear_cache (stp_list_t *list)
 Clear cached nodes.
void stp_list_node_free_data (void *item)
 Free node data allocated with stp_malloc.
stp_list_tstp_list_create (void)
 Create a new list object.
stp_list_tstp_list_copy (const stp_list_t *list)
 Copy and allocate a list object.
int stp_list_destroy (stp_list_t *list)
 Destroy a list object.
int stp_list_get_length (const stp_list_t *list)
 Get the length of a list.
stp_list_item_tstp_list_get_start (const stp_list_t *list)
 Find the first item in a list.
stp_list_item_tstp_list_get_end (const stp_list_t *list)
 Find the last item in a list.
stp_list_item_tstp_list_get_item_by_index (const stp_list_t *list, int idx)
 Find an item in a list by its index.
static stp_list_item_tstp_list_get_item_by_name_internal (const stp_list_t *list, const char *name)
 Find an item in a list by its name.
stp_list_item_tstp_list_get_item_by_name (const stp_list_t *list, const char *name)
 Find an item in a list by its name.
static stp_list_item_tstp_list_get_item_by_long_name_internal (const stp_list_t *list, const char *long_name)
 Find an item in a list by its long name.
stp_list_item_tstp_list_get_item_by_long_name (const stp_list_t *list, const char *long_name)
 Find an item in a list by its long name.
void stp_list_set_freefunc (stp_list_t *list, stp_node_freefunc freefunc)
 Set a list node free function.
stp_node_freefunc stp_list_get_freefunc (const stp_list_t *list)
 Get a list node free function.
void stp_list_set_copyfunc (stp_list_t *list, stp_node_copyfunc copyfunc)
 Set a list node copy function.
stp_node_copyfunc stp_list_get_copyfunc (const stp_list_t *list)
 Get a list node copy function.
void stp_list_set_namefunc (stp_list_t *list, stp_node_namefunc namefunc)
 Set a list node name function.
stp_node_namefunc stp_list_get_namefunc (const stp_list_t *list)
 Get a list node name function.
void stp_list_set_long_namefunc (stp_list_t *list, stp_node_namefunc long_namefunc)
 Set a list node long name function.
stp_node_namefunc stp_list_get_long_namefunc (const stp_list_t *list)
 Get a list node long name function.
void stp_list_set_sortfunc (stp_list_t *list, stp_node_sortfunc sortfunc)
 Set a list node sort function.
stp_node_sortfunc stp_list_get_sortfunc (const stp_list_t *list)
 Get a list node sort function.
int stp_list_item_create (stp_list_t *list, stp_list_item_t *next, const void *data)
 Create a new list item.
int stp_list_item_destroy (stp_list_t *list, stp_list_item_t *item)
 Destroy a list item.
stp_list_item_tstp_list_item_prev (const stp_list_item_t *item)
 Get the previous item in the list.
stp_list_item_tstp_list_item_next (const stp_list_item_t *item)
 Get the next item in the list.
void * stp_list_item_get_data (const stp_list_item_t *item)
 Get the data associated with a list item.
int stp_list_item_set_data (stp_list_item_t *item, void *data)
 Set the data associated with a list item.


Define Documentation

#define check_list List   )     assert(List != NULL)
 

Check the validity of a list.

Definition at line 128 of file print-list.c.

Referenced by stp_get_color_by_colorfuncs(), stp_get_color_by_index(), stp_get_color_by_name(), stp_list_copy(), stp_list_destroy(), stp_list_get_copyfunc(), stp_list_get_freefunc(), stp_list_get_item_by_index(), stp_list_get_item_by_long_name(), stp_list_get_item_by_name(), stp_list_get_length(), stp_list_get_long_namefunc(), stp_list_get_namefunc(), stp_list_get_sortfunc(), stp_list_item_create(), stp_list_item_destroy(), stp_list_set_copyfunc(), stp_list_set_freefunc(), stp_list_set_long_namefunc(), stp_list_set_namefunc(), and stp_list_set_sortfunc().


Function Documentation

static void clear_cache stp_list_t list  )  [inline, static]
 

Clear cached nodes.

Parameters:
list the list to use.

Definition at line 112 of file print-list.c.

References set_long_name_cache(), and set_name_cache().

Referenced by stp_list_destroy(), stp_list_item_create(), and stp_list_item_destroy().

static void set_long_name_cache stp_list_t list,
const char *  long_name,
stp_list_item_t cache
[static]
 

Cache a list node by its long name.

Parameters:
list the list to use.
long_name the long name.
cache the node to cache.

Definition at line 95 of file print-list.c.

References stp_free(), and stp_strdup().

Referenced by clear_cache(), and stp_list_get_item_by_long_name().

static void set_name_cache stp_list_t list,
const char *  name,
stp_list_item_t cache
[static]
 

Cache a list node by its short name.

Parameters:
list the list to use.
name the short name.
cache the node to cache.

Definition at line 76 of file print-list.c.

References stp_free(), and stp_strdup().

Referenced by clear_cache(), and stp_list_get_item_by_name().

static stp_list_item_t* stp_list_get_item_by_long_name_internal const stp_list_t list,
const char *  long_name
[static]
 

Find an item in a list by its long name.

This internal helper is not optimised to use any caching.

Parameters:
list the list to use.
long_name the long name to find.
Returns:
a pointer to the list item, or NULL if the long name is invalid or the list is empty.

Definition at line 396 of file print-list.c.

References stp_list_item::data, and stp_list_item::next.

Referenced by stp_list_get_item_by_long_name().

static stp_list_item_t* stp_list_get_item_by_name_internal const stp_list_t list,
const char *  name
[static]
 

Find an item in a list by its name.

This internal helper is not optimised to use any caching.

Parameters:
list the list to use.
name the name to find.
Returns:
a pointer to the list item, or NULL if the name is invalid or the list is empty.

Definition at line 324 of file print-list.c.

References stp_list_item::data, and stp_list_item::next.

Referenced by stp_list_get_item_by_name().


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