Reference

Templates

This section describes the templates and their parameters. Each template consists of a header and an implementation. Headers are named ‘container-decl.h’ and implementations are named ‘container-impl-c.h’. For example ‘map-decl.h’ and ‘map-impl-c.h’.

The templates require a set of #define values to be set, and that will be used to generate code for a specific container type. An example implementation list of char * is:

/* list-str.h */
#define TYPE  char *
#define NAME  str
#define UNAME  STR

#include <c-craft/list-decl.h>

#undef TYPE
#undef NAME
#undef UNAME
/* list-str.c */
#include "list-str.h"

#define TYPE  char *
#define NAME  str
#define UNAME  STR

#include <c-craft/list-impl-c.h>

#undef TYPE
#undef NAME
#undef UNAME

Parameters for this example are TYPE, NAME and UNAME.


Container API

Conventions

This section describes the generic container implementations. These could by any type, depending on the parameters used in the generation. This reference substitutes the word ‘type’ or ‘TYPE’ in appropriate casing, rather than assume any particular type implementation. For maps there are two types, one for the key and one for the value. The value comes first, so a map of doubles keyed by int is created with map_double_int_create(), and in the reference is shown as map_type_create().


List

Template Generation

Declarations File:

list-decl.h

Implementation File:

list-impl-c.h

Parameters

TYPE:

The type of element contained.

NAME:

The disambiguating name element used in function name definitions

UNAME:

The disambiguating name element used in data type declarations

Examples

#define TYPE void *
#define NAME ptr
#define UNAME PTR
...
LIST_PTR lp = list_ptr_create(mem, 1024);
void *data = get_some_data();
list_ptr_append(lp, data);

Data Types

A link in a linked list as an abstract data type.


typedef struct list_type *LIST_TYPE

A list as an abstract data type.


Functions

void list_type_append(LIST_TYPE list, TYPE item)

Append an element at the end of a list.

Parameters:
  • list – The list being accessed.

  • item – The item to append.


void list_type_clear(LIST_TYPE list)

Clear all elements from the list.

Parameters:

list – The list to be cleared.


size_t list_type_count(LIST_TYPE list)

Count the number of elements in the list.

Remark

This function may not perform well if there are many elements.

Parameters:

list – The list being accessed.

Returns:

A count of the number of elements.


LIST_TYPE list_type_create(MEM_SCOPE scope)

Create a new list.

Parameters:

scope – A memory scope to own the list.

Returns:

A new empty list.


TYPE list_type_find(LIST_TYPE list, TYPE item, TYPE not_found, int (*cmp)(TYPE, TYPE))

Search a list to find an element.

Remark

This function may not perform well if there are many elements.

Parameters:
  • list – The list being accessed.

  • item – The element being searched for.

  • not_found – A value to be returned to indicate the item was not found.

  • cmp – A comparison function used to test each element in the list.

Returns:

The element, or the ‘not_found’ value if not found.


TYPE list_type_first(LIST_TYPE list, TYPE not_found)

Get the first element in a list.

Remark

For many types a NULL or zero return is a useful way to distinguish between a valid or non-existent element.

Parameters:
  • list – The list being accessed.

  • not_found – A value to be returned if the list is empty.

Returns:

The first element, or a not_found value if no element exists.


LIST_TYPE list_type_from_array(MEM_SCOPE scope, TYPE *array, size_t len)

Create a list from an existing array.

Parameters:
  • scope – A memory scope to own the list.

  • array – The array to copy.

  • len – The number of elements in the array.

Returns:

A LIST_TYPE that maybe used in subsequent list calls.


TYPE list_type_get(LIST_TYPE list, int index)

Get the element at an index in a list.

Remark

Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Get does not affect any currency established with list_type_first and list_type_next.

Remark

Access by index may not perform well if there are many elements.

Parameters:
  • list – The list being accessed.

  • index – The index to get the element from.

Returns:

The element at the given index.


void list_type_insert(LIST_TYPE list, TYPE item)

Insert an element at the front of a list.

Parameters:
  • list – The list being accessed.

  • item – The element to insert.


void list_type_insert_at(LIST_TYPE list, int index, TYPE item)

Insert an element at a given index in a list.

Remark

Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Get does not affect any currency established with list_type_first and list_type_next.

Remark

Access by index may not perform well if there are many elements.

Parameters:
  • list – The list being accessed.

  • index – The index to insert the element at.

  • item – The element to insert.


TYPE list_type_next(LIST_TYPE list, TYPE not_found)

Get the next element in a list.

Remark

For many types a zero return is a useful way to distinguish between a valid or non-existent element. Where it is not use list_type_count to determine if elements are available.

Parameters:
  • list – The list being accessed.

  • not_found – A value to be returned if the list is empty.

Returns:

The next element, or a zero element if no element exists.


TYPE list_type_remove(LIST_TYPE list)

Remove the current element from a list.

Remark

The list_type_remove function is only appropriate during list iteration, when list_type_first and/or list_type_next have been called to establish a currency. Use at any other time will yield unpredictable results.

Parameters:

list – The list being accessed.

Returns:

The element being removed.


TYPE list_type_remove_at(LIST_TYPE list, int index)

Remove an element from a given index.

Remark

Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Get should not affect any currency established with list_type_first and list_type_next.

Remark

Access by index may not perform well if there are many elements.

Parameters:
  • list – The list being accessed.

  • index – The index to remove the element from.

Returns:

The element being removed.


TYPE list_type_replace(LIST_TYPE list, TYPE item)

Replace the current element in a list.

Remark

The list_type_replace function is only appropriate during list iteration, when list_type_first and/or list_type_next have been called to establish a currency. Use at any other time will yield unpredictable results.

See also

list_type_get(), list_type_set()

Parameters:
  • list – The list being accessed.

  • item – The element to replace with.

Returns:

The element being replaced.


void list_type_set(LIST_TYPE list, int index, TYPE item)

Set the element at an index in a list.

Remark

Attempting to access an index that does not exist will assert in DEBUG mode and yield unpredictable results in RELEASE mode. Set should not affect any currency established with list_type_first and list_type_next.

Remark

Access by index may not perform well if there are many elements.

Parameters:
  • list – The list being accessed.

  • index – The index to set the element.

  • item – The element to set.


TYPE *list_type_to_array(LIST_TYPE list, TYPE not_found)

Convert to an array of all elements.

Remark

This function may not perform well if there are many elements.

Parameters:
  • list – The list being accessed.

  • not_found – A value appended to to signify the array end.

Returns:

A standard C array of all elements.


char *list_str_to_string(LIST_STR str, char c)

Concatenate to a delimited string of all elements.

Remark

This function is specific to LIST_STR only.

Parameters:
  • str – The list being accessed.

  • c – A character to separate each string with.

Returns:

A char * concatenation of all elements.


LIST_TYPE list_type_where(LIST_TYPE list, int (*func)(TYPE, TYPE), TYPE arg)

Create a new list by filtering a list using supplied criteria.

Remark

This function uses the supplied comparison function to test each member in turn and adds to the new list only if the function returns TRUE.

Remark

This function may not perform well if there are many elements.

See also

list_type_to_array().

Parameters:
  • list – The list being accessed.

  • func – A comparison function used to test each element in the list.

  • arg – The argument to supply for the test function.

Returns:

A new list with the filtered elements.


Vector

Template Generation

Declarations File:

vector-decl.h

Implementation File:

vector-impl-c.h

Parameters

TYPE:

The type of element contained.

NAME:

The disambiguating name element used in function name definitions

UNAME:

The disambiguating name element used in data type declarations

Examples

#define TYPE char *
#define NAME str
#define UNAME STR
...
VECTOR_STR vp = vector_str_create(mem, 16);
vector_str_append(vp, "Hello, collections library !");

Data Types

typedef struct vector_type *VECTOR_TYPE

A VECTOR_TYPE abstract data type.


Functions

void vector_type_append(VECTOR_TYPE vector, TYPE item)

Append an element at the end of a vector.

Remark

The vector is expanded if necessary, and this will cause a move of all the data.

Parameters:
  • vector – The vector being accessed.

  • item – The element to append.


size_t vector_type_count(VECTOR_TYPE vector)

Count the number of elements in the vector.

Parameters:

vector – The vector being accessed.

Returns:

The number of elements in the vector.


VECTOR_TYPE vector_type_create(MEM_SCOPE scope, size_t capacity)

Create a new vector.

Remark

The capacity is the number of elements that can be appended before the vector is expanded.

See also

vector_type_from_array()

Parameters:
  • scope – A memory scope.

  • capacity – The initial number of elements in the vector.

Returns:

A VECTOR_TYPE that maybe used in subsequent vector calls.


TYPE vector_type_find(VECTOR_TYPE vector, TYPE item, TYPE not_found, int (*cmp)(TYPE, TYPE))

Search a vector to find an element.

Remark

This function may not perform well if there are many items in the vector.

Parameters:
  • vector – The vector being accessed.

  • item – The element being searched for.

  • not_found – A value to be returned to indicate the item was not found.

  • cmp – A comparison function used to test each element in the vector.

Returns:

The element, or not_found value if not found.


VECTOR_TYPE vector_type_from_array(MEM_SCOPE scope, TYPE *array, size_t len)

Create a new vector loaded with the array contents.

See also

vector_type_create()

Parameters:
  • scope – A memory scope.

  • array – The array to copy.

  • len – The number of elements in the array.

Returns:

A VECTOR_TYPE that maybe used in subsequent vector calls.


TYPE vector_type_get(VECTOR_TYPE vector, int index)

Get the element at an index in a vector.

See also

vector_type_set().

Parameters:
  • vector – The vector being accessed.

  • index – The index to get the element from.

Returns:

The element at the given index.


void vector_type_insert(VECTOR_TYPE vector, TYPE item)

Insert an element at the front of a vector.

Note

Elements are shuffled along, and the vector expanded if necessary. Consequently this function may not perform well.

Parameters:
  • vector – The vector being accessed.

  • item – The element to insert.


void vector_type_insert_at(VECTOR_TYPE vector, int index, TYPE item)

Insert an element at a given index.

Note

Elements are shuffled along, and the vector expanded if necessary. Consequently this function may not perform well.

Parameters:
  • vector – The vector being accessed.

  • index – The index to insert the element at.

  • item – The element to insert.


TYPE vector_type_remove_at(VECTOR_TYPE vector, int index)

Remove an element from a given index.

Note

Elements are shuffled down. Consequently this function may not perform well.

Parameters:
  • vector – The vector being accessed.

  • index – The index to remove the element from.

Returns:

The element being removed.


void vector_type_set(VECTOR_TYPE vector, int index, TYPE item)

Set the element at an index in a vector.

See also

vector_type_get()

Parameters:
  • vector – The vector being accessed.

  • index – The index to set the element.

  • item – The element to set.


TYPE *vector_type_to_array(VECTOR_TYPE vector, TYPE not_found)

Convert to an array of all elements.

Parameters:
  • vector – The vector being accessed.

  • not_found – A value appended to signify the array end.

Returns:

A standard C array of all elements.


VECTOR_TYPE vector_type_where(VECTOR_TYPE vector, int (*func)(const TYPE, const TYPE), TYPE arg)

Create a new vector by filtering a vector using supplied criteria.

Remark

This function uses the supplied comparison function to test each member in turn and adds to the new vector only if the function returns TRUE.

Parameters:
  • vector – The vector being accessed.

  • func – A comparison function used to test each element in the vector.

  • arg – The argument to supply for the test function.

Returns:

A new vector with the filtered elements.


Map

Template Generation

Declarations File:

map-decl.h

Implementation File:

map-impl-c.h

Parameters

KTYPE:

The type of key used to access elements.

VTYPE:

The type of element contained.

KNAME:

The disambiguating key name used in function name definitions.

VNAME:

The disambiguating value name used in function name definitions.

UKNAME:

The disambiguating key name used in data type declarations.

UVNAME:

The disambiguating value name used in data type declarations.

VECTOR:

Define to implement a vector based map.

LIST:

Define to implement a list based map.

STRING_HASH:

Define to use a string hash, otherwise a raw data hash is used.

NOTE: VECTOR and LIST are mutually exclusive. Use one or the other.

Examples

#define KTYPE char *
#define VTYPE int
#define KNAME str
#define UKNAME STR
#define VNAME int
#define UVNAME INT
#define VECTOR
#define STRING_HASH
...
MAP_INT_STR mp = map_int_str_create(mem, 12);
map_int_str_set(mp, "key", 23);

Notes

Either VECTOR or LIST must be defined, but not both.


Data Types

struct kvp_vtype_ktype

Key value pair type definition.

KTYPE kvp_vtype_ktype::key

The map key.

VTYPE kvp_vtype_ktype::value

The map value associated with the key.


typedef struct kvp_vtype_ktype KVP_VTYPE_KTYPE

Key value pair abstract data type.


typedef struct map_vtype_ktype *MAP_VTYPE_KTYPE

Map abstract data type.


Functions

size_t map_type_count(MAP_VTYPE_KTYPE map)

Count the number of elements in a map.

Remark

This function may not perform well if there are many elements.

Parameters:

map – The map being accessed.

Returns:

A count of the number of elements.


MAP_VTYPE_KTYPE map_type_create(MEM_SCOPE scope, size_t slots, int (*pkcmp)(KTYPE k1, KTYPE k2))

Create a new map on a memory scope.

Remark

The number of slots should be designed according to expected usage of the map. A higher number will give better performance, but use more memory. Prime numbers have a better chance of even distribution. The exact choice is should be researched if optimum performance is a critical requirement.

Parameters:
  • scope – The memory scope.

  • slots – The number of slots in the hash array.

  • pkcmp – A comparison function for keys to determine a match on find.

Returns:

A MAP_VTYPE_KTYPE that maybe used in subsequent map calls.


VTYPE map_type_find(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE not_found)

Find an element in a map by key.

Remark

Get does not affect any currency established with map_vname_kname_first and map_vname_kname_next.

Remark

The function behaves identically to map_vname_kname_get() and is provided for consistency.

See also

map_vname_kname_get().

Parameters:
  • map – The map being accessed.

  • key – The element key.

  • not_found – A value to be returned to indicate the item was not found.

Returns:

The element found by the given key, or not_found value if not found.


KTYPE map_type_first(MAP_VTYPE_KTYPE map, KTYPE not_found)

Get the first key in the map.

Remark

For many types a zero return is a useful way to distiguish between a valid or non-existent element. Where it is not use count to determine if elements are available.

Remark

The iteration order of a map is arbitrary and should not be relied on.

Parameters:
  • map – The map being accessed.

  • not_found – A value to be returned to indicate the map is empty.

Returns:

The first key, or a zero key if no element exists.


MAP_VTYPE_KTYPE map_type_from_array(MEM_SCOPE scope, KVP_VTYPE_KTYPE *array, size_t len, size_t slots, int (*pkcmp)(KTYPE k1, KTYPE k2))

Create a new map from an array of key value pairs.

Remark

Maps cannot be created by a simple array of values since a key is required for each value. This function requires a key value pair array. A key value pair is a struct with a key member and a value member.

See also

struct kvp_vtype_ktype, map_vname_kname_create().

Parameters:
  • scope – A memory scope.

  • array – A key value pair array.

  • len – The number of elements in the array.

  • slots – The number of slots in the hash array.

  • pkcmp – A comparison function for keys to determine a match on find.

Returns:

A MAP_VTYPE_KTYPE that maybe used in subsequent map calls.


VTYPE map_type_get(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE not_found)

Get an element in a map by key.

Remark

Get does not affect any currency established with map_vname_kname_first and map_vname_kname_next.

Remark

The function behaves identically to map_vname_kname_find() and is provided for consistency.

See also

map_vname_kname_set(), map_vname_kname_find().

Parameters:
  • map – The map being accessed.

  • key – The element key.

  • not_found – A value to be returned to indicate the item was not found.

Returns:

The element found by the given key, or ‘not_found’ if not found.


int map_type_insert(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE item)

Insert an element into a map.

Parameters:
  • map – The map being accessed.

  • key – The key of the element being inserted.

  • item – The element to insert.

Returns:

TRUE if the item was inserted or FALSE if the key already exists.


KTYPE map_type_next(MAP_VTYPE_KTYPE map, KTYPE not_found)

Get the next key in the map.

Parameters:
  • map – The map being accessed.

  • not_found – A value to be returned to indicate there are no more keys.

Returns:

The next key, or a zero key if no more elements exist.


VTYPE map_type_remove(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE not_found)

Remove the element with the given key from a map.

Parameters:
  • map – The map being accessed.

  • key – The key of the element to remove.

  • not_found – A value to be returned to indicate the item was not found.

Returns:

The element being removed, or zero if not found.


void map_type_set(MAP_VTYPE_KTYPE map, KTYPE key, VTYPE item)

Set an element in a map by key.

Remark

Set does not affect any currency established with map_vname_kname_first and map_vname_kname_next.

See also

map_vname_kname_get().

Parameters:
  • map – The map being accessed.

  • key – The element key.

  • item – The element to set.


KTYPE *map_type_to_key_array(MAP_VTYPE_KTYPE map, KTYPE not_found)

Create an array of map keys.

Remark

The not_found value is often NULL or 0, but may be any key value.

Remark

This function may not perform well if there are many elements.

See also

to_value_array().

Parameters:
  • map – The map being accessed.

  • not_found – A key value to be used to terminate the array.

Returns:

An array of all keys in the map with an appended _stack.


VTYPE *map_type_to_value_array(MAP_VTYPE_KTYPE map, VTYPE not_found)

Create an array of map values.

Remark

The not_found value is often NULL or 0, but may be any key value.

Remark

The array elements will be in no particular order.

Remark

This function may not perform well if there are many elements.

Parameters:
  • map – The map being accessed.

  • not_found – A value to be used to terminate the array.

Returns:

An array of all values in the map with an appended _stack.


MAP_VTYPE_KTYPE map_type_where_key(MAP_VTYPE_KTYPE map, int (*func)(KTYPE, KTYPE), KTYPE arg)

Create a new map by filtering the keys of a map using supplied criteria.

Remark

This function uses the supplied comparison function to test each element key in turn and adds to the new map only if the function returns TRUE.

Remark

This function may not perform well if there are many elements.

Parameters:
  • map – The map being accessed.

  • func – A comparison function used to test each element key in the map.

  • arg – The argument to supply for the test function.

Returns:

A new map with the filtered elements.


MAP_VTYPE_KTYPE map_type_where_value(MAP_VTYPE_KTYPE map, int (*func)(VTYPE, VTYPE), VTYPE arg)

Create a new map by filtering the values of a map using supplied criteria.

Remark

This function uses the supplied comparison function to test each element value in turn and adds to the new map only if the function returns TRUE.

Remark

This function may not perform well if there are many elements.

Parameters:
  • map – The map being accessed.

  • func – A comparison function used to test each element value in the map.

  • arg – The argument to supply for the test function.

Returns:

A new map with the filtered elements.


Stack

Template Generation

Declarations File:

stack-decl.h

Implementation File:

stack-impl-c.h

Parameters

TYPE:

The type of element contained.

NAME:

The disambiguating name element used in function name definitions

UNAME:

The disambiguating name element used in data type declarations

Examples

#define TYPE double
#define NAME double
#define UNAME DOUBLE
...
STACK_DOUBLE vp = stack_double_create(mem, 10);
stack_double_append(vp, 1.2345);

Data Types

typedef struct stack_type *STACK_TYPE

A STACK_TYPE abstract data type.


Functions

size_t stack_type_count(STACK_TYPE stack)

Count the number of elements in the stack.

Parameters:

stack – The stack being accessed.

Returns:

The number of elements in the stack.


STACK_TYPE stack_type_create(MEM_SCOPE scope, size_t capacity)

Create a new stack.

Remark

The capacity is the number of elements that can be appended before the stack is expanded. If more elements are pushed the stack is automatically expanded.

Parameters:
  • scope – A memory scope.

  • capacity – The initial number of elements in the stack.

Returns:

A STACK_TYPE that maybe used in subsequent stack calls, and to allocate memory.


TYPE stack_type_peek(STACK_TYPE stack, TYPE not_found)

Peek the next element on the stack without removing it.

Parameters:
  • stack – The stack being accessed.

  • not_found – A value to be returned to indicate nothing to peek.

Returns:

The next element that would be popped off the stack, or zero if the stack is empty.


TYPE stack_type_pop(STACK_TYPE stack, TYPE not_found)

Pop the next element off the stack.

Remark

Pop takes the most recently pushed element from the stack.

Parameters:
  • stack – The stack being accessed.

  • not_found – A value to be returned to indicate nothing to pop.

Returns:

The element popped off the stack, or zero if the stack is empty.


void stack_type_push(STACK_TYPE stack, TYPE item)

Push an element onto the stack.

Parameters:
  • stack – The stack being accessed.

  • item – The element to push onto the stack.


Queue

Template Generation

Declarations File:

queue-decl.h

Implementation File:

queue-impl-c.h

Parameters

TYPE:

The type of element contained.

NAME:

The disambiguating name element used in function name definitions

UNAME:

The disambiguating name element used in data type declarations

Examples

#define TYPE long
#define NAME llong
#define UNAME LLONG
...
QUEUE_LLONG *lp = queue_llong_create(mem);
queue_llong_append(lp, 0xFFFFEEEE11112222L);

Data Types

typedef struct queue_type *QUEUE_TYPE

A QUEUE abstract data type.


Functions

size_t queue_type_count(QUEUE_TYPE queue)

Count the number of elements in the queue.

Parameters:

queue – The queue being accessed.

Returns:

The number of elements in the queue.


QUEUE_TYPE queue_type_create(MEM_SCOPE scope)

Create a new queue.

Parameters:

scope – A memory scope.

Returns:

A QUEUE_TYPE that maybe used in subsequent queue calls.


TYPE queue_type_peek(QUEUE_TYPE queue, TYPE not_found)

Peek the next element on the queue without removing it.

Parameters:
  • queue – The queue being accessed.

  • not_found – A value to be returned if the queue is empty.

Returns:

The next element that would be popped off the queue, or zero if the queue is empty.


TYPE queue_type_pop(QUEUE_TYPE queue, TYPE not_found)

Pop the next element off the queue.

Remark

Pop returns the earliest pushed element from the queue.

Parameters:
  • queue – The queue being accessed.

  • not_found – A value to be returned if the queue is empty.

Returns:

The element popped off the queue, or zero if the queue is empty.


void queue_type_push(QUEUE_TYPE queue, TYPE item)

Push an element onto the queue.

Parameters:
  • queue – The queue being accessed.

  • item – The element to push onto the queue.


Miscellaneous

Arrays

int array_type_contains(TYPE *array, size_t len, TYPE item)

Check if a standard C array contains an element.

Remark

This function uses a basic equality test, so may not work as expected for complex types, including char *.

Remark

This function uses a simple linear search so may not perform well.

Parameters:
  • array – The array to check.

  • len – The length of the array.

  • item – The item to check for.

Returns:

TRUE if the item is found, FALSE if not.


Atoms

Atoms can be used to force strings to be unique. Uniqueness may be scoped or global. Atomising is not a thread safe operation.


ATOM atom_create(MEM_SCOPE mem, int slots)

Create an ATOM scope for atom storage.

Parameters:
  • mem – The memory scope to contain all atoms.

  • slots – The number of slots in the hash table.

Returns:

An ATOM scope.


const char *atom_str(ATOM atom, const char *str)

Atomise a string, IE make unique, within the given ATOM scope.

Remark

An atom string is unique, and guaranteed to have the same pointer address for identical string content, within the same ATOM scope.

Parameters:
  • atom – The ATOM scope for string uniqueness.

  • str – The string to atomise.

Returns:

A string ATOM.


const char *atom(const char *str)

Save a string as a global atom.

Remark

An atom string is globally unique, and guaranteed to have the same pointer address for identical string content.

Parameters:

str – The string to atomise.

Returns:

An atom for the given string.

Comparison

Comparison can be templated, but comparison of complex types is unlikely to yield sensible functions. Common types are included in the library.


int cmp_type(TYPE v1, TYPE v2)

Compare two items.

Parameters:
  • v1 – First item.

  • v2 – Second item.

Returns:

0 if the items are equal, 1 if the first is greater than the second and -1 if the first item is less than the second.


int less_than_type(TYPE v1, TYPE v2)

Tests if an item is less than another item.

Parameters:
  • v1 – The item.

  • v2 – The other item.

Returns:

TRUE if the item is less than the other item, FALSE otherwise.


int greater_than_type(TYPE v1, TYPE v2)

Tests if an item is greater than another item.

Parameters:
  • v1 – The item.

  • v2 – The other item.

Returns:

TRUE if the item is greater than the other item, FALSE otherwise.


int equals_type(TYPE v1, TYPE v2)

Tests if an item equals another item.

Parameters:
  • v1 – The item.

  • v2 – The other item.

Returns:

TRUE if the item is equal to the other item, FALSE otherwise.